推力增加,基础滚动
This commit is contained in:
parent
3cf3f70328
commit
2692da2c04
File diff suppressed because one or more lines are too long
@ -26,19 +26,26 @@ namespace GameLogic
|
|||||||
m_tmpAllValue = FindChildComponent<TextMeshProUGUI>("Mid/m_imgValue/m_rectCar/m_tmpAllValue");
|
m_tmpAllValue = FindChildComponent<TextMeshProUGUI>("Mid/m_imgValue/m_rectCar/m_tmpAllValue");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
public int m_Index;
|
|
||||||
|
|
||||||
private long m_AllScore;
|
public int m_Index;
|
||||||
|
private List<UnitPlayerData> m_ListUnitPlayDatas = new List<UnitPlayerData>();
|
||||||
|
|
||||||
|
private int m_AddPush = 0; // 初始推力值
|
||||||
|
private long m_AllPush = 0; // 当前总值
|
||||||
|
private int m_AllAddPush = 0;//永久增加推力值
|
||||||
|
|
||||||
protected override void OnCreate()
|
protected override void OnCreate()
|
||||||
{
|
{
|
||||||
base.OnCreate();
|
base.OnCreate();
|
||||||
|
|
||||||
|
|
||||||
|
GameModule.Timer.AddTimer(TimerHandler, 0.1f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TimerHandler(object[] e)
|
||||||
protected override void OnUpdate()
|
|
||||||
{
|
{
|
||||||
base.OnUpdate();
|
AddMyPush();
|
||||||
|
RefreshUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnInit(int i)
|
public void OnInit(int i)
|
||||||
@ -51,14 +58,67 @@ namespace GameLogic
|
|||||||
m_imgSign.sprite = GameModule.Resource.LoadAsset<Sprite>("zjm_mz_" + assetsId);
|
m_imgSign.sprite = GameModule.Resource.LoadAsset<Sprite>("zjm_mz_" + assetsId);
|
||||||
m_imgValue.sprite = GameModule.Resource.LoadAsset<Sprite>("zjm_jdt_" + assetsId);
|
m_imgValue.sprite = GameModule.Resource.LoadAsset<Sprite>("zjm_jdt_" + assetsId);
|
||||||
m_tmpSign.text = DataGameSceneManager.Instance.m_Strs[i];
|
m_tmpSign.text = DataGameSceneManager.Instance.m_Strs[i];
|
||||||
m_tmpAllValue.text = m_AllScore.ToString();
|
m_tmpAllValue.text = m_AllPush.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void AddPlayer(UnitPlayerData data)
|
||||||
|
{
|
||||||
|
data.teamId = m_Index;
|
||||||
|
m_ListUnitPlayDatas.Add(data);
|
||||||
|
m_AddPush++;
|
||||||
|
}
|
||||||
|
|
||||||
public long GetAllPower()
|
public long GetAllPower()
|
||||||
{
|
{
|
||||||
return m_AllScore;
|
return m_AllPush;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddMyPush()
|
||||||
|
{
|
||||||
|
m_AllPush += m_AddPush;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshUI()
|
||||||
|
{
|
||||||
|
m_tmpAllValue.text = m_AllPush.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateScale(long m_AllPush)
|
||||||
|
{
|
||||||
|
// 避免除0
|
||||||
|
if (m_AllPush == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//// 基于当前总值,计算自己scale大小
|
||||||
|
//var results = this.m_AllPush / (float)m_AllPush;
|
||||||
|
|
||||||
|
//// 求出实际值
|
||||||
|
//// var s = EventConts.MaxActorScale * results;
|
||||||
|
//var s = results * EventConts.actorScaleConst + sclaeAdd;
|
||||||
|
|
||||||
|
//if (s < EventConts.MinActorScale)
|
||||||
|
//{
|
||||||
|
// s = EventConts.MinActorScale;
|
||||||
|
//}
|
||||||
|
//else if (s >= EventConts.MaxActorScale)
|
||||||
|
//{
|
||||||
|
// s = EventConts.MaxActorScale;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// 每次都更新
|
||||||
|
|
||||||
|
//// 两者相差值超过
|
||||||
|
//if (Mathf.Abs(this.m_Go.transform.localScale.x - s) > 0.05f)
|
||||||
|
//{
|
||||||
|
// m_OldScale = s;
|
||||||
|
// this.m_Go.transform.DOScale(m_OldScale, 0.5f);
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace GameLogic
|
|||||||
|
|
||||||
public class UnitPlayerData
|
public class UnitPlayerData
|
||||||
{
|
{
|
||||||
public string teamId;
|
public int teamId;
|
||||||
public ProtCustMessageData protCustMessageData;
|
public ProtCustMessageData protCustMessageData;
|
||||||
public long m_Score; // 当局积分
|
public long m_Score; // 当局积分
|
||||||
public long m_AllWinCount;// 当局胜点
|
public long m_AllWinCount;// 当局胜点
|
||||||
|
@ -177,46 +177,15 @@ namespace GameLogic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 随机落座
|
int targetId = Random.Range(1, EventConts.MaxPlayerIds);
|
||||||
// if (EventConts.gameStateType == GameStateType.团队赛)
|
var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
||||||
// {
|
if (actor == null)
|
||||||
// int targetId = Random.Range(1, EventConts.MaxPlayerIds);
|
{
|
||||||
// var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
Log.Error("没有获取到实体玩家,tid = {0}", targetId);
|
||||||
// if (actor == null)
|
return;
|
||||||
// {
|
}
|
||||||
// Log.Error("没有获取到实体玩家,tid = {0}", targetId);
|
actor.AddPlayer(data);
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// actor.AddUnitPlayer(data);
|
|
||||||
// }
|
|
||||||
// else if (EventConts.gameStateType == GameStateType.个人赛)
|
|
||||||
// {
|
|
||||||
// var actor = DataGameSceneManager.Instance.GetTeamActor(data.teamId);
|
|
||||||
// if (actor == null)
|
|
||||||
// {
|
|
||||||
// actor = DataGameSceneManager.Instance.CraeteTeamActor(data);
|
|
||||||
// actor.AddUnitPlayer(data);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (data.teamId == "-1")
|
|
||||||
// {
|
|
||||||
// // 随机落座
|
|
||||||
// if (EventConts.gameStateType == GameStateType.团队赛)
|
|
||||||
// {
|
|
||||||
// int targetId = Random.Range(1, EventConts.MaxPlayerIds);
|
|
||||||
// var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
|
||||||
// if (actor == null)
|
|
||||||
// {
|
|
||||||
// Log.Error("没有获取到实体玩家,tid = {0}", targetId);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// actor.AddUnitPlayer(data);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var item in m_GiftIds)
|
foreach (var item in m_GiftIds)
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,8 @@ namespace GameLogic
|
|||||||
private Transform teamList;
|
private Transform teamList;
|
||||||
private Dictionary<string, UnitPlayerData> m_DicUnitPlayerDatas = new Dictionary<string, UnitPlayerData>(); //局内玩家数据
|
private Dictionary<string, UnitPlayerData> m_DicUnitPlayerDatas = new Dictionary<string, UnitPlayerData>(); //局内玩家数据
|
||||||
public List<ActorHItem> m_TeamSortList = new List<ActorHItem>(); // 用于排序的阵营列表数据
|
public List<ActorHItem> m_TeamSortList = new List<ActorHItem>(); // 用于排序的阵营列表数据
|
||||||
|
public Dictionary<string, ActorHItem> m_DicTeamList = new Dictionary<string, ActorHItem>();
|
||||||
|
|
||||||
public float m_GameTimerLen = 0;
|
public float m_GameTimerLen = 0;
|
||||||
public List<string> m_Strs = new List<string>() { "陈", "王", "李", "张", "刘", "杨", "黄", "赵", "吴", "周",
|
public List<string> m_Strs = new List<string>() { "陈", "王", "李", "张", "刘", "杨", "黄", "赵", "吴", "周",
|
||||||
"徐", "孙", "马", "朱", "胡","何","林","高","罗","郑",
|
"徐", "孙", "马", "朱", "胡","何","林","高","罗","郑",
|
||||||
@ -29,10 +31,6 @@ namespace GameLogic
|
|||||||
// 礼物特效
|
// 礼物特效
|
||||||
public List<GiftItemData> m_GiftItemDatas = new List<GiftItemData>();
|
public List<GiftItemData> m_GiftItemDatas = new List<GiftItemData>();
|
||||||
public MeshRenderer m_PanelBg;
|
public MeshRenderer m_PanelBg;
|
||||||
public GameObject m_SpeedEffect; // 全局加速特效
|
|
||||||
private float m_SpeefEffectTimer = 0; // 全局加速特效时长
|
|
||||||
public GameObject m_SnowEffect; // 全局减速特效
|
|
||||||
private float m_SnowEffectTimer = 0;// 全局减速特效时长
|
|
||||||
|
|
||||||
private int m_UpdateShowEmoTimer = -1;
|
private int m_UpdateShowEmoTimer = -1;
|
||||||
public void OnInit()
|
public void OnInit()
|
||||||
@ -58,8 +56,6 @@ namespace GameLogic
|
|||||||
private void FindGameComponent()
|
private void FindGameComponent()
|
||||||
{
|
{
|
||||||
teamList = GameObject.Find("TeamList").transform;
|
teamList = GameObject.Find("TeamList").transform;
|
||||||
m_SpeedEffect = GameObject.Find("Effect").transform.GetChild(0).gameObject;
|
|
||||||
m_SnowEffect = GameObject.Find("Effect").transform.GetChild(1).gameObject;
|
|
||||||
m_PanelBg = GameObject.Find("Plane").GetComponent<MeshRenderer>();
|
m_PanelBg = GameObject.Find("Plane").GetComponent<MeshRenderer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +104,7 @@ namespace GameLogic
|
|||||||
UnitPlayerData unitPlayerData = new UnitPlayerData()
|
UnitPlayerData unitPlayerData = new UnitPlayerData()
|
||||||
{
|
{
|
||||||
protCustMessageData = protCustMessageData,
|
protCustMessageData = protCustMessageData,
|
||||||
teamId = "-1"
|
teamId = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(protCustMessageData.imgURL))
|
if (string.IsNullOrEmpty(protCustMessageData.imgURL))
|
||||||
@ -501,8 +497,6 @@ namespace GameLogic
|
|||||||
m_DicUnitPlayerDatas.Clear();
|
m_DicUnitPlayerDatas.Clear();
|
||||||
m_VipItemDatas.Clear();
|
m_VipItemDatas.Clear();
|
||||||
m_GiftItemDatas.Clear();
|
m_GiftItemDatas.Clear();
|
||||||
m_SpeefEffectTimer = 0;
|
|
||||||
m_SnowEffectTimer = 0;
|
|
||||||
WinAllValue = 0;
|
WinAllValue = 0;
|
||||||
ScoreAllValue = 0;
|
ScoreAllValue = 0;
|
||||||
|
|
||||||
@ -521,6 +515,15 @@ namespace GameLogic
|
|||||||
GameEvent.Send(EventConts.RestGameBattle);
|
GameEvent.Send(EventConts.RestGameBattle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActorHItem GetTeamActor(string key)
|
||||||
|
{
|
||||||
|
if (!m_DicTeamList.ContainsKey(key))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return m_DicTeamList[key];
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@ -563,13 +566,6 @@ namespace GameLogic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SnowEffectTimer -= Time.deltaTime;
|
|
||||||
m_SpeefEffectTimer -= Time.deltaTime;
|
|
||||||
|
|
||||||
// 控制特效显示时长
|
|
||||||
m_SnowEffect.gameObject.SetActive(m_SnowEffectTimer > 0);
|
|
||||||
m_SpeedEffect.gameObject.SetActive(m_SpeefEffectTimer > 0);
|
|
||||||
|
|
||||||
// 减少游戏时长
|
// 减少游戏时长
|
||||||
m_GameTimerLen -= Time.deltaTime;
|
m_GameTimerLen -= Time.deltaTime;
|
||||||
|
|
||||||
@ -590,8 +586,6 @@ namespace GameLogic
|
|||||||
// 强制结束
|
// 强制结束
|
||||||
SetGameState(false);
|
SetGameState(false);
|
||||||
|
|
||||||
m_SpeedEffect.gameObject.SetActive(false);
|
|
||||||
m_SnowEffect.gameObject.SetActive(false);
|
|
||||||
|
|
||||||
WinAllValue = 0;
|
WinAllValue = 0;
|
||||||
ScoreAllValue = 0;
|
ScoreAllValue = 0;
|
||||||
@ -610,8 +604,6 @@ namespace GameLogic
|
|||||||
// m_TeamSortList.Clear();
|
// m_TeamSortList.Clear();
|
||||||
m_GiftItemDatas.Clear();
|
m_GiftItemDatas.Clear();
|
||||||
m_VipItemDatas.Clear();
|
m_VipItemDatas.Clear();
|
||||||
m_SpeefEffectTimer = 0;
|
|
||||||
m_SnowEffectTimer = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ namespace GameLogic
|
|||||||
r.anchoredPosition = new Vector2(0, 478 - i * (109 - 5f));
|
r.anchoredPosition = new Vector2(0, 478 - i * (109 - 5f));
|
||||||
r.localPosition = new Vector3(r.localPosition.x, r.localPosition.y, 0);
|
r.localPosition = new Vector3(r.localPosition.x, r.localPosition.y, 0);
|
||||||
actorHItem.OnInit(i);
|
actorHItem.OnInit(i);
|
||||||
|
DataGameSceneManager.Instance.m_DicTeamList.Add((i + 1).ToString(), actorHItem);
|
||||||
DataGameSceneManager.Instance.m_TeamSortList.Add(actorHItem);
|
DataGameSceneManager.Instance.m_TeamSortList.Add(actorHItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,29 +19,29 @@ namespace GameLogic
|
|||||||
m_Run = transform.Find("Run").gameObject;
|
m_Run = transform.Find("Run").gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnInit(UnitPlayerData unitPlayerData)
|
//public void OnInit(UnitPlayerData unitPlayerData)
|
||||||
{
|
//{
|
||||||
m_Name.text = unitPlayerData.protCustMessageData.nickName;
|
// m_Name.text = unitPlayerData.protCustMessageData.nickName;
|
||||||
m_Run.transform.DOLocalMoveX(78, 1f);
|
// m_Run.transform.DOLocalMoveX(78, 1f);
|
||||||
if (EventConts.gameStateType == GameStateType.个人赛)
|
// if (EventConts.gameStateType == GameStateType.个人赛)
|
||||||
{
|
// {
|
||||||
m_Info.text = "加入玩法";
|
// m_Info.text = "加入玩法";
|
||||||
}
|
// }
|
||||||
else if (EventConts.gameStateType == GameStateType.团队赛)
|
// else if (EventConts.gameStateType == GameStateType.团队赛)
|
||||||
{
|
// {
|
||||||
m_Info.text = "加入" + DataGameSceneManager.Instance.GetStrs((int.Parse(unitPlayerData.teamId)));
|
// m_Info.text = "加入" + DataGameSceneManager.Instance.GetStrs((int.Parse(unitPlayerData.teamId)));
|
||||||
}
|
// }
|
||||||
|
|
||||||
transform.DOLocalMoveX(42, 0.25f).SetEase(Ease.Linear).OnComplete(async () =>
|
// transform.DOLocalMoveX(42, 0.25f).SetEase(Ease.Linear).OnComplete(async () =>
|
||||||
{
|
// {
|
||||||
await UniTask.Delay(2500);
|
// await UniTask.Delay(2500);
|
||||||
if (this != null && this.gameObject != null && transform.parent != null)
|
// if (this != null && this.gameObject != null && transform.parent != null)
|
||||||
{
|
// {
|
||||||
Destroy(gameObject);
|
// Destroy(gameObject);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user