| | |
| | | PlayerDatas.Instance.InitPlayerData(package);
|
| | | PlayerDatas.Instance.RequestWorldTick();
|
| | |
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | PlayerDatas.Instance.baseData.MapID = ClientDungeonStageUtility.clientMapId;
|
| | | }
|
| | |
|
| | | if (package.socketType == ServerType.Main)
|
| | | {
|
| | | if (playerIdBuf != 0 && playerIdBuf != PlayerDatas.Instance.baseData.PlayerID)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | PlayerDatas.Instance.baseData.MapID = ClientDungeonStageUtility.clientMapId;
|
| | | }
|
| | | else
|
| | | {
|
| | | var clientMapRecord = ClientDungeonStageUtility.GetOfflineRecordMap();
|
| | | if (clientMapRecord.mapId != 0)
|
| | | {
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)clientMapRecord.mapId);
|
| | | ClientDungeonStageUtility.dungeonInfo = clientMapRecord.dungeon;
|
| | | PlayerDatas.Instance.baseData.MapID = (ushort)clientMapRecord.mapId;
|
| | | }
|
| | | }
|
| | |
|
| | | if (package.socketType == ServerType.Main)
|
| | | {
|
| | | SDKUtility.Instance.RoleLogin(package.PlayerID.ToString(),
|
| | |
| | | {
|
| | | // 处理封魔坛英雄伤害
|
| | | FakeDemonJarDungeonStage _dungeon = StageLoad.Instance.currentStage as FakeDemonJarDungeonStage;
|
| | | ClientHazyDemonKingStage _clientHazyDemonStage = StageLoad.Instance.currentStage as ClientHazyDemonKingStage;
|
| | | if (_dungeon != null)
|
| | | {
|
| | | if (attacker.ServerInstID == PlayerDatas.Instance.PlayerId)
|
| | | {
|
| | | _dungeon.AddHeroHurt(hurtValue);
|
| | | }
|
| | | }
|
| | | else if (_clientHazyDemonStage != null)
|
| | | {
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | if (canDie
|
| | | && target.ActorInfo.RealHp == 0
|
| | | && !(StageLoad.Instance.currentStage is ClientHazyDemonKingStage))
|
| | | && target.ActorInfo.RealHp == 0)
|
| | | {
|
| | | target.Die(attacker.ServerInstID, soConfig.deadFlyId, (byte)attackType);
|
| | | }
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | if (_target.ActorInfo.serverDie && !(StageLoad.Instance.currentStage is ClientHazyDemonKingStage))
|
| | | if (_target.ActorInfo.serverDie)
|
| | | {
|
| | | _target.Die(owner.ServerInstID, 0, m_CacheSkill.hurtClientList[i].AttackType);
|
| | | }
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | if (_target.ActorInfo.serverDie
|
| | | && !(StageLoad.Instance.currentStage is ClientHazyDemonKingStage))
|
| | | if (_target.ActorInfo.serverDie)
|
| | | {
|
| | | _target.Die(owner.ServerInstID, 0, m_CacheSkill.hurtClntFightNpcList[i].AttackType);
|
| | | }
|
| | |
| | | using System;
|
| | | using Snxxz.UI;
|
| | | using System;
|
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | |
| | | { |
| | | |
| | | public static bool isClientDungeon { get; private set; } |
| | | public static ushort clientMapId { get; private set; } |
| | | public static ushort clientMapId { get; private set; }
|
| | | public static Dungeon dungeonInfo { get; set; } |
| | | |
| | | const string OFFLINEMAPRECORD = "OfflineMapRecord"; |
| | | |
| | | public static event Action<HB214_tagMCCuntomFBPrizeInfo> onReceiveCustomDropItme; |
| | | |
| | | public static void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.switchAccountEvent += Reset; |
| | | } |
| | | |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; |
| | | }
|
| | |
|
| | | public static void SetClientDungeon(bool value, ushort mapId) |
| | | { |
| | | isClientDungeon = value; |
| | | clientMapId = mapId; |
| | | } |
| | | |
| | | GlobalTimeEvent.Instance.fiveSecondEvent -= FiveSecondEvent; |
| | | if (value)
|
| | | {
|
| | | if (IsRequireOfflineReconnect(mapId))
|
| | | {
|
| | | RecordClientMap();
|
| | | GlobalTimeEvent.Instance.fiveSecondEvent += FiveSecondEvent; |
| | | }
|
| | | } |
| | | else
|
| | | {
|
| | | ResetOfflineRecord();
|
| | | } |
| | | }
|
| | |
|
| | | public static void RequestClientDropItem(int mapId, int lineId)//模拟的真实地图id以及线路id
|
| | | {
|
| | | var pak = new CB108_tagCMRefreshCustomFBPrize();
|
| | |
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | } |
| | | |
| | | public static void RequestStartClientDungeon(int mapId,int lineId)
|
| | | public static void RequestStartClientDungeon(int mapId, int lineId)
|
| | | {
|
| | | dungeonInfo = new Dungeon()
|
| | | {
|
| | | mapId = mapId,
|
| | | lineId = lineId,
|
| | | };
|
| | |
|
| | | var pak = new CA231_tagCMClientStartCustomScene();
|
| | | pak.MapID = (uint)mapId;
|
| | | pak.FuncLineID = (ushort)lineId;
|
| | |
| | | }
|
| | | } |
| | | |
| | | private static void FiveSecondEvent()
|
| | | {
|
| | | RecordClientMap();
|
| | | } |
| | | |
| | | private static void RecordClientMap()
|
| | | {
|
| | | var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
|
| | | var clientMapRecord = new ClientMapRecord()
|
| | | {
|
| | | mapId = clientMapId,
|
| | | time = DateTime.Now,
|
| | | dungeon = dungeonInfo,
|
| | | };
|
| | | LocalSave.SetString(key, LitJson.JsonMapper.ToJson(clientMapRecord));
|
| | | } |
| | | |
| | | private static void ResetOfflineRecord()
|
| | | {
|
| | | var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
|
| | | LocalSave.DeleteKey(key);
|
| | | } |
| | | |
| | | public static ClientMapRecord GetOfflineRecordMap()
|
| | | {
|
| | | var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
|
| | | if (LocalSave.HasKey(key))
|
| | | {
|
| | | var clientMapRecord = LitJson.JsonMapper.ToObject<ClientMapRecord>(LocalSave.GetString(key));
|
| | | return clientMapRecord;
|
| | | }
|
| | | return default(ClientMapRecord);
|
| | | } |
| | | |
| | | static bool IsRequireOfflineReconnect(int mapId)
|
| | | {
|
| | | switch (mapId)
|
| | | {
|
| | | case 2000:
|
| | | case 31190:
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | private static void OnPlayerLoginOk()
|
| | | {
|
| | | if (isClientDungeon)
|
| | | {
|
| | | RequestStartClientDungeon(dungeonInfo.mapId, dungeonInfo.lineId);
|
| | | }
|
| | | } |
| | | |
| | | private static void Reset() |
| | | { |
| | | isClientDungeon = false; |
| | | clientMapId = 0; |
| | | } |
| | | |
| | | public struct ClientMapRecord
|
| | | {
|
| | | public int mapId;
|
| | | public DateTime time;
|
| | | public Dungeon dungeon;
|
| | | } |
| | | } |
| | |
| | | }
|
| | |
|
| | | DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | | HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | |
|
| | | public override void Initialize()
|
| | | {
|
| | |
| | |
|
| | | step = Step.None;
|
| | |
|
| | | var incidentConfig = HazyRegionConfig.Get(ClientHazyPreciousDungeon.incidentId);
|
| | | var incidentConfig = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var dungeonId = model.GetDungeonId(incidentConfig.dungeonId, incidentConfig.lineId);
|
| | | var config = DungeonConfig.Get(dungeonId);
|
| | | stepTimes = LitJson.JsonMapper.ToObject<int[]>(config.StepTime);
|
| | |
| | |
|
| | | static GA_NpcClientFightBoss clientFightBoss = null;
|
| | |
|
| | | float totalTime = 20f;
|
| | | float timer = 0f;
|
| | | DateTime playerAtkTime = DateTime.Now;
|
| | | Clock pickItemClock = null;
|
| | |
|
| | | float stepTimer = 0f;
|
| | |
| | | {
|
| | | base.Initialize();
|
| | |
|
| | | timer = 0f;
|
| | | playerAtkTime = DateTime.MinValue;
|
| | | m_Step = Step.None;
|
| | | pickAllDropItem = false;
|
| | | itemCount = 0;
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnReconnected;
|
| | | AttackHandler.OnAttackTarget += OnPlayerAttack; |
| | | ClientDungeonStageUtility.onReceiveCustomDropItme += OnReceiveCustomDropItme; |
| | | dungeonModel.onDungeonResultEvent += OnDungeonResultEvent; |
| | | ClientDropItemUtility.OnItemPickup += OnItemPickup; |
| | |
| | | clientFightBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)config.npcId, E_ActorGroup.Enemy);
|
| | | clientFightBoss.Pos = bossBornPosition;
|
| | | clientFightBoss.LockTargetSID = PlayerDatas.Instance.PlayerId;
|
| | | }
|
| | |
|
| | | private void OnPlayerAttack(uint _attackerId, uint _victimId, byte _type, uint _damage)
|
| | | {
|
| | | if (clientFightBoss == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (_victimId == clientFightBoss.ServerInstID)
|
| | | {
|
| | | var progress = Mathf.Clamp01(1 - timer / totalTime);
|
| | | var hp = (ulong)(clientFightBoss.ActorInfo.RealMaxHp * progress);
|
| | |
|
| | | TargetBriefInfo.OnRefreshBossLifeBar(_victimId, clientFightBoss.NpcConfig.NPCID,
|
| | | hp, clientFightBoss.ActorInfo.RealMaxHp);
|
| | |
|
| | | playerAtkTime = DateTime.Now;
|
| | | }
|
| | | PersonalEnemy.Bind(clientFightBoss);
|
| | | }
|
| | |
|
| | | private void OnReceiveCustomDropItme(HB214_tagMCCuntomFBPrizeInfo package)
|
| | |
| | | {
|
| | | base.OnUpdate();
|
| | |
|
| | | if (timer < totalTime)
|
| | | if (clientFightBoss != null && clientFightBoss.ActorInfo.serverDie)
|
| | | {
|
| | | if ((DateTime.Now - playerAtkTime).TotalSeconds < 1f)
|
| | | {
|
| | | timer += Time.deltaTime;
|
| | | if (timer >= totalTime)
|
| | | {
|
| | | TargetBriefInfo.OnRefreshBossLifeBar(clientFightBoss.ServerInstID, clientFightBoss.NpcConfig.NPCID,
|
| | | 0, clientFightBoss.ActorInfo.RealMaxHp);
|
| | | OnBossDie();
|
| | | }
|
| | | }
|
| | | OnBossDie();
|
| | | }
|
| | |
|
| | | switch (step)
|
| | |
| | | {
|
| | | if (clientFightBoss != null)
|
| | | {
|
| | | clientFightBoss.ActorInfo.serverDie = true;
|
| | | GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
|
| | | clientFightBoss.Die();
|
| | | clientFightBoss = null;
|
| | | }
|
| | |
|
| | |
| | | ClientDungeonStageUtility.RequestSettleClientDungeon(config.dungeonId, config.lineId);
|
| | | }
|
| | |
|
| | | private void OnReconnected()
|
| | | {
|
| | | var incidentId = hazyRegionModel.processingIncidentId;
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(config.dungeonId, config.lineId);
|
| | | }
|
| | |
|
| | | public override void UnInitialize()
|
| | | {
|
| | | base.UnInitialize();
|
| | |
| | | pickItemClock = null;
|
| | | }
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnReconnected;
|
| | | AttackHandler.OnAttackTarget -= OnPlayerAttack;
|
| | | ClientDungeonStageUtility.onReceiveCustomDropItme -= OnReceiveCustomDropItme;
|
| | | dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
|
| | | ClientDropItemUtility.OnItemPickup -= OnItemPickup; |
| | |
| | | public static class ClientHazyPreciousDungeon
|
| | | {
|
| | | public const int DATAMAP = 31190;
|
| | | public static int incidentId = 0;
|
| | |
|
| | | public static void RequestEnter(int id)
|
| | | static HazyRegionModel model { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | |
|
| | | public static void RequestEnter()
|
| | | {
|
| | | incidentId = id;
|
| | |
|
| | | var config = HazyRegionConfig.Get(id);
|
| | | var config = HazyRegionConfig.Get(model.processingIncidentId);
|
| | |
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | if (hero != null)
|
| | |
| | | }
|
| | |
|
| | | MapTransferUtility.Instance.Clear();
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)DATAMAP);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(DATAMAP, config.lineId);
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)DATAMAP);
|
| | | StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
|
| | | {
|
| | | toMapId = DATAMAP,
|
| | |
| | |
|
| | | PlayerDatas.Instance.baseData.mainServerMapIdRecord = PlayerDatas.Instance.baseData.MapID;
|
| | | PlayerDatas.Instance.baseData.MapID = (ushort)DATAMAP;
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOk;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOk;
|
| | | }
|
| | |
|
| | | private static void PlayerLoginOk()
|
| | | {
|
| | | var mapId = PlayerDatas.Instance.baseData.MapID;
|
| | | if (mapId == DATAMAP)
|
| | | {
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(0, 0);
|
| | | }
|
| | | }
|
| | |
|
| | | public static void RequestExit()
|
| | |
| | | PlayerDatas.Instance.extersion.pkState = 0;
|
| | | ModelCenter.Instance.GetModel<DungeonModel>().ResetBufData();
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOk;
|
| | | StageLoad.Instance.onStageLoadFinish -= OnStageLoadFinish;
|
| | | StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
|
| | |
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | if (IsInDemonKingDungeon(PlayerDatas.Instance.baseData.MapID))
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(config.dungeonId, config.lineId);
|
| | | }
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | }
|
| | |
|
| | | MapTransferUtility.Instance.Clear();
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, Client_MapID);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(config.dungeonId, config.lineId);
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, Client_MapID);
|
| | | StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
|
| | | {
|
| | | toMapId = Client_MapID,
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | if (IsInGrassDungeon(PlayerDatas.Instance.baseData.MapID))
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(config.dungeonId, config.lineId);
|
| | | }
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | }
|
| | |
|
| | | MapTransferUtility.Instance.Clear();
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)mapId);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(config.dungeonId, config.lineId);
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)mapId);
|
| | | StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
|
| | | {
|
| | | toMapId = mapId,
|
| | |
| | |
|
| | | public int limitPoint { get; private set; }
|
| | | public int point { get; private set; }
|
| | | public int processingIncidentId { get; private set; }
|
| | |
|
| | | public int processingIncidentId
|
| | | {
|
| | | get
|
| | | {
|
| | | return LocalSave.GetInt(StringUtility.Contact("HazyIncidentId", PlayerDatas.Instance.PlayerId));
|
| | | }
|
| | | private set
|
| | | {
|
| | | LocalSave.SetInt(StringUtility.Contact("HazyIncidentId", PlayerDatas.Instance.PlayerId), value);
|
| | | }
|
| | | }
|
| | |
|
| | | public int adventureDialogueId { get; private set; }
|
| | | public bool playing { get; private set; }
|
| | | public bool satisfyFakeOpen { get; private set; }
|
| | |
| | | break;
|
| | | case HazyRegionIncidentType.Precious:
|
| | | BossShowModel.Instance.reqDungeonLineId = 0;
|
| | | ClientHazyPreciousDungeon.RequestEnter(id);
|
| | | ClientHazyPreciousDungeon.RequestEnter();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | MapTransferUtility.Instance.Clear();
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)Client_DataMap);
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(0, 0);
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)Client_DataMap);
|
| | | StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand()
|
| | | {
|
| | | toMapId = Client_DataMap,
|
| | |
| | |
|
| | | PlayerDatas.Instance.baseData.mainServerMapIdRecord = PlayerDatas.Instance.baseData.MapID;
|
| | | PlayerDatas.Instance.baseData.MapID = (ushort)Client_DataMap;
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOk;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOk;
|
| | | }
|
| | |
|
| | | private static void PlayerLoginOk()
|
| | | {
|
| | | var mapId = PlayerDatas.Instance.baseData.MapID;
|
| | | if (mapId == Client_DataMap)
|
| | | {
|
| | | ClientDungeonStageUtility.RequestStartClientDungeon(0, 0);
|
| | | }
|
| | | }
|
| | |
|
| | | public static void RequestExit()
|
| | |
| | | PlayerDatas.Instance.extersion.pkState = 0;
|
| | | ModelCenter.Instance.GetModel<DungeonModel>().ResetBufData();
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOk;
|
| | | StageLoad.Instance.onStageLoadFinish -= OnStageLoadFinish;
|
| | | StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
|
| | |
|
| | |
| | | |
| | | { |
| | | public event Action secondEvent; |
| | | public event Action fiveSecondEvent; |
| | | public event Action minuteEvent; |
| | | public event Action fiveMinuteEvent; |
| | | public event Action tenMinuteEvent; |
| | |
| | | public event Action halfMinuteEvent;
|
| | |
|
| | | int secondBuf = -1;
|
| | | int fiveSecondBuf = -1;
|
| | | int minuteBuf = -1;
|
| | | int fiveMinuteBuf = -1;
|
| | | int tenMinuteBuf = -1;
|
| | |
| | | secondBuf = second;
|
| | | }
|
| | |
|
| | |
|
| | | var fiveSecond = second / 5;
|
| | | if (fiveSecondBuf != fiveSecond)
|
| | | {
|
| | | try
|
| | | {
|
| | | if (fiveSecondEvent != null)
|
| | | {
|
| | | fiveSecondEvent();
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Debug.LogException(ex);
|
| | | }
|
| | | finally
|
| | | {
|
| | | fiveSecondBuf = fiveSecond;
|
| | | }
|
| | | }
|
| | |
|
| | | var minute = DateTime.Now.Minute;
|
| | | if (minuteBuf != minute)
|
| | | {
|