| | |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | public class JadeDynastyTowerModel : Model, IPlayerLoginOk, IMapInitOk |
| | | public class JadeDynastyTowerModel : Model, IPlayerLoginOk, IMapInitOk, IBeforePlayerDataInitialize |
| | | { |
| | | public const int DATA_MAPID = 0; |
| | | const int REDPOINTID = 1; |
| | | const int functionId = 166; |
| | | |
| | | public int highestPassFloor { get; private set; } |
| | | public int currentFloor { |
| | |
| | | set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "_JadeDynastyTowerUnLockFloor"), value); } |
| | | } |
| | | |
| | | bool serverInited = false; |
| | | Redpoint redpoint = new Redpoint(REDPOINTID); |
| | | List<int> sortedFloors = new List<int>(); |
| | | |
| | | DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | var error = GetErrorOfChallenge(); |
| | | if (error == 0) |
| | | { |
| | | dungeonModel.RequestChallangeDungeon(DATA_MAPID, 0); |
| | | } |
| | | else |
| | | { |
| | | |
| | | switch (error) |
| | | { |
| | | case 1: |
| | | break; |
| | | case 2: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private int GetErrorOfChallenge() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(functionId)) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | var enterTimes = dungeonModel.GetEnterTimes(DATA_MAPID); |
| | | var totalTimes = dungeonModel.GetTotalTimes(DATA_MAPID); |
| | | if (enterTimes >= totalTimes) |
| | | { |
| | | return 2; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | public void RequestRefreshMonster() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void RequestSetDungeonAction() |
| | | { |
| | | var sendInfo = new CA508_tagCMDoFBAction(); |
| | | sendInfo.ActionType = 0; |
| | |
| | | |
| | | public void UpdateHighestPassFloor(HB213_tagMCZhuXianTowerInfo info) |
| | | { |
| | | var oldRecorder = highestPassFloor; |
| | | highestPassFloor = (int)info.Floor; |
| | | if (serverInited && highestPassFloor > oldRecorder) |
| | | { |
| | | var config = Config.Instance.Get<JadeDynastyTowerConfig>(highestPassFloor); |
| | | if (config.unLockEquipPlace > 0) |
| | | { |
| | | specialUnLockFloor = highestPassFloor; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | |
| | | serverInited = true; |
| | | } |
| | | |
| | | public void OnMapInitOk() |
| | |
| | | switch (PlayerDatas.Instance.baseData.MapID) |
| | | { |
| | | case DATA_MAPID: |
| | | RequestSetDungeonAction(); |
| | | RequestRefreshMonster(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | serverInited = false; |
| | | } |
| | | } |
| | | } |
| | | |