Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0310_tagRoleSkillChange.cs
@@ -68,7 +68,8 @@ { SkillHelper.Instance.OnSpSkillChange(vNetData.NewSkillID, 1); } InstanceResourcesLoader.PreloadSkillEffect(vNetData.NewSkillID); } } } Core/ResModule/AssetBundle/AssetBundleUtility.cs
@@ -8,6 +8,8 @@ public class AssetBundleUtility : SingletonMonobehaviour<AssetBundleUtility> { private List<AssetBundleInfo> m_AssetBundleInfoList = new List<AssetBundleInfo>(); private List<string> m_LoadingAssetBundleList = new List<string>(); private List<string> m_LoadingAssetList = new List<string>(); private Dictionary<string, AssetInfo> m_AssetInfoDict = new Dictionary<string, AssetInfo>(); private Dictionary<string, AssetBundle> m_AssetBundleDict = new Dictionary<string, AssetBundle>(); private Dictionary<string, Dictionary<string, UnityEngine.Object>> m_AssetDict = new Dictionary<string, Dictionary<string, UnityEngine.Object>>(); @@ -187,6 +189,18 @@ yield break; } if (m_LoadingAssetBundleList.Contains(assetBundleName)) { while (!m_AssetBundleDict.ContainsKey(assetBundleName)) { // Debug.Log(Time.frameCount + " ] 正在加载AssetBundle: " + assetBundleName + ", 请等待..."); yield return null; } yield break; } m_LoadingAssetBundleList.Add(assetBundleName); var _assetBundleInfo = GetAssetBundleInfo(assetBundleName); if (_assetBundleInfo == null) { @@ -211,6 +225,8 @@ } CacheAssetBundle(assetBundleName, _request.assetBundle); m_LoadingAssetBundleList.Remove(assetBundleName); } private IEnumerator Co_LoadAssetBundleDependenice(AssetBundleInfo assetBundleInfo) @@ -242,11 +258,35 @@ private IEnumerator Co_DoLoadAsset(string assetBundleName, string assetName, Action<bool, UnityEngine.Object> callBack = null) { #if UNITY_5 assetBundleName = assetBundleName.ToLower(); #endif #if UNITY_EDITOR RunTimeABLoadLog.AddLog(assetBundleName, assetName, UnityEngine.SceneManagement.SceneManager.GetActiveScene().name); #endif yield return Co_LoadAssetBundle(assetBundleName); string _checkTag = assetBundleName + "@" + assetName; if (m_LoadingAssetList.Contains(_checkTag)) { while (!m_AssetDict.ContainsKey(assetBundleName) || !m_AssetDict[assetBundleName].ContainsKey(assetName)) { // Debug.Log(Time.frameCount + " ] 正在加载Asset: " + _checkTag + ", 请等待..."); yield return null; } if (callBack != null) { callBack(true, m_AssetDict[assetBundleName][assetName]); } yield break; } m_LoadingAssetList.Add(_checkTag); var request = m_AssetBundleDict[assetBundleName].LoadAssetAsync(assetName); while (!request.isDone) @@ -270,6 +310,7 @@ } } m_LoadingAssetList.Remove(_checkTag); } private IEnumerator Co_DoLoadAsset(AssetInfo assetInfo, Action<bool, UnityEngine.Object> callBack = null) Core/ResModule/InstanceResourcesLoader.cs
@@ -29,25 +29,25 @@ public static RuntimeAnimatorController LoadDefaultMobAnimatorController_Fight() { return AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, GeneralDefine.ModeDefaultConfig[1][1]); GeneralDefine.ModeDefaultConfig[1][1].Replace("Prefab_Race_", "")); } public static RuntimeAnimatorController LoadDefaultMobAnimatorController_Func() { return AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, GeneralDefine.ModeDefaultConfig[0][1]); GeneralDefine.ModeDefaultConfig[0][1].Replace("Prefab_Race_", "")); } public static RuntimeAnimatorController LoadDefaultMobAnimatorController_Horse() { return AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, GeneralDefine.ModeDefaultConfig[3][1]); GeneralDefine.ModeDefaultConfig[3][1].Replace("Prefab_Horse_", "")); } public static RuntimeAnimatorController LoadDefaultMobAnimatorController_Pet() { return AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, GeneralDefine.ModeDefaultConfig[2][1]); GeneralDefine.ModeDefaultConfig[2][1].Replace("Prefab_Race_", "")); } public static GameObject LoadDefaultFightNPC() @@ -60,6 +60,25 @@ { return LoadMob(GeneralDefine.ModeDefaultConfig[0][0], GeneralDefine.ModeDefaultConfig[0][1]); } public static void AsyncLoadDefaultFuncNpc(Action<bool, UnityEngine.Object> callBack) { AsyncLoadNpc(GeneralDefine.ModeDefaultConfig[0][0], GeneralDefine.ModeDefaultConfig[0][1], callBack); } public static void AsyncLoadDefaultFightNpc(Action<bool, UnityEngine.Object> callBack) { AsyncLoadNpc(GeneralDefine.ModeDefaultConfig[1][0], GeneralDefine.ModeDefaultConfig[1][1], callBack); } public static void AsyncLoadDefaultPet(Action<bool, UnityEngine.Object> callBack) { AsyncLoadNpc(GeneralDefine.ModeDefaultConfig[2][0], GeneralDefine.ModeDefaultConfig[2][1], callBack); } public static GameObject LoadDefaultHorse() @@ -228,6 +247,84 @@ return prefab; } public static void AsyncLoadModelRes(int id, Action<bool, UnityEngine.Object> callback = null) { ModelResConfig _m = Config.Instance.Get<ModelResConfig>(id); if (_m == null) { return; } string _name = _m.ResourcesName; int _index = _name.IndexOf('/'); if (_index != -1) { _name = _name.Substring(_index + 1); } string _suffix = string.Empty; if (_m.Type == (int)E_ModelResType.Suit) { _suffix = raceSuffix; } else if (_m.Type == (int)E_ModelResType.Horse) { _suffix = horseSuffix; } else if (_m.Type == (int)E_ModelResType.Wing) { _suffix = wingSuffix; } else if (_m.Type == (int)E_ModelResType.Weapon) { _suffix = weaponSuffix; } else if (_m.Type == (int)E_ModelResType.Secondary) { _suffix = secondarySuffix; } else if (_m.Type == (int)E_ModelResType.Hand) { _suffix = handSuffix; } if (AssetSource.mobFromEditor) { #if UNITY_EDITOR string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Mob/", _suffix + _name, ".prefab"); var _gameObject = AssetDatabase.LoadAssetAtPath<GameObject>(_resourcePath); if (_gameObject) { if (callback != null) { callback(true, _gameObject); } } else { if (callback != null) { callback(false, null); } } #endif } else { string _bundleName = StringUtility.Contact(ResourcesPath.MOB_FOLDER_NAME, "prefab_race_" + _name.Replace("_UI", "")); string _assetName = _suffix + _name; AssetBundleUtility.Instance.Co_LoadAsset(_bundleName, _assetName, callback); } } public static GameObject LoadMob(string assetBundleName, string assetName) { GameObject _gameObject = null; @@ -301,8 +398,7 @@ return _gameObject; } public static void LoadEffectAsync(int _id, Action<bool, UnityEngine.Object> _callBack) public static void LoadEffectAsync(int _id, Action<bool, UnityEngine.Object> _callBack = null) { GameObject gameObject = null; var config = Config.Instance.Get<EffectConfig>(_id); @@ -334,4 +430,113 @@ AssetBundleUtility.Instance.Co_LoadAsset(bundleName, config.fxName, _callBack); } } public static void AsyncLoadNpc(int npcID, Action<bool, UnityEngine.Object> callBack = null) { NPCConfig _m = Config.Instance.Get<NPCConfig>(npcID); if (_m == null || _m.MODE.Equals("0")) { if (callBack != null) { callBack(false, null); } } string _assetName; string _assetBundleName; if (GAMgr.Instance.s_NpcID2Assetname.TryGetValue(npcID, out _assetName)) { _assetBundleName = GAMgr.Instance.s_NpcID2BundleName[npcID]; } else { _assetName = StringUtility.Contact(raceSuffix, _m.MODE); _assetBundleName = StringUtility.Contact(ResourcesPath.MOB_FOLDER_NAME, _assetName); GAMgr.Instance.s_NpcID2Assetname[npcID] = _assetName; GAMgr.Instance.s_NpcID2BundleName[npcID] = _assetBundleName; } AsyncLoadNpc(_assetBundleName, _assetName, callBack); } public static void AsyncLoadNpc(string assetBundleName, string assetName, Action<bool, UnityEngine.Object> callBack = null) { if (AssetSource.mobFromEditor) { #if UNITY_EDITOR string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Mob/", assetName, ".prefab"); var _p = AssetDatabase.LoadAssetAtPath<GameObject>(_resourcePath); if (callBack != null) { callBack(true, _p); } #endif } else { AssetBundleUtility.Instance.Co_LoadAsset(assetBundleName, assetName, callBack); } } public static void PreloadSkillEffect(int id) { var _skillInfo = SkillHelper.Instance.Get(id); // 技能特效预加载 if (_skillInfo.config.EffectName > 0) { InstanceResourcesLoader.LoadEffectAsync(_skillInfo.config.EffectName); } if (_skillInfo.config.BuffEffectID > 0) { InstanceResourcesLoader.LoadEffectAsync(_skillInfo.config.EffectName); } var _soSkill = _skillInfo.soFile; if (_soSkill != null) { for (int i = 0; i < _soSkill.animationEventList.Count; ++i) { if (_soSkill.animationEventList[i].frameEventType == E_FrameEventType.OnPlayEffect) { if (_soSkill.animationEventList[i].intParam > 0) { InstanceResourcesLoader.LoadEffectAsync(_soSkill.animationEventList[i].intParam); } } else if (_soSkill.animationEventList[i].frameEventType == E_FrameEventType.OnSkillEvent) { var _param = _soSkill.animationEventList[i].intParam; var _type = SoSkill.GetAttactType(_param); var _id = SoSkill.GetFrameEventId(_param); if (_type == SoSkill.E_AttackType.Sweep) { var _config = ScriptableObjectLoader.LoadSoSweepHit(_id); if (_config.hitEffectId > 0) { InstanceResourcesLoader.LoadEffectAsync(_config.hitEffectId); } } else if (_type == SoSkill.E_AttackType.FlyObject) { var _config = ScriptableObjectLoader.LoadSoFlyObject(_id); if (_config.hitEffectId > 0) { InstanceResourcesLoader.LoadEffectAsync(_config.hitEffectId); } if (_config.ammoEffectId > 0) { InstanceResourcesLoader.LoadEffectAsync(_config.hitEffectId); } } } } } } } Core/SFX/SFXPlayUtility.cs
@@ -18,7 +18,6 @@ public SFXController PlayEffectAsync(int id, Transform parent, float scale = 1) { var config = Config.Instance.Get<EffectConfig>(id); Debug.LogFormat("[{0}] 开始异步加载: {1}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), config.fxName); var bundleName = StringUtility.Contact(ResourcesPath.EFFECT_Folder_Name, config.packageName); if (AssetSource.effectFromEditor || AssetBundleUtility.Instance.JudgeExistAsset(bundleName, config.fxName)) { @@ -41,7 +40,6 @@ } else { Debug.LogFormat("[{0}] 开始异步加载: {1}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), config.fxName); AssetBundleUtility.Instance.Co_LoadAsset(bundleName, config.fxName, OnEffectLoaded); return null; } @@ -55,7 +53,6 @@ if (_prefab) { GameObjectPoolManager.Instance.CacheGameObject(_prefab, 1, false); Debug.LogFormat("[{0}] 异步加载: {1} 完毕", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), _prefab.name); } } } @@ -134,7 +131,7 @@ } else { Debug.LogFormat("[{0}] 开始异步加载: {1}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), config.fxName); // Debug.LogFormat("[{0}] 开始异步加载: {1}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), config.fxName); AssetBundleUtility.Instance.Co_LoadAsset(bundleName, config.fxName, OnEffectLoaded); return null; } Fight/Stage/StageManager.cs
@@ -8,7 +8,7 @@ [XLua.LuaCallCSharp] public class StageManager : Singleton<StageManager> { private Stage m_CurrentStage; @@ -19,32 +19,40 @@ public event Action<float> loadingProgressEvent; bool m_IsServerPreparing = false; public bool isServerPreparing { public bool isServerPreparing { get { return m_IsServerPreparing; } set { m_IsServerPreparing = value; } } public Stage.E_StageType StageType { get { public Stage.E_StageType StageType { get { return m_StageType; } } public Stage CurrentStage { get { public Stage CurrentStage { get { return m_CurrentStage; } } int m_CurrentMapId; public int currentMapId { public int currentMapId { get { return m_CurrentMapId; } private set { m_CurrentMapId = value; } } int m_CurrentMapResID; public int currentMapResId { get { public int currentMapResId { get { return m_CurrentMapResID; } private set { m_CurrentMapResID = value; } @@ -55,9 +63,11 @@ float m_LoadingProgress = 0f; float loadingProgress { float loadingProgress { get { return m_LoadingProgress; } set { set { m_LoadingProgress = value; if (loadingProgressEvent != null) { @@ -584,6 +594,15 @@ _hero.RequestLight(); PlayerDatas.Instance.hero = _hero; var _preloadEffectList = GeneralDefine.PreloadSkillEffect[_hero.JobSetup.Job - 1]; if (_preloadEffectList != null && _preloadEffectList.Length > 0) { foreach (var _id in _preloadEffectList) { InstanceResourcesLoader.PreloadSkillEffect(_id); } } } private string GetAssetBundleNameByStageId(int stageID, int mapResID) System/Achievement/AchievementModel.cs
@@ -179,7 +179,7 @@ switch (config.Type) { case 3: WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); var hasTask = taskmodel.GetQuestState(config.Condition[0]) != -1; @@ -234,7 +234,7 @@ else { taskmodel.DailyBountyMove(); WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); } } @@ -243,7 +243,7 @@ case 1: if (PlayerDatas.Instance.baseData.LV < GeneralDefine.achievementEarlierStageLevel) { WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); taskmodel.AutomaticTripToTask(taskmodel.currentMission); } @@ -257,7 +257,7 @@ break; case 4: case 86: WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); var mapModel = ModelCenter.Instance.GetModel<MapModel>(); var pointId = mapModel.GetRecommendHangPoint(); var mapEventConfig = Config.Instance.Get<MapEventPointConfig>(pointId); @@ -265,12 +265,12 @@ WindowCenter.Instance.Open<LocalMapWin>(); break; case 36: WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); MapTransferUtility.Instance.MoveToNPC(config.Condition[0]); break; case 37: WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); MapTransferUtility.Instance.MoveToLocalMapPosition(config.Condition2.Vector3Parse()); break; @@ -292,7 +292,7 @@ { if (PlayerDatas.Instance.baseData.LV < GeneralDefine.achievementEarlierStageLevel) { WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); taskmodel.AutomaticTripToTask(taskmodel.currentMission); } @@ -333,7 +333,7 @@ else { AchievementGoto.guideAchievementId = _achievementId; WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); playerPack.SetLookIndex(guid82); WindowCenter.Instance.Close<MainInterfaceWin>(); @@ -358,7 +358,7 @@ { AchievementGoto.guideAchievementId = _achievementId; playerPack.SetLookIndex(guid83); WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Close<MainInterfaceWin>(); WindowCenter.Instance.Open<KnapSackWin>(); } @@ -379,7 +379,7 @@ } else { WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); playerPack.SetLookIndex(guid84); WindowCenter.Instance.Close<MainInterfaceWin>(); @@ -402,7 +402,7 @@ } else { WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); playerPack.SetLookIndex(guid85); WindowCenter.Instance.Close<MainInterfaceWin>(); @@ -417,7 +417,7 @@ } else { WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); playerPack.SetLookIndex(guid90); WindowCenter.Instance.Close<MainInterfaceWin>(); @@ -425,7 +425,7 @@ } break; case 109: WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); var skillId = SkillConfig.FindSkillByJob(config.Condition, PlayerDatas.Instance.baseData.Job); if (skillId != 0) @@ -483,7 +483,7 @@ } treasureModel.currentCategory = TreasureCategory.Human; treasureModel.selectedTreasure = treasureId; if (!WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) if (!WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.TreasureCollectSoul); } @@ -491,7 +491,7 @@ } break; default: WindowCenter.Instance.Close<TreasureLevelUpWin>(); WindowCenter.Instance.Close<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); break; System/BossShow/BossShowModel.cs
@@ -80,10 +80,10 @@ ActiveBossShowCam(true); CameraController.Instance.CameraObject.enabled = false; if (WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) if (WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { WindowJumpMgr.Instance.ClearJumpData(); WindowCenter.Instance.CloseImmediately<TreasureLevelUpWin>(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.CloseImmediately<TreasureSelectWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); } System/Chat/ChatCenter.cs
@@ -779,7 +779,7 @@ private void CheckChatFloatOpen() { if (WindowCenter.Instance.ExitAnyFullScreenOrMaskWin() && !WindowCenter.Instance.IsOpen<LoadingWin>() && StageManager.Instance.CurrentStage is DungeonStage && !WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) && StageManager.Instance.CurrentStage is DungeonStage && !WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { if (!WindowCenter.Instance.IsOpen<ChatFloatWin>()) { System/Compose/New/ComposeEquipWin.cs
@@ -323,6 +323,7 @@ if (preSecondType != curSecondType) { isIncreaseRate = false; preSecondType = curSecondType; curComposeEquipIndex = -1; selectModel.ClearSelectModel(); @@ -352,6 +353,7 @@ if (preThirdType != curThirdType) { isIncreaseRate = false; preThirdType = curThirdType; } curComposeEquipIndex = -1; @@ -572,13 +574,14 @@ composeBtn.gameObject.SetActive(true); onekeyPutBtn.gameObject.SetActive(true); UpdateComposeMat(); RefreshComposeSuccessRate(); } RefreshComposeSuccessRate(); } public void RefreshComposeSuccessRate() { if (compoundModel == null) return; successRate = 0; int increaseRate = 0; if (compoundModel != null) System/GeneralConfig/GeneralDefine.cs
@@ -122,6 +122,7 @@ public static List<int> dogzNoRebornRemindMaps = null; public static string[][] ModeDefaultConfig { get; private set; } public static int[][] PreloadSkillEffect { get; private set; } public static int[] RealmGroup { get; private set; } public static float PrefightAtkRange { get; private set; } @@ -529,6 +530,11 @@ fairyLandBuffCondition = GetInt("XjmjAddHarm", 1); fairyLandBuffId = GetInt("XjmjAddHarm", 2); achievementEarlierStageLevel = GetInt("AchieveLV"); func = Config.Instance.Get<FuncConfigConfig>("PreloadSkillEffect"); PreloadSkillEffect = new int[2][]; PreloadSkillEffect[0] = GetIntArray("PreloadSkillEffect"); PreloadSkillEffect[1] = GetIntArray("PreloadSkillEffect", 2); } catch (Exception ex) { System/MainInterfacePanel/CoinTaskTipModel.cs
@@ -114,7 +114,7 @@ private IEnumerator PopupPanel() { yield return WaitingForSecondConst.WaitMS1500; if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { yield break; } @@ -136,7 +136,7 @@ private IEnumerator FairyAuTaskPanel() { yield return WaitingForSecondConst.WaitMS1500; if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { yield break; } System/MainInterfacePanel/FlyingShoesTask.cs
@@ -189,7 +189,7 @@ { treasureModel.selectedTreasure = _treasureId; treasureModel.openFromTaskId = Task_ID; WindowCenter.Instance.Open<TreasureLevelUpWin>(); WindowCenter.Instance.Open<TreasureBaseWin>(); } return; } @@ -211,7 +211,7 @@ { treasureModel.selectedTreasure = _treasureId; treasureModel.openFromTaskId = Task_ID; WindowCenter.Instance.Open<TreasureLevelUpWin>(); WindowCenter.Instance.Open<TreasureBaseWin>(); } } break; System/MainInterfacePanel/PlayerTaskDatas.cs
@@ -1295,7 +1295,7 @@ yield break; } if (WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) if (WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { yield break; } System/MainInterfacePanel/PowerAddWin.cs
@@ -121,7 +121,7 @@ void CheckPosition() { var type = WindowType.None; if (WindowCenter.Instance.IsOpen<TreasureLevelUpWin>()) if (WindowCenter.Instance.IsOpen<TreasureBaseWin>()) { type = WindowType.TreasureLevelUp; } System/Store/StoreModel.cs
@@ -109,6 +109,260 @@ isLogin = false; } #region 解析本地数据 public Dictionary<int, List<int>> storeRedRuleDict { get; private set; } //红点类型 1,免费商品 2,必买商品 3,坐骑灵宠 4,可购买物品(积分兑换) public Dictionary<int, List<int>> storePushDict { get; private set; } //1,每日弹1次2,只弹1次 private void ParseFuncConfig() { storeRedRuleDict = new Dictionary<int, List<int>>(); storePushDict = new Dictionary<int, List<int>>(); FuncConfigConfig storeRedRules = Config.Instance.Get<FuncConfigConfig>("StoreRedRules"); if(storeRedRules != null) { JsonData redRules = JsonMapper.ToObject(storeRedRules.Numerical1); foreach(var type in redRules.Keys) { int redType = 0; int.TryParse(type,out redType); JsonData shops = redRules[type]; if (!storeRedRuleDict.ContainsKey(redType)) { List<int> shopIdlist = new List<int>(); if(shops.IsArray) { for(int i = 0; i < shops.Count; i++) { int shopId = 0; int.TryParse(shops[i].ToString(),out shopId); shopIdlist.Add(shopId); } } storeRedRuleDict.Add(redType,shopIdlist); } } JsonData pushRules = JsonMapper.ToObject(storeRedRules.Numerical2); foreach(var type in pushRules.Keys) { int pushType = 0; int.TryParse(type,out pushType); JsonData shops = pushRules[type]; if (!storePushDict.ContainsKey(pushType)) { List<int> shopIdlist = new List<int>(); if (shops.IsArray) { for (int i = 0; i < shops.Count; i++) { int shopId = 0; int.TryParse(shops[i].ToString(), out shopId); shopIdlist.Add(shopId); } } storePushDict.Add(pushType, shopIdlist); } } } } public Dictionary<int,List<StoreConfig>> storeTypeDict { get; private set; } private void ParseStoreConfig() { storeTypeDict = new Dictionary<int, List<StoreConfig>>(); List<StoreConfig> storeConfigs = Config.Instance.GetAllValues<StoreConfig>(); for(int i = 0; i < storeConfigs.Count; i++) { var config = storeConfigs[i]; if(config.ShopType != 0) { if(!storeTypeDict.ContainsKey(config.ShopType)) { List<StoreConfig> configs = new List<StoreConfig>(); configs.Add(config); storeTypeDict.Add(config.ShopType,configs); } else { storeTypeDict[config.ShopType].Add(config); } } } foreach(var type in storeTypeDict.Keys) { var configs = storeTypeDict[type]; configs.Sort(CompareByShopSort); } } public int CompareByShopSort(StoreConfig start, StoreConfig end) { int sort1 = start.ShopSort; int sort2 = end.ShopSort; if (sort1.CompareTo(sort2) != 0) return sort1.CompareTo(sort2); return 0; } #endregion #region 获取数据 public bool TryGetRedTypeByShopId(int shopId, out int type) { type = 0; foreach (var key in storeRedRuleDict.Keys) { List<int> idlist = storeRedRuleDict[key]; if (idlist.Contains(shopId)) { type = key; return true; } } return false; } public bool TryGetPushTypeByShopId(int shopId, out int type) { type = 0; foreach (var key in storePushDict.Keys) { List<int> idlist = storePushDict[key]; if (idlist.Contains(shopId)) { type = key; return true; } } return false; } private Dictionary<int, List<StoreConfig>> showStoreTypeDict = new Dictionary<int, List<StoreConfig>>(); public void UpdateShowStore() { showStoreTypeDict.Clear(); foreach(var type in storeTypeDict.Keys) { var configs = storeTypeDict[type]; List<StoreConfig> showConfigs = new List<StoreConfig>(); if(!showStoreTypeDict.ContainsKey(type)) { for (int i = 0; i < configs.Count; i++) { var config = configs[i]; int remainNum = 0; bool isSellOut = TryGetIsSellOut(config, out remainNum); if(isSellOut && config.TheOnlyShop == 1) { } } } } } public bool TryGetIsSellOut(StoreConfig storeConfig, out int remainCnt) { int canBuyCnt = 0; int addBuyCnt = 0; remainCnt = 0; bool isLimitBuy = TryGetLimitBuy(storeConfig, out canBuyCnt, out addBuyCnt); if (!isLimitBuy) return false; int remainNum = canBuyCnt; BuyShopItemLimit shopItemLimit = GetBuyShopLimit((uint)storeConfig.ID); if (shopItemLimit != null) { remainNum -= shopItemLimit.BuyCnt; } if (remainNum <= 0) { return true; } return false; } public bool TryGetLimitBuy(StoreConfig config, out int canBuyCnt, out int addBuyCnt) { canBuyCnt = 0; addBuyCnt = 0; if (config == null) return false; int[] canBuyNums = config.PurchaseNumber; if (canBuyNums == null || canBuyNums.Length < 1) return false; int curVipIndex = -1; int nexVipIndex = -1; bool isVipBuy = TryGetVipBuy(config, out curVipIndex, out nexVipIndex); if (isVipBuy) { if (curVipIndex != -1) { canBuyCnt = canBuyNums[curVipIndex]; } if (nexVipIndex != -1) { addBuyCnt = canBuyNums[nexVipIndex] - canBuyCnt; } return true; } else { if (canBuyNums[0] != 0) { canBuyCnt = canBuyNums[0]; return true; } else { return false; } } } public bool TryGetVipBuy(StoreConfig config, out int curVipIndex, out int nextVipIndex) { curVipIndex = -1; nextVipIndex = -1; bool isVipBuy = false; if (config == null) return false; var vipLvs = config.VIPLV; if (vipLvs == null || vipLvs.Length < 1) return false; for(int i = 0; i < vipLvs.Length; i++) { var vipLv = vipLvs[i]; if(vipLv != 0) { isVipBuy = true; } } if (isVipBuy) { int playerVip = PlayerDatas.Instance.baseData.VIPLv; for (int i = vipLvs.Length - 1; i > -1; i--) { var vipLv = vipLvs[i]; if (vipLv > playerVip) { nextVipIndex = i; } else if (vipLv <= playerVip) { curVipIndex = i; break; } } } return isVipBuy; } #endregion public string GetStoreRefreshTimeByType(int type) { if (resetTimeDict == null || !resetTimeDict.ContainsKey(type)) return string.Empty; System/Treasure/DemonTreasureWin.cs
New file @@ -0,0 +1,70 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, November 13, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class DemonTreasureWin : Window { [SerializeField] TreasureDemonBehaviour m_TreasureDemonBehaviour; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { UI3DTreasureSelectStage.Instance.SetStartState(); } protected override void OnActived() { base.OnActived(); model.treasureSelectedEvent += TreasureSelectedEvent; m_TreasureDemonBehaviour.Display(model.selectedTreasure, true); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.treasureSelectedEvent -= TreasureSelectedEvent; model.SetTreasureUnlockShow(TreasureCategory.Demon, 0); } protected override void OnAfterClose() { } #endregion private void TreasureSelectedEvent(int obj) { m_TreasureDemonBehaviour.Display(model.selectedTreasure, false); } } } System/Treasure/DemonTreasureWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 9a3ed68d5cc690a458ae6f67f431841b timeCreated: 1542095044 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/FairyTreasureCollectPanel.cs
@@ -12,8 +12,10 @@ { public class FairyTreasureCollectPanel : MonoBehaviour { [SerializeField] Image m_TreasureNameIcon; [SerializeField] PositionTween m_NameTween; [SerializeField] TreasureContainer[] m_TreasureContainers; public void Display(int _treasureId, bool _tween = false) { @@ -33,6 +35,20 @@ } } var config = Config.Instance.Get<TreasureConfig>(_treasureId); if (config != null) { m_TreasureNameIcon.SetSprite(config.TreasureNameIcon); } if (_tween) { m_NameTween.Play(); } else { m_NameTween.SetEndState(); } } public void Dispose() System/Treasure/FairyTreasureCollectPanelPattern3.cs
@@ -130,7 +130,7 @@ FuncOpen.Instance.ProcessorFuncErrorTip(124); return; } WindowCenter.Instance.CloseImmediately<TreasureLevelUpWin>(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Open<TreasureFindHostWin>(); break; } @@ -145,7 +145,7 @@ } if (show) { WindowCenter.Instance.CloseImmediately<TreasureLevelUpWin>(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); } show = false; System/Treasure/FairyTreasureCollectPanelPattern5.cs
@@ -182,7 +182,7 @@ private void DisplayFurnacesHole() { m_ContainerHoles.gameObject.SetActive(treasure.state == TreasureState.Collected); if (treasure.state == TreasureState.Collected) if (treasure.state == TreasureState.Collected && treasure.stage == 0) { var _list = model.GetFurnacesAchievements(); for (int i = 0; i < m_FurnacesIcons.Length; i++) @@ -218,7 +218,7 @@ m_FurnacesIcons[i].gameObject.SetActive(achievement != null && achievement.completed); } } else if (treasure.state == TreasureState.Collected && treasure.stage >= 1) { for (int i = 0; i < m_FurnacesIcons.Length; i++) { @@ -257,7 +257,7 @@ { TreasureStageUpTriggerWin.screenShotCut = _tex; WindowJumpMgr.Instance.ClearJumpData(); WindowCenter.Instance.CloseImmediately<TreasureLevelUpWin>(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Open<TreasureStageUpTriggerWin>(true); WindowCenter.Instance.Open<MainInterfaceWin>(); if (WindowCenter.Instance.IsOpen<DialogueDuidanceWin>()) @@ -439,7 +439,7 @@ private void GotoStove() { WindowCenter.Instance.CloseImmediately<TreasureLevelUpWin>(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Close<MainInterfaceWin>(); WindowCenter.Instance.Open<BlastFurnaceWin>(); } System/Treasure/FairyTreasureWin.cs
New file @@ -0,0 +1,70 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, November 13, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class FairyTreasureWin : Window { [SerializeField] FairyTreasureCollectPanel m_TreasureFairyBehaviour; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { UI3DTreasureSelectStage.Instance.SetStartState(); } protected override void OnActived() { base.OnActived(); model.treasureSelectedEvent += TreasureSelectedEvent; m_TreasureFairyBehaviour.Dispose(); m_TreasureFairyBehaviour.Display(model.selectedTreasure, true); } protected override void OnAfterOpen() { } protected override void OnPreClose() { m_TreasureFairyBehaviour.Dispose(); model.treasureSelectedEvent -= TreasureSelectedEvent; } protected override void OnAfterClose() { } #endregion private void TreasureSelectedEvent(int obj) { m_TreasureFairyBehaviour.Dispose(); m_TreasureFairyBehaviour.Display(model.selectedTreasure, false); } } } System/Treasure/FairyTreasureWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: e51dda432d4101d459487613d8918b7e timeCreated: 1542095817 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/TreasureBaseWin.cs
New file @@ -0,0 +1,288 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, November 13, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class TreasureBaseWin : Window { [SerializeField] RectTransform m_DisplayContainer; [SerializeField] Image m_TreasureTitle; [SerializeField] DragSelectComponent m_DragSelect; [SerializeField] Button m_Left; [SerializeField] Button m_Right; [SerializeField] Button m_Back; public static event Func<int, bool> allowSelectTreasure; public static event Func<int> allowBack; public static event Action<int> prepareSelectTreasure; public static event Action prepareBack; bool backToSelectWindow = false; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Left.onClick.AddListener(Left); m_Right.onClick.AddListener(Right); m_Back.onClick.AddListener(Back); } protected override void OnPreOpen() { backToSelectWindow = false; m_DisplayContainer.gameObject.SetActive(false); if (UI3DTreasureSelectStage.Instance.IsOpen) { if (UI3DTreasureSelectStage.Instance.jumpTreasure != 0) { model.selectedTreasure = UI3DTreasureSelectStage.Instance.jumpTreasure; } else { model.selectedTreasure = UI3DTreasureSelectStage.Instance.selectTreasure; } } } protected override void OnAfterOpen() { UI3DTreasureSelectStage.Instance.OnCameraCloserComplete += OnCameraCloserComplete; UI3DTreasureSelectStage.Instance.OnCameraBackComplete += OnCameraBackComplete; m_DragSelect.onDragComplete += OnDragComplete; model.treasureSelectedEvent += TreasureSelectedEvent; CameraManager.uiCamera.enabled = true; if (!UI3DTreasureSelectStage.Instance.IsOpen) { UI3DTreasureSelectStage.Instance.Open(true, model.currentCategory); var _list = model.GetTreasureCategory(model.currentCategory); var _index = _list.FindIndex((x) => { return x == model.selectedTreasure; }); UI3DTreasureSelectStage.Instance.GotoImmediatly(_index); OnCameraCloserComplete(); } else if (UI3DTreasureSelectStage.Instance.CloserComplete) { OnCameraCloserComplete(); } } protected override void OnPreClose() { CloseSubWindows(); UI3DTreasureSelectStage.Instance.OnCameraCloserComplete -= OnCameraCloserComplete; UI3DTreasureSelectStage.Instance.OnCameraBackComplete -= OnCameraBackComplete; m_DragSelect.onDragComplete -= OnDragComplete; model.treasureSelectedEvent -= TreasureSelectedEvent; if (!backToSelectWindow) { UI3DTreasureSelectStage.Instance.Close(); } } protected override void OnAfterClose() { } #endregion private void TreasureSelectedEvent(int treasureId) { DisplaySelects(); var list = model.GetTreasureCategory(model.currentCategory); var index = list.FindIndex((x) => { return x == treasureId; }); if (index != -1) { UI3DTreasureSelectStage.Instance.GotoImmediatly(index); } } private void OnCameraCloserComplete() { if (WindowCenter.Instance.IsOpen<EffectToFaBaoWin>()) { WindowCenter.Instance.CloseImmediately<EffectToFaBaoWin>(); } CloseSubWindows(); m_DisplayContainer.gameObject.SetActive(true); switch (model.currentCategory) { case TreasureCategory.Human: m_TreasureTitle.SetSprite("XT_FB_45"); m_Left.image.SetSprite("XT_FB_33"); m_Right.image.SetSprite("XT_FB_34"); WindowCenter.Instance.Open<TreasureLevelUpWin>(); break; case TreasureCategory.Demon: m_TreasureTitle.SetSprite("XT_FB_46"); m_Left.image.SetSprite("XT_FB_35"); m_Right.image.SetSprite("XT_FB_36"); WindowCenter.Instance.Open<DemonTreasureWin>(); break; case TreasureCategory.Fairy: m_TreasureTitle.SetSprite("XT_FB_47"); m_Left.image.SetSprite("XT_FB_33"); m_Right.image.SetSprite("XT_FB_34"); WindowCenter.Instance.Open<FairyTreasureWin>(); break; } DisplaySelects(); } private void DisplaySelects() { var leftRifht = Config.Instance.Get<TreasureConfig>(model.selectedTreasure + 1); m_Right.gameObject.SetActive(leftRifht != null); leftRifht = Config.Instance.Get<TreasureConfig>(model.selectedTreasure - 1); m_Left.gameObject.SetActive(leftRifht != null); } private void OnCameraBackComplete() { backToSelectWindow = true; CloseImmediately(); } private void OnDragComplete(int result) { if (result > 0) { Right(); } else if (result < 0) { Left(); } } private void Left() { var selectTreasure = model.selectedTreasure - 1; if (!AllowSelectTreasure(selectTreasure)) { return; } if (prepareSelectTreasure != null) { prepareSelectTreasure(selectTreasure); } model.selectedTreasure = selectTreasure; } private void Right() { var selectTreasure = model.selectedTreasure + 1; if (!AllowSelectTreasure(selectTreasure)) { return; } if (prepareSelectTreasure != null) { prepareSelectTreasure(selectTreasure); } model.selectedTreasure = selectTreasure; } private void Back() { var returnCode = 0; if (allowBack != null) { returnCode = allowBack(); } if (returnCode != 0) { return; } if (PlayerDatas.Instance.baseData.LV < model.treasureBackLvLimit && !WindowJumpMgr.Instance.IsJumpState) { StartBack(); return; } if (!WindowJumpMgr.Instance.IsJumpState && model.openFromTreasureList) { StartBack(); return; } if (!WindowJumpMgr.Instance.IsJumpState && model.exitRecord >= 4) { StartBack(); model.exitRecord = 0; return; } model.openFromTreasureList = false; CloseImmediately(); if (!WindowJumpMgr.Instance.IsJumpState) { model.exitRecord++; WindowCenter.Instance.Open<MainInterfaceWin>(); } } void StartBack() { if (prepareBack != null) { prepareBack(); } model.openFromTreasureList = false; CloseSubWindows(); m_DisplayContainer.gameObject.SetActive(false); WindowCenter.Instance.Open<TreasureSelectWin>(true); UI3DTreasureSelectStage.Instance.StartBack(); } private bool AllowSelectTreasure(int treasureId) { Treasure treasure; if (!model.TryGetTreasure(treasureId, out treasure)) { return false; } if (allowSelectTreasure != null && !allowSelectTreasure(treasureId)) { return false; } return true; } private void CloseSubWindows() { var childrens = WindowConfig.Get().FindChildWindows("TreasureBaseWin"); foreach (var window in childrens) { WindowCenter.Instance.Close(window); } } } } System/Treasure/TreasureBaseWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 8caae764204324b49a5cdc5ee43c33c4 timeCreated: 1542077271 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/TreasureCollectBriefInfoBehaviour.cs
@@ -384,7 +384,7 @@ model.selectedTreasure = displayTreasureId; model.currentCategory = (TreasureCategory)config.Category; model.openFromTreasureCollect = true; WindowCenter.Instance.Open<TreasureLevelUpWin>(); WindowCenter.Instance.Open<TreasureBaseWin>(); } } System/Treasure/TreasureDemonBehaviour.cs
@@ -9,6 +9,7 @@ { public class TreasureDemonBehaviour : MonoBehaviour { [SerializeField] Image m_TreasureNameIcon; [SerializeField] Text m_TreasureDescription; [SerializeField] RectTransform m_ContainerFightPower; [SerializeField] Text m_FightPower; @@ -24,6 +25,7 @@ [SerializeField] PositionTween m_DescriptionTween; [SerializeField] PositionTween m_SkillTween; [SerializeField] PositionTween m_NameTween; TreasureModel m_Model; TreasureModel model @@ -74,11 +76,13 @@ m_SkillTween.SetStartState(); m_DescriptionTween.Play(); m_SkillTween.Play(); m_NameTween.Play(); } else { m_DescriptionTween.SetEndState(); m_SkillTween.SetEndState(); m_NameTween.SetEndState(); } var config = Config.Instance.Get<TreasureConfig>(_id); @@ -91,6 +95,7 @@ m_GetBtn.gameObject.SetActive(m_Treasure.state == TreasureState.Collecting); m_RecommondPower.gameObject.SetActive(m_Treasure.state != TreasureState.Collected); m_ContainerFightPower.gameObject.SetActive(m_Treasure.state == TreasureState.Collected); m_TreasureNameIcon.SetSprite(config.TreasureNameIcon); if (m_Treasure.state == TreasureState.Locked) { System/Treasure/TreasureExhibitionBehaviour.cs
@@ -58,7 +58,7 @@ { return; } if (_window is TreasureSelectWin || _window is TreasureLevelUpWin) if (_window is TreasureSelectWin || _window is TreasureBaseWin) { if (!m_NewTreasureEffect.IsPlaying) { System/Treasure/TreasureLevelUpWin.cs
@@ -17,8 +17,6 @@ { [SerializeField] TreasureAnimation m_TreasureAnimation; [SerializeField] RectTransform m_DisplayContainer; [SerializeField] Image m_TreasureTitle; [SerializeField] DragSelectComponent m_DragSelect; [SerializeField] RectTransform m_ContainerUnGet; [SerializeField] RectTransform m_ContainerLockDetail; @@ -54,16 +52,6 @@ [SerializeField] RectTransform m_ContainerPotential; [SerializeField] TreasurePotentialPanel m_TreasurePotential; [SerializeField] TreasureDemonBehaviour m_TreasureDemonBehaviour; [SerializeField] FairyTreasureCollectPanel m_TreasureFairyBehaviour; [SerializeField] RectTransform m_ContainerSelect; [SerializeField] Image m_LeftRedpoint; [SerializeField] Image m_RightRedpoint; [SerializeField] Button m_LeftBtn; [SerializeField] Button m_RightBtn; [SerializeField] Button m_BackBtn; TreasureModel m_Model; TreasureModel model { @@ -95,9 +83,7 @@ Treasure m_Treasure; bool m_CorrectClose = false; bool m_OnLevelUpStage = false; bool m_Init = false; bool m_NewBieGuide = false; int mainTaskId = 0; @@ -118,44 +104,29 @@ protected override void AddListeners() { m_BackBtn.onClick.AddListener(OnBack); m_GetTreasureBtn.onClick.AddListener(OnGetTreasure); m_LevelUpBtn.onClick.AddListener(OnLevelUp); m_LeftBtn.onClick.AddListener(OnLeftBtn); m_RightBtn.onClick.AddListener(OnRightBtn); m_Controller.OnRefreshCell += OnRefreshCell; } protected override void OnPreOpen() { m_Init = false; if (UI3DTreasureSelectStage.Instance.IsOpen) { if (UI3DTreasureSelectStage.Instance.jumpTreasure != 0) { model.selectedTreasure = UI3DTreasureSelectStage.Instance.jumpTreasure; } else { model.selectedTreasure = UI3DTreasureSelectStage.Instance.selectTreasure; } } m_DisplayContainer.gameObject.SetActive(false); m_DisplayContainer.gameObject.SetActive(true); m_ContainerSkillShow.gameObject.SetActive(false); m_ContainerTip.gameObject.SetActive(false); m_CorrectClose = false; m_OnLevelUpStage = false; m_NewBieGuide = false; model.treasureStepUpShow = false; m_TreasureAnimation.stepComplete = true; beforePlayerLv = PlayerDatas.Instance.baseData.LV; model.SetTreasureUnlockShow(TreasureCategory.Human, 0); } protected override void OnAfterOpen() protected override void OnActived() { UI3DTreasureSelectStage.Instance.OnCameraCloserComplete += OnCameraCloserComplete; UI3DTreasureSelectStage.Instance.OnCameraBackComplete += OnCameraBackComplete; base.OnActived(); PlayerTaskDatas.CardLevelChange += CardLevelChange; model.treasureLevelProgressUpdateEvent += TreasureLevelProgressUpdateEvent; model.treasureSelectedEvent += TreasureSelectedEvent; @@ -169,39 +140,23 @@ m_Slider.slider.onValueChanged.AddListener(OnSliderValueUpdate); NewBieCenter.Instance.guideCompletedEvent += GuideCompletedEvent; FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; model.skillLevelUpRedpointUpdate += SkillLevelUpRedpointUpdate; m_DragSelect.onDragComplete += onDragComplete; CameraManager.uiCamera.enabled = true; if (!UI3DTreasureSelectStage.Instance.IsOpen) { UI3DTreasureSelectStage.Instance.Open(true, model.currentCategory); var _list = model.GetTreasureCategory(model.currentCategory); var _index = _list.FindIndex((x) => { return x == model.selectedTreasure; }); UI3DTreasureSelectStage.Instance.GotoImmediatly(_index); OnCameraCloserComplete(); } else if (UI3DTreasureSelectStage.Instance.CloserComplete && !m_Init) { OnCameraCloserComplete(); } model.treasureStateChangeEvent += TreasureStateChangeEvent; TreasureBaseWin.allowSelectTreasure += AllowSelectTreasure; TreasureBaseWin.prepareSelectTreasure += PrepareSelectTreasure; TreasureBaseWin.allowBack += AllowBack; TreasureBaseWin.prepareBack += PrepareBack; mainTaskId = 0; Display(); } protected override void OnActived() protected override void OnAfterOpen() { base.OnActived(); } protected override void OnPreClose() { UI3DTreasureSelectStage.Instance.OnCameraCloserComplete -= OnCameraCloserComplete; UI3DTreasureSelectStage.Instance.OnCameraBackComplete -= OnCameraBackComplete; model.treasureLevelProgressUpdateEvent -= TreasureLevelProgressUpdateEvent; PlayerTaskDatas.CardLevelChange -= CardLevelChange; model.treasureSelectedEvent -= TreasureSelectedEvent; @@ -215,19 +170,16 @@ NewBieCenter.Instance.guideCompletedEvent -= GuideCompletedEvent; model.treasureStateChangeEvent -= TreasureStateChangeEvent; FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; m_DragSelect.onDragComplete -= onDragComplete; model.skillLevelUpRedpointUpdate -= SkillLevelUpRedpointUpdate; TreasureBaseWin.allowSelectTreasure -= AllowSelectTreasure; TreasureBaseWin.prepareSelectTreasure -= PrepareSelectTreasure; TreasureBaseWin.allowBack -= AllowBack; TreasureBaseWin.prepareBack -= PrepareBack; m_Slider.slider.onValueChanged.RemoveAllListeners(); m_TreasurePotential.Dispose(); m_AchievementScroll.Dispose(); m_TreasureFairyBehaviour.Dispose(); if (FunctionalGuideCenter.Instance.ExistUnderwayGuide(65)) { FunctionalGuideCenter.Instance.RemoveGuide(65); } if (!m_CorrectClose) { UI3DTreasureSelectStage.Instance.Close(); } if (m_TreasureAnimation.step == TreasureAnimation.TreasureShowStep.FirstUnLock) { @@ -260,32 +212,11 @@ if (_id == model.selectedTreasure && _treasure != null && _treasure.state == TreasureState.Collecting && model.serverInited) { UpdateStage(); if (WindowCenter.Instance.IsOpen<EffectToFaBaoWin>()) { WindowCenter.Instance.CloseImmediately<EffectToFaBaoWin>(); } Display(); } } private void OnCameraCloserComplete() { m_Init = true; m_DisplayContainer.gameObject.SetActive(true); UpdateStage(); if (WindowCenter.Instance.IsOpen<EffectToFaBaoWin>()) { WindowCenter.Instance.CloseImmediately<EffectToFaBaoWin>(); } } private void OnCameraBackComplete() { m_CorrectClose = true; CloseImmediately(); } private void UpdateStage(int _state = 0) private void Display(int _state = 0) { m_TreasureAnimation.selectTreasureId = model.selectedTreasure; model.TryGetTreasure(model.selectedTreasure, out m_Treasure); @@ -294,71 +225,9 @@ model.cacheGotAchievements.Clear(); var _config = Config.Instance.Get<TreasureConfig>(m_Treasure.id); m_TreasureProperty.treasureNameTween.SetEndState(); switch (model.currentCategory) { case TreasureCategory.Human: beforePlayerLv = PlayerDatas.Instance.baseData.LV; m_TreasureDemonBehaviour.gameObject.SetActive(false); m_TreasureFairyBehaviour.gameObject.SetActive(false); model.treasureStepUpShow = false; SelectHumanTreasure(_state); m_TreasureTitle.SetSprite("XT_FB_45"); m_LeftBtn.image.SetSprite("XT_FB_33"); m_RightBtn.image.SetSprite("XT_FB_34"); break; case TreasureCategory.Demon: HideHuman(); m_TreasureAnimation.SetDisplayEnd(); m_TreasureAnimation.TreasureTween(); m_TreasureAnimation.stepComplete = true; model.treasureStepUpShow = false; m_TreasureProperty.containerName.gameObject.SetActive(true); m_TreasureDemonBehaviour.gameObject.SetActive(true); m_TreasureFairyBehaviour.gameObject.SetActive(false); m_TreasureDemonBehaviour.Display(m_Treasure.id, _state == 0); if (_state == 0) { m_TreasureProperty.treasureNameTween.Play(); } m_TreasureTitle.SetSprite("XT_FB_46"); m_LeftBtn.image.SetSprite("XT_FB_35"); m_RightBtn.image.SetSprite("XT_FB_36"); break; case TreasureCategory.Fairy: HideHuman(); m_TreasureAnimation.SetDisplayEnd(); m_TreasureAnimation.TreasureTween(); m_TreasureAnimation.stepComplete = true; model.treasureStepUpShow = false; m_TreasureDemonBehaviour.gameObject.SetActive(false); m_TreasureProperty.containerName.gameObject.SetActive(true); m_TreasureFairyBehaviour.gameObject.SetActive(true); m_TreasureFairyBehaviour.Dispose(); m_TreasureFairyBehaviour.Display(m_Treasure.id, _state == 0); if (_state == 0) { m_TreasureProperty.treasureNameTween.Play(); } m_TreasureTitle.SetSprite("XT_FB_47"); m_LeftBtn.image.SetSprite("XT_FB_33"); m_RightBtn.image.SetSprite("XT_FB_34"); break; } var _leftRifht = Config.Instance.Get<TreasureConfig>(model.selectedTreasure + 1); m_RightBtn.gameObject.SetActive(_leftRifht != null); _leftRifht = Config.Instance.Get<TreasureConfig>(model.selectedTreasure - 1); m_LeftBtn.gameObject.SetActive(_leftRifht != null); var skillLevelUpRedpointTreasure = model.GetSkillLevelUpRedpointTreasure(); m_LeftRedpoint.gameObject.SetActive(false); m_RightRedpoint.gameObject.SetActive(false); } private void HideHuman() { m_ContainerUnGet.gameObject.SetActive(false); m_ContainerPotential.gameObject.SetActive(false); m_ContainerLevelUp.gameObject.SetActive(false); beforePlayerLv = PlayerDatas.Instance.baseData.LV; model.treasureStepUpShow = false; SelectHumanTreasure(_state); } private void SelectHumanTreasure(int _state = 0) @@ -434,7 +303,7 @@ && FuncOpen.Instance.IsFuncOpen(82) && !model.GetSpAnim(m_Treasure.id)) { m_TreasureAnimation.step = TreasureAnimation.TreasureShowStep.FirstPotential; UpdateStage(2); Display(2); return; } } @@ -451,7 +320,7 @@ && !model.GetSpAnim(m_Treasure.id)) { m_TreasureAnimation.step = TreasureAnimation.TreasureShowStep.FirstPotential; UpdateStage(2); Display(2); } } } @@ -519,68 +388,11 @@ private void TreasureSelectedEvent(int _id) { if (!m_TreasureAnimation.stepComplete) { return; } var _list = model.GetTreasureCategory(model.currentCategory); var _index = _list.FindIndex((x) => { return x == _id; }); if (_index != -1) { m_OnLevelUpStage = false; UI3DTreasureSelectStage.Instance.GotoImmediatly(_index); UpdateStage(1); } Display(1); } private void onDragComplete(int _value) private bool AllowSelectTreasure(int treasureId) { if (_value > 0) { OnRightBtn(); } else if (_value < 0) { OnLeftBtn(); } } private void OnLeftBtn() { if (CheckSelectTreasureFunc(model.selectedTreasure - 1)) { model.openFromTaskId = 0; if (FunctionalGuideCenter.Instance.ExistUnderwayGuide(65)) { FunctionalGuideCenter.Instance.RemoveGuide(65); } model.selectedTreasure = model.selectedTreasure - 1; } } private void OnRightBtn() { if (CheckSelectTreasureFunc(model.selectedTreasure + 1)) { model.openFromTaskId = 0; if (FunctionalGuideCenter.Instance.ExistUnderwayGuide(65)) { FunctionalGuideCenter.Instance.RemoveGuide(65); } model.selectedTreasure = model.selectedTreasure + 1; } } private bool CheckSelectTreasureFunc(int _id) { Treasure _treasure; if (!model.TryGetTreasure(_id, out _treasure)) { return false; } if (model.TreasureStageUpLimit(model.selectedTreasure)) { return false; @@ -588,49 +400,31 @@ return m_TreasureAnimation.stepComplete && !model.treasureStepUpShow && !m_NewBieGuide; } private void OnBack() private void PrepareSelectTreasure(int treasureId) { if (!m_TreasureAnimation.stepComplete || model.treasureStepUpShow || m_NewBieGuide) model.openFromTaskId = 0; if (FunctionalGuideCenter.Instance.ExistUnderwayGuide(65)) { return; } if (model.TreasureStageUpLimit(model.selectedTreasure)) { return; } if (PlayerDatas.Instance.baseData.LV < model.treasureBackLvLimit && !WindowJumpMgr.Instance.IsJumpState) { StartBack(); return; } if (!WindowJumpMgr.Instance.IsJumpState && model.openFromTreasureList) { StartBack(); return; } if (!WindowJumpMgr.Instance.IsJumpState && model.exitRecord >= 4) { StartBack(); model.exitRecord = 0; return; } model.openFromTreasureList = false; CloseImmediately(); if (!WindowJumpMgr.Instance.IsJumpState) { model.exitRecord++; WindowCenter.Instance.Open<MainInterfaceWin>(); FunctionalGuideCenter.Instance.RemoveGuide(65); } } void StartBack() private int AllowBack() { if (!m_TreasureAnimation.stepComplete || model.treasureStepUpShow || m_NewBieGuide) { return 1; } if (model.TreasureStageUpLimit(model.selectedTreasure)) { return 1; } return 0; } private void PrepareBack() { model.SetTreasureUnlockShow(TreasureCategory.Human, 0); model.openFromTreasureList = false; m_DisplayContainer.gameObject.SetActive(false); WindowCenter.Instance.Open<TreasureSelectWin>(true); UI3DTreasureSelectStage.Instance.StartBack(); } private void OnGetTreasure() @@ -750,7 +544,7 @@ private void AchievementCompletedEvent(int _id) { var config = Config.Instance.Get<TreasureConfig>(model.selectedTreasure); if (!m_Init || config == null || (TreasureCategory)config.Category != TreasureCategory.Human if (config == null || (TreasureCategory)config.Category != TreasureCategory.Human || m_Treasure.state != TreasureState.Collected || m_Treasure.IsHighestStage) { return; @@ -836,7 +630,7 @@ else if (FuncOpen.Instance.IsFuncOpen(82) && !model.GetSpAnim(m_Treasure.id)) { m_TreasureAnimation.step = TreasureAnimation.TreasureShowStep.FirstPotential; UpdateStage(2); Display(2); } break; case TreasureAnimation.TreasureShowStep.FirstUnLock: @@ -864,13 +658,13 @@ if (m_Treasure.IsHighestStage && FuncOpen.Instance.IsFuncOpen(82)) { m_TreasureAnimation.step = TreasureAnimation.TreasureShowStep.FirstPotential; UpdateStage(2); Display(2); } else { if (mainTaskId != 0) { CloseImmediately(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); task.AutomaticTripToTask(mainTaskId); } @@ -995,8 +789,8 @@ break; case TreasureStageUnlock.Treasure: WindowJumpMgr.Instance.ClearJumpData(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Open<MainInterfaceWin>(); CloseImmediately(); break; case TreasureStageUnlock.TreasureSoul: TreasureSoulActiveWin.treasureSoulId = stage.treasureSoul; @@ -1019,7 +813,7 @@ { TreasureStageUpTriggerWin.screenShotCut = _tex; WindowJumpMgr.Instance.ClearJumpData(); CloseImmediately(); WindowCenter.Instance.CloseImmediately<TreasureBaseWin>(); WindowCenter.Instance.Open<TreasureStageUpTriggerWin>(true); WindowCenter.Instance.Open<MainInterfaceWin>(); if (WindowCenter.Instance.IsOpen<DialogueDuidanceWin>()) @@ -1218,13 +1012,6 @@ } } private void SkillLevelUpRedpointUpdate() { var skillLevelUpRedpointTreasure = model.GetSkillLevelUpRedpointTreasure(); m_LeftRedpoint.gameObject.SetActive(false); m_RightRedpoint.gameObject.SetActive(false); } protected override void LateUpdate() { base.LateUpdate(); @@ -1251,7 +1038,7 @@ public void PreviewAnimation() { m_TreasureAnimation.step = TreasureAnimation.TreasureShowStep.FirstPotential; UpdateStage(2); Display(2); } [ContextMenu("测试功能开启")] System/Treasure/TreasureSelectWin.cs
@@ -169,7 +169,7 @@ WindowJumpMgr.Instance.ClearJumpData(); m_CorrectClose = true; CameraManager.uiCamera.enabled = false; WindowCenter.Instance.Open<TreasureLevelUpWin>(); WindowCenter.Instance.Open<TreasureBaseWin>(); CloseImmediately(); } System/Treasure/UI3DTreasureSelectStage.cs
@@ -426,6 +426,7 @@ { StopCoroutine(preloadCoroutine); preloadCoroutine = null; Preloading = false; } if (!m_PreloadDict.ContainsKey(currentCategory) && !_closer) System/WindowJump/WindowJumpMgr.cs
@@ -503,7 +503,7 @@ SetJumpLogic<TreasureSoulWin>(_tagWinSearchModel.TABID); break; case JumpUIType.TreasureCollectSoul: SetJumpLogic<TreasureLevelUpWin>(0); SetJumpLogic<TreasureBaseWin>(0); break; case JumpUIType.Kylin: dungeonModel.currentDungeon = new Dungeon(31190, 0); @@ -617,7 +617,7 @@ case JumpUIType.LLBT: treasureModel.currentCategory = TreasureCategory.Fairy; treasureModel.selectedTreasure = int.Parse(_tagWinSearchModel.SelectActive); SetJumpLogic<TreasureLevelUpWin>(_tagWinSearchModel.TABID); SetJumpLogic<TreasureBaseWin>(_tagWinSearchModel.TABID); break; case JumpUIType.FYZJTyp1: case JumpUIType.FYZJTyp2: @@ -625,7 +625,7 @@ case JumpUIType.SHLTyp2: treasureModel.currentCategory = TreasureCategory.Demon; treasureModel.selectedTreasure = int.Parse(_tagWinSearchModel.SelectActive); SetJumpLogic<TreasureLevelUpWin>(_tagWinSearchModel.TABID); SetJumpLogic<TreasureBaseWin>(_tagWinSearchModel.TABID); break; case JumpUIType.DhszTs: @@ -640,7 +640,7 @@ case JumpUIType.StfTs: treasureModel.currentCategory = TreasureCategory.Human; treasureModel.selectedTreasure = int.Parse(_tagWinSearchModel.SelectActive); SetJumpLogic<TreasureLevelUpWin>(_tagWinSearchModel.TABID); SetJumpLogic<TreasureBaseWin>(_tagWinSearchModel.TABID); break; case JumpUIType.FirstRecharge: SetJumpLogic<FirstRechargeWin>(_tagWinSearchModel.TABID, true); System/WorldMap/LocalMapTreasure.cs
@@ -55,7 +55,7 @@ model.selectedTreasure = treasureId; model.currentCategory = TreasureCategory.Human; WindowCenter.Instance.Open<TreasureLevelUpWin>(); WindowCenter.Instance.Open<TreasureBaseWin>(); } } UI/Common/UI3DShowHero.cs
@@ -108,7 +108,7 @@ if (weaponId != 0) { prefab = InstanceResourcesLoader.LoadModelRes(weaponId, true); prefab = InstanceResourcesLoader.LoadModelRes(weaponId); if (prefab) { pool = GameObjectPoolManager.Instance.RequestPool(prefab); @@ -119,7 +119,7 @@ if (secondaryId != 0) { prefab = InstanceResourcesLoader.LoadModelRes(secondaryId, true); prefab = InstanceResourcesLoader.LoadModelRes(secondaryId); if (prefab) { if (secondaryModel) @@ -134,7 +134,7 @@ if (wingsId != 0) { prefab = InstanceResourcesLoader.LoadModelRes(wingsId, true); prefab = InstanceResourcesLoader.LoadModelRes(wingsId); if (prefab) { pool = GameObjectPoolManager.Instance.RequestPool(prefab); @@ -329,18 +329,18 @@ if (oldWeapon != 0) { prefab = InstanceResourcesLoader.LoadModelRes(oldWeapon, true); prefab = InstanceResourcesLoader.LoadModelRes(oldWeapon); pool = GameObjectPoolManager.Instance.RequestPool(prefab); pool.Release(weaponModel); weaponModel = null; } prefab = InstanceResourcesLoader.LoadModelRes(resoureceId, true); prefab = InstanceResourcesLoader.LoadModelRes(resoureceId); if (!prefab) { resoureceId = config.BaseEquip[1]; prefab = InstanceResourcesLoader.LoadModelRes(resoureceId, true); prefab = InstanceResourcesLoader.LoadModelRes(resoureceId); } if (prefab) @@ -372,7 +372,7 @@ if (oldSecondary != 0) { prefab = InstanceResourcesLoader.LoadModelRes(oldSecondary, true); prefab = InstanceResourcesLoader.LoadModelRes(oldSecondary); pool = GameObjectPoolManager.Instance.RequestPool(prefab); pool.Release(secondaryModel); secondaryModel = null; @@ -380,12 +380,12 @@ if (secondaryResId != 0) { prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId, true); prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId); if (!prefab) { var config = Config.Instance.Get<JobSetupConfig>(_job); secondaryResId = config.BaseEquip[2]; prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId, true); prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId); } if (prefab) @@ -415,7 +415,7 @@ if (oldWings != 0) { prefab = InstanceResourcesLoader.LoadModelRes(oldWings, true); prefab = InstanceResourcesLoader.LoadModelRes(oldWings); pool = GameObjectPoolManager.Instance.RequestPool(prefab); pool.Release(wingsModel); wingsModel = null; @@ -423,12 +423,12 @@ if (resourceId != 0) { prefab = InstanceResourcesLoader.LoadModelRes(resourceId, true); prefab = InstanceResourcesLoader.LoadModelRes(resourceId); if (!prefab) { resourceId = config.BaseEquip[3]; prefab = InstanceResourcesLoader.LoadModelRes(resourceId, true); prefab = InstanceResourcesLoader.LoadModelRes(resourceId); } if (prefab)