Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: Fish
|
| | | // [ Date ]: Wednesday, May 15, 2019
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System.IO;
|
| | | using System.Threading;
|
| | | using System;
|
| | | using UnityEngine;
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public partial class ActorShowConfig
|
| | | {
|
| | |
|
| | | //-------------------------------------------------------- |
| | | // [Author]: Fish |
| | | // [ Date ]: Friday, May 24, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Threading; |
| | | using System; |
| | | using UnityEngine; |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public partial class ActorShowConfig |
| | | { |
| | | |
| | | public readonly int ID;
|
| | | public readonly int NpcID;
|
| | | public readonly int MapID;
|
| | |
| | | public readonly int soundId;
|
| | | public readonly int soundTime;
|
| | | public readonly int step;
|
| | |
|
| | | public ActorShowConfig()
|
| | | {
|
| | | }
|
| | |
|
| | | public ActorShowConfig(string input)
|
| | | {
|
| | | try
|
| | | {
|
| | | var tables = input.Split('\t');
|
| | |
|
| | | public readonly int showName; |
| | | |
| | | public ActorShowConfig() |
| | | { |
| | | } |
| | | |
| | | public ActorShowConfig(string input) |
| | | { |
| | | try |
| | | { |
| | | var tables = input.Split('\t'); |
| | | |
| | | int.TryParse(tables[0],out ID);
|
| | |
|
| | | int.TryParse(tables[1],out NpcID);
|
| | |
| | | int.TryParse(tables[23],out soundTime);
|
| | |
|
| | | int.TryParse(tables[24],out step);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | DebugEx.Log(ex);
|
| | | }
|
| | | }
|
| | |
|
| | | static Dictionary<string, ActorShowConfig> configs = new Dictionary<string, ActorShowConfig>();
|
| | | public static ActorShowConfig Get(string id)
|
| | | { |
| | | if (!inited)
|
| | | {
|
| | | Debug.Log("ActorShowConfig 还未完成初始化。");
|
| | | return null;
|
| | | }
|
| | | |
| | | if (configs.ContainsKey(id))
|
| | | {
|
| | | return configs[id];
|
| | | }
|
| | |
|
| | | ActorShowConfig config = null;
|
| | | if (rawDatas.ContainsKey(id))
|
| | | {
|
| | | config = configs[id] = new ActorShowConfig(rawDatas[id]);
|
| | | rawDatas.Remove(id);
|
| | | }
|
| | |
|
| | | return config;
|
| | | }
|
| | |
|
| | | public static ActorShowConfig Get(int id)
|
| | | {
|
| | | return Get(id.ToString());
|
| | | }
|
| | |
|
| | | public static List<string> GetKeys()
|
| | | {
|
| | | var keys = new List<string>();
|
| | | keys.AddRange(configs.Keys);
|
| | | keys.AddRange(rawDatas.Keys);
|
| | | return keys;
|
| | | }
|
| | |
|
| | | public static List<ActorShowConfig> GetValues()
|
| | | {
|
| | | var values = new List<ActorShowConfig>();
|
| | | values.AddRange(configs.Values);
|
| | |
|
| | | var keys = new List<string>(rawDatas.Keys);
|
| | | foreach (var key in keys)
|
| | | {
|
| | | values.Add(Get(key));
|
| | | }
|
| | |
|
| | | return values;
|
| | | }
|
| | |
|
| | | public static bool Has(string id)
|
| | | {
|
| | | return configs.ContainsKey(id) || rawDatas.ContainsKey(id);
|
| | | }
|
| | |
|
| | | public static bool Has(int id)
|
| | | {
|
| | | return Has(id.ToString());
|
| | | }
|
| | |
|
| | | public static bool inited { get; private set; }
|
| | | protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>();
|
| | | public static void Init(bool sync=false)
|
| | | {
|
| | | inited = false;
|
| | | var path = string.Empty;
|
| | | if (AssetSource.refdataFromEditor)
|
| | | {
|
| | | path = ResourcesPath.CONFIG_FODLER +"/ActorShow.txt";
|
| | | }
|
| | | else
|
| | | {
|
| | | path = AssetVersionUtility.GetAssetFilePath("config/ActorShow.txt");
|
| | | }
|
| | |
|
| | | configs.Clear();
|
| | | var tempConfig = new ActorShowConfig();
|
| | | var preParse = tempConfig is IConfigPostProcess;
|
| | |
|
| | | if (sync)
|
| | | {
|
| | | var lines = File.ReadAllLines(path);
|
| | | if (!preParse)
|
| | | {
|
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3);
|
| | | }
|
| | | for (int i = 3; i < lines.Length; i++)
|
| | | {
|
| | | try |
| | | {
|
| | | var line = lines[i];
|
| | | var index = line.IndexOf("\t");
|
| | | if (index == -1)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var id = line.Substring(0, index);
|
| | |
|
| | | if (preParse)
|
| | | {
|
| | | var config = new ActorShowConfig(line);
|
| | | configs[id] = config;
|
| | | (config as IConfigPostProcess).OnConfigParseCompleted();
|
| | | }
|
| | | else
|
| | | {
|
| | | rawDatas[id] = line;
|
| | | }
|
| | | }
|
| | | catch (System.Exception ex)
|
| | | {
|
| | | Debug.LogError(ex);
|
| | | }
|
| | | }
|
| | | inited = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | ThreadPool.QueueUserWorkItem((object _object) =>
|
| | | {
|
| | | var lines = File.ReadAllLines(path);
|
| | | if (!preParse)
|
| | | {
|
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3);
|
| | | }
|
| | | for (int i = 3; i < lines.Length; i++)
|
| | | {
|
| | | try |
| | | {
|
| | | var line = lines[i];
|
| | | var index = line.IndexOf("\t");
|
| | | if (index == -1)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var id = line.Substring(0, index);
|
| | |
|
| | | if (preParse)
|
| | | {
|
| | | var config = new ActorShowConfig(line);
|
| | | configs[id] = config;
|
| | | (config as IConfigPostProcess).OnConfigParseCompleted();
|
| | | }
|
| | | else
|
| | | {
|
| | | rawDatas[id] = line;
|
| | | }
|
| | | }
|
| | | catch (System.Exception ex)
|
| | | {
|
| | | Debug.LogError(ex);
|
| | | }
|
| | | }
|
| | |
|
| | | inited = true;
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | int.TryParse(tables[25],out showName); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | DebugEx.Log(ex); |
| | | } |
| | | } |
| | | |
| | | static Dictionary<string, ActorShowConfig> configs = new Dictionary<string, ActorShowConfig>(); |
| | | public static ActorShowConfig Get(string id) |
| | | { |
| | | if (!inited) |
| | | { |
| | | Debug.Log("ActorShowConfig 还未完成初始化。"); |
| | | return null; |
| | | } |
| | | |
| | | if (configs.ContainsKey(id)) |
| | | { |
| | | return configs[id]; |
| | | } |
| | | |
| | | ActorShowConfig config = null; |
| | | if (rawDatas.ContainsKey(id)) |
| | | { |
| | | config = configs[id] = new ActorShowConfig(rawDatas[id]); |
| | | rawDatas.Remove(id); |
| | | } |
| | | |
| | | return config; |
| | | } |
| | | |
| | | public static ActorShowConfig Get(int id) |
| | | { |
| | | return Get(id.ToString()); |
| | | } |
| | | |
| | | public static List<string> GetKeys() |
| | | { |
| | | var keys = new List<string>(); |
| | | keys.AddRange(configs.Keys); |
| | | keys.AddRange(rawDatas.Keys); |
| | | return keys; |
| | | } |
| | | |
| | | public static List<ActorShowConfig> GetValues() |
| | | { |
| | | var values = new List<ActorShowConfig>(); |
| | | values.AddRange(configs.Values); |
| | | |
| | | var keys = new List<string>(rawDatas.Keys); |
| | | foreach (var key in keys) |
| | | { |
| | | values.Add(Get(key)); |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | |
| | | public static bool Has(string id) |
| | | { |
| | | return configs.ContainsKey(id) || rawDatas.ContainsKey(id); |
| | | } |
| | | |
| | | public static bool Has(int id) |
| | | { |
| | | return Has(id.ToString()); |
| | | } |
| | | |
| | | public static bool inited { get; private set; } |
| | | protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>(); |
| | | public static void Init(bool sync=false) |
| | | { |
| | | inited = false; |
| | | var path = string.Empty; |
| | | if (AssetSource.refdataFromEditor) |
| | | { |
| | | path = ResourcesPath.CONFIG_FODLER +"/ActorShow.txt"; |
| | | } |
| | | else |
| | | { |
| | | path = AssetVersionUtility.GetAssetFilePath("config/ActorShow.txt"); |
| | | } |
| | | |
| | | configs.Clear(); |
| | | var tempConfig = new ActorShowConfig(); |
| | | var preParse = tempConfig is IConfigPostProcess; |
| | | |
| | | if (sync) |
| | | { |
| | | var lines = File.ReadAllLines(path); |
| | | if (!preParse) |
| | | { |
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3); |
| | | } |
| | | for (int i = 3; i < lines.Length; i++) |
| | | { |
| | | try |
| | | { |
| | | var line = lines[i]; |
| | | var index = line.IndexOf("\t"); |
| | | if (index == -1) |
| | | { |
| | | continue; |
| | | } |
| | | var id = line.Substring(0, index); |
| | | |
| | | if (preParse) |
| | | { |
| | | var config = new ActorShowConfig(line); |
| | | configs[id] = config; |
| | | (config as IConfigPostProcess).OnConfigParseCompleted(); |
| | | } |
| | | else |
| | | { |
| | | rawDatas[id] = line; |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Debug.LogError(ex); |
| | | } |
| | | } |
| | | inited = true; |
| | | } |
| | | else |
| | | { |
| | | ThreadPool.QueueUserWorkItem((object _object) => |
| | | { |
| | | var lines = File.ReadAllLines(path); |
| | | if (!preParse) |
| | | { |
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3); |
| | | } |
| | | for (int i = 3; i < lines.Length; i++) |
| | | { |
| | | try |
| | | { |
| | | var line = lines[i]; |
| | | var index = line.IndexOf("\t"); |
| | | if (index == -1) |
| | | { |
| | | continue; |
| | | } |
| | | var id = line.Substring(0, index); |
| | | |
| | | if (preParse) |
| | | { |
| | | var config = new ActorShowConfig(line); |
| | | configs[id] = config; |
| | | (config as IConfigPostProcess).OnConfigParseCompleted(); |
| | | } |
| | | else |
| | | { |
| | | rawDatas[id] = line; |
| | | } |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | Debug.LogError(ex); |
| | | } |
| | | } |
| | | |
| | | inited = true; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ef8ad14c092549545a7623899eb26c2a |
| | | timeCreated: 1557892285 |
| | | timeCreated: 1558687215 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | |
| | | }
|
| | | }
|
| | |
|
| | | var clientDungeonInfo = new Dungeon()
|
| | | {
|
| | | mapId = (int)package.ExAttr14 / 1000,
|
| | | lineId = (int)package.ExAttr14 % 1000,
|
| | | };
|
| | |
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | PlayerDatas.Instance.baseData.MapID = ClientDungeonStageUtility.clientMapId;
|
| | | }
|
| | | else
|
| | | {
|
| | | var clientMapRecord = ClientDungeonStageUtility.GetClientDataMapSymbol();
|
| | | if (clientMapRecord.mapId != 0 &&
|
| | | (DateTime.Now - clientMapRecord.time).TotalMinutes < 3)
|
| | | if (clientDungeonInfo.mapId != 0)
|
| | | {
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)clientMapRecord.mapId);
|
| | | ClientDungeonStageUtility.dungeonInfo = clientMapRecord.dungeon;
|
| | | PlayerDatas.Instance.baseData.MapID = (ushort)clientMapRecord.mapId;
|
| | | var clientMapId = ClientDungeonStageUtility.GetClientMapId(clientDungeonInfo.mapId);
|
| | | if (clientMapId != 0)
|
| | | {
|
| | | ClientDungeonStageUtility.SetClientDungeon(true, (ushort)clientMapId);
|
| | | ClientDungeonStageUtility.dungeonInfo = clientDungeonInfo;
|
| | | PlayerDatas.Instance.baseData.MapID = (ushort)clientMapId;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | public static ushort clientMapId { get; private set; }
|
| | | public static Dungeon dungeonInfo { get; set; } |
| | | |
| | | const string OFFLINEMAPRECORD = "OfflineMapRecord"; |
| | | |
| | | static Action<Dungeon, bool> clientCustomDungeonResult; |
| | | |
| | | public static void Init() |
| | |
| | | { |
| | | isClientDungeon = value; |
| | | clientMapId = mapId; |
| | | |
| | | GlobalTimeEvent.Instance.fiveSecondEvent -= FiveSecondEvent; |
| | | if (value)
|
| | | {
|
| | | if (IsRequireOfflineReconnect(mapId))
|
| | | {
|
| | | SetClientDataMapSymbol();
|
| | | GlobalTimeEvent.Instance.fiveSecondEvent += FiveSecondEvent; |
| | | }
|
| | | } |
| | | else
|
| | | {
|
| | | ClearClientDataMapSymbol();
|
| | | } |
| | | }
|
| | | |
| | | public static void RequestStartClientDungeon(int mapId, int lineId, Action<Dungeon, bool> callBack)
|
| | |
| | | exitClientMap = true,
|
| | | });
|
| | | } |
| | | |
| | | private static void FiveSecondEvent()
|
| | | {
|
| | | SetClientDataMapSymbol();
|
| | | } |
| | | |
| | | public static void SetClientDataMapSymbol()
|
| | | {
|
| | | switch (clientMapId)
|
| | | {
|
| | | case HazyDemonKingModel.CLIENTDATAMAP:
|
| | | {
|
| | | if (!(StageLoad.Instance.currentStage is ClientHazyDemonKingStage))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var stage = StageLoad.Instance.currentStage as ClientHazyDemonKingStage;
|
| | | if (stage.step > ClientHazyDemonKingStage.Step.Fight)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case HazyGrassModel.FAIRY_CLIENTDATAMAP:
|
| | | case HazyGrassModel.REIKI_CLIENTDATAMAP:
|
| | | {
|
| | | if (!(StageLoad.Instance.currentStage is ClientHazyGrassStage))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var stage = StageLoad.Instance.currentStage as ClientHazyGrassStage;
|
| | | if (stage.hasCompleted)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case HazyRegionModel.PRECIOUS_CLIENTDATAMAP:
|
| | | {
|
| | | if (!(StageLoad.Instance.currentStage is ClientHazyPreciousDungeonStage))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var stage = StageLoad.Instance.currentStage as ClientHazyPreciousDungeonStage;
|
| | | if (stage.step > ClientHazyPreciousDungeonStage.Step.Collect)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case PersonalBossModel.PERSONALBOSS_MAPID:
|
| | | {
|
| | | if (!(StageLoad.Instance.currentStage is ClientPersonalBossDungeonStage))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var stage = StageLoad.Instance.currentStage as ClientPersonalBossDungeonStage;
|
| | | if (stage.step > ClientPersonalBossDungeonStage.Step.Fight)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
|
| | | var clientMapRecord = new ClientDataMapSymbol()
|
| | | {
|
| | | mapId = clientMapId,
|
| | | time = DateTime.Now,
|
| | | dungeon = dungeonInfo,
|
| | | };
|
| | | LocalSave.SetString(key, LitJson.JsonMapper.ToJson(clientMapRecord));
|
| | | } |
| | | |
| | | public static void ClearClientDataMapSymbol()
|
| | | {
|
| | | var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
|
| | | LocalSave.DeleteKey(key);
|
| | | } |
| | | |
| | | public static ClientDataMapSymbol GetClientDataMapSymbol()
|
| | | {
|
| | | var key = StringUtility.Contact(OFFLINEMAPRECORD, "_", PlayerDatas.Instance.baseData.PlayerID);
|
| | | if (LocalSave.HasKey(key))
|
| | | {
|
| | | var clientMapRecord = LitJson.JsonMapper.ToObject<ClientDataMapSymbol>(LocalSave.GetString(key));
|
| | | return clientMapRecord;
|
| | | }
|
| | | return default(ClientDataMapSymbol);
|
| | | } |
| | | |
| | | static bool IsRequireOfflineReconnect(int mapId)
|
| | | public static int GetClientMapId(int mapId)
|
| | | {
|
| | | switch (mapId)
|
| | | {
|
| | | case HazyDemonKingModel.CLIENTDATAMAP:
|
| | | case HazyGrassModel.REIKI_CLIENTDATAMAP:
|
| | | case HazyGrassModel.FAIRY_CLIENTDATAMAP:
|
| | | case HazyRegionModel.PRECIOUS_CLIENTDATAMAP:
|
| | | case HazyDemonKingModel.DATAMAP:
|
| | | case HazyDemonKingModel.CROSSSERVERDATAMAP:
|
| | | return HazyDemonKingModel.CLIENTDATAMAP;
|
| | | case HazyGrassModel.REIKI_DATAMAP:
|
| | | return HazyGrassModel.REIKI_CLIENTDATAMAP;
|
| | | case HazyGrassModel.FAIRY_DATAMAP:
|
| | | return HazyGrassModel.FAIRY_CLIENTDATAMAP;
|
| | | case PersonalBossModel.PERSONALBOSS_MAPID:
|
| | | return true;
|
| | | case HazyRegionModel.PRECIOUS_CLIENTDATAMAP:
|
| | | case TreasureModel.CLIENTDATAMAP:
|
| | | return mapId;
|
| | | }
|
| | | return false;
|
| | | return 0;
|
| | | }
|
| | |
|
| | | private static void OnPlayerLoginOk()
|
| | |
| | | { |
| | | isClientDungeon = false; |
| | | clientMapId = 0; |
| | | } |
| | | |
| | | public struct ClientDataMapSymbol
|
| | | {
|
| | | public int mapId;
|
| | | public DateTime time;
|
| | | public Dungeon dungeon;
|
| | | } |
| | | } |
| | |
| | |
|
| | | step = Step.None;
|
| | |
|
| | | var incidentConfig = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var incidentConfig = HazyRegionConfig.Get(incidentId);
|
| | | var dungeonId = model.GetDungeonId(incidentConfig.dungeonId, incidentConfig.lineId);
|
| | | var config = DungeonConfig.Get(dungeonId);
|
| | | stepTimes = LitJson.JsonMapper.ToObject<int[]>(config.StepTime);
|
| | |
| | | StartCoroutine(Co_VerityExistBossShow());
|
| | |
|
| | | InitializePlayer();
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
|
| | | }
|
| | |
|
| | | private IEnumerator Co_VerityExistBossShow()
|
| | |
| | | if (!BossShowModel.Instance.BossShowing)
|
| | | {
|
| | | BossShowCompletedEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnPlayerLoginOk()
|
| | | {
|
| | | if (step <= Step.Fight)
|
| | | {
|
| | | InitializeBoss();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | ClientCollectUtility.OnCollectFinished -= OnCollectFinished;
|
| | | model.onDungeonResultEvent -= OnDungeonResultEvent;
|
| | | PersonalEnemy.OnNpcAppear -= OnNpcAppear;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
|
| | | }
|
| | |
|
| | | private void OnDungeonResultEvent()
|
| | |
| | |
|
| | | private void InitializeNpc()
|
| | | {
|
| | | PersonalEnemy.Create((uint)m_BossNpcId, E_ActorGroup.Enemy, s_BossPosition);
|
| | | InitializeBoss();
|
| | |
|
| | | clientPrecious = GAMgr.Instance.ReqClntNoFightNpc<GA_NpcClientCollect>((uint)m_PreciousNpcId, E_ActorGroup.FuncNpc);
|
| | | clientPrecious.Pos = s_PreciousPosition;
|
| | |
| | | {
|
| | | animator.Play(GAStaticDefine.State_IdleHash);
|
| | | }
|
| | | }
|
| | |
|
| | | private void InitializeBoss()
|
| | | {
|
| | | uint hp = 0;
|
| | | uint hpEx = 0;
|
| | | var position = s_BossPosition;
|
| | | if (clientBoss != null)
|
| | | {
|
| | | hp = (uint)clientBoss.ActorInfo.Hp;
|
| | | hpEx = clientBoss.ActorInfo.HpEx;
|
| | | position = clientBoss.Pos;
|
| | | PersonalEnemy.Release(clientBoss);
|
| | | }
|
| | |
|
| | | PersonalEnemy.Create((uint)m_BossNpcId, E_ActorGroup.Enemy, position, hp, hpEx);
|
| | | }
|
| | |
|
| | | void OnEnterPrepare()
|
| | |
| | | model.UpdateCoolDown(DungeonCoolDownType.LeaveMap, (uint)seconds * 1000);
|
| | |
|
| | | m_ExitClock = Clock.AlarmAfter(seconds, OnExitDungeon);
|
| | |
|
| | | ClientDungeonStageUtility.ClearClientDataMapSymbol();
|
| | |
|
| | | UpdateMissionData();
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | static GA_NpcClientFightBoss s_ClientBoss = null;
|
| | |
|
| | | static PersonalBossModel model { get { return ModelCenter.Instance.GetModel<PersonalBossModel>(); } } |
| | | static DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } |
| | | |
| | |
| | |
|
| | | step = Step.None;
|
| | |
|
| | | var config = PersonalBossConfig.Get(model.clientBossNpcId);
|
| | | var npcId = model.GetBossNpcId(ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = PersonalBossConfig.Get(npcId);
|
| | | if (config != null)
|
| | | {
|
| | | var dungeonId = dungeonModel.GetDungeonId(PersonalBossModel.PERSONALBOSS_MAPID, config.lineId);
|
| | |
| | | }
|
| | |
|
| | | dungeonModel.onDungeonResultEvent += OnDungeonResultEvent;
|
| | | PersonalEnemy.OnNpcAppear += OnNpcAppear;
|
| | | } |
| | | |
| | | protected override void OnStageLoadFinish()
|
| | |
| | | InitializePlayer();
|
| | |
|
| | | step = Step.Prepare;
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOk;
|
| | | } |
| | | |
| | | void InitializePlayer()
|
| | |
| | | |
| | | private void OnEnterOver()
|
| | | {
|
| | | ClientDungeonStageUtility.ClearClientDataMapSymbol();
|
| | |
|
| | | var seconds = s_StepTimes[2];
|
| | | dungeonModel.UpdateCoolDown(DungeonCoolDownType.LeaveMap, (uint)seconds * 1000);
|
| | | s_StepClock = Clock.AlarmAfter(seconds, () =>
|
| | |
| | | |
| | | void InitializeNpc()
|
| | | {
|
| | | PersonalEnemy.Create((uint)model.clientBossNpcId, E_ActorGroup.Enemy, s_NpcPosition);
|
| | | uint hp = 0;
|
| | | uint hpEx = 0;
|
| | | var position = s_NpcPosition;
|
| | | if (s_ClientBoss != null)
|
| | | {
|
| | | hp = (uint)s_ClientBoss.ActorInfo.Hp;
|
| | | hpEx = s_ClientBoss.ActorInfo.HpEx;
|
| | | position = s_ClientBoss.Pos;
|
| | | PersonalEnemy.Release(s_ClientBoss);
|
| | | }
|
| | |
|
| | | var npcId = model.GetBossNpcId(ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | PersonalEnemy.Create((uint)npcId, E_ActorGroup.Enemy, position, hp, hpEx);
|
| | | } |
| | | |
| | | private void OnDungeonResultEvent()
|
| | |
| | | step = Step.Over;
|
| | | } |
| | | |
| | | private void PlayerLoginOk()
|
| | | {
|
| | | if (step < Step.Over)
|
| | | {
|
| | | InitializeNpc();
|
| | | }
|
| | | } |
| | | |
| | | public override void UnInitialize()
|
| | | {
|
| | | base.UnInitialize();
|
| | |
|
| | | dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
|
| | | PersonalEnemy.OnNpcAppear -= OnNpcAppear;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOk;
|
| | |
|
| | | if (s_ClientBoss != null)
|
| | | {
|
| | | s_ClientBoss = null;
|
| | | }
|
| | |
|
| | | if (s_StepClock != null)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void OnNpcAppear(GA_NpcClientFightNorm _npc)
|
| | | {
|
| | | if (_npc != null && _npc is GA_NpcClientFightBoss)
|
| | | {
|
| | | s_ClientBoss = _npc as GA_NpcClientFightBoss;
|
| | | }
|
| | | }
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | private void OnGUI()
|
| | | {
|
| | |
| | | case 31140:
|
| | | case JadeDynastyBossModel.JADEDYNASTY_MAP:
|
| | | case HazyDemonKingModel.CLIENTDATAMAP:
|
| | | case HazyDemonKingModel.DEMONKINGMAPID1:
|
| | | case HazyDemonKingModel.DEMONKINGMAPID2:
|
| | | case HazyDemonKingModel.DATAMAP:
|
| | | case HazyDemonKingModel.CROSSSERVERDATAMAP:
|
| | | WindowCenter.Instance.Open<DungeonPickUpItemCoolDownWin>();
|
| | | break;
|
| | | case FairyLeagueModel.FAIRY_LEAGUE_DUNGEON:
|
| | |
| | | break;
|
| | | case HazyGrassModel.REIKI_CLIENTDATAMAP:
|
| | | case HazyGrassModel.FAIRY_CLIENTDATAMAP:
|
| | | case HazyGrassModel.FairyGrassMapId:
|
| | | case HazyGrassModel.ReikiGrassMapId:
|
| | | case HazyGrassModel.FAIRY_DATAMAP:
|
| | | case HazyGrassModel.REIKI_DATAMAP:
|
| | | WindowCenter.Instance.Close<DungeonEndCoolDownWin>();
|
| | | WindowCenter.Instance.Open<DungeonCollectItemSuccWin>();
|
| | | break;
|
| | |
| | | |
| | | |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "Client_MapID", Snxxz.UI.HazyDemonKingModel.CLIENTDATAMAP); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "DEMONKINGMAPID1", Snxxz.UI.HazyDemonKingModel.DEMONKINGMAPID1); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "DEMONKINGMAPID2", Snxxz.UI.HazyDemonKingModel.DEMONKINGMAPID2); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "DEMONKINGMAPID1", Snxxz.UI.HazyDemonKingModel.DATAMAP); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "DEMONKINGMAPID2", Snxxz.UI.HazyDemonKingModel.CROSSSERVERDATAMAP); |
| | | |
| | | |
| | | |
| | |
| | | Utils.BeginClassRegister(type, L, __CreateInstance, 5, 0, 0); |
| | | |
| | | |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "ReikiGrassMapId", Snxxz.UI.HazyGrassModel.ReikiGrassMapId); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "FairyGrassMapId", Snxxz.UI.HazyGrassModel.FairyGrassMapId); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "ReikiGrassMapId", Snxxz.UI.HazyGrassModel.REIKI_DATAMAP); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "FairyGrassMapId", Snxxz.UI.HazyGrassModel.FAIRY_DATAMAP); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "Client_ReikiGrassMapID", Snxxz.UI.HazyGrassModel.REIKI_CLIENTDATAMAP); |
| | | Utils.RegisterObject(L, translator, Utils.CLS_IDX, "Client_FairyGrassMapID", Snxxz.UI.HazyGrassModel.FAIRY_CLIENTDATAMAP); |
| | | |
| | |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "IsBossUnLocked", _m_IsBossUnLocked); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetLatestUnLockBoss", _m_GetLatestUnLockBoss); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "UpdateRedpoint", _m_UpdateRedpoint); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnMapInitOk", _m_OnMapInitOk); |
| | | |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "bossSelectedEvent", _e_bossSelectedEvent); |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _m_OnMapInitOk(RealStatePtr L) |
| | | { |
| | | try { |
| | | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | Snxxz.UI.PersonalBossModel gen_to_be_invoked = (Snxxz.UI.PersonalBossModel)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | | { |
| | | |
| | | gen_to_be_invoked.OnMapInitOk( ); |
| | | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | } catch(System.Exception gen_e) { |
| | | return LuaAPI.luaL_error(L, "c# exception:" + gen_e); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _g_get_selectedBoss(RealStatePtr L) |
| | |
| | | public List<ShowActor> showTargetList { get; private set; }
|
| | | public bool BossShowing { get; private set; }
|
| | | public Camera showCamera { get; private set; }
|
| | | public ShowActor showHero { get; private set; }
|
| | | public bool satisfyStep { get; private set; }
|
| | | private bool serverNotify = false;
|
| | | private int cacheMapId = 0;
|
| | |
| | | }
|
| | | }
|
| | | showTargetList.Clear();
|
| | | showHero = null;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | var _instanceid = GetInstanceId();
|
| | | showActor = new ShowActor(actorShowModel.showNpcs[i], i, _instanceid, actorShowModel);
|
| | | m_ShowActorInstanceDict.Add(_instanceid, showActor);
|
| | |
|
| | | if (actorShowModel.showNpcs[i] == 1)
|
| | | {
|
| | | showHero = showActor;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | CameraUtility.RemoveCullingMask(CameraManager.uiCamera, LayerUtility.UIEffectLayer);
|
| | | if (!WindowCenter.Instance.IsOpen<BossShowWin>())
|
| | | {
|
| | | BossShowWin.bossShowId = actorShowModel.ID;
|
| | | WindowCenter.Instance.Open<BossShowWin>();
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | [SerializeField] UIEffect bossNameEffect;
|
| | | [SerializeField] Button skipBtn;
|
| | | [SerializeField] HeadUpName m_HeadUpHero;
|
| | |
|
| | | public static int bossShowId = 0;
|
| | |
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | |
| | | {
|
| | | BossShowModel.Instance.OnBossNameEvent += OnBossNameEvent;
|
| | | skipBtn.gameObject.SetActive(BossShowModel.Instance.satisfyStep);
|
| | |
|
| | | var config = ActorShowConfig.Get(bossShowId);
|
| | |
|
| | | m_HeadUpHero.target = null;
|
| | |
|
| | | m_HeadUpHero.gameObject.SetActive(config != null && config.showName == 1
|
| | | && BossShowModel.Instance.showHero != null);
|
| | | if (config != null && config.showName == 1
|
| | | && BossShowModel.Instance.showHero != null)
|
| | | {
|
| | | DisplayHeadUpName();
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnBossNameEvent()
|
| | |
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | |
| | | m_HeadUpHero.SyncPosition(true);
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | |
| | | {
|
| | | }
|
| | | #endregion
|
| | |
|
| | | void DisplayHeadUpName()
|
| | | {
|
| | | m_HeadUpHero.pattern = HeadUpName.Pattern.Hero;
|
| | | m_HeadUpHero.camera = BossShowModel.Instance.showCamera;
|
| | | var hero = BossShowModel.Instance.showHero;
|
| | | if (hero != null)
|
| | | {
|
| | | var MP_Name = hero.m_Model.transform.GetChildTransformDeeply("A_Name");
|
| | | if (!MP_Name)
|
| | | {
|
| | | MP_Name = hero.m_Model.transform;
|
| | | }
|
| | | m_HeadUpHero.target = MP_Name;
|
| | | }
|
| | | m_HeadUpHero.offset = new Vector3(0, 0, 0);
|
| | | var realmLevel = PlayerDatas.Instance.baseData.realmLevel;
|
| | | var name = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName);
|
| | | var familyName = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.FamilyName);
|
| | | m_HeadUpHero.SetPlayerInfo(new HeadUpName.PlayerInfo()
|
| | | {
|
| | | realm = realmLevel,
|
| | | name = name,
|
| | | alliance = familyName,
|
| | | });
|
| | |
|
| | | m_HeadUpHero.SyncPosition(true);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | var crossServerBossModel = ModelCenter.Instance.GetModel<CrossServerBossModel>();
|
| | | crossServerBossModel.RequestExit();
|
| | | break;
|
| | | case 4000:
|
| | | case TreasureModel.CLIENTDATAMAP:
|
| | | case HazyRegionModel.PRECIOUS_CLIENTDATAMAP:
|
| | | case PersonalBossModel.PERSONALBOSS_MAPID:
|
| | | ClientDungeonStageUtility.ExitNormalClientDungeon();
|
| | |
| | | {
|
| | | switch (ClientDungeonStageUtility.clientMapId)
|
| | | {
|
| | | case 4000:
|
| | | case TreasureModel.CLIENTDATAMAP:
|
| | | case HazyGrassModel.FAIRY_CLIENTDATAMAP:
|
| | | case HazyGrassModel.REIKI_CLIENTDATAMAP:
|
| | | case PersonalBossModel.PERSONALBOSS_MAPID:
|
| | | case HazyDemonKingModel.CLIENTDATAMAP:
|
| | | ClientDungeonStageUtility.ExitNormalClientDungeon();
|
| | | break;
|
| | | }
|
| | |
| | | case SkyTowerModel.DATA_MAPID:
|
| | | ProcessSkyTowerExitCoolDownEnd();
|
| | | break;
|
| | | case HazyDemonKingModel.DEMONKINGMAPID2:
|
| | | case HazyGrassModel.ReikiGrassMapId:
|
| | | case HazyGrassModel.FairyGrassMapId:
|
| | | case HazyDemonKingModel.CROSSSERVERDATAMAP:
|
| | | case HazyGrassModel.REIKI_DATAMAP:
|
| | | case HazyGrassModel.FAIRY_DATAMAP:
|
| | | var crossServerBossModel = ModelCenter.Instance.GetModel<CrossServerBossModel>();
|
| | | crossServerBossModel.RequestExit();
|
| | | break;
|
| | |
| | | WindowCenter.Instance.Open<GatherSoulDungeonHintWin>();
|
| | | }
|
| | | break;
|
| | | case HazyGrassModel.ReikiGrassMapId:
|
| | | case HazyGrassModel.FairyGrassMapId:
|
| | | case HazyGrassModel.REIKI_DATAMAP:
|
| | | case HazyGrassModel.FAIRY_DATAMAP:
|
| | | if (!WindowCenter.Instance.IsOpen<HazyGrassDungeonWin>())
|
| | | {
|
| | | WindowCenter.Instance.Open<HazyGrassDungeonWin>();
|
| | |
| | | var weel = Mathf.Clamp(model.mission.wheel, 1, int.MaxValue) - 1;
|
| | | descText.text = config.Info.Length > weel ? config.Info[weel] : config.Info[0];
|
| | | break;
|
| | | case HazyGrassModel.FairyGrassMapId:
|
| | | case HazyGrassModel.ReikiGrassMapId:
|
| | | case HazyGrassModel.FAIRY_DATAMAP:
|
| | | case HazyGrassModel.REIKI_DATAMAP:
|
| | | break;
|
| | | default:
|
| | | descText.text = config.Info.Length > step ? config.Info[step] : config.Info[0];
|
| | |
| | | namespace Snxxz.UI
|
| | | {
|
| | | [XLua.LuaCallCSharp]
|
| | | public class PersonalBossModel : Model, IMapInitOk
|
| | | public class PersonalBossModel : Model
|
| | | {
|
| | | public const int PERSONALBOSS_MAPID = 31240;
|
| | | public const int PERSONAL_REDPOINTID = 76003;
|
| | |
| | | bossSelectedEvent(value);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public int clientBossNpcId
|
| | | {
|
| | | get
|
| | | {
|
| | | return LocalSave.GetInt("PersonalBossClient_" + PlayerDatas.Instance.PlayerId);
|
| | | }
|
| | | private set
|
| | | {
|
| | | LocalSave.SetInt("PersonalBossClient_" + PlayerDatas.Instance.PlayerId, value);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | return sortedBossIds[0];
|
| | | }
|
| | |
|
| | | public int GetBossNpcId(int lineId)
|
| | | {
|
| | | var configs = PersonalBossConfig.GetValues();
|
| | | foreach (var config in configs)
|
| | | {
|
| | | if (config.lineId == lineId)
|
| | | {
|
| | | return config.NPCID;
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | private void OnPlayerDataChange(PlayerDataType _type)
|
| | |
| | | public void RequestGotoDungeon(int _bossId)
|
| | | {
|
| | | var config = PersonalBossConfig.Get(_bossId);
|
| | | clientBossNpcId = _bossId;
|
| | | ClientDungeonStageUtility.GotoNormalClientDungeon(PERSONALBOSS_MAPID, PERSONALBOSS_MAPID, config.lineId);
|
| | | }
|
| | |
|
| | | public void OnMapInitOk()
|
| | | {
|
| | | //var dungeonModel = ModelCenter.Instance.GetModel<DungeonModel>();
|
| | | //var dataMapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
|
| | | //
|
| | | //switch (dataMapId)
|
| | | //{
|
| | | // case PERSONALBOSS_MAPID:
|
| | | // var sendInfo = new CA508_tagCMDoFBAction();
|
| | | // sendInfo.ActionType = 0;
|
| | | // sendInfo.ActionInfo = (uint)selectedBoss;
|
| | | // GameNetSystem.Instance.SendInfo(sendInfo);
|
| | | // MapTransferUtility.Instance.MoveToNPC(selectedBoss);
|
| | | // break;
|
| | | //}
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | static readonly Vector3 playerBornPosition = new Vector3(10, 6.38f, 6.67f);
|
| | | static readonly Vector3 bossBornPosition = new Vector3(8.35f, 6.37f, 9.7f);
|
| | |
|
| | | static GA_NpcClientFightBoss clientFightBoss = null;
|
| | | static GA_NpcClientFightBoss s_ClientBoss = null;
|
| | |
|
| | | float stepTimer = 0f;
|
| | |
|
| | | float existTime = 10f;
|
| | | float exitTime = 10f;
|
| | |
|
| | | Step m_Step = Step.Fight;
|
| | | public Step step
|
| | |
| | | get { return m_Step; }
|
| | | set
|
| | | {
|
| | | if (m_Step != value)
|
| | | {
|
| | | m_Step = value;
|
| | | switch (m_Step)
|
| | | {
|
| | | case Step.Fight:
|
| | | stepTimer = 0f;
|
| | | break;
|
| | | case Step.Settle:
|
| | | stepTimer = 0f;
|
| | | break;
|
| | | case Step.Exit:
|
| | | stepTimer = 0f;
|
| | | break;
|
| | | }
|
| | | }
|
| | | m_Step = value;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | InitializeBoss();
|
| | |
|
| | | step = Step.Fight;
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOkEvent;
|
| | | }
|
| | |
|
| | | public static uint GetClientBossSid()
|
| | | {
|
| | | if (clientFightBoss != null)
|
| | | if (s_ClientBoss != null)
|
| | | {
|
| | | return clientFightBoss.ServerInstID;
|
| | | return s_ClientBoss.ServerInstID;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
| | |
|
| | | void InitializeBoss()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | PersonalEnemy.Create((uint)config.npcId, E_ActorGroup.Enemy, bossBornPosition);
|
| | | uint hp = 0;
|
| | | uint hpEx = 0;
|
| | | var position = bossBornPosition;
|
| | | if (s_ClientBoss != null)
|
| | | {
|
| | | hp = (uint)s_ClientBoss.ActorInfo.Hp;
|
| | | hpEx = s_ClientBoss.ActorInfo.HpEx;
|
| | | position = s_ClientBoss.Pos;
|
| | | PersonalEnemy.Release(s_ClientBoss);
|
| | | }
|
| | |
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | PersonalEnemy.Create((uint)config.npcId, E_ActorGroup.Enemy, position, hp, hpEx);
|
| | | }
|
| | |
|
| | | private void OnDungeonResultEvent()
|
| | | {
|
| | | step = Step.Settle;
|
| | | ClientDungeonStageUtility.ClearClientDataMapSymbol();
|
| | | dungeonModel.UpdateCoolDown(DungeonCoolDownType.LeaveMap, 10 * 1000);
|
| | | }
|
| | |
|
| | | private void OnNpcAppear(GA_NpcClientFightNorm _npc)
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (_npc.NpcConfig.NPCID == config.npcId)
|
| | | {
|
| | | clientFightBoss = _npc as GA_NpcClientFightBoss;
|
| | | s_ClientBoss = _npc as GA_NpcClientFightBoss;
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnUpdate()
|
| | |
|
| | | private void PlayerLoginOkEvent()
|
| | | {
|
| | | base.OnUpdate();
|
| | |
|
| | | if (clientFightBoss != null && clientFightBoss.ActorInfo.serverDie)
|
| | | if (step <= Step.Fight)
|
| | | {
|
| | | OnBossDie();
|
| | | }
|
| | |
|
| | | switch (step)
|
| | | {
|
| | | case Step.Fight:
|
| | | if (clientFightBoss == null)
|
| | | {
|
| | | stepTimer += Time.deltaTime;
|
| | | if (stepTimer > 5f)
|
| | | {
|
| | | stepTimer = 0f;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case Step.Settle:
|
| | | stepTimer += Time.deltaTime;
|
| | | if (stepTimer >= existTime)
|
| | | {
|
| | | step = Step.Exit;
|
| | | ClientDungeonStageUtility.ExitNormalClientDungeon();
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | void OnBossDie()
|
| | | {
|
| | | if (clientFightBoss != null)
|
| | | {
|
| | | clientFightBoss = null;
|
| | | InitializeBoss();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | base.UnInitialize();
|
| | |
|
| | | if (clientFightBoss != null)
|
| | | if (s_ClientBoss != null)
|
| | | {
|
| | | clientFightBoss = null;
|
| | | s_ClientBoss = null;
|
| | | }
|
| | |
|
| | | dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
|
| | | PersonalEnemy.OnNpcAppear -= OnNpcAppear;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOkEvent;
|
| | | }
|
| | |
|
| | | #if UNITY_EDITOR
|
| | |
| | | None,
|
| | | Fight,
|
| | | Settle,
|
| | | Exit
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | static readonly Vector3 PlayerBornPosition1 = new Vector3(19.401f, 4.985f, 5.494f);
|
| | |
|
| | | static List<Vector3> s_NpcPositions = new List<Vector3>();
|
| | | static List<int> s_RandomIndexs = new List<int>();
|
| | |
|
| | | static readonly int s_EnemyNpcId = 40208005;
|
| | |
|
| | | static Vector3 s_EnemyPosition = Vector3.zero;
|
| | |
|
| | | static GA_NpcClientFightNorm s_ClientMonster = null;
|
| | |
|
| | | bool hasInitializedNpc = false;
|
| | | public bool hasCompleted { get; private set; }
|
| | |
| | |
|
| | | ClientCollectUtility.OnCollectFinished += OnCollectFinished;
|
| | | dungeonModel.onDungeonResultEvent += OnDungeonResultEvent;
|
| | | PersonalEnemy.OnNpcAppear += OnNpcAppear;
|
| | | }
|
| | |
|
| | | protected override void OnStageLoadFinish()
|
| | |
| | | InitializeNpc();
|
| | |
|
| | | model.onMapNpcCountRefresh += OnMapNpcCountRefresh;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOk;
|
| | | }
|
| | |
|
| | | public override void UnInitialize()
|
| | |
| | | ClientCollectUtility.OnCollectFinished -= OnCollectFinished;
|
| | | dungeonModel.onDungeonResultEvent -= OnDungeonResultEvent;
|
| | | model.onMapNpcCountRefresh -= OnMapNpcCountRefresh;
|
| | | PersonalEnemy.OnNpcAppear -= OnNpcAppear;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= PlayerLoginOk;
|
| | | }
|
| | |
|
| | | private void OnMapNpcCountRefresh()
|
| | |
| | | dungeonModel.UpdateCoolDown(DungeonCoolDownType.LeaveMap, 10 * 1000);
|
| | |
|
| | | hasCompleted = true;
|
| | | ClientDungeonStageUtility.ClearClientDataMapSymbol();
|
| | | }
|
| | |
|
| | | private void OnCollectFinished(uint _sid)
|
| | |
| | | void InitializeNpc()
|
| | | {
|
| | | var config = ScriptableObjectLoader.LoadSoHazyMapNpc(ClientDungeonStageUtility.clientMapId);
|
| | | var positions = config.GetNpcPositions();
|
| | | s_NpcPositions = config.GetNpcPositions(hazyRegionModel.hazyRegionOpenTimes);
|
| | |
|
| | | s_RandomIndexs.Clear();
|
| | | for (int i = 0; i < positions.Count; i++)
|
| | | for (int i = 0; i < s_NpcPositions.Count; i++)
|
| | | {
|
| | | s_RandomIndexs.Add(i);
|
| | | }
|
| | |
|
| | | var mapId = model.GetGrassMapId(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var mapId = model.GetGrassMapId(incidentId);
|
| | | var npcInfos = model.GetGrassNpcInfos(mapId);
|
| | |
|
| | | var npcJsonDatas = GetLocalNpcData();
|
| | |
| | |
|
| | | if (hasInitializedNpc)
|
| | | {
|
| | | var enemyPosition = positions[UnityEngine.Random.Range(0, positions.Count)];
|
| | | s_EnemyPosition = s_NpcPositions[UnityEngine.Random.Range(0, s_NpcPositions.Count)];
|
| | |
|
| | | if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.FAIRY_CLIENTDATAMAP)
|
| | | {
|
| | | PersonalEnemy.Create((uint)s_EnemyNpcId, E_ActorGroup.Enemy, enemyPosition);
|
| | | }
|
| | | InitializeMonster();
|
| | | }
|
| | |
|
| | | if (hasInitializedNpc)
|
| | |
| | | {
|
| | | hasInitializedNpc = true;
|
| | |
|
| | | var config = ScriptableObjectLoader.LoadSoHazyMapNpc(ClientDungeonStageUtility.clientMapId);
|
| | | var positions = config.GetNpcPositions();
|
| | |
|
| | | var position = positions[index];
|
| | | var position = s_NpcPositions[index];
|
| | |
|
| | | GA_NpcClientCollect _npc = GAMgr.Instance.ReqClntNoFightNpc<GA_NpcClientCollect>((uint)npcId,
|
| | | E_ActorGroup.FuncNpc);
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | void InitializeMonster()
|
| | | {
|
| | | var position = s_EnemyPosition;
|
| | |
|
| | | if (s_ClientMonster != null)
|
| | | {
|
| | | position = s_ClientMonster.Pos;
|
| | | PersonalEnemy.Release(s_ClientMonster);
|
| | | }
|
| | |
|
| | | if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.FAIRY_CLIENTDATAMAP)
|
| | | {
|
| | | PersonalEnemy.Create((uint)s_EnemyNpcId, E_ActorGroup.Enemy, position);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnNpcAppear(GA_NpcClientFightNorm _npc)
|
| | | {
|
| | | s_ClientMonster = _npc;
|
| | | }
|
| | |
|
| | | private void PlayerLoginOk()
|
| | | {
|
| | | InitializeMonster();
|
| | | }
|
| | |
|
| | | void UnloadAllNpc()
|
| | | {
|
| | | foreach (var _npc in s_CollectNpcs.Values)
|
| | |
| | | }
|
| | |
|
| | | s_CollectNpcs.Clear();
|
| | |
|
| | | if (s_ClientMonster != null)
|
| | | {
|
| | | s_ClientMonster = null;
|
| | | }
|
| | | }
|
| | |
|
| | | #region 本地Npc数据
|
| | |
| | | {
|
| | | get
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null)
|
| | | {
|
| | | return config.dungeonType;
|
| | |
| | |
|
| | | public const int CLIENTDATAMAP = 2000;
|
| | |
|
| | | public const int DEMONKINGMAPID1 = 22030;
|
| | | public const int DEMONKINGMAPID2 = 32030;
|
| | | public const int DATAMAP = 22030;
|
| | | public const int CROSSSERVERDATAMAP = 32030;
|
| | |
|
| | | public event Action onPlayerInfoRefresh;
|
| | | public event Action onPlayerCountRefresh;
|
| | |
| | |
|
| | | public void RequestExitDungeon()
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.MapID == DEMONKINGMAPID1)
|
| | | if (PlayerDatas.Instance.baseData.MapID == DATAMAP)
|
| | | {
|
| | | ModelCenter.Instance.GetModel<DungeonModel>().ExitCurrentDungeon();
|
| | | }
|
| | |
| | |
|
| | | void Display()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(model.processingIncidentId);
|
| | | var incidentId = model.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | var npcConfig = NPCConfig.Get(config.npcId);
|
| | | m_BossName.text = npcConfig.charName;
|
| | |
|
| | |
| | | {
|
| | | get
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(model.dungeonResult.dataMapID, model.dungeonResult.lineID);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null)
|
| | | {
|
| | | return config.dungeonType;
|
| | |
| | | {
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | m_DungeonTarget.Init(config.dungeonId);
|
| | | }
|
| | | else
|
| | |
| | | var mapId = 0;
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | mapId = hazyGrassModel.GetGrassMapId(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | mapId = hazyGrassModel.GetGrassMapId(incidentId);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | Dictionary<int, List<int>> m_MapNpcs = new Dictionary<int, List<int>>();
|
| | | Dictionary<int, int> m_MapNpcCount = new Dictionary<int, int>();
|
| | |
|
| | | public const int ReikiGrassMapId = 32040;
|
| | | public const int FairyGrassMapId = 32050;
|
| | | public const int REIKI_DATAMAP = 32040;
|
| | | public const int FAIRY_DATAMAP = 32050;
|
| | | public const int REIKI_CLIENTDATAMAP = 3240;
|
| | | public const int FAIRY_CLIENTDATAMAP = 3250;
|
| | |
|
| | |
| | | var mapNpcConfigs = MapNpcRefreshConfig.GetValues();
|
| | | foreach (var config in mapNpcConfigs)
|
| | | {
|
| | | if (config.MapID == ReikiGrassMapId
|
| | | || config.MapID == FairyGrassMapId)
|
| | | if (config.MapID == REIKI_DATAMAP
|
| | | || config.MapID == FAIRY_DATAMAP)
|
| | | {
|
| | | List<int> _npcs = null;
|
| | | if (!m_MapNpcs.TryGetValue(config.MapID, out _npcs))
|
| | |
| | | var dungeonHintId = 0;
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null)
|
| | | {
|
| | | dungeonHintId = dungeonModel.GetDungeonHintId(config.dungeonId, 0);
|
| | |
| | | && (ClientDungeonStageUtility.clientMapId == REIKI_CLIENTDATAMAP
|
| | | || ClientDungeonStageUtility.clientMapId == FAIRY_CLIENTDATAMAP))
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var incidentId = hazyRegionModel.GetIncidentId(ClientDungeonStageUtility.dungeonInfo.mapId, ClientDungeonStageUtility.dungeonInfo.lineId);
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null)
|
| | | {
|
| | | var collectCount = dungeonModel.GetDugneonNpcCollectCount(npcId);
|
| | |
| | |
|
| | | public void ReceivePackage(HA714_tagMCNPCCntList package)
|
| | | {
|
| | | if (package.MapID != ReikiGrassMapId
|
| | | && package.MapID != FairyGrassMapId)
|
| | | if (package.MapID != REIKI_DATAMAP
|
| | | && package.MapID != FAIRY_DATAMAP)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | #endif |
| | | public class HazyMapNpcScriptableObject : ScriptableObject
|
| | | { |
| | | [SerializeField, Header("订制次数")] int[] m_CustomCounts; |
| | | [SerializeField, Header("订制位置")] List<CustomPositions> m_CustomNpcPositions; |
| | | [SerializeField] List<Vector3> m_NpcPositions; |
| | | |
| | | public List<Vector3> GetNpcPositions()
|
| | | public List<Vector3> GetNpcPositions(int count)
|
| | | {
|
| | | if (m_CustomCounts != null && m_CustomCounts.Length > 0
|
| | | && m_CustomNpcPositions != null)
|
| | | {
|
| | | var index = Array.IndexOf(m_CustomCounts, count);
|
| | | if (index != -1 && index < m_CustomNpcPositions.Count)
|
| | | {
|
| | | return m_CustomNpcPositions[index].positions;
|
| | | }
|
| | | }
|
| | | return m_NpcPositions;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | #endif
|
| | |
|
| | |
|
| | | [Serializable]
|
| | | public struct CustomPositions
|
| | | {
|
| | | public List<Vector3> positions;
|
| | | }
|
| | | }
|
| | |
|
| | | #if UNITY_EDITOR
|
| | |
| | | {
|
| | | if (model.selectedTreasure == 101)
|
| | | {
|
| | | ClientDungeonStageUtility.GotoNormalClientDungeon(4000, 0, 0);
|
| | | ClientDungeonStageUtility.GotoNormalClientDungeon(TreasureModel.CLIENTDATAMAP, TreasureModel.CLIENTDATAMAP, 0);
|
| | | return;
|
| | | }
|
| | | if (PlayerDatas.Instance.baseData.LV >= config.ChallengeLevel)
|
| | |
| | | List<int> eightFurnacesAchievements = new List<int>();
|
| | | List<int> treasureUnOpens = new List<int>();
|
| | |
|
| | | public const int CLIENTDATAMAP = 4000;
|
| | | public const int TREASURE_DATAMAPID = 41110;
|
| | | public const int TREASURE_MAPID = 41110;
|
| | | public const int TREASURE_GUIDE_ID = 102;
|