| New file |
| | |
| | | using System;
|
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class ClientHazyPreciousDungeonStage : DungeonStage
|
| | | {
|
| | | readonly Vector3 s_IndicationPosition = new Vector3(12.1f, 6f, 11.95f);
|
| | | readonly Vector3 s_IndicationAngle = new Vector3(0, -30.74f, 0);
|
| | |
|
| | | int m_LineId = 0;
|
| | |
|
| | | int[] stepTimes;
|
| | |
|
| | | int m_BossNpcId = 0;
|
| | | int m_PreciousNpcId = 0;
|
| | | int m_PreciousEffectNpcId = 0;
|
| | |
|
| | | SFXController m_Indication;
|
| | | Clock m_PrepareClock;
|
| | |
|
| | | GA_NpcClientFightBoss clientBoss;
|
| | | GA_NpcClientCollect clientPrecious;
|
| | | GA_NpcClientFightNorm clientPreciousEffect;
|
| | |
|
| | | Step m_Step = Step.None;
|
| | | Step step
|
| | | {
|
| | | get { return m_Step; }
|
| | | set
|
| | | {
|
| | | if (m_Step != value)
|
| | | {
|
| | | switch (m_Step)
|
| | | {
|
| | | case Step.Prepare:
|
| | | break;
|
| | | case Step.Fight:
|
| | | OnExitFight();
|
| | | break;
|
| | | case Step.Collect:
|
| | | break;
|
| | | case Step.Over:
|
| | | break;
|
| | | }
|
| | |
|
| | | m_Step = value;
|
| | | switch (m_Step)
|
| | | {
|
| | | case Step.Prepare:
|
| | | OnEnterPrepare();
|
| | | break;
|
| | | case Step.Fight:
|
| | | OnEnterFight();
|
| | | break;
|
| | | case Step.Collect:
|
| | | break;
|
| | | case Step.Over:
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | |
|
| | | public override void Initialize()
|
| | | {
|
| | | base.Initialize();
|
| | |
|
| | | step = Step.None;
|
| | |
|
| | | var incidentConfig = HazyRegionConfig.Get(ClientHazyPreciousDungeon.incidentId);
|
| | | var dungeonId = model.GetDungeonId(incidentConfig.dungeonId, incidentConfig.lineId);
|
| | | var config = DungeonConfig.Get(dungeonId);
|
| | | stepTimes = LitJson.JsonMapper.ToObject<int[]>(config.StepTime);
|
| | | var npcArray = LitJson.JsonMapper.ToObject<int[]>(config.RefreshNPC);
|
| | | m_BossNpcId = npcArray[0];
|
| | | m_PreciousNpcId = npcArray[1];
|
| | | m_PreciousEffectNpcId = npcArray[2];
|
| | | m_LineId = incidentConfig.lineId;
|
| | |
|
| | | UnloadAssets();
|
| | |
|
| | | BossShowModel.Instance.bossShowCompletedEvent += BossShowCompletedEvent;
|
| | | }
|
| | |
|
| | | protected override void OnUpdate()
|
| | | {
|
| | | base.OnUpdate();
|
| | |
|
| | | switch (step)
|
| | | {
|
| | | case Step.None:
|
| | | break;
|
| | | case Step.Prepare:
|
| | | break;
|
| | | case Step.Fight:
|
| | | if (clientBoss.ActorInfo.serverDie)
|
| | | {
|
| | | step = Step.Collect;
|
| | | }
|
| | | break;
|
| | | case Step.Collect:
|
| | | break;
|
| | | case Step.Over:
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnStageLoadFinish()
|
| | | {
|
| | | base.OnStageLoadFinish();
|
| | |
|
| | | InitializePlayer();
|
| | | InitializeNpc();
|
| | | }
|
| | |
|
| | | public override void UnInitialize()
|
| | | {
|
| | | base.UnInitialize();
|
| | |
|
| | | UnloadAssets();
|
| | |
|
| | | BossShowModel.Instance.bossShowCompletedEvent -= BossShowCompletedEvent;
|
| | | }
|
| | |
|
| | | private void InitializePlayer()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | private void InitializeNpc()
|
| | | {
|
| | | clientBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)m_BossNpcId, E_ActorGroup.Enemy);
|
| | | clientPrecious = GAMgr.Instance.ReqClntNoFightNpc<GA_NpcClientCollect>((uint)m_PreciousNpcId, E_ActorGroup.FuncNpc);
|
| | | clientPreciousEffect = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)m_PreciousEffectNpcId, E_ActorGroup.Enemy);
|
| | | }
|
| | |
|
| | | void OnEnterPrepare()
|
| | | {
|
| | | var seconds = GetStepSeconds(Step.Prepare);
|
| | | model.UpdateCoolDown(DungeonCoolDownType.WaitStart, (uint)seconds * 1000);
|
| | | m_PrepareClock = Clock.AlarmAfter(seconds, () =>
|
| | | {
|
| | | step = Step.Fight;
|
| | | });
|
| | |
|
| | | UpdateMissionData();
|
| | | }
|
| | |
|
| | | void OnEnterFight()
|
| | | {
|
| | | InitializeNpc();
|
| | |
|
| | | var seconds = GetStepSeconds(Step.Fight);
|
| | | model.UpdateCoolDown(DungeonCoolDownType.FightStart, (uint)seconds * 1000);
|
| | | }
|
| | |
|
| | | void OnExitFight()
|
| | | {
|
| | | GAMgr.Instance.ServerDie(clientPreciousEffect.ServerInstID);
|
| | | }
|
| | |
|
| | | void OnEnterCollect()
|
| | | {
|
| | | m_Indication = SFXPlayUtility.Instance.PlayWithEulerAngle(1051, s_IndicationPosition, s_IndicationAngle);
|
| | | }
|
| | |
|
| | | int GetStepSeconds(Step step)
|
| | | {
|
| | | switch (step)
|
| | | {
|
| | | case Step.Prepare:
|
| | | return stepTimes != null && stepTimes.Length > 0 ? stepTimes[0] : 3;
|
| | | case Step.Fight:
|
| | | return stepTimes != null && stepTimes.Length > 1 ? stepTimes[1] : 480;
|
| | | case Step.Collect:
|
| | | return stepTimes != null && stepTimes.Length > 3 ? stepTimes[3] : 5;
|
| | | case Step.Over:
|
| | | return stepTimes != null && stepTimes.Length > 2 ? stepTimes[2] : 10;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | private void UpdateMissionData()
|
| | | {
|
| | | //var npcTotal = 0;
|
| | | //if(step==Step.)
|
| | | //var missionData = new DungeonMissionData()
|
| | | //{
|
| | | // lineID = m_LineId,
|
| | | // step = (int)step < (int)Step.Collect ? 1 : 2,
|
| | | // npcTotal = 0,
|
| | | //};
|
| | | //model.UpdateFakeDungeonMission(ClientHazyPreciousDungeon.DATAMAP, missionData);
|
| | | }
|
| | |
|
| | | void UnloadAssets()
|
| | | {
|
| | | if (m_Indication != null)
|
| | | {
|
| | | SFXPlayUtility.Instance.Release(m_Indication);
|
| | | m_Indication = null;
|
| | | }
|
| | | if (m_PrepareClock != null)
|
| | | {
|
| | | Clock.Stop(m_PrepareClock);
|
| | | m_PrepareClock = null;
|
| | | }
|
| | |
|
| | | if (clientBoss != null)
|
| | | {
|
| | | GAMgr.Instance.ServerDie(clientBoss.ServerInstID);
|
| | | GAMgr.Instance.Release(clientBoss);
|
| | | clientBoss = null;
|
| | | }
|
| | |
|
| | | if (clientPrecious != null)
|
| | | {
|
| | | GAMgr.Instance.ServerDie(clientPrecious.ServerInstID);
|
| | | GAMgr.Instance.Release(clientPrecious);
|
| | | clientPrecious = null;
|
| | | }
|
| | |
|
| | | if (clientPreciousEffect != null)
|
| | | {
|
| | | GAMgr.Instance.ServerDie(clientPreciousEffect.ServerInstID);
|
| | | GAMgr.Instance.Release(clientPreciousEffect);
|
| | | clientPreciousEffect = null;
|
| | | }
|
| | | }
|
| | |
|
| | | private void BossShowCompletedEvent()
|
| | | {
|
| | | step = Step.Prepare;
|
| | | }
|
| | |
|
| | | enum Step
|
| | | {
|
| | | None,
|
| | | Prepare,
|
| | | Fight,
|
| | | Collect,
|
| | | Over,
|
| | | }
|
| | | }
|
| | | } |
| | | |