Core/GameEngine/Model/Config/TreasureDungeonConfig.cs
New file @@ -0,0 +1,59 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, November 14, 2018 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class TreasureDungeonConfig : ConfigBase { public int ID { get ; private set ; } public int MWID { get ; private set ; } public int LineID { get ; private set ; } public int Level { get ; private set ; } public string Attr { get ; private set; } public int fightPower { get ; private set ; } public string icon { get ; private set; } public string bossName { get ; private set; } public override string getKey() { return ID.ToString(); } public override void Parse() { try { ID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; MWID=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0; LineID=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0; Level=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; Attr = rawContents[4].Trim(); fightPower=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0; icon = rawContents[6].Trim(); bossName = rawContents[7].Trim(); } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/TreasureDungeonConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 61743ee3c4a581e448636306d3687f81 timeCreated: 1542164140 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/ConfigManager.cs
@@ -204,6 +204,7 @@ AddAsyncTask<ChatBubbleBoxConfig>(); AddAsyncTask<GuardConfig>(); AddAsyncTask<MarketQueryConfig>(); AddAsyncTask<TreasureDungeonConfig>(); while (!AllCompleted()) { var completedCount = 0; Core/NetworkPackage/ServerPack/HA3_Function/HA352_tagMCMagicWeaponLVInfo.cs
@@ -1,38 +1,35 @@ using UnityEngine; using System.Collections; // A3 52 法宝等级信息 #tagMCMagicWeaponLVInfo public class HA352_tagMCMagicWeaponLVInfo : GameNetPackBasic { public byte Count; // 信息个数 public tagMCMagicWeaponInfo[] InfoList = null; // 信息列表 public HA352_tagMCMagicWeaponLVInfo() { _cmd = (ushort)0xA352; } public override void ReadFromBytes(byte[] vBytes) { TransBytes(out Count, vBytes, NetDataType.BYTE); InfoList = new tagMCMagicWeaponInfo[Count]; for (int i = 0; i < Count; i++) { InfoList[i] = new tagMCMagicWeaponInfo(); TransBytes(out InfoList[i].MWID, vBytes, NetDataType.DWORD); TransBytes(out InfoList[i].LV, vBytes, NetDataType.BYTE); TransBytes(out InfoList[i].Exp, vBytes, NetDataType.DWORD); TransBytes(out InfoList[i].State, vBytes, NetDataType.BYTE); } } public struct tagMCMagicWeaponInfo { public uint MWID; public byte LV; public uint Exp; public byte State; //是否点击法宝认主 } } using UnityEngine; using System.Collections; // A3 52 法宝等级信息 #tagMCMagicWeaponLVInfo public class HA352_tagMCMagicWeaponLVInfo : GameNetPackBasic { public byte Count; // 信息个数 public tagMCMagicWeaponInfo[] InfoList; // 信息列表 public HA352_tagMCMagicWeaponLVInfo () { _cmd = (ushort)0xA352; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Count, vBytes, NetDataType.BYTE); InfoList = new tagMCMagicWeaponInfo[Count]; for (int i = 0; i < Count; i ++) { InfoList[i] = new tagMCMagicWeaponInfo(); TransBytes (out InfoList[i].MWID, vBytes, NetDataType.DWORD); TransBytes (out InfoList[i].LV, vBytes, NetDataType.BYTE); TransBytes (out InfoList[i].Exp, vBytes, NetDataType.DWORD); TransBytes (out InfoList[i].State, vBytes, NetDataType.BYTE); TransBytes (out InfoList[i].FBPassLV, vBytes, NetDataType.BYTE); } } public struct tagMCMagicWeaponInfo { public uint MWID; public byte LV; public uint Exp; public byte State; //是否点击法宝认主 public byte FBPassLV; //副本关卡 } } Core/ResModule/ScriptableObjectLoader.cs
@@ -22,6 +22,7 @@ public const string SoMapObjectGenerate_Suffix = "SoMapObjectGenerate_"; public const string SoTreasureMeridian_Suffix = "SoTreasureMeridian_"; public const string SoTreasure3D_Suffix = "SoTreasure3D_"; public const string SoDemonDungeon_Suffix = "SoDemonDungeon_"; public static SoMap LoadSoMapObjectGenerate(int mapID) { @@ -426,4 +427,34 @@ return config; } public static DemonDungeonScriptable LoadSoDemonDungeon(int _id) { DemonDungeonScriptable config = null; if (AssetSource.refdataFromEditor) { #if UNITY_EDITOR var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Refdata/ScriptableObject/SoDemonDungeon/", SoDemonDungeon_Suffix, _id, ".asset"); config = AssetDatabase.LoadAssetAtPath<DemonDungeonScriptable>(resourcePath); #endif } else { var assetName = StringUtility.Contact(SoDemonDungeon_Suffix, _id); var assetInfo = new AssetInfo(bundleName, assetName); config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as DemonDungeonScriptable; } if (config == null) { //Debug.LogErrorFormat("ScriptableObjectLoader.TreasureMeridianConfig() => 加载不到资源: {0}.", _id); } return config; } } Fight/GameActor/GA_Pet.cs
@@ -33,6 +33,8 @@ protected sealed override void OnMainModelLoaded() { base.OnMainModelLoaded(); uint _parentSID = ServerInstID / 10; if (_parentSID != PlayerDatas.Instance.PlayerId) { System/BossShow/BossShowModel.cs
@@ -8,8 +8,7 @@ namespace Snxxz.UI { [XLua.LuaCallCSharp] public class BossShowModel : Singleton<BossShowModel> public class BossShowModel : Singleton<BossShowModel> { public BossShowModel() { @@ -477,6 +476,10 @@ && (config.line == 1000 || config.line == reqDungeonLineId) && config.type == 2) { if (!RequireBossShow(config.MapID, config.line)) { break; } _showModel = config; break; } @@ -634,6 +637,35 @@ var playerId = PlayerDatas.Instance.baseData.PlayerID; return LocalSave.GetBool(StringUtility.Contact("BossShowStep_", playerId, "_", config.MapID, "_", config.NpcID)); } #region 魔族法宝特殊判断 bool RequireBossShow(int mapId, int lineId) { if (mapId != 41110) { return true; } var model = ModelCenter.Instance.GetModel<TreasureModel>(); var list = model.GetTreasureCategory(TreasureCategory.Demon); for (int i = 0; i < list.Count; i++) { TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(list[i], out treasureDungeon)) { var count = treasureDungeon.dungeonInfos.Count; if (count > 0 && treasureDungeon.dungeonInfos[0].lineId == lineId) { var maxLevel = treasureDungeon.dungeonInfos[count - 1].level; if (treasureDungeon.currentLevel < maxLevel - 1) { return false; } } } } return true; } #endregion } } System/Dungeon/DemonTreasureDungeonVictoryWin.cs
New file @@ -0,0 +1,97 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, November 15, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class DemonTreasureDungeonVictoryWin : DungeonVictoryWin { [SerializeField] PropertyBehaviour[] m_Propertys; [SerializeField] Button m_ChallengeNextLevel; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } protected override void AddListeners() { base.AddListeners(); m_ChallengeNextLevel.onClick.AddListener(ChallengeNext); } protected override void Display() { m_ContainerPoivt.gameObject.SetActive(true); base.DrawPassTime(); base.RequireDungeonExit(); DisplayDemonTreasureProperty(); } private void DisplayDemonTreasureProperty() { var result = dungeonModel.dungeonResult; TreasureDungeon treasureDungeon; Dictionary<int, int> propertyDict = null; m_ChallengeNextLevel.gameObject.SetActive(false); if (model.TryGetTreasureDungeon(41110, result.lineID, out treasureDungeon)) { var dungeonInfo = treasureDungeon.Get(result.wheel); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { propertyDict = dungeonInfo.propertyDict; } if (result.wheel < treasureDungeon.maxLevel - 1) { m_ChallengeNextLevel.gameObject.SetActive(true); } } var index = 0; if (propertyDict != null) { foreach (var key in propertyDict.Keys) { if (index < m_Propertys.Length) { m_Propertys[index].gameObject.SetActive(true); m_Propertys[index].Display(key, propertyDict[key]); } } } for (int i = index; i < m_Propertys.Length; i++) { m_Propertys[i].gameObject.SetActive(false); } } private void ChallengeNext() { TreasureDungeon treasureDungeon; var result = dungeonModel.dungeonResult; if (model.TryGetTreasureDungeon(41110, result.lineID, out treasureDungeon)) { if (result.wheel < treasureDungeon.maxLevel - 1) { CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 0; pak.ActionInfo = 0; GameNetSystem.Instance.SendInfo(pak); } } } } } System/Dungeon/DemonTreasureDungeonVictoryWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: bac3bc15f92956f4da91eeb4944fd680 timeCreated: 1542245702 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Dungeon/DungeonData.cs
@@ -59,6 +59,7 @@ public int startRewardLineID; public int enterLV; public int leaderID; public int wheel; public long totalExp { System/Dungeon/DungeonModel.cs
@@ -1024,6 +1024,16 @@ WindowCenter.Instance.Open<DungeonRuneTowerVictoryWin>(); break; case 41110: var treasureModel = ModelCenter.Instance.GetModel<TreasureModel>(); TreasureDungeon treasureDungeon; if (treasureModel.TryGetTreasureDungeon(41110, dungeonResult.lineID, out treasureDungeon)) { if (dungeonResult.wheel < treasureDungeon.maxLevel) { WindowCenter.Instance.Open<DemonTreasureDungeonVictoryWin>(); break; } } WindowCenter.Instance.Open<DungeonGetTreasureVictoryWin>(); WindowCenter.Instance.Open<TreasureDungeonVictoryWin>(); break; System/Dungeon/TreasureDungeonMissionHintWin.cs
@@ -18,11 +18,18 @@ { [SerializeField] RectTransform m_ContainerDisplay; [SerializeField] Text m_Title; [SerializeField] Text m_Description; [SerializeField] Transform m_ContainerTreasureDungeon; [SerializeField] Text m_Description; [SerializeField] Transform m_ContainerTreasure; [SerializeField] Image m_Icon; [SerializeField] ScreenMoveTo m_ScreenMoveTo; [SerializeField] Transform m_ContainerDemonDungeon; [SerializeField] PropertyBehaviour[] m_DemonPropertys; bool demonTreasureDungeon = false; int treasureId = 0; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } @@ -41,6 +48,18 @@ m_ScreenMoveTo.gameObject.SetActive(false); BossNotify.OnNotifyStateEvent += OnNotifyStateEvent; BossShowModel.Instance.bossShowCompletedEvent += BossShowCompletedEvent; var allConfigs = Config.Instance.GetAllValues<TreasureConfig>(); foreach (var value in allConfigs) { if (value.MapId == PlayerDatas.Instance.baseData.MapID && value.LineId == PlayerDatas.Instance.baseData.dungeonLineId) { treasureId = value.ID; break; } } Display(); } protected override void OnAfterOpen() @@ -61,7 +80,7 @@ protected override void OnActived() { base.OnActived(); if (!BossShowModel.Instance.BossShowing) if (!BossShowModel.Instance.BossShowing && !demonTreasureDungeon) { StartCoroutine(Co_TreasureBehaviour()); } @@ -69,32 +88,32 @@ #endregion public void Display() { CheckDemonTreasureDungeon(); m_ContainerTreasureDungeon.gameObject.SetActive(!demonTreasureDungeon); m_ContainerDemonDungeon.gameObject.SetActive(demonTreasureDungeon); if (!demonTreasureDungeon) { DisplayNormalTreasureDungeon(); } else { DisplayDemonTreasureDungeon(); } } private void BossShowCompletedEvent() { StartCoroutine(Co_TreasureBehaviour()); if (!demonTreasureDungeon) { StartCoroutine(Co_TreasureBehaviour()); } } IEnumerator Co_TreasureBehaviour() { var allConfigs = Config.Instance.GetAllValues<TreasureConfig>(); var treasureId = 0; foreach (var value in allConfigs) { if (value.MapId == PlayerDatas.Instance.baseData.MapID && value.LineId == PlayerDatas.Instance.baseData.dungeonLineId) { treasureId = value.ID; break; } } var config = Config.Instance.Get<TreasureConfig>(treasureId); var dungeonId = dungeonModel.GetDungeonId(config.MapId, config.LineId); var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId); m_Title.text = dungeonConfig.FBName; m_Description.text = dungeonConfig.Description; m_Icon.SetSprite(config.Icon); m_ScreenMoveTo.transform.SetParentEx(this.transform, Vector3.zero, Vector3.zero, Vector3.one); m_ScreenMoveTo.gameObject.SetActive(true); m_ScreenMoveTo.enabled = false; @@ -114,6 +133,80 @@ m_ContainerDisplay.gameObject.SetActive(!_state); } } void DisplayNormalTreasureDungeon() { var config = Config.Instance.Get<TreasureConfig>(treasureId); var dungeonId = dungeonModel.GetDungeonId(config.MapId, config.LineId); var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId); m_Title.text = dungeonConfig.FBName; m_Description.text = dungeonConfig.Description; m_Icon.SetSprite(config.Icon); } void DisplayDemonTreasureDungeon() { TreasureDungeon treasureDungeon; Dictionary<int, int> propertyDict = null; if (model.TryGetTreasureDungeon(treasureId, out treasureDungeon)) { var dungeonInfo = treasureDungeon.Get(treasureDungeon.currentLevel + 1); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { propertyDict = dungeonInfo.propertyDict; var config = Config.Instance.Get<TreasureDungeonConfig>(dungeonInfo.key); if (config != null) { m_Title.text = Language.Get("DemonTreasureDungeonHintTitle", config.bossName); } } } var index = 0; if (propertyDict != null) { foreach (var key in propertyDict.Keys) { if (index < m_DemonPropertys.Length) { m_DemonPropertys[index].gameObject.SetActive(true); m_DemonPropertys[index].Display(key, propertyDict[key]); index++; } } } for (int i = index; i < m_DemonPropertys.Length; i++) { m_DemonPropertys[i].gameObject.SetActive(false); } } private void CheckDemonTreasureDungeon() { var mapId = PlayerDatas.Instance.baseData.MapID; var lineId = PlayerDatas.Instance.baseData.dungeonLineId; demonTreasureDungeon = false; if (mapId == 41110) { var list = model.GetTreasureCategory(TreasureCategory.Demon); for (int i = 0; i < list.Count; i++) { TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(list[i], out treasureDungeon)) { var count = treasureDungeon.dungeonInfos.Count; if (count > 0 && treasureDungeon.dungeonInfos[0].lineId == lineId) { var maxLevel = treasureDungeon.dungeonInfos[count - 1].level; if (treasureDungeon.currentLevel < maxLevel - 1) { demonTreasureDungeon = true; break; } } } } } } } } System/MainInterfacePanel/SkillButtonEffects.cs
@@ -363,7 +363,7 @@ Treasure treasure; if (treasureModel.TryGetTreasure(treasures[i], out treasure)) { _SkillAndPreTreasure[treasure.unLockSkill] = treasures[i]; _SkillAndPreTreasure[treasure.unlockSkill] = treasures[i]; } } } System/MainInterfacePanel/TipPanel.cs
@@ -24,12 +24,19 @@ LoginAdModel loginAdModel { get { return ModelCenter.Instance.GetModel<LoginAdModel>(); } } FirstTimeRechargeModel firstTimeRechargeModel { get { return ModelCenter.Instance.GetModel<FirstTimeRechargeModel>(); } } StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } public TipPanel() { WindowCenter.Instance.windowAfterOpenEvent += windowBeforeOpen; NewBieCenter.Instance.guideCompletedEvent += guideCompleted; StageManager.Instance.onStageLoadFinish += OnStageLoadFinish; TreasureNewGotWin.CloseTreasureNewGotWinEvent += CloseTreasureNewGotWinEvent; } private void CloseTreasureNewGotWinEvent() { SnxxzGame.Instance.StartCoroutine(Co_Load()); } private void OnStageLoadFinish() @@ -54,7 +61,8 @@ { yield return null; if (WindowCenter.Instance.IsOpen<MainInterfaceWin>() && !NewBieCenter.Instance.inGuiding && !WindowCenter.Instance.ExitAnyFullScreenOrMaskWin() && !StageManager.Instance.isLoading) && !WindowCenter.Instance.ExitAnyFullScreenOrMaskWin() && !StageManager.Instance.isLoading && !treasureModel.newGotShowing) { IsOPenTip(); } @@ -65,7 +73,7 @@ yield return WaitingForSecondConst.WaitMS500; if (WindowCenter.Instance.IsOpen<MainInterfaceWin>() && !NewBieCenter.Instance.inGuiding && !WindowCenter.Instance.ExitAnyFullScreenOrMaskWin() && !StageManager.Instance.isLoading && StageManager.Instance.CurrentStage is DungeonStage) && StageManager.Instance.CurrentStage is DungeonStage && !treasureModel.newGotShowing) { IsOPenTip(); } System/Message/RichText.cs
@@ -199,7 +199,7 @@ return; } #endif if (language && !string.IsNullOrEmpty(enableDisplay)) if (language && !string.IsNullOrEmpty(enableDisplay) && Application.isPlaying) { text = Language.Get(enableDisplay); } System/Role/PropertyBehaviour.cs
@@ -10,6 +10,7 @@ { [SerializeField] Text m_PropertyName; [SerializeField] Text m_PropertyValue; [SerializeField] Text m_PropertyAdd; public void Display(int _property, int _value) { @@ -43,6 +44,26 @@ config.ISPercentage == 1 ? "%" : string.Empty); } } public void DisplayAdd(int _property, int _value, int _add) { var config = Config.Instance.Get<PlayerPropertyConfig>(_property); if (config != null) { m_PropertyName.text = StringUtility.Contact(config.Name, ":"); m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage)), config.ISPercentage == 1 ? "%" : string.Empty); if (_add == 0) { m_PropertyAdd.text = string.Empty; } else { m_PropertyAdd.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_add, config.ISPercentage)), config.ISPercentage == 1 ? "%" : string.Empty); } } } } } System/Treasure/DemonDungeonBehaviour.cs
New file @@ -0,0 +1,74 @@ using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class DemonDungeonBehaviour : MonoBehaviour { [SerializeField] Image m_NormalBottom; [SerializeField] Image m_TreasureBottom; [SerializeField] Text m_BossName; [SerializeField] Image m_Icon; [SerializeField] RectTransform m_ContainerSelect; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } public void Display(int treasureId, int level) { TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(treasureId, out treasureDungeon)) { var count = treasureDungeon.dungeonInfos.Count; var maxlevel = treasureDungeon.dungeonInfos[count - 1].level; var active = level <= treasureDungeon.currentLevel; var select = level == treasureDungeon.currentLevel + 1; var dungeonInfo = treasureDungeon.Get(level); m_NormalBottom.gameObject.SetActive(level != maxlevel); m_TreasureBottom.gameObject.SetActive(level == maxlevel); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { var config = Config.Instance.Get<TreasureDungeonConfig>(dungeonInfo.key); m_BossName.text = config.bossName; m_Icon.SetSprite(config.icon); } if (active) { m_BossName.text = Language.Get("PassedTreasureDungeon"); m_BossName.color = UIHelper.GetUIColor(TextColType.Green, true); } else if (select) { m_BossName.color = UIHelper.GetUIColor(TextColType.Red); } else { m_BossName.color = UIHelper.GetUIColor(TextColType.Gray); } transform.localScale = select ? Vector3.one * DemonTreasureWin.expand : Vector3.one; m_ContainerSelect.gameObject.SetActive(select); m_Icon.material = active || select ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); if (level == maxlevel) { m_TreasureBottom.material = active || select ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); } else { m_NormalBottom.material = active || select ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); } } } } } System/Treasure/DemonDungeonBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: a9bd47a1536463f4b916b4fbe4672ecc timeCreated: 1542163489 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/DemonDungeonScriptable.cs
New file @@ -0,0 +1,56 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif public class DemonDungeonScriptable : ScriptableObject { [SerializeField] int treasureId; [SerializeField] List<Vector3> positions; public Vector3 GetPosition(int index) { if (index < positions.Count && index >= 0) { return positions[index]; } return Vector3.zero; } #if UNITY_EDITOR public void ApplyPosition(int index, Vector3 _position) { if (positions == null) { positions = new List<Vector3>(); } if (index >= positions.Count) { positions.Add(_position); } else { positions[index] = _position; } } #endif } #if UNITY_EDITOR public class DemonDungeonScriptableEditor : Editor { [MenuItem("策划工具/生成魔族法宝配置文件")] static void BuildConfig() { DemonDungeonScriptable config = CreateInstance<DemonDungeonScriptable>(); string _path = StringUtility.Contact("Assets/ResourcesOut/Refdata/ScriptableObject/SoDemonDungeon/", "SoDemonDungeon_", ".asset"); AssetDatabase.CreateAsset(config, _path); AssetDatabase.Refresh(); ProjectWindowUtil.ShowCreatedAsset(config); } } #endif System/Treasure/DemonDungeonScriptable.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 9a351935a6b40984a8ec0220d1e501f0 timeCreated: 1542165048 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/DemonTreasurePropertyCell.cs
New file @@ -0,0 +1,16 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Snxxz.UI { public class DemonTreasurePropertyCell : CellView { [SerializeField] PropertyBehaviour m_Property; public void Display(int property, int value) { m_Property.DisplayUpper(property, value); } } } System/Treasure/DemonTreasurePropertyCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 651a181f16a6bb849847af57234ce069 timeCreated: 1542182072 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/DemonTreasurePropertyWin.cs
New file @@ -0,0 +1,102 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, November 14, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class DemonTreasurePropertyWin : Window { [SerializeField] ScrollerController m_ScrollerControl; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } static Dictionary<int, int> propertyDict = new Dictionary<int, int>(); #region Built-in protected override void BindController() { } protected override void AddListeners() { m_ScrollerControl.OnRefreshCell += OnRefreshCell; } protected override void OnPreOpen() { Display(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion private void OnRefreshCell(ScrollerDataType type, CellView cell) { var propertyCell = cell as DemonTreasurePropertyCell; var key = cell.index; if (propertyDict.ContainsKey(key)) { propertyCell.Display(key, propertyDict[key]); } } private void Display() { propertyDict.Clear(); var list = model.GetTreasureCategory(TreasureCategory.Demon); for (int i = 0; i < list.Count; i++) { TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(list[i], out treasureDungeon)) { for (int k = 0; k < treasureDungeon.dungeonInfos.Count; k++) { var dungeonInfo = treasureDungeon.dungeonInfos[k]; if (treasureDungeon.currentLevel >= dungeonInfo.level) { foreach (var key in dungeonInfo.propertyDict.Keys) { if (!propertyDict.ContainsKey(key)) { propertyDict.Add(key, 0); } propertyDict[key] += dungeonInfo.propertyDict[key]; } } } } } m_ScrollerControl.Refresh(); foreach (var key in propertyDict.Keys) { m_ScrollerControl.AddCell(ScrollerDataType.Header, key); } m_ScrollerControl.Restart(); } } } System/Treasure/DemonTreasurePropertyWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: dd0ff4fff363e6d4b9853d3ee1a47ac2 timeCreated: 1542181355 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/DemonTreasureWin.cs
@@ -6,6 +6,7 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; @@ -14,10 +15,58 @@ public class DemonTreasureWin : Window { [SerializeField] TreasureDemonBehaviour m_TreasureDemonBehaviour; [SerializeField] Text m_PropertyTitle; [SerializeField] PropertyBehaviour[] m_Propertys; [SerializeField] Text m_SkillTitle; [SerializeField] Image m_SkillIcon; [SerializeField] Text m_SkillState; [SerializeField] Text m_SkillName; [SerializeField] Text m_SkillDescription; [SerializeField] RectTransform m_DungeonsContent; [SerializeField] Transform m_ContainerDungeons; [SerializeField] DemonDungeonBehaviour[] m_DungeonBehaviours; [SerializeField] Transform m_ContainerChallenge; [SerializeField] Button m_Challenge; [SerializeField] Text m_RecommondPower; [SerializeField] Button m_ViewProperty; [SerializeField] float m_Expand = 1.05f; [SerializeField] PositionTween m_TreasureGainTween; [SerializeField] PositionTween m_DescriptionTween; [SerializeField] PositionTween m_SkillTween; [SerializeField] PositionTween m_NameTween; [SerializeField] UIAlphaTween m_DungeonAlphaTween; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } static Dictionary<int, int> currentPropertyDict = new Dictionary<int, int>(); static List<int> displayPropertys = new List<int>(); static Dictionary<int, int> addPropertyDict = new Dictionary<int, int>(); public static float expand = 1.05f; AnimationStep m_Step = AnimationStep.None; AnimationStep step { get { return m_Step; } set { if (m_Step != value) { m_Step = value; DisplayAnimation(); } } } #region Built-in protected override void BindController() @@ -26,18 +75,38 @@ protected override void AddListeners() { m_ViewProperty.onClick.AddListener(ViewProperty); m_Challenge.onClick.AddListener(Challenge); } protected override void OnPreOpen() { UI3DTreasureSelectStage.Instance.SetStartState(); expand = m_Expand; m_Step = AnimationStep.None; } protected override void OnActived() { base.OnActived(); model.treasureSelectedEvent += TreasureSelectedEvent; m_TreasureDemonBehaviour.Display(model.selectedTreasure, true); model.treasureStateChangeEvent += TreasureStateChangeEvent; model.demonTreasureDungeonUpdate += DemonTreasureDungeonUpdate; Display(); Treasure treasure; if (model.TryGetTreasure(model.selectedTreasure, out treasure)) { switch (treasure.state) { case TreasureState.Collecting: case TreasureState.Collected: step = AnimationStep.None2Collect; break; case TreasureState.Locked: step = AnimationStep.None2Lock; break; } } } protected override void OnAfterOpen() @@ -48,6 +117,8 @@ protected override void OnPreClose() { model.treasureSelectedEvent -= TreasureSelectedEvent; model.treasureStateChangeEvent -= TreasureStateChangeEvent; model.demonTreasureDungeonUpdate -= DemonTreasureDungeonUpdate; model.SetTreasureUnlockShow(TreasureCategory.Demon, 0); } @@ -56,11 +127,374 @@ } #endregion private void TreasureSelectedEvent(int obj) private void ViewProperty() { m_TreasureDemonBehaviour.Display(model.selectedTreasure, false); WindowCenter.Instance.Open<DemonTreasurePropertyWin>(); } private void Challenge() { Treasure treasure; if (!model.TryGetTreasure(model.selectedTreasure, out treasure)) { return; } var fightPower = PlayerDatas.Instance.baseData.FightPoint; var recommandPower = 0; TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(model.selectedTreasure, out treasureDungeon)) { var dungeonInfo = treasureDungeon.Get(treasureDungeon.currentLevel + 1); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { recommandPower = dungeonInfo.fightPower; } } var config = Config.Instance.Get<TreasureConfig>(model.selectedTreasure); if (fightPower < recommandPower) { ConfirmCancel.ShowPopConfirm(Language.Get("DemonLackPowerTitle"), Language.Get("DemonLackFightPower", recommandPower) , (bool isOk) => { if (isOk) { model.collectingDemon = model.selectedTreasure; dungeonModel.SingleChallenge(TreasureModel.TREASURE_DATAMAPID, config.LineId); } }); } else { model.collectingDemon = model.selectedTreasure; dungeonModel.SingleChallenge(TreasureModel.TREASURE_DATAMAPID, config.LineId); } } private void Display() { m_TreasureDemonBehaviour.Display(model.selectedTreasure); DisplayProperty(); DisplaySkill(); DisplayDungeons(); DisplayChallenge(); DisplayDungeonPosition(); } private void DisplayAnimation() { switch (step) { case AnimationStep.None2Lock: m_DescriptionTween.Play(); m_NameTween.Play(); m_SkillTween.Play(); m_TreasureGainTween.SetStartState(); UI3DTreasureSelectStage.Instance.SetStartState(); m_ContainerDungeons.gameObject.SetActive(false); break; case AnimationStep.None2Collect: m_ContainerDungeons.gameObject.SetActive(true); m_DungeonAlphaTween.Play(); UI3DTreasureSelectStage.Instance.Tween(null); m_DescriptionTween.SetStartState(); m_NameTween.SetStartState(); m_SkillTween.SetStartState(); m_TreasureGainTween.Play(); break; case AnimationStep.Lock2Collect: m_ContainerDungeons.gameObject.SetActive(true); m_DungeonAlphaTween.Play(); UI3DTreasureSelectStage.Instance.Tween(null); m_DescriptionTween.Play(true); m_NameTween.Play(true); m_SkillTween.Play(true); m_TreasureGainTween.Play(); break; case AnimationStep.Collect2Lock: m_ContainerDungeons.gameObject.SetActive(false); UI3DTreasureSelectStage.Instance.SetStartState(); m_DescriptionTween.Play(); m_NameTween.Play(); m_SkillTween.Play(); m_TreasureGainTween.Play(true); break; } } private void DisplayProperty() { TreasureDungeon treasureDungeon; currentPropertyDict.Clear(); addPropertyDict.Clear(); displayPropertys.Clear(); if (model.TryGetTreasureDungeon(model.selectedTreasure, out treasureDungeon)) { for (int i = 0; i < treasureDungeon.dungeonInfos.Count; i++) { var info = treasureDungeon.dungeonInfos[i]; if (treasureDungeon.currentLevel >= info.level) { foreach (var key in info.propertyDict.Keys) { if (!currentPropertyDict.ContainsKey(key)) { currentPropertyDict.Add(key, 0); } currentPropertyDict[key] += info.propertyDict[key]; if (!displayPropertys.Contains(key)) { displayPropertys.Add(key); } } } else { foreach (var key in info.propertyDict.Keys) { if (!addPropertyDict.ContainsKey(key)) { addPropertyDict.Add(key, info.propertyDict[key]); } if (!displayPropertys.Contains(key)) { displayPropertys.Add(key); } } break; } } if (treasureDungeon.currentLevel == treasureDungeon.maxLevel) { m_PropertyTitle.text = Language.Get("GetTreasurePropertyTitle"); } else { m_PropertyTitle.text = Language.Get("PassTreasureDungeonPropertyTitle"); } } for (int i = 0; i < m_Propertys.Length; i++) { if (i < displayPropertys.Count) { m_Propertys[i].gameObject.SetActive(true); var currentValue = 0; if (currentPropertyDict.ContainsKey(displayPropertys[i])) { currentValue = currentPropertyDict[displayPropertys[i]]; } var addValue = 0; if (addPropertyDict.ContainsKey(displayPropertys[i])) { addValue = addPropertyDict[displayPropertys[i]]; } m_Propertys[i].DisplayAdd(displayPropertys[i], currentValue, addValue); } else { m_Propertys[i].gameObject.SetActive(false); } } } private void DisplaySkill() { Treasure treasure; if (model.TryGetTreasure(model.selectedTreasure, out treasure)) { var skillConfig = Config.Instance.Get<SkillConfig>(treasure.unlockSkill); if (skillConfig != null) { m_SkillIcon.SetSprite(skillConfig.IconName); m_SkillName.text = skillConfig.SkillName; m_SkillDescription.text = skillConfig.Description; if (treasure.state == TreasureState.Collected) { m_SkillState.text = Language.Get("DemonTreasureSkillGot"); m_SkillState.color = UIHelper.GetUIColor(TextColType.Green, true); } else { m_SkillState.text = Language.Get("DemonTreasureSkillGetting"); m_SkillState.color = UIHelper.GetUIColor(TextColType.Red, true); } } } TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(model.selectedTreasure, out treasureDungeon)) { var dungeonInfo = treasureDungeon.Get(treasureDungeon.maxLevel); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { var config = Config.Instance.Get<TreasureDungeonConfig>(dungeonInfo.key); m_SkillTitle.text = Language.Get("PassTreasureDungeonSkillTitle", config.bossName); } } } private void DisplayChallenge() { Treasure treasure; if (!model.TryGetTreasure(model.selectedTreasure, out treasure)) { return; } m_ContainerChallenge.gameObject.SetActive(treasure.state == TreasureState.Collecting); var fightPower = PlayerDatas.Instance.baseData.FightPoint; var recommandPower = 0; TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(model.selectedTreasure, out treasureDungeon)) { var dungeonInfo = treasureDungeon.Get(treasureDungeon.currentLevel + 1); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { recommandPower = dungeonInfo.fightPower; } } m_RecommondPower.text = Language.Get("TreasureRecommendAttr", StringUtility.Contact(fightPower, "/", recommandPower)); m_RecommondPower.color = UIHelper.GetUIColor(fightPower >= recommandPower ? TextColType.Green : TextColType.Red); } private void DisplayDungeons() { TreasureDungeon treasureDungeon; DemonDungeonScriptable config = ScriptableObjectLoader.LoadSoDemonDungeon(model.selectedTreasure); if (model.TryGetTreasureDungeon(model.selectedTreasure, out treasureDungeon)) { for (int i = 0; i < m_DungeonBehaviours.Length; i++) { if (i < treasureDungeon.dungeonInfos.Count) { m_DungeonBehaviours[i].gameObject.SetActive(true); m_DungeonBehaviours[i].Display(model.selectedTreasure, treasureDungeon.dungeonInfos[i].level); if (config != null) { m_DungeonBehaviours[i].transform.localPosition = config.GetPosition(i); } } else { m_DungeonBehaviours[i].gameObject.SetActive(false); } } } } private void TreasureStateChangeEvent(int id) { if (id == model.selectedTreasure) { DisplaySkill(); DisplayProperty(); DisplayChallenge(); UpdateAnimationStep(); } } private void TreasureSelectedEvent(int id) { Display(); UpdateAnimationStep(); } private void DemonTreasureDungeonUpdate(int id) { if (id == model.selectedTreasure) { DisplayDungeons(); DisplayChallenge(); } } private void UpdateAnimationStep() { Treasure treasure; if (model.TryGetTreasure(model.selectedTreasure, out treasure)) { switch (treasure.state) { case TreasureState.Collecting: case TreasureState.Collected: switch (step) { case AnimationStep.Collect2Lock: case AnimationStep.None2Lock: step = AnimationStep.Lock2Collect; break; } break; case TreasureState.Locked: switch (step) { case AnimationStep.None2Collect: case AnimationStep.Lock2Collect: step = AnimationStep.Collect2Lock; break; } break; } } } private void DisplayDungeonPosition() { TreasureDungeon treasureDungeon; var scriptable = ScriptableObjectLoader.LoadSoDemonDungeon(model.selectedTreasure); if (scriptable == null) { return; } var height = (m_DungeonBehaviours[0].transform as RectTransform).sizeDelta.y; var viewAreaHeight = (m_ContainerDungeons as RectTransform).sizeDelta.y; if (model.TryGetTreasureDungeon(model.selectedTreasure, out treasureDungeon)) { var selectLevel = treasureDungeon.currentLevel == treasureDungeon.maxLevel ? treasureDungeon.maxLevel : (treasureDungeon.currentLevel + 1); var selectPosition = scriptable.GetPosition(selectLevel - 1); if (selectPosition.y + (height / 2) * expand <= viewAreaHeight) { m_DungeonsContent.anchoredPosition = Vector3.zero; return; } else { var delta = selectPosition.y + (height / 2) * expand - viewAreaHeight; m_DungeonsContent.anchoredPosition = m_DungeonsContent.localPosition.SetY(-delta); } } } enum AnimationStep { None, None2Lock, None2Collect, Lock2Collect, Collect2Lock, } #if UNITY_EDITOR [SerializeField] DemonDungeonScriptable m_EditorScriptable; [ContextMenu("应用位置信息")] void ApplyPositions() { if (m_EditorScriptable == null) { return; } var index = 0; for (int i = 0; i < m_DungeonBehaviours.Length; i++) { if (m_DungeonBehaviours[i].gameObject.activeSelf) { m_EditorScriptable.ApplyPosition(index, m_DungeonBehaviours[i].transform.localPosition); index++; } } } #endif } } System/Treasure/DragSelectComponent.cs
@@ -25,7 +25,8 @@ || WindowCenter.Instance.IsOpen<TreasureNewStageWin>() || WindowCenter.Instance.IsOpen<PotentialItemUseWin>() || WindowCenter.Instance.IsOpen<TreasureSoulActiveWin>() || WindowCenter.Instance.IsOpen<GetItemPathWin>()) || WindowCenter.Instance.IsOpen<GetItemPathWin>() || WindowCenter.Instance.IsOpen<DemonTreasurePropertyWin>()) { m_StartDrag = false; return; System/Treasure/FairyTreasureCollectPanelPattern3.cs
@@ -66,7 +66,7 @@ if (treasure.treasureStages.Count > 0 && treasure.treasureStages[0].unlockType == TreasureStageUnlock.Skill) { var _skillId = treasure.unLockSkill; var _skillId = treasure.unlockSkill; var skillConfig = Config.Instance.Get<SkillConfig>(_skillId); m_AddedEffect.text = skillConfig.Description; } System/Treasure/FunctionUnlockFlyObject.cs
@@ -54,7 +54,7 @@ case FunctionUnlockType.TreasureSkill: Treasure _treaure; ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(m_Id, out _treaure); var _skillCfg = Config.Instance.Get<SkillConfig>(_treaure.unLockSkill); var _skillCfg = Config.Instance.Get<SkillConfig>(_treaure.unlockSkill); m_FunctionIcon.SetSprite(_skillCfg.IconName); m_FunctionIcon.SetNativeSize(); originalScale = 1f; System/Treasure/TreasureAnimation.cs
@@ -713,7 +713,7 @@ { return x.unlockType == TreasureStageUnlock.Skill; }); var _skillStageIndex = _treasure.GetStageIndex(_skillStage); var _skillStageIndex = _treasure.IndexOfStage(_skillStage); for (int i = 0; i < _config.stagePointNum; i++) { if (i == _skillStageIndex) System/Treasure/TreasureBaseWin.cs
@@ -129,6 +129,7 @@ } CloseSubWindows(); m_DisplayContainer.gameObject.SetActive(true); UI3DTreasureSelectStage.Instance.SetStartState(); switch (model.currentCategory) { case TreasureCategory.Human: System/Treasure/TreasureData.cs
@@ -24,12 +24,7 @@ private set { m_Stage = value; } } int m_Exp; public int exp { get { return m_Exp; } private set { m_Exp = value; } } public int exp { get; private set; } bool m_HasClickChallenge = false; public bool hasClickChallenge @@ -65,7 +60,7 @@ } } public int unLockSkill public int unlockSkill { get { @@ -78,14 +73,10 @@ } } public int unLockPrivilege { get; private set; } public int autoSelectPotential { get; set; } Dictionary<int, List<TreasurePotential>> jobToPotentials = new Dictionary<int, List<TreasurePotential>>(); public List<TreasureStage> treasureStages = new List<TreasureStage>(); public List<TreasurePotential> potentials { @@ -107,11 +98,6 @@ public Redpoint skillLevelUpRedpoint { get; private set; } public Redpoint achievementRedpoint { get; private set; } public Treasure(int _id) { this.id = _id; } public Treasure(int _id, int[] _potentialIds, Redpoint _skillLevelUpRedpoint, Redpoint _achievementPoint) { @@ -251,19 +237,16 @@ return configA.ReOrder < configB.ReOrder ? -1 : 1; } public List<TreasureStage> treasureStages = new List<TreasureStage>(); public void UpdateTreasureStage(TreasureUpConfig _cfg) public void ParseTreasureStage(TreasureUpConfig config) { TreasureStage _stage = new TreasureStage(_cfg); TreasureStage _stage = new TreasureStage(config); treasureStages.Add(_stage); } public void UpdateTreasureLevelExp(int _lv, int _exp, bool _hasClickChallenge) public void UpdateTreasureLevelExp(int level, int exp, bool _hasClickChallenge) { stage = _lv; exp = _exp; stage = level; this.exp = exp; hasClickChallenge = _hasClickChallenge; if ((this is HumanTreasure)) { @@ -282,19 +265,6 @@ } } public bool IsUnlockStage(TreasureStageUnlock _type) { var _stage = treasureStages.Find((x) => { return x.unlockType == _type; }); if (_stage == null) { return false; } return stage >= _stage.stage; } public int GetStageId(int _stageIndex) { foreach (var item in treasureStages) @@ -308,7 +278,7 @@ return 0; } public int GetStageIndex(int _stage) public int IndexOfStage(int _stage) { if (treasureStages[0].unlockType == TreasureStageUnlock.None) { @@ -316,15 +286,15 @@ } return _stage; } public int StageCount { get { return treasureStages.Count; } } } public class HumanTreasure : Treasure { TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } HumanTreasureState m_State = HumanTreasureState.Locked; public HumanTreasureState humanState { @@ -335,7 +305,7 @@ private set { m_State = value; ModelCenter.Instance.GetModel<TreasureModel>().HumanTreasureStateChange(base.id); model.HumanTreasureStateChange(base.id); } } @@ -678,6 +648,91 @@ } } public class TreasureDungeon { public int treasureId; public List<TreasureDungeonInfo> dungeonInfos = new List<TreasureDungeonInfo>(); private int m_Level = 0; public int currentLevel { get { var model = ModelCenter.Instance.GetModel<TreasureModel>(); Treasure treasure; if (model.TryGetTreasure(treasureId, out treasure) && treasure.state == TreasureState.Collected) { return maxLevel; } return m_Level; } set { m_Level = value; } } public int maxLevel { get; private set; } public Redpoint challengeRedpoint; public TreasureDungeon(int treasureId,Redpoint challengeRedpoint) { this.treasureId = treasureId; this.challengeRedpoint = challengeRedpoint; } public void ParseDungeonInfo(TreasureDungeonConfig config) { if (dungeonInfos.FindIndex((x) => { return x.level == config.Level; }) == -1) { var json = LitJson.JsonMapper.ToObject(config.Attr); var propertyDict = new Dictionary<int, int>(); foreach (var key in json.Keys) { var property = int.Parse(key); var value = int.Parse(json[key].ToString()); propertyDict.Add(property, value); } var dungeonInfo = new TreasureDungeonInfo() { key = config.ID, fightPower = config.fightPower, level = config.Level, propertyDict = propertyDict, lineId = config.LineID }; dungeonInfos.Add(dungeonInfo); if (config.Level > maxLevel) { maxLevel = config.Level; } } } public TreasureDungeonInfo Get(int level) { return dungeonInfos.Find((x) => { return x.level == level; }); } } public struct TreasureDungeonInfo { public int key; public int lineId; public int level; public Dictionary<int, int> propertyDict; public int fightPower; } public enum TreasureStageUnlock { None, System/Treasure/TreasureDemonBehaviour.cs
@@ -13,7 +13,6 @@ [SerializeField] Text m_TreasureDescription; [SerializeField] RectTransform m_ContainerFightPower; [SerializeField] Text m_FightPower; [SerializeField] Text m_RecommondPower; [SerializeField] RectTransform m_ContainerLimit; [SerializeField] Text m_Limit; [SerializeField] RectTransform m_ContainerSkill; @@ -21,11 +20,6 @@ [SerializeField] Text m_SkillName; [SerializeField] Text m_SkillEffect; [SerializeField] Text m_SkillDescrition; [SerializeField] Button m_GetBtn; [SerializeField] PositionTween m_DescriptionTween; [SerializeField] PositionTween m_SkillTween; [SerializeField] PositionTween m_NameTween; TreasureModel m_Model; TreasureModel model @@ -38,11 +32,6 @@ Treasure m_Treasure; private void Awake() { m_GetBtn.onClick.AddListener(OnTreasureGet); } private void OnEnable() { model.treasureStateChangeEvent += treasureStateChangeEvent; @@ -53,7 +42,6 @@ if (_id == m_Treasure.id) { m_Limit.gameObject.SetActive(m_Treasure.state != TreasureState.Collected); m_GetBtn.gameObject.SetActive(m_Treasure.state == TreasureState.Collecting); } } @@ -62,38 +50,18 @@ model.treasureStateChangeEvent -= treasureStateChangeEvent; } public void Display(int _id, bool _tween = false) public void Display(int _id) { model.TryGetTreasure(_id, out m_Treasure); if (m_Treasure == null) { return; } if (_tween) { m_DescriptionTween.SetStartState(); 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); m_TreasureDescription.text = config.Story; var demonRecommondCfg = Config.Instance.Get<DemonRecommondPropertyConfig>(_id); var myPower = PlayerDatas.Instance.baseData.FightPoint; m_RecommondPower.text = Language.Get("TreasureRecommendAttr", StringUtility.Contact(myPower, "/", demonRecommondCfg.RecommendPower)); m_RecommondPower.color = UIHelper.GetUIColor(myPower >= demonRecommondCfg.RecommendPower ? TextColType.Green : TextColType.Red, true); m_ContainerLimit.gameObject.SetActive(m_Treasure.state == TreasureState.Locked); 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); @@ -119,7 +87,7 @@ } } var skillConfig = Config.Instance.Get<SkillConfig>(m_Treasure.unLockSkill); var skillConfig = Config.Instance.Get<SkillConfig>(m_Treasure.unlockSkill); m_ContainerSkill.gameObject.SetActive(skillConfig != null); if (skillConfig != null) { @@ -138,16 +106,6 @@ && !NewBieCenter.Instance.completeGuidesBuf.Contains(88)) { NewBieCenter.Instance.StartNewBieGuide(88); } } private void OnTreasureGet() { var _cfg = Config.Instance.Get<TreasureConfig>(model.selectedTreasure); if (_cfg != null) { model.collectingDemon = model.selectedTreasure; ModelCenter.Instance.GetModel<DungeonModel>().SingleChallenge(TreasureModel.TREASURE_DATAMAPID, _cfg.LineId); } } } System/Treasure/TreasureIntroducePanel.cs
@@ -38,7 +38,7 @@ { var config = Config.Instance.Get<TreasureConfig>(m_Treasure.id); m_FunctionTitle.text = Language.Get("Hallows_UnLockSkill"); var skillConfig = Config.Instance.Get<SkillConfig>(m_Treasure.unLockSkill); var skillConfig = Config.Instance.Get<SkillConfig>(m_Treasure.unlockSkill); m_FunctionName.text = skillConfig.SkillName; m_Icon.SetSprite(skillConfig.IconName); System/Treasure/TreasureLevelUpWin.cs
@@ -296,7 +296,7 @@ if (model.GetTreasureStageShow(m_Treasure.id) != -1) { model.SetTreasureStageShow(m_Treasure.id, -1); m_TreasureAnimation.OnStageLock(m_Treasure.GetStageIndex(m_Treasure.stage)); m_TreasureAnimation.OnStageLock(m_Treasure.IndexOfStage(m_Treasure.stage)); } m_TreasureProperty.SetActive(m_Treasure.state == TreasureState.Collected); if (_state == 1 && m_Treasure.IsHighestStage @@ -621,7 +621,7 @@ if (model.GetTreasureStageShow(m_Treasure.id) != -1) { model.SetTreasureStageShow(m_Treasure.id, -1); m_TreasureAnimation.OnStageLock(m_Treasure.GetStageIndex(m_Treasure.stage)); m_TreasureAnimation.OnStageLock(m_Treasure.IndexOfStage(m_Treasure.stage)); } if (!m_Treasure.IsHighestStage) { @@ -672,7 +672,7 @@ { var stage = m_Treasure.treasureStages[m_Treasure.stage]; model.SetTreasureStageShow(m_Treasure.id, -1); m_TreasureAnimation.OnStageLock(m_Treasure.GetStageIndex(stage.stage)); m_TreasureAnimation.OnStageLock(m_Treasure.IndexOfStage(stage.stage)); } } } @@ -761,7 +761,7 @@ } model.treasureStepUpShow = false; var stage = m_Treasure.treasureStages[m_Treasure.stage]; var _index = m_Treasure.GetStageIndex(stage.stage); var _index = m_Treasure.IndexOfStage(stage.stage); model.SetTreasureStageShow(m_Treasure.id, stage.stage); if (WindowCenter.Instance.IsOpen<TreasureStageTipWin>()) @@ -772,7 +772,7 @@ switch (stage.unlockType) { case TreasureStageUnlock.Skill: var _config = Config.Instance.Get<SkillConfig>(m_Treasure.unLockSkill); var _config = Config.Instance.Get<SkillConfig>(m_Treasure.unlockSkill); m_ContainerSkillShow.gameObject.SetActive(true); m_HeroShowSkill.SetSprite(_config.IconName); m_HeroShowSkillName.SetSprite(StringUtility.Contact("SkillName_", _config.SkillID)); @@ -1030,7 +1030,7 @@ [ContextMenu("Preview")] public void PreviewHreoSkill() { m_TreasureAnimation.OnHeroSkillShow(m_Treasure.GetStageIndex(m_Treasure.stage)); m_TreasureAnimation.OnHeroSkillShow(m_Treasure.IndexOfStage(m_Treasure.stage)); PlaySkillShow(); } System/Treasure/TreasureMeridianBehaviour.cs
@@ -97,7 +97,7 @@ ModelCenter.Instance.GetModel<ItemTipsModel>().SetItemTipsModel(itemAttrData); return; } model.selectedStage = m_TreasureStage.stage; TreasureStageTipWin.selectStage = m_TreasureStage.stage; if (!WindowCenter.Instance.IsOpen<TreasureStageTipWin>()) { TreasureStageTipWin.SetTargetPosition(this.transform as RectTransform); System/Treasure/TreasureModel.cs
@@ -32,7 +32,7 @@ Redpoint elderGodRedpoint = new Redpoint(TREASURE_REDPOINTID, CATEGORY_REDPOINTIDS[(int)TreasureCategory.ElderGod - 1]); Redpoint zergRedpoint = new Redpoint(TREASURE_REDPOINTID, CATEGORY_REDPOINTIDS[(int)TreasureCategory.Zerg - 1]); public Redpoint stoveRedpoint = new Redpoint(CATEGORY_REDPOINTIDS[(int)TreasureCategory.Fairy - 1], 7200); public Redpoint stoveRedpoint { get; private set; } public event Action<int> treasureCollectProgressUpdateEvent; public event Action<int> treasureSelectedEvent; @@ -46,13 +46,8 @@ public event Action<int> treasureLevelProgressUpdateEvent; public event Action<int> treasureStageUpEvent; public event Action<int> humanTreasureStateChangeEvent; public event Action<int> demonTreasureDungeonUpdate; public event Action skillLevelUpRedpointUpdate; bool m_WaitOpenDetailsWin = false; public bool waitOpenDetailsWin { get { return m_WaitOpenDetailsWin; } set { m_WaitOpenDetailsWin = value; } } int m_SelectedTreasure = 0; public int selectedTreasure { @@ -80,36 +75,9 @@ } } int m_SelectedStage = 0; public int selectedStage { get { return m_SelectedStage; } set { m_SelectedStage = value; } } public bool treasureStepUpShow { get; set; } private bool m_TreasureStepUpShow = false; public bool treasureStepUpShow { get { return m_TreasureStepUpShow; } set { m_TreasureStepUpShow = value; } } private bool m_TreasureStageUpShow = false; public bool treasureStageUpShow { get { return m_TreasureStageUpShow; } set { m_TreasureStageUpShow = value; } } public bool treasureStageUpShow { get; set; } TreasureCategory m_CurrentCategory = TreasureCategory.Human; public TreasureCategory currentCategory { @@ -175,6 +143,7 @@ Dictionary<int, int> treasureStageShowDict = new Dictionary<int, int>(); List<int> treasureUnOpens = new List<int>();//版本未开放法宝 Dictionary<int, int[]> potentialInitialPowers = new Dictionary<int, int[]>(); Dictionary<int, TreasureDungeon> treasureDungeons = new Dictionary<int, TreasureDungeon>(); public Dictionary<int, int> fairyTreasureGetDict { get; private set; } @@ -204,8 +173,8 @@ public bool openFromTreasureUnlockShow { get; set; } public bool openFromTreasureCollect { get; set; } public bool openFromTreasureList { get; set; } public int openFromTaskId { get; set; } public bool inPotentialModifyPower { get; set; } public int openFromTaskId = 0; public List<int> castSoulGuideTaskIds { get; private set; } public List<int> guideTreasures { get; private set; } @@ -216,9 +185,7 @@ public int exitRecord { get; set; } public int entranceOpenCondition { get; private set; } public List<int> cacheGotAchievements { get { return m_CacheGotAchievements; } } public List<int> cacheGotAchievements { get { return m_CacheGotAchievements; } } AchievementModel achievementModel { get { return ModelCenter.Instance.GetModel<AchievementModel>(); } } PlayerPackModel packageModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } @@ -293,6 +260,10 @@ humanTreasure.UpdateTreasureState(); } } foreach (var treasureDungeon in treasureDungeons.Values) { treasureDungeon.currentLevel = 0; } } public void OnPlayerLoginOk() @@ -301,6 +272,7 @@ UpdateAchievementRedpoints(); UpdateCastSoulRedpoints(); UpdateSkillLevelUpRedpoints(); UpdateDemonDungeonRedpoints(); } private bool needDisplayReguluLevelUp = false; @@ -471,6 +443,35 @@ return treasures.TryGetValue(_id, out _treasure); } public bool TryGetTreasureDungeon(int _id, out TreasureDungeon _treasureDungeon) { return treasureDungeons.TryGetValue(_id, out _treasureDungeon); } public bool TryGetTreasureDungeon(int _mapId, int lineId, out TreasureDungeon treasureDungeon) { treasureDungeon = null; if (_mapId != 41110) { return false; } var list = GetTreasureCategory(TreasureCategory.Demon); for (int i = 0; i < list.Count; i++) { if (TryGetTreasureDungeon(list[i], out treasureDungeon)) { if (treasureDungeon.dungeonInfos.Count > 0) { if (treasureDungeon.dungeonInfos[0].lineId == lineId) { return true; } } } } return false; } public bool TryGetTreasureUnlockAchievement(int _treasureId, out int achievement) { return treasureAchievementDict.TryGetValue(_treasureId, out achievement); @@ -589,6 +590,8 @@ OpenTreasureNewGot(); } UpdateDemonDungeonRedpoint(treasure.id); if (treasureCollectingShowId == id) { treasureCollectingShowId = 0; @@ -630,6 +633,7 @@ SetTreasureUnlockShow((TreasureCategory)config.Category, treasure.id); } treasure.state = TreasureState.Collecting; UpdateDemonDungeonRedpoint(treasure.id); if ((TreasureCategory)config.Category == TreasureCategory.Human) { (treasure as HumanTreasure).UpdateTreasureState(); @@ -786,6 +790,10 @@ case PlayerDataRefresh.LV: UpdateAchievementRedpoints(); break; case PlayerDataRefresh.FightPoint: case PlayerDataRefresh.FightPower: UpdateDemonDungeonRedpoints(); break; } } @@ -922,6 +930,37 @@ } } private void UpdateDemonDungeonRedpoints() { foreach (var treasureId in treasureDungeons.Keys) { UpdateDemonDungeonRedpoint(treasureId); } } private void UpdateDemonDungeonRedpoint(int treasureId) { TreasureDungeon treasureDungeon; if (TryGetTreasureDungeon(treasureId, out treasureDungeon)) { treasureDungeon.challengeRedpoint.state = RedPointState.None; Treasure treasure; if (TryGetTreasure(treasureId, out treasure) && treasure.state != TreasureState.Collecting) { return; } var dungeonInfo = treasureDungeon.Get(treasureDungeon.currentLevel + 1); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { if (PlayerDatas.Instance.baseData.FightPoint >= dungeonInfo.fightPower) { treasureDungeon.challengeRedpoint.state = RedPointState.Simple; } } } } public int GetSkillLevelUpRedpointTreasure() { var list = GetTreasureCategory(TreasureCategory.Human); @@ -1015,7 +1054,7 @@ IEnumerator Co_OpenTreasureNewGot() { yield return WaitingForSecondConst.WaitMS600; yield return null; OpenTreasureNewGot(); } @@ -1212,6 +1251,7 @@ if (_pretreasure == null || _pretreasure.state == TreasureState.Collected) { treasure.state = TreasureState.Collecting; UpdateDemonDungeonRedpoint(treasure.id); collectingDemon = treasure.id; if (serverInited) { @@ -1336,6 +1376,16 @@ treasureStageUpEvent(treasure.id); } } TreasureDungeon treasureDungeon; if (TryGetTreasureDungeon((int)package.InfoList[i].MWID, out treasureDungeon)) { treasureDungeon.currentLevel = package.InfoList[i].FBPassLV; UpdateDemonDungeonRedpoint(treasureDungeon.treasureId); if (demonTreasureDungeonUpdate != null) { demonTreasureDungeonUpdate(treasureDungeon.treasureId); } } } UpdateSkillLevelUpRedpoints(); } @@ -1452,7 +1502,7 @@ Treasure treasure; if (TryGetTreasure(config.MWID, out treasure)) { treasure.UpdateTreasureStage(config); treasure.ParseTreasureStage(config); } } @@ -1476,6 +1526,22 @@ funcConfig = Config.Instance.Get<FuncConfigConfig>("OpenFabao"); entranceOpenCondition = int.Parse(funcConfig.Numerical1); stoveRedpoint = new Redpoint(CATEGORY_REDPOINTIDS[(int)TreasureCategory.Fairy - 1], TREASURE_REDPOINTBASE + redpointIndex++); var treasureDungeonConfigs = Config.Instance.GetAllValues<TreasureDungeonConfig>(); foreach (var config in treasureDungeonConfigs) { TreasureDungeon treasureDungeon; if (!treasureDungeons.TryGetValue(config.MWID, out treasureDungeon)) { var treasureConfig = Config.Instance.Get<TreasureConfig>(config.MWID); var challengeRedpoint = new Redpoint(CATEGORY_REDPOINTIDS[treasureConfig.Category - 1], TREASURE_REDPOINTBASE + redpointIndex++); treasureDungeon = new TreasureDungeon(config.MWID, challengeRedpoint); treasureDungeons.Add(config.MWID, treasureDungeon); } treasureDungeon.ParseDungeonInfo(config); } } const string pattern = "\\\"[0-9]+\\\":\\[[0-9|,]*\\]"; System/Treasure/TreasurePotentialPanel.cs
@@ -206,7 +206,7 @@ model.potentialLevelUpdate -= PotentialLevelUpdate; model.potentialLevelUpdate += PotentialLevelUpdate; var _stageSkillCfg = Config.Instance.Get<SkillConfig>(m_Treasure.unLockSkill); var _stageSkillCfg = Config.Instance.Get<SkillConfig>(m_Treasure.unlockSkill); if (_stageSkillCfg != null) { m_StageSkillIcon.SetSprite(_stageSkillCfg.IconName); @@ -509,7 +509,7 @@ m_ContainerTotalEffect.gameObject.SetActive(true); m_SkillTitle.text = Language.Get("PotentialSkill"); var config = Config.Instance.Get<SkillConfig>(m_Treasure.unLockSkill); var config = Config.Instance.Get<SkillConfig>(m_Treasure.unlockSkill); if (config != null) { m_SkillIcon.SetSprite(config.IconName); System/Treasure/TreasureStageTipWin.cs
@@ -42,6 +42,8 @@ private float ratio = 1.0f; static Vector2 targetPosition = Vector2.zero; public static int selectStage = 0; #region Built-in protected override void BindController() { @@ -86,7 +88,7 @@ model.TryGetTreasure(model.selectedTreasure, out m_Treasure); m_TreasureStage = m_Treasure.treasureStages.Find((x) => { return x.stage == model.selectedStage; return x.stage == selectStage; }); if (m_TreasureStage == null) System/Treasure/TreasureStageUpTriggerWin.cs
@@ -138,7 +138,7 @@ instance.transform.SetParentEx(m_FlyContainer, Vector3.zero, Quaternion.identity, Vector3.one); var _index = _stage.stage; _index = m_Treasure.GetStageIndex(_index); _index = m_Treasure.IndexOfStage(_index); var _config = ScriptableObjectLoader.LoadSoTreasureMeridian(model.selectedTreasure); if (_config != null) { System/Treasure/TreasureUnlockCell.cs
@@ -81,7 +81,7 @@ { return; } model.selectedStage = treasureStage.stage; TreasureStageTipWin.selectStage = treasureStage.stage; if (!WindowCenter.Instance.IsOpen<TreasureStageTipWin>()) { TreasureStageTipWin.SetTargetPosition(m_Button.transform as RectTransform); UI/Common/TimerToChsBehaviour.cs
@@ -7,11 +7,11 @@ public class TimerToChsBehaviour : TimerBehaviour { [HideInInspector] public string addtionInfo=string.Empty; public string addtionInfo = string.Empty; protected override void UpdateTimeShow() { var lastSecond = (endTime - DateTime.Now).TotalSeconds; var lastSecond = (endTime - TimeUtility.ServerNow).TotalSeconds; m_TimeShow.text = StringUtility.Contact(TimeUtility.SecondsToDHMSCHS((int)lastSecond), addtionInfo); } } UI/Common/UI3DHeroSkillShow.cs
@@ -153,7 +153,7 @@ if (_treasure != null) { m_HeroSkillCompletet = callback; var _skillId = _treasure.unLockSkill; var _skillId = _treasure.unlockSkill; var _index = m_TreasureSkills.FindIndex((x) => { return x.treasureId == _treasureId; Utility/EnumHelper.cs
@@ -1009,6 +1009,10 @@ /// fff4cd /// </summary> LightYellow = 15, /// <summary> /// (204, 204, 204, 255) /// </summary> Gray = 16 } public enum E_EquipType Utility/UIHelper.cs
@@ -375,6 +375,7 @@ public static readonly Color s_NavyYellow = new Color32(255, 239, 71, 255); public static readonly Color s_LightGreen = new Color32(141, 220, 17, 255); public static readonly Color s_LightYellow = new Color32(255, 244, 205, 255); //fff4cd public static readonly Color s_Gray = new Color32(204, 204, 204, 255); public static Color GetUIColor(int itemColor, bool bright = false) { @@ -429,6 +430,8 @@ return s_LightGreen; case TextColType.LightYellow: return s_LightYellow; case TextColType.Gray: return s_Gray; } return bright ? s_BrightWhiteColor : s_DarkWhiteColor; }