Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
3
3D Fruit
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanqing
3D Fruit
Commits
3c1dfe10
Commit
3c1dfe10
authored
May 07, 2021
by
wanqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改场景切换逻辑
parent
03d4743f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
67 deletions
+61
-67
BattleCtrl.cs
3D Fruit/Assets/#A2_Scripts/Battle/BattleCtrl.cs
+2
-2
BattleUI.cs
3D Fruit/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
+14
-11
LevelManager.cs
3D Fruit/Assets/#A2_Scripts/Level/LevelManager.cs
+0
-4
SelectLevelCtrl.cs
3D Fruit/Assets/#A2_Scripts/Level/SelectLevelCtrl.cs
+44
-49
BattleUI.prefab
3D Fruit/Assets/#A3_Prefabs/BattleUI.prefab
+1
-1
No files found.
3D Fruit/Assets/#A2_Scripts/Battle/BattleCtrl.cs
View file @
3c1dfe10
...
...
@@ -124,7 +124,7 @@ public class BattleCtrl : MonoBehaviour
public
void
OnBattleWin
()
{
_IsEndBattle
=
true
;
battleUI
.
OnBattleWin
();
//
battleUI.OnBattleWin();
//int varCurTime = (int)levelManager.curLevel.bestTime;
//if(LocalRecord.HasKey(levelManager.CurLevelIndex.ToString()))
//{
...
...
@@ -152,7 +152,7 @@ public class BattleCtrl : MonoBehaviour
{
LocalRecord
.
SetIntRecord
(
levelManager
.
CurLevelIndex
.
ToString
(),
varCurStar
);
}
Invoke
(
"DelayChangeToSelectScene"
,
3
.0f
);
Invoke
(
"DelayChangeToSelectScene"
,
2
.0f
);
}
//延迟切换场景
...
...
3D Fruit/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
View file @
3c1dfe10
...
...
@@ -68,6 +68,7 @@ public class BattleUI : MonoBehaviour
public
Action
onFieldNearBtn
;
public
Action
onClawMoveSpeedAddBtn
;
public
Action
onClawMoveSpeedDownBtn
;
public
Action
onNextBtn
;
//private Text m_ShowOrHideMouseText;//显示或隐藏手指text
private
int
m_mouseIndex
=
0
;
//点击次数
...
...
@@ -117,7 +118,7 @@ public class BattleUI : MonoBehaviour
private
void
Start
()
{
m_boomBtn
.
interactable
=
false
;
BattleCtrl
.
instance
.
levelManager
.
selectLevel
.
onMoveFinish
=
StartFade
;
BattleCtrl
.
instance
.
levelManager
.
selectLevel
.
onMoveFinish
=
MoveFinish
;
}
void
SetDragMode
()
{
...
...
@@ -145,7 +146,8 @@ public class BattleUI : MonoBehaviour
public
void
NextLevel
()
{
m_successObj
.
SetActive
(
false
);
BattleCtrl
.
instance
.
levelManager
.
LoadNextLevel
();
//BattleCtrl.instance.levelManager.LoadNextLevel();
onNextBtn
?.
Invoke
();
}
//选择关卡
void
SelectLevel
()
...
...
@@ -162,6 +164,11 @@ public class BattleUI : MonoBehaviour
m_startLogoObj
.
SetActive
(
false
);
//SetBattleObjState(true);
//SettingBtnState(false);
m_bSelectToMain
=
true
;
m_bMainToSelect
=
false
;
m_bfadeState
=
false
;
m_startIndex
++;
}
//设置
void
SettingBtn
()
...
...
@@ -229,7 +236,7 @@ public class BattleUI : MonoBehaviour
//胜利
public
void
OnBattleWin
()
{
Invoke
(
"DelayWin"
,
1.0
f
);
Invoke
(
"DelayWin"
,
0.2
f
);
//string varKey = BattleCtrl.instance.levelManager.CurLevelIndex.ToString();
//if (LocalRecord.HasKey(varKey))
//{
...
...
@@ -617,12 +624,10 @@ public class BattleUI : MonoBehaviour
m_goodText
.
gameObject
.
SetActive
(
true
);
}
}
void
StartFade
()
void
MoveFinish
()
{
m_bSelectToMain
=
true
;
m_bMainToSelect
=
false
;
m_bfadeState
=
false
;
m_startIndex
++;
m_startBtn
.
gameObject
.
SetActive
(
true
);
m_startLogoObj
.
SetActive
(
true
);
}
//从主场景换到选择关卡界面
public
void
ChangeMainToSelectScene
()
...
...
@@ -681,9 +686,6 @@ public class BattleUI : MonoBehaviour
{
m_bfadeState
=
true
;
m_fadeAlpha
=
1f
;
m_startBtn
.
gameObject
.
SetActive
(
true
);
m_startLogoObj
.
SetActive
(
true
);
m_successObj
.
SetActive
(
false
);
SetBattleObjState
(
false
);
SettingBtnState
(
true
);
GlobalConfig
.
SetActiveFruitState
(
false
);
...
...
@@ -698,6 +700,7 @@ public class BattleUI : MonoBehaviour
{
m_fadeAlpha
=
0.0f
;
m_bMainToSelect
=
false
;
OnBattleWin
();
}
}
}
...
...
3D Fruit/Assets/#A2_Scripts/Level/LevelManager.cs
View file @
3c1dfe10
...
...
@@ -136,10 +136,6 @@ public class LevelManager : MonoBehaviour
{
m_selectLevel
.
BackToScene
();
}
else
{
m_selectLevel
.
ShowEffect
();
}
}
//隐藏当前关卡
public
void
HideCurLevel
()
...
...
3D Fruit/Assets/#A2_Scripts/Level/SelectLevelCtrl.cs
View file @
3c1dfe10
...
...
@@ -22,6 +22,7 @@ public class SelectLevelCtrl : MonoBehaviour
private
string
m_idle3
=
"TK_idle3"
;
private
string
m_walk
=
"TK_walk1"
;
private
Sequence
m_sq
;
public
Action
onMoveFinish
;
// Start is called before the first frame update
...
...
@@ -37,78 +38,62 @@ public class SelectLevelCtrl : MonoBehaviour
m_girlStartPos
=
m_girlTrans
.
position
;
m_girlStartRotation
=
m_girlTrans
.
rotation
;
BattleCtrl
.
instance
.
battleUI
.
on
StartBtn
+=
StartRotate
;
BattleCtrl
.
instance
.
battleUI
.
on
NextBtn
+=
NextStart
;
}
void
StartRotate
()
void
NextStart
()
{
m_effectObj
.
SetActive
(
false
);
if
(
BattleCtrl
.
instance
.
levelManager
.
curLevel
)
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelOneIndex
)
{
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelOneIndex
)
{
m_boyTrans
.
DORotateQuaternion
(
Quaternion
.
Euler
(
0
,
90
,
0
),
0.5f
).
onComplete
=
delegate
()
{
StartMove
();
};
}
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_girlTrans
.
DORotateQuaternion
(
Quaternion
.
Euler
(
0
,
90
,
0
),
0.5f
).
onComplete
=
delegate
()
{
StartMove
();
};
}
m_girlTrans
.
DORotateQuaternion
(
Quaternion
.
Euler
(
0
,
90
,
0
),
0.5f
).
onComplete
=
delegate
()
{
StartMove
();
};
}
else
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_
girl
Trans
.
DORotateQuaternion
(
Quaternion
.
Euler
(
0
,
90
,
0
),
0.5f
).
onComplete
=
delegate
()
{
m_
boy
Trans
.
DORotateQuaternion
(
Quaternion
.
Euler
(
0
,
90
,
0
),
0.5f
).
onComplete
=
delegate
()
{
StartMove
();
};
}
}
void
StartMove
()
{
if
(
BattleCtrl
.
instance
.
levelManager
.
curLevel
)
m_girlAni
.
Play
(
m_walk
);
m_boyAni
.
Play
(
m_walk
);
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelOneIndex
)
{
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelOneIndex
)
{
m_boyAni
.
Play
(
m_walk
);
m_boyTrans
.
DOMoveX
(
0.5f
,
2.0f
).
onComplete
=
delegate
()
{
onMoveFinish
?.
Invoke
();
};
}
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_girlAni
.
Play
(
m_walk
);
m_girlTrans
.
DOMoveX
(
0.5f
,
2.0f
).
onComplete
=
delegate
()
{
onMoveFinish
?.
Invoke
();
};
}
m_sq
=
DOTween
.
Sequence
();
m_sq
.
Append
(
m_girlTrans
.
DOMoveX
(
0.5f
,
2.0f
));
m_sq
.
Join
(
m_boyTrans
.
DOMove
(
m_girlStartPos
,
2.0f
));
m_sq
.
AppendCallback
(
MoveFinish
);
}
else
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_
girlAni
.
Play
(
m_walk
);
m_
girlTrans
.
DOMoveX
(
0.5f
,
2.0f
).
onComplete
=
delegate
()
{
onMoveFinish
?.
Invoke
(
);
}
;
m_
sq
=
DOTween
.
Sequence
(
);
m_
sq
.
Append
(
m_boyTrans
.
DOMoveX
(
0.5f
,
2.0f
));
m_sq
.
Join
(
m_girlTrans
.
DOMove
(
m_girlStartPos
,
2.0f
)
);
m_sq
.
AppendCallback
(
MoveFinish
)
;
}
}
//
显示特效
public
void
ShowEffect
()
//
走完后
void
MoveFinish
()
{
m_effectObj
.
SetActive
(
true
);
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelOneIndex
)
{
m_boyAni
.
Play
(
m_idle3
);
}
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_girlAni
.
Play
(
m_idle3
);
}
onMoveFinish
?.
Invoke
();
}
//回到选择场景
public
void
BackToScene
()
{
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelOneIndex
)
{
m_boyTrans
.
position
=
m_girlStartPos
;
m_boyTrans
.
rotation
=
m_girlStartRotation
;
m_girlTrans
.
position
=
m_boyStartPos
;
m_girlTrans
.
rotation
=
m_boyStartRotation
;
m_boyAni
.
Play
(
m_idle3
);
m_girlAni
.
Play
(
m_idle1
);
}
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_boyTrans
.
position
=
m_boyStartPos
;
m_boyTrans
.
rotation
=
m_boyStartRotation
;
...
...
@@ -117,12 +102,22 @@ public class SelectLevelCtrl : MonoBehaviour
m_boyAni
.
Play
(
m_idle1
);
m_girlAni
.
Play
(
m_idle3
);
}
else
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelTwoIndex
)
{
m_boyTrans
.
position
=
m_girlStartPos
;
m_boyTrans
.
rotation
=
m_girlStartRotation
;
m_girlTrans
.
position
=
m_boyStartPos
;
m_girlTrans
.
rotation
=
m_boyStartRotation
;
m_boyAni
.
Play
(
m_idle3
);
m_girlAni
.
Play
(
m_idle1
);
}
}
private
void
OnDestroy
()
{
if
(
BattleCtrl
.
instance
.
battleUI
)
{
BattleCtrl
.
instance
.
battleUI
.
on
StartBtn
-=
StartRotate
;
BattleCtrl
.
instance
.
battleUI
.
on
NextBtn
-=
NextStart
;
}
m_sq
.
Kill
();
}
}
3D Fruit/Assets/#A3_Prefabs/BattleUI.prefab
View file @
3c1dfe10
...
...
@@ -13746,7 +13746,7 @@ GameObject:
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
0
m_IsActive
:
1
---
!u!224
&6064464677757260073
RectTransform
:
m_ObjectHideFlags
:
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment