Commit e2fd5710 authored by czy's avatar czy

UI优化和得分bug修改

parent e426b9f4
......@@ -3979,6 +3979,76 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 605753004, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 605753004, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchoredPosition.y
value: 176
objectReference: {fileID: 0}
- target: {fileID: 605753004, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_SizeDelta.x
value: 339.4073
objectReference: {fileID: 0}
- target: {fileID: 605753004, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_SizeDelta.y
value: 187.38428
objectReference: {fileID: 0}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_FontData.m_BestFit
value: 1
objectReference: {fileID: 0}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_FontData.m_MaxSize
value: 94
objectReference: {fileID: 0}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_FontData.m_Alignment
value: 4
objectReference: {fileID: 0}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_FontData.m_Font
value:
objectReference: {fileID: 12800000, guid: 8bcb1e4d602e26044bd1dca9f775fa10,
type: 3}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 605753005, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 767122296, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1338799328, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchoredPosition.y
value: 468
objectReference: {fileID: 0}
- target: {fileID: 1338799328, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_SizeDelta.x
value: 150.00436
objectReference: {fileID: 0}
- target: {fileID: 1338799328, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_SizeDelta.y
value: 150.00436
objectReference: {fileID: 0}
- target: {fileID: 1338799328, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchoredPosition.x
value: 194
objectReference: {fileID: 0}
- target: {fileID: 6064464676328073066, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6064464677632144689, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_Name
......@@ -4089,6 +4159,26 @@ PrefabInstance:
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7582286918531672244, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8583335472386491063, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8583335472386491063, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8583335472386491063, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
--- !u!114 &6165904641102012439 stripped
......@@ -4110,22 +4200,17 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 186647395}
m_Modifications:
- target: {fileID: 606498650832925584, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 641092551534534229, guid: 6cc70e2d845becb45a2f0b3462de70dd,
- target: {fileID: 618264746694878637, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 1732029372708412899, guid: 6cc70e2d845becb45a2f0b3462de70dd,
- target: {fileID: 2122666457885329229, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 2388897092943699901, guid: 6cc70e2d845becb45a2f0b3462de70dd,
- target: {fileID: 2693210503429464793, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
......@@ -4195,17 +4280,22 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4730664731052113124, guid: 6cc70e2d845becb45a2f0b3462de70dd,
- target: {fileID: 5640535757844518538, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 6300376379442780280, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 7128402308403862055, guid: 6cc70e2d845becb45a2f0b3462de70dd,
- target: {fileID: 7456138430773547321, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 7724240737156392718, guid: 6cc70e2d845becb45a2f0b3462de70dd,
- target: {fileID: 8984240033196200468, guid: 6cc70e2d845becb45a2f0b3462de70dd,
type: 3}
propertyPath: m_Mesh
value:
......@@ -4319,15 +4409,5 @@ PrefabInstance:
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 9084503724270250775, guid: e808ab909854dca4dba20c69399d6a13,
type: 3}
propertyPath: m_text
value: x8
objectReference: {fileID: 0}
- target: {fileID: 9084503724270250775, guid: e808ab909854dca4dba20c69399d6a13,
type: 3}
propertyPath: m_textInfo.characterCount
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e808ab909854dca4dba20c69399d6a13, type: 3}
......@@ -85,15 +85,9 @@ public class BattleCtrl : MonoBehaviour
void Start()
{
battleUI.onStartBtn += StartBattle;
turnNextLevel += UpdateTargetScore;
UpdateTargetScore();
}
public void UpdateTargetScore()
{
targetScore = Score * Magnification;
}
void InitServices()
......@@ -277,7 +271,6 @@ public class BattleCtrl : MonoBehaviour
m_levelManager.onBeforeLoadLevel -= OnBeforeLoadLevel;
m_levelManager.onAfterLoadLevel -= OnAfterLoadLevel;
battleUI.onStartBtn -= StartBattle;
turnNextLevel -= UpdateTargetScore;
//battleUI.onStartBtn = null;
_GameServices.OnDisponse();
_GameServices = null;
......
......@@ -152,6 +152,10 @@ public class BattleUI : MonoBehaviour
// 进入下一关卡
public void NextLevelBtnDown()
{
print("点击NextButton:"+ BattleCtrl.instance.Score+" "+BattleCtrl.instance.targetScore);
BattleCtrl.instance.Score = BattleCtrl.instance.targetScore;
BattleCtrl.instance.updateScore?.Invoke();
print(""+ BattleCtrl.instance.Score);
BattleCtrl.instance.turnNextLevel?.Invoke();
}
public void NextLevel()
......
......@@ -130,12 +130,7 @@ public class AIMove : MonoBehaviour
{
if(SpeedLevel < MaxSpeedLevel)
{
SpeedLevel += 1;
BattleCtrl.instance.Score++;
BattleCtrl.instance.updateScore?.Invoke();
ChangeModel();
}
other.gameObject.GetComponentInChildren<Gold>().PlayParticle();//吃金币特效
......
......@@ -4,11 +4,13 @@ using UnityEngine;
public class PurseImage : MonoBehaviour
{
private RectTransform recTransform;
private float Speed = 5f;
private Vector3 beginPos;
private Vector3 targetPos;
private int targetScoreNumber;
private RectTransform recTransform; //钱包的RectTransform
private float Speed = 5f; //控制钱包的移动速度
private Vector3 beginPos; //钱包原来的位置
private Vector3 targetPos; //目标分数
private float WaitTime = 2;
private float timer = 0;
void Start()
{
recTransform = GetComponent<RectTransform>();
......@@ -24,10 +26,11 @@ public class PurseImage : MonoBehaviour
if (BattleCtrl.instance.isEndBattle)
{
//游戏结束,钱袋移动到屏幕中心
recTransform.localPosition = Vector3.Lerp(recTransform.localPosition, targetPos, Speed * Time.deltaTime);
//recTransform.localPosition=Camera.main.ScreenToViewportPoint(Vector3.one * 0.5f);
if(Vector3.Distance(recTransform.localPosition, targetPos) < 10)
{
//开始更新分数。
print(BattleCtrl.instance.Score+"--"+BattleCtrl.instance.targetScore);
BattleCtrl.instance.Score = (int)Mathf.Lerp(BattleCtrl.instance.Score, BattleCtrl.instance.targetScore, 5f*Time.deltaTime);
BattleCtrl.instance.updateScore?.Invoke();
......@@ -37,8 +40,19 @@ public class PurseImage : MonoBehaviour
BattleCtrl.instance.Score = BattleCtrl.instance.targetScore;
BattleCtrl.instance.updateScore?.Invoke();
//进入下一关
print("进入下一关");
BattleCtrl.instance.turnNextLevel?.Invoke();
timer += Time.deltaTime;
if (timer >= WaitTime)
{
timer = 0;
if (BattleCtrl.instance.IsWin)
{
//胜利自动进入下一关。
print("进入下一关");
BattleCtrl.instance.turnNextLevel?.Invoke();
}
}
}
......
......@@ -337,6 +337,8 @@ public class PlayerMove : MonoBehaviour
{
//print("滑行结束");
BattleCtrl.instance.ExitScoreSettlementStatus();
//获取滑行倍率
Physics.Raycast(transform.position, -transform.up, out hit, 30);
//print(hit.collider.name);
if (hit.collider.gameObject.GetComponent<TextMeshPro>() == null)
......@@ -348,7 +350,7 @@ public class PlayerMove : MonoBehaviour
string magnificationStr = hit.collider.gameObject.GetComponent<TextMeshPro>().text.Replace("x", "");
BattleCtrl.instance.Magnification = Convert.ToInt32(magnificationStr);
}
BattleCtrl.instance.UpdateTargetScore();
BattleCtrl.instance.targetScore = BattleCtrl.instance.Score * BattleCtrl.instance.Magnification;
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment