Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -31,6 +31,7 @@ public static void Init() { // 登记相应的数据体及对应的数据转逻辑类 Register(typeof(HA31E_tagMCGatherSoulHoleInfo), typeof(DTCA31E_tagMCGatherSoulHoleInfo)); Register(typeof(HAA1D_tagMCActTotalRechargeInfo), typeof(DTCAA1D_tagMCActTotalRechargeInfo)); Register(typeof(HAA1C_tagMCTotalRechargePlayerInfo), typeof(DTCAA1C_tagMCTotalRechargePlayerInfo)); Register(typeof(HA717_tagMCChatBubbleBoxState), typeof(DTCA717_tagMCChatBubbleBoxState)); Core/GameEngine/Model/Config/GatherSoulComposeConfig.cs
New file @@ -0,0 +1,58 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, December 13, 2018 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class GatherSoulComposeConfig : ConfigBase { public int TagItemID { get ; private set ; } public int NeedLV { get ; private set ; } public int[] NeedItem; public int NeedSoulSplinters { get ; private set ; } public int NeedSoulCore { get ; private set ; } public int category { get ; private set ; } public override string getKey() { return TagItemID.ToString(); } public override void Parse() { try { TagItemID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; NeedLV=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0; string[] NeedItemStringArray = rawContents[2].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); NeedItem = new int[NeedItemStringArray.Length]; for (int i=0;i<NeedItemStringArray.Length;i++) { int.TryParse(NeedItemStringArray[i],out NeedItem[i]); } NeedSoulSplinters=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; NeedSoulCore=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0; category=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0; } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/GatherSoulComposeConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 0ea390c2d6d6e9140a961520fdc1f652 timeCreated: 1544702516 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/Config/GatherSoulConfig.cs
New file @@ -0,0 +1,49 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 18, 2018 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class GatherSoulConfig : ConfigBase { public int ID { get ; private set ; } public int[] AttrType; public int soulStage { get ; private set ; } public override string getKey() { return ID.ToString(); } public override void Parse() { try { ID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; string[] AttrTypeStringArray = rawContents[1].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); AttrType = new int[AttrTypeStringArray.Length]; for (int i=0;i<AttrTypeStringArray.Length;i++) { int.TryParse(AttrTypeStringArray[i],out AttrType[i]); } soulStage=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0; } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/GatherSoulConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: a572bdda8829e644b94935dd6f99d1ee timeCreated: 1545099809 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/Config/GatherSoulPropertyConfig.cs
New file @@ -0,0 +1,56 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 18, 2018 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class GatherSoulPropertyConfig : ConfigBase { public int AttrType { get ; private set ; } public string AttrInfo1 { get ; private set; } public string AttrInfo2 { get ; private set; } public string AttrInfo3 { get ; private set; } public string AttrInfo4 { get ; private set; } public string AttrInfo5 { get ; private set; } public int sort { get ; private set ; } public override string getKey() { return AttrType.ToString(); } public override void Parse() { try { AttrType=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; AttrInfo1 = rawContents[1].Trim(); AttrInfo2 = rawContents[2].Trim(); AttrInfo3 = rawContents[3].Trim(); AttrInfo4 = rawContents[4].Trim(); AttrInfo5 = rawContents[5].Trim(); sort=IsNumeric(rawContents[6]) ? int.Parse(rawContents[6]):0; } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/GatherSoulPropertyConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 94d416140f232244a8491a1281aa4af3 timeCreated: 1545099843 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/ConfigManager.cs
@@ -214,6 +214,9 @@ AddAsyncTask<FuncSwitchConfig>(); AddAsyncTask<AncientRobotNameConfig>(); AddAsyncTask<CrossServerArenaConfig>(); AddAsyncTask<GatherSoulConfig>(); AddAsyncTask<GatherSoulPropertyConfig>(); AddAsyncTask<GatherSoulComposeConfig>(); while (!AllCompleted()) { Core/GameEngine/Model/Player/Character/PlayerExtersionData.cs
@@ -59,4 +59,7 @@ public int NpcHurtAddPer;//对怪物伤害加成 188 public int FunalHurtPer;//对怪物伤害加成 189 public int talentPoint;//天赋点数 190 public uint soulDust;//聚魂-魂尘 196 public uint soulSplinters;//聚魂-碎片 197 public uint soulCore;//聚魂-核心环 198 } Core/GameEngine/Model/Player/PlayerDatas.cs
@@ -795,6 +795,15 @@ hero.SwitchGodWeapon(4, baseData.godWeaponLV_4); } break; case PlayerDataRefresh.CDBPlayerRefresh_SoulDust: extersion.soulDust = value; break; case PlayerDataRefresh.CDBPlayerRefresh_SoulSplinters: extersion.soulSplinters = value; break; case PlayerDataRefresh.CDBPlayerRefresh_SoulCore: extersion.soulCore = value; break; } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA518_tagCMGatherSoulUp.cs
New file @@ -0,0 +1,20 @@ using UnityEngine; using System.Collections; // A5 18 聚魂升级 #tagCMGatherSoulUp public class CA518_tagCMGatherSoulUp : GameNetPackBasic { public byte PlaceType; // 位置类型;0-背包,1-孔 public ushort PlaceIndex; // 位置索引 public CA518_tagCMGatherSoulUp () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA518; } public override void WriteToBytes () { WriteBytes (PlaceType, NetDataType.BYTE); WriteBytes (PlaceIndex, NetDataType.WORD); } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA518_tagCMGatherSoulUp.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: b6661ae74043bd047ac00848ec3e8475 timeCreated: 1545015576 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA519_tagCMGatherSoulDecompose.cs
New file @@ -0,0 +1,22 @@ using UnityEngine; using System.Collections; // A5 19 聚魂分解 #tagCMGatherSoulDecompose public class CA519_tagCMGatherSoulDecompose : GameNetPackBasic { public byte IsAuto; // 是否自动分解 public byte Count; // 指定批量分解数,最大不超过50个 public ushort[] PlaceIndexList; // 批量分解位置索引列表 public CA519_tagCMGatherSoulDecompose () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA519; } public override void WriteToBytes () { WriteBytes (IsAuto, NetDataType.BYTE); WriteBytes (Count, NetDataType.BYTE); WriteBytes (PlaceIndexList, NetDataType.WORD, Count); } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA519_tagCMGatherSoulDecompose.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 69b90cf6a5a092342b96386da8631a53 timeCreated: 1545015576 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA51C_tagCMGatherSoulCompound.cs
New file @@ -0,0 +1,24 @@ using UnityEngine; using System.Collections; // A5 1C 聚魂合成 #tagCMGatherSoulCompound public class CA51C_tagCMGatherSoulCompound : GameNetPackBasic { public byte Cnt; public byte[] PackList; //所在位置 0-背包 1-孔 public ushort[] IndexList; //物品索引 public uint TagItemID; //合成目标物品ID public CA51C_tagCMGatherSoulCompound () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA51C; } public override void WriteToBytes () { WriteBytes (Cnt, NetDataType.BYTE); WriteBytes (PackList, NetDataType.BYTE, Cnt); WriteBytes (IndexList, NetDataType.WORD, Cnt); WriteBytes (TagItemID, NetDataType.DWORD); } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA51C_tagCMGatherSoulCompound.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 7324300e72513334bb76a6c7b0e36bb2 timeCreated: 1545015576 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA204_tagMCVPackRefresh.cs
@@ -1,22 +1,30 @@ using UnityEngine; using System.Collections; using Snxxz.UI; // A2 04 虚拟背包物品刷新 #tagMCVPackRefresh public class DTCA204_tagMCVPackRefresh : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA204_tagMCVPackRefresh vNetData = vNetPack as HA204_tagMCVPackRefresh; if (vNetData != null&&vNetData.PackType== (int)PackType.rptRunePack) { ModelCenter.Instance.GetModel<RuneModel>().OnRunePackRefresh(vNetData); } } } using UnityEngine; using System.Collections; using Snxxz.UI; // A2 04 虚拟背包物品刷新 #tagMCVPackRefresh public class DTCA204_tagMCVPackRefresh : DtcBasic { VirtualPackModel virtualPackModel { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA204_tagMCVPackRefresh vNetData = vNetPack as HA204_tagMCVPackRefresh; if (vNetData != null && vNetData.PackType == (int)PackType.rptRunePack) { ModelCenter.Instance.GetModel<RuneModel>().OnRunePackRefresh(vNetData); } virtualPackModel.OnReceiveServerPack(vNetData); } } Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA205_tagMCVPackClear.cs
@@ -1,27 +1,30 @@ using UnityEngine; using System.Collections; using Snxxz.UI; // A2 05 虚拟背包物品清空 #tagMCVPackClear public class DTCA205_tagMCVPackClear : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA205_tagMCVPackClear vNetData = vNetPack as HA205_tagMCVPackClear; if (vNetData != null) { switch ((PackType)vNetData.PackType) { case PackType.rptRunePack: ModelCenter.Instance.GetModel<RuneModel>().OnRunePackClear(vNetData); break; } } } } using UnityEngine; using System.Collections; using Snxxz.UI; // A2 05 虚拟背包物品清空 #tagMCVPackClear public class DTCA205_tagMCVPackClear : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA205_tagMCVPackClear vNetData = vNetPack as HA205_tagMCVPackClear; if (vNetData != null) { switch ((PackType)vNetData.PackType) { case PackType.rptRunePack: ModelCenter.Instance.GetModel<RuneModel>().OnRunePackClear(vNetData); break; default: ModelCenter.Instance.GetModel<VirtualPackModel>().OnReceiveServerPack(vNetData); break; } } } } Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA31E_tagMCGatherSoulHoleInfo.cs
New file @@ -0,0 +1,26 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, December 17, 2018 //-------------------------------------------------------- using Snxxz.UI; using System; using System.Collections; using System.Collections.Generic; public class DTCA31E_tagMCGatherSoulHoleInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); var package = vNetPack as HA31E_tagMCGatherSoulHoleInfo; var model = ModelCenter.Instance.GetModel<GatheringSoulModel>(); model.OnReceiveServerPack(package); } } Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA31E_tagMCGatherSoulHoleInfo.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 7ac2fb93687ddce4e99497d25fa0ffc0 timeCreated: 1545015653 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HA3_Function/HA31E_tagMCGatherSoulHoleInfo.cs
New file @@ -0,0 +1,19 @@ using UnityEngine; using System.Collections; // A3 1E 玩家聚魂孔信息 #tagMCGatherSoulHoleInfo public class HA31E_tagMCGatherSoulHoleInfo : GameNetPackBasic { public byte Count; // 孔信息数 public uint[] GatherSoulDataList; // 孔数据信息, 数据与背包数据相同 public HA31E_tagMCGatherSoulHoleInfo () { _cmd = (ushort)0xA31E; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Count, vBytes, NetDataType.BYTE); TransBytes (out GatherSoulDataList, vBytes, NetDataType.DWORD, Count); } } Core/NetworkPackage/ServerPack/HA3_Function/HA31E_tagMCGatherSoulHoleInfo.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 81c8714d2fa24da4c967cfc831d4ae92 timeCreated: 1545015632 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Fight/GameActor/GA_NpcCollect.cs
@@ -283,6 +283,11 @@ return; } if (NpcConfig.NPCID == GeneralDefine.GatherSoulDZ) { return; } if (!m_ArrivedList.Contains(ServerInstID)) { if (OnArrive != null) @@ -354,8 +359,15 @@ } else { PlayerTaskDatas _model = ModelCenter.Instance.GetModel<PlayerTaskDatas>(); m_CanCollect = _model.IsGather(NpcConfig.NPCID); if (NpcConfig.NPCID == GeneralDefine.GatherSoulDZ) { m_CanCollect = true; } else { PlayerTaskDatas _model = ModelCenter.Instance.GetModel<PlayerTaskDatas>(); m_CanCollect = _model.IsGather(NpcConfig.NPCID); } } if (!m_CanCollect) Fight/GameActor/GA_NpcFunc.cs
@@ -65,7 +65,7 @@ PlayerTaskDatas _model = ModelCenter.Instance.GetModel<PlayerTaskDatas>(); var _npcID = NpcConfig.NPCID; if(_npcID == 10404101) if (_npcID == 10404101) { _npcID = 10404100; } @@ -380,7 +380,10 @@ Vector3 _forward = MathUtility.ForwardXZ(_hero.Pos, Pos); Forward = _forward; } NPCInteractProcessor.InvokeEvent(E_NpcType.Func, NpcConfig.NPCID, ServerInstID); if (NpcConfig.NPCID != GeneralDefine.GatherSoulDZ) { NPCInteractProcessor.InvokeEvent(E_NpcType.Func, NpcConfig.NPCID, ServerInstID); } } } Fight/MapTransferUtility.cs
@@ -940,7 +940,10 @@ if (!UserInputHandler.isTouched && (_hero.SkillMgr.CurCastSkill == null || _hero.SkillMgr.CurCastSkill.SkillCompelete)) { NPCInteractProcessor.InvokeEvent(E_NpcType.Func, NpcID, _npc.ServerInstID); if (NpcID != GeneralDefine.GatherSoulDZ) { NPCInteractProcessor.InvokeEvent(E_NpcType.Func, NpcID, _npc.ServerInstID); } Clear(); } } System/Compose/New/ComposeWin.cs
@@ -33,6 +33,7 @@ private FunctionButton _itemUITitleType; [SerializeField] private FunctionButton _dogzEquipFunc; [SerializeField] FunctionButton m_GatherSoulCompose; [SerializeField] private FunctionButtonGroup _funcBtnGroup; #endregion @@ -59,11 +60,13 @@ _equipUITitleType.onClick.AddListener(OnClickEquipCompose); _itemUITitleType.onClick.AddListener(OnClickItemCompose); _dogzEquipFunc.AddListener(ClickDogzEquipCompose); m_GatherSoulCompose.AddListener(GatherSoulCompose); _prePageBtn.onClick.AddListener(OnClickLeftBtn); _nextPageBtn.onClick.AddListener(OnClickRightBtn); _closeBtn.onClick.AddListener(OnClickCloseBtn); } protected override void OnPreOpen() { ComposeModel.ResetModel(); @@ -265,6 +268,21 @@ functionOrder = _wingsUITitleType.order; } private void GatherSoulCompose() { CloseSubWindows(); if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation<GatherSoulComposeWin>(); } else { WindowCenter.Instance.Open<GatherSoulComposeWin>(); } functionOrder = m_GatherSoulCompose.order; } private void CloseSubWindows() { System/DailyQuest/DailyQuestWin.cs
@@ -303,6 +303,9 @@ WindowCenter.Instance.CloseImmediately<DailyQuestWin>(); WindowCenter.Instance.Open<LocalMapWin>(); break; case DailyQuestType.GatherSoulDungeon: GotoNormalDungeon(_id, 0); break; default: CSharpCallLua.GotoLuaDailyQuest(_id); break; System/DailyQuest/ResourcesBackPanel.cs
@@ -230,7 +230,7 @@ string strLanguage = string.Empty; if (CostJade >= NeedFairyJade) { strLanguage = string.Format(Language.Get("NewResourceBack1"), NeedFairyJade); strLanguage = string.Format(Language.Get("NewResourceBack4"), NeedFairyJade); } else { System/Dungeon/DungeonFightWin.cs
@@ -33,6 +33,7 @@ [SerializeField] DungeonBossBriefInfoContainer m_BossInfosContainer; [SerializeField] GameObject m_Container_WHYJ; [SerializeField] DungenWHYJ m_DungenWHYJ; [SerializeField] GatherSoulDungeonBehaviour m_GatherSoulDungeonBehaviour; bool excutedAutoExit = false; float timer = 0f; DateTime endTime = DateTime.Now; @@ -76,6 +77,7 @@ m_ExitDungeon.gameObject.SetActive(dataMapId != DemonJarModel.DEMONJAR_MAPID); m_ContainerAncient.gameObject.SetActive(dataMapId == 31160); m_BossInfosContainer.gameObject.SetActive(dataMapId == ElderGodAreaModel.ELDERGODAREA_MAPID || dataMapId == BossHomeModel.BOSSHOME_MAPID); m_GatherSoulDungeonBehaviour.gameObject.SetActive(dataMapId == GatherSoulDungeonModel.DUNGEON_MAPID); switch (dataMapId) { case 31080: @@ -96,6 +98,9 @@ break; case 31160: m_AncientKing.Init(); break; case GatherSoulDungeonModel.DUNGEON_MAPID: m_GatherSoulDungeonBehaviour.Display(this); break; default: break; @@ -146,6 +151,7 @@ m_ContainerFuncBtn.localPosition = m_ContainerFuncBottom.localPosition; m_BossInfosContainer.Dispose(); m_AncientKing.UnInit(); m_GatherSoulDungeonBehaviour.Dispose(); DropItemManager.pickUpCallBack -= OnPickItem; MainInterfaceWin.Event_Duplicates -= OnChangeFuncBtnPosEvent; model.dungeonCoolDownEvent -= OnLeaveMapTimeEvent; @@ -223,6 +229,18 @@ language = Language.Get(config.ExitDescription); } } else if (dataMapId == GatherSoulDungeonModel.DUNGEON_MAPID) { var mission = model.mission; if (mission.step <= 1) { language = Language.Get("GatherSoulDungeonExitTip_0"); } else { language = Language.Get("GatherSoulDungeonExitTip_1"); } } else { language = Language.Get(config.ExitDescription); System/Dungeon/DungeonItemCollectFlyObject.cs
@@ -1,101 +1,117 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, October 26, 2017 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using System; namespace Snxxz.UI { public class DungeonItemCollectFlyObject : MonoBehaviour { [SerializeField] BezierMove m_BezierMove; Action endCallBack = null; public void Begin(Vector3 _from, Vector3 _to, Action _callBack) { var startPoint = _from.SetZ(0); var endPoint = _to; endCallBack = _callBack; var nl = Vector3.Normalize(endPoint - startPoint); var normal = new Vector3(-nl.y, nl.x, 0); var distance = Vector3.Distance(startPoint, endPoint); var pivot = startPoint + normal * UnityEngine.Random.Range(-distance, distance)*0.7f + nl * distance * 0.4f; m_BezierMove.Begin(startPoint, pivot, endPoint, OnReach); this.gameObject.SetActive(true); this.transform.localPosition = startPoint; } private void OnReach() { if (endCallBack != null) { endCallBack(); endCallBack = null; } DungeonItemCollectFlyObjectPool.Recycle(this.gameObject); } } public class DungeonItemCollectFlyObjectPool { static GameObjectPoolManager.GameObjectPool pool = null; public static DungeonItemCollectFlyObject Require() { if (pool == null) { var prefab = UILoader.LoadPrefab("DungeonItemCollectFlyObject"); if (prefab != null) { pool = GameObjectPoolManager.Instance.RequestPool(prefab); } } if (pool != null) { var instance = pool.Request(); return instance.GetComponent<DungeonItemCollectFlyObject>(); } else { return null; } } public static void Recycle(GameObject _gameObject) { if (pool != null) { pool.Release(_gameObject); _gameObject.transform.SetParent(null); _gameObject.SetActive(false); } } public static void Clear() { if (pool != null) { pool.Clear(); pool = null; } } } } //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, October 26, 2017 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using System; namespace Snxxz.UI { public class DungeonItemCollectFlyObject : MonoBehaviour { [SerializeField] BezierMove m_BezierMove; Action endCallBack = null; public void Begin(Vector3 _from, Vector3 _to, Action _callBack) { var startPoint = _from.SetZ(0); var endPoint = _to; endCallBack = _callBack; var nl = Vector3.Normalize(endPoint - startPoint); var normal = new Vector3(-nl.y, nl.x, 0); var distance = Vector3.Distance(startPoint, endPoint); var pivot = startPoint + normal * UnityEngine.Random.Range(-distance, distance)*0.7f + nl * distance * 0.4f; m_BezierMove.Begin(startPoint, pivot, endPoint, OnReach); this.gameObject.SetActive(true); this.transform.localPosition = startPoint; } public void Begin(Vector3 _from, Vector3 _to, float modulus, Action _callBack) { var startPoint = _from.SetZ(0); var endPoint = _to; endCallBack = _callBack; var nl = Vector3.Normalize(endPoint - startPoint); var normal = new Vector3(-nl.y, nl.x, 0); var distance = Vector3.Distance(startPoint, endPoint); var pivot = startPoint + normal * UnityEngine.Random.Range(-distance, distance) * modulus + nl * distance * 0.4f; m_BezierMove.Begin(startPoint, pivot, endPoint, OnReach); this.gameObject.SetActive(true); this.transform.localPosition = startPoint; } private void OnReach() { if (endCallBack != null) { endCallBack(); endCallBack = null; } DungeonItemCollectFlyObjectPool.Recycle(this.gameObject); } } public class DungeonItemCollectFlyObjectPool { static GameObjectPoolManager.GameObjectPool pool = null; public static DungeonItemCollectFlyObject Require() { if (pool == null) { var prefab = UILoader.LoadPrefab("DungeonItemCollectFlyObject"); if (prefab != null) { pool = GameObjectPoolManager.Instance.RequestPool(prefab); } } if (pool != null) { var instance = pool.Request(); return instance.GetComponent<DungeonItemCollectFlyObject>(); } else { return null; } } public static void Recycle(GameObject _gameObject) { if (pool != null) { pool.Release(_gameObject); _gameObject.transform.SetParent(null); _gameObject.SetActive(false); } } public static void Clear() { if (pool != null) { pool.Clear(); pool = null; } } } } System/Dungeon/DungeonModel.cs
@@ -556,6 +556,7 @@ dungeonInspireCounts.Clear(); inspireRemindEffective = false; inspireNoRemind = false; ModelCenter.Instance.GetModel<GatherSoulDungeonModel>().ResetDungeonMessage(); } public void UpdateRecords(HA320_tagMCPlayerFBInfoData.tagMCFBInfo[] _serverInfos) @@ -847,6 +848,13 @@ } } break; case GatherSoulDungeonModel.DUNGEON_MAPID: ModelCenter.Instance.GetModel<GatherSoulDungeonModel>().OnReceiveDungeonMessage(_mission); if (!WindowCenter.Instance.IsOpen<GatherSoulDungeonHintWin>()) { WindowCenter.Instance.Open<GatherSoulDungeonHintWin>(); } break; default: if (GetDungeonHintId(mapId, lineId) != 0) { @@ -1018,6 +1026,9 @@ WindowCenter.Instance.Open<DungeonGetTreasureVictoryWin>(); WindowCenter.Instance.Open<TreasureDungeonVictoryWin>(); break; case GatherSoulDungeonModel.DUNGEON_MAPID: WindowCenter.Instance.Open<DungeonGatherSoulVictoryWin>(); break; default: WindowCenter.Instance.Open<DungeonVictoryWin>(); break; System/Dungeon/DungeonSweepResultWin.cs
@@ -98,7 +98,15 @@ } var cost = model.GetSweepCost(model.currentDungeon); m_SweepCost.SetItem(cost); if (cost.id > 0) { m_SweepCost.gameObject.SetActive(true); m_SweepCost.SetItem(cost); } else { m_SweepCost.gameObject.SetActive(false); } } private void DrawItems() @@ -166,7 +174,7 @@ else { model.RequestSweep(model.currentDungeon); } } } else { System/FindPrecious/FindPreciousBossRebornBehaviour.cs
@@ -45,6 +45,30 @@ if (timer > 1f) { timer = 0f; var bossId = model.currentBossNotify.bossId; if (!model.IsBossAlive(bossId)) { var type = model.GetBossFindPreciousType(bossId); switch (type) { case FindPreciousType.DemonJar: model.ReportConfirmBossRebornNotify(model.currentBossNotify); break; default: FindPreciousModel.BossInfo bossInfo; if (model.TryGetBossInfo(bossId, out bossInfo)) { var rebornCountDown = (int)(bossInfo.refreshTime - TimeUtility.ServerNow).TotalSeconds; if (rebornCountDown > FindPreciousModel.PREPOSE_SECONDS) { model.ReportConfirmBossRebornNotify(model.currentBossNotify); } } break; } } DisplayRebornCountDown(); } } System/FindPrecious/FindPreciousModel.cs
@@ -83,6 +83,7 @@ public void OnPlayerLoginOk() { serverInited = true; RequestQueryBossInfo(0); InitializeBossNotify(); } @@ -116,8 +117,17 @@ public void RequestQueryBossInfo(int bossId) { var sendInfo = new CA904_tagCGQueryBossInfo(); sendInfo.Count = 1; sendInfo.BossIDList = new uint[] { (uint)bossId }; if (bossId == 0) { sendInfo.Count = 0; sendInfo.BossIDList = new uint[] { }; } else { sendInfo.Count = 1; sendInfo.BossIDList = new uint[] { (uint)bossId }; } GameNetSystem.Instance.SendInfo(sendInfo); } System/GatheringSoul/DungeonGatherSoulVictoryWin.cs
New file @@ -0,0 +1,113 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 18, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class DungeonGatherSoulVictoryWin : DungeonVictoryWin { [SerializeField] ScrollerController m_ScrollerControl; [SerializeField] RectTransform m_ContainerItems; [SerializeField] GatherSoulResultItemCell[] m_ResultItems; DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } List<ServerItem> itemList = new List<ServerItem>(); protected override void AddListeners() { base.AddListeners(); m_ScrollerControl.OnRefreshCell += OnRefreshCell; } protected override void Display() { m_ContainerPoivt.gameObject.SetActive(true); base.RequireDungeonExit(); base.DrawPassTime(); DisplayItems(); } void DisplayItems() { itemList.Clear(); var result = model.dungeonResult; if (result.itemInfo != null) { itemList.AddRange(result.itemInfo); } itemList.Sort(Compare); m_ScrollerControl.Refresh(); m_ContainerItems.gameObject.SetActive(itemList.Count > 0 && itemList.Count <= 6); if (itemList.Count > 6) { for (int i = 0; i < itemList.Count; i++) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i); } } else { for (int i = 0; i < m_ResultItems.Length; i++) { m_ResultItems[i].gameObject.SetActive(i < itemList.Count); if (i < itemList.Count) { m_ResultItems[i].Display(itemList[i].ItemID, itemList[i].Count); } } } m_ScrollerControl.Restart(); } private void OnRefreshCell(ScrollerDataType type, CellView cell) { var resultCell = cell as GatherSoulResultItemCell; if (cell.index < itemList.Count) { var item = itemList[cell.index]; resultCell.Display(item.ItemID, item.Count); } } int Compare(ServerItem lhs, ServerItem rhs) { var lhsConfig = Config.Instance.Get<ItemConfig>(lhs.ItemID); var rhsConfig = Config.Instance.Get<ItemConfig>(rhs.ItemID); var lhsEssence = lhsConfig.Type == GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE; var rhsEssence = rhsConfig.Type == GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE; if (lhsEssence != rhsEssence) { return lhsEssence.CompareTo(rhsEssence); } if (lhsConfig.ItemColor != rhsConfig.ItemColor) { return -lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor); } var lhsCore = lhsConfig.Type == GatheringSoulModel.GATHERSOUL_CORE_TYPE; var rhsCore = rhsConfig.Type == GatheringSoulModel.GATHERSOUL_CORE_TYPE; if (lhsCore != rhsCore) { return -lhsCore.CompareTo(rhsCore); } return 0; } } } System/GatheringSoul/DungeonGatherSoulVictoryWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 44e96ca5e3e77414194be628f1bc2908 timeCreated: 1545119140 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulBuildBehaviour.cs
New file @@ -0,0 +1,104 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulBuildBehaviour : MonoBehaviour { [SerializeField] RectTransform m_AttackDefend; [SerializeField] Button m_BuildAttackDefend; [SerializeField] RectTransform m_IceDefend; [SerializeField] Button m_BuildIceDefend; int collectNpcId = 0; uint serverInstanceId = 0; static bool m_SatisfyBuild = false; public static event Action defendBuildRefresh; public static bool satisfyBuild { get { return m_SatisfyBuild; } set { m_SatisfyBuild = value; if (defendBuildRefresh != null) { defendBuildRefresh(); } } } GatherSoulDungeonModel model { get { return ModelCenter.Instance.GetModel<GatherSoulDungeonModel>(); } } private void Awake() { m_BuildAttackDefend.AddListener(BuildAttackDefend); m_BuildIceDefend.AddListener(BuildIceDefend); } public void Display(int npcId,uint sid) { collectNpcId = npcId; serverInstanceId = sid; model.missionHelpUpdate -= MissionHelpUpdate; model.missionHelpUpdate += MissionHelpUpdate; DisplayBase(); } public void Dispose() { model.missionHelpUpdate -= MissionHelpUpdate; collectNpcId = 0; serverInstanceId = 0; satisfyBuild = false; } void DisplayBase() { var attackDefendCount = model.GetDefendNpcCount(model.attckDefendNpcId); var iceDefendCount = model.GetDefendNpcCount(model.iceDefendNpcId); m_AttackDefend.gameObject.SetActive(attackDefendCount < model.attackDefendCountLimit); m_IceDefend.gameObject.SetActive(iceDefendCount < model.iceDefendCountLimit); satisfyBuild = iceDefendCount < model.iceDefendCountLimit || attackDefendCount < model.attackDefendCountLimit; } private void BuildAttackDefend() { if (collectNpcId != 0 && serverInstanceId != 0) { CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 0; pak.ActionInfo = (uint)model.attckDefendNpcId; GameNetSystem.Instance.SendInfo(pak); NPCInteractProcessor.InvokeEvent(E_NpcType.Collect, collectNpcId, serverInstanceId); } } private void BuildIceDefend() { if (collectNpcId != 0 && serverInstanceId != 0) { CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 0; pak.ActionInfo = (uint)model.iceDefendNpcId; GameNetSystem.Instance.SendInfo(pak); NPCInteractProcessor.InvokeEvent(E_NpcType.Collect, collectNpcId, serverInstanceId); } } private void MissionHelpUpdate() { DisplayBase(); } } } System/GatheringSoul/GatherSoulBuildBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 0fae3cfd8e38dbd4a9e4ccc1573558f5 timeCreated: 1545104245 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulComposeBehaviour.cs
New file @@ -0,0 +1,78 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulComposeBehaviour : MonoBehaviour { [SerializeField] GatherSoulMatItem[] m_MatItems; [SerializeField] GatherSoulItemBehaviour[] m_RequireItems; GatherSoulComposeModel model { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } GatheringSoulModel soulModel { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public void Display(int itemId) { GatherSoulComposeModel.Compose compose; if (!model.TryGetCompose(itemId, out compose)) { return; } for (int i = 0; i < m_RequireItems.Length; i++) { if (compose.requireItems != null && i < compose.requireItems.Count) { if (compose.requireItems[i] == model.jumpGatherSoulItem.itemId) { m_RequireItems[i].Display(model.jumpGatherSoulItem.itemId, model.jumpGatherSoulItem.level); m_RequireItems[i].DisplayCount(1, 1); } else { GatherSoulItem item; bool exist = soulModel.TryGetHighestLevelItem(compose.requireItems[i], out item); m_RequireItems[i].Display(compose.requireItems[i], exist ? item.level : 1); m_RequireItems[i].DisplayCount(exist ? 1 : 0, 1); } } else { m_RequireItems[i].Display(0, 0); } } var index = 0; if (compose.requireSoulSplinters != 0) { if (index < m_MatItems.Length) { m_MatItems[index].Display(GatheringSoulModel.SOULSPLINTERS_MONEYTYPE, compose.requireSoulSplinters); } index++; } if (compose.requireSoulCore != 0) { if (index < m_MatItems.Length) { m_MatItems[index].Display(GatheringSoulModel.SOULCORE_MONEYTYPE, compose.requireSoulCore); } index++; } for (int i = index; i < m_MatItems.Length; i++) { m_MatItems[i].DisplayEmpty(); } } } } System/GatheringSoul/GatherSoulComposeBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 753c03ee31cc84049a73b840942fca65 timeCreated: 1544752956 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulComposeCategoryCell.cs
New file @@ -0,0 +1,71 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulComposeCategoryCell : CellView { [SerializeField] Image m_Bottom; [SerializeField] Text m_CategoryName; [SerializeField] Image m_Arrow; [SerializeField] RedpointBehaviour m_Redpoint; [SerializeField] Button m_Func; GatherSoulComposeModel model { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } GatherSoulComposeModel.ComposeCategory category; private void Awake() { m_Func.AddListener(OnFunc); } private void OnFunc() { if (model.selectCategory.Equals(category)) { model.selectCategory = default(GatherSoulComposeModel.ComposeCategory); } else { model.selectCategory = category; } } public void Display(GatherSoulComposeModel.ComposeCategory category) { this.category = category; bool isSelect = model.selectCategory.Equals(category); m_Arrow.transform.localEulerAngles = isSelect ? new Vector3(0, 0, -90) : Vector3.zero; m_Bottom.SetSprite(isSelect ? "ComposeFirstClassChoosebtn" : "ComposeFirstClassNormalbtn"); var qualityNameKey = StringUtility.Contact("QualityName_", category.quality); var propertyCountNameKey = StringUtility.Contact("SoulPropertyCountName_", category.propertyCount); switch (category.category) { case 1: m_CategoryName.text = StringUtility.Contact(Language.Get(qualityNameKey), Language.Get(propertyCountNameKey), Language.Get("SoulCategoryProperty")); break; case 2: m_CategoryName.text = StringUtility.Contact(Language.Get(qualityNameKey), Language.Get("ComposeSoulCore")); break; case 3: m_CategoryName.text = StringUtility.Contact(Language.Get(qualityNameKey), Language.Get("ComposeSoulPromotion")); break; case 4: m_CategoryName.text = StringUtility.Contact(Language.Get(propertyCountNameKey), Language.Get("SoulCategoryProperty"), Language.Get("ComposeHolySoul")); break; } } } } System/GatheringSoul/GatherSoulComposeCategoryCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 8e427e45690c5eb47b2fe3a3094e3ae8 timeCreated: 1544704726 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulComposeModel.cs
New file @@ -0,0 +1,178 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; namespace Snxxz.UI { [XLua.Hotfix] [XLua.LuaCallCSharp] public class GatherSoulComposeModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { Dictionary<int, Compose> composeDict = new Dictionary<int, Compose>(); public List<ComposeCategory> composeCategories { get; private set; } public Dictionary<ComposeCategory, List<int>> categoryDict { get; private set; } public event Action onSelectComposeItemChange; public event Action onSelectCategoryChange; ComposeCategory m_SelectCategory; public ComposeCategory selectCategory { get { return m_SelectCategory; } set { if (!value.Equals(m_SelectCategory)) { m_SelectCategory = value; if (onSelectCategoryChange != null) { onSelectCategoryChange(); } } } } int m_SelectItemId = 0; public int selectItemId { get { return m_SelectItemId; } set { if (value != m_SelectItemId) { m_SelectItemId = value; if (onSelectComposeItemChange != null) { onSelectComposeItemChange(); } } } } public VirtualItem jumpGatherSoulItem { get; set; } GatheringSoulModel soulModel { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public override void Init() { ParseConfig(); } public void OnBeforePlayerDataInitialize() { } public void OnPlayerLoginOk() { } public override void UnInit() { } void ParseConfig() { categoryDict = new Dictionary<ComposeCategory, List<int>>(); composeCategories = new List<ComposeCategory>(); var configs = Config.Instance.GetAllValues<GatherSoulComposeConfig>(); for (int i = 0; i < configs.Count; i++) { composeDict.Add(configs[i].TagItemID, new Compose(configs[i])); var itemConfig = Config.Instance.Get<ItemConfig>(configs[i].TagItemID); var gatherSoulConfig = Config.Instance.Get<GatherSoulConfig>(configs[i].TagItemID); if (gatherSoulConfig == null) { continue; } var propertyCount = gatherSoulConfig.AttrType.Length; if (itemConfig.Type == GatheringSoulModel.GATHERSOUL_CORE_TYPE) { propertyCount = 0; } var quality = itemConfig.ItemColor; var category = new ComposeCategory() { category = configs[i].category, propertyCount = propertyCount, quality = quality, }; if (!composeCategories.Contains(category)) { composeCategories.Add(category); } List<int> list; if (!categoryDict.TryGetValue(category, out list)) { list = new List<int>(); categoryDict.Add(category, list); } list.Add(configs[i].TagItemID); } } public bool ExistInComposeMat(int itemId, out Compose outCompose) { outCompose = null; foreach (var compose in composeDict.Values) { if (compose.requireItems.Contains(itemId)) { outCompose = compose; return true; } } return false; } public bool TryGetCompose(int itemId, out Compose compose) { return composeDict.TryGetValue(itemId, out compose); } public class Compose { public int itemId; public List<int> requireItems; public int requireLevel; public int requireSoulSplinters; public int requireSoulCore; public int category; public Compose(GatherSoulComposeConfig config) { itemId = config.TagItemID; requireItems = new List<int>(config.NeedItem); requireLevel = config.NeedLV; requireSoulSplinters = config.NeedSoulSplinters; requireSoulCore = config.NeedSoulCore; category = config.category; } } public struct ComposeCategory { public int category; public int quality; public int propertyCount; public override bool Equals(object obj) { var compare = (ComposeCategory)obj; return this.category == compare.category && this.quality == compare.quality && this.propertyCount == compare.propertyCount; } public override int GetHashCode() { return (category * 100 + quality * 10 + propertyCount).GetHashCode(); } } } } System/GatheringSoul/GatherSoulComposeModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: d74a739f763f7ae4193a065108b574da timeCreated: 1544579930 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulComposeSelectCell.cs
New file @@ -0,0 +1,49 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulComposeSelectCell : CellView { [SerializeField] Image m_Bottom; [SerializeField] Text m_ItemName; [SerializeField] RedpointBehaviour m_Redpoint; [SerializeField] Button m_Func; int itemId; GatherSoulComposeModel model { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } private void Awake() { m_Func.AddListener(OnFunc); } private void OnFunc() { if (itemId != 0) { model.selectItemId = itemId; } } public void Display(int itemId) { this.itemId = itemId; var config = Config.Instance.Get<ItemConfig>(itemId); m_ItemName.text = config.ItemName; m_ItemName.color = UIHelper.GetUIColor(config.ItemColor); m_Bottom.SetSprite(model.selectItemId == itemId ? "ChildListBtn_Select" : "ChildListBtn_UnSelect"); } } } System/GatheringSoul/GatherSoulComposeSelectCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 88b84b54f5cc83242a4a2ad5606d8ed0 timeCreated: 1544706615 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulComposeWin.cs
New file @@ -0,0 +1,412 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, December 13, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulComposeWin : Window { [SerializeField] ScrollerController m_ScrollerControl; [SerializeField] GatherSoulItemBehaviour m_ComposeItem; [SerializeField] PropertyBehaviour[] m_ComposeItemPropertys; [SerializeField] Text m_SuccessRate; [SerializeField] Button m_Compose; [SerializeField] GatherSoulComposeBehaviour[] m_ComposeBehaviours; [SerializeField] Text m_RequireLevel; [SerializeField] RectTransform m_ContainerUnCompose; [SerializeField] RectTransform m_ContainerCompose; [SerializeField] UIEffect m_OneMatEffect; [SerializeField] UIEffect m_TwoMatEffect; GatherSoulComposeModel model { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } GatheringSoulModel soulModel { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Compose.onClick.AddListener(Compose); m_ScrollerControl.OnRefreshCell += OnRefreshCell; } protected override void OnPreOpen() { model.selectCategory = default(GatherSoulComposeModel.ComposeCategory); model.selectItemId = 0; HandleJumpSelect(); Display(); model.onSelectComposeItemChange += OnSelectComposeItemChange; model.onSelectCategoryChange += OnSelectCategoryChange; soulModel.gatherSoulPackRefresh += GatherSoulPackRefresh; soulModel.gatherSoulHolesRefresh += GatherSoulHolesRefresh; DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent += MakeItemAnswerEvent; } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.jumpGatherSoulItem = default(VirtualItem); model.onSelectComposeItemChange -= OnSelectComposeItemChange; model.onSelectCategoryChange -= OnSelectCategoryChange; soulModel.gatherSoulPackRefresh -= GatherSoulPackRefresh; soulModel.gatherSoulHolesRefresh -= GatherSoulHolesRefresh; DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent -= MakeItemAnswerEvent; } protected override void OnAfterClose() { } #endregion void HandleJumpSelect() { if (!model.jumpGatherSoulItem.Equals(default(VirtualItem))) { var itemId = model.jumpGatherSoulItem.itemId; GatherSoulComposeModel.Compose compose; if (model.ExistInComposeMat(itemId, out compose)) { foreach (var category in model.categoryDict.Keys) { if (model.categoryDict[category].Contains(compose.itemId)) { model.selectCategory = category; model.selectItemId = compose.itemId; break; } } } } } private void GatherSoulHolesRefresh() { if (!model.jumpGatherSoulItem.Equals(default(VirtualItem)) && !soulModel.CheckExist(model.jumpGatherSoulItem)) { model.jumpGatherSoulItem = default(VirtualItem); } DisplayCompose(); } private void GatherSoulPackRefresh() { if (!model.jumpGatherSoulItem.Equals(default(VirtualItem)) && !soulModel.CheckExist(model.jumpGatherSoulItem)) { model.jumpGatherSoulItem = default(VirtualItem); } DisplayCompose(); } private void OnSelectComposeItemChange() { model.jumpGatherSoulItem = default(VirtualItem); m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); DisplayCompose(); DisplayRequireLevel(); } private void OnSelectCategoryChange() { model.jumpGatherSoulItem = default(VirtualItem); DisplaySelect(); if (model.selectCategory.Equals(default(GatherSoulComposeModel.ComposeCategory))) { model.selectItemId = 0; } else { var list = model.categoryDict[model.selectCategory]; if (list == null || !list.Contains(model.selectItemId)) { model.selectItemId = 0; } } DisplayCompose(); DisplayRequireLevel(); } private void MakeItemAnswerEvent(H0721_tagMakeItemAnswer package) { if (package.MakeType == (byte)MakeType.Def_mitGatherSoulCompound) { if (model.selectItemId != 0) { GatherSoulComposeModel.Compose compose; if (model.TryGetCompose(model.selectItemId, out compose)) { if (compose.requireSoulCore > 0 && compose.requireSoulSplinters > 0) { m_TwoMatEffect.Play(); } else { m_OneMatEffect.Play(); } } } } } private void OnRefreshCell(ScrollerDataType type, CellView cell) { if (type == ScrollerDataType.Header) { var categoryCell = cell as GatherSoulComposeCategoryCell; categoryCell.Display(model.composeCategories[cell.index]); } else if (type == ScrollerDataType.Normal) { var selectCell = cell as GatherSoulComposeSelectCell; selectCell.Display(cell.index); } } void Display() { DisplaySelect(); DisplayCompose(); DisplayRequireLevel(); } void DisplaySelect() { var jumpIndex = 0; m_ScrollerControl.Refresh(); for (int i = 0; i < model.composeCategories.Count; i++) { var category = model.composeCategories[i]; var list = model.categoryDict[category]; m_ScrollerControl.AddCell(ScrollerDataType.Header, i); if (model.selectCategory.Equals(category)) { jumpIndex = i; for (int k = 0; k < list.Count; k++) { m_ScrollerControl.AddCell(ScrollerDataType.Normal, list[k]); if (model.selectItemId != 0 && model.selectItemId == list[k]) { jumpIndex += k+1; } } } } m_ScrollerControl.Restart(); m_ScrollerControl.JumpIndex(jumpIndex); } void DisplayCompose() { var matCount = 0; GatherSoulComposeModel.Compose compose = null; if (model.TryGetCompose(model.selectItemId, out compose)) { if (compose.requireSoulCore != 0) { matCount++; } if (compose.requireSoulSplinters != 0) { matCount++; } } for (int i = 0; i < m_ComposeBehaviours.Length; i++) { m_ComposeBehaviours[i].gameObject.SetActive(i + 1 == matCount); if (i + 1 == matCount) { m_ComposeBehaviours[i].Display(model.selectItemId); } } m_ComposeItem.gameObject.SetActive(matCount > 0); m_ContainerCompose.gameObject.SetActive(matCount > 0); m_ContainerUnCompose.gameObject.SetActive(matCount == 0); if (matCount > 0) { var resolveReturn = 0; for (int i = 0; i < compose.requireItems.Count; i++) { if (compose.requireItems[i] == model.jumpGatherSoulItem.itemId) { resolveReturn += soulModel.GetResolveReturnCost(model.jumpGatherSoulItem.itemId, model.jumpGatherSoulItem.level, true); } else { GatherSoulItem item; if (!soulModel.TryGetHighestLevelItem(compose.requireItems[i], out item)) { resolveReturn = 0; break; } resolveReturn += soulModel.GetResolveReturnCost(item.id, item.level, true); } } var level = 1; if (resolveReturn != 0) { level = soulModel.GetLevelByCost(model.selectItemId, (ulong)resolveReturn); } level = Mathf.Max(1, level); m_ComposeItem.Display(model.selectItemId, level); var propertys = soulModel.gatherSoulPropertys[model.selectItemId]; for (int i = 0; i < m_ComposeItemPropertys.Length; i++) { m_ComposeItemPropertys[i].gameObject.SetActive(i < propertys.Count); if (i < propertys.Count) { m_ComposeItemPropertys[i].DisplayUpper(propertys[i], soulModel.GetPropertyValue(model.selectItemId, propertys[i], level)); } } } else { m_ComposeItem.Display(0, 1); } } void DisplayRequireLevel() { GatherSoulComposeModel.Compose compose = null; if (model.TryGetCompose(model.selectItemId, out compose)) { m_RequireLevel.gameObject.SetActive(true); m_RequireLevel.text = Language.Get("GatherSoulComposeRequireLevel", compose.requireLevel); } else { m_RequireLevel.gameObject.SetActive(false); } } private void Compose() { var error = 0; if (!TestCompose(out error)) { DisplayErrorTip(error); return; } else { GatherSoulComposeModel.Compose compose; if (model.TryGetCompose(model.selectItemId, out compose)) { byte[] packArray = new byte[compose.requireItems.Count]; ushort[] indexArray = new ushort[compose.requireItems.Count]; for (int i = 0; i < compose.requireItems.Count; i++) { GatherSoulItem item; if (soulModel.TryGetHighestLevelItem(compose.requireItems[i], out item)) { packArray[i] = (byte)item.placeType; indexArray[i] = (ushort)item.index; } else { return; } } CA51C_tagCMGatherSoulCompound pak = new CA51C_tagCMGatherSoulCompound(); pak.PackList = packArray; pak.IndexList = indexArray; pak.Cnt = (byte)compose.requireItems.Count; pak.TagItemID = (uint)model.selectItemId; GameNetSystem.Instance.SendInfo(pak); } } } bool TestCompose(out int error) { error = 0; GatherSoulComposeModel.Compose compose; if (!model.TryGetCompose(model.selectItemId, out compose)) { error = 1; return false; } if (PlayerDatas.Instance.baseData.LV < compose.requireLevel) { error = 2; return false; } if (UIHelper.GetMoneyCnt(GatheringSoulModel.SOULSPLINTERS_MONEYTYPE) < (ulong)compose.requireSoulSplinters) { error = 3; return false; } if (UIHelper.GetMoneyCnt(GatheringSoulModel.SOULCORE_MONEYTYPE) < (ulong)compose.requireSoulCore) { error = 4; return false; } for (int i = 0; i < compose.requireItems.Count; i++) { if (compose.requireItems[i] != model.jumpGatherSoulItem.itemId) { GatherSoulItem item; if (!soulModel.TryGetHighestLevelItem(compose.requireItems[i], out item)) { error = 5; return false; } } } return true; } void DisplayErrorTip(int error) { switch (error) { case 2: SysNotifyMgr.Instance.ShowTip("GatherSoulComposeError_2"); break; case 3: SysNotifyMgr.Instance.ShowTip("GatherSoulComposeError_3"); break; case 4: SysNotifyMgr.Instance.ShowTip("GatherSoulComposeError_4"); break; case 5: SysNotifyMgr.Instance.ShowTip("GatherSoulComposeError_5"); break; } } } } System/GatheringSoul/GatherSoulComposeWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: d61183202e081ad488e471cf8db5a36d timeCreated: 1544704498 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonBehaviour.cs
New file @@ -0,0 +1,248 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulDungeonBehaviour : MonoBehaviour { [SerializeField] RectTransform m_GenerateMonsterRemind; [SerializeField] Button m_GenerateMonster; [SerializeField] Button m_AttackDefendButton; [SerializeField] Text m_AttackDefendCount; [SerializeField] Text m_AttackDefendDescription; [SerializeField] Button m_IceDefendButton; [SerializeField] Text m_IceDefendCount; [SerializeField] Text m_IceDefendDescription; [SerializeField] Button m_GenerateBoss; [SerializeField] RectTransform m_ContaienrAreadySpawn; [SerializeField] RectTransform m_ContainerAutoSpawn; [SerializeField] Button m_ViewGetItem; GatherSoulDungeonModel model { get { return ModelCenter.Instance.GetModel<GatherSoulDungeonModel>(); } } DungeonFightWin window; private void Awake() { m_GenerateMonster.onClick.AddListener(GenerateMonster); m_AttackDefendButton.onClick.AddListener(ClickAttackDefend); m_IceDefendButton.onClick.AddListener(ClickIceDefend); m_GenerateBoss.onClick.AddListener(GenerateBoss); m_ViewGetItem.onClick.AddListener(ViewGetItem); } public void Display(DungeonFightWin window) { this.window = window; model.missionHelpUpdate += MissionHelpUpdate; model.monsterAppearEvent += MonsterAppearEvent; DropItem.onDropItemDisappear += OnDropItemDisappear; DisplayGenerateMonster(); DisplayDefend(); DisplayGenerateBoss(); } public void Dispose() { model.missionHelpUpdate -= MissionHelpUpdate; model.monsterAppearEvent -= MonsterAppearEvent; DropItem.onDropItemDisappear -= OnDropItemDisappear; } private void OnDropItemDisappear(Vector3 position) { if (window != null) { var flyObject = DungeonItemCollectFlyObjectPool.Require(); flyObject.transform.SetParentEx(window.transform, Vector3.zero, Quaternion.identity, Vector3.one); var uiPosition = CameraUtility.ConvertToUIPosition(CameraManager.sceneCamera, position); var localPos = window.transform.InverseTransformPoint(uiPosition); if (Mathf.Abs(localPos.x) > Screen.width / 2 || Mathf.Abs(localPos.y) > Screen.height / 2) { localPos.x = -Screen.width / 2; localPos.y = -Screen.height / 2 + 100f; localPos.z = 0; } uiPosition = window.transform.TransformPoint(localPos); flyObject.Begin(uiPosition, m_ViewGetItem.transform.position, 0.2f, null); } } void DisplayGenerateMonster() { m_GenerateMonster.gameObject.SetActive(model.mission.step == 1); if (model.GetDefendNpcCount(model.attckDefendNpcId) >= model.attackDefendCountLimit && model.GetDefendNpcCount(model.iceDefendNpcId) >= model.iceDefendCountLimit && model.mission.step == 1) { m_GenerateMonsterRemind.gameObject.SetActive(true); } else { m_GenerateMonsterRemind.gameObject.SetActive(false); } } void DisplayDefend() { var count = model.GetDefendNpcCount(model.attckDefendNpcId); m_AttackDefendCount.text = Language.Get("GatherSoulDefendRemain", model.attackDefendCountLimit - count); count = model.GetDefendNpcCount(model.iceDefendNpcId); m_IceDefendCount.text = Language.Get("GatherSoulDefendRemain", model.iceDefendCountLimit - count); } void DisplayGenerateBoss() { var mission = model.mission; m_ContainerAutoSpawn.gameObject.SetActive(mission.isAuto == 1); m_ContaienrAreadySpawn.gameObject.SetActive(mission.isAuto != 1 && mission.hasRefreshBoss == 1); } private void MissionHelpUpdate() { DisplayGenerateMonster(); DisplayDefend(); DisplayGenerateBoss(); } private void GenerateMonster() { var mission = model.mission; if (model.GetDefendNpcCount(model.attckDefendNpcId) < model.attackDefendCountLimit || model.GetDefendNpcCount(model.iceDefendNpcId) < model.iceDefendCountLimit) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("GenerateMonsterConfirm"), (bool isOk) => { if (isOk) { SendGenerateMonsterPackage(); } }); } else { SendGenerateMonsterPackage(); } } void SendGenerateMonsterPackage() { model.clickGenerateMonster = true; CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 1; pak.ActionInfo = 0; GameNetSystem.Instance.SendInfo(pak); } private void GenerateBoss() { var mission = model.mission; if (mission.step <= 1) { SysNotifyMgr.Instance.ShowTip("PleaseGenerateMonsterFirst"); } else { WindowCenter.Instance.Open<GatherSoulGenerateBossWin>(); } } private void ClickAttackDefend() { var count = model.GetDefendNpcCount(model.attckDefendNpcId); if (count >= model.attackDefendCountLimit) { var npcConfig = Config.Instance.Get<NPCConfig>(model.attckDefendNpcId); if (npcConfig != null) { SysNotifyMgr.Instance.ShowTip("HasBuildAllDefend", npcConfig.charName); } } else { GotoCloserBuildPoint(); } } private void ClickIceDefend() { var count = model.GetDefendNpcCount(model.iceDefendNpcId); if (count >= model.iceDefendCountLimit) { var npcConfig = Config.Instance.Get<NPCConfig>(model.iceDefendNpcId); if (npcConfig != null) { SysNotifyMgr.Instance.ShowTip("HasBuildAllDefend", npcConfig.charName); } } else { GotoCloserBuildPoint(); } } void GotoCloserBuildPoint() { var hero = PlayerDatas.Instance.hero; if (hero != null) { var actor = GAMgr.Instance.GetCloserNPC(hero.Pos, model.defendPointNpcId) as GA_NpcCollect; if (actor != null) { SnxxzGame.Instance.StartCoroutine(Co_MoveToNpc(actor)); } } } private void MonsterAppearEvent() { } private void ViewGetItem() { bool existItems = false; for (int i = 1; i <= model.dungeonWeelCount; i++) { List<GatherSoulDungeonModel.ItemInfo> list; if (model.TryGetDungeonItems(i,out list)) { existItems = true; break; } } if (existItems) { WindowCenter.Instance.Open<GatherSoulDungeonGetItemWin>(); } else { SysNotifyMgr.Instance.ShowTip("UnGetAnyGatherSoulItems"); } } IEnumerator Co_MoveToNpc(GA_NpcCollect actor) { var hero = PlayerDatas.Instance.hero; if (hero == null || actor == null) { yield break; } while (hero.SkillMgr.CurCastSkill != null && hero.SkillMgr.CurCastSkill.SkillCompelete == false) { yield return null; } MapTransferUtility.Instance.MoveToNPC(actor.NpcConfig.NPCID, (int)actor.ServerInstID); } } } System/GatheringSoul/GatherSoulDungeonBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 91cb50f82d122d347849efdc0e957284 timeCreated: 1545038267 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonGetItemWin.cs
New file @@ -0,0 +1,141 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, December 17, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulDungeonGetItemWin : Window { [SerializeField] int m_LineCount = 5; [SerializeField] ScrollerController m_ScrollerControl; GatherSoulDungeonModel model { get { return ModelCenter.Instance.GetModel<GatherSoulDungeonModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_ScrollerControl.OnRefreshCell += OnRefreshCell; m_ScrollerControl.OnGetDynamicSize += OnGetDynamicSize; m_ScrollerControl.lockType = EnhanceLockType.KeepVertical; } protected override void OnPreOpen() { model.missionHelpUpdate += MissionHelpUpdate; Display(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.missionHelpUpdate -= MissionHelpUpdate; } protected override void OnAfterClose() { } #endregion private bool OnGetDynamicSize(ScrollerDataType type, int index, out float height) { height = 0; if (type == ScrollerDataType.Normal) { var weel = index / 100; var line = index % 100; bool requireLine = false; if (weel < model.mission.wheel) { List<GatherSoulDungeonModel.ItemInfo> list; if (model.TryGetDungeonItems(weel, out list)) { if (line == list.Count / m_LineCount) { requireLine = true; } } } height = requireLine ? 92 : 82; return true; } return false; } private void OnRefreshCell(ScrollerDataType type, CellView cell) { if (type == ScrollerDataType.Header) { var weelCell = cell as GatherSoulDungeonWeelCell; weelCell.Display(cell.index); } else if (type == ScrollerDataType.Normal) { var itemCell = cell as GatherSoulDungeonItemCell; var weel = cell.index / 100; var line = cell.index % 100; bool requireLine = false; if (weel < model.mission.wheel) { List<GatherSoulDungeonModel.ItemInfo> list; if (model.TryGetDungeonItems(weel, out list)) { if (line == list.Count / m_LineCount) { requireLine = true; } } } itemCell.Display(weel, line, requireLine); } } private void MissionHelpUpdate() { Display(); } void Display() { m_ScrollerControl.Refresh(); var mission = model.mission; for (int i = 1; i <= mission.wheel; i++) { List<GatherSoulDungeonModel.ItemInfo> list; if (model.TryGetDungeonItems(i, out list)) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i); var line = Mathf.CeilToInt((float)list.Count / m_LineCount); for (int k = 0; k < line; k++) { m_ScrollerControl.AddCell(ScrollerDataType.Normal, i * 100 + k); } } } m_ScrollerControl.Restart(); } } } System/GatheringSoul/GatherSoulDungeonGetItemWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 79693efdcf13ddf419564096a33ebf73 timeCreated: 1545050102 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonHintWin.cs
New file @@ -0,0 +1,120 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, December 17, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulDungeonHintWin : Window { [SerializeField] Text m_HelpRemind; [SerializeField] RectTransform m_ContainerReady; [SerializeField] RectTransform m_ContainerTarget; [SerializeField] RectTransform m_ContainerHint; [SerializeField] Text m_Title; [SerializeField] Text m_AttackDefendCount; [SerializeField] Text m_IceDefendCount; [SerializeField] DungeonTargetBehaviour m_TargetBehaviour; GatherSoulDungeonModel model { get { return ModelCenter.Instance.GetModel<GatherSoulDungeonModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { model.missionHelpUpdate += MissionHelpUpdate; Display(); m_TargetBehaviour.Init(GatherSoulDungeonModel.DUNGEON_MAPID); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.missionHelpUpdate -= MissionHelpUpdate; } protected override void OnAfterClose() { } #endregion void Display() { DisplayHelpRemind(); DisplayMissionTarget(); } void DisplayHelpRemind() { var mission = model.mission; if (mission.step <= 1) { m_HelpRemind.text = UIHelper.ReplaceNewLine(Language.Get("GatherSoulHelpRemind_0")); } else { m_HelpRemind.text = UIHelper.ReplaceNewLine(Language.Get("GatherSoulHelpRemind_1")); } } void DisplayMissionTarget() { var mission = model.mission; var lineId = mission.lineID; var dungeonId = dungeonModel.GetDungeonId(GatherSoulDungeonModel.DUNGEON_MAPID, lineId); var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId); if (dungeonConfig != null) { m_Title.text = dungeonConfig.FBName; } m_ContainerReady.gameObject.SetActive(mission.step <= 1); m_ContainerTarget.gameObject.SetActive(mission.step > 1); m_ContainerHint.gameObject.SetActive(mission.step > 1); if (mission.step <= 1) { m_AttackDefendCount.text = StringUtility.Contact( model.GetDefendNpcCount(model.attckDefendNpcId), "/", model.attackDefendCountLimit); m_IceDefendCount.text = StringUtility.Contact( model.GetDefendNpcCount(model.iceDefendNpcId), "/", model.iceDefendCountLimit); } } private void MissionHelpUpdate() { Display(); } } } System/GatheringSoul/GatherSoulDungeonHintWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 18d23dd3834d709498bbbbc89c993f56 timeCreated: 1545035236 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonItemCell.cs
New file @@ -0,0 +1,44 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulDungeonItemCell : CellView { [SerializeField] GatherSoulItemBehaviour[] m_Items; [SerializeField] RectTransform m_Cutline; GatherSoulDungeonModel model { get { return ModelCenter.Instance.GetModel<GatherSoulDungeonModel>(); } } public void Display(int weel, int line, bool requireLine) { List<GatherSoulDungeonModel.ItemInfo> list; if (model.TryGetDungeonItems(weel, out list)) { for (int i = 0; i < m_Items.Length; i++) { var index = line * m_Items.Length + i; if (index < list.Count) { m_Items[i].gameObject.SetActive(true); m_Items[i].Display(list[index].ItemID, 1); m_Items[i].DisplayCount(list[index].Count); } else { m_Items[i].gameObject.SetActive(false); } } } m_Cutline.gameObject.SetActive(requireLine); } } } System/GatheringSoul/GatherSoulDungeonItemCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: f892a4940ed33db44bcbb75a785f40ac timeCreated: 1545050595 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonModel.cs
New file @@ -0,0 +1,204 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; namespace Snxxz.UI { [XLua.Hotfix] [XLua.LuaCallCSharp] public class GatherSoulDungeonModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { public const int DUNGEON_MAPID = 31340; GatherSoulDungeonHelp m_Mission; public GatherSoulDungeonHelp mission { get { return m_Mission; } private set { m_Mission = value; } } public int attckDefendNpcId { get; private set; } public int iceDefendNpcId { get; private set; } public int defendPointNpcId { get; private set; } public int attackDefendCountLimit { get; private set; } public int iceDefendCountLimit { get; private set; } public int generateBossCost { get; private set; } public int dungeonWeelCount { get; private set; } public bool clickGenerateMonster { get; set; } Dictionary<int, List<ItemInfo>> dungeonItemDict = new Dictionary<int, List<ItemInfo>>(); readonly List<int> itemTypeSort = new List<int>() { GatheringSoulModel.GATHERSOUL_CORE_TYPE, GatheringSoulModel.GATHERSOUL_SOUL_TYPE,GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE}; public event Action missionHelpUpdate; public event Action monsterAppearEvent; public override void Init() { ParseConfig(); } public void OnBeforePlayerDataInitialize() { ResetDungeonMessage(); } public void OnPlayerLoginOk() { } public override void UnInit() { } void ParseConfig() { var funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulDungeon"); if (funcConfig != null) { attckDefendNpcId = int.Parse(funcConfig.Numerical1); iceDefendNpcId = int.Parse(funcConfig.Numerical2); defendPointNpcId = int.Parse(funcConfig.Numerical3); } funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulAttacker"); if (funcConfig != null) { attackDefendCountLimit = int.Parse(funcConfig.Numerical1); iceDefendCountLimit = int.Parse(funcConfig.Numerical2); } funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulGoldBoss"); if (funcConfig != null) { generateBossCost = int.Parse(funcConfig.Numerical1); } funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulDungeonTurn"); if (funcConfig != null) { dungeonWeelCount = int.Parse(funcConfig.Numerical1); } } public void OnReceiveDungeonMessage(string _mission) { mission = LitJson.JsonMapper.ToObject<GatherSoulDungeonHelp>(_mission); if (clickGenerateMonster && mission.step == 2) { if (monsterAppearEvent != null) { monsterAppearEvent(); } } dungeonItemDict.Clear(); if (mission.gsItemInfo != null) { foreach (var key in mission.gsItemInfo.Keys) { var weel = int.Parse(key); List<ItemInfo> list; if (!dungeonItemDict.TryGetValue(weel, out list)) { list = new List<ItemInfo>(); dungeonItemDict.Add(weel, list); } if (mission.gsItemInfo[key] != null) { list.AddRange(mission.gsItemInfo[key]); list.Sort(Compare); } } } clickGenerateMonster = false; bool requreStepHint = mission.step == 1 && (GetDefendNpcCount(attckDefendNpcId) < attackDefendCountLimit || GetDefendNpcCount(iceDefendNpcId) < iceDefendCountLimit); if (requreStepHint && !WindowCenter.Instance.IsOpen<GatherSoulDungeonStepHintWin>()) { WindowCenter.Instance.Open<GatherSoulDungeonStepHintWin>(); } else if (!requreStepHint && WindowCenter.Instance.IsOpen<GatherSoulDungeonStepHintWin>()) { WindowCenter.Instance.Close<GatherSoulDungeonStepHintWin>(); } if (missionHelpUpdate != null) { missionHelpUpdate(); } } public bool TryGetDungeonItems(int weel, out List<ItemInfo> list) { return dungeonItemDict.TryGetValue(weel, out list); } public int GetDefendNpcCount(int npcId) { if (mission.npc != null) { for (int i = 0; i < mission.npc.Length; i++) { var npcInfo = mission.npc[i]; if (npcInfo.NPCID == npcId) { return npcInfo.killCnt; } } } return 0; } public void ResetDungeonMessage() { mission = default(GatherSoulDungeonHelp); clickGenerateMonster = false; dungeonItemDict.Clear(); } int Compare(ItemInfo lhs, ItemInfo rhs) { var lhsConfig = Config.Instance.Get<ItemConfig>(lhs.ItemID); var rhsConfig = Config.Instance.Get<ItemConfig>(rhs.ItemID); var lhsTypeSort = itemTypeSort.IndexOf(lhsConfig.Type); var rhsTypeSort = itemTypeSort.IndexOf(rhsConfig.Type); if (lhsTypeSort != rhsTypeSort) { return lhsTypeSort.CompareTo(rhsTypeSort); } if (lhsConfig.ItemColor != rhsConfig.ItemColor) { return -lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor); } return 0; } public struct ItemInfo { public int ItemID; public int Count; } } public struct GatherSoulDungeonHelp { public int lineID; public int wheel; public int step; public DungeonNPCInfo[] npc; public int isAuto; public int hasRefreshBoss; public Dictionary<string, GatherSoulDungeonModel.ItemInfo[]> gsItemInfo; } } System/GatheringSoul/GatherSoulDungeonModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 70b4b88ef44511e4991626767a8cec26 timeCreated: 1545032624 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonStepHintWin.cs
New file @@ -0,0 +1,63 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 18, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulDungeonStepHintWin : Window { [SerializeField] RectTransform m_Container; #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { GatherSoulBuildBehaviour.defendBuildRefresh += DefendBuildRefresh; Display(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { GatherSoulBuildBehaviour.defendBuildRefresh -= DefendBuildRefresh; } protected override void OnAfterClose() { } #endregion void Display() { m_Container.gameObject.SetActive(!GatherSoulBuildBehaviour.satisfyBuild); } private void DefendBuildRefresh() { Display(); } } } System/GatheringSoul/GatherSoulDungeonStepHintWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 0b5a1fa0f900e1b4f985b4668fa6f65a timeCreated: 1545118299 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulDungeonWeelCell.cs
New file @@ -0,0 +1,19 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulDungeonWeelCell : CellView { [SerializeField] Text m_Weel; public void Display(int weel) { m_Weel.text = Language.Get("GatherSoulDungeonDropTitle", Language.Get(StringUtility.Contact("Num_CHS_", weel))); } } } System/GatheringSoul/GatherSoulDungeonWeelCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: c1bd8ea089f2cb2439a03e1603af6bad timeCreated: 1545050359 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulEquipCell.cs
New file @@ -0,0 +1,45 @@ using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulEquipCell : CellView { [SerializeField] Image m_Icon; [SerializeField] Text m_Level; [SerializeField] PropertyBehaviour[] m_Propertys; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } VirtualPackModel virtualPack { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } public void Display(GatherSoulItem item) { var itemConfig = Config.Instance.Get<ItemConfig>(item.id); m_Icon.SetSprite(itemConfig.IconKey); m_Level.text = item.level.ToString(); var list = model.gatherSoulPropertys[item.id]; for (int i = 0; i < m_Propertys.Length; i++) { m_Propertys[i].gameObject.SetActive(i < list.Count); if (i < list.Count) { var propertyValue = model.GetPropertyValue(item.id, list[i], item.level); m_Propertys[i].DisplayUpper(list[i], propertyValue); } } } } } System/GatheringSoul/GatherSoulEquipCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4ea72ca4ef6da3844896840cdf140865 timeCreated: 1544519220 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulEquipListWin.cs
New file @@ -0,0 +1,141 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 11, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulEquipListWin : Window { [SerializeField] RectTransform m_Container; [SerializeField] Button m_Close; [SerializeField] ScrollerController m_ScrollerControl; public static int selectHole = 0; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } List<GatherSoulItem> equipList = new List<GatherSoulItem>(); #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Close.onClick.AddListener(CloseClick); m_ScrollerControl.OnRefreshCell += OnRefreshCell; } protected override void OnPreOpen() { Display(); model.gatherSoulPackRefresh += GatherSoulPackRefresh; } protected override void OnAfterOpen() { } protected override void OnPreClose() { equipList.Clear(); model.gatherSoulPackRefresh -= GatherSoulPackRefresh; } protected override void OnAfterClose() { } #endregion private void OnRefreshCell(ScrollerDataType type, CellView cell) { var equipCell = cell as GatherSoulEquipCell; if (cell.index < equipList.Count) { equipCell.Display(equipList[cell.index]); } } void Display() { model.TryGetSatisfyEquipSouls(selectHole, ref equipList); EliminateSameItem(); equipList.Sort(model.CommonSort); m_ScrollerControl.Refresh(); for (int i = 0; i < equipList.Count; i++) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i, EquipGatherSoul); } m_ScrollerControl.Restart(); } void EliminateSameItem() { List<int> removeIndexs = new List<int>(); for (int i = 0; i < equipList.Count; i++) { var item = equipList[i]; if (removeIndexs.Contains(i)) { continue; } for (int k = i + 1; k < equipList.Count; k++) { if (removeIndexs.Contains(k)) { continue; } var compare = item.Compare(equipList[k]); if (item.ExistSameProperty(equipList[k].id)) { if(compare == 1 || compare == 0) { removeIndexs.Add(k); } else { removeIndexs.Add(i); break; } } } } removeIndexs.Sort(); for (int i = removeIndexs.Count - 1; i >= 0; i--) { equipList.RemoveAt(removeIndexs[i]); } } private void GatherSoulPackRefresh() { Display(); } private void EquipGatherSoul(CellView cell) { if (cell.index < equipList.Count) { var item = equipList[cell.index]; model.ExecuteEquipSoul(item, selectHole); CloseImmediately(); } } } } System/GatheringSoul/GatherSoulEquipListWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 5bc165d5faf0bd048a80b7dd0625f357 timeCreated: 1544518933 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulGenerateBossWin.cs
New file @@ -0,0 +1,164 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 18, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulGenerateBossWin : Window { [SerializeField] Text m_Label; [SerializeField] Toggle m_AutoGenerate; [SerializeField] Button m_Confirm; [SerializeField] Button m_Cancel; [SerializeField] Button m_Close; GatherSoulDungeonModel model { get { return ModelCenter.Instance.GetModel<GatherSoulDungeonModel>(); } } bool autoGenerate = false; #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Close.onClick.AddListener(CloseClick); m_Cancel.onClick.AddListener(CloseClick); m_Confirm.onClick.AddListener(Confirm); } protected override void OnPreOpen() { model.missionHelpUpdate += MissionHelpUpdate; m_AutoGenerate.isOn = model.mission.isAuto == 1; Display(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.missionHelpUpdate -= MissionHelpUpdate; } protected override void OnAfterClose() { } #endregion void Display() { DisplayLabel(); } void DisplayLabel() { var mission = model.mission; if (mission.hasRefreshBoss == 1) { m_Label.text = Language.Get("GatherSoulAreadyGenerateBoss"); } else { m_Label.text = Language.Get("GatherSoulGenerateBoss", model.generateBossCost); } } private void Confirm() { var mission=model.mission; if (mission.hasRefreshBoss == 1) { if (m_AutoGenerate.isOn == (mission.isAuto == 1)) { CloseClick(); } else { if (m_AutoGenerate.isOn) { var weelCount = model.dungeonWeelCount - mission.wheel; ConfirmCost(weelCount); } else { CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 2; pak.ActionInfo = 2; GameNetSystem.Instance.SendInfo(pak); CloseClick(); } } } else { var weelCount = m_AutoGenerate.isOn ? (model.dungeonWeelCount - mission.wheel + 1) : 1; ConfirmCost(weelCount); } } void ConfirmCost(int weelCount) { var cost = weelCount * model.generateBossCost; if (weelCount == 0) { CloseClick(); return; } if (UIHelper.GetMoneyCnt(2) >= (ulong)cost) { CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 2; pak.ActionInfo = m_AutoGenerate.isOn ? (uint)1 : 0; GameNetSystem.Instance.SendInfo(pak); CloseClick(); } else if (UIHelper.GetMoneyCnt(1) + UIHelper.GetMoneyCnt(2) >= (ulong)cost) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("GenerateBossCostConfirm", cost, UIHelper.GetMoneyCnt(2), (ulong)cost - UIHelper.GetMoneyCnt(2)), (bool isOk) => { if (isOk) { CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction(); pak.ActionType = 2; pak.ActionInfo = m_AutoGenerate.isOn ? (uint)1 : 0; GameNetSystem.Instance.SendInfo(pak); CloseClick(); } }); } else { CloseClick(); WindowCenter.Instance.Open<RechargeTipWin>(); } } private void MissionHelpUpdate() { DisplayLabel(); } } } System/GatheringSoul/GatherSoulGenerateBossWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 33b1f88fffc871e4aa3cc623c54a9068 timeCreated: 1545113722 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulHoleBehaviour.cs
New file @@ -0,0 +1,189 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulHoleBehaviour : MonoBehaviour { [SerializeField] int hole; [SerializeField] RectTransform m_ContainreItem; [SerializeField] RectTransform m_ContainerEquipSign; [SerializeField] RectTransform m_ContainerLock; [SerializeField] RectTransform m_ContaienrRedpoint; [SerializeField] Image m_Icon; [SerializeField] Text m_ItemName; [SerializeField] Text m_Level; [SerializeField] Text m_Condition; [SerializeField] Button m_Func; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } GatherSoulComposeModel composeModel { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } private void Awake() { m_Func.onClick.AddListener(OnFunc); } public void Display() { model.gatherSoulHoleRefresh -= GatherSoulHoleRefresh; model.gatherSoulHoleRefresh += GatherSoulHoleRefresh; RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent; RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent; DisplayBase(); DisplayRedpoint(); } void DisplayBase() { bool unlockHole = model.IsHoleUnlock(hole); GatherSoulItem item; bool equiped = model.TryGetItem(hole, out item); m_ContainreItem.gameObject.SetActive(equiped); m_ContainerLock.gameObject.SetActive(!unlockHole); m_ContainerEquipSign.gameObject.SetActive(!equiped && unlockHole); if (equiped) { var config = Config.Instance.Get<ItemConfig>(item.id); m_Icon.SetSprite(config.IconKey); m_ItemName.text = config.ItemName; m_Level.text = item.level.ToString(); m_ItemName.color = UIHelper.GetUIColor(config.ItemColor); } if (!unlockHole) { DisplayCondition(); } } void DisplayCondition() { GatherSoulHoleCondition condition; if (model.TryGetHoleCondition(hole, out condition)) { m_Condition.text = Language.Get("GatherSoulHoleOpenCondition", condition.level); } } private void OnFunc() { if (!model.IsHoleUnlock(hole)) { GatherSoulHoleCondition condition; if (model.TryGetHoleCondition(hole, out condition)) { SysNotifyMgr.Instance.ShowTip("GatherSoulHoleOpenCondition", condition.level); } } else { GatherSoulItem item; if (model.TryGetItem(hole, out item)) { var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>(); var data = new ItemAttrData(item.id); data.SetGatherSoul(item.level, hole); GatherSoulComposeModel.Compose compose; bool requireCompose = composeModel.ExistInComposeMat(item.id, out compose); if (requireCompose) { data.SetTipsFuncBtn(ItemWinBtnType.compose, OnTipFunc); } if (!model.IsGatherSoulMaxLevel(item.id, item.level)) { data.SetTipsFuncBtn(ItemWinBtnType.LevelUp, OnTipFunc); } data.SetTipsFuncBtn(ItemWinBtnType.putOff, OnTipFunc); itemTipsModel.SetItemTipsModel(data); } else { if (!model.ContainsEquipSoul(hole)) { SysNotifyMgr.Instance.ShowTip("NoneSoulSatisfyEquip"); } else { GatherSoulEquipListWin.selectHole = hole; WindowCenter.Instance.Open<GatherSoulEquipListWin>(); } } } } private void RedpointValueChangeEvent(int id) { if (id == model.equipRedpoint.id || id == model.levelUpRedpoint.id) { DisplayRedpoint(); } } void DisplayRedpoint() { bool requireRedpoint = (model.equipRedpoint.state == RedPointState.Simple && model.equipRedpointHole == hole) || (model.levelUpRedpoint.state == RedPointState.Simple && model.levelUpRedpointHole == hole); m_ContaienrRedpoint.gameObject.SetActive(requireRedpoint); } private void OnTipFunc(ItemWinBtnType funcType, string arg2) { switch (funcType) { case ItemWinBtnType.compose: { GatherSoulItem item; if (model.TryGetItem(hole, out item)) { model.HandleSoulTipFunc(funcType, item); } } break; case ItemWinBtnType.putOff: { WindowCenter.Instance.CloseImmediately<GatherSoulTipWin>(); GatherSoulItem item; if (model.TryGetItem(hole, out item)) { model.ExecutePutOffSoul(item); } } break; case ItemWinBtnType.LevelUp: WindowCenter.Instance.CloseImmediately<GatherSoulTipWin>(); GatherSoulLevelUpWin.selectHole = hole; WindowCenter.Instance.Open<GatherSoulLevelUpWin>(); break; } } private void GatherSoulHoleRefresh(int hole) { if (this.hole == hole) { DisplayBase(); } } public void Dispose() { model.gatherSoulHoleRefresh -= GatherSoulHoleRefresh; RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent; } } } System/GatheringSoul/GatherSoulHoleBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: baaa5e43cf5435e46b6b38f9ad1af70f timeCreated: 1544435816 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulItemBehaviour.cs
New file @@ -0,0 +1,207 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulItemBehaviour : MonoBehaviour { [SerializeField] RectTransform m_ContainerItem; [SerializeField] Image m_Icon; [SerializeField] RectTransform m_ContainerLevel; [SerializeField] Text m_Level; [SerializeField] Text m_ItemName; [SerializeField] Text m_Count; [SerializeField] Button m_Func; [SerializeField] RectTransform m_Select; VirtualPackModel model { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } GatherSoulComposeModel composeModel { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } GatheringSoulModel soulModel { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } VirtualItem displayItem; private void Awake() { if (m_Func != null) { m_Func.onClick.AddListener(OnFunc); } } /// <summary> /// 背包位置索引 /// </summary> /// <param name="packType"></param> /// <param name="index"></param> public void Display(int index) { displayItem = default(VirtualItem); GatherSoulItem item; bool exist = model.TryGetItem(PackType.rptGatherSoul, index, out item) && index != -1; m_ContainerItem.gameObject.SetActive(exist); if (exist) { displayItem = new VirtualItem() { packType = PackType.rptGatherSoul, index = index, itemId = item.id, level = item.level, }; Display(); } } public void Display(int id, int level) { if (id == 0) { m_ContainerItem.gameObject.SetActive(false); return; } displayItem = new VirtualItem() { packType = (PackType)0, itemId = id, level = level, }; m_ContainerItem.gameObject.SetActive(true); Display(); } void Display() { var config = Config.Instance.Get<ItemConfig>(displayItem.itemId); if (config != null) { m_Icon.SetSprite(config.IconKey); if (m_ContainerLevel != null) { m_ContainerLevel.gameObject.SetActive(config.Type != GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE); } if (m_Level != null) { m_Level.text = displayItem.level.ToString(); } if (m_ItemName != null) { m_ItemName.text = config.ItemName; m_ItemName.color = UIHelper.GetUIColor(config.ItemColor); } } DisplayEffect(); } public void DisplayCount(int count, int requireCount = 0) { if (m_Count != null) { if (requireCount == 0) { m_Count.text = count.ToString(); m_Count.color = UIHelper.GetUIColor(TextColType.LightYellow); } else { m_Count.text = StringUtility.Contact( UIHelper.AppendStringColor(count >= requireCount ? TextColType.LightYellow : TextColType.Red, count.ToString()) , "/", requireCount.ToString()); } } } void DisplayEffect() { if (m_Select != null) { m_Select.gameObject.SetActive(displayItem.packType == PackType.rptGatherSoul && soulModel.replaceRedpoint.state == RedPointState.Simple && soulModel.replaceRedpointIndex == displayItem.index); } } void OnFunc() { var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>(); if (displayItem.packType == PackType.rptGatherSoul) { GatherSoulItem item; if (model.TryGetItem(displayItem.packType, displayItem.index, out item)) { var data = new ItemAttrData(item.id); data.SetGatherSoul(item.level, -1, PackType.rptGatherSoul, displayItem.index); if (item.itemType != GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE) { GatherSoulComposeModel.Compose outCompose; bool requireCompose = composeModel.ExistInComposeMat(item.id, out outCompose); if (requireCompose) { data.SetTipsFuncBtn(ItemWinBtnType.compose, OnTipFunc); } if (soulModel.IsSamePropertyCompareHoles(-1, item as GatherSoulItem) == -1) { data.SetTipsFuncBtn(ItemWinBtnType.Wear, OnTipFunc); } else { data.SetTipsFuncBtn(ItemWinBtnType.Replace, OnTipFunc); } GatherSoulComposeModel.Compose compose; if (composeModel.TryGetCompose(item.id, out compose) && compose.requireItems.Count > 0) { data.SetTipsFuncBtn(ItemWinBtnType.split, OnTipFunc); } else { data.SetTipsFuncBtn(ItemWinBtnType.Resolve, OnTipFunc); } } itemTipsModel.SetItemTipsModel(data); } } else { if (displayItem.itemId != 0) { var data = new ItemAttrData(displayItem.itemId); data.SetGatherSoul(displayItem.level, -1); itemTipsModel.SetItemTipsModel(data); } } } private void OnTipFunc(ItemWinBtnType type, string arg2) { if (displayItem.Equals(default(VirtualItem))) { WindowCenter.Instance.Close<GatherSoulTipWin>(); return; } GatherSoulItem item; if (!model.TryGetItem(displayItem.packType, displayItem.index, out item)) { WindowCenter.Instance.Close<GatherSoulTipWin>(); return; } soulModel.HandleSoulTipFunc(type, item); } } } System/GatheringSoul/GatherSoulItemBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 3aa1e94817187c94da52e6556a277f8e timeCreated: 1544444761 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulLevelUpWin.cs
New file @@ -0,0 +1,176 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, December 12, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulLevelUpWin : Window { [SerializeField] Text m_ItemName; [SerializeField] Text m_Level; [SerializeField] Image m_Icon; [SerializeField] PropertyBehaviour[] m_Propertys; [SerializeField] Image[] m_Arrows; [SerializeField] Text m_LevelUpCost; [SerializeField] Button m_LevelUp; [SerializeField] Button m_Close; [SerializeField] RectTransform m_ContainerHighest; [SerializeField] RectTransform m_ContainerLevelUp; public static int selectHole = 0; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Close.onClick.AddListener(CloseClick); m_LevelUp.onClick.AddListener(LevelUp); } protected override void OnPreOpen() { Display(); PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent; model.gatherSoulHoleRefresh += GatherSoulHoleRefresh; } protected override void OnAfterOpen() { } protected override void OnPreClose() { PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent; model.gatherSoulHoleRefresh -= GatherSoulHoleRefresh; } protected override void OnAfterClose() { } #endregion void Display() { DisplayBase(); DisplayCost(); DisplayProperty(); } void DisplayBase() { GatherSoulItem item; if (model.TryGetItem(selectHole, out item)) { var itemConfig = Config.Instance.Get<ItemConfig>(item.id); m_ItemName.text = itemConfig.ItemName; m_ItemName.color = UIHelper.GetUIColor(itemConfig.ItemColor); m_Level.text = Language.Get("Z1024", item.level); m_Icon.SetSprite(itemConfig.IconKey); } } void DisplayProperty() { GatherSoulItem item; if (model.TryGetItem(selectHole, out item) && model.gatherSoulPropertys.ContainsKey(item.id)) { bool isMaxLevle = model.IsGatherSoulMaxLevel(item.id, item.level); var list = model.gatherSoulPropertys[item.id]; for (int i = 0; i < m_Propertys.Length; i++) { m_Propertys[i].gameObject.SetActive(i < list.Count); if (i < list.Count) { var valueNow = model.GetPropertyValue(item.id, list[i], item.level); var valueNext = isMaxLevle ? 0 : model.GetPropertyValue(item.id, list[i], item.level + 1); m_Propertys[i].DisplayUp(list[i], valueNow, valueNext); } } for (int i = 0; i < m_Arrows.Length; i++) { m_Arrows[i].gameObject.SetActive(!isMaxLevle); } } } void DisplayCost() { GatherSoulItem item; if (model.TryGetItem(selectHole, out item)) { var levelUpCost = model.RequireLevelUpCost(item); var soulDust = UIHelper.GetMoneyCnt(28); var satisfy = soulDust >= (ulong)levelUpCost; m_LevelUpCost.text = StringUtility.Contact( UIHelper.AppendStringColor(satisfy ? TextColType.NavyBrown : TextColType.Red, soulDust.ToString()) , "/", levelUpCost); bool isMaxLevle = model.IsGatherSoulMaxLevel(item.id, item.level); m_ContainerLevelUp.gameObject.SetActive(!isMaxLevle); m_ContainerHighest.gameObject.SetActive(isMaxLevle); } } private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType) { if (refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulDust) { DisplayCost(); } } private void GatherSoulHoleRefresh(int hole) { if (hole == selectHole) { GatherSoulItem item; if (!model.TryGetItem(hole, out item)) { CloseImmediately(); return; } Display(); } } private void LevelUp() { GatherSoulItem item; if (model.TryGetItem(selectHole, out item)) { var error = 0; if (!model.SatisfyLevelUp(item, out error)) { model.DisplayLevelUpError(error); } else { CA518_tagCMGatherSoulUp pak = new CA518_tagCMGatherSoulUp(); pak.PlaceType = (byte)item.placeType; pak.PlaceIndex = (ushort)item.index; GameNetSystem.Instance.SendInfo(pak); } } } } } System/GatheringSoul/GatherSoulLevelUpWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4b99e3df44c20ab4f84912f435cb6b79 timeCreated: 1544598482 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulMatItem.cs
New file @@ -0,0 +1,76 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulMatItem : MonoBehaviour { [SerializeField] RectTransform m_Container; [SerializeField] Image m_ItemBottom; [SerializeField] Image m_Icon; [SerializeField] Text m_ItemName; [SerializeField] Text m_Count; [SerializeField] Button m_Func; private void Awake() { m_Func.AddListener(OnFunc); } int moneyType = 0; int require = 0; public void Display(int moneyType, int require = 0) { this.moneyType = moneyType; this.require = require; Display(); } public void Display() { m_Container.gameObject.SetActive(true); m_Icon.SetIconWithMoneyType(moneyType); var count = UIHelper.GetMoneyCnt(moneyType); var displayId = GeneralDefine.moneyDisplayIds.ContainsKey(moneyType) ? GeneralDefine.moneyDisplayIds[moneyType] : 0; if (require == 0) { m_Count.text = count.ToString(); m_Count.color = UIHelper.GetUIColor(TextColType.LightYellow); } else { m_Count.text = StringUtility.Contact( UIHelper.AppendStringColor(count >= (ulong)require ? TextColType.LightYellow : TextColType.Red, count.ToString()) , "/", require.ToString()); } if (displayId != 0) { var config = Config.Instance.Get<ItemConfig>(displayId); m_ItemName.text = config.ItemName; m_ItemBottom.SetItemBackGround(config.ItemColor); } } public void DisplayEmpty() { m_Container.gameObject.SetActive(false); } private void OnFunc() { var itemPathModel = ModelCenter.Instance.GetModel<GetItemPathModel>(); var displayId = GeneralDefine.moneyDisplayIds.ContainsKey(moneyType) ? GeneralDefine.moneyDisplayIds[moneyType] : 0; if (displayId != 0) { itemPathModel.SetChinItemModel(displayId); } } } } System/GatheringSoul/GatherSoulMatItem.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: ec9553f2e2fc8ba4c839df0790c598c6 timeCreated: 1544753302 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulPackCell.cs
New file @@ -0,0 +1,33 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Snxxz.UI { public class GatherSoulPackCell : CellView { [SerializeField] GatherSoulItemBehaviour[] m_GatherSoulItems; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public void Display(int line) { for (int i = 0; i < m_GatherSoulItems.Length; i++) { var index = line * m_GatherSoulItems.Length + i; if (index < model.packIndexs.Count) { m_GatherSoulItems[i].Display(model.packIndexs[index]); } else { m_GatherSoulItems[i].Display(-1); } } } } } System/GatheringSoul/GatherSoulPackCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 419511038954612439afab131b3c1d7e timeCreated: 1544445160 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulResolveCell.cs
New file @@ -0,0 +1,20 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Snxxz.UI { public class GatherSoulResolveCell : CellView { [SerializeField] GatherSoulResolveItem[] m_Items; public void Display(int line) { for (int i = 0; i < m_Items.Length; i++) { var index = line * m_Items.Length + i; m_Items[i].Display(index); } } } } System/GatheringSoul/GatherSoulResolveCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: ed16e194b5ccbcc4a95170eb9251c000 timeCreated: 1544687267 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulResolveItem.cs
New file @@ -0,0 +1,58 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulResolveItem : MonoBehaviour { [SerializeField] RectTransform m_Container; [SerializeField] Image m_Icon; [SerializeField] RectTransform m_ContainerLevel; [SerializeField] Text m_Level; [SerializeField] Button m_Func; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } int index = -1; private void Awake() { m_Func.AddListener(OnFunc); } public void Display(int index) { this.index = index; var item = index < model.resolveItems.Count ? model.resolveItems[index] : null; bool exist = item != null; m_Container.gameObject.SetActive(exist); if (exist) { var itemConfig = Config.Instance.Get<ItemConfig>(item.id); m_Icon.SetSprite(itemConfig.IconKey); m_ContainerLevel.gameObject.SetActive(itemConfig.Type != GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE); m_Level.text = item.level.ToString(); } } private void OnFunc() { if (index != -1 && index < model.resolveItems.Count) { if (model.resolveItems[index] == null) { return; } model.RemoveOneKeyResolve(index); } } } } System/GatheringSoul/GatherSoulResolveItem.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 0a3cd588173781140877d18cbf7d3814 timeCreated: 1544687539 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulResolveWin.cs
New file @@ -0,0 +1,254 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, December 13, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System.Linq; namespace Snxxz.UI { public class GatherSoulResolveWin : Window { [SerializeField] int m_LineCount = 6; [SerializeField] ScrollerController m_ScrollerControl; [SerializeField] Toggle m_AutoResolveToggle; [SerializeField] Button m_OpenQualitySort; [SerializeField] Image m_Arrow; [SerializeField] ClickScreenOtherSpace m_ClickSpace; [SerializeField] SortTable m_QualitySort; [SerializeField] Text m_Quality; [SerializeField] Text m_SoulDust; [SerializeField] Button m_Resolve; [SerializeField] Button m_Close; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } VirtualPackModel virtualPack { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } int selectQuality = 2; bool qualitySortOpen = false; #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Close.onClick.AddListener(CloseClick); m_Resolve.onClick.AddListener(Resolve); m_OpenQualitySort.onClick.AddListener(OpenQualitySort); m_ScrollerControl.OnRefreshCell += OnRefreshCell; m_ScrollerControl.lockType = EnhanceLockType.KeepVertical; } protected override void OnPreOpen() { model.resolveItems.Clear(); m_QualitySort.gameObject.SetActive(false); qualitySortOpen = false; m_Arrow.transform.localEulerAngles = new Vector3(0, 0, 180); selectQuality = GetDefaultQuality(); m_QualitySort.SetDefault(); m_Quality.text = Language.Get(StringUtility.Contact("GatherSoulResolve_", selectQuality)); m_Quality.color = UIHelper.GetUIColor(selectQuality); Display(); PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent; model.gatherSoulPackRefresh += GatherSoulPackRefresh; m_QualitySort.onSelectSortEvent += OnSelectSort; model.oneKeyResolveRefresh += OneKeyResolveRefresh; m_ScrollerControl.JumpIndex(0); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.autoResolve = m_AutoResolveToggle.isOn; model.resolveItems.Clear(); PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent; model.gatherSoulPackRefresh -= GatherSoulPackRefresh; m_QualitySort.onSelectSortEvent -= OnSelectSort; model.oneKeyResolveRefresh -= OneKeyResolveRefresh; } protected override void OnAfterClose() { } protected override void LateUpdate() { if (qualitySortOpen != m_QualitySort.gameObject.activeSelf) { qualitySortOpen = m_QualitySort.gameObject.activeSelf; QualitySortRefresh(); } } #endregion int GetDefaultQuality() { for (int i = 2; i < 5; i++) { model.GetResolveSouls(i, model.resolveItems); if (model.resolveItems.Count > 0) { return i; } } return 2; } private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType) { if (refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulDust) { DisplayResolveSoulDust(); } } private void OnRefreshCell(ScrollerDataType type, CellView cell) { var resolveCell = cell as GatherSoulResolveCell; resolveCell.Display(cell.index); } private void OnSelectSort(SortType type, int sort) { if (type == SortType.EquipQuality) { selectQuality = sort; Display(); m_Quality.color = UIHelper.GetUIColor(selectQuality); } } private void QualitySortRefresh() { m_Arrow.transform.localEulerAngles = qualitySortOpen ? Vector3.zero : new Vector3(0, 0, 180); } private void OneKeyResolveRefresh() { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); DisplayResolveSoulDust(); } private void Display() { DisplayResolveItems(); DisplayResolveSoulDust(); } private void GatherSoulPackRefresh() { bool change = false; for (int i = 0; i < model.resolveItems.Count; i++) { if (model.resolveItems[i] == null) { continue; } if (!model.CheckExist(model.resolveItems[i])) { change = true; model.resolveItems[i] = null; } } if (change) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } } void DisplayResolveItems() { model.GetResolveSouls(selectQuality, model.resolveItems); model.resolveItems.Sort(model.CommonSort2); if (m_ScrollerControl.GetNumberOfCells(m_ScrollerControl.m_Scorller) == 0) { var count = virtualPack.GetPackCapacity(PackType.rptGatherSoul); var line = Mathf.CeilToInt((float)count / m_LineCount); m_ScrollerControl.Refresh(); for (int i = 0; i < line; i++) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i); } m_ScrollerControl.Restart(); } else { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } } void DisplayResolveSoulDust() { var result = 0; for (int i = 0; i < model.resolveItems.Count; i++) { if (model.resolveItems[i] == null) { continue; } result += model.GetResolveReturnCost(model.resolveItems[i].id, model.resolveItems[i].level); } var soulDust = UIHelper.ReplaceLargeNum(UIHelper.GetMoneyCnt(28)); m_SoulDust.text = StringUtility.Contact(soulDust, "+", UIHelper.AppendStringColor(TextColType.DarkGreen, UIHelper.ReplaceLargeNum(result))); } private void OpenQualitySort() { if (!m_QualitySort.gameObject.activeSelf) { m_QualitySort.gameObject.SetActive(true); } } private void Resolve() { if (model.resolveItems.Count == 0) { return; } List<ushort> list = new List<ushort>(); for (int i = 0; i < model.resolveItems.Count; i++) { if (model.CheckExist(model.resolveItems[i])) { list.Add((ushort)model.resolveItems[i].index); } } var page = Mathf.CeilToInt((float)list.Count / 50); for (int i = 0; i < page; i++) { ushort[] resolves = list.Skip(i * 50).Take((i < page - 1) ? 50 : (list.Count - i * 50)).ToArray(); model.SendResolvePack(resolves, false); } } } } System/GatheringSoul/GatherSoulResolveWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 7e7a17bdf294d834cb182edd7aa6bc65 timeCreated: 1544680762 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulResultItemCell.cs
New file @@ -0,0 +1,31 @@ using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulResultItemCell : CellView { [SerializeField] GatherSoulItemBehaviour m_Item; [SerializeField] UIEffect m_QualityEffect; public void Display(int id, int count) { var itemConfig = Config.Instance.Get<ItemConfig>(id); m_Item.Display(id, 1); m_Item.DisplayCount(count); m_QualityEffect.StopImediatly(); var effectId = itemConfig.ItemColor == 3 ? 1136 : itemConfig.ItemColor == 4 ? 1137 : itemConfig.ItemColor == 5 ? 1138 : 0; if (effectId > 0) { m_QualityEffect.effect = effectId; m_QualityEffect.Play(); } } } } System/GatheringSoul/GatherSoulResultItemCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 55ce6abdb7493954b83e30e6c19fc661 timeCreated: 1545120309 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulTipBase.cs
New file @@ -0,0 +1,45 @@ using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulTipBase : MonoBehaviour { [SerializeField] Text m_ItemName; [SerializeField] RectTransform m_ContainerEssence; [SerializeField] RectTransform m_ContainerSoul; [SerializeField] RectTransform m_ContainerItem; [SerializeField] Image m_ItemIcon; [SerializeField] Text m_ItemLevel; [SerializeField] Text m_EquipPlaceName; [SerializeField] Text m_Level; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public void Display(int id, int level) { var itemConfig = Config.Instance.Get<ItemConfig>(id); m_ItemName.text = itemConfig.ItemName; m_ItemName.color = UIHelper.GetUIColor(itemConfig.ItemColor); m_ItemIcon.SetSprite(itemConfig.IconKey); bool isSoulEssence = itemConfig.Type == GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE; m_ContainerSoul.gameObject.SetActive(!isSoulEssence); m_ContainerEssence.gameObject.SetActive(isSoulEssence); m_ItemLevel.gameObject.SetActive(!isSoulEssence); if (!isSoulEssence) { m_ItemLevel.text = level.ToString(); m_EquipPlaceName.text = GatheringSoulModel.GetEquipHoleName(id); m_Level.text = level.ToString(); } } } } System/GatheringSoul/GatherSoulTipBase.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: f1c145236d204b2429fa1ffac55116b6 timeCreated: 1544582149 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulTipProperty.cs
New file @@ -0,0 +1,45 @@ using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulTipProperty : MonoBehaviour, IGatherSoulTipScrollPart { [SerializeField] PropertyBehaviour[] m_Propertys; [SerializeField] RectTransform m_ContainerNone; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public void Display(int id, int level) { var itemConfig = Config.Instance.Get<ItemConfig>(id); bool isSoulEssence = itemConfig.Type == GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE; m_ContainerNone.gameObject.SetActive(isSoulEssence); List<int> list = null; if (!isSoulEssence) { list = model.gatherSoulPropertys[id]; } for (int i = 0; i < m_Propertys.Length; i++) { m_Propertys[i].gameObject.SetActive(list != null && i < list.Count); if (list != null && i < list.Count) { var propertyValue = model.GetPropertyValue(id, list[i], level); m_Propertys[i].DisplayUpper(list[i], propertyValue); } } } public float GetHeight() { return (this.transform as RectTransform).sizeDelta.y; } } } System/GatheringSoul/GatherSoulTipProperty.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: b539a1732f759d4469694120224738a9 timeCreated: 1544534605 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulTipResolve.cs
New file @@ -0,0 +1,59 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulTipResolve : MonoBehaviour, IGatherSoulTipScrollPart { [SerializeField] Text m_Title; [SerializeField] RectTransform m_ContainerSoulDust; [SerializeField] Text m_SoulDust; [SerializeField] RectTransform m_ContainerSoulSplinters; [SerializeField] Text m_SoulSplinters; [SerializeField] RectTransform m_ContainerSoulCore; [SerializeField] Text m_SoulCore; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } GatherSoulComposeModel composeModel { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } public void Display(int id, int level) { GatherSoulComposeModel.Compose compose; var requireSoulSplinters = 0; var requireSoulCore = 0; if (composeModel.TryGetCompose(id, out compose)) { m_Title.text = Language.Get("GatherSoulTipResolve_1"); requireSoulSplinters = compose.requireSoulSplinters; requireSoulCore = compose.requireSoulCore; } else { m_Title.text = Language.Get("GatherSoulTipResolve_2"); } m_ContainerSoulDust.gameObject.SetActive(level > 1 || compose == null); m_SoulDust.text = StringUtility.Contact("+", model.GetResolveReturnCost(id, level, compose != null)); m_ContainerSoulSplinters.gameObject.SetActive(requireSoulSplinters > 0); m_SoulSplinters.text = StringUtility.Contact("+", requireSoulSplinters); m_ContainerSoulCore.gameObject.SetActive(requireSoulCore > 0); m_SoulCore.text = StringUtility.Contact("+", requireSoulCore); } public float GetHeight() { return (this.transform as RectTransform).sizeDelta.y; } } } System/GatheringSoul/GatherSoulTipResolve.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 794a49903d6af9541869fa812657b9f4 timeCreated: 1544582960 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulTipWin.cs
New file @@ -0,0 +1,173 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, December 11, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulTipWin : Window { [SerializeField] CanvasGroup m_CanvaGroup; [SerializeField] Image m_EquipedSign; [SerializeField] GatherSoulTipBase m_Base; [SerializeField] ScrollRect m_Scroller; [SerializeField] LayoutElement m_ScrollerLayout; [SerializeField] VerticalLayoutGroup m_ContentLayout; [SerializeField] GatherSoulTipProperty m_Property; [SerializeField] GatherSoulTipResolve m_Resolve; [SerializeField] RectTransform m_ContainerGetWay; [SerializeField] Button[] m_Funcs; [SerializeField] Text[] m_FuncBtnDisplays; [SerializeField] RectTransform[] m_Redpoints; [SerializeField] Text m_GetWay; [SerializeField] Button m_Close; [SerializeField] Vector2 m_ScrollerHeight = new Vector2(180, 260); ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Close.onClick.AddListener(CloseClick); } protected override void OnPreOpen() { DisplayEquipedSign(); Display(); DisplayGetWay(); DisplayFuncs(); m_CanvaGroup.alpha = 0; m_Scroller.verticalNormalizedPosition = 1; } protected override void OnActived() { base.OnActived(); transform.SetAsLastSibling(); StartCoroutine(Co_GetHeight()); } protected override void OnAfterOpen() { } protected override void OnPreClose() { StopAllCoroutines(); } protected override void OnAfterClose() { } #endregion IEnumerator Co_GetHeight() { yield return null; yield return null; var height = m_Property.GetHeight(); height += m_Resolve.GetHeight(); height += m_ContentLayout.padding.top; height += m_ContentLayout.padding.bottom; height += m_ContentLayout.spacing * 1; height = Mathf.Clamp(height, m_ScrollerHeight.x, m_ScrollerHeight.y); m_ScrollerLayout.preferredHeight = height; yield return null; m_CanvaGroup.alpha = 1; } void DisplayEquipedSign() { m_EquipedSign.gameObject.SetActive(itemTipsModel.curAttrData.equipHole != -1); } void Display() { var id = itemTipsModel.curAttrData.itemId; var level = itemTipsModel.curAttrData.level; m_Base.Display(id, level); m_Property.Display(id, level); m_Resolve.Display(id, level); } void DisplayGetWay() { var config = itemTipsModel.curAttrData.itemConfig; m_ContainerGetWay.gameObject.SetActive(config != null && !string.IsNullOrEmpty(config.Description)); if (config != null && !string.IsNullOrEmpty(config.Description)) { m_GetWay.text = config.Description; } } void DisplayFuncs() { var dict = itemTipsModel.curAttrData.tipsFuncBtnDic; var index = 0; foreach (var type in dict.Keys) { var callBackType = type; if (index < m_Funcs.Length) { m_Funcs[index].gameObject.SetActive(true); m_Funcs[index].RemoveAllListeners(); m_Funcs[index].AddListener(() => { if (dict != null && dict.ContainsKey(callBackType)) { if (dict[callBackType] != null) { dict[callBackType](callBackType, string.Empty); } } }); m_FuncBtnDisplays[index].text = Language.Get(StringUtility.Contact("ItemHandle_", callBackType)); m_Redpoints[index].gameObject.SetActive(false); if (callBackType == ItemWinBtnType.LevelUp) { m_Redpoints[index].gameObject.SetActive(model.levelUpRedpoint.state == RedPointState.Simple && model.levelUpRedpointHole == itemTipsModel.curAttrData.equipHole); } else if (callBackType == ItemWinBtnType.Replace) { m_Redpoints[index].gameObject.SetActive(model.replaceRedpoint.state == RedPointState.Simple && itemTipsModel.curAttrData.index == model.replaceRedpointIndex); } } index++; } for (int i = index; i < m_Funcs.Length; i++) { m_Funcs[i].gameObject.SetActive(false); } } } } System/GatheringSoul/GatherSoulTipWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: e8006390bb0a6ae4f807e6aec3d52345 timeCreated: 1544534158 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulTotalPropertyWin.cs
New file @@ -0,0 +1,149 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, December 12, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GatherSoulTotalPropertyWin : Window { [SerializeField] RectTransform m_Content; [SerializeField] PropertyBehaviour[] m_Propertys; List<PropertyBehaviour> m_ClonePropertys = new List<PropertyBehaviour>(); GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } Dictionary<int, int> displayPropertyDict = new Dictionary<int, int>(); List<int> propertySorts = new List<int>(); #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { model.gatherSoulHolesRefresh += GatherSoulHoleRefresh; DisplayProperty(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.gatherSoulHolesRefresh -= GatherSoulHoleRefresh; } protected override void OnAfterClose() { } #endregion void DisplayProperty() { var count = model.holeCount; propertySorts.Clear(); displayPropertyDict.Clear(); for (int i = 0; i < count; i++) { GatherSoulItem item; if (model.TryGetItem(i, out item)) { var list = model.gatherSoulPropertys[item.id]; for (int k = 0; k < list.Count; k++) { displayPropertyDict.Add(list[k], model.GetPropertyValue(item.id, list[k], item.level)); propertySorts.Add(list[k]); } } } propertySorts.Sort(Compare); CheckPropertyBehaviour(); var index = 0; for (int i = 0; i < propertySorts.Count; i++) { if (index < m_Propertys.Length) { m_Propertys[index].gameObject.SetActive(true); m_Propertys[index].DisplayUpper(propertySorts[i], displayPropertyDict[propertySorts[i]]); } else if (index < m_ClonePropertys.Count) { m_ClonePropertys[index].gameObject.SetActive(true); m_ClonePropertys[index].DisplayUpper(propertySorts[i], displayPropertyDict[propertySorts[i]]); } index++; } for (int i = index; i < m_Propertys.Length; i++) { m_Propertys[i].gameObject.SetActive(false); } index = Mathf.Max(0, index - m_Propertys.Length); for (int i = index; i < m_ClonePropertys.Count; i++) { m_ClonePropertys[i].gameObject.SetActive(false); } } void CheckPropertyBehaviour() { if (m_Propertys.Length + m_ClonePropertys.Count >= propertySorts.Count) { return; } else { var behaviour = GameObject.Instantiate(m_Propertys[0]); if (behaviour != null) { behaviour.transform.SetParent(m_Content); behaviour.transform.localPosition = Vector3.zero; behaviour.transform.localEulerAngles = Vector3.zero; behaviour.transform.localScale = Vector3.one; m_ClonePropertys.Add(behaviour); } } } int Compare(int lhs, int rhs) { var lhsConfig = Config.Instance.Get<GatherSoulPropertyConfig>(lhs); var rhsConfig = Config.Instance.Get<GatherSoulPropertyConfig>(rhs); if (lhsConfig.sort != rhsConfig.sort) { return -lhsConfig.sort.CompareTo(rhsConfig.sort); } return 0; } private void GatherSoulHoleRefresh() { DisplayProperty(); } } } System/GatheringSoul/GatherSoulTotalPropertyWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: dccd8cf646882de4b8c795c5a5a00d4b timeCreated: 1544602191 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatherSoulWin.cs
New file @@ -0,0 +1,191 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, December 10, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class GatherSoulWin : Window { [SerializeField] int m_PackLineCount = 5; [SerializeField] GatherSoulHoleBehaviour[] m_GatherSoulHoles; [SerializeField] ScrollerController m_ScrollerControl; [SerializeField] Text m_SoulDust; [SerializeField] Text m_SoulSplinters; [SerializeField] Text m_SoulCore; [SerializeField] Button m_GetSoul; [SerializeField] Button m_GotoCompose; [SerializeField] Button m_Resolve; [SerializeField] Button m_ViewProperty; [SerializeField] Image m_DustIcon; [SerializeField] Image m_SplintersIcon; [SerializeField] Image m_CoreIcon; VirtualPackModel virtualPack { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_GetSoul.onClick.AddListener(GetSoul); m_GotoCompose.onClick.AddListener(GotoCompose); m_Resolve.onClick.AddListener(Resolve); m_ViewProperty.onClick.AddListener(ViewProperty); UIEventTrigger.Get(m_DustIcon.gameObject).OnDown = (GameObject go) => { ViewMoneyType(GatheringSoulModel.SOULDUST_MONEYTYPE, m_DustIcon.transform as RectTransform); }; UIEventTrigger.Get(m_SplintersIcon.gameObject).OnDown = (GameObject go) => { ViewMoneyType(GatheringSoulModel.SOULSPLINTERS_MONEYTYPE, m_SplintersIcon.transform as RectTransform); }; UIEventTrigger.Get(m_CoreIcon.gameObject).OnDown = (GameObject go) => { ViewMoneyType(GatheringSoulModel.SOULCORE_MONEYTYPE, m_CoreIcon.transform as RectTransform); }; m_ScrollerControl.OnRefreshCell += OnRefreshCell; } protected override void OnPreOpen() { for (int i = 0; i < m_GatherSoulHoles.Length; i++) { m_GatherSoulHoles[i].Display(); } Display(); PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent; model.gatherSoulPackRefresh += GatherSoulPackRefresh; } protected override void OnAfterOpen() { } protected override void OnPreClose() { for (int i = 0; i < m_GatherSoulHoles.Length; i++) { m_GatherSoulHoles[i].Dispose(); } PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent; model.gatherSoulPackRefresh -= GatherSoulPackRefresh; } protected override void OnAfterClose() { } #endregion void Display() { DisplayPackSouls(); DisplaySoulCost(); } void DisplayPackSouls() { if (m_ScrollerControl.GetNumberOfCells(m_ScrollerControl.m_Scorller) == 0) { m_ScrollerControl.Refresh(); var capacity = virtualPack.GetPackCapacity(PackType.rptGatherSoul); var line = Mathf.CeilToInt((float)capacity / m_PackLineCount); for (int i = 0; i < line; i++) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i); } m_ScrollerControl.Restart(); } else { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } } void DisplaySoulCost() { m_SoulDust.text = UIHelper.ReplaceLargeNum(UIHelper.GetMoneyCnt(28)); m_SoulSplinters.text = UIHelper.ReplaceLargeNum(UIHelper.GetMoneyCnt(29)); m_SoulCore.text = UIHelper.ReplaceLargeNum(UIHelper.GetMoneyCnt(30)); } private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType) { if (refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulDust || refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulSplinters || refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulCore) { DisplaySoulCost(); } } private void OnRefreshCell(ScrollerDataType type, CellView cell) { var packCell = cell as GatherSoulPackCell; packCell.Display(cell.index); } private void GatherSoulPackRefresh() { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } private void ViewProperty() { if (WindowCenter.Instance.IsOpen<GatherSoulTotalPropertyWin>()) { WindowCenter.Instance.Close<GatherSoulTotalPropertyWin>(); } else { WindowCenter.Instance.Open<GatherSoulTotalPropertyWin>(); } } private void GetSoul() { } private void GotoCompose() { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.GatherSoul271); } private void Resolve() { WindowCenter.Instance.Open<GatherSoulResolveWin>(); } void ViewMoneyType(int moneyType, RectTransform rect) { SystemMoneyRemindWin.moneyType = moneyType; var position = rect.TransformPoint(Vector3.zero); SystemMoneyRemindWin.position = position; WindowCenter.Instance.Open<SystemMoneyRemindWin>(true); } } } System/GatheringSoul/GatherSoulWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: e736a7034bdc6a14ead7302294aa13e8 timeCreated: 1544435400 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatheringSoulModel.cs
New file @@ -0,0 +1,1571 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using TableConfig; using UnityEngine; namespace Snxxz.UI { [XLua.LuaCallCSharp] [XLua.Hotfix] public class GatheringSoulModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { Dictionary<int, GatherSoulItem> gatherSoulHoleDict = new Dictionary<int, GatherSoulItem>(); Dictionary<int, GatherSoulHoleCondition> holeConditions = new Dictionary<int, GatherSoulHoleCondition>(); Dictionary<int, int> holeItemTypeDict; Dictionary<int, int> qualityMaxLevelDict; Dictionary<int, int> propertySortDict = new Dictionary<int, int>(); Dictionary<int, float> qualityResolveCostDict; public Dictionary<int, List<int>> gatherSoulPropertys { get; private set; } public List<int> packIndexs { get; private set; } public List<GatherSoulItem> resolveItems { get; private set; } public int holeCount { get { return holeItemTypeDict.Count; } } public bool autoResolve { get { return QuickSetting.Instance.GetQuickSettingBool(QuickSetting.QuickSettingType.GatherSoulAutoResolve, 0, false); } set { var now = QuickSetting.Instance.GetQuickSettingBool(QuickSetting.QuickSettingType.GatherSoulAutoResolve, 0, false); if (value != now) { QuickSetting.Instance.SetQuickSetting(QuickSetting.QuickSettingType.GatherSoulAutoResolve, value); } } } public int coreHole { get; private set; } public int autoResolveRemainCount { get; private set; } public event Action<int> gatherSoulHoleRefresh; public event Action gatherSoulHolesRefresh; public event Action gatherSoulPackRefresh; public const int GATHERSOUL_SOUL_TYPE = 62; public const int GATHERSOUL_CORE_TYPE = 63; public const int GATHERSOUL_ESSENCE_TYPE = 61; public const int SOULDUST_MONEYTYPE = 28; public const int SOULSPLINTERS_MONEYTYPE = 29; public const int SOULCORE_MONEYTYPE = 30; const int GATHERSOUL_REDPOINT_BASE = 10102; const int GATHERSOUL_REDPOINT_DEEP = 1010200; static int redpointIndex = 5; public readonly Redpoint redpoint = new Redpoint(101, GATHERSOUL_REDPOINT_BASE); public readonly Redpoint equipRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010201); public readonly Redpoint replaceRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010202); public readonly Redpoint resolveRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010203); public readonly Redpoint levelUpRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010204); static readonly IComparer<int> soulPackSort = new GatherSoulPackSort(); static readonly IEqualityComparer<int> holeItemTypeDistinct = new HoleItemTypeDistinct(); VirtualPackModel virtualPack { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } GatherSoulComposeModel composeModel { get { return ModelCenter.Instance.GetModel<GatherSoulComposeModel>(); } } public override void Init() { ParseConfig(); packIndexs = new List<int>(); resolveItems = new List<GatherSoulItem>(); virtualPack.virtualPackRefresh += VirtualPackRefresh; PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent; FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; } public void OnBeforePlayerDataInitialize() { packIndexs.Clear(); gatherSoulHoleDict.Clear(); } public void OnPlayerLoginOk() { CheckAutoResolve(); UpdateRedpoint(); } public override void UnInit() { virtualPack.virtualPackRefresh -= VirtualPackRefresh; PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent; FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; } private void OnFuncStateChangeEvent(int id) { if (id == 155) { UpdateRedpoint(); } } private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType) { if (refreshType == PlayerDataRefresh.CDBPlayerRefresh_SoulDust) { UpdateRedpoint(); } } void ParseConfig() { var funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulHole"); if (funcConfig != null) { var dict = ConfigParse.GetDic<int, int>(funcConfig.Numerical1); foreach (var hole in dict.Keys) { holeConditions.Add(hole, new GatherSoulHoleCondition() { level = dict[hole], }); } holeItemTypeDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical2); foreach (var hole in holeItemTypeDict.Keys) { if (holeItemTypeDict[hole] == GATHERSOUL_CORE_TYPE) { coreHole = hole; } } } funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulMaxLevel"); if (funcConfig != null) { qualityMaxLevelDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical1); } funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulLevelUp"); if (funcConfig != null) { levelUpCostFormula = funcConfig.Numerical1; qualityCostModulus = ConfigParse.GetDic<int, float>(funcConfig.Numerical2); multiPropertyModulus = ConfigParse.GetDic<int, float>(funcConfig.Numerical3); qualityResolveCostDict = ConfigParse.GetDic<int, float>(funcConfig.Numerical4); soulStageModulusDict = ConfigParse.GetDic<int, float>(funcConfig.Numerical5); } funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulAutoResolve"); if (funcConfig != null) { autoResolveRemainCount = int.Parse(funcConfig.Numerical1); } var gatherSoulPropertyConfigs = Config.Instance.GetAllValues<GatherSoulPropertyConfig>(); for (int i = 0; i < gatherSoulPropertyConfigs.Count; i++) { var config = gatherSoulPropertyConfigs[i]; propertyComputeDict.Add(config.AttrType, new PropertyCompute(config)); propertySortDict.Add(config.AttrType, config.sort); } var gatherSoulConfigs = Config.Instance.GetAllValues<GatherSoulConfig>(); gatherSoulPropertys = new Dictionary<int, List<int>>(); for (int i = 0; i < gatherSoulConfigs.Count; i++) { var config = gatherSoulConfigs[i]; gatherSoulPropertys.Add(config.ID, new List<int>()); gatherSoulPropertys[config.ID].AddRange(config.AttrType); } } public static string GetEquipHoleName(int id) { var itemConfig = Config.Instance.Get<ItemConfig>(id); return Language.Get(StringUtility.Contact("GatherSoulHoleName_", itemConfig.Type)); } public int GetPropertyHighestSort(List<int> list) { var sort = -1; for (int i = 0; i < list.Count; i++) { if (propertySortDict.ContainsKey(list[i]) && propertySortDict[list[i]] > sort) { sort = propertySortDict[list[i]]; } } return sort; } private void VirtualPackRefresh(PackType packType) { if (packType == PackType.rptGatherSoul) { RefreshGatherSoulPack(); CheckAutoResolve(); UpdateRedpoint(); } } public void RefreshGatherSoulPack() { packIndexs.Clear(); List<int> emptyHoles; if (ExistEmptyHole(out emptyHoles)) { emptyHoles = emptyHoles.Distinct(holeItemTypeDistinct).ToList(); SelectBestEquipSoul(emptyHoles); } else { SelectBestReplaceSoul(); } packIndexs.Sort(CommonSort); var existCount = packIndexs.Count; List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { for (int i = 0; i < list.Count; i++) { if (!packIndexs.Contains(list[i])) { packIndexs.Add(list[i]); } } } packIndexs.Sort(existCount, packIndexs.Count - existCount, soulPackSort); if (gatherSoulPackRefresh != null) { gatherSoulPackRefresh(); } } void SelectBestEquipSoul(List<int> holes) { List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { var error = 0; for (int k = 0; k < holes.Count; k++) { var hole = holes[k]; for (int i = 0; i < list.Count; i++) { GatherSoulItem item; if (virtualPack.TryGetItem(PackType.rptGatherSoul, list[i], out item)) { if (SatisfyEquipSoul(item, hole, out error)) { if (!packIndexs.Contains(list[i])) { packIndexs.Add(list[i]); } } } } } } JustSelectBest(); } void SelectBestReplaceSoul() { List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { for (int i = 0; i < list.Count; i++) { GatherSoulItem packItem; if (virtualPack.TryGetItem(PackType.rptGatherSoul, list[i], out packItem)) { var hole = 0; if (SatisfyReplace(packItem, out hole)) { GatherSoulItem item; if (TryGetItem(hole, out item) && packItem.Compare(item) == 1) { if (!packIndexs.Contains(list[i])) { packIndexs.Add(list[i]); } } } } } } JustSelectBest(); } void JustSelectBest() { List<int> removeList = new List<int>(); for (int i = 0; i < packIndexs.Count; i++) { if (removeList.Contains(i)) { continue; } GatherSoulItem item; virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[i], out item); for (int k = i + 1; k < packIndexs.Count; k++) { if (removeList.Contains(k)) { continue; } GatherSoulItem compareItem; virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[k], out compareItem); int compare = item.Compare(compareItem); if (item.ExistSameProperty(compareItem.id)) { if(compare == 1 || compare == 0) { removeList.Add(k); } else { removeList.Add(i); break; } } } } removeList.Sort(); for (int i = removeList.Count - 1; i >= 0; i--) { packIndexs.RemoveAt(removeList[i]); } } public bool ExistEmptyHole(out List<int> list) { var count = holeCount; list = new List<int>(); for (int i = 0; i < count; i++) { if (!IsHoleUnlock(i)) { continue; } GatherSoulItem item; if (!TryGetItem(i, out item)) { list.Add(i); } } return list.Count > 0; } public bool ExistEmptyHole() { var count = holeCount; for (int i = 0; i < count; i++) { if (!IsHoleUnlock(i)) { continue; } GatherSoulItem item; if (!TryGetItem(i, out item)) { return true; } } return false; } public void OnReceiveServerPack(HA31E_tagMCGatherSoulHoleInfo package) { gatherSoulHoleDict.Clear(); for (int i = 0; i < package.Count; i++) { var data = package.GatherSoulDataList[i]; if (data != 0) { var item = new GatherSoulItem(); item.ParseHoleItem(i, data, 1); gatherSoulHoleDict.Add(i, item); } if (gatherSoulHoleRefresh != null) { gatherSoulHoleRefresh(i); } } if (gatherSoulHolesRefresh != null) { gatherSoulHolesRefresh(); } RefreshGatherSoulPack(); UpdateRedpoint(); } public bool ContainsEquipSoul(int hole) { List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { int error = 0; for (int i = 0; i < list.Count; i++) { GatherSoulItem item; if (virtualPack.TryGetItem(PackType.rptGatherSoul, list[i], out item)) { if (SatisfyEquipSoul(item, hole, out error)) { return true; } } } } return false; } public void TryGetSatisfyEquipSouls(int hole, ref List<GatherSoulItem> equipList) { equipList.Clear(); List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { var error = 0; for (int i = 0; i < list.Count; i++) { GatherSoulItem item; if (virtualPack.TryGetItem(PackType.rptGatherSoul, list[i], out item)) { if (SatisfyEquipSoul(item, hole, out error)) { equipList.Add(item); } } } } } public bool IsHoleUnlock(int hole) { GatherSoulItem item; if (TryGetItem(hole, out item)) { return true; } GatherSoulHoleCondition condition; if (TryGetHoleCondition(hole, out condition)) { return PlayerDatas.Instance.baseData.LV >= condition.level; } return true; } public bool SatisfyEquipSoul(GatherSoulItem item, int hole, out int error) { error = 0; if (item.placeType != 0) { return false; } var itemConfig = Config.Instance.Get<ItemConfig>(item.id); if (!IsHoleUnlock(hole)) { error = 1; return false; } if (holeItemTypeDict.ContainsKey(hole)) { if (holeItemTypeDict[hole] != itemConfig.Type) { error = 2; return false; } } bool samePropertyCompareHole = false; GatherSoulItem holeItem; if (TryGetItem(hole, out holeItem)) { if (item.ExistSameProperty(holeItem.id)) { samePropertyCompareHole = true; } } if (!samePropertyCompareHole && IsSamePropertyCompareHoles(hole, item) != -1) { error = 3; return false; } return true; } public bool SatisfyReplace(GatherSoulItem item, out int hole) { var count = holeCount; hole = 0; for (int i = 0; i < count; i++) { GatherSoulItem holeItem; if (TryGetItem(i, out holeItem)) { if (item.gatherSoulType == holeItem.gatherSoulType && item.ExistSameProperty(holeItem.id)) { hole = i; return true; } } } return false; } public bool SatisfyReplace(int hole, GatherSoulItem item) { GatherSoulItem holeItem; if (TryGetItem(hole, out holeItem)) { if (item.itemType == holeItem.itemType && item.ExistSameProperty(holeItem.id)) { return true; } } return false; } public bool SatisfyLevelUp(GatherSoulItem item, out int error) { error = 0; if (IsGatherSoulMaxLevel(item.id, item.level)) { error = 1; return false; } if ((ulong)RequireLevelUpCost(item) > UIHelper.GetMoneyCnt(28)) { error = 2; return false; } return true; } public void DisplayLevelUpError(int error) { switch (error) { case 1: SysNotifyMgr.Instance.ShowTip("GatherSoulLevelError_1"); break; case 2: SysNotifyMgr.Instance.ShowTip("GatherSoulLevelError_2"); break; } } public int IsSamePropertyCompareHoles(int exclude, GatherSoulItem item) { var count = holeCount; for (int i = 0; i < count; i++) { if (i == exclude) { continue; } if (IsSamePropertyCompareHole(i, item)) { return i; } } return -1; } public bool IsSamePropertyCompareHole(int hole, GatherSoulItem item) { GatherSoulItem compare; if (TryGetItem(hole, out compare)) { return item.ExistSameProperty(compare.id); } return false; } public bool IsGatherSoulMaxLevel(int id, int level) { var config = Config.Instance.Get<ItemConfig>(id); if (qualityMaxLevelDict != null && qualityMaxLevelDict.ContainsKey(config.ItemColor)) { return qualityMaxLevelDict[config.ItemColor] <= level; } return true; } public bool IsBestSoul(GatherSoulItem item, int excludePlaceType, int excludeIndex) { var count = holeCount; for (int i = 0; i < count; i++) { GatherSoulItem compare; if (TryGetItem(i, out compare)) { if (compare.placeType == excludePlaceType && compare.index == excludeIndex) { continue; } if (!item.ExistSameProperty(compare.id) || item.Compare(compare) != 1) { return false; } } } List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { GatherSoulItem packItem; for (int i = 0; i < list.Count; i++) { if (virtualPack.TryGetItem(PackType.rptGatherSoul, list[i], out packItem)) { var compare = packItem; if (compare.placeType == excludePlaceType && compare.index == excludeIndex) { continue; } if (!item.ExistSameProperty(compare.id) || item.Compare(compare) != 1) { return false; } } } } return true; } public void HandleSoulTipFunc(ItemWinBtnType type, GatherSoulItem item) { switch (type) { case ItemWinBtnType.compose: if (!FuncOpen.Instance.IsFuncOpen(158)) { FuncOpen.Instance.ProcessorFuncErrorTip(158); return; } WindowCenter.Instance.Close<GatherSoulTipWin>(); composeModel.jumpGatherSoulItem = new VirtualItem() { packType = item.placeType == 0 ? PackType.rptGatherSoul : PackType.rptInterimPack, index = item.index, itemId = item.id, level = item.level }; WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.GatherSoul271); break; case ItemWinBtnType.split: case ItemWinBtnType.Resolve: if (IsBestSoul(item, item.placeType, item.index)) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("BestGatherSoulResolveConfirm"), (bool isOk) => { if (isOk) { ExecuteResolve(item); } }); } else { ExecuteResolve(item); } break; case ItemWinBtnType.Wear: List<int> emptyHoles; bool existEmptyHole = false; if (ExistEmptyHole(out emptyHoles)) { if (item.itemType == GATHERSOUL_CORE_TYPE && emptyHoles.Contains(coreHole)) { existEmptyHole = true; } else if (item.itemType == GATHERSOUL_SOUL_TYPE) { existEmptyHole = emptyHoles.Count > 1 || emptyHoles[0] != coreHole; } } if (existEmptyHole) { WindowCenter.Instance.Close<GatherSoulTipWin>(); ExecuteEquipSoul(item); } else { SysNotifyMgr.Instance.ShowTip("NoneOfAnyEmptySoulHole"); } break; case ItemWinBtnType.Replace: WindowCenter.Instance.Close<GatherSoulTipWin>(); ExecuteReplaceSoul(item); break; } } public void ExecuteResolve(GatherSoulItem item) { GatherSoulComposeModel.Compose compose; if (composeModel.TryGetCompose(item.id, out compose)) { var config = Config.Instance.Get<ItemConfig>(item.id); var baseName = config.ItemName; var sb = new StringBuilder(); for (int i = 0; i < compose.requireItems.Count; i++) { var itemId = compose.requireItems[i]; config = Config.Instance.Get<ItemConfig>(itemId); sb.Append(config.ItemName); if (i < compose.requireItems.Count - 2) { sb.Append("、"); } else if (i == compose.requireItems.Count - 2) { sb.Append(Language.Get("GatherSoulAnd")); } } var requireSoulCore = 0; var requireSoulSplinters = 0; var soulDust = GetResolveReturnCost(item.id, item.level, true); if (composeModel.TryGetCompose(item.id, out compose)) { requireSoulCore = compose.requireSoulCore; requireSoulSplinters = compose.requireSoulSplinters; } ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("MultiGatherSoulResolveConfirm", baseName, sb.ToString(), requireSoulCore, requireSoulSplinters, soulDust), (bool isOk) => { if (isOk) { WindowCenter.Instance.Close<GatherSoulTipWin>(); SendResolvePack(item); } }); } else { WindowCenter.Instance.Close<GatherSoulTipWin>(); SendResolvePack(item); } } public void SendResolvePack(GatherSoulItem item) { if (!CheckExist(item)) { return; } SendResolvePack(new ushort[1] { (ushort)item.index }, false); } public void ExecuteEquipSoul(GatherSoulItem item) { var error = 0; List<int> list; if (ExistEmptyHole(out list)) { for (int i = 0; i < list.Count; i++) { if (SatisfyEquipSoul(item, list[i], out error)) { SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, list[i]); return; } } } } public void ExecuteEquipSoul(GatherSoulItem item, int hole) { var error = 0; if (SatisfyEquipSoul(item, hole, out error)) { SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, hole); } } public void ExecuteReplaceSoul(GatherSoulItem item) { var error = 0; var count = holeCount; var tryEquipHole = -1; for (int i = 0; i < count; i++) { if (SatisfyEquipSoul(item, i, out error)) { tryEquipHole = i; break; } } if (tryEquipHole != -1) { GatherSoulItem holeItem; if (TryGetItem(tryEquipHole, out holeItem)) { var sameHole = -1; if (gatherSoulPropertys[item.id].Count > gatherSoulPropertys[holeItem.id].Count) { sameHole = IsSamePropertyCompareHoles(tryEquipHole, item); } if (sameHole != -1) { SendEquipPack((int)PackType.rptInterimPack, sameHole, (int)PackType.rptGatherSoul, 0); } SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, tryEquipHole); } } } public void ExecutePutOffSoul(GatherSoulItem item) { if (item.placeType == 1) { if (virtualPack.GetPackRemainCount(PackType.rptGatherSoul) < 1) { SysNotifyMgr.Instance.ShowTip("GeRen_chenxin_676165"); return; } SendEquipPack((int)PackType.rptInterimPack, item.index, (int)PackType.rptGatherSoul, 0); } } public void SendResolvePack(ushort[] resolves, bool isAuto) { CA519_tagCMGatherSoulDecompose pak = new CA519_tagCMGatherSoulDecompose(); pak.IsAuto = isAuto ? (byte)1 : (byte)0; pak.PlaceIndexList = resolves; pak.Count = (byte)resolves.Length; GameNetSystem.Instance.SendInfo(pak); } void SendEquipPack(int srcpackType, int scrIndex, int destpackType, int destIndex) { C073D_tagCPackItemExchange pak = new C073D_tagCPackItemExchange(); pak.SrcBackpack = (byte)srcpackType; pak.SrcIndex = (ushort)scrIndex; pak.DesBackPack = (byte)destpackType; pak.DestIndex = (ushort)destIndex; GameNetSystem.Instance.SendInfo(pak); } public bool CheckExist(GatherSoulItem item) { bool same = false; if (item.placeType == 0) { GatherSoulItem compare; same = virtualPack.TryGetItem(PackType.rptGatherSoul, item.index, out compare) && item.IsEqual(compare); } else if (item.placeType == 1) { GatherSoulItem compare; same = TryGetItem(item.index, out compare) && item.IsEqual(compare); } return same; } public bool CheckExist(VirtualItem item) { if (item.packType == PackType.rptGatherSoul) { GatherSoulItem compare; if (virtualPack.TryGetItem(PackType.rptGatherSoul, item.index, out compare)) { return item.itemId == compare.id && item.level == compare.level; } } else if (item.packType == PackType.rptInterimPack) { GatherSoulItem compare; if (TryGetItem(item.index, out compare)) { return item.itemId == compare.id && item.level == compare.level; } } return false; } public bool TryGetHoleCondition(int hole, out GatherSoulHoleCondition condition) { return holeConditions.TryGetValue(hole, out condition); } public bool TryGetItem(int hole, out GatherSoulItem item) { return gatherSoulHoleDict.TryGetValue(hole, out item); } public bool TryGetHighestLevelItem(int itemId, out GatherSoulItem item) { item = null; foreach (var soulItem in gatherSoulHoleDict.Values) { if (soulItem.id == itemId && (item == null || soulItem.level > item.level)) { item = soulItem; } } List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { GatherSoulItem packItem; for (int i = 0; i < list.Count; i++) { if (virtualPack.TryGetItem(PackType.rptGatherSoul, list[i], out packItem)) { if (packItem.id == itemId && (item == null || packItem.level > item.level)) { item = packItem; } } } } return item != null; } public bool TryGetSinglePropertyItems(int property, out int itemId) { itemId = 0; foreach (var key in gatherSoulPropertys.Keys) { if (gatherSoulPropertys[key].Count == 1 && gatherSoulPropertys[key][0] == property) { itemId = key; return true; } } return false; } public int CommonSort(GatherSoulItem lhs, GatherSoulItem rhs) { var lhsPropertyCount = gatherSoulPropertys[lhs.id].Count; var rhsPropertyCount = gatherSoulPropertys[rhs.id].Count; if (lhsPropertyCount != rhsPropertyCount) { return -lhsPropertyCount.CompareTo(rhsPropertyCount); } var lhsConfig = Config.Instance.Get<ItemConfig>(lhs.id); var rhsConfig = Config.Instance.Get<ItemConfig>(rhs.id); if (lhsConfig.ItemColor != rhsConfig.ItemColor) { return -lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor); } var lhsPropertys = gatherSoulPropertys[lhs.id]; var rhsPropertys = gatherSoulPropertys[rhs.id]; var lhsPropertySort = GetPropertyHighestSort(lhsPropertys); var rhsPropertySort = GetPropertyHighestSort(rhsPropertys); if (lhsPropertySort != rhsPropertySort) { return -lhsPropertySort.CompareTo(rhsPropertySort); } return 0; } public int CommonSort(int lhs, int rhs) { GatherSoulItem lhsItem; GatherSoulItem rhsItem; if (!virtualPack.TryGetItem(PackType.rptGatherSoul, lhs, out lhsItem) || !virtualPack.TryGetItem(PackType.rptGatherSoul, rhs, out rhsItem)) { return 0; } return CommonSort(lhsItem, rhsItem); } public int CommonSort2(GatherSoulItem lhs, GatherSoulItem rhs) { if (lhs.gatherSoulType != rhs.gatherSoulType) { return lhs.gatherSoulType.CompareTo(rhs.gatherSoulType); } if (lhs.gatherSoulType != GatherSoulType.Essence && rhs.gatherSoulType != GatherSoulType.Essence) { var lhsPropertys = gatherSoulPropertys[lhs.id]; var rhsPropertys = gatherSoulPropertys[rhs.id]; if (lhsPropertys.Count != rhsPropertys.Count) { return -lhsPropertys.Count.CompareTo(rhsPropertys.Count); } } var lhsConfig = Config.Instance.Get<ItemConfig>(lhs.id); var rhsConfig = Config.Instance.Get<ItemConfig>(rhs.id); if (null == lhsConfig || null == rhsConfig) { return 0; } if (lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor) != 0) { return -lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor); } if (lhs.gatherSoulType != GatherSoulType.Essence && rhs.gatherSoulType != GatherSoulType.Essence) { var lhsPropertys = gatherSoulPropertys[lhs.id]; var rhsPropertys = gatherSoulPropertys[rhs.id]; var lhsPropertySort = GetPropertyHighestSort(lhsPropertys); var rhsPropertySort = GetPropertyHighestSort(rhsPropertys); if (lhsPropertySort != rhsPropertySort) { return -lhsPropertySort.CompareTo(rhsPropertySort); } } if (lhs.level.CompareTo(rhs.level) != 0) { return -lhs.level.CompareTo(rhs.level); } return 0; } #region 属性值计算 Dictionary<int, PropertyCompute> propertyComputeDict = new Dictionary<int, PropertyCompute>(); public class PropertyCompute { string formula = string.Empty; Dictionary<int, float> qualityModulusDict; Dictionary<int, float> multiPropertyModulusDict; Dictionary<int, int> qualityBaseProperty; Dictionary<int, float> cacheFormulaResult; Dictionary<int, float> soulStageModulusDict; public PropertyCompute(GatherSoulPropertyConfig config) { formula = config.AttrInfo1; qualityModulusDict = ConfigParse.GetDic<int, float>(config.AttrInfo2); multiPropertyModulusDict = ConfigParse.GetDic<int, float>(config.AttrInfo3); qualityBaseProperty = ConfigParse.GetDic<int, int>(config.AttrInfo4); soulStageModulusDict = ConfigParse.GetDic<int, float>(config.AttrInfo5); cacheFormulaResult = new Dictionary<int, float>(); } public int GetPropertyValue(int id, int level) { var itemConfig = Config.Instance.Get<ItemConfig>(id); var gatherSoulConfig = Config.Instance.Get<GatherSoulConfig>(id); float result = 0; if (itemConfig != null) { var formulaResult = 0f; if (cacheFormulaResult.ContainsKey(level)) { formulaResult = cacheFormulaResult[level]; } if (!cacheFormulaResult.ContainsKey(level)) { Equation.Instance.Clear(); Equation.Instance.AddKeyValue("level", level); formulaResult = Equation.Instance.Eval<float>(formula); cacheFormulaResult.Add(level, formulaResult); } var quality = itemConfig.ItemColor; var propertyCount = 1; if (gatherSoulConfig != null) { propertyCount = gatherSoulConfig.AttrType.Length; } float qualityModulus = qualityModulusDict[quality]; var baseValue = 0; if (qualityBaseProperty.ContainsKey(quality)) { baseValue = qualityBaseProperty[quality]; } var stage = gatherSoulConfig.soulStage; float soulStageModulus = 1; if (soulStageModulusDict.ContainsKey(stage)) { soulStageModulus = soulStageModulusDict[stage]; } if (multiPropertyModulusDict.ContainsKey(propertyCount)) { var multiPropertyModulus = multiPropertyModulusDict[propertyCount]; result = (formulaResult * qualityModulus + baseValue) * soulStageModulus * multiPropertyModulus; } else { result = (formulaResult * qualityModulus + baseValue) * soulStageModulus; } } return Mathf.RoundToInt(result); } } public int GetPropertyValue(int id, int type, int level) { if (propertyComputeDict.ContainsKey(type)) { return propertyComputeDict[type].GetPropertyValue(id, level); } return 0; } #endregion #region 消耗计算 string levelUpCostFormula = string.Empty; Dictionary<int, float> levelUpFormulaCostDict = new Dictionary<int, float>(); Dictionary<int, float> qualityCostModulus; Dictionary<int, float> multiPropertyModulus; Dictionary<int, float> soulStageModulusDict; public int RequireLevelUpCost(GatherSoulItem item) { return RequireLevelUpCost(item.id, item.level); } public int RequireLevelUpCost(int id, int level) { var result = 0f; var itemConfig = Config.Instance.Get<ItemConfig>(id); var formulaResult = 0f; if (levelUpFormulaCostDict.ContainsKey(level + 1)) { formulaResult = levelUpFormulaCostDict[level + 1]; } else { Equation.Instance.Clear(); Equation.Instance.AddKeyValue("level", level + 1); formulaResult = Equation.Instance.Eval<float>(levelUpCostFormula); levelUpFormulaCostDict.Add(level + 1, formulaResult); } var propertyCount = gatherSoulPropertys.ContainsKey(id) ? gatherSoulPropertys[id].Count : 1; var stage = 0; var config = Config.Instance.Get<GatherSoulConfig>(id); if (config != null) { stage = config.soulStage; } var soulStageModulus = soulStageModulusDict != null && soulStageModulusDict.ContainsKey(stage) ? soulStageModulusDict[stage] : 1; if (multiPropertyModulus.ContainsKey(propertyCount)) { result = formulaResult * qualityCostModulus[itemConfig.ItemColor] * soulStageModulus * multiPropertyModulus[propertyCount]; } else { result = formulaResult * qualityCostModulus[itemConfig.ItemColor] * soulStageModulus; } return Mathf.RoundToInt(result); } public int GetLevelByCost(int id, ulong cost) { var config = Config.Instance.Get<ItemConfig>(id); var maxLevel = qualityMaxLevelDict[config.ItemColor]; ulong totalCost = 0; for (int i = 1; i < maxLevel; i++) { totalCost += (ulong)RequireLevelUpCost(id, i); if (cost < totalCost) { return i; } } return maxLevel; } #endregion #region 分解 public event Action oneKeyResolveRefresh; public int GetResolveReturnCost(int id, int level, bool fromCompose = false) { float result = 0; var itemConfig = Config.Instance.Get<ItemConfig>(id); if (itemConfig.Type == GATHERSOUL_ESSENCE_TYPE) { return itemConfig.EffectValueA1; } for (int i = 1; i <= level; i++) { if (i == 1) { if (!fromCompose) { var stage = 0; var config = Config.Instance.Get<GatherSoulConfig>(id); if (config != null) { stage = config.soulStage; } var soulStageModulus = soulStageModulusDict != null && soulStageModulusDict.ContainsKey(stage) ? soulStageModulusDict[stage] : 1; if (qualityResolveCostDict != null && qualityResolveCostDict.ContainsKey(itemConfig.ItemColor)) { result += qualityResolveCostDict[itemConfig.ItemColor] * soulStageModulus; } } } else { result += RequireLevelUpCost(id, i - 1); } } return (int)result; } public void GetResolveSouls(int quality, List<GatherSoulItem> list) { list.Clear(); Dictionary<int, int> dict = new Dictionary<int, int>(); var count = holeCount; for (int i = 0; i < count; i++) { GatherSoulItem item; if (TryGetItem(i, out item)) { SetPropertyQuality(item, ref dict); } } List<int> packlist; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out packlist)) { GatherSoulItem item; for (int i = 0; i < packlist.Count; i++) { if (virtualPack.TryGetItem(PackType.rptGatherSoul, packlist[i], out item)) { if (item.itemType == GATHERSOUL_ESSENCE_TYPE) { continue; } SetPropertyQuality(item, ref dict); } } } for (int i = 0; i < packlist.Count; i++) { GatherSoulItem item; if (virtualPack.TryGetItem(PackType.rptGatherSoul, packlist[i], out item)) { if (item.itemType == GATHERSOUL_ESSENCE_TYPE) { list.Add(item); continue; } var propertys = gatherSoulPropertys[item.id]; if (propertys.Count > 1) { continue; } var property = propertys[0]; var config = Config.Instance.Get<ItemConfig>(item.id); if (config.ItemColor <= quality && config.ItemColor < dict[property]) { list.Add(item); } } } } void SetPropertyQuality(GatherSoulItem item, ref Dictionary<int, int> dict) { var propertys = gatherSoulPropertys[item.id]; var itemConfig = Config.Instance.Get<ItemConfig>(item.id); for (int i = 0; i < propertys.Count; i++) { var property = propertys[i]; if (!dict.ContainsKey(property) || dict[property] < itemConfig.ItemColor) { dict[property] = itemConfig.ItemColor; } } } public void RemoveOneKeyResolve(int index) { if (index != -1 && index < resolveItems.Count) { resolveItems.RemoveAt(index); resolveItems.Insert(index, null); if (oneKeyResolveRefresh != null) { oneKeyResolveRefresh(); } } } List<GatherSoulItem> autoResolveList = new List<GatherSoulItem>(); void CheckAutoResolve() { if (!autoResolve) { return; } var capacity = virtualPack.GetPackCapacity(PackType.rptGatherSoul); List<int> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { if (capacity - list.Count > autoResolveRemainCount) { return; } autoResolveList.Clear(); GetResolveSouls(int.MaxValue, autoResolveList); List<ushort> resolveList = new List<ushort>(); for (int i = 0; i < autoResolveList.Count; i++) { resolveList.Add((ushort)autoResolveList[i].index); } var page = Mathf.CeilToInt((float)resolveList.Count / 50); for (int i = 0; i < page; i++) { ushort[] resolves = resolveList.Skip(i * 50).Take((i < page - 1) ? 50 : (resolveList.Count - i * 50)).ToArray(); SendResolvePack(resolves, true); } } } #endregion #region 红点 public int equipRedpointHole = 0; public int levelUpRedpointHole = 0; public int replaceRedpointIndex = 0; void UpdateRedpoint() { equipRedpoint.state = RedPointState.None; replaceRedpoint.state = RedPointState.None; resolveRedpoint.state = RedPointState.None; levelUpRedpoint.state = RedPointState.None; if (!FuncOpen.Instance.IsFuncOpen(155)) { return; } var error = 0; List<int> holes; if (ExistEmptyHole(out holes) && packIndexs.Count > 0) { GatherSoulItem item; if (virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[0], out item)) { for (int i = 0; i < holes.Count; i++) { if (SatisfyEquipSoul(item, holes[i], out error)) { equipRedpointHole = holes[i]; equipRedpoint.state = RedPointState.Simple; return; } } } } var count = holeCount; if (packIndexs.Count > 0) { GatherSoulItem item; virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[0], out item); for (int i = 0; i < count; i++) { GatherSoulItem holeItem; if (TryGetItem(i, out holeItem)) { if (SatisfyReplace(i, item) && item.Compare(holeItem) == 1) { replaceRedpointIndex = item.index; replaceRedpoint.state = RedPointState.Simple; return; } } } } List<GatherSoulItem> list = new List<GatherSoulItem>(); GetResolveSouls(int.MaxValue, list); if (list.Count > 0) { resolveRedpoint.state = RedPointState.Simple; list = null; return; } GatherSoulItem coreItem; if (TryGetItem(coreHole, out coreItem)) { if (SatisfyLevelUp(coreItem, out error)) { levelUpRedpointHole = coreHole; levelUpRedpoint.state = RedPointState.Simple; } } else { for (int i = 0; i < count; i++) { GatherSoulItem holeItem; if (TryGetItem(i, out holeItem)) { if (SatisfyLevelUp(holeItem, out error)) { levelUpRedpointHole = i; levelUpRedpoint.state = RedPointState.Simple; return; } } } } } #endregion public class HoleItemTypeDistinct : IEqualityComparer<int> { GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public bool Equals(int x, int y) { return model.holeItemTypeDict[x] == model.holeItemTypeDict[y]; } public int GetHashCode(int obj) { if (model.holeItemTypeDict.ContainsKey(obj)) { return model.holeItemTypeDict[obj].GetHashCode(); } return obj.GetHashCode(); } } } public class GatherSoulItem : VirtualPackItem { public GatherSoulType gatherSoulType; public int itemType { get; private set; } public int placeType { get; private set; }//0-背包 1-装备 GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public void ParseHoleItem(int index, uint data, int placeType) { ParsePackItem(index, data); this.placeType = placeType; } public override void ParsePackItem(int index, uint data) { base.ParsePackItem(index, data); var itemConfig = Config.Instance.Get<ItemConfig>(id); itemType = itemConfig.Type; if (itemType == GatheringSoulModel.GATHERSOUL_SOUL_TYPE) { gatherSoulType = GatherSoulType.Soul; } else if (itemType == GatheringSoulModel.GATHERSOUL_CORE_TYPE) { gatherSoulType = GatherSoulType.Core; } else if (itemType == GatheringSoulModel.GATHERSOUL_ESSENCE_TYPE) { gatherSoulType = GatherSoulType.Essence; } } public bool ExistSameProperty(int compareId) { var list = model.gatherSoulPropertys[id]; for (int i = 0; i < list.Count; i++) { var comparePropertys = model.gatherSoulPropertys[compareId]; if (comparePropertys.Contains(list[i])) { return true; } } return false; } public int Compare(GatherSoulItem compare) { var comparePropertyCount = model.gatherSoulPropertys[compare.id].Count; var propertyCount = model.gatherSoulPropertys[id].Count; if (comparePropertyCount != propertyCount) { return propertyCount > comparePropertyCount ? 1 : -1; } var compareConfig = Config.Instance.Get<ItemConfig>(compare.id); var config = Config.Instance.Get<ItemConfig>(id); if (compareConfig.ItemColor != config.ItemColor) { return config.ItemColor > compareConfig.ItemColor ? 1 : -1; } if (level != compare.level) { return level > compare.level ? 1 : -1; } return 0; } public bool IsEqual(GatherSoulItem compare) { return this.id == compare.id && this.index == compare.index && this.level == compare.level && this.placeType == compare.placeType; } } public enum GatherSoulType { Core, Soul, Essence, } public struct GatherSoulHoleCondition { public int level; } public interface IGatherSoulTipScrollPart { float GetHeight(); } public class GatherSoulPackSort : IComparer<int> { VirtualPackModel virtualPackModel { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } public int Compare(int lhs, int rhs) { GatherSoulItem lhsItem; GatherSoulItem rhsItem; if (!virtualPackModel.TryGetItem(PackType.rptGatherSoul, lhs, out lhsItem) || !virtualPackModel.TryGetItem(PackType.rptGatherSoul, rhs, out rhsItem)) { return 0; } return model.CommonSort2(lhsItem, rhsItem); } } } System/GatheringSoul/GatheringSoulModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4c4788a1dee13d343b3801d58293bd84 timeCreated: 1544420716 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/SystemMoneyRemindWin.cs
New file @@ -0,0 +1,79 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Friday, December 14, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class SystemMoneyRemindWin : Window { [SerializeField] RectTransform m_Container; [SerializeField] Text m_Remind; public static int moneyType = 0; public static Vector2 position = Vector3.zero; #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { Display(); } protected override void OnActived() { base.OnActived(); var localpos = transform.InverseTransformPoint(position); m_Container.localPosition = localpos; } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion protected override void LateUpdate() { base.LateUpdate(); if (!Input.GetMouseButton(0)) { if (WindowCenter.Instance.IsOpen<SystemMoneyRemindWin>()) { CloseImmediately(); } } } void Display() { m_Remind.text = Language.Get(StringUtility.Contact("MoneyTypeUseRemind_", moneyType)); } } } System/GatheringSoul/SystemMoneyRemindWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 77ec946bfa3aa1f429baca2680aae3b8 timeCreated: 1544772268 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/VirtualPackModel.cs
New file @@ -0,0 +1,207 @@ using System; using System.Collections; using System.Collections.Generic; using System.Text; using TableConfig; using UnityEngine; namespace Snxxz.UI { [XLua.LuaCallCSharp] [XLua.Hotfix] public class VirtualPackModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { Dictionary<PackType, List<VirtualPackItem>> virtualPackItems = new Dictionary<PackType, List<VirtualPackItem>>(); Dictionary<PackType, int> virtualPackCapacityDict = new Dictionary<PackType, int>(); public event Action<PackType> virtualPackRefresh; public override void Init() { ParseConfig(); } public void OnBeforePlayerDataInitialize() { virtualPackItems.Clear(); } public void OnPlayerLoginOk() { } public override void UnInit() { } void ParseConfig() { var funcConfig = Config.Instance.Get<FuncConfigConfig>("GatherSoulPackCount"); if (funcConfig != null) { virtualPackCapacityDict.Add(PackType.rptGatherSoul, int.Parse(funcConfig.Numerical1)); } } public int GetPackCapacity(PackType packType) { if (virtualPackCapacityDict.ContainsKey(packType)) { return virtualPackCapacityDict[packType]; } return 0; } public int GetPackRemainCount(PackType packType) { var capacity = GetPackCapacity(packType); if (virtualPackItems.ContainsKey(packType)) { return capacity - virtualPackItems[packType].Count; } return capacity; } public bool TryGetItems(PackType packType, out List<int> list) { list = new List<int>(); List<VirtualPackItem> _list; if (virtualPackItems.TryGetValue(packType, out _list)) { for (int i = 0; i < _list.Count; i++) { list.Add(_list[i].index); } return true; } return false; } public bool TryGetItem<T>(PackType packType, int packIndex, out T item) where T : VirtualPackItem { item = default(T); if (virtualPackItems.ContainsKey(packType)) { var _index = virtualPackItems[packType].FindIndex((x) => { return x.index == packIndex; }); if (_index != -1) { item = virtualPackItems[packType][_index] as T; } return _index != -1; } return false; } public void OnReceiveServerPack(HA204_tagMCVPackRefresh package) { var packType = (PackType)package.PackType; switch (packType) { case PackType.rptGatherSoul: break; default: return; } List<VirtualPackItem> list; if (!virtualPackItems.TryGetValue(packType, out list)) { list = new List<VirtualPackItem>(); virtualPackItems.Add(packType, list); } SetVirtualItem(packType, ref list, package.VPacklItemList); if (virtualPackRefresh != null) { virtualPackRefresh((PackType)package.PackType); } } public void OnReceiveServerPack(HA205_tagMCVPackClear package) { List<VirtualPackItem> list; if (virtualPackItems.TryGetValue((PackType)package.PackType, out list)) { for (int i = 0; i < package.Count; i++) { var index = package.ItemPlaceList[i]; list.RemoveAll((x) => { return x.index == index; }); } if (virtualPackRefresh != null) { virtualPackRefresh((PackType)package.PackType); } } } void SetVirtualItem(PackType packType, ref List<VirtualPackItem> list, HA204_tagMCVPackRefresh.tagMCVPackItem[] items) { for (int i = 0; i < items.Length; i++) { var item = list.Find((x) => { return x.index == items[i].ItemPlace; }); if (item != null) { list.Remove(item); item = null; } item = VirtualPackItem.Get(packType); list.Add(item); item.ParsePackItem(items[i].ItemPlace, items[i].ItemData); } } } public abstract class VirtualPackItem { public int index { get; private set; } public int id { get; private set; } public int level { get; private set; } protected string dataString { get; private set; } protected static StringBuilder sb = new StringBuilder(); public virtual void ParsePackItem(int index, uint data) { this.index = index; dataString = data.ToString(); int delta = 10 - dataString.Length; sb.Length = 0; sb.Append('0', delta); dataString = dataString.Insert(0, sb.ToString()); id = int.Parse(dataString.Substring(5, 5)); level = int.Parse(dataString.Substring(2, 3)) + 1; } public static VirtualPackItem Get(PackType packType) { switch (packType) { case PackType.rptGatherSoul: return new GatherSoulItem(); } return null; } } public struct VirtualItem { public PackType packType; public int itemId; public int index; public int level; } } System/GatheringSoul/VirtualPackModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 31921259156650748816297a77bb44a0 timeCreated: 1544421387 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GeneralConfig/GeneralDefine.cs
@@ -162,6 +162,8 @@ public static int medQualityHorseEffectCount { get; private set; } public static int highQualityHorseEffectCount { get; private set; } public static int GatherSoulDZ { get; private set; } public static int fairyLandBuffCondition { get; private set; } public static int fairyLandBuffId { get; private set; } public static int achievementEarlierStageLevel { get; private set; } @@ -552,12 +554,12 @@ lowQualityGuardCount = int.Parse(func.Numerical1); medQualityGuardCount = int.Parse(func.Numerical2); highQualityGuardCount = int.Parse(func.Numerical3); func = Config.Instance.Get<FuncConfigConfig>("QualityPetEffectCount"); lowQualityPetEffectCount = int.Parse(func.Numerical1); medQualityPetEffectCount = int.Parse(func.Numerical2); highQualityPetEffectCount = int.Parse(func.Numerical3); func = Config.Instance.Get<FuncConfigConfig>("QualityHorseEffectCount"); lowQualityHorseEffectCount = int.Parse(func.Numerical1); medQualityHorseEffectCount = int.Parse(func.Numerical2); @@ -638,6 +640,8 @@ } } GatherSoulDZ = GetInt("GatherSoulDZ"); if (SgzcRealm == null) { SgzcRealm = new Dictionary<int, int>(); System/HappyXB/HappyXBGetItemWin.cs
@@ -55,6 +55,7 @@ int manyMoney = 0; bool isHaveXBTool = false; bool isCostToolMany = false; XBGetItemConfig xbItemConfig = null; protected override void BindController() { @@ -136,10 +137,12 @@ private void InitUI() { xbItemConfig = XBModel.GetXBItemConfigByType((int)XBModel.title); CreateGetItem(); xbScoreText.text = XBModel.addXBScore.ToString(); for(int i = 0; i < xbItemlist.Count; i++) { var xbItem = xbItemlist[i]; int count = playerPack.GetItemCountByID(PackType.rptTreasure,xbItemlist[i].itemId); if(count > 0) { @@ -268,6 +271,29 @@ index += 1; ShowGetItemCtrl(index); }); var xbItem = xbItemlist[index]; bool isJump = false; switch(XBModel.title) { case HappXBTitle.Best: if(XBModel.isJumpBestXB) { isJump = true; } break; case HappXBTitle.Rune: if (XBModel.isJumpRuneXB) { isJump = true; } break; } if (isJump && xbItem.gridIndex == xbItemConfig.LuckyGridNum) { SoundPlayer.Instance.PlayUIAudio(67); } } } System/ItemDrop/DropItem.cs
@@ -4,9 +4,11 @@ using TableConfig; using UnityEngine.UI; using Snxxz.UI; using System; public class DropItem : HUDBehaviour { public static event Action<Vector3> onDropItemDisappear; public static DropItem Drop(int _id, Vector3 _position, Camera _camera) { @@ -132,9 +134,22 @@ if (autoPickUp && Time.time > dispearTime) { var dropTrace = DropItemPool.RequireDropItemTrace(); dropTrace.transform.position = this.transform.position; dropTrace.Trace(PlayerDatas.Instance.hero, new Vector3(0, 0.5f, 0), () => { DropItemPool.ReycleDropItemTrace(dropTrace); }); var mapId = PlayerDatas.Instance.baseData.MapID; var dataMapId = ModelCenter.Instance.GetModel<DungeonModel>().GetDataMapIdByMapId(mapId); switch (dataMapId) { case GatherSoulDungeonModel.DUNGEON_MAPID: if (onDropItemDisappear != null) { onDropItemDisappear(transform.position); } break; default: var dropTrace = DropItemPool.RequireDropItemTrace(); dropTrace.transform.position = this.transform.position; dropTrace.Trace(PlayerDatas.Instance.hero, new Vector3(0, 0.5f, 0), () => { DropItemPool.ReycleDropItemTrace(dropTrace); }); break; } DropItemPool.ReycleDropItem(this); RecyleEffect(); System/KnapSack/Logic/ItemTipsModel.cs
@@ -665,6 +665,9 @@ case ItemWinType.buyPetMatWin: WindowCenter.Instance.Open<BuyPetMatInfoWin>(); break; case ItemWinType.GatherSoul: WindowCenter.Instance.Open<GatherSoulTipWin>(); break; } } @@ -764,14 +767,36 @@ { if (attrData == null) return; var horseModel = ModelCenter.Instance.GetModel<PlayerMountDatas>(); var petmodel = ModelCenter.Instance.GetModel<PlayerPetDatas>(); bool isOverdue = modelInterface.IsOverdue(attrData.guid,attrData.itemId,attrData.useDataDict); switch(attrData.itemConfig.Type) HorseConfig horseConfig = null; PetInfoConfig petInfo = null; switch (attrData.itemConfig.Type) { case 26: petInfo = unlockPetDict[attrData.itemId]; if (petmodel._DicPetBack.ContainsKey(petInfo.ID)) { if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemWinBtnType.sell, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendSellQuest(ItemWinBtnType.sell, attrData); }); } } break; case 41: horseConfig = unlockMountDict[attrData.itemId]; if (horseModel._DicHorse.ContainsKey(horseConfig.HorseID)) { if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemWinBtnType.sell, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendSellQuest(ItemWinBtnType.sell, attrData); }); } } break; case 124: HorseConfig horseConfig = unlockMountDict[attrData.itemConfig.EffectValueA1]; var horseModel = ModelCenter.Instance.GetModel<PlayerMountDatas>(); if (horseModel._DicHorse.ContainsKey(horseConfig.HorseID) && attrData.isBind == 1) horseConfig = unlockMountDict[attrData.itemConfig.EffectValueA1]; if (horseModel._DicHorse.ContainsKey(horseConfig.HorseID)) { if (attrData.itemConfig.CanSell == 1) { @@ -780,9 +805,8 @@ } break; case 125: PetInfoConfig petInfo = unlockPetDict[attrData.itemConfig.EffectValueA1]; var petmodel = ModelCenter.Instance.GetModel<PlayerPetDatas>(); if (petmodel._DicPetBack.ContainsKey(petInfo.ID) && attrData.isBind == 1) petInfo = unlockPetDict[attrData.itemConfig.EffectValueA1]; if (petmodel._DicPetBack.ContainsKey(petInfo.ID)) { if (attrData.itemConfig.CanSell == 1) { @@ -2232,6 +2256,8 @@ public bool isPreview { get; private set; }//是否预览 public ItemConfig itemConfig { get; private set; } public bool isCustom { get; private set; } //是否是定制物品 public int level { get; private set; }//等级 public int equipHole { get; private set; }//聚魂孔 public ItemTipChildType ChildType { get; private set; } //决定当前面板打开哪个 public Dictionary<int, List<int>> useDataDict { get; private set;} public Dictionary<int, int> strengthDataDict { get; private set; } @@ -2305,6 +2331,8 @@ this.isCustom = false; this.extraInfos = null; isHavePutLimit = true; this.level = 1; this.equipHole = -1; this.isCustom = CheckIsCustomItem(); if(isCustom) { @@ -2873,6 +2901,13 @@ tipsFuncBtnDic.Add(type,func); } public void SetGatherSoul(int level, int equipHole, PackType packType = PackType.rptDeleted, int index = -1) { this.level = level; this.equipHole = equipHole; this.packType = packType; this.index = index; } /// <summary> /// 设置该物品的弹框类型 /// </summary> @@ -2926,6 +2961,9 @@ case "GuardPanel": winType = ItemWinType.guardWin; break; case "GatherSoul": winType = ItemWinType.GatherSoul; break; default: DebugEx.Log("没有此物品的弹框类型" + this.itemConfig.Template.Trim()); break; System/MainInterfacePanel/MainCollectBehaviour.cs
New file @@ -0,0 +1,86 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class MainCollectBehaviour : MonoBehaviour { [SerializeField] RectTransform m_ContainerNormalCollect; [SerializeField] Button m_NormalCollect; [SerializeField] Image m_NormalCollectIcon; [SerializeField] Text m_NormalCollectLabel; [SerializeField] GatherSoulBuildBehaviour m_GatherSoulBuild; int collectNpcId = 0; uint serverInstanceId = 0; DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } private void Awake() { m_NormalCollect.AddListener(NormalCollect); } public void Display(int npcId, uint sid) { collectNpcId = npcId; serverInstanceId = sid; var mapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID); m_ContainerNormalCollect.gameObject.SetActive(false); m_GatherSoulBuild.gameObject.SetActive(false); switch (mapId) { case GatherSoulDungeonModel.DUNGEON_MAPID: m_GatherSoulBuild.gameObject.SetActive(true); m_GatherSoulBuild.Display(npcId, sid); break; default: m_ContainerNormalCollect.gameObject.SetActive(true); DisplayNormalCollect(); break; } } public void Dispose() { collectNpcId = 0; serverInstanceId = 0; m_GatherSoulBuild.Dispose(); } void DisplayNormalCollect() { var mapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID); switch (mapId) { case 31230: m_NormalCollectIcon.SetSprite("TY_UI_8"); m_NormalCollectLabel.text = Language.Get("Collect_FairyFeast"); break; default: m_NormalCollectIcon.SetSprite("TY_UI_6"); m_NormalCollectLabel.text = Language.Get("Collect_Normal"); break; } m_NormalCollectIcon.SetNativeSize(); } private void NormalCollect() { if (collectNpcId != 0 && serverInstanceId != 0) { NPCInteractProcessor.InvokeEvent(E_NpcType.Collect, collectNpcId, serverInstanceId); } } } } System/MainInterfacePanel/MainCollectBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: d517bbca743210f4f85784601979d9d8 timeCreated: 1545104592 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/MainInterfacePanel/MainInterfaceWin.cs
@@ -77,9 +77,7 @@ [SerializeField] Transform unctionForecastPosition1; [SerializeField] Transform unctionForecastPosition2; [SerializeField] Button m_CollectBtn; [SerializeField] Image m_CollectIcon; [SerializeField] Text m_CollectBtnText; [SerializeField] MainCollectBehaviour m_CollectBehaviour; [SerializeField] Button m_RedBag;//红包入口按钮 [SerializeField] UIEffect m_RedpackGetSfx; [SerializeField] Button m_SendRedbagBtn; @@ -93,8 +91,6 @@ [SerializeField] FairyLeagueRemindBehaviour m_FairyLeagueRemind; [SerializeField] Transform m_EffectTask;//任务完成特效播放位置 private int m_CollectNPCID; private uint m_CollectNPCSID; private bool TaskSwithBool = true; [SerializeField] Button _SwitchShowBtn;//切换按钮 @@ -235,7 +231,6 @@ GA_Hero.OnEnterOrExitArea += OnEnterOrExitArea; NewBieCenter.Instance.guideBeginEvent += OnGuideBegin; NewBieCenter.Instance.guideCompletedEvent += OnGuideCompleted; m_CollectBtn.AddListener(OnCollectBtnClick); GA_NpcCollect.OnArrive += OnArriveCollectNPC; GA_NpcCollect.OnLeave += OnLeaveCollectNpc; PlayerRedPacketDatas.OnRedBagGetEvent += OnRedBagGet; @@ -405,6 +400,7 @@ m_TeamInvitationEntrance.UnInit(); m_FairyCallBehaviour.UnInit(); m_FairyLeagueRemind.UnInit(); m_CollectBehaviour.Dispose(); horseRidBool = false; purchaseModel.UpdateNewMysticalEvent -= UpdateMysticalPurchaseImag; assistModel.UpdateRedpointEvent -= UpdateDungeonAssistImag; @@ -428,12 +424,11 @@ { WindowCenter.Instance.CloseImmediately<FunctionForecastWin>(); } m_CollectBtn.RemoveAllListeners(); GA_NpcCollect.OnArrive -= OnArriveCollectNPC; GA_NpcCollect.OnLeave -= OnLeaveCollectNpc; fairyGrabBossModel.bossGrabHintEvent -= bossGrabHintEvent; wishModel.UpdateWishAwardEvent -= UpdateWishAwardImag; m_CollectBtn.gameObject.SetActive(false); m_CollectBehaviour.gameObject.SetActive(false); } private void GuideBeginEvent() @@ -518,22 +513,7 @@ if ((_areaType == MapArea.E_Type.Neutral || _areaType == MapArea.E_Type.Boss) && _enter) { WindowCenter.Instance.Open<NeutralMarkWin>(); int mapID = PlayerDatas.Instance.baseData.MapID; var config = Config.Instance.Get<MapConfig>(mapID); int[] atkInt = pKModel.GetArea(config.AtkType).ToArray(); if (onMainModel.ShieldedArea.Contains(PlayerDatas.Instance.baseData.MapID) || fairyGrabBossModel.grabBossHintOpen) { //return; } else { if (atkInt.Length > 1 && Buffmodel.PkType != 5) { onMainModel.AreaState = Buffmodel.PkType; DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)5); } } AtkTypeChange(); } if (_areaType == MapArea.E_Type.Neutral && !_enter) @@ -588,6 +568,25 @@ } } private void AtkTypeChange()//骑宠争夺是否切换状态 { int mapID = PlayerDatas.Instance.baseData.MapID; var config = Config.Instance.Get<MapConfig>(mapID); int[] atkInt = pKModel.GetArea(config.AtkType).ToArray(); if (onMainModel.ShieldedArea.Contains(PlayerDatas.Instance.baseData.MapID)) { } else { if (fairyGrabBossModel.grabBossHintOpen && atkInt.Length > 1 && Buffmodel.PkType != 5) { onMainModel.AreaState = Buffmodel.PkType; DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)5); } } } private void OnMaininterCDTime() { MarkRayButton(); @@ -998,33 +997,16 @@ } } void OnCollectBtnClick() { if (m_CollectNPCID != 0 && m_CollectNPCSID != 0) { NPCInteractProcessor.InvokeEvent(E_NpcType.Collect, m_CollectNPCID, m_CollectNPCSID); } } void OnArriveCollectNPC(uint sid, int npcID) { m_CollectNPCID = npcID; m_CollectNPCSID = sid; m_CollectBtn.gameObject.SetActive(true); var mapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID); m_CollectIcon.SetSprite(mapId == 31230 ? "TY_UI_8" : "TY_UI_6"); m_CollectIcon.SetNativeSize(); m_CollectBtnText.text = mapId == 31230 ? Language.Get("Collect_FairyFeast") : Language.Get("Collect_Normal"); m_CollectBehaviour.gameObject.SetActive(true); m_CollectBehaviour.Display(npcID, sid); } void OnLeaveCollectNpc(uint sid, int npcID) { if (m_CollectNPCID == npcID && m_CollectNPCSID == sid) { m_CollectNPCID = 0; m_CollectNPCSID = 0; } m_CollectBtn.gameObject.SetActive(false); m_CollectBehaviour.Dispose(); m_CollectBehaviour.gameObject.SetActive(false); } #endregion @@ -1174,6 +1156,7 @@ { IsShowTaskPanel(); ShowFairyGrabBoss(); AtkTypeChange(); } private void ShowFairyGrabBoss() System/Role/PropertyBehaviour.cs
@@ -84,6 +84,28 @@ config.ISPercentage == 1 ? "%" : string.Empty); } } public void DisplayUp(int _property, int _value, int _add) { var config = Config.Instance.Get<PlayerPropertyConfig>(_property); if (config != null) { m_PropertyName.text = config.Name; m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum( UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))), 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, UIHelper.GetPropertyDecimalCount(_property))), config.ISPercentage == 1 ? "%" : string.Empty); } } } } } System/Role/RolePanel.cs
@@ -15,6 +15,7 @@ [SerializeField] FunctionButtonGroup buttonGroup; [SerializeField] FunctionButton functionButtonRole; [SerializeField] FunctionButton functionButtonMagician; [SerializeField] FunctionButton m_GatherSoul; [SerializeField] RectTransform m_RoleInfoRt; [SerializeField] Text m_PropertyAtk; @@ -265,6 +266,7 @@ functionButtonRole.onClick.AddListener(OnFuncRole); functionButtonMagician.onClick.AddListener(OnFuncMagician); m_AddPoint.onClick.AddListener(OnPromoteClick); m_GatherSoul.onClick.AddListener(GatherSoul); m_PlayerPropertyBtn.onClick.AddListener(OnAttrExplainClick); m_TitleBtn.onClick.AddListener(OnDesignationClick); m_RenameBtn.onClick.AddListener(OnRenameClick); @@ -274,18 +276,18 @@ m_CloseBtn.onClick.AddListener(CloseClick); } private void GatherSoul() { CloseChild(); WindowCenter.Instance.Open<GatherSoulWin>(); functionOrder = m_GatherSoul.order; } private void OnFuncMagician() { CloseChild(); if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation<MagicianWin>(); } else { WindowCenter.Instance.Open<MagicianWin>(); } functionOrder = 3; WindowCenter.Instance.Open<MagicianWin>(); functionOrder = functionButtonMagician.order; } private void OnFuncRole() System/RoleParticulars/RoleParticularModel.cs
@@ -8,17 +8,21 @@ namespace Snxxz.UI { [XLua.LuaCallCSharp] public class RoleParticularModel : Model public class RoleParticularModel : Model, IBeforePlayerDataInitialize { public override void Init() { } public override void UnInit() { } public void OnBeforePlayerDataInitialize() { viewPlayerType = -1; } public int viewPlayer { get; private set; } @@ -93,8 +97,10 @@ public void OnRevRoleEquip(HA705_tagSCQueryPlayerCacheResult package) { if (viewPlayer != package.PlayerID) if (viewPlayer != package.PlayerID || viewPlayerType == -1) { return; } ViewPlayerData viewPlayerData = null; if (!viewPlayerDataDic.TryGetValue((int)package.PlayerID, out viewPlayerData)) { @@ -602,6 +608,7 @@ } break; } viewPlayerType = -1; } public class ViewPlayerData System/Skill/QuickSetting.cs
@@ -18,6 +18,7 @@ quickSettingDic.Add(QuickSettingType.AutoUseXp, new QuickSettingRange(QuickSettingType.AutoUseXp, 1)); quickSettingDic.Add(QuickSettingType.SpAnim, new QuickSettingRange(QuickSettingType.SpAnim, 10)); quickSettingDic.Add(QuickSettingType.TreasureHighestAnim, new QuickSettingRange(QuickSettingType.TreasureHighestAnim, 10)); quickSettingDic.Add(QuickSettingType.GatherSoulAutoResolve, new QuickSettingRange(QuickSettingType.GatherSoulAutoResolve, 1)); setting = new string(UCharacter, 100); DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; } @@ -121,7 +122,8 @@ FairyLeagueGuide, AutoUseXp, SpAnim, TreasureHighestAnim TreasureHighestAnim, GatherSoulAutoResolve } public struct QuickSettingRange { System/Vip/VipInvest/CheckDisplay.cs
@@ -27,7 +27,7 @@ private void OnEnable() { IsBool = false; _time = 0; _time = 0; } private void LateUpdate() { System/Vip/VipInvest/RotatePointer.cs
@@ -31,7 +31,7 @@ public float _Speed = 1f; WheelOfFortuneModel wheelOfFortuneModel { get { return ModelCenter.Instance.GetModel<WheelOfFortuneModel>(); } } [SerializeField] CheckDisplay m_CheckDisplay; private int FairyJade = 0; public void Init() { IsRotateBool = false; @@ -43,7 +43,7 @@ } private void OnEnable() { FairyJade = (int)UIHelper.GetMoneyCnt(2); } private void OnDisable() { @@ -61,6 +61,10 @@ sequence.Kill(); transform.localRotation = Quaternion.Euler(0, 0, -Angle); m_CheckDisplay.ShowSelected(wheelOfFortuneModel.Lattice); int money = ((int)UIHelper.GetMoneyCnt(2) - FairyJade); string str=UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName); SysNotifyMgr.Instance.ShowTip("BindJadeNotice", str, money); FairyJade = (int)UIHelper.GetMoneyCnt(2); if (IsButtonShow != null) { IsButtonShow(true); @@ -113,6 +117,10 @@ IsButtonShow(true); } m_CheckDisplay.ShowSelected(wheelOfFortuneModel.Lattice); int money = ((int)UIHelper.GetMoneyCnt(2) - FairyJade); string str = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName); SysNotifyMgr.Instance.ShowTip("BindJadeNotice", str, money); FairyJade = (int)UIHelper.GetMoneyCnt(2); }); IsRotateBool = false; } System/Vip/VipInvest/WheelOfFortuneModel.cs
@@ -5,6 +5,7 @@ using LitJson; using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; @@ -84,7 +85,8 @@ angleClass.AngleEnd = (float)AngleList[i][1]; AngleDic.Add(Type, angleClass); } } } SysNotifyMgr.Instance.RegisterCondition("BindJadeNotice", SatisfyNotifyCondition); } public override void UnInit() @@ -202,6 +204,16 @@ } return 0; } private bool SatisfyNotifyCondition(string key, ArrayList paramArray) { if (paramArray != null && paramArray.Count > 0 && paramArray[0].Equals(UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName))) { return false; } return true; } } } System/Vip/VipInvest/WheelOfFortuneWin.cs
@@ -109,7 +109,7 @@ private void EndOfFlashing() { TiedJadeChange(); SoundPlayer.Instance.PlayUIAudio(72); SoundPlayer.Instance.PlayUIAudio(72); m_UIEffect_1.Play(); } @@ -188,7 +188,7 @@ } private Sequence mScoreSequence; private void TiedJadeChange()//绑玉变化 { { m_RotationTween.enabled = true; mScoreSequence = DOTween.Sequence(); mScoreSequence.SetAutoKill(false); System/WindowBase/ModelCenter.cs
@@ -213,6 +213,10 @@ RegisterModel<FuncSwitchModel>(); RegisterModel<CrossServerModel>(); RegisterModel<CrossServerRewardModel>(); RegisterModel<GatheringSoulModel>(); RegisterModel<VirtualPackModel>(); RegisterModel<GatherSoulComposeModel>(); RegisterModel<GatherSoulDungeonModel>(); inited = true; } System/WindowBase/WindowCenter.cs
@@ -17,6 +17,7 @@ "MessageWin", "NewBieWin", "NewItemGetWin", "AttributePromoteShowWin" ,"DungeonBeginCoolDownWin","DungeonFightWin","StatusTipWin" ,"ScrollTipWin","MarqueeWin","ExperienceOpenWin","TrumpetWin","BattlePrepareCoolDownWin","DungeonGradeWin","BattleHintWin", "TreasureDungeonMissionHintWin","FairyGrabBossHintWin","DungeonFairyFeastHintWin","PetAndMountPushWin","UpgradeWin","DungeonFairyLandWin" ,"GatherSoulDungeonHintWin" }; UIRoot m_UIRoot; System/WindowJump/WindowJumpMgr.cs
@@ -173,6 +173,7 @@ case JumpUIType.ComposeFunc5: case JumpUIType.TicketCompose1: case JumpUIType.TicketCompose2: case JumpUIType.GatherSoul271: SetJumpLogic<ComposeWin>(_tagWinSearchModel.TABID); break; case JumpUIType.EquipCompose1: @@ -1522,7 +1523,7 @@ EquipCompose268 = 268, //装备合成-8阶橙色2星玉佩 EquipCompose269 = 269, //装备合成-9阶红色2星玉佩 EquipCompose270 = 270, //装备合成-10阶红色3星玉佩 GatherSoul271 = 271, //聚魂合成 DhszTs = 1001,//定海神针功法提升界面 HyqTs = 1002,//皓月枪功法提升界面 GyzTs = 1003,//鬼牙刃功法提升界面 Utility/EnumHelper.cs
@@ -324,6 +324,7 @@ FairyGrabBoss = 27, KillMonster = 28, DungeonAssist = 29, GatherSoulDungeon = 30, } public enum ActivityPrepareType @@ -577,6 +578,9 @@ CDBPlayerRefresh_GodWeaponLV_2 = 193, CDBPlayerRefresh_GodWeaponLV_3 = 194, CDBPlayerRefresh_GodWeaponLV_4 = 195, CDBPlayerRefresh_SoulDust = 196,//聚魂-魂尘 CDBPlayerRefresh_SoulSplinters = 197,//聚魂-碎片 CDBPlayerRefresh_SoulCore = 198,//聚魂-核心环 }; /** 物品加成类型 */ @@ -644,6 +648,7 @@ rptDogzItem = 32, //神兽物品背包 rptDogzEquip = 33, //神兽装备背包(神兽穿戴) rptBlastFrunacePack = 253, //炼丹背包 rptGatherSoul = 254,//聚魂 rptRunePack = 255,//符印背包 } @@ -812,6 +817,7 @@ Def_DanRecycle = 20, //丹药回收 Def_mitDogzEquipPlus = 21,// 神兽装备强化 Def_mitRuneCompound = 22,//符印合成 Def_mitGatherSoulCompound = 23,//聚魂合成 } /// <summary> /// 金钱类型(虚拟物品) @@ -1545,6 +1551,10 @@ renewal,//续费 strength, //强化 refine, //精炼 LevelUp,//升级 Resolve,//分解 Wear,//佩戴 Replace,//替换 } public enum ItemWinType @@ -1558,6 +1568,7 @@ buyBoxWin, //购买宝箱弹框 petMatWin, //解锁宠物和坐骑道具弹框 buyPetMatWin, //购买解锁宠物和坐骑道具弹框 GatherSoul,//聚魂 } public enum ItemTipChildType Utility/UIHelper.cs
@@ -772,6 +772,18 @@ { return (ulong)ModelCenter.Instance.GetModel<StoreModel>().GetTCBPlayerData(PlayerDataRefresh.CDBPlayerRefresh_Danjing); } case 28: { return PlayerDatas.Instance.extersion.soulDust; } case 29: { return PlayerDatas.Instance.extersion.soulSplinters; } case 30: { return PlayerDatas.Instance.extersion.soulCore; } } return 0; }