using System; using System.Collections; using System.Collections.Generic; using MoleMole.Config; using UnityEngine; using UnityEngine.UI; namespace MoleMole { public class InLevelMainPageContext : BasePageContext { public enum InLevelMainPageShowState { Show = 0, Hide = 1, Changing = 2 } private const int COUNT_DOWN_TEXT_WARNING_SECOND = 10; private const int MIN_SP_DISPLAY_TEXT_INT_VALUE = 2; private const float _localAvatarHPWarningRatio = 0.3f; private const float _maxHurtWarningRatio = 2f; private const float _minHurtWarningRatio = 0.5f; private MonoComboText _comboText; private MonoHPDisplayText _hpDisplayText; private MonoSPDisplayText _spDisplayText; private Text _timeCountDownText; private Text _addTimeText; private Text _timerText; private Animation _mainPageFadeAnim; private InLevelMainPageShowState _showState; private Transform _buttonOverHeatPlugin; public Dictionary skillButtonDict; public MonoAvatarButtonContainer avatarButtonContainer; private float _tutorialDelayInputTime = 0.5f; private float _hurtRatio; private LocalAvatarHealthMode _healthMode; private bool _pauseDialogShown; private bool _pauseBtnEnable = true; private bool _hasShowTeamBuff; private bool _isOverheat; private float _overheatRatio; public bool PauseBtnEnabled { get { return _pauseBtnEnable; } set { _pauseBtnEnable = value; } } public InLevelMainPageContext(GameObject view = null) { config = new ContextPattern { contextName = "InLevelMainPageContext", viewPrefabPath = "UI/Menus/Page/InLevel/InLevelMainPage" }; base.view = view; skillButtonDict = new Dictionary(); } public override bool OnNotify(Notify ntf) { if (ntf.type == NotifyTypes.OnAvatarCreate) { return OnAvatarCreate((uint)ntf.body); } if (ntf.type == NotifyTypes.PostStageReady) { return PostStageReady(); } if (ntf.type == NotifyTypes.ShowDamegeText) { return ShowDamegeText((EvtBeingHit)ntf.body); } if (ntf.type == NotifyTypes.AttackLanded) { return OnAttackLandedNotify((EvtAttackLanded)ntf.body); } if (ntf.type == NotifyTypes.SetTimeCountDownText) { return SetTimeCountDownText((float)ntf.body); } if (ntf.type == NotifyTypes.SetTimesUpText) { return SetTimesUpText((string)ntf.body); } if (ntf.type == NotifyTypes.ShowAddTimeText) { return ShowAddTimeText((float)ntf.body); } if (ntf.type == NotifyTypes.SetDefendModeText) { return SetDefendModeText((string)ntf.body); } if (ntf.type == NotifyTypes.ShowDefendModeText) { return SetDefendModeTextEnable((bool)ntf.body); } if (ntf.type == NotifyTypes.SetTimeCountDownTextActive) { return SetTimeCountDownTextActive((bool)ntf.body); } if (ntf.type == NotifyTypes.ShowHelperCutIn) { return ShowHelperCutIn(); } if (ntf.type == NotifyTypes.DropItemConutChanged) { return SetDropItemCount((int)ntf.body); } if (ntf.type == NotifyTypes.ShowLevelDisplayText) { return ShowLevelDisplayText((string)ntf.body); } if (ntf.type == NotifyTypes.SetTimerText) { return SetTimerText((float)ntf.body); } if (ntf.type == NotifyTypes.SetupLocalAvatarStatus) { return SetupLocalAvatarStatus(ntf.body as AvatarActor); } if (ntf.type == NotifyTypes.TutorialPlayerTeaching) { return OnTutorialPlayerTeaching((LevelTutorialPlayerTeaching)ntf.body); } if (ntf.type == NotifyTypes.TutorialUltraAttack) { return OnTutorialUltraAttackNotify((LevelTutorialUltraAttack)ntf.body); } if (ntf.type == NotifyTypes.TutorialBranchAttack) { return OnTutorialBranchAttackNotify((LevelTutorialBranchAttack)ntf.body); } if (ntf.type == NotifyTypes.TutorialEliteAttack) { return OnTutorialEliteAttackNotify((LevelTutorialEliteAttack)ntf.body); } if (ntf.type == NotifyTypes.TutorialSwapAttack) { return OnTutorialSwapAttackNotify((LevelTutorialSwapAttack)ntf.body); } if (ntf.type == NotifyTypes.TutorialSwapAndRestrain) { return OnTutorialSwapAndRestrain((LevelTutorialSwapAndRestrain)ntf.body); } if (ntf.type == NotifyTypes.TutorialMonsterBlock) { return OnTutorialMonsterBlock((LevelTutorialMonsterBlock)ntf.body); } if (ntf.type == NotifyTypes.TutorialMonsterTeleport) { return OnTutorialMonsterTeleport((LevelTutorialMonsterTeleport)ntf.body); } if (ntf.type == NotifyTypes.TutorialNatureRestrain) { return OnTutorialNatureRestrain((LevelTutorialNatureRestrain)ntf.body); } if (ntf.type == NotifyTypes.TutorialMonsterShield) { return OnTutorialMonsterShield((LevelTutorialMonsterShield)ntf.body); } if (ntf.type == NotifyTypes.TutorialMonsterRobotDodge) { return OnTutorialMonsterRobotDodge((LevelTutorialMonsterRobotDodge)ntf.body); } if (ntf.type == NotifyTypes.EvadeBtnVisible) { return OnEvadeBtnVisibleControl((bool)ntf.body); } if (ntf.type == NotifyTypes.AttackBtnVisible) { return OnAttackBtnVisibleControl((bool)ntf.body); } if (ntf.type == NotifyTypes.JoystickVisible) { return OnJoystickVisibleControl((bool)ntf.body); } if (ntf.type == NotifyTypes.PauseBtnEnable) { return OnPauseBtnEnable((bool)ntf.body); } if (ntf.type == NotifyTypes.PauseBtnVisible) { return OnPauseBtnVisible((bool)ntf.body); } if (ntf.type == NotifyTypes.SwapBtnVisible) { return OnSwapBtnVisible((bool)ntf.body); } if (ntf.type == NotifyTypes.EcoModeVisible) { return OnEcoModeVisible((bool)ntf.body); } if (ntf.type == NotifyTypes.OnSocketConnect) { return OnSocketConnect(); } if (ntf.type == NotifyTypes.OnSocketDisconnect) { return OnSocketDisconnect(); } if (ntf.type == NotifyTypes.ResitComboClear) { return OnResistComboClear(); } if (ntf.type == NotifyTypes.OnQuitGameDialogShow) { return OnQuitGameDialogShow(); } if (ntf.type == NotifyTypes.OnQuitGameDialogDestroy) { return OnQuitGameDialogDestroy(); } if (ntf.type == NotifyTypes.BattleBegin) { return OnBattleBegin(); } if (ntf.type == NotifyTypes.LoadingSceneDestroyed) { return OnLoadingSceneDestroyed(); } return false; } public override void StartUp(Transform canvasTrans, Transform viewParent = null) { base.StartUp(canvasTrans, viewParent); _comboText.transform.localScale = Vector3.zero; LevelActor levelActor = Singleton.Instance.levelActor; levelActor.onLevelComboChanged = (Action)Delegate.Combine(levelActor.onLevelComboChanged, new Action(UpdateComboText)); } public override void Destroy() { LevelActor levelActor = Singleton.Instance.levelActor; levelActor.onLevelComboChanged = (Action)Delegate.Remove(levelActor.onLevelComboChanged, new Action(UpdateComboText)); base.Destroy(); } protected override void BindViewCallbacks() { BindViewCallback(base.view.transform.Find("FuncBtns/PauseBtn").GetComponent