Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -590,6 +590,12 @@ Register(typeof(HAA82_tagMCActGubaoPlayerInfo), typeof(DTCAA82_tagMCActGubaoPlayerInfo)); Register(typeof(HAA83_tagMCCrossActGubaoInfo), typeof(DTCAA83_tagMCCrossActGubaoInfo)); Register(typeof(HA927_tagGCXiangongNewPlayerInfo), typeof(DTCA927_tagGCXiangongNewPlayerInfo)); Register(typeof(HA928_tagGCXiangongRecPlayerInfo), typeof(DTCA928_tagGCXiangongRecPlayerInfo)); Register(typeof(HB114_tagMCXiangongInfo), typeof(DTCB114_tagMCXiangongInfo)); Register(typeof(HB115_tagMCTiandaoTreeInfo), typeof(DTCB115_tagMCTiandaoTreeInfo)); Register(typeof(HB116_tagMCUseMoneyTotalInfo), typeof(DTCB116_tagMCUseMoneyTotalInfo)); } Core/GameEngine/Model/Config/TiandaoTreeConfig.cs
New file @@ -0,0 +1,206 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: 2024年9月6日 //-------------------------------------------------------- using System.Collections.Generic; using System.IO; using System.Threading; using System; using UnityEngine; using LitJson; public partial class TiandaoTreeConfig { public readonly int AwardIndex; public readonly int NeedQiyun; public readonly int[][] AwardItemList; public TiandaoTreeConfig() { } public TiandaoTreeConfig(string input) { try { var tables = input.Split('\t'); int.TryParse(tables[0],out AwardIndex); int.TryParse(tables[1],out NeedQiyun); AwardItemList = JsonMapper.ToObject<int[][]>(tables[2].Replace("(", "[").Replace(")", "]")); } catch (Exception ex) { DebugEx.Log(ex); } } static Dictionary<string, TiandaoTreeConfig> configs = new Dictionary<string, TiandaoTreeConfig>(); public static TiandaoTreeConfig Get(string id) { if (!inited) { Debug.Log("TiandaoTreeConfig 还未完成初始化。"); return null; } if (configs.ContainsKey(id)) { return configs[id]; } TiandaoTreeConfig config = null; if (rawDatas.ContainsKey(id)) { config = configs[id] = new TiandaoTreeConfig(rawDatas[id]); rawDatas.Remove(id); } return config; } public static TiandaoTreeConfig Get(int id) { return Get(id.ToString()); } public static List<string> GetKeys() { var keys = new List<string>(); keys.AddRange(configs.Keys); keys.AddRange(rawDatas.Keys); return keys; } public static List<TiandaoTreeConfig> GetValues() { var values = new List<TiandaoTreeConfig>(); values.AddRange(configs.Values); var keys = new List<string>(rawDatas.Keys); for (int i = 0; i < keys.Count; i++) { values.Add(Get(keys[i])); } return values; } public static bool Has(string id) { return configs.ContainsKey(id) || rawDatas.ContainsKey(id); } public static bool Has(int id) { return Has(id.ToString()); } public static bool inited { get; private set; } protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>(); public static void Init(bool sync=false) { inited = false; var path = string.Empty; if (AssetSource.refdataFromEditor) { path = ResourcesPath.CONFIG_FODLER +"/TiandaoTree.txt"; } else { path = AssetVersionUtility.GetAssetFilePath("config/TiandaoTree.txt"); } configs.Clear(); var tempConfig = new TiandaoTreeConfig(); var preParse = tempConfig is IConfigPostProcess; if (sync) { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new TiandaoTreeConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; } else { ThreadPool.QueueUserWorkItem((object _object) => { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new TiandaoTreeConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; }); } } } Core/GameEngine/Model/Config/TiandaoTreeConfig.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b7f206e4ceb3f9a4d93e67a5793937f1 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/Config/XiangongConfig.cs
New file @@ -0,0 +1,215 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: Friday, September 6, 2024 //-------------------------------------------------------- using System.Collections.Generic; using System.IO; using System.Threading; using System; using UnityEngine; using LitJson; public partial class XiangongConfig { public readonly int XiangongID; public readonly int ShowDays; public readonly int MoneyType; public readonly int MoneyValue; public readonly int TitleID; public readonly int AwardItemList; public XiangongConfig() { } public XiangongConfig(string input) { try { var tables = input.Split('\t'); int.TryParse(tables[0],out XiangongID); int.TryParse(tables[1],out ShowDays); int.TryParse(tables[2],out MoneyType); int.TryParse(tables[3],out MoneyValue); int.TryParse(tables[4],out TitleID); int.TryParse(tables[5],out AwardItemList); } catch (Exception ex) { DebugEx.Log(ex); } } static Dictionary<string, XiangongConfig> configs = new Dictionary<string, XiangongConfig>(); public static XiangongConfig Get(string id) { if (!inited) { Debug.Log("XiangongConfig 还未完成初始化。"); return null; } if (configs.ContainsKey(id)) { return configs[id]; } XiangongConfig config = null; if (rawDatas.ContainsKey(id)) { config = configs[id] = new XiangongConfig(rawDatas[id]); rawDatas.Remove(id); } return config; } public static XiangongConfig Get(int id) { return Get(id.ToString()); } public static List<string> GetKeys() { var keys = new List<string>(); keys.AddRange(configs.Keys); keys.AddRange(rawDatas.Keys); return keys; } public static List<XiangongConfig> GetValues() { var values = new List<XiangongConfig>(); values.AddRange(configs.Values); var keys = new List<string>(rawDatas.Keys); for (int i = 0; i < keys.Count; i++) { values.Add(Get(keys[i])); } return values; } public static bool Has(string id) { return configs.ContainsKey(id) || rawDatas.ContainsKey(id); } public static bool Has(int id) { return Has(id.ToString()); } public static bool inited { get; private set; } protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>(); public static void Init(bool sync=false) { inited = false; var path = string.Empty; if (AssetSource.refdataFromEditor) { path = ResourcesPath.CONFIG_FODLER +"/Xiangong.txt"; } else { path = AssetVersionUtility.GetAssetFilePath("config/Xiangong.txt"); } configs.Clear(); var tempConfig = new XiangongConfig(); var preParse = tempConfig is IConfigPostProcess; if (sync) { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new XiangongConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; } else { ThreadPool.QueueUserWorkItem((object _object) => { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new XiangongConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; }); } } } Core/GameEngine/Model/Config/XiangongConfig.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 3f206509f83e7144f9016d0e4d1a416b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ClientPack/ClientToGameServer/CA9_Function/CA906_tagCGQueryXiangongRecPlayers.cs
New file @@ -0,0 +1,18 @@ using UnityEngine; using System.Collections; // A9 06 查看仙宫仙名录 #tagCGQueryXiangongRecPlayers public class CA906_tagCGQueryXiangongRecPlayers : GameNetPackBasic { public ushort XiangongID; // 仙宫ID public CA906_tagCGQueryXiangongRecPlayers () { combineCmd = (ushort)0x1801; _cmd = (ushort)0xA906; } public override void WriteToBytes () { WriteBytes (XiangongID, NetDataType.WORD); } } Core/NetworkPackage/ClientPack/ClientToGameServer/CA9_Function/CA906_tagCGQueryXiangongRecPlayers.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 56f6261825708834991b7161a859bb77 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ClientPack/ClientToGameServer/CA9_Function/CA907_tagCGLikeXiangong.cs
New file @@ -0,0 +1,18 @@ using UnityEngine; using System.Collections; // A9 07 点赞仙宫 #tagCGLikeXiangong public class CA907_tagCGLikeXiangong : GameNetPackBasic { public ushort XiangongID; // 仙宫ID,为0时代表每日的仙宫点赞 public CA907_tagCGLikeXiangong () { combineCmd = (ushort)0x1801; _cmd = (ushort)0xA907; } public override void WriteToBytes () { WriteBytes (XiangongID, NetDataType.WORD); } } Core/NetworkPackage/ClientPack/ClientToGameServer/CA9_Function/CA907_tagCGLikeXiangong.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b5b9eda1e67f4634997c4f51d96e9c71 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HA9_Function/DTCA927_tagGCXiangongNewPlayerInfo.cs
New file @@ -0,0 +1,13 @@ using UnityEngine; using System.Collections; using vnxbqy.UI; // A9 27 仙宫新晋玩家信息 #tagGCXiangongNewPlayerInfo public class DTCA927_tagGCXiangongNewPlayerInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA927_tagGCXiangongNewPlayerInfo vNetData = vNetPack as HA927_tagGCXiangongNewPlayerInfo; ModelCenter.Instance.GetModel<CelestialPalaceModel>().UpdateXiangongNewPlayerInfo(vNetData); } } Core/NetworkPackage/DTCFile/ServerPack/HA9_Function/DTCA927_tagGCXiangongNewPlayerInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 6278f866313ea794e8c9a4f80c713178 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HA9_Function/DTCA928_tagGCXiangongRecPlayerInfo.cs
New file @@ -0,0 +1,13 @@ using UnityEngine; using System.Collections; using vnxbqy.UI; // A9 28 仙宫仙名录玩家信息 #tagGCXiangongRecPlayerInfo public class DTCA928_tagGCXiangongRecPlayerInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA928_tagGCXiangongRecPlayerInfo vNetData = vNetPack as HA928_tagGCXiangongRecPlayerInfo; ModelCenter.Instance.GetModel<CelestialPalaceModel>().UpdateXiangongRecPlayerInfo(vNetData); } } Core/NetworkPackage/DTCFile/ServerPack/HA9_Function/DTCA928_tagGCXiangongRecPlayerInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 4954886ae0c952244a19cb11ff73176f MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB114_tagMCXiangongInfo.cs
New file @@ -0,0 +1,13 @@ using UnityEngine; using System.Collections; using vnxbqy.UI; // B1 14 仙宫信息 #tagMCXiangongInfo public class DTCB114_tagMCXiangongInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HB114_tagMCXiangongInfo vNetData = vNetPack as HB114_tagMCXiangongInfo; ModelCenter.Instance.GetModel<CelestialPalaceModel>().UpdateXiangongInfo(vNetData); } } Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB114_tagMCXiangongInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 15f9c4348b5be4e40a1e352a81d6cd27 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB115_tagMCTiandaoTreeInfo.cs
New file @@ -0,0 +1,13 @@ using UnityEngine; using System.Collections; using vnxbqy.UI; // B1 15 天道树信息 #tagMCTiandaoTreeInfo public class DTCB115_tagMCTiandaoTreeInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HB115_tagMCTiandaoTreeInfo vNetData = vNetPack as HB115_tagMCTiandaoTreeInfo; ModelCenter.Instance.GetModel<CelestialPalaceModel>().UpdateTiandaoTreeInfo(vNetData); } } Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB115_tagMCTiandaoTreeInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: e9aed3255e84aaa4989f7533a0291e5a MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB116_tagMCUseMoneyTotalInfo.cs
New file @@ -0,0 +1,13 @@ using UnityEngine; using System.Collections; using vnxbqy.UI; // B1 16 累计消耗货币信息 #tagMCUseMoneyTotalInfo public class DTCB116_tagMCUseMoneyTotalInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HB116_tagMCUseMoneyTotalInfo vNetData = vNetPack as HB116_tagMCUseMoneyTotalInfo; ModelCenter.Instance.GetModel<CelestialPalaceModel>().UpdateUseMoneyTotalInfo(vNetData); } } Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB116_tagMCUseMoneyTotalInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 0e34943e67d4c6f4b810a2f4679e91bc MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HA9_Function/HA927_tagGCXiangongNewPlayerInfo.cs
New file @@ -0,0 +1,49 @@ using UnityEngine; using System.Collections; // A9 27 仙宫新晋玩家信息 #tagGCXiangongNewPlayerInfo public class HA927_tagGCXiangongNewPlayerInfo : GameNetPackBasic { public ushort XiangongID; // 仙宫ID public byte NewPlayerCount; public tagGCXiangongNewPlayer[] NewPlayerList; public HA927_tagGCXiangongNewPlayerInfo () { _cmd = (ushort)0xA927; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out XiangongID, vBytes, NetDataType.WORD); TransBytes (out NewPlayerCount, vBytes, NetDataType.BYTE); NewPlayerList = new tagGCXiangongNewPlayer[NewPlayerCount]; for (int i = 0; i < NewPlayerCount; i ++) { NewPlayerList[i] = new tagGCXiangongNewPlayer(); TransBytes (out NewPlayerList[i].AddTime, vBytes, NetDataType.DWORD); TransBytes (out NewPlayerList[i].ServerID, vBytes, NetDataType.DWORD); TransBytes (out NewPlayerList[i].PlayerID, vBytes, NetDataType.DWORD); TransBytes (out NewPlayerList[i].NameLen, vBytes, NetDataType.BYTE); TransBytes (out NewPlayerList[i].Name, vBytes, NetDataType.Chars, NewPlayerList[i].NameLen); TransBytes (out NewPlayerList[i].LV, vBytes, NetDataType.WORD); TransBytes (out NewPlayerList[i].Job, vBytes, NetDataType.BYTE); TransBytes (out NewPlayerList[i].RealmLV, vBytes, NetDataType.WORD); TransBytes (out NewPlayerList[i].EquipShowSwitch, vBytes, NetDataType.DWORD); TransBytes (out NewPlayerList[i].EquipShowIDCount, vBytes, NetDataType.BYTE); TransBytes (out NewPlayerList[i].EquipShowID, vBytes, NetDataType.DWORD, NewPlayerList[i].EquipShowIDCount); } } public struct tagGCXiangongNewPlayer { public uint AddTime; // 新晋时间戳 public uint ServerID; public uint PlayerID; public byte NameLen; public string Name; // 玩家名,size = NameLen public ushort LV; // 玩家等级 public byte Job; // 玩家职业 public ushort RealmLV; // 玩家境界 public uint EquipShowSwitch; public byte EquipShowIDCount; public uint[] EquipShowID; } } Core/NetworkPackage/ServerPack/HA9_Function/HA927_tagGCXiangongNewPlayerInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 47a50384ed72412479198d18b412bad1 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HA9_Function/HA928_tagGCXiangongRecPlayerInfo.cs
New file @@ -0,0 +1,43 @@ using UnityEngine; using System.Collections; // A9 28 仙宫仙名录玩家信息 #tagGCXiangongRecPlayerInfo public class HA928_tagGCXiangongRecPlayerInfo : GameNetPackBasic { public ushort XiangongID; // 仙宫ID public byte RecPlayerCount; public tagGCXiangongRecPlayer[] RecPlayerList; public HA928_tagGCXiangongRecPlayerInfo () { _cmd = (ushort)0xA928; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out XiangongID, vBytes, NetDataType.WORD); TransBytes (out RecPlayerCount, vBytes, NetDataType.BYTE); RecPlayerList = new tagGCXiangongRecPlayer[RecPlayerCount]; for (int i = 0; i < RecPlayerCount; i ++) { RecPlayerList[i] = new tagGCXiangongRecPlayer(); TransBytes (out RecPlayerList[i].AddTime, vBytes, NetDataType.DWORD); TransBytes (out RecPlayerList[i].ServerID, vBytes, NetDataType.DWORD); TransBytes (out RecPlayerList[i].PlayerID, vBytes, NetDataType.DWORD); TransBytes (out RecPlayerList[i].NameLen, vBytes, NetDataType.BYTE); TransBytes (out RecPlayerList[i].Name, vBytes, NetDataType.Chars, RecPlayerList[i].NameLen); TransBytes (out RecPlayerList[i].LV, vBytes, NetDataType.WORD); TransBytes (out RecPlayerList[i].Job, vBytes, NetDataType.BYTE); TransBytes (out RecPlayerList[i].RealmLV, vBytes, NetDataType.WORD); } } public struct tagGCXiangongRecPlayer { public uint AddTime; // 新晋时间戳 public uint ServerID; public uint PlayerID; public byte NameLen; public string Name; // 玩家名,size = NameLen public ushort LV; // 玩家等级 public byte Job; // 玩家职业 public ushort RealmLV; // 玩家境界 } } Core/NetworkPackage/ServerPack/HA9_Function/HA928_tagGCXiangongRecPlayerInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: ac73865be3fefbb4184a3dd8f15c0e0c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HB1_Role/HB114_tagMCXiangongInfo.cs
New file @@ -0,0 +1,31 @@ using UnityEngine; using System.Collections; // B1 14 仙宫信息 #tagMCXiangongInfo public class HB114_tagMCXiangongInfo : GameNetPackBasic { public byte LikeStateToday; // 今日是否已点赞,指仙宫的外层点赞,非某个指定仙宫 public byte XiangongCount; public tagMCXiangong[] XiangongList; public HB114_tagMCXiangongInfo () { _cmd = (ushort)0xB114; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out LikeStateToday, vBytes, NetDataType.BYTE); TransBytes (out XiangongCount, vBytes, NetDataType.BYTE); XiangongList = new tagMCXiangong[XiangongCount]; for (int i = 0; i < XiangongCount; i ++) { XiangongList[i] = new tagMCXiangong(); TransBytes (out XiangongList[i].XiangongID, vBytes, NetDataType.WORD); TransBytes (out XiangongList[i].LikeStateToday, vBytes, NetDataType.BYTE); } } public struct tagMCXiangong { public ushort XiangongID; // 仙宫ID public byte LikeStateToday; // 今日是否已点赞 } } Core/NetworkPackage/ServerPack/HB1_Role/HB114_tagMCXiangongInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 217d66d74f8461a45916fd9a7f783be3 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HB1_Role/HB115_tagMCTiandaoTreeInfo.cs
New file @@ -0,0 +1,21 @@ using UnityEngine; using System.Collections; // B1 15 天道树信息 #tagMCTiandaoTreeInfo public class HB115_tagMCTiandaoTreeInfo : GameNetPackBasic { public uint Qiyun; // 当前气运值 public byte AwardCount; // 天道果领取记录值个数 public uint[] AwardStateList; // 天道果领取记录值列表,按奖励索引位二进制记录是否已领取,一个值可存31位,如值1存0~30,值2存31~61,... public HB115_tagMCTiandaoTreeInfo () { _cmd = (ushort)0xB115; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Qiyun, vBytes, NetDataType.DWORD); TransBytes (out AwardCount, vBytes, NetDataType.BYTE); TransBytes (out AwardStateList, vBytes, NetDataType.DWORD, AwardCount); } } Core/NetworkPackage/ServerPack/HB1_Role/HB115_tagMCTiandaoTreeInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 3d66a80d12b957a43a07a5c9c473e22e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HB1_Role/HB116_tagMCUseMoneyTotalInfo.cs
New file @@ -0,0 +1,29 @@ using UnityEngine; using System.Collections; // B1 16 累计消耗货币信息 #tagMCUseMoneyTotalInfo public class HB116_tagMCUseMoneyTotalInfo : GameNetPackBasic { public byte Count; public tagMCUseMoneyTotal[] InfoList; public HB116_tagMCUseMoneyTotalInfo () { _cmd = (ushort)0xB116; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Count, vBytes, NetDataType.BYTE); InfoList = new tagMCUseMoneyTotal[Count]; for (int i = 0; i < Count; i ++) { InfoList[i] = new tagMCUseMoneyTotal(); TransBytes (out InfoList[i].MoneyType, vBytes, NetDataType.BYTE); TransBytes (out InfoList[i].UseTotal, vBytes, NetDataType.DWORD); } } public struct tagMCUseMoneyTotal { public byte MoneyType; // 货币类型,仅同步需要记录的货币类型 public uint UseTotal; // 累计消耗货币值 } } Core/NetworkPackage/ServerPack/HB1_Role/HB116_tagMCUseMoneyTotalInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 097936c396b6eaf4b8fa39186b223db7 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: addff9f36589d9248907f6fb21fc8e66 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceButtonGroupWin.cs
New file @@ -0,0 +1,92 @@ using System.Collections; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceButtonGroupWin : Window { [SerializeField] ButtonEx btnHell; [SerializeField] ButtonEx btnTree; [SerializeField] ButtonEx btnShop; [SerializeField] ButtonEx btnClose; [SerializeField] ImageEx imgHellChoose; [SerializeField] ImageEx imgTreeChoose; [SerializeField] ImageEx imgShopChoose; CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } protected override void BindController() { btnClose.SetListener(CloseClick); btnHell.SetListener(() => { model.currentSelectedTabButtonType = 0; }); btnTree.SetListener(() => { model.currentSelectedTabButtonType = 1; }); btnShop.SetListener(() => { model.currentSelectedTabButtonType = 2; }); } protected override void OnPreOpen() { transform.SetAsLastSibling(); model.SelectedTabButtonClickedEvent += OnSelectedTabButtonClickedEvent; model.currentSelectedTabButtonType = 0; ChooseImageShow(model.currentSelectedTabButtonType); } protected override void OnPreClose() { model.SelectedTabButtonClickedEvent -= OnSelectedTabButtonClickedEvent; WindowCenter.Instance.CloseAll(); } void OnSelectedTabButtonClickedEvent(int type) { WindowCenter.Instance.CloseOthers<CelestialPalaceWin>(); if (type == 0) { WindowCenter.Instance.Open<CelestialPalaceHellWin>(); } else if (type == 1) { WindowCenter.Instance.Open<CelestialPalaceTreeWin>(); } else if (type == 2) { WindowCenter.Instance.Open<CelestialPalaceShopWin>(); } WindowCenter.Instance.Open<CelestialPalaceButtonGroupWin>(); // 延迟一帧设置为最下面 if (gameObject.activeInHierarchy) { StartCoroutine(SetAsLastSiblingNextFrame()); } ChooseImageShow(type); } IEnumerator SetAsLastSiblingNextFrame() { yield return new WaitForEndOfFrame(); // 等待一帧 transform.SetAsLastSibling(); } void ChooseImageShow(int type) { imgHellChoose.SetActive(type == 0); imgTreeChoose.SetActive(type == 1); imgShopChoose.SetActive(type == 2); } protected override void OnAfterOpen() { } protected override void OnAfterClose() { } protected override void AddListeners() { } } System/CelestialPalace/CelestialPalaceButtonGroupWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: a5193b722715b0f418aba3b96724e07b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceHellCell.cs
New file @@ -0,0 +1,22 @@ using System.Collections.Generic; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceHellCell : CellView { [SerializeField] List<ButtonEx> btnXGList = new List<ButtonEx>(); CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void Display(int num) { for (int i = 0; i < btnXGList.Count; i++) { int index = i + 1; btnXGList[i].SetListener(() => { model.currentSelectedXGId = index; WindowCenter.Instance.Open<CelestialPalaceRoomWin>(); }); } } } System/CelestialPalace/CelestialPalaceHellCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 5571bef22a258e547a65a6947748f118 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceHellWin.cs
New file @@ -0,0 +1,86 @@ using UnityEngine; using vnxbqy.UI; public class CelestialPalaceHellWin : Window { [SerializeField] ScrollerController scroller; [SerializeField] ButtonEx btnLike; [SerializeField] TextEx txtLike; CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } protected override void BindController() { btnLike.SetListener(() => { model.SendA907LikePack(0); // 为0时代表每日的仙宫点赞 }); } protected override void OnPreOpen() { model.UpdateXiangongInfoEvent += OnUpdateXiangongInfoEvent; model.UpdateXiangongNewPlayerInfoEvent += OnUpdateXiangongNewPlayerInfoEvent; model.UpdateXiangongRecPlayerInfoEvent += OnUpdateXiangongRecPlayerInfoEvent; scroller.OnRefreshCell += OnRefreshCell; Display(); } protected override void OnPreClose() { scroller.OnRefreshCell -= OnRefreshCell; model.UpdateXiangongInfoEvent -= OnUpdateXiangongInfoEvent; model.UpdateXiangongNewPlayerInfoEvent -= OnUpdateXiangongNewPlayerInfoEvent; model.UpdateXiangongRecPlayerInfoEvent -= OnUpdateXiangongRecPlayerInfoEvent; } protected override void OnAfterOpen() { scroller.Refresh(); scroller.AddCell(ScrollerDataType.Header, 0); scroller.Restart(); } void Display() { bool isLikeStateToday = model.likeStateToday; btnLike.interactable = !isLikeStateToday; btnLike.SetColorful(null, !isLikeStateToday); txtLike.text = isLikeStateToday ? Language.Get("CelestialPalace07") : Language.Get("sharegift3"); txtLike.color = UIHelper.GetUIColor(isLikeStateToday ? TextColType.Gray : TextColType.NavyYellow); } void OnRefreshCell(ScrollerDataType type, CellView cell) { var _cell = cell as CelestialPalaceHellCell; _cell.Display(_cell.index); } private void OnUpdateXiangongInfoEvent() { Display(); scroller.m_Scorller.RefreshActiveCellViews(); } private void OnUpdateXiangongRecPlayerInfoEvent() { Display(); scroller.m_Scorller.RefreshActiveCellViews(); } private void OnUpdateXiangongNewPlayerInfoEvent() { Display(); scroller.m_Scorller.RefreshActiveCellViews(); } protected override void OnAfterClose() { } protected override void AddListeners() { } } System/CelestialPalace/CelestialPalaceHellWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 6a94f70a7cb4b8243bfa63e97e09953b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceModel.cs
New file @@ -0,0 +1,709 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace vnxbqy.UI { public class CelestialPalaceModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { public readonly int MoneyType = 47; //天道币货币类型 public readonly int StoreType = 310; //天道币商店类型 public readonly int FuncId = 235; //仙宫功能Id public readonly int MaxHeaderCount = 3; public readonly int MaxNormalCount = 3; public readonly int MaxTailCount = 2; public int moneyItemId; //天道币货币物品Id // 当前选中的页签按钮 0 仙宫 1 天道树 2 天道阁 private int m_CurrentSelectedTabButtonType; public int currentSelectedTabButtonType { get { return m_CurrentSelectedTabButtonType; } set { m_CurrentSelectedTabButtonType = value; UpdateRedPoint(); SelectedTabButtonClickedEvent?.Invoke(value); } } // 当前选中的宫殿Id private int m_CurrentSelectedXGId; public int currentSelectedXGId { get { return m_CurrentSelectedXGId; } set { m_CurrentSelectedXGId = value; } } // 当前选中的商品商店表ID private int m_CurrentSelectedShopGoodId; public int currentSelectedShopGoodId { get { return m_CurrentSelectedShopGoodId; } set { m_CurrentSelectedShopGoodId = value; SelectedShopCellClickedEvent?.Invoke(); } } // 树冠所在行索引 public int headerRowIndex; // int[树冠所在行索引,树枝方向] 树冠所在行索引 public List<int[]> normalRowIndexList = new List<int[]>(); // 树根所在行索引 public int tailRowIndex; //<行索引,List<awardIndex>> 行索引对应奖励索引 public Dictionary<int, List<int>> rowIndexCellDict = new Dictionary<int, List<int>>(); //<奖励索引,行索引> 奖励索引对应行索引 public Dictionary<int, int> awardIndexToRowIndexDict = new Dictionary<int, int>(); // 当前气运值 public uint nowQiYun; // 今日是否已点赞,指仙宫的外层点赞,非某个指定仙宫 public bool likeStateToday; // <仙宫Id,今日是否点赞> 仙宫点赞状态字典 public Dictionary<int, bool> xgLikeDict = new Dictionary<int, bool>(); // <货币类型,总消耗数量> 货币总消耗数量字典 public Dictionary<int, uint> xgUseTotalDict = new Dictionary<int, uint>(); // <仙宫Id,玩家Id> 仙宫对应玩家字典 public Dictionary<int, List<uint>> allPlayerDict = new Dictionary<int, List<uint>>(); // <玩家Id,玩家详细信息> 所有玩家信息字典 public Dictionary<uint, CelestialPalacePlayer> allPlayerInfoDict = new Dictionary<uint, CelestialPalacePlayer>(); // <奖励索引,是否已领取> 奖励领取状态字典 public Dictionary<int, bool> xgHaveDict = new Dictionary<int, bool>(); // <仙宫Id,是否需要重新查询仙名录> 是否发查仙名录包字典 public Dictionary<int, bool> xgNeedSendDict = new Dictionary<int, bool>(); public event Action<int> SelectedTabButtonClickedEvent; // 玩家点击不同页签按钮 public event Action SelectedShopCellClickedEvent; // 玩家点击商店Cell public event Action UpdateXiangongInfoEvent; // 仙宫信息更新 public event Action UpdateUseMoneyTotalInfoEvent; // 天道货币消耗信息更新 public event Action UpdateXiangongNewPlayerInfoEvent; // 仙宫新晋玩家信息更新 public event Action UpdateXiangongRecPlayerInfoEvent; // 仙宫仙名录玩家信息更新 public event Action UpdateTiandaoTreeInfoEvent; // 天道树信息更新 // 入口红点 458 Redpoint mainRedPoint = new Redpoint(MainRedDot.CelestialPalaceRepoint); // 仙宫标签红点 4581 Redpoint tabRedPoint1 = new Redpoint(MainRedDot.CelestialPalaceRepoint, MainRedDot.CelestialPalaceRepoint * 10 + 1); // 天道树标签红点 4582 Redpoint tabRedPoint2 = new Redpoint(MainRedDot.CelestialPalaceRepoint, MainRedDot.CelestialPalaceRepoint * 10 + 2); // 【没使用,预留的】 天道阁标签红点 4583 // Redpoint tabRedPoint3 = new Redpoint(MainRedDot.CelestialPalaceRepoint, MainRedDot.CelestialPalaceRepoint * 10 + 3); // 每日点赞红点 4586 Redpoint hellLikeRedPoint = new Redpoint(MainRedDot.CelestialPalaceRepoint * 10 + 1, MainRedDot.CelestialPalaceRepoint * 10 + 6); // 仙名录入口红点 4587 Redpoint bookRedPoint = new Redpoint(MainRedDot.CelestialPalaceRepoint * 10 + 7); // 仙名录点赞红点 4588 Redpoint bookLikeRedPoint = new Redpoint(MainRedDot.CelestialPalaceRepoint * 10 + 7, MainRedDot.CelestialPalaceRepoint * 10 + 8); //宫殿红点 4581001 ->4581019 <xgId,红点ID> (MainRedDot.CelestialPalaceRepoint * 10 + 1)*1000+xgid Dictionary<int, Redpoint> hellRedPointDict = new Dictionary<int, Redpoint>(); public override void Init() { FuncOpen.Instance.OnFuncStateChangeEvent += OnFunctionStateChange; moneyItemId = int.Parse(FuncConfigConfig.Get("XiangongSet").Numerical3); GetRowIndex(out headerRowIndex, out normalRowIndexList, out tailRowIndex, out rowIndexCellDict, out awardIndexToRowIndexDict); InitHellRRedpoint(); } void InitHellRRedpoint() { List<string> list = TiandaoTreeConfig.GetKeys(); for (int i = 0; i < list.Count; i++) { int xgId = int.Parse(list[i]); hellRedPointDict[xgId] = new Redpoint(MainRedDot.CelestialPalaceRepoint * 10 + 1, (MainRedDot.CelestialPalaceRepoint * 10 + 1) * 1000 + xgId); } } public void OnBeforePlayerDataInitialize() { // 配置默认值 currentSelectedTabButtonType = 0; currentSelectedXGId = 0; // 来自封包的数据 likeStateToday = false; nowQiYun = 0; xgLikeDict.Clear(); xgUseTotalDict.Clear(); allPlayerInfoDict.Clear(); allPlayerDict.Clear(); xgHaveDict.Clear(); } public void OnPlayerLoginOk() { } public override void UnInit() { FuncOpen.Instance.OnFuncStateChangeEvent -= OnFunctionStateChange; } private void OnFunctionStateChange(int obj) { if (FuncId == obj) UpdateRedPoint(); } public void OpenCelestialPalaceWin() { currentSelectedTabButtonType = 0; currentSelectedXGId = 0; WindowCenter.Instance.Open<CelestialPalaceWin>(); WindowCenter.Instance.Open<CelestialPalaceHellWin>(); WindowCenter.Instance.Open<CelestialPalaceButtonGroupWin>(); } // 点赞仙宫 发包 public void SendA907LikePack(int xgID) { var pack = new CA907_tagCGLikeXiangong(); pack.XiangongID = (ushort)xgID; GameNetSystem.Instance.SendInfo(pack); } // 查看仙宫仙名录 发包 public void SendA906SeekPack(int xgID) { var pack = new CA906_tagCGQueryXiangongRecPlayers(); pack.XiangongID = (ushort)xgID; GameNetSystem.Instance.SendInfo(pack); } // 领取天道果 public void SendA504GetAwardPack(int awardIndex) { var pack = new CA504_tagCMPlayerGetReward(); pack.RewardType = 75; pack.DataEx = (uint)awardIndex; GameNetSystem.Instance.SendInfo(pack); } // 仙宫新晋玩家信息 public void UpdateXiangongNewPlayerInfo(HA927_tagGCXiangongNewPlayerInfo vNetData) { // 更新所有玩家信息字典 var newPlayerList = vNetData.NewPlayerList; for (int i = 0; i < newPlayerList.Length; i++) { uint playerId = newPlayerList[i].PlayerID; if (!allPlayerInfoDict.ContainsKey(playerId)) allPlayerInfoDict[playerId] = new CelestialPalacePlayer(); allPlayerInfoDict[playerId].AddTime = newPlayerList[i].AddTime; allPlayerInfoDict[playerId].ServerID = newPlayerList[i].ServerID; allPlayerInfoDict[playerId].PlayerID = newPlayerList[i].PlayerID; allPlayerInfoDict[playerId].Name = newPlayerList[i].Name; allPlayerInfoDict[playerId].LV = newPlayerList[i].LV; allPlayerInfoDict[playerId].Job = newPlayerList[i].Job; allPlayerInfoDict[playerId].RealmLV = newPlayerList[i].RealmLV; allPlayerInfoDict[playerId].EquipShowSwitch = newPlayerList[i].EquipShowSwitch; allPlayerInfoDict[playerId].EquipShowID = newPlayerList[i].EquipShowID; } // 更新仙宫对应玩家字典 int xgId = (int)vNetData.XiangongID; if (!allPlayerDict.ContainsKey(xgId)) allPlayerDict[xgId] = new List<uint>(); for (int i = 0; i < newPlayerList.Length; i++) { uint playerId = newPlayerList[i].PlayerID; if (!allPlayerDict[xgId].Contains(playerId)) allPlayerDict[xgId].Add(playerId); } xgNeedSendDict[xgId] = true; UpdateRedPoint(); UpdateXiangongNewPlayerInfoEvent?.Invoke(); } // 仙宫仙名录玩家信息 public void UpdateXiangongRecPlayerInfo(HA928_tagGCXiangongRecPlayerInfo vNetData) { // 更新所有玩家信息字典 var recPlayerList = vNetData.RecPlayerList; for (int i = 0; i < recPlayerList.Length; i++) { uint playerId = recPlayerList[i].PlayerID; if (!allPlayerInfoDict.ContainsKey(playerId)) allPlayerInfoDict[playerId] = new CelestialPalacePlayer(); allPlayerInfoDict[playerId].AddTime = recPlayerList[i].AddTime; allPlayerInfoDict[playerId].ServerID = recPlayerList[i].ServerID; allPlayerInfoDict[playerId].PlayerID = recPlayerList[i].PlayerID; allPlayerInfoDict[playerId].Name = recPlayerList[i].Name; allPlayerInfoDict[playerId].LV = recPlayerList[i].LV; allPlayerInfoDict[playerId].Job = recPlayerList[i].Job; allPlayerInfoDict[playerId].RealmLV = recPlayerList[i].RealmLV; } // 更新仙宫对应玩家字典 int xgId = (int)vNetData.XiangongID; if (!allPlayerDict.ContainsKey(xgId)) allPlayerDict[xgId] = new List<uint>(); for (int i = 0; i < recPlayerList.Length; i++) { uint playerId = recPlayerList[i].PlayerID; if (!allPlayerDict[xgId].Contains(playerId)) allPlayerDict[xgId].Add(playerId); } xgNeedSendDict[xgId] = false; UpdateRedPoint(); UpdateXiangongRecPlayerInfoEvent?.Invoke(); } public void UpdateRedPoint() { // 重置所有红点 mainRedPoint.state = RedPointState.None; tabRedPoint1.state = RedPointState.None; tabRedPoint2.state = RedPointState.None; hellLikeRedPoint.state = RedPointState.None; bookRedPoint.state = RedPointState.None; bookLikeRedPoint.state = RedPointState.None; var hellList = hellRedPointDict.Keys.ToList(); for (int i = 0; i < hellList.Count; i++) { int nowxgId = hellList[i]; hellRedPointDict[nowxgId].state = RedPointState.None; } // 有宫殿可点赞 for (int i = 0; i < hellList.Count; i++) { int nowXGId = hellList[i]; bool isLike = IsXGLike(nowXGId); bool isRoomHavePlayer = TryGetRoomNewPlayer(nowXGId, out var newPlayerList); if (!isLike && isRoomHavePlayer) { hellRedPointDict[nowXGId].state = RedPointState.Simple; } } // 每日点赞 if (!likeStateToday) hellLikeRedPoint.state = RedPointState.Simple; // 有可领取的天道果 bool isHaveAwardbyAll = IsHaveAwardbyAll(); if (isHaveAwardbyAll) tabRedPoint2.state = RedPointState.Simple; // 当前正在查看可点赞的仙宫和仙名录 if (!XiangongConfig.Has(currentSelectedXGId)) return; bool isLike1 = IsXGLike(currentSelectedXGId); bool isRoomHavePlayer1 = TryGetRoomNewPlayer(currentSelectedXGId, out var newPlayerList1); if (!isLike1 && isRoomHavePlayer1) bookLikeRedPoint.state = RedPointState.Simple; } // 仙宫信息 public void UpdateXiangongInfo(HB114_tagMCXiangongInfo vNetData) { likeStateToday = vNetData.LikeStateToday == 1; for (int i = 0; i < vNetData.XiangongList.Length; i++) { int xgID = vNetData.XiangongList[i].XiangongID; bool isLikeStateToday = vNetData.XiangongList[i].LikeStateToday == 1; xgLikeDict[xgID] = isLikeStateToday; } UpdateRedPoint(); UpdateXiangongInfoEvent?.Invoke(); } // 天道树信息 public void UpdateTiandaoTreeInfo(HB115_tagMCTiandaoTreeInfo vNetData) { nowQiYun = vNetData.Qiyun; xgHaveDict = ParseAwardStateList(vNetData.AwardStateList); UpdateRedPoint(); UpdateTiandaoTreeInfoEvent?.Invoke(); } // 累计消耗货币信息 public void UpdateUseMoneyTotalInfo(HB116_tagMCUseMoneyTotalInfo vNetData) { for (int i = 0; i < vNetData.InfoList.Length; i++) { int moneyType = vNetData.InfoList[i].MoneyType; uint useTotal = vNetData.InfoList[i].UseTotal; xgUseTotalDict[moneyType] = useTotal; if (moneyType == MoneyType) { UpdateRedPoint(); UpdateUseMoneyTotalInfoEvent?.Invoke(); } } } // 解析奖励索引对应的领取状态 Dictionary<int, bool> ParseAwardStateList(uint[] AwardStateList) { Dictionary<int, bool> xgHaveDict = new Dictionary<int, bool>(); for (int i = 0; i < AwardStateList.Length; i++) { uint currentState = AwardStateList[i]; for (int j = 0; j < 31; j++) { int awardIndex = i * 31 + j; bool isReceived = (currentState & (1U << j)) != 0; xgHaveDict[awardIndex] = isReceived; } } return xgHaveDict; } // 判断当前仙宫是否需要重新发包获取数据 public bool IsNeedSendA906Pack(int xgId) { if (!xgNeedSendDict.TryGetValue(xgId, out bool isNeed)) return true; return isNeed; } // 获取当前这档天道果的显示状态 0 不可领取(未达成) 1 可领取 2 已领取 public int GetGainState(int awardIndex) { // 已达成 if (IsAwardArrive(awardIndex)) { //可领取? return IsHaveAward(awardIndex) ? 2 : 1; } else { return 0; } } // 当前天道果的所需值是否达成 public bool IsAwardArrive(int awardIndex) { return TiandaoTreeConfig.Has(awardIndex) ? nowQiYun >= TiandaoTreeConfig.Get(awardIndex).NeedQiyun : false; } // 当前天道果的奖励是否领取 public bool IsHaveAward(int awardIndex) { return xgHaveDict != null && xgHaveDict.TryGetValue(awardIndex, out bool isHave) ? isHave : false; } //当前是否有可领取的天道果 public bool IsHaveAwardbyAll() { if (xgHaveDict == null) return false; var list = TiandaoTreeConfig.GetKeys(); for (int i = 0; i < list.Count; i++) { int awardIndex = int.Parse(list[i]); if (GetGainState(awardIndex) == 1) return true; } return false; } // 当前这档奖励多少个天道果 public int GetAwardCount(int awardIndex) { if (!TiandaoTreeConfig.Has(awardIndex)) return 0; TiandaoTreeConfig config = TiandaoTreeConfig.Get(awardIndex); int count = 0; int[][] awardArr = config.AwardItemList; for (int i = 0; i < awardArr.Length; i++) { if (awardArr[i][0] == moneyItemId) { count += awardArr[i][1]; } } return count; } // 尝试自动领取天道果 并返回排序的奖励列表 true 有天道果能被自动领取 false 没有天道果能被自动领取 public bool TryAutoHaveAward(out List<Item> awardList) { awardList = new List<Item>(); bool isHave = false; // <物品id,物品数量> 奖励物品信息字典 Dictionary<int, int> tempDict = new Dictionary<int, int>(); //发包索引列表 List<int> allAwardItemList = new List<int>(); List<int> xgHaveList = xgHaveDict.Keys.ToList(); for (int i = 0; i < xgHaveList.Count; i++) { int index = xgHaveList[i]; if (!TiandaoTreeConfig.Has(index)) continue; int state = GetGainState(index); if (state == 1) { isHave = true; if (!allAwardItemList.Contains(index)) allAwardItemList.Add(index); var awardItemList = TiandaoTreeConfig.Get(index).AwardItemList; for (int j = 0; j < awardItemList.Length; j++) { int itemId = awardItemList[j][0]; int count = awardItemList[j][1]; if (!tempDict.ContainsKey(itemId)) { tempDict[itemId] = count; } else { tempDict[itemId] += count; } } } } if (isHave) { for (int i = 0; i < allAwardItemList.Count; i++) SendA504GetAwardPack(allAwardItemList[i]); var list = tempDict.Keys.ToList(); list.Sort((a, b) => SortByItemColor(a, b, tempDict)); for (int i = 0; i < list.Count; i++) { int itemId = list[i]; int allCount = tempDict[itemId]; awardList.Add(new Item() { id = itemId, count = allCount }); } } return isHave; } int SortByItemColor(int a, int b, Dictionary<int, int> tempDict) { int count1 = tempDict[a]; int count2 = tempDict[b]; int quality1 = ItemConfig.Get(a).ItemColor; int quality2 = ItemConfig.Get(b).ItemColor; //品质高的排在前面 if (quality1 != quality2) { return quality2.CompareTo(quality1); } // 品质相同时,数量多的排在前面 if (count1 != count2) { return count2.CompareTo(count1); } // 如果品质和数量都相同,保持原有顺序 return 0; } // 获得树冠,树枝,树根的行数和方向 public void GetRowIndex(out int headerRowIndex, out List<int[]> normalRowIndexList, out int tailRowIndex, out Dictionary<int, List<int>> rowIndexCellDict, out Dictionary<int, int> awardIndexToRowIndexDict) { headerRowIndex = 0; normalRowIndexList = new List<int[]>(); tailRowIndex = 0; awardIndexToRowIndexDict = new Dictionary<int, int>(); rowIndexCellDict = new Dictionary<int, List<int>>(); List<string> list = TiandaoTreeConfig.GetKeys(); //树冠在第0行 有3个果实 int rowIndex = 0; int count = list.Count; rowIndexCellDict[rowIndex] = new List<int>(); for (int i = 0; i < MaxHeaderCount; i++) { int awardIndex = count - i; rowIndexCellDict[rowIndex].Add(awardIndex); awardIndexToRowIndexDict[awardIndex] = rowIndex; } rowIndexCellDict[rowIndex].Sort(); rowIndexCellDict[rowIndex].Reverse(); count -= MaxHeaderCount; headerRowIndex = rowIndex; //一节树干有3个果实 由两节树干组成 count -= MaxTailCount; count /= MaxNormalCount; for (int i = 0; i < count; i++) { rowIndex += 1; normalRowIndexList.Add(new int[2] { rowIndex, i % 2 == 1 ? 0 : 1 }); rowIndexCellDict[rowIndex] = new List<int>(); for (int j = MaxNormalCount - 1; j >= 0; j--) { int awardIndex = (j + list.Count - MaxTailCount) - rowIndex * MaxNormalCount; rowIndexCellDict[rowIndex].Add(awardIndex); awardIndexToRowIndexDict[awardIndex] = rowIndex; } rowIndexCellDict[rowIndex].Sort(); rowIndexCellDict[rowIndex].Reverse(); } //树根在最后一行 有2个果实 rowIndex += 1; tailRowIndex = rowIndex; rowIndexCellDict[rowIndex] = new List<int>(); for (int i = MaxTailCount - 1; i >= 0; i--) { int awardIndex = i + 1; rowIndexCellDict[rowIndex].Add(awardIndex); awardIndexToRowIndexDict[awardIndex] = rowIndex; } rowIndexCellDict[rowIndex].Sort(); rowIndexCellDict[rowIndex].Reverse(); } // 获取领取到了哪一层 public int GetJumpRowIndex() { int lastRowIndex = tailRowIndex;//玩家最后可领取所在层,默认是最后一层 List<int> xgHaveList = xgHaveDict.Keys.ToList(); for (int i = 0; i < xgHaveList.Count; i++) { int awardIndex = xgHaveList[i]; if (!TiandaoTreeConfig.Has(awardIndex)) continue; int state = GetGainState(awardIndex); if (state == 1 || state == 2) { if (awardIndexToRowIndexDict != null && awardIndexToRowIndexDict.TryGetValue(awardIndex, out int rowIndex)) { lastRowIndex = rowIndex; } } } return Mathf.Max(lastRowIndex, 0); } // 获取总共消耗了多少天道果 public uint GetAllCostCount() { return xgUseTotalDict != null && xgUseTotalDict.TryGetValue(MoneyType, out uint count) ? count : 0; } // 当前仙宫今日是否点赞 public bool IsXGLike(int xgId) { return xgLikeDict != null && xgLikeDict.TryGetValue(xgId, out bool isLike) ? isLike : false; } // 当前玩家是指定仙宫的新晋仙官吗 public bool IsNewPlayer(int xgId, uint nowPlayerId) { if (!TryGetRoomNewPlayer(xgId, out var newPlayerList) || newPlayerList == null) return false; return newPlayerList.Contains(nowPlayerId); } // 当前宫殿是否有新晋仙官 并返回新晋仙官playerId列表 public bool TryGetRoomNewPlayer(int xgId, out List<uint> newPlayerList) { newPlayerList = new List<uint>(); var serverNow = TimeUtility.ServerNow; if (!XiangongConfig.Has(xgId) || allPlayerDict == null || !allPlayerDict.TryGetValue(xgId, out var list) || list == null || allPlayerInfoDict == null) return false; for (int i = 0; i < list.Count; i++) { if (!allPlayerInfoDict.TryGetValue(list[i], out var celestialPalacePlayer) || celestialPalacePlayer == null) continue; uint showTimes = (uint)XiangongConfig.Get(xgId).ShowDays * 24 * 60 * 60; var overTime = TimeUtility.GetTime((uint)(celestialPalacePlayer.AddTime + showTimes)); if (overTime >= serverNow) newPlayerList.Add(list[i]); } return newPlayerList.Count > 0; } // 获得排序后的指定仙宫的所有玩家详细信息(仙名录) public List<CelestialPalacePlayer> GetSortXGPlayInfo(int xgId) { List<CelestialPalacePlayer> xgPlayerList = GetXGPlayInfo(xgId); xgPlayerList.Sort(SortPlayInfoByAddTime); return xgPlayerList; } // 获得指定仙宫的所有玩家详细信息(仙名录) public List<CelestialPalacePlayer> GetXGPlayInfo(int xgId) { List<CelestialPalacePlayer> xgPlayerList = new List<CelestialPalacePlayer>(); if (allPlayerDict == null || !allPlayerDict.TryGetValue(xgId, out var playerIdList)) return xgPlayerList; for (int i = 0; i < playerIdList.Count; i++) { uint playerId = playerIdList[i]; if (allPlayerInfoDict == null || !allPlayerInfoDict.TryGetValue(playerId, out var celestialPalacePlayerInfo)) continue; xgPlayerList.Add(celestialPalacePlayerInfo); } return xgPlayerList; } // 根据新晋时间戳排序仙名录 public int SortPlayInfoByAddTime(CelestialPalacePlayer a, CelestialPalacePlayer b) { return TimeUtility.GetTime(b.AddTime).CompareTo(TimeUtility.GetTime(a.AddTime)); } //展示称号 public void ShowTitle(int titleId, ImageEx imgTitle) { DienstgradConfig config = DienstgradConfig.Get(titleId); UIFrame frame = imgTitle.GetComponent<UIFrame>(); if (UIFrameMgr.Inst.ContainsFace(config.Image)) { if (frame == null) frame = imgTitle.gameObject.AddComponent<UIFrame>(); imgTitle.raycastTarget = false; frame.ResetFrame(config.Image); frame.enabled = true; } else { if (frame != null) frame.enabled = false; imgTitle.SetSprite(config.Image); } } // 获取当前时间戳的年/月/日字符串 public string GetAddTimeToYearMonthDay(uint AddTime) { var time = TimeUtility.GetTime(AddTime); return Language.Get("CelestialPalace10", time.Year, time.Month, time.Day); } public int GetItemId(RoleEquipType type, uint[] equipShowID) { if (equipShowID != null) { foreach (var id in equipShowID) { var itemConfig = ItemConfig.Get((int)id); if (itemConfig != null && itemConfig.EquipPlace == (int)type) { return (int)id; } } } return 0; } } } public class CelestialPalacePlayer { public uint AddTime; // 新晋时间戳 public uint ServerID; public uint PlayerID; public string Name; // 玩家名,size = NameLen public ushort LV; // 玩家等级 public byte Job; // 玩家职业 public ushort RealmLV; // 玩家境界 public uint EquipShowSwitch; public uint[] EquipShowID; } System/CelestialPalace/CelestialPalaceModel.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: f794e14743dc19c428f5ef0f0f05fb36 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceNameListCell.cs
New file @@ -0,0 +1,46 @@ using System.Collections.Generic; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceNameListCell : CellView { [SerializeField] ImageEx imgHead; [SerializeField] ImageEx imgTitle; [SerializeField] TextEx txtNum; [SerializeField] TextEx txtDate; [SerializeField] TextEx txtNew; [SerializeField] TextEx txtPlayerInfo; [SerializeField] TextEx txtServerName; CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void Display(int index) { int nowXGId = model.currentSelectedXGId; if (nowXGId == 0) return; List<CelestialPalacePlayer> xgPlayerList = model.GetSortXGPlayInfo(nowXGId); if (xgPlayerList == null || index < 0 || index > xgPlayerList.Count - 1) return; CelestialPalacePlayer celestialPalacePlayer = xgPlayerList[index]; imgHead.SetSprite(UIHelper.GetHeadIcon((int)celestialPalacePlayer.Job)); int titleId = XiangongConfig.Get(nowXGId).TitleID; model.ShowTitle(titleId, imgTitle); string serverName = ServerListCenter.Instance.GetServerName((int)celestialPalacePlayer.ServerID); txtServerName.text = serverName; int realmLV = celestialPalacePlayer.RealmLV; string name = celestialPalacePlayer.Name; if (realmLV > 0) { txtPlayerInfo.text = Language.Get("CelestialPalace08", serverName, RealmConfig.Get(realmLV).Name, name); } else { txtPlayerInfo.text = Language.Get("CelestialPalace09", serverName, name); } txtDate.text = model.GetAddTimeToYearMonthDay(celestialPalacePlayer.AddTime); bool isRoomHavePlayer = model.IsNewPlayer(nowXGId, celestialPalacePlayer.PlayerID); txtNew.SetActive(isRoomHavePlayer); txtNum.SetActive(!isRoomHavePlayer); txtNum.text = Language.Get("CelestialPalace11", xgPlayerList.Count - index); } } System/CelestialPalace/CelestialPalaceNameListCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 86161224ebe29034ba61b0fa9f449cac MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceNameListWin.cs
New file @@ -0,0 +1,102 @@ using System.Collections.Generic; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceNameListWin : Window { [SerializeField] ScrollerController scroller; [SerializeField] ButtonEx btnClose; [SerializeField] ButtonEx btnLike; [SerializeField] ImageEx imgLiked; int nowXGId; // 当前查看的仙宫ID List<CelestialPalacePlayer> xgPlayerList; CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } protected override void BindController() { btnClose.SetListener(CloseClick); btnLike.SetListener(OnClickLike); } protected override void OnPreOpen() { model.UpdateXiangongInfoEvent += OnUpdateXiangongInfoEvent; model.UpdateXiangongRecPlayerInfoEvent += OnUpdateXiangongRecPlayerInfoEvent; model.UpdateXiangongNewPlayerInfoEvent += OnUpdateXiangongNewPlayerInfoEvent; scroller.OnRefreshCell += OnRefreshCell; Display(); } protected override void OnPreClose() { model.UpdateXiangongInfoEvent -= OnUpdateXiangongInfoEvent; model.UpdateXiangongRecPlayerInfoEvent -= OnUpdateXiangongRecPlayerInfoEvent; model.UpdateXiangongNewPlayerInfoEvent -= OnUpdateXiangongNewPlayerInfoEvent; scroller.OnRefreshCell -= OnRefreshCell; } private void OnUpdateXiangongNewPlayerInfoEvent() { Display(); CreateScroller(); } private void OnUpdateXiangongRecPlayerInfoEvent() { Display(); CreateScroller(); } private void OnUpdateXiangongInfoEvent() { Display(); } protected override void OnAfterOpen() { CreateScroller(); } void Display() { nowXGId = model.currentSelectedXGId; if (nowXGId == 0) return; bool isLike = model.IsXGLike(nowXGId); bool isRoomHavePlayer = model.TryGetRoomNewPlayer(nowXGId, out var newPlayerList); btnLike.SetActive(!isLike && isRoomHavePlayer); imgLiked.SetActive(isLike || !isRoomHavePlayer); } void CreateScroller() { xgPlayerList = model.GetSortXGPlayInfo(nowXGId); if (xgPlayerList == null) return; scroller.Refresh(); for (int i = 0; i < xgPlayerList.Count; i++) { scroller.AddCell(ScrollerDataType.Header, i); } scroller.Restart(); } void OnClickLike() { model.SendA907LikePack(nowXGId); } void OnRefreshCell(ScrollerDataType type, CellView cell) { var _cell = cell as CelestialPalaceNameListCell; _cell.Display(_cell.index); } protected override void OnAfterClose() { } protected override void AddListeners() { } } System/CelestialPalace/CelestialPalaceNameListWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: f2252e4a3c5b84d4c8757225c916d161 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceRoomWin.cs
New file @@ -0,0 +1,177 @@ using UnityEngine; using UnityEngine.UI; using vnxbqy.UI; public class CelestialPalaceRoomWin : Window { [SerializeField] Transform havePlayer; [SerializeField] Transform noPlayer; [SerializeField] ButtonEx btnNameList; [SerializeField] ButtonEx btnLeft; [SerializeField] ButtonEx btnRight; [SerializeField] TextEx txtPlayerInfo; [SerializeField] TextEx txtLv; [SerializeField] TextEx txtServerName; [SerializeField] ImageEx imgHead; [SerializeField] ImageEx imgTitleNoPlayer; [SerializeField] ImageEx imgTitlePlayer; [SerializeField] TextEx txtTitle; [SerializeField] RawImage rawImage; int xgId; int currentIndex; //当前查看的新晋仙官列表索引 CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } TitleModel titleModel { get { return ModelCenter.Instance.GetModel<TitleModel>(); } } protected override void BindController() { btnNameList.SetListener(OnClickNameList); btnLeft.SetListener(OnClickLeft); btnRight.SetListener(OnClickRight); } protected override void OnPreOpen() { model.UpdateXiangongRecPlayerInfoEvent += OnUpdateXiangongRecPlayerInfoEvent; model.UpdateXiangongNewPlayerInfoEvent += OnUpdateXiangongNewPlayerInfoEvent; currentIndex = 0; Display(); model.UpdateRedPoint(); } protected override void OnPreClose() { model.UpdateXiangongRecPlayerInfoEvent -= OnUpdateXiangongRecPlayerInfoEvent; model.UpdateXiangongNewPlayerInfoEvent -= OnUpdateXiangongNewPlayerInfoEvent; } private void OnUpdateXiangongNewPlayerInfoEvent() { Display(); model.UpdateRedPoint(); } void OnUpdateXiangongRecPlayerInfoEvent() { WindowCenter.Instance.Open<CelestialPalaceNameListWin>(); } void Display() { xgId = model.currentSelectedXGId; if (xgId <= 0) { CloseClick(); return; } txtTitle.text = Language.Get(StringUtility.Contact("CelestialPalaceName_", xgId)); bool isRoomHavePlayer = model.TryGetRoomNewPlayer(xgId, out var newPlayerList); havePlayer.SetActive(isRoomHavePlayer); noPlayer.SetActive(!isRoomHavePlayer); btnLeft.SetActive(isRoomHavePlayer && currentIndex > 0); btnRight.SetActive(isRoomHavePlayer && currentIndex < newPlayerList.Count - 1); rawImage.SetActive(isRoomHavePlayer); int titleId = XiangongConfig.Get(xgId).TitleID; //存在新晋仙官 if (isRoomHavePlayer) { if (currentIndex < 0 || currentIndex > newPlayerList.Count - 1) return; uint nowPlayerId = newPlayerList[currentIndex]; if (model.allPlayerInfoDict == null || !model.allPlayerInfoDict.TryGetValue(nowPlayerId, out var celestialPalacePlayer)) return; model.ShowTitle(titleId, imgTitlePlayer); imgHead.SetSprite(UIHelper.GetHeadIcon((int)celestialPalacePlayer.Job)); txtLv.text = Language.Get("PlayerDetail_Level", celestialPalacePlayer.LV); string serverName = ServerListCenter.Instance.GetServerName((int)celestialPalacePlayer.ServerID); txtServerName.text = serverName; int realmLV = celestialPalacePlayer.RealmLV; string name = celestialPalacePlayer.Name; if (realmLV > 0) { txtPlayerInfo.text = Language.Get("CelestialPalace08", serverName, RealmConfig.Get(realmLV).Name, name); } else { txtPlayerInfo.text = Language.Get("CelestialPalace09", serverName, name); } ShowPlayer(rawImage, celestialPalacePlayer.Job, celestialPalacePlayer.EquipShowSwitch, celestialPalacePlayer.EquipShowID); } else { model.ShowTitle(titleId, imgTitleNoPlayer); } } void OnClickNameList() { if (model.IsNeedSendA906Pack(xgId)) { model.SendA906SeekPack(xgId); } else { WindowCenter.Instance.Open<CelestialPalaceNameListWin>(); } } void OnClickLeft() { currentIndex -= 1; Display(); } void OnClickRight() { currentIndex += 1; Display(); } public void ShowPlayer(RawImage rawImage, int Job, uint EquipShowSwitch, uint[] EquipShowID) { int _suitLevel = (int)(EquipShowSwitch % 10); int clothes = model.GetItemId(RoleEquipType.Clothes, EquipShowID); int weapon = model.GetItemId(RoleEquipType.Weapon, EquipShowID); int weapon2 = model.GetItemId(RoleEquipType.Weapon2, EquipShowID); int fashionClothes = model.GetItemId(RoleEquipType.FashionClothes, EquipShowID); int fashionWeapon = model.GetItemId(RoleEquipType.FashionWeapon, EquipShowID); int fashionWeapon2 = model.GetItemId(RoleEquipType.FashionWeapon2, EquipShowID); var data = new UI3DPlayerExhibitionData { job = Job, fashionClothesId = fashionClothes, fashionWeaponId = fashionWeapon, fashionSecondaryId = fashionWeapon2, clothesId = clothes, suitLevel = _suitLevel, weaponId = weapon, wingsId = 0, secondaryId = weapon2, reikiRootEffectId = 0, isDialogue = false, equipLevel = (int)EquipShowSwitch / 10 % 100, scale = 1.0f, //titleID = player.playerInfo.TitleID, }; rawImage.SetActive(true); UI3DModelExhibition.InstanceClone7.ShowPlayer(rawImage, data); rawImage.raycastTarget = false; } protected override void OnAfterOpen() { } protected override void OnAfterClose() { } protected override void AddListeners() { } } System/CelestialPalace/CelestialPalaceRoomWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 1a9c76517bbef9c40b342f1f7952dda8 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceShopCell.cs
New file @@ -0,0 +1,75 @@ using UnityEngine; using vnxbqy.UI; public class CelestialPalaceShopCell : MonoBehaviour { [SerializeField] ItemCell itemCell; [SerializeField] ImageEx imgLock; [SerializeField] ImageEx imgItemMoneyIcon; [SerializeField] ImageEx imgSell; [SerializeField] ImageEx imgChoose; [SerializeField] TextEx txtItemName; [SerializeField] TextEx txtItemPrice; [SerializeField] TextEx txtPurchaseLimitCount; [SerializeField] TextEx txtLockTip; [SerializeField] ButtonEx btnBuy; [SerializeField] ButtonEx btnChoose; StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void SetDisplay(StoreConfig storeConfig) { ItemConfig itemConfig = ItemConfig.Get(storeModel.GetReplaceId(storeConfig.ID, storeConfig.ItemID)); if (itemConfig == null) return; ItemCellModel cellModel = new ItemCellModel(itemConfig.ID, false, (ulong)storeConfig.ItemCnt); itemCell.button.enabled = false; itemCell.Init(cellModel); txtItemName.text = itemConfig.ItemName; txtItemName.color = UIHelper.GetUIColor(itemConfig.ItemColor, true); imgItemMoneyIcon.SetIconWithMoneyType(storeConfig.MoneyType); txtItemPrice.text = UIHelper.ReplaceLargeNum((ulong)(storeConfig.MoneyNumber)); bool isLimitBuy = BuyItemController.Instance.CheckIsLimitBuyCnt(storeConfig, out var canBuyCnt, out var addBuyCnt); BuyShopItemLimit shopItemLimit = storeModel.GetBuyShopLimit((uint)storeConfig.ID); int remainNum = canBuyCnt; int buyCnt = 0; if (shopItemLimit != null) { buyCnt = shopItemLimit.BuyCnt; remainNum = canBuyCnt - buyCnt; } uint allCostCount = model.GetAllCostCount(); bool isCanBuy = allCostCount >= storeConfig.LimitValue; btnBuy.SetActive(isCanBuy); imgLock.SetActive(!isCanBuy); txtLockTip.SetActive(!isCanBuy); txtLockTip.text = Language.Get("CelestialPalace04", storeConfig.LimitValue); if (isLimitBuy) { txtPurchaseLimitCount.SetActive(isCanBuy); txtPurchaseLimitCount.text = Language.Get("CelestialPalace05", buyCnt, canBuyCnt); imgSell.SetActive(remainNum == 0); } else { txtPurchaseLimitCount.SetActive(false); imgSell.SetActive(false); } bool isChoose = storeConfig.ID == model.currentSelectedShopGoodId; imgChoose.SetActive(isChoose); btnBuy.SetListener(() => { if (!isCanBuy) return; storeModel.OnClickShopCell(storeConfig); }); btnChoose.SetListener(() => { model.currentSelectedShopGoodId = storeConfig.ID; }); } } System/CelestialPalace/CelestialPalaceShopCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 960b00d1e5a49b945a42a26b77ab42fc MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceShopWin.cs
New file @@ -0,0 +1,269 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using vnxbqy.UI; public class CelestialPalaceShopWin : Window { [SerializeField] ImageEx imgMoneyIcon1; [SerializeField] ImageEx imgMoneyIcon2; [SerializeField] RawImage imgModel; [SerializeField] ImageEx imgItem; [SerializeField] TextEx txtExpenditureAmount; [SerializeField] TextEx txtItemName; [SerializeField] RichText txtItemInfo; [SerializeField] TextEx txtTotalAmount; [SerializeField] ScrollerController scroller; [SerializeField] GetWayTrigger getWayTrigger; StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } FashionDressModel fashionDressModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } List<StoreModel.StoreData> shoplist; int chooseGoodId = 0; protected override void BindController() { } protected override void OnPreOpen() { storeModel.storeFuncType = (StoreFunc)model.StoreType; scroller.OnRefreshCell += OnRefreshCell; storeModel.RefreshBuyShopLimitEvent += RefreshStore; PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefreshEvent; model.SelectedShopCellClickedEvent += OnSelectedShopCellClickedEvent; model.UpdateUseMoneyTotalInfoEvent += OnUpdateUseMoneyTotalInfoEvent; Display(); } private void OnUpdateUseMoneyTotalInfoEvent() { Display(); } protected override void OnPreClose() { scroller.OnRefreshCell -= OnRefreshCell; storeModel.RefreshBuyShopLimitEvent -= RefreshStore; PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefreshEvent; model.SelectedShopCellClickedEvent -= OnSelectedShopCellClickedEvent; model.UpdateUseMoneyTotalInfoEvent -= OnUpdateUseMoneyTotalInfoEvent; } private void OnSelectedShopCellClickedEvent() { scroller.m_Scorller.RefreshActiveCellViews(); UpdateShow(model.currentSelectedShopGoodId); } void RefreshStore() { scroller.m_Scorller.RefreshActiveCellViews(); } void OnPlayerDataRefreshEvent(PlayerDataType type) { if (type == PlayerDataType.default39) { Display(); } } protected override void OnAfterOpen() { CreateScroller(); } void CreateScroller() { shoplist = storeModel.TryGetStoreDatas(storeModel.storeFuncType); if (shoplist == null) { DebugEx.Log("商店数据为空"); return; } shoplist.Sort(CmpStore); model.currentSelectedShopGoodId = shoplist[0].shopId; scroller.Refresh(); if (shoplist.Count > 0) { int cellsPerRow = 2; int numberOfRows = Mathf.CeilToInt((float)shoplist.Count / cellsPerRow); for (int i = 0; i < numberOfRows; i++) { scroller.AddCell(ScrollerDataType.Header, i); } } scroller.Restart(); } protected override void OnAfterClose() { } void Display() { getWayTrigger.SetItemId(model.moneyItemId); imgMoneyIcon1.SetIconWithMoneyType(model.MoneyType); imgMoneyIcon2.SetIconWithMoneyType(model.MoneyType); txtTotalAmount.text = UIHelper.GetMoneyCnt(model.MoneyType).ToString(); txtExpenditureAmount.text = model.GetAllCostCount().ToString(); } void UpdateShow(int goodId) { if (!StoreConfig.Has(goodId)) return; int itemId = StoreConfig.Get(goodId).ItemID; if (!ItemConfig.Has(itemId)) return; ItemConfig itemConfig = ItemConfig.Get(itemId); txtItemName.text = itemConfig.ItemName; txtItemInfo.text = itemConfig.Description; txtTotalAmount.text = UIHelper.GetMoneyCnt(model.MoneyType).ToString(); ShowModel(itemId); } public void ShowModel(int itemId) { UI3DTreasureExhibition.Instance.Stop(); var itemConfig = ItemConfig.Get(itemId); imgModel.SetActive(false); imgItem.SetActive(false); switch (itemConfig.Type) { //!!! 参考灵器 case 113://翅膀 imgModel.SetActive(true); var config = SpiritWeaponConfig.Get(itemId); UI3DModelExhibition.Instance.ShowWing(config.NPCID, imgModel); break; case 114://守护1 case 115://守护2 imgModel.SetActive(true); config = SpiritWeaponConfig.Get(itemId); UI3DModelExhibition.Instance.ShowNPC(config.NPCID, Vector3.zero, imgModel, false, false); break; case 116://绝世武器 case 117://绝世副手 imgModel.SetActive(true); config = SpiritWeaponConfig.Get(itemId); UI3DModelExhibition.Instance.ShowEquipment(itemConfig.ChangeOrd, config.Rotation, config.scale, imgModel); break; case 41://坐骑碎片 imgModel.SetActive(true); var horseId = HorseConfig.GetItemUnLockHorse(itemId); HorseConfig _model = HorseConfig.Get(horseId); UI3DModelExhibition.Instance.ShowHourse(_model.Model, imgModel); break; case 26://灵兽碎片 imgModel.SetActive(true); var petId = PetInfoConfig.GetItemUnLockPet(itemId); var npcConfig = NPCConfig.Get(petId); UI3DModelExhibition.Instance.ShowNPC(petId, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, imgModel); break; case 82://时装碎片 case 83://时装激活道具 imgModel.SetActive(true); if (itemConfig != null) { var fashionType = 0; var fashionId = 0; var isFashion = tipsModel.TryGetItemFashionData(itemConfig.ID, out fashionType, out fashionId); if (isFashion) { List<int> fashionIds = null; fashionDressModel.TryGetFashionIds(fashionType, out fashionIds); if (fashionIds != null && fashionIds.Count > 0) { UI3DModelExhibition.Instance.ShowPlayer(imgModel, SetFashionDressData(fashionIds)); } } } break; default: imgItem.SetActive(true); imgItem.SetSprite(itemConfig.IconKey); break; } } UI3DPlayerExhibitionData SetFashionDressData(List<int> fashionIds) { var job = PlayerDatas.Instance.baseData.Job; var fashionClothesId = 0; var fashionWeaponId = 0; var fashionSecondaryId = 0; foreach (var fashionId in fashionIds) { FashionDress fashionDress = null; var isFashion = fashionDressModel.TryGetFashionDress(fashionId, out fashionDress); if (isFashion) { int itemId = fashionDress.requireLevelUpItem; var itemConfig = ItemConfig.Get(itemId); switch (fashionDress.fashionDressType) { case 1: fashionClothesId = fashionDress.GetEquipItemId(); break; case 2: fashionWeaponId = fashionDress.GetEquipItemId(); break; case 3: fashionSecondaryId = fashionDress.GetEquipItemId(); break; } } } var data = new UI3DPlayerExhibitionData() { job = job, fashionClothesId = fashionClothesId, fashionWeaponId = fashionWeaponId, fashionSecondaryId = fashionSecondaryId, isDialogue = false, }; return data; } protected override void AddListeners() { } void OnRefreshCell(ScrollerDataType type, CellView cell) { int cellsPerRow = 2; int length = cell.transform.childCount; for (int i = 0; i < length; i++) { int cellIndex = cell.index * cellsPerRow + i; var shopCell = cell.transform.GetChild(i).GetComponent<CelestialPalaceShopCell>(); if (cellIndex < shoplist.Count) { shopCell.SetActive(true); shopCell.SetDisplay(shoplist[cellIndex].storeConfig); } else { shopCell.SetActive(false); } } } //售罄商品排在最后 int CmpStore(StoreModel.StoreData a, StoreModel.StoreData b) { bool isSellOutA = BuyItemController.Instance.IsSellOut(a.storeConfig.ID, 0); bool isSellOutB = BuyItemController.Instance.IsSellOut(b.storeConfig.ID, 0); if (isSellOutA != isSellOutB) return isSellOutA.CompareTo(isSellOutB); return a.storeConfig.ShopSort.CompareTo(b.storeConfig.ShopSort); } } System/CelestialPalace/CelestialPalaceShopWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b0497e6c13b8f0c4baf59075d874b85d MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceTreeGain.cs
New file @@ -0,0 +1,47 @@ using vnxbqy.UI; using UnityEngine; using System.Collections.Generic; public class CelestialPalaceTreeGain : MonoBehaviour { [SerializeField] TextEx txtAwardCount; [SerializeField] TextEx txtFortuneCount; [SerializeField] ButtonEx btnGain; [SerializeField] UIEffect uiEffect; TiandaoTreeConfig config; int awardIndex; int state; CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void Display(int awardIndex) { this.awardIndex = awardIndex; if (!TiandaoTreeConfig.Has(awardIndex)) return; uiEffect.Stop(); // 获取当前这档天道果的显示状态 0 不可领取(未达成) 1 可领取 2 已领取 state = model.GetGainState(awardIndex); btnGain.SetColorful(null, state != 2); // 领取后置灰 if (state == 1) uiEffect.Play(); config = TiandaoTreeConfig.Get(awardIndex); txtAwardCount.text = Language.Get("CelestialPalace13", model.GetAwardCount(awardIndex)); txtFortuneCount.text = Language.Get("CelestialPalace12", model.nowQiYun, config.NeedQiyun); btnGain.SetListener(OnClickGain); } void OnClickGain() { if (state == 1) { if (model.TryAutoHaveAward(out List<Item> awardList) && !awardList.IsNullOrEmpty()) { ItemLogicUtility.Instance.ShowGetItem(awardList, "", 5); } } else { ItemTipUtility.Show(model.moneyItemId); } } } System/CelestialPalace/CelestialPalaceTreeGain.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: bd23934198bb2a24e8bef285458f0202 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceTreeHeaderCell.cs
New file @@ -0,0 +1,19 @@ using System.Collections.Generic; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceTreeHeaderCell : CellView { [SerializeField] List<CelestialPalaceTreeGain> gainList = new List<CelestialPalaceTreeGain>(); CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void Display(int rowIndex) { if (model.rowIndexCellDict == null || !model.rowIndexCellDict.TryGetValue(rowIndex, out var list)) return; for (int i = 0; i < list.Count; i++) { int awardIndex = list[i]; gainList[i].Display(awardIndex); } } } System/CelestialPalace/CelestialPalaceTreeHeaderCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 1ec61b331dd302a4ab2f55e01b228be5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceTreeNomalCell.cs
New file @@ -0,0 +1,33 @@ using System.Collections.Generic; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceTreeNormalCell : CellView { [SerializeField] Transform leftContect; [SerializeField] Transform rightContect; [SerializeField] List<CelestialPalaceTreeGain> leftgainList = new List<CelestialPalaceTreeGain>(); [SerializeField] List<CelestialPalaceTreeGain> rightgainList = new List<CelestialPalaceTreeGain>(); CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void Display(int rowIndex, CellView cellView) { if (model.rowIndexCellDict == null || !model.rowIndexCellDict.TryGetValue(rowIndex, out var list)) return; int direction = cellView.info.Value.infoInt1;//0 左 1 右 leftContect.SetActive(direction == 0); rightContect.SetActive(direction != 0); for (int i = 0; i < list.Count; i++) { int awardIndex = list[i]; if (direction == 0) { leftgainList[i].Display(awardIndex); } else { rightgainList[i].Display(awardIndex); } } } } System/CelestialPalace/CelestialPalaceTreeNomalCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: e5e38ed567a80cb40a0d469bf856aca9 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceTreeTailCell.cs
New file @@ -0,0 +1,20 @@ using System.Collections.Generic; using UnityEngine; using vnxbqy.UI; public class CelestialPalaceTreeTailCell : CellView { [SerializeField] List<CelestialPalaceTreeGain> gainList = new List<CelestialPalaceTreeGain>(); CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } public void Display(int rowIndex) { if (model.rowIndexCellDict == null || !model.rowIndexCellDict.TryGetValue(rowIndex, out var list)) return; for (int i = 0; i < list.Count; i++) { int awardIndex = list[i]; gainList[i].Display(awardIndex); } } } System/CelestialPalace/CelestialPalaceTreeTailCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b299b59b035f46840b1001ec8ff73fd5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceTreeWin.cs
New file @@ -0,0 +1,81 @@ using UnityEngine; using vnxbqy.UI; public class CelestialPalaceTreeWin : Window { [SerializeField] ScrollerController scroller; CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } } protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { scroller.OnRefreshCell += OnRefreshCell; model.UpdateTiandaoTreeInfoEvent += OnUpdateTiandaoTreeInfoEvent; } protected override void OnPreClose() { scroller.OnRefreshCell -= OnRefreshCell; model.UpdateTiandaoTreeInfoEvent -= OnUpdateTiandaoTreeInfoEvent; } private void OnUpdateTiandaoTreeInfoEvent() { scroller.m_Scorller.RefreshActiveCellViews(); } protected override void OnAfterOpen() { CreateScroller(); } protected override void OnAfterClose() { } void CreateScroller() { if (model.normalRowIndexList == null) return; var normalRowIndexList = model.normalRowIndexList; scroller.Refresh(); scroller.AddCell(ScrollerDataType.Header, model.headerRowIndex); for (int i = 0; i < normalRowIndexList.Count; i++) { CellInfo cellInfo = new CellInfo { infoInt1 = normalRowIndexList[i][1] }; scroller.AddCell(ScrollerDataType.Normal, normalRowIndexList[i][0], cellInfo); } scroller.AddCell(ScrollerDataType.Tail, model.tailRowIndex); scroller.Restart(); scroller.JumpIndex(model.GetJumpRowIndex()); } void OnRefreshCell(ScrollerDataType type, CellView cell) { if (type == ScrollerDataType.Header) { var _cell = cell as CelestialPalaceTreeHeaderCell; _cell.Display(_cell.index); } else if (type == ScrollerDataType.Normal) { var _cell = cell as CelestialPalaceTreeNormalCell; _cell.Display(_cell.index, cell); } else { var _cell = cell as CelestialPalaceTreeTailCell; _cell.Display(_cell.index); } } } System/CelestialPalace/CelestialPalaceTreeWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 33d3372942b387c4dbbb885db9b42471 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CelestialPalace/CelestialPalaceWin.cs
New file @@ -0,0 +1,37 @@ using vnxbqy.UI; public class CelestialPalaceWin : Window { protected override void BindController() { } protected override void OnPreOpen() { } protected override void OnPreClose() { } protected override void OnAfterOpen() { } protected override void OnAfterClose() { } protected override void AddListeners() { } } System/CelestialPalace/CelestialPalaceWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: a9b7d006cb55a9e43bf216b0a8f814cc MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/ItemTip/GetWayTrigger.cs
@@ -39,6 +39,10 @@ } } public void SetItemId(int itemID) { m_ItemId = itemID; } } } System/MainInterfacePanel/HighSettingTip.cs
@@ -47,7 +47,7 @@ [SerializeField] Image m_NewDayActionIcon; [SerializeField] Image m_NewDayActionName; [SerializeField] RedpointBehaviour m_NewDayActionRedPoint; [SerializeField] Button m_xg; private bool isNeedTip = true; StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } @@ -98,6 +98,7 @@ if (actionInfo.activityID == 0) return; WindowCenter.Instance.Open(actionInfo.winName); }); m_xg.SetListener(() => { ModelCenter.Instance.GetModel<CelestialPalaceModel>().OpenCelestialPalaceWin(); }); } public void Init() System/MainInterfacePanel/MainRedDot.cs
@@ -134,6 +134,7 @@ public const int QCTrainActRedpoint = 455; //骑宠养成活动 public const int RankActRepoint = 456; //排行榜活动的中介红点 public const int TreasurePavilionRankActRepoint = 457; //古宝养成排行榜活动 public const int CelestialPalaceRepoint = 458; //仙宫 System/Store/StoreModel.cs
@@ -2225,6 +2225,7 @@ default9, default10, QCTrainActStore = 306, //骑宠养成活动商店 CelestialPalaceStore = 308, //仙宫商店(天道阁) } public enum LocalSaveStoreType Utility/ConfigInitiator.cs
@@ -369,6 +369,9 @@ normalTasks.Add(new ConfigInitTask("GubaoResonanceAttr", () => { GubaoResonanceAttrConfig.Init(); }, () => { return GubaoResonanceAttrConfig.inited; })); normalTasks.Add(new ConfigInitTask("TreasureItemLib", () => { TreasureItemLibConfig.Init(); }, () => { return TreasureItemLibConfig.inited; })); normalTasks.Add(new ConfigInitTask("FunctionTeamSet", () => { FunctionTeamSetConfig.Init(); }, () => { return FunctionTeamSetConfig.inited; })); normalTasks.Add(new ConfigInitTask("Xiangong", () => { XiangongConfig.Init(); }, () => { return XiangongConfig.inited; })); normalTasks.Add(new ConfigInitTask("TiandaoTree", () => { TiandaoTreeConfig.Init(); }, () => { return TiandaoTreeConfig.inited; })); } static List<ConfigInitTask> doingTasks = new List<ConfigInitTask>(); Utility/EnumHelper.cs
@@ -716,7 +716,7 @@ default36, // 264 Boss最终伤害加成 default37, // 265 骑宠积分 default38, // 266 古宝养成货币 default39, default39, // 267 天道币 default40, default41, default42, Utility/UIHelper.cs
@@ -1097,6 +1097,11 @@ //古宝养成货币 return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default38); } case 47: { //天道币 return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default39); } case 99: { return PlayerDatas.Instance.baseData.ExAttr11;