【UI重构】分离UI和Monobehaviour
parent
903940df7f
commit
ad4596058d
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
public void PushWindow(UIWindow window)
|
||||
{
|
||||
if (window)
|
||||
if (window != null)
|
||||
{
|
||||
if (_uiWindowStack.Contains(window))
|
||||
{
|
||||
|
|
@ -171,7 +171,7 @@
|
|||
public static async UniTask NormalCloseWindow(UIWindow hideWindow, String showWindowStr, Object data = null)
|
||||
{
|
||||
var window = Instance.PopWindow();
|
||||
if (!window)
|
||||
if (window == null)
|
||||
{
|
||||
hideWindow.OnBack();
|
||||
return;
|
||||
|
|
@ -182,7 +182,7 @@
|
|||
public static async UniTask NormalCloseWindow(UIWindow hideWindow, Object data = null)
|
||||
{
|
||||
var showWindow = Instance.PopWindow();
|
||||
if (!showWindow)
|
||||
if (showWindow == null)
|
||||
{
|
||||
hideWindow.OnBack();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Framework;
|
|||
using PhxhSDK;
|
||||
using UnityEngine;
|
||||
|
||||
public partial class UIManager : Singlenton<UIManager>, IInitable
|
||||
public partial class UIManager : Singlenton<UIManager>, IInitable, IUpdatable
|
||||
{
|
||||
public const string UI_PREFAB_PATH = "Assets/Art/UI/Prefab/{0}.prefab";
|
||||
|
||||
|
|
@ -42,6 +42,30 @@ public partial class UIManager : Singlenton<UIManager>, IInitable
|
|||
EventManager.Instance.Unregister(EventManager.EventName.ClearUIStack, (Action<string[]>)ClearHideStack);
|
||||
}
|
||||
|
||||
public void Update(float dt)
|
||||
{
|
||||
foreach (var winKv in mMemoryWindows)
|
||||
{
|
||||
var window = winKv.Value;
|
||||
if (window.IsOpen() && window.gameObject)
|
||||
{
|
||||
window.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region UIWindow Manager
|
||||
|
||||
public static void BindWindowObj(UIWindow window, GameObject uiObj)
|
||||
{
|
||||
window.gameObject = uiObj.gameObject;
|
||||
window.transform = uiObj.transform;
|
||||
window.rectTransform = uiObj.GetComponent<RectTransform>();
|
||||
window.name = uiObj.name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenWindowAPI
|
||||
/// <summary>
|
||||
/// 打开一个UI
|
||||
|
|
@ -52,7 +76,7 @@ public partial class UIManager : Singlenton<UIManager>, IInitable
|
|||
public async UniTask<UIWindow> OpenWindow(string path, object data = null)
|
||||
{
|
||||
var window = await _LoadWindow(path, true);
|
||||
if (window)
|
||||
if (window != null)
|
||||
{
|
||||
if (window.uiWindowLayer == UIWindowLayer.Normal)
|
||||
{
|
||||
|
|
@ -105,7 +129,7 @@ public partial class UIManager : Singlenton<UIManager>, IInitable
|
|||
public void CloseWindow(string wName, UIWindowCloseType closeType = UIWindowCloseType.HideAndDestroy)
|
||||
{
|
||||
var window = GetOpenedWindowByPath<UIWindow>(wName);
|
||||
if (window)
|
||||
if (window != null)
|
||||
{
|
||||
window.CloseWindow(closeType);
|
||||
}
|
||||
|
|
@ -297,7 +321,7 @@ public partial class UIManager : Singlenton<UIManager>, IInitable
|
|||
|
||||
LayerListInsertWindow(window);
|
||||
|
||||
if (!window)
|
||||
if (window == null)
|
||||
{
|
||||
DebugUtil.LogError("Create ui fail: {0}", uipath);
|
||||
return null;
|
||||
|
|
@ -519,21 +543,21 @@ public partial class UIManager : Singlenton<UIManager>, IInitable
|
|||
private async void _OnAndroidClickBack()
|
||||
{
|
||||
var window = GetTopWindowInLayer(UIWindowLayer.Tips);
|
||||
if (window)
|
||||
if (window != null)
|
||||
{
|
||||
await window.OnBack();
|
||||
return;
|
||||
}
|
||||
|
||||
window = GetTopWindowInLayer(UIWindowLayer.ForeGround);
|
||||
if (window)
|
||||
if (window!= null)
|
||||
{
|
||||
await window.OnBack();
|
||||
return;
|
||||
}
|
||||
|
||||
window = GetTopWindowInLayer(UIWindowLayer.Normal);
|
||||
if (window)
|
||||
if (window!= null)
|
||||
{
|
||||
await window.OnBack();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,11 @@ public partial class UIRoot : SingletonMono<UIRoot>
|
|||
GameObject obj = Instantiate(uiPrefab, Root.transform, false) as GameObject;
|
||||
string[] dirs = windowName.Split('/');
|
||||
string className = dirs[dirs.Length - 1] + "Controller";
|
||||
window = obj.AddComponent(CommonUtilsFramework.GamePlayAssembly.GetType(className)) as UIWindow;
|
||||
|
||||
//window = obj.AddComponent(CommonUtilsFramework.GamePlayAssembly.GetType(className)) as UIWindow;
|
||||
window = CommonUtilsFramework.GamePlayAssembly.CreateInstance(className) as UIWindow;
|
||||
UIManager.BindWindowObj(window, obj);
|
||||
|
||||
if (window == null)
|
||||
{
|
||||
DebugUtil.LogError("Cant find UIWindow: {0}, check the name or remove any outter namespace.", className);
|
||||
|
|
|
|||
|
|
@ -8,14 +8,22 @@ using UnityEngine.UI;
|
|||
using UnityEngine.Serialization;
|
||||
using Object = System.Object;
|
||||
|
||||
public abstract class UIWindow : MonoBehaviour
|
||||
public abstract class UIWindow
|
||||
{
|
||||
public GameObject gameObject;
|
||||
public Transform transform;
|
||||
public RectTransform rectTransform;
|
||||
public string name;
|
||||
|
||||
|
||||
private const string DEFAULT_SHOW_ANIM = "show";
|
||||
private const string DEFAULT_HIDE_ANIM = "hide";
|
||||
private string mWindowName;
|
||||
private ScreenOrientation _lastOrientation;
|
||||
private Vector2 _offsets; //x,y代表左右的偏移量
|
||||
|
||||
private bool _isNeedScreenAdaption;
|
||||
|
||||
// 是否播放默认的打开对话框的声音
|
||||
public bool isPlayDefaultOpenAudio = true;
|
||||
// 是否播放默认的关闭对话框的声音
|
||||
|
|
@ -35,21 +43,17 @@ public abstract class UIWindow : MonoBehaviour
|
|||
|
||||
private bool _isHideAndPush = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
//OnInit();
|
||||
}
|
||||
|
||||
protected void OnStart()
|
||||
protected void RegisterScreenAdaption()
|
||||
{
|
||||
_lastOrientation = Screen.orientation;
|
||||
InitScreenUIOffset();
|
||||
UpdateScreenAdaption();
|
||||
_isNeedScreenAdaption = true;
|
||||
}
|
||||
|
||||
protected void OnUpdate()
|
||||
protected virtual void OnUpdate()
|
||||
{
|
||||
if (_lastOrientation != Screen.orientation)
|
||||
if (_isNeedScreenAdaption && _lastOrientation != Screen.orientation)
|
||||
{
|
||||
//Debug.Log("Screen orientation has changed!");
|
||||
// Add your orientation-specific actions here
|
||||
|
|
@ -63,6 +67,45 @@ public abstract class UIWindow : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
OnUpdate();
|
||||
}
|
||||
|
||||
#region MonoBehaviour Methods Override
|
||||
|
||||
protected void Destroy(GameObject obj)
|
||||
{
|
||||
UnityEngine.Object.Destroy(obj);
|
||||
}
|
||||
|
||||
protected void DestroyImmediate(GameObject obj)
|
||||
{
|
||||
UnityEngine.Object.DestroyImmediate(obj);
|
||||
}
|
||||
|
||||
protected void Destroy(Component cmp)
|
||||
{
|
||||
UnityEngine.Object.Destroy(cmp);
|
||||
}
|
||||
|
||||
protected void DestroyImmediate(Component cmp)
|
||||
{
|
||||
UnityEngine.Object.DestroyImmediate(cmp);
|
||||
}
|
||||
|
||||
protected GameObject Instantiate(GameObject prefab)
|
||||
{
|
||||
return UnityEngine.Object.Instantiate(prefab, transform);
|
||||
}
|
||||
|
||||
protected GameObject Instantiate(GameObject prefab, Transform trans)
|
||||
{
|
||||
return UnityEngine.Object.Instantiate(prefab, trans);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region #ScreenAdaption
|
||||
/// <summary>
|
||||
/// 屏幕适配,目前方案是左右固定名称的节点下的各个物体需要适配,其他的不管
|
||||
|
|
@ -152,7 +195,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
}
|
||||
|
||||
_OnClose();
|
||||
Destroy();
|
||||
DestroyWindow();
|
||||
UIManager.Instance.RemoveWindow(mWindowName);
|
||||
}
|
||||
else if(closeType == UIWindowCloseType.OnlyHide)
|
||||
|
|
@ -167,7 +210,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
else
|
||||
{
|
||||
//强制清除所有界面时使用
|
||||
Destroy();
|
||||
DestroyWindow();
|
||||
UIManager.Instance.RemoveWindow(mWindowName);
|
||||
}
|
||||
}
|
||||
|
|
@ -175,7 +218,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
public virtual async UniTask<bool> OnBack(object data = null)
|
||||
{
|
||||
var window = UIManager.Instance.PopWindow();
|
||||
if (!window)
|
||||
if (window == null)
|
||||
{
|
||||
CloseWindow(UIWindowCloseType.HideAndDestroy);
|
||||
return true;
|
||||
|
|
@ -250,7 +293,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
{
|
||||
var window = UIManager.Instance.GetLastFullScreen();
|
||||
|
||||
if (window && window != this)
|
||||
if (window != null && window != this)
|
||||
{
|
||||
if (UIManager.Instance.CheckIsWindowInStack(this))
|
||||
{
|
||||
|
|
@ -274,7 +317,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void Destroy()
|
||||
private void DestroyWindow()
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
|
|
@ -282,7 +325,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
OnRelease();
|
||||
}
|
||||
isOpen = false;
|
||||
Destroy(gameObject);
|
||||
UnityEngine.Object.Destroy(gameObject);
|
||||
AssetManager.Instance.Unload(string.Format(UIManager.UI_PREFAB_PATH, mWindowName));
|
||||
}
|
||||
|
||||
|
|
@ -502,7 +545,7 @@ public abstract class UIWindow : MonoBehaviour
|
|||
return obj;
|
||||
}
|
||||
|
||||
public T GetComponent<T>(string path) where T : Behaviour
|
||||
public T GetComponent<T>(string path = "") where T : Behaviour
|
||||
{
|
||||
var component = transform.Find(path)?.GetComponent<T>();
|
||||
if (component == null)
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace Gameplay.Story.Cmp.Impl
|
|||
|
||||
public void LoadUIMainStory(UIStoryMainController cmp)
|
||||
{
|
||||
if (!_uiStoryMain)
|
||||
if (_uiStoryMain == null)
|
||||
{
|
||||
_uiStoryMain = cmp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace Gameplay.Story.Cmp.Other
|
|||
if (!StoryManager.IsEditor)
|
||||
{
|
||||
var uiCmp = StoryManager.instance.uiManager.UIStoryMain;
|
||||
if (uiCmp)
|
||||
if (uiCmp != null)
|
||||
{
|
||||
uiCmp.Handle(sendData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class UIFightSceneController : UIWindow
|
|||
EventManager.Instance.Register(EventManager.EventName.LevelFightUIHPInit, (Action<GameUnit>)OnHPInit);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (!LevelManager.Instance.CurrentLevel.IsInBattle())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ public class UI_StartBtn_CMSBtnController : UIWindow{
|
|||
_skillNodeArray[i] = node;
|
||||
node.BindWindow(this);
|
||||
node.OnAwake();
|
||||
|
||||
RegisterScreenAdaption();
|
||||
}
|
||||
|
||||
_skillNodesAnim = GetComponent<Animator>("UI_LiuHaiRight/UICommandSkill");
|
||||
|
|
@ -107,14 +109,9 @@ public class UI_StartBtn_CMSBtnController : UIWindow{
|
|||
SetNodesData();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
OnStart();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
OnUpdate();
|
||||
base.OnUpdate();
|
||||
|
||||
UpdateNodes();
|
||||
|
||||
|
|
|
|||
|
|
@ -91,8 +91,9 @@ public class UI_LoadingController : UIWindow
|
|||
}
|
||||
float refreshTime = 3f;
|
||||
float nowTime = 0;
|
||||
void Update()
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
//base.OnUpdate();
|
||||
if (nowTime >= refreshTime)
|
||||
{
|
||||
nowTime = 0;
|
||||
|
|
@ -185,7 +186,8 @@ public class UI_LoadingController : UIWindow
|
|||
}
|
||||
public void StartLoading(Action onEnd)
|
||||
{
|
||||
enabled = true;
|
||||
//enabled = true;
|
||||
OnShowWindow();
|
||||
displayProgress = 0;
|
||||
Image_ProcessBar.fillAmount = 0f;
|
||||
Text_Process.text = 0+"%";
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class UI_LogInController : UIWindow
|
|||
CommonUtils.GetComponent<TMP_Text>(TipsObj, "label").text = obj;
|
||||
|
||||
IEnumerator coroutine = waitTime();
|
||||
StartCoroutine(coroutine);
|
||||
//StartCoroutine(coroutine);
|
||||
}
|
||||
private IEnumerator waitTime()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using NLDPB;
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
using TMPro;
|
||||
|
|
@ -205,7 +206,7 @@ public class UIAdvanceController : UIWindow
|
|||
GetComponent<TMP_Text>("Image_BG/UI_RankLevel/Text_RankLevel01/fixvalue01").text = CommonUtils.GetLocalizeText(oriCfg.Name);
|
||||
|
||||
}
|
||||
private void OnCharacterLevelup(UpgradeType type)
|
||||
private async void OnCharacterLevelup(UpgradeType type)
|
||||
{
|
||||
if (type != UpgradeType.UtAwake)
|
||||
{
|
||||
|
|
@ -222,8 +223,9 @@ public class UIAdvanceController : UIWindow
|
|||
RefreshBreakLvUpBtn();
|
||||
RefreshFirstLogo();
|
||||
PlayLightFx();
|
||||
coroutine1 = waitTimeForFx();
|
||||
StartCoroutine(coroutine1);
|
||||
await WaitTimeForFx();
|
||||
//StartCoroutine(coroutine1);
|
||||
|
||||
}
|
||||
private void RefreshFirstLogo()
|
||||
{
|
||||
|
|
@ -234,14 +236,18 @@ public class UIAdvanceController : UIWindow
|
|||
});
|
||||
|
||||
}
|
||||
private IEnumerator waitTimeForFx()
|
||||
private async UniTask WaitTimeForFx()
|
||||
{
|
||||
yield return new WaitForSeconds(0.8f);
|
||||
await UniTask.Delay(800);
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MoveLogos();
|
||||
PlayChangeAnimation();
|
||||
|
||||
coroutine = WaitTimeRefresh();
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefresh();
|
||||
//StartCoroutine(coroutine);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -253,13 +259,13 @@ public class UIAdvanceController : UIWindow
|
|||
}
|
||||
private void ResetFlagPosition()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
for (int i = 0; i < Constants.ADVANCE_FLAG_UI; i++)
|
||||
{
|
||||
allIconObj[i].transform.localPosition = new Vector3(191-85*i, 50-17*i, 0);
|
||||
}
|
||||
}
|
||||
private void PlayChangeAnimation()
|
||||
private async void PlayChangeAnimation()
|
||||
{
|
||||
if (IsMaxLevel())
|
||||
{
|
||||
|
|
@ -275,14 +281,18 @@ public class UIAdvanceController : UIWindow
|
|||
|
||||
mAnimator.Play("Advance SkillInfo_Change", 0, 0f);
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimator, "Advance SkillInfo_Change");
|
||||
coroutine = WaitTimeRefresh(waitTime);
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefresh(waitTime);
|
||||
//StartCoroutine(coroutine);
|
||||
}
|
||||
|
||||
}
|
||||
private IEnumerator WaitTimeRefresh(float waitTime)
|
||||
private async UniTask WaitTimeRefresh(float waitTime)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
await UniTask.Delay((int)(waitTime * 1000));
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mAnimator.Play("Advance SkillInfo_Change", 0, 0f);
|
||||
mAnimator.speed = 0;
|
||||
RefreshSkill();
|
||||
|
|
@ -303,12 +313,15 @@ public class UIAdvanceController : UIWindow
|
|||
|
||||
}
|
||||
|
||||
private IEnumerator WaitTimeRefresh()
|
||||
private async UniTask WaitTimeRefresh()
|
||||
{
|
||||
yield return new WaitForSeconds(0.8f);
|
||||
await UniTask.Delay(800);
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MoveLogosBack();
|
||||
RefreshAdvanceLogo();
|
||||
|
||||
}
|
||||
private void MoveLogos()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Gameplay.Net;
|
|||
using NLDPB;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
using TMPro;
|
||||
|
|
@ -140,7 +141,7 @@ public class UIRankController : UIWindow
|
|||
{
|
||||
return;
|
||||
}
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
mCharacterDataInfo = CharacterDataInfoManager.Instance.GetCharacterInfo(mCharacterDataInfo.ID);
|
||||
mTargetLevel = (int)mCharacterDataInfo.BreakLevel + 1;
|
||||
RefreshFxValue();
|
||||
|
|
@ -171,7 +172,7 @@ public class UIRankController : UIWindow
|
|||
|
||||
private IEnumerator coroutine;
|
||||
|
||||
private void PlayChangeAnimation()
|
||||
private async void PlayChangeAnimation()
|
||||
{
|
||||
if(IsMaxLevel())
|
||||
{
|
||||
|
|
@ -186,14 +187,14 @@ public class UIRankController : UIWindow
|
|||
|
||||
mAnimator.Play("RankInfo_Change",0,0f);
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimator, "RankInfo_Change");
|
||||
coroutine = WaitTimeRefresh(waitTime);
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefresh(waitTime);
|
||||
//StartCoroutine(coroutine);
|
||||
}
|
||||
|
||||
}
|
||||
private IEnumerator coroutine1;
|
||||
|
||||
private void PlayLightFx()
|
||||
private async void PlayLightFx()
|
||||
{
|
||||
var breaklv = (int)mCharacterDataInfo.BreakLevel;
|
||||
if(breaklv>Constants.ADVANCE_FLAG_UI)
|
||||
|
|
@ -204,22 +205,22 @@ public class UIRankController : UIWindow
|
|||
tempObj.SetActive(true);
|
||||
tempObj.GetComponent<ParticleSystem>().Play();
|
||||
|
||||
coroutine1 = WaitTimeRefreshRect(1,breaklv);
|
||||
StartCoroutine(coroutine1);
|
||||
await WaitTimeRefreshRect(1,breaklv);
|
||||
//4(coroutine1);
|
||||
}
|
||||
|
||||
private IEnumerator WaitTimeRefreshRect(int v,int breaklv)
|
||||
private async UniTask WaitTimeRefreshRect(int v,int breaklv)
|
||||
{
|
||||
yield return new WaitForSeconds(v);
|
||||
await UniTask.Delay(v * 1000);
|
||||
MoveLightRect(mTargetLevel);
|
||||
RefreshFlag();
|
||||
FindObj(string.Format("Image_BG/Image_RankPic_Bg/{0}/RankLevel", (breaklv).ToString())).SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator WaitTimeRefresh(float waitTime)
|
||||
private async UniTask WaitTimeRefresh(float waitTime)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
await UniTask.Delay((int)waitTime * 1000);
|
||||
mAnimator.Play("RankInfo_Change",0,0f);
|
||||
mAnimator.speed=0;
|
||||
RefreshSkill();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using PhxhSDK;
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
|
|
@ -124,7 +125,7 @@ public class UISkill_LevelUpController : UIWindow
|
|||
}
|
||||
private IEnumerator coroutine;
|
||||
|
||||
private void OnCharacterLevelup(NLDPB.UpgradeType type)
|
||||
private async void OnCharacterLevelup(NLDPB.UpgradeType type)
|
||||
{
|
||||
if (type != NLDPB.UpgradeType.UtUltraSkill)
|
||||
{
|
||||
|
|
@ -139,8 +140,8 @@ public class UISkill_LevelUpController : UIWindow
|
|||
maxSkill.SetActive(true);
|
||||
PlayAnimation("Skill_LevelUp_Max");
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimatior, "Skill_LevelUp_Max");
|
||||
coroutine = WaitTimeRefreshMax(waitTime);
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefreshMax(waitTime);
|
||||
//StartCoroutine(coroutine);
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -148,8 +149,8 @@ public class UISkill_LevelUpController : UIWindow
|
|||
RefresMaxSkill();
|
||||
PlayAnimation("Skill_LevelUp_01");
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimatior, "Skill_LevelUp_01");
|
||||
coroutine = WaitTimeRefresh(waitTime);
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefresh(waitTime);
|
||||
//StartCoroutine(coroutine);
|
||||
RefreshUI();
|
||||
|
||||
}
|
||||
|
|
@ -164,9 +165,9 @@ public class UISkill_LevelUpController : UIWindow
|
|||
mAnimatior.enabled = false;
|
||||
|
||||
}
|
||||
private IEnumerator WaitTimeRefreshMax(float time)
|
||||
private async UniTask WaitTimeRefreshMax(float time)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
await UniTask.Delay((int)(time * 1000));
|
||||
//RefreshUI();
|
||||
RefreshBaseInfo();
|
||||
|
||||
|
|
@ -182,19 +183,19 @@ public class UISkill_LevelUpController : UIWindow
|
|||
mAnimatior.enabled = true;
|
||||
mAnimatior.Play(aniName,0,0);
|
||||
}
|
||||
private IEnumerator WaitTimeRefresh(float time)
|
||||
private async UniTask WaitTimeRefresh(float time)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
await UniTask.Delay((int)(time * 1000));
|
||||
RefreshUI();
|
||||
PlayAnimation("Skill_LevelUp_02");
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimatior, "Skill_LevelUp_02");
|
||||
coroutine = WaitTimeRefresh2(waitTime);
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefresh2(waitTime);
|
||||
//StartCoroutine(coroutine);
|
||||
|
||||
}
|
||||
private IEnumerator WaitTimeRefresh2(float time)
|
||||
private async UniTask WaitTimeRefresh2(float time)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
await UniTask.Delay((int)(time * 1000));
|
||||
ResetAnimator();
|
||||
|
||||
}
|
||||
|
|
@ -415,7 +416,7 @@ public class UISkill_LevelUpController : UIWindow
|
|||
protected override void OnHideWindow()
|
||||
{
|
||||
EventManager.Instance.Send(EventManager.EventName.EN_UIControllCultivateMainInput, true);
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using NLDPB;
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
using TMPro;
|
||||
|
|
@ -271,7 +272,7 @@ public class UI_CultivateController : UIWindow
|
|||
|
||||
}
|
||||
|
||||
private void PlayFx()
|
||||
private async void PlayFx()
|
||||
{
|
||||
PlayAnimation(GetComponent<Animator>(("Image_CultivateBG")), "MainDefault Animation");
|
||||
PlayAnimation(GetComponent<Animator>(), "Line And Document Animation");
|
||||
|
|
@ -283,14 +284,18 @@ public class UI_CultivateController : UIWindow
|
|||
UI_Cultivate_ActSkObj.SetActive(false);
|
||||
FindObj("Image_BG/Image_GroupLogo/Image_NameInfo").SetActive(false);
|
||||
|
||||
_coroutine = WaitTimeForFx();
|
||||
StartCoroutine(_coroutine);
|
||||
await WaitTimeForFx();
|
||||
//StartCoroutine(_coroutine);
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator WaitTimeForFx()
|
||||
private async UniTask WaitTimeForFx()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
await UniTask.Delay(1000);
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
OpenLeftChildUI(mCurLeftUICharacterType);
|
||||
|
||||
UI_Cultivate_LevelObj.SetActive(true);
|
||||
|
|
@ -474,7 +479,7 @@ public class UI_CultivateController : UIWindow
|
|||
{
|
||||
ControllInput(false);
|
||||
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
}
|
||||
|
||||
public override void OnRelease()
|
||||
|
|
@ -485,7 +490,7 @@ public class UI_CultivateController : UIWindow
|
|||
}
|
||||
|
||||
float sumTime = 0;
|
||||
void Update()
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (!IsCanChange)
|
||||
{
|
||||
|
|
@ -867,15 +872,15 @@ public class UI_CultivateController : UIWindow
|
|||
|
||||
|
||||
|
||||
private void OnButton_RightArrowsClick()
|
||||
private async void OnButton_RightArrowsClick()
|
||||
{
|
||||
int nowIndex = ReturnCorrectCharacterIndex(mCurIndex + 1);
|
||||
mCurIndex = nowIndex;
|
||||
RefreshCurCharacterDataInfo(mCurIndex);
|
||||
RefreshChildUIForLeft();
|
||||
PlayChangeOutAnimation();
|
||||
_coroutine = RefreshAfterAniChangeOut();
|
||||
StartCoroutine(_coroutine);
|
||||
await RefreshAfterAniChangeOut();
|
||||
//StartCoroutine(_coroutine);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -894,21 +899,25 @@ public class UI_CultivateController : UIWindow
|
|||
}
|
||||
private IEnumerator _coroutine;
|
||||
|
||||
private void OnButton_LeftArrowsClick()
|
||||
private async void OnButton_LeftArrowsClick()
|
||||
{
|
||||
int nowIndex = ReturnCorrectCharacterIndex(mCurIndex - 1);
|
||||
mCurIndex = nowIndex;
|
||||
RefreshCurCharacterDataInfo(mCurIndex);
|
||||
RefreshChildUIForLeft();
|
||||
PlayChangeOutAnimation();
|
||||
_coroutine = RefreshAfterAniChangeOut();
|
||||
StartCoroutine(_coroutine);
|
||||
await RefreshAfterAniChangeOut();
|
||||
//StartCoroutine(_coroutine);
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator RefreshAfterAniChangeOut()
|
||||
private async UniTask RefreshAfterAniChangeOut()
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
await UniTask.Delay(500);
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RefreshMiddle();
|
||||
RefreshRight();
|
||||
PlayChangeInAnimation();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using NLDPB;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Gameplay;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
|
@ -90,17 +91,9 @@ public class UI_Cultivate_DetailController : UIWindow
|
|||
mAnimator = GetComponent<Animator>();
|
||||
|
||||
RegisterEvent();
|
||||
RegisterScreenAdaption();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
OnStart();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
OnUpdate();
|
||||
}
|
||||
|
||||
|
||||
private void RegisterEvent()
|
||||
{
|
||||
|
|
@ -140,20 +133,24 @@ public class UI_Cultivate_DetailController : UIWindow
|
|||
}
|
||||
private IEnumerator _coroutine;
|
||||
|
||||
public void RefreshOnChangePlay(CharacterDataInfo data)
|
||||
public async void RefreshOnChangePlay(CharacterDataInfo data)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
SetCharacterInfo(data as CharacterDataInfo);
|
||||
RefreshInfos();
|
||||
PlayAnimation("DetailChangeOut");
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimator, "DetailChangeOut");
|
||||
_coroutine = WaitTimeRefresh(waitTime);
|
||||
StartCoroutine(_coroutine);
|
||||
await WaitTimeRefresh(waitTime);
|
||||
//StartCoroutine(_coroutine);
|
||||
}
|
||||
|
||||
private IEnumerator WaitTimeRefresh(float waitTime)
|
||||
private async UniTask WaitTimeRefresh(float waitTime)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
await UniTask.Delay((int)(waitTime * 1000));
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RefreshInfos();
|
||||
|
||||
PlayAnimation("DetailChangeIn");
|
||||
|
|
@ -183,7 +180,7 @@ public class UI_Cultivate_DetailController : UIWindow
|
|||
//invoke when close window
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
}
|
||||
|
||||
public override void OnRelease()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using Framework;
|
|||
using NLDPB;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Gameplay;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
|
@ -102,16 +103,8 @@ public class UI_Cultivate_ProAndInfoController : UIWindow
|
|||
BindButton(Button_Property, OnButton_Property);
|
||||
LoadCfg();
|
||||
mAnimator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
OnStart();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
OnUpdate();
|
||||
|
||||
RegisterScreenAdaption();
|
||||
}
|
||||
|
||||
private void RegisterEvent()
|
||||
|
|
@ -120,23 +113,27 @@ public class UI_Cultivate_ProAndInfoController : UIWindow
|
|||
}
|
||||
private IEnumerator coroutine;
|
||||
|
||||
public void RefreshOnChangePlay(CharacterDataInfo info)
|
||||
public async void RefreshOnChangePlay(CharacterDataInfo info)
|
||||
{
|
||||
if (this.gameObject.activeSelf == true)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
SetCharacterInfo(info as CharacterDataInfo);
|
||||
PlayAnimation("ProAndInfo_ChangeOut");
|
||||
float waitTime = PhxhSDK.Utils.GetAnimatorLength(mAnimator, "ProAndInfo_ChangeOut");
|
||||
coroutine = WaitTimeRefresh(waitTime);
|
||||
StartCoroutine(coroutine);
|
||||
await WaitTimeRefresh(waitTime);
|
||||
//StartCoroutine(coroutine);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator WaitTimeRefresh(float waitTime)
|
||||
private async UniTask WaitTimeRefresh(float waitTime)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
await UniTask.Delay((int)(waitTime * 1000));
|
||||
if (!gameObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RefreshBasicInfo();
|
||||
RefreshFavorableInfo();
|
||||
PlayAnimation("ProAndInfo_ChangeIn");
|
||||
|
|
@ -226,6 +223,6 @@ public class UI_Cultivate_ProAndInfoController : UIWindow
|
|||
protected override void OnHideWindow()
|
||||
{
|
||||
UnRegisterEvent();
|
||||
StopAllCoroutines();
|
||||
//StopAllCoroutines();
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ public class UITipsManager
|
|||
_tipInfo = new TipInfo(++_tipID, curTipWindow);
|
||||
|
||||
await UniTask.Delay(1500);
|
||||
if (curTipWindow)
|
||||
if (curTipWindow != null)
|
||||
{
|
||||
curTipWindow.CloseWindow();
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ public class UITipsManager
|
|||
|
||||
public static async void ShowConfirmOne(string title, string desc, Delegate func)
|
||||
{
|
||||
if (!_oneConfirm)
|
||||
if (_oneConfirm == null)
|
||||
{
|
||||
_oneConfirm = await UIManager.Instance.OpenWindow(UINameConst.UINoticeOne, new UINoticeOneController.Data()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class UI_BeforeFightController : UIWindow
|
|||
{
|
||||
_rawImage.enabled = false;
|
||||
await TeamEditManager.Instance.LoadTeamPreviewNode(_currTeamIndex, UINameConst.UI_BeforeFight);
|
||||
if (this)
|
||||
if (this.IsOpen())
|
||||
{
|
||||
_rawImage.enabled = true;
|
||||
var previewNode = TeamEditManager.Instance.TeamPreviewNode;
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ public class UI_MainPanelController: UIWindow
|
|||
BindButton(Button_Unknown, _OnClickTask);
|
||||
BindButton(Button_Camera, OnCameraClick);
|
||||
cameraGoList = new List<GameObject>();
|
||||
|
||||
RegisterScreenAdaption();
|
||||
}
|
||||
|
||||
private async void OnStoreBtnClick()
|
||||
|
|
@ -152,11 +154,6 @@ public class UI_MainPanelController: UIWindow
|
|||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
OnStart();
|
||||
}
|
||||
|
||||
private async void OnButton_VehicleClickAsync()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_VehicleChoose);
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ public class UI_VehicleChooseController : UIWindow
|
|||
// var window = UIManager.Instance.PopWindow();
|
||||
// await UIManager.AnimSwitchWindow(this, UIWindowCloseType.HideAndDestroy, window);
|
||||
// window.ReloadWindow(_curTeam);
|
||||
CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue