| | |
| | | |
| | | public Tween leaderSequence; |
| | | private int leaderPosIndex = -1; //监工已达移动点 |
| | | private int state = 0; //0 站岗(不显示) 1 前进 2 空手返程 3 货物返程(不中断) |
| | | |
| | | int tendID; |
| | | GoldRushPosEvent[] leaderPathPointArr; //监工移动点 |
| | | |
| | | Action<bool> OnComplete; |
| | | public Action<bool> OnComplete; |
| | | public bool forcrCallBack; |
| | | |
| | | public void Init(GoldRushPosEvent[] _leaderPathPointArr, float waitTime, int _tendID, int index, bool isBack, Action<bool> _OnComplete) |
| | | public void Init(GoldRushPosEvent[] _leaderPathPointArr, float waitTime, int _tendID, int index, bool isBack, |
| | | Action<bool> _OnComplete) |
| | | { |
| | | tendID = _tendID; |
| | | leaderPathPointArr = _leaderPathPointArr; |
| | | leaderPosIndex = !isBack ? -1: leaderPathPointArr.Length - 1; |
| | | state = 0; |
| | | leaderPosIndex = !isBack ? -1 : leaderPathPointArr.Length - 1; |
| | | leaderWord.Stop(); |
| | | leaderWord.SetEndState(); |
| | | // goods.SetActive(isBack); |
| | |
| | | |
| | | Vector3 nextPos = leaderPathPointArr[moveIndex].transform.localPosition; |
| | | if (isBack) |
| | | { |
| | | leader.PlayAnimation("run_xiangzi", true, false); |
| | | { |
| | | if (forcrCallBack) |
| | | { |
| | | leader.PlayAnimation("run", true, false); |
| | | } |
| | | else |
| | | { |
| | | leader.PlayAnimation("run_xiangzi", true, false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | leaderWord.SetActive(true); |
| | | leaderWord.Play(); |
| | | leaderText.text = Language.Get(pathPosEvent.m_Text1); |
| | | leaderText.text = Language.Get(!pathPosEvent.m_IsRandom ? pathPosEvent.m_Text1 : |
| | | pathPosEvent.m_Text1 + UnityEngine.Random.Range((int)pathPosEvent.m_Value1, (int)pathPosEvent.m_Value2 + 1)); |
| | | ForceRefreshLayout(); |
| | | } |
| | | else if (pathPosEvent.m_PosEvent == PosEvent.TargetWord) |
| | | { |
| | |
| | | for (int i = 0; i < GoldRushManager.followWorkerCount; i++) |
| | | { |
| | | GoldRushManager.Instance.NotifyPathEvent(pathPosEvent.m_PosEvent, isBack, tendID, i, |
| | | pathPosEvent.m_Text1 + UnityEngine.Random.Range((int)pathPosEvent.m_Value1, (int)pathPosEvent.m_Value2)); |
| | | pathPosEvent.m_Text1 + UnityEngine.Random.Range((int)pathPosEvent.m_Value1, (int)pathPosEvent.m_Value2 + 1)); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 强制刷新Layout,解决嵌套Layout和ContentSizeFitter的重叠问题 |
| | | /// </summary> |
| | | async UniTask ForceRefreshLayout() |
| | | { |
| | | await UniTask.DelayFrame(2); |
| | | LayoutRebuilder.ForceRebuildLayoutImmediate(leaderWord.GetComponent<RectTransform>()); |
| | | } |
| | | } |
| | | |