| | |
| | | typeof(DungeonOpenTimeConfig),
|
| | | typeof(FaceConfig),
|
| | | typeof(FamilyDonateConfig),
|
| | | typeof(FBDJGEffectConfig),
|
| | | typeof(FBDJGLevelConfig),
|
| | | typeof(FBDJGQuickConfig),
|
| | | typeof(FightPowerRatioConfig),
|
| | | typeof(FirstChargeConfig),
|
| | | typeof(GoldRushCampConfig),
|
| | |
| | | ClearConfigDictionary<FaceConfig>();
|
| | | // 清空 FamilyDonateConfig 字典
|
| | | ClearConfigDictionary<FamilyDonateConfig>();
|
| | | // 清空 FBDJGEffectConfig 字典
|
| | | ClearConfigDictionary<FBDJGEffectConfig>();
|
| | | // 清空 FBDJGLevelConfig 字典
|
| | | ClearConfigDictionary<FBDJGLevelConfig>();
|
| | | // 清空 FBDJGQuickConfig 字典
|
| | | ClearConfigDictionary<FBDJGQuickConfig>();
|
| | | // 清空 FightPowerRatioConfig 字典
|
| | | ClearConfigDictionary<FightPowerRatioConfig>();
|
| | | // 清空 FirstChargeConfig 字典
|
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: YYL |
| | | // [ Date ]: Thursday, January 8, 2026 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class FBDJGEffectConfig : ConfigBase<int, FBDJGEffectConfig> |
| | | { |
| | | static FBDJGEffectConfig() |
| | | { |
| | | // 访问过静态构造函数 |
| | | visit = true; |
| | | } |
| | | |
| | | public int EffID; |
| | | public string Name; |
| | | public int EffQuality; |
| | | public int AttrID; |
| | | public int AttrValue; |
| | | |
| | | public override int LoadKey(string _key) |
| | | { |
| | | int key = GetKey(_key); |
| | | return key; |
| | | } |
| | | |
| | | public override void LoadConfig(string input) |
| | | { |
| | | try { |
| | | string[] tables = input.Split('\t'); |
| | | int.TryParse(tables[0],out EffID); |
| | | |
| | | Name = tables[1]; |
| | | |
| | | int.TryParse(tables[2],out EffQuality); |
| | | |
| | | int.TryParse(tables[3],out AttrID); |
| | | |
| | | int.TryParse(tables[4],out AttrValue); |
| | | } |
| | | catch (Exception exception) |
| | | { |
| | | Debug.LogError(exception); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1d9ab1627e4cbd940b92b06a7fbdbb9f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: YYL |
| | | // [ Date ]: Thursday, January 8, 2026 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class FBDJGLevelConfig : ConfigBase<int, FBDJGLevelConfig> |
| | | { |
| | | static FBDJGLevelConfig() |
| | | { |
| | | // 访问过静态构造函数 |
| | | visit = true; |
| | | } |
| | | |
| | | public int LevelID; |
| | | public int LayerNum; |
| | | public int LevelNum; |
| | | public int[][] PassAwardList; |
| | | public int[][] AwardList; |
| | | public int[] LineupIDList; |
| | | public long FightPower; |
| | | |
| | | public override int LoadKey(string _key) |
| | | { |
| | | int key = GetKey(_key); |
| | | return key; |
| | | } |
| | | |
| | | public override void LoadConfig(string input) |
| | | { |
| | | try { |
| | | string[] tables = input.Split('\t'); |
| | | int.TryParse(tables[0],out LevelID); |
| | | |
| | | int.TryParse(tables[1],out LayerNum); |
| | | |
| | | int.TryParse(tables[2],out LevelNum); |
| | | |
| | | PassAwardList = JsonMapper.ToObject<int[][]>(tables[3].Replace("(", "[").Replace(")", "]")); |
| | | |
| | | AwardList = JsonMapper.ToObject<int[][]>(tables[4].Replace("(", "[").Replace(")", "]")); |
| | | |
| | | if (tables[5].Contains("[")) |
| | | { |
| | | LineupIDList = JsonMapper.ToObject<int[]>(tables[5]); |
| | | } |
| | | else |
| | | { |
| | | string[] LineupIDListStringArray = tables[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | LineupIDList = new int[LineupIDListStringArray.Length]; |
| | | for (int i=0;i<LineupIDListStringArray.Length;i++) |
| | | { |
| | | int.TryParse(LineupIDListStringArray[i],out LineupIDList[i]); |
| | | } |
| | | } |
| | | |
| | | long.TryParse(tables[6],out FightPower); |
| | | } |
| | | catch (Exception exception) |
| | | { |
| | | Debug.LogError(exception); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fcb6fd70d963c02458708cfb1a6bec17 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: YYL |
| | | // [ Date ]: 2026年1月7日 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Collections.Generic; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public partial class FBDJGQuickConfig : ConfigBase<int, FBDJGQuickConfig> |
| | | { |
| | | static FBDJGQuickConfig() |
| | | { |
| | | // 访问过静态构造函数 |
| | | visit = true; |
| | | } |
| | | |
| | | public int NeedLayer; |
| | | public int[][] QuickAwardList; |
| | | |
| | | public override int LoadKey(string _key) |
| | | { |
| | | int key = GetKey(_key); |
| | | return key; |
| | | } |
| | | |
| | | public override void LoadConfig(string input) |
| | | { |
| | | try { |
| | | string[] tables = input.Split('\t'); |
| | | int.TryParse(tables[0],out NeedLayer); |
| | | |
| | | QuickAwardList = JsonMapper.ToObject<int[][]>(tables[1].Replace("(", "[").Replace(")", "]")); |
| | | } |
| | | catch (Exception exception) |
| | | { |
| | | Debug.LogError(exception); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1b059c4a6d6df3640b8f1c56d87ec625 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | public partial class FBDJGLevelConfig : ConfigBase<int, FBDJGLevelConfig> |
| | | { |
| | | //<层数,<关卡编号,关卡ID>> |
| | | static Dictionary<int, Dictionary<int, int>> idDict = new Dictionary<int, Dictionary<int, int>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | if (!idDict.ContainsKey(LayerNum)) |
| | | { |
| | | idDict[LayerNum] = new Dictionary<int, int>(); |
| | | } |
| | | idDict[LayerNum][LevelNum] = LevelID; |
| | | } |
| | | |
| | | public static bool TryGetLayerNumDict(int layerNum, out Dictionary<int, int> dict) |
| | | { |
| | | dict = null; |
| | | return idDict != null && idDict.TryGetValue(layerNum, out dict); |
| | | } |
| | | |
| | | public static bool TryGetLevelID(int layerNum, int levelNum, out int levelID) |
| | | { |
| | | levelID = 0; |
| | | return idDict != null && idDict.TryGetValue(layerNum, out var dict) && dict.TryGetValue(levelNum, out levelID); |
| | | } |
| | | |
| | | public static bool TryGetFBDJGLevelConfig(int layerNum, int levelNum, out FBDJGLevelConfig config) |
| | | { |
| | | config = null; |
| | | if (TryGetLevelID(layerNum, levelNum, out var levelID) && HasKey(levelID)) |
| | | { |
| | | config = Get(levelID); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static bool TryGetFBDJGLevelConfig(int levelID, out FBDJGLevelConfig config) |
| | | { |
| | | config = null; |
| | | if (HasKey(levelID)) |
| | | { |
| | | config = Get(levelID); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static bool TryGetMinFBDJGLevelConfig(out FBDJGLevelConfig minConfig) |
| | | { |
| | | minConfig = null; |
| | | if (idDict.IsNullOrEmpty()) |
| | | return false; |
| | | int layerNum = idDict.Keys.Min(); |
| | | if (!TryGetLayerNumDict(layerNum, out var dict) || dict.IsNullOrEmpty()) |
| | | return false; |
| | | int levelNum = dict.Keys.Min(); |
| | | if (!TryGetFBDJGLevelConfig(layerNum, levelNum, out minConfig) || minConfig == null) |
| | | return false; |
| | | return true; |
| | | } |
| | | public static bool TryGetMaxFBDJGLevelConfig(out FBDJGLevelConfig maxConfig) |
| | | { |
| | | maxConfig = null; |
| | | if (idDict.IsNullOrEmpty()) |
| | | return false; |
| | | int layerNum = idDict.Keys.Max(); |
| | | if (!TryGetLayerNumDict(layerNum, out var dict) || dict.IsNullOrEmpty()) |
| | | return false; |
| | | int levelNum = dict.Keys.Max(); |
| | | if (!TryGetFBDJGLevelConfig(layerNum, levelNum, out maxConfig) || maxConfig == null) |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | // 获取指定层的最大关卡编号 |
| | | public static bool TryGetMaxLevelNumInLayer(int layerNum, out int maxLevelNum) |
| | | { |
| | | maxLevelNum = 0; |
| | | if (!TryGetLayerNumDict(layerNum, out var dict) || dict.IsNullOrEmpty()) |
| | | return false; |
| | | maxLevelNum = dict.Keys.Max(); |
| | | return true; |
| | | } |
| | | |
| | | // 获取下一关 |
| | | public static bool TryGetNextLevel(int layerNum, int levelNum, out int nextLayerNum, out int nextLevelNum) |
| | | { |
| | | nextLayerNum = 0; |
| | | nextLevelNum = 0; |
| | | if (!TryGetMaxLevelNumInLayer(layerNum, out int maxLevelNum)) |
| | | return false; |
| | | |
| | | // 层数相同,下一关 |
| | | if (maxLevelNum > 0 && levelNum < maxLevelNum) |
| | | { |
| | | nextLayerNum = layerNum; |
| | | nextLevelNum = levelNum + 1; |
| | | return true; |
| | | } |
| | | |
| | | // 下一层的第1关 |
| | | nextLayerNum = layerNum + 1; |
| | | |
| | | // 如果没有下一层 |
| | | if (!idDict.ContainsKey(nextLayerNum)) |
| | | { |
| | | nextLayerNum = 0; |
| | | nextLevelNum = 0; |
| | | return false; |
| | | } |
| | | |
| | | nextLevelNum = idDict[nextLayerNum].Keys.Min(); |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6758d29be01589f498a9074901ac5eaf |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e31491498dc67314482b5c0dd793d662 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B1 01 定军阁效果预设 #tagCSDingjungeEffSet |
| | | |
| | | public class CB101_tagCSDingjungeEffSet : GameNetPackBasic { |
| | | public byte SelectAuto; //是否启用自动选择 |
| | | public byte SelectSetCnt; |
| | | public ushort[] SelectSetAttrIDList; //预设优先选择属性ID列表 [优先级1属性ID, ...] |
| | | |
| | | public CB101_tagCSDingjungeEffSet () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xB101; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (SelectAuto, NetDataType.BYTE); |
| | | WriteBytes (SelectSetCnt, NetDataType.BYTE); |
| | | WriteBytes (SelectSetAttrIDList, NetDataType.WORD, SelectSetCnt); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 16ea44f330cde9d4ba513f69ee39bf7b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B1 02 定军阁效果选择 #tagCSDingjungeEffSelect |
| | | |
| | | public class CB102_tagCSDingjungeEffSelect : GameNetPackBasic { |
| | | public byte SelectType; //0-手动选择,1-放弃本次选择,2-一键选择(仅开启了自动选择时有效) |
| | | public byte SelectIndex; //手动选择索引 0~n |
| | | public byte ReplaceHole; //手动选择替换槽位 1~n,槽位=槽索引+1,升级时可直接发0 |
| | | |
| | | public CB102_tagCSDingjungeEffSelect () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xB102; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (SelectType, NetDataType.BYTE); |
| | | WriteBytes (SelectIndex, NetDataType.BYTE); |
| | | WriteBytes (ReplaceHole, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 022b09229e8064d43a397e44a8502088 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B1 08 快速一键过关副本 #tagCMFBQuickPass |
| | | |
| | | public class CB108_tagCMFBQuickPass : GameNetPackBasic { |
| | | public uint MapID; |
| | | public ushort LineID; |
| | | |
| | | public CB108_tagCMFBQuickPass () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xB108; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (MapID, NetDataType.DWORD); |
| | | WriteBytes (LineID, NetDataType.WORD); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c50a7b683e2b15b47b1e399aed9525ef |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B4 16 查看NPC属性 #tagCSViewNPCAttr |
| | | |
| | | public class CB416_tagCSViewNPCAttr : GameNetPackBasic { |
| | | public uint MapID; // 自定义地图ID,可用于绑定战斗地图场景功能(如主线boss、爬塔、竞技场等) |
| | | public uint FuncLineID; // MapID对应的扩展值,如具体某个关卡等 |
| | | public uint ViewNPCID; // 指定查看某个NPCID,发0则查看该关卡阵容所有NPC |
| | | |
| | | public CB416_tagCSViewNPCAttr () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xB416; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (MapID, NetDataType.DWORD); |
| | | WriteBytes (FuncLineID, NetDataType.DWORD); |
| | | WriteBytes (ViewNPCID, NetDataType.DWORD); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a6ce8891edcc48b49918eb96e53a9a11 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B2 02 定军阁信息 #tagSCDingjungeInfo |
| | | |
| | | public class DTCB202_tagSCDingjungeInfo : DtcBasic { |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | base.Done(vNetPack); |
| | | HB202_tagSCDingjungeInfo vNetData = vNetPack as HB202_tagSCDingjungeInfo; |
| | | WarlordPavilionManager.Instance.UpdateDingjungeInfo(vNetData); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 225b85aa172fad04089d1a456d91f7dc |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B4 32 查看NPC属性结果 #tagSCViewNPCAttrRet |
| | | |
| | | public class DTCB432_tagSCViewNPCAttrRet : DtcBasic { |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | base.Done(vNetPack); |
| | | HB432_tagSCViewNPCAttrRet vNetData = vNetPack as HB432_tagSCViewNPCAttrRet; |
| | | ViewNPCManager.Instance.UpdateViewNPCAttrRet(vNetData); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: cde823bde6926d742b373957c8225a1c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | Register(typeof(HB130_tagSCBeautyInfo), typeof(DTCB130_tagSCBeautyInfo)); |
| | | Register(typeof(HB040_tagSCTravelInfo), typeof(DTCB040_tagSCTravelInfo)); |
| | | Register(typeof(HA3C7_tagMCGubaoInfo), typeof(DTCA3C7_tagMCGubaoInfo)); |
| | | Register(typeof(HB202_tagSCDingjungeInfo), typeof(DTCB202_tagSCDingjungeInfo)); |
| | | Register(typeof(HB432_tagSCViewNPCAttrRet), typeof(DTCB432_tagSCViewNPCAttrRet)); |
| | | } |
| | | |
| | | //主工程注册封包 |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B2 02 定军阁信息 #tagSCDingjungeInfo |
| | | |
| | | public class HB202_tagSCDingjungeInfo : GameNetPackBasic { |
| | | public uint TodayPass; //今日过关进度 层*100+关卡编号,历史最高过关记录取A320中的PassLineID |
| | | public byte EffCnt; |
| | | public tagSCDingjungeEff[] EffList; //已生效的效果列表 |
| | | public byte SelectEffCnt; |
| | | public uint[] SelectEffList; //待手动选择的效果ID列表 |
| | | public ushort UnSelectCnt; //还有几个未选择的效果 |
| | | public byte SelectAuto; //是否启用自动选择 |
| | | public byte SelectSetCnt; |
| | | public ushort[] SelectSetAttrIDList; //预设优先选择属性ID列表 [优先级1属性ID, ...] |
| | | |
| | | public HB202_tagSCDingjungeInfo () { |
| | | _cmd = (ushort)0xB202; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out TodayPass, vBytes, NetDataType.DWORD); |
| | | TransBytes (out EffCnt, vBytes, NetDataType.BYTE); |
| | | EffList = new tagSCDingjungeEff[EffCnt]; |
| | | for (int i = 0; i < EffCnt; i ++) { |
| | | EffList[i] = new tagSCDingjungeEff(); |
| | | TransBytes (out EffList[i].EffIndex, vBytes, NetDataType.BYTE); |
| | | TransBytes (out EffList[i].EffID, vBytes, NetDataType.WORD); |
| | | TransBytes (out EffList[i].EffLV, vBytes, NetDataType.BYTE); |
| | | } |
| | | TransBytes (out SelectEffCnt, vBytes, NetDataType.BYTE); |
| | | TransBytes (out SelectEffList, vBytes, NetDataType.DWORD, SelectEffCnt); |
| | | TransBytes (out UnSelectCnt, vBytes, NetDataType.WORD); |
| | | TransBytes (out SelectAuto, vBytes, NetDataType.BYTE); |
| | | TransBytes (out SelectSetCnt, vBytes, NetDataType.BYTE); |
| | | TransBytes (out SelectSetAttrIDList, vBytes, NetDataType.WORD, SelectSetCnt); |
| | | } |
| | | |
| | | public class tagSCDingjungeEff { |
| | | public byte EffIndex; //槽索引,0~n |
| | | public ushort EffID; |
| | | public byte EffLV; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: aa87a53953bfef748b62a18e1537e3dd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B4 32 查看NPC属性结果 #tagSCViewNPCAttrRet |
| | | |
| | | public class HB432_tagSCViewNPCAttrRet : GameNetPackBasic { |
| | | public uint MapID; // 自定义地图ID,可用于绑定战斗地图场景功能(如主线关卡、主线boss、爬塔、竞技场等) |
| | | public uint FuncLineID; // MapID对应的扩展值,如具体某个关卡等 |
| | | public uint ViewNPCID; // 指定查看某个NPCID,发0则查看该关卡阵容所有NPC |
| | | public byte NPCCnt; |
| | | public tagSCViewNPCAttr[] NPCAttrList; |
| | | |
| | | public HB432_tagSCViewNPCAttrRet () { |
| | | _cmd = (ushort)0xB432; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out MapID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out FuncLineID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out ViewNPCID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out NPCCnt, vBytes, NetDataType.BYTE); |
| | | NPCAttrList = new tagSCViewNPCAttr[NPCCnt]; |
| | | for (int i = 0; i < NPCCnt; i ++) { |
| | | NPCAttrList[i] = new tagSCViewNPCAttr(); |
| | | TransBytes (out NPCAttrList[i].PosNum, vBytes, NetDataType.BYTE); |
| | | TransBytes (out NPCAttrList[i].NPCID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out NPCAttrList[i].HeroID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out NPCAttrList[i].LV, vBytes, NetDataType.WORD); |
| | | TransBytes (out NPCAttrList[i].Star, vBytes, NetDataType.BYTE); |
| | | TransBytes (out NPCAttrList[i].BreakLV, vBytes, NetDataType.BYTE); |
| | | TransBytes (out NPCAttrList[i].AwakeLV, vBytes, NetDataType.BYTE); |
| | | TransBytes (out NPCAttrList[i].AttrLen, vBytes, NetDataType.WORD); |
| | | TransBytes (out NPCAttrList[i].AttrMsg, vBytes, NetDataType.Chars, NPCAttrList[i].AttrLen); |
| | | } |
| | | } |
| | | |
| | | public class tagSCViewNPCAttr { |
| | | public byte PosNum; // 在本阵容中的站位,从1开始 |
| | | public uint NPCID; // 战斗NPCID,不同的实例ID对应的NPCID可能一样 |
| | | public uint HeroID; // 武将ID,玩家或NPC均可能有,如果有值则外观相关以该武将为准,否则以NPCID为准 |
| | | public ushort LV; // 等级,玩家的武将等级或NPC成长等级,等级显示以该值为准 |
| | | public byte Star; // 星级 |
| | | public byte BreakLV; // 突破 |
| | | public byte AwakeLV; // 觉醒 |
| | | public ushort AttrLen; |
| | | public string AttrMsg; // 属性信息 {"属性ID":value, ...} |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 128031526f9b0f14180aa02d3e0318b6 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | managers.Add(BeautyMMManager.Instance);
|
| | | managers.Add(DailySpecialsManager.Instance);
|
| | | managers.Add(GubaoManager.Instance);
|
| | | managers.Add(WarlordPavilionManager.Instance);
|
| | | managers.Add(ViewNPCManager.Instance);
|
| | | foreach (var manager in managers)
|
| | | {
|
| | | manager.Init();
|
| | |
| | | typeof(ArenaBattleWin), |
| | | typeof(BoneFieldBattleWin), |
| | | typeof(TianziBillboradBattleWin), |
| | | typeof(WarlordPavilionBattleWin), |
| | | }; |
| | | |
| | | // 战场名称 |
| | |
| | | public const string ArenaBattleField = "ArenaBattleField"; |
| | | public const string BoneBattleField = "BoneBattleField"; |
| | | public const string TianziBillboradBattleField = "TianziBillboradBattleField"; |
| | | public const string WarlordPavilionBattleField = "WarlordPavilionBattleField"; |
| | | |
| | | public static Dictionary<string, string> battleNameToWinName = new Dictionary<string, string>() |
| | | { |
| | |
| | | { ArenaBattleField, "ArenaBattleWin" }, |
| | | { BoneBattleField, "BoneFieldBattleWin" }, |
| | | { TianziBillboradBattleField, "TianziBillboradBattleWin" }, |
| | | { WarlordPavilionBattleField, "WarlordPavilionBattleField" }, |
| | | }; |
| | | |
| | | public static Dictionary<string, int> FieldNameToIndex = new Dictionary<string, int>() |
| | |
| | | { ArenaBattleField, 2 }, |
| | | { BoneBattleField, 3}, |
| | | { TianziBillboradBattleField, 4 }, |
| | | { WarlordPavilionBattleField, 5 }, |
| | | }; |
| | | |
| | | //和 CreateBattleField 里的对应 |
| | |
| | | {3, ArenaBattleField}, |
| | | {30010, BoneBattleField}, |
| | | {30020, TianziBillboradBattleField}, |
| | | {30030, WarlordPavilionBattleField}, |
| | | }; |
| | | |
| | | |
| New file |
| | |
| | | using LitJson; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | |
| | | public class WarlordPavilionBattleField : BattleField |
| | | { |
| | | protected JsonData extendData; |
| | | protected MainLevelConfig levelConfig; |
| | | public WarlordPavilionBattleField(string _guid) : base(_guid) |
| | | { |
| | | |
| | | } |
| | | |
| | | public override void Init(int MapID, int FuncLineID, JsonData _extendData, |
| | | List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList, byte turnMax) |
| | | { |
| | | base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList, turnMax); |
| | | |
| | | int level = FuncLineID;// 关卡 |
| | | extendData = _extendData; |
| | | levelConfig = MainLevelConfig.Get(level); |
| | | |
| | | SetBattleMode(BattleMode.Record); |
| | | } |
| | | |
| | | public override void AutoSetBattleMode() |
| | | { |
| | | SetBattleMode(BattleMode.Record); |
| | | } |
| | | |
| | | public override void TurnFightState(int TurnNum, int State, |
| | | uint FuncLineID, JsonData extendData) |
| | | { |
| | | base.TurnFightState(TurnNum, State, FuncLineID, extendData); |
| | | |
| | | switch (State) |
| | | { |
| | | // 起始状态标记 |
| | | case 0: |
| | | break; |
| | | case 1://准备完毕 |
| | | break; |
| | | case 2://战斗中 |
| | | break; |
| | | case 3://战斗结束 |
| | | break; |
| | | case 4://结算奖励 |
| | | break; |
| | | case 5://结束状态标记 |
| | | break; |
| | | default: |
| | | BattleDebug.LogError("recieve a unknown State"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | protected override void OnSettlement(JsonData turnFightStateData) |
| | | { |
| | | base.OnSettlement(turnFightStateData); |
| | | } |
| | | |
| | | public override void WhaleFall() |
| | | { |
| | | AutoFightModel.Instance.isPause = false; |
| | | Destroy(); |
| | | |
| | | if (UIManager.Instance.IsOpened<WarlordPavilionBattleWin>()) |
| | | { |
| | | UIManager.Instance.CloseWindow<WarlordPavilionBattleWin>(); |
| | | UIManager.Instance.OpenWindow<WarlordPavilionWin>(); |
| | | } |
| | | } |
| | | |
| | | public override void Run() |
| | | { |
| | | if (operationAgent == null) |
| | | { |
| | | //防范异常 |
| | | return; |
| | | } |
| | | base.Run(); |
| | | } |
| | | |
| | | public override void DistributeNextPackage() |
| | | { |
| | | if (IsBattleFinish) |
| | | return; |
| | | |
| | | // 不要调用base的函数 |
| | | BattleManager.Instance.DistributeNextReportPackage(guid); |
| | | } |
| | | |
| | | public override void ShowWindow(HB424_tagSCTurnFightInit vNetData) |
| | | { |
| | | WarlordPavilionBattleWin fsBattleWin = UIManager.Instance.GetUI<WarlordPavilionBattleWin>();// as FullScreenBattleWin; |
| | | if (null == fsBattleWin) |
| | | { |
| | | fsBattleWin = UIManager.Instance.OpenWindow<WarlordPavilionBattleWin>(); |
| | | } |
| | | fsBattleWin.SetBattleField(this); |
| | | |
| | | if (UIManager.Instance.IsOpened<WarlordPavilionWin>()) |
| | | { |
| | | UIManager.Instance.CloseWindow<WarlordPavilionWin>(); |
| | | } |
| | | } |
| | | |
| | | public NPCLineupConfig GetBossLineupConfig() |
| | | { |
| | | WarlordPavilionManager.Instance.AnalysisFinishProgress(FuncLineID, out int layerNum, out int levelNum); |
| | | if (!FBDJGLevelConfig.TryGetFBDJGLevelConfig(layerNum, levelNum, out FBDJGLevelConfig config)) |
| | | return null; |
| | | int[] lineupIDList = config.LineupIDList; |
| | | if (lineupIDList.IsNullOrEmpty()) |
| | | return null; |
| | | int lineupID = lineupIDList[0]; |
| | | if (!NPCLineupConfig.HasKey(lineupID)) |
| | | return null; |
| | | NPCLineupConfig nPCLineupConfig = NPCLineupConfig.Get(lineupID); |
| | | return nPCLineupConfig; |
| | | } |
| | | |
| | | public override BattleObject FindBoss() |
| | | { |
| | | |
| | | var config = GetBossLineupConfig(); |
| | | if (config != null) |
| | | { |
| | | int bossId = config.BossID; |
| | | BattleObject bo = battleObjMgr.allBattleObjDict.Values.FirstOrDefault(bo => bo.teamHero.NPCID == bossId); |
| | | return bo; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1435e3580e72a024c9b99a89b94809eb |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | case 30020: |
| | | battleField = new TianziBillboradBattleField(guid); |
| | | break; |
| | | case 30030: |
| | | battleField = new WarlordPavilionBattleField(guid); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class WarlordPavilionBattleWin : BaseBattleWin |
| | | { |
| | | [SerializeField] Transform transButtons; |
| | | [SerializeField] public BossLifeBar bossLifeBar; |
| | | [SerializeField] public SkillWordCell[] skillWordCells; |
| | | [SerializeField] public BossHeadCell bossHeadCell; |
| | | [SerializeField] public Text txtBossName; |
| | | private BattleObject bossBattleObject = null; |
| | | [SerializeField] public List<BattleBuffCell> buffCells; |
| | | [SerializeField] HeroCountryComponent myCountry; |
| | | [SerializeField] HeroCountryComponent enemyCountry; |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | MainWin.TabChangeEvent += OnTabChangeEvent; |
| | | UIManager.Instance.OnOpenWindow += OnOpenWindow; |
| | | bool isOpenBattleChangeTab = IsOpenBattleChangeTab(); |
| | | transButtons.localPosition = new Vector3(0, isOpenBattleChangeTab ? 130 : 0, 0); |
| | | if (isOpenBattleChangeTab) |
| | | { |
| | | UIManager.Instance.GetUI<MainWin>()?.CloseSubUI(); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.CloseWindow<MainWin>(); |
| | | } |
| | | isClickSkip = false; |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | |
| | | MainWin.TabChangeEvent -= OnTabChangeEvent; |
| | | UIManager.Instance.OnOpenWindow -= OnOpenWindow; |
| | | bool isOpenBattleChangeTab = IsOpenBattleChangeTab(); |
| | | if (isOpenBattleChangeTab) |
| | | { |
| | | UIManager.Instance.GetUI<MainWin>()?.RestoreSubUI(); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<MainWin>(); |
| | | } |
| | | |
| | | if (bossBattleObject != null) |
| | | { |
| | | if (bossBattleObject.buffMgr != null) |
| | | { |
| | | bossBattleObject.buffMgr.onBuffChanged -= OnBuffChanged; |
| | | } |
| | | bossBattleObject = null; |
| | | } |
| | | |
| | | if (isClickSkip) |
| | | { |
| | | isClickSkip = false; |
| | | TryPass(); |
| | | } |
| | | } |
| | | |
| | | void OnOpenWindow(UIBase win) |
| | | { |
| | | if (win is WarlordPavilionVictoryWin || win is WarlordPavilionFailWin) |
| | | { |
| | | isClickSkip = false; |
| | | } |
| | | } |
| | | |
| | | bool isClickSkip = false; |
| | | protected override void OnClickPass() |
| | | { |
| | | if (!IsPass()) |
| | | return; |
| | | isClickSkip = true; |
| | | clickTime = Time.time; // 记录点击时间 |
| | | battleField.ForceFinish(); |
| | | |
| | | } |
| | | |
| | | float stayTime = 2f; |
| | | float clickTime = 0f; |
| | | void LateUpdate() |
| | | { |
| | | if (isClickSkip && Time.time - clickTime >= stayTime) |
| | | { |
| | | isClickSkip = false; |
| | | TryPass(); |
| | | } |
| | | } |
| | | |
| | | private void TryPass() |
| | | { |
| | | if (UIManager.Instance.IsOpened<WarlordPavilionVictoryWin>() || |
| | | UIManager.Instance.IsOpened<WarlordPavilionFailWin>()) |
| | | return; |
| | | CloseWindow(); |
| | | Debug.LogError($"OnBattleEnd 异常关闭"); |
| | | BattleSettlementManager.Instance.WinShowOver(BattleConst.WarlordPavilionBattleField); |
| | | |
| | | } |
| | | private void OnTabChangeEvent() |
| | | { |
| | | UIManager.Instance.CloseWindow<WarlordPavilionBattleWin>(); |
| | | } |
| | | |
| | | protected override void OnCreateBattleField(string guid, BattleField field) |
| | | { |
| | | if (field is WarlordPavilionBattleField) |
| | | { |
| | | SetBattleField(field); |
| | | } |
| | | } |
| | | |
| | | protected override void RefreshSpecific() |
| | | { |
| | | WarlordPavilionBattleField warlordField = battleField as WarlordPavilionBattleField; |
| | | if (warlordField == null) return; |
| | | |
| | | NPCLineupConfig lineupConfig = warlordField.GetBossLineupConfig(); |
| | | |
| | | if (bossBattleObject != null) |
| | | { |
| | | if (bossBattleObject.buffMgr != null) |
| | | { |
| | | bossBattleObject.buffMgr.onBuffChanged -= OnBuffChanged; |
| | | } |
| | | bossBattleObject = null; |
| | | } |
| | | |
| | | bossBattleObject = warlordField.FindBoss(); |
| | | |
| | | DisplaySkillWordsList(lineupConfig); |
| | | |
| | | if (null != bossBattleObject) |
| | | { |
| | | TeamHero teamHero = bossBattleObject.teamHero; |
| | | bossHeadCell.SetTeamHero(teamHero); |
| | | txtBossName.text = teamHero.name; |
| | | NPCConfig npcConfig = NPCConfig.Get(teamHero.NPCID); |
| | | bossLifeBar.SetBaseInfo(Mathf.Max(1, npcConfig.LifeBarCount), (ulong)teamHero.curHp, (ulong)teamHero.maxHp); |
| | | bossBattleObject.buffMgr.onBuffChanged -= OnBuffChanged; |
| | | bossBattleObject.buffMgr.onBuffChanged += OnBuffChanged; |
| | | } |
| | | else |
| | | { |
| | | bossHeadCell.SetTeamHero(null); |
| | | txtBossName.text = string.Empty; |
| | | bossLifeBar.SetBaseInfo(2, 2, 2); |
| | | Debug.LogError("找不到boss"); |
| | | } |
| | | |
| | | OnRoundChange(battleField.round, battleField.turnMax); // 确保回合显示被调用 |
| | | OnBuffChanged(); |
| | | |
| | | // 获取我方(红方)队伍数据 |
| | | List<BattleObject> myTeam = battleField.battleObjMgr.GetBattleObjList(BattleCamp.Red); |
| | | // 获取敌方(蓝方)队伍数据 |
| | | List<BattleObject> enemyTeam = battleField.battleObjMgr.GetBattleObjList(BattleCamp.Blue); |
| | | |
| | | myCountry.RefreshOnTeamCountry(GetTeamHeroList(myTeam), true); |
| | | enemyCountry.RefreshOnTeamCountry(GetTeamHeroList(enemyTeam), true); |
| | | } |
| | | |
| | | private void OnBuffChanged() |
| | | { |
| | | var buffList = new List<HB428_tagSCBuffRefresh>(); |
| | | if (null != bossBattleObject) |
| | | { |
| | | buffList = bossBattleObject.buffMgr.GetBuffIconList(); |
| | | } |
| | | RefreshBuff(buffList); |
| | | } |
| | | |
| | | private void RefreshHP() |
| | | { |
| | | if (null != bossBattleObject) |
| | | { |
| | | TeamHero teamHero = bossBattleObject.teamHero; |
| | | bossLifeBar.Show((ulong)teamHero.curHp, (ulong)teamHero.maxHp); |
| | | } |
| | | } |
| | | |
| | | protected override void OnDamageTaken(BattleDmgInfo info) |
| | | { |
| | | // Debug.LogError("OnDamageTaken 被调用 调用者是 " + info.battleHurtParam.caster.casterObj?.teamHero.name + " 对象 " + info.battleHurtParam.hurter.hurtObj?.teamHero.name); |
| | | base.OnDamageTaken(info); |
| | | |
| | | if (battleField == null || info.battleFieldGuid != battleField.guid) |
| | | return; |
| | | |
| | | if (null == bossBattleObject) |
| | | return; |
| | | |
| | | // ★★★ 完全使用 StoryBossBattleWin 的逻辑 ★★★ |
| | | if (info.battleHurtParam.hurter.hurtObj != null && bossBattleObject.teamHero.ObjID == info.battleHurtParam.hurter.hurtObj.teamHero.ObjID) |
| | | { |
| | | bossLifeBar.Show((ulong)info.battleHurtParam.hurter.toHp, (ulong)bossBattleObject.teamHero.maxHp); |
| | | } |
| | | else if (info.battleHurtParam.caster.casterObj != null && bossBattleObject.teamHero.ObjID == info.battleHurtParam.caster.casterObj.teamHero.ObjID) |
| | | { |
| | | bossLifeBar.Show((ulong)info.battleHurtParam.caster.toHp, (ulong)bossBattleObject.teamHero.maxHp); |
| | | } |
| | | } |
| | | |
| | | protected override void OnClose() |
| | | { |
| | | base.OnClose(); |
| | | } |
| | | |
| | | public void DisplaySkillWordsList(NPCLineupConfig lineUPConfig) |
| | | { |
| | | if (skillWordCells.IsNullOrEmpty()) |
| | | return; |
| | | |
| | | if (null == lineUPConfig) |
| | | return; |
| | | |
| | | for (int i = 0; i < skillWordCells.Length; i++) |
| | | { |
| | | if (i < lineUPConfig.SkillIDExList.Length) |
| | | { |
| | | skillWordCells[i].SetActive(true); |
| | | int skillID = lineUPConfig.SkillIDExList[i]; |
| | | skillWordCells[i].Init(skillID, () => |
| | | { |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | SmallTipWin.isDownShow = true; |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | skillWordCells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void RefreshBuff(List<HB428_tagSCBuffRefresh> datas) |
| | | { |
| | | if (buffCells == null) |
| | | { |
| | | for (int i = 0; i < buffCells.Count; i++) |
| | | { |
| | | buffCells[i].SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < buffCells.Count; i++) |
| | | { |
| | | if (i < datas.Count) |
| | | { |
| | | buffCells[i].SetActive(true); |
| | | HB428_tagSCBuffRefresh buffData = datas[i]; |
| | | SkillConfig skillConfig = SkillConfig.Get((int)buffData.SkillID); |
| | | buffCells[i].Init(buffData, () => |
| | | { |
| | | // 点击buff图标 显示buff描述/当前身上所有buff |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | buffCells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | bool IsOpenBattleChangeTab() |
| | | { |
| | | return FuncOpen.Instance.IsFuncOpen(ArenaManager.Instance.BattleChangeTabFuncId); |
| | | } |
| | | |
| | | List<TeamHero> GetTeamHeroList(List<BattleObject> teams) |
| | | { |
| | | List<TeamHero> teamHeroes = new List<TeamHero>(); |
| | | if (teams.IsNullOrEmpty()) |
| | | return teamHeroes; |
| | | foreach (var item in teams) |
| | | { |
| | | teamHeroes.Add(item.teamHero); |
| | | } |
| | | return teamHeroes; |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fc7f3f13231e1b449a1f66527363b427 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | public class WarlordPavilionTabHandler : BaseChallengeTabHandler |
| | | { |
| | | protected override int GetIndex() => 4; |
| | | protected override int GetOpenState() => 0; // 0=FuncID |
| | | protected override int GetFuncId() => (int)FuncOpenEnum.WarlordPavilion; |
| | | protected override int GetRedpointId() => MainRedDot.WarlordPavilionRepoint; |
| | | |
| | | protected override string GetCountInfo() |
| | | { |
| | | WarlordPavilionManager.Instance.TryGetShowLayerNumAndLevelNum(out int layerNum, out int levelNum); |
| | | return UIHelper.AppendColor(TextColType.Green, Language.Get("WarlordPavilion29", Language.Get("Arena15", layerNum, levelNum))); |
| | | } |
| | | |
| | | protected override Action GetOnClickAction() |
| | | { |
| | | return HandleBoneFieldNavigation; |
| | | } |
| | | |
| | | private void HandleBoneFieldNavigation() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(GetFuncId(), true)) |
| | | return; |
| | | UIManager.Instance.CloseWindow<ChallengeTabWin>(); |
| | | |
| | | BattleField battleField = BattleManager.Instance.GetBattleFieldByMapID(WarlordPavilionManager.Instance.DataMapID); |
| | | if (battleField != null) |
| | | { |
| | | WarlordPavilionBattleWin battleWin; |
| | | if (!UIManager.Instance.IsOpened<WarlordPavilionBattleWin>()) |
| | | { |
| | | battleWin = UIManager.Instance.OpenWindow<WarlordPavilionBattleWin>(); |
| | | } |
| | | else |
| | | { |
| | | battleWin = UIManager.Instance.GetUI<WarlordPavilionBattleWin>(); |
| | | } |
| | | battleWin.SetBattleField(battleField as WarlordPavilionBattleField); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<WarlordPavilionWin>(); |
| | | } |
| | | } |
| | | |
| | | protected override void SubscribeToSpecificEvents() |
| | | { |
| | | WarlordPavilionManager.Instance.OnUpdateDingjungeInfoEvent += OnUpdateDingjungeInfoEvent; |
| | | } |
| | | |
| | | protected override void UnsubscribeFromSpecificEvents() |
| | | { |
| | | WarlordPavilionManager.Instance.OnUpdateDingjungeInfoEvent -= OnUpdateDingjungeInfoEvent; |
| | | } |
| | | |
| | | private void OnUpdateDingjungeInfoEvent(List<int> indexs) |
| | | { |
| | | Refresh(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9c12a549ffaac2d46b8221a69c966eba |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public const int FunctionPreviewRepoint = 474; //功能预告
|
| | | public const int HeroFatesRepoint = 475;//宿缘
|
| | | public const int DailyTehui = 476;//每日特惠
|
| | | public const int WarlordPavilionRepoint = 477;//定军阁
|
| | | public void Register()
|
| | | {
|
| | |
|
| | |
| | | case BattleConst.TianziBillboradBattleField: |
| | | PopupWindowsProcessor.Instance.Add("TianziBillboradVictoryWin", false, BattleConst.TianziBillboradBattleField); |
| | | break; |
| | | case BattleConst.WarlordPavilionBattleField: |
| | | PopupWindowsProcessor.Instance.Add(isWin ? "WarlordPavilionVictoryWin" : "WarlordPavilionFailWin", false, BattleConst.WarlordPavilionBattleField); |
| | | break; |
| | | default: |
| | | PopupWindowsProcessor.Instance.Add(isWin ? "BattleVictoryWin" : "BattleFailWin", false, BattleConst.StoryBossBattleField); |
| | | break; |
| | |
| | | case BattleConst.TianziBillboradBattleField: |
| | | TianziBillboradManager.Instance.isSweepVictory = false; |
| | | UIManager.Instance.OpenWindow<TianziBillboradVictoryWin>(); |
| | | break; |
| | | case BattleConst.WarlordPavilionBattleField: |
| | | if (isWin) |
| | | { |
| | | UIManager.Instance.OpenWindow<WarlordPavilionVictoryWin>(); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<WarlordPavilionFailWin>(); |
| | | } |
| | | break; |
| | | default: |
| | | if (isWin) |
| | |
| | | UIManager.Instance.CloseWindow<MapLoadingWin>(); |
| | | if (mapID == 2) |
| | | { |
| | | AutoFightModel.Instance.isPause = false; |
| | | AutoFightModel.Instance.isPause = false; |
| | | } |
| | | } |
| | | } |
| | |
| | | case BattleConst.StoryBossBattleField: |
| | | case BattleConst.BoneBattleField: |
| | | case BattleConst.TianziBillboradBattleField: |
| | | case BattleConst.WarlordPavilionBattleField: |
| | | BattleObject bossBattleObject = battleField.FindBoss(); |
| | | if (bossBattleObject == null || bossBattleObject.teamHero == null) |
| | | return detailName; |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //战场结算界面,存在多个的情况 |
| | | public class WarlordPavilionFailWin : UIBase |
| | | { |
| | | [SerializeField] TextEx txtFuncName; |
| | | [SerializeField] Button tipHeroCultivateBtn; |
| | | [SerializeField] Button tipEquipBtn; |
| | | [SerializeField] Button tipHeroPosBtn; |
| | | [SerializeField] ButtonEx detailBtn; |
| | | string battleName = BattleConst.WarlordPavilionBattleField; |
| | | protected override void InitComponent() |
| | | { |
| | | tipHeroCultivateBtn.AddListener(() => |
| | | { |
| | | CloseWindow(); |
| | | }); |
| | | |
| | | tipEquipBtn.AddListener(() => |
| | | { |
| | | CloseWindow(); |
| | | }); |
| | | |
| | | tipHeroPosBtn.AddListener(() => |
| | | { |
| | | CloseWindow(); |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | |
| | | detailBtn.SetListener(() => |
| | | { |
| | | BattleSettlementManager.Instance.OpenBattleDetailWin(battleName); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | int funcId = (int)FuncOpenEnum.WarlordPavilion; |
| | | txtFuncName.text = FuncOpenLVConfig.HasKey(funcId) ? FuncOpenLVConfig.Get(funcId).Name : string.Empty; |
| | | if (!FirstChargeManager.Instance.GetLocalFail()) |
| | | { |
| | | FirstChargeManager.Instance.SetLocalFail(); |
| | | } |
| | | FirstChargeManager.Instance.TryPopWin(); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | BattleSettlementManager.Instance.WinShowOver(battleName); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7680971ec5970cd45a4c6dbd6ba705bb |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | |
| | | public class WarlordPavilionVictoryWin : UIBase |
| | | { |
| | | [SerializeField] ButtonEx detailBtn; |
| | | [SerializeField] TextEx txtFuncName; |
| | | [SerializeField] ScrollerController scroller; |
| | | |
| | | string battleName = BattleConst.WarlordPavilionBattleField; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | detailBtn.SetListener(() => |
| | | { |
| | | BattleSettlementManager.Instance.OpenBattleDetailWin(battleName); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | CreateScroller(); |
| | | int funcId = (int)FuncOpenEnum.WarlordPavilion; |
| | | txtFuncName.text = FuncOpenLVConfig.HasKey(funcId) ? FuncOpenLVConfig.Get(funcId).Name : string.Empty; |
| | | } |
| | | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | BattleSettlementManager.Instance.WinShowOver(battleName); |
| | | } |
| | | |
| | | List<Item> showItems = new List<Item>(); |
| | | void CreateScroller() |
| | | { |
| | | var jsonData = BattleSettlementManager.Instance.GetBattleSettlement(battleName); |
| | | if (jsonData == null) |
| | | { |
| | | DelayCloseWindow().Forget(); |
| | | return; |
| | | } |
| | | showItems.Clear(); |
| | | scroller.Refresh(); |
| | | |
| | | if (!jsonData.ContainsKey("itemInfo")) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var resultStr = jsonData["itemInfo"]; |
| | | for (int i = 0; i < resultStr.Count; i++) |
| | | { |
| | | showItems.Add(new Item((int)resultStr[i]["ItemID"], (long)resultStr[i]["Count"])); |
| | | } |
| | | |
| | | showItems.Sort(SortItem); |
| | | for (int i = 0; i < showItems.Count; i++) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | |
| | | |
| | | |
| | | int SortItem(Item itemA, Item itemB) |
| | | { |
| | | var itemConfigA = ItemConfig.Get(itemA.id); |
| | | var itemConfigB = ItemConfig.Get(itemB.id); |
| | | return itemConfigB.ItemColor - itemConfigA.ItemColor; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as SettlementAwardCell; |
| | | var item = showItems[cell.index]; |
| | | _cell?.Display(item.id, item.countEx); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b3c1aab8b21497246a29d15362bba684 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 575457eac14e9134f91cefacf5d696aa |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | public class ViewNPCManager : GameSystemManager<ViewNPCManager> |
| | | { |
| | | public Dictionary<uint, Dictionary<uint, Dictionary<uint, ViewNPCAttr>>> dict = new Dictionary<uint, Dictionary<uint, Dictionary<uint, ViewNPCAttr>>>(); |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEventOnRelogin; |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitializeEventOnRelogin; |
| | | } |
| | | |
| | | private void OnBeforePlayerDataInitializeEventOnRelogin() |
| | | { |
| | | dict.Clear(); |
| | | } |
| | | // --- 解析属性字典 --- |
| | | private Dictionary<int, long> ParseAttrDict(string jsonStr) |
| | | { |
| | | Dictionary<int, long> result = new Dictionary<int, long>(); |
| | | if (string.IsNullOrEmpty(jsonStr)) return result; |
| | | |
| | | try |
| | | { |
| | | JsonData jd = JsonMapper.ToObject(jsonStr); |
| | | foreach (string attrKey in jd.Keys) |
| | | { |
| | | if (int.TryParse(attrKey, out int attrId)) |
| | | { |
| | | JsonData v = jd[attrKey]; |
| | | long val = 0; |
| | | // 健壮性数值转换 |
| | | if (v.IsLong) val = (long)v; |
| | | else if (v.IsInt) val = (long)(int)v; |
| | | else if (v.IsDouble) val = (long)(double)v; |
| | | else if (v.IsString) long.TryParse(v.ToString(), out val); |
| | | |
| | | result[attrId] = val; |
| | | } |
| | | } |
| | | } |
| | | catch (System.Exception e) |
| | | { |
| | | Debug.LogWarning($"解析NPC属性JSON失败: {e.Message}"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public event Action<uint, uint> OnUpdateViewNPCAttrRet; |
| | | public void UpdateViewNPCAttrRet(HB432_tagSCViewNPCAttrRet vNetData) |
| | | { |
| | | if (!dict.ContainsKey(vNetData.MapID)) |
| | | { |
| | | dict[vNetData.MapID] = new Dictionary<uint, Dictionary<uint, ViewNPCAttr>>(); |
| | | } |
| | | |
| | | var mapDict = dict[vNetData.MapID]; |
| | | |
| | | if (!mapDict.ContainsKey(vNetData.FuncLineID)) |
| | | { |
| | | mapDict[vNetData.FuncLineID] = new Dictionary<uint, ViewNPCAttr>(); |
| | | } |
| | | |
| | | var funcLineDict = mapDict[vNetData.FuncLineID]; |
| | | |
| | | if (vNetData.NPCAttrList != null) |
| | | { |
| | | // 使用临时字典按NPCID分组 |
| | | Dictionary<uint, List<HB432_tagSCViewNPCAttrRet.tagSCViewNPCAttr>> tempGroup = |
| | | new Dictionary<uint, List<HB432_tagSCViewNPCAttrRet.tagSCViewNPCAttr>>(); |
| | | |
| | | foreach (var npcAttr in vNetData.NPCAttrList) |
| | | { |
| | | uint npcID = npcAttr.NPCID; |
| | | if (!tempGroup.ContainsKey(npcID)) |
| | | { |
| | | tempGroup[npcID] = new List<HB432_tagSCViewNPCAttrRet.tagSCViewNPCAttr>(); |
| | | } |
| | | tempGroup[npcID].Add(npcAttr); |
| | | } |
| | | |
| | | // 存入第3层字典 |
| | | foreach (var kvp in tempGroup) |
| | | { |
| | | var firstAttr = kvp.Value[0]; |
| | | funcLineDict[kvp.Key] = new ViewNPCAttr |
| | | { |
| | | PosNum = firstAttr.PosNum, |
| | | NPCID = firstAttr.NPCID, |
| | | HeroID = firstAttr.HeroID, |
| | | LV = firstAttr.LV, |
| | | Star = firstAttr.Star, |
| | | BreakLV = firstAttr.BreakLV, |
| | | AwakeLV = firstAttr.AwakeLV, |
| | | AttrDict = ParseAttrDict(firstAttr.AttrMsg) |
| | | }; |
| | | } |
| | | } |
| | | OnUpdateViewNPCAttrRet?.Invoke(vNetData.MapID, vNetData.FuncLineID); |
| | | } |
| | | |
| | | |
| | | public bool TryGetNPCAttr(uint mapID, uint funcLineID, uint npcID, out ViewNPCAttr npcAttr) |
| | | { |
| | | npcAttr = null; |
| | | |
| | | if (!dict.TryGetValue(mapID, out var mapDict)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (!mapDict.TryGetValue(funcLineID, out var funcLineDict)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return funcLineDict.TryGetValue(npcID, out npcAttr); |
| | | } |
| | | |
| | | public void SendViewNPCAttr(uint mapID, uint funcLineID, uint viewNPCID) |
| | | { |
| | | CB416_tagCSViewNPCAttr pack = new CB416_tagCSViewNPCAttr(); |
| | | pack.MapID = mapID; |
| | | pack.FuncLineID = funcLineID; |
| | | pack.ViewNPCID = viewNPCID; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | } |
| | | |
| | | public class ViewNPCAttr |
| | | { |
| | | public byte PosNum; // 在本阵容中的站位,从1开始 |
| | | public uint NPCID; // 战斗NPCID,不同的实例ID对应的NPCID可能一样 |
| | | public uint HeroID; // 武将ID,玩家或NPC均可能有,如果有值则外观相关以该武将为准,否则以NPCID为准 |
| | | public ushort LV; // 等级,玩家的武将等级或NPC成长等级,等级显示以该值为准 |
| | | public byte Star; // 星级 |
| | | public byte BreakLV; // 突破 |
| | | public byte AwakeLV; // 觉醒 |
| | | public Dictionary<int, long> AttrDict = new Dictionary<int, long>(); // 属性; |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 26665bb56e360ba48883659f9df93abd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: df6e40f1c2f93aa4784924dc1ea30145 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | public class WarlordPavilionAwardCell : MonoBehaviour |
| | | { |
| | | [SerializeField] TextEx txtTitle; |
| | | [SerializeField] TextEx txtState; |
| | | [SerializeField] ItemCell[] itemCells; |
| | | [SerializeField] Color32 pass = new Color32(36, 139, 18, 255); |
| | | [SerializeField] Color32 noPass = new Color32(157, 112, 84, 255); |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | public void Display(int needLayer, int historyMaxLayer) |
| | | { |
| | | if (!FBDJGQuickConfig.HasKey(needLayer)) |
| | | return; |
| | | FBDJGQuickConfig fBDJGQuickConfig = FBDJGQuickConfig.Get(needLayer); |
| | | txtTitle.text = Language.Get("WarlordPavilion15", needLayer); |
| | | bool isPass = needLayer <= historyMaxLayer; |
| | | txtState.text = Language.Get(isPass ? "WarlordPavilion13" : "WarlordPavilion14"); |
| | | txtState.color = isPass ? pass : noPass; |
| | | manager.DisplayItemCell(itemCells, fBDJGQuickConfig.QuickAwardList); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6d64090da81e2634ea818bac6c36d145 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | public class WarlordPavilionAwardWin : UIBase |
| | | { |
| | | [SerializeField] ScrollerController scrAward; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | scrAward.OnRefreshCell += OnRefreshCell; |
| | | CreateScroller(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scrAward.OnRefreshCell -= OnRefreshCell; |
| | | } |
| | | |
| | | int historyMaxLayerNum; |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell.GetComponent<WarlordPavilionAwardCell>(); |
| | | _cell?.Display(cell.index, historyMaxLayerNum); |
| | | } |
| | | |
| | | private void CreateScroller() |
| | | { |
| | | manager.GetHistoryMaxPassLayerNum(out historyMaxLayerNum); |
| | | |
| | | int jumpIndex = 0; |
| | | scrAward.Refresh(); |
| | | List<int> list = manager.GetAwardList(); |
| | | if (!list.IsNullOrEmpty()) |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | int needLayer = list[i]; |
| | | if (needLayer <= historyMaxLayerNum) |
| | | { |
| | | jumpIndex = i; |
| | | } |
| | | scrAward.AddCell(ScrollerDataType.Header, needLayer); |
| | | } |
| | | } |
| | | scrAward.Restart(); |
| | | scrAward.JumpIndex(jumpIndex); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: adedcbbf6fe04e8488e61002e7ca67d3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class WarlordPavilionBonusPreseCell : MonoBehaviour |
| | | { |
| | | [SerializeField] TextEx txtNum; |
| | | [SerializeField] Dropdown dropdown; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | int index; |
| | | List<int> attrIds; |
| | | |
| | | public void Display(int index) |
| | | { |
| | | this.index = index; |
| | | txtNum.text = Language.Get("WarlordPavilion19", index + 1); |
| | | |
| | | InitializeDropdown(); |
| | | } |
| | | |
| | | void InitializeDropdown() |
| | | { |
| | | dropdown.onValueChanged.RemoveAllListeners(); |
| | | attrIds = manager.GetAttrIds(); |
| | | if (attrIds.IsNullOrEmpty()) |
| | | return; |
| | | List<string> options = manager.GetOptions(); |
| | | if (options.IsNullOrEmpty()) |
| | | return; |
| | | dropdown.ClearOptions(); |
| | | dropdown.AddOptions(options); |
| | | RefreshCheckmarks(); |
| | | |
| | | int defaultValue = 0; // 默认选中"无" |
| | | |
| | | ushort[] chooseAttrIDList = manager.GetChooseAttrIDList(); |
| | | if (chooseAttrIDList.IsNullOrEmpty() || index < 0 || index >= chooseAttrIDList.Length) |
| | | return; |
| | | |
| | | int savedAttrId = chooseAttrIDList[index]; |
| | | if (savedAttrId > 0) // 排除"无"选项 |
| | | { |
| | | int savedIndex = attrIds.IndexOf(savedAttrId); |
| | | if (savedIndex >= 0) |
| | | { |
| | | defaultValue = savedIndex + 1; // +1 是因为第一个选项是"无" |
| | | } |
| | | } |
| | | |
| | | dropdown.value = defaultValue; |
| | | dropdown.onValueChanged.AddListener(OnDropdownValueChanged); |
| | | } |
| | | |
| | | // 刷新所有选项的勾选状态 |
| | | // 刷新所有选项的勾选状态 |
| | | void RefreshCheckmarks() |
| | | { |
| | | ushort[] chooseAttrIDList = manager.GetChooseAttrIDList(); |
| | | if (chooseAttrIDList.IsNullOrEmpty()) |
| | | return; |
| | | var dict = manager.GetIndexToAttrIds(); |
| | | |
| | | for (int i = 0; i < dropdown.options.Count; i++) |
| | | { |
| | | // 如果字典中存在该索引,获取对应的attrId |
| | | if (dict.TryGetValue(i, out int attrId)) |
| | | { |
| | | // 检查attrId是否在chooseAttrIDList中存在(被其他cell选中) |
| | | bool isChecked = Array.Exists(chooseAttrIDList, id => id == attrId); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void OnDropdownValueChanged(int selectedIndex) |
| | | { |
| | | if (attrIds.IsNullOrEmpty() || selectedIndex < 0 || selectedIndex >= attrIds.Count) |
| | | return; |
| | | |
| | | if (selectedIndex <= 0) |
| | | { |
| | | // 选中"无"选项 |
| | | manager.SetChooseAttrIDList(index, 0); |
| | | return; |
| | | } |
| | | |
| | | int selectedAttrId = attrIds[selectedIndex - 1]; |
| | | manager.SetChooseAttrIDList(index, selectedAttrId); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b1360540210575a449ccbdd082ee4264 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | public class WarlordPavilionBonusPresetWin : UIBase |
| | | { |
| | | [SerializeField] ScrollerController scroller; |
| | | [SerializeField] ButtonEx btnOpen; //开启预设 |
| | | [SerializeField] ButtonEx btnClose; //关闭预设 |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | protected override void InitComponent() |
| | | { |
| | | btnOpen.SetListener(() => |
| | | { |
| | | ushort[] choose = manager.GetChooseAttrIDList(); |
| | | manager.SendDingjungeEffSet(true, choose); |
| | | }); |
| | | btnClose.SetListener(() => |
| | | { |
| | | ushort[] choose = manager.GetChooseAttrIDList(); |
| | | manager.SendDingjungeEffSet(false, choose); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | manager.OnChooseAttrIDListChangeEvent += OnChooseAttrIDListChangeEvent; |
| | | manager.OnUpdateDingjungeInfoEvent += OnUpdateDingjungeInfoEvent; |
| | | Display(); |
| | | CreateScroller(); |
| | | bool isTodayShowSelectBonusRed = manager.IsTodayShowSelectBonusRed(); |
| | | if (isTodayShowSelectBonusRed) |
| | | { |
| | | manager.SetLoacl(); |
| | | manager.UpdateRedpoint(); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | manager.OnChooseAttrIDListChangeEvent -= OnChooseAttrIDListChangeEvent; |
| | | manager.OnUpdateDingjungeInfoEvent -= OnUpdateDingjungeInfoEvent; |
| | | } |
| | | |
| | | private void OnUpdateDingjungeInfoEvent(List<int> indexs) |
| | | { |
| | | Display(); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | private void OnChooseAttrIDListChangeEvent() |
| | | { |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell.GetComponent<WarlordPavilionBonusPreseCell>(); |
| | | _cell?.Display(cell.index); |
| | | } |
| | | |
| | | private void CreateScroller() |
| | | { |
| | | manager.SetChooseAttrIDList(); |
| | | scroller.Refresh(); |
| | | for (int i = 0; i < manager.bonusPresetMaxCnt; i++) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | |
| | | private void Display() |
| | | { |
| | | btnOpen.SetActive(!manager.IsAutoPresetOn()); |
| | | btnClose.SetActive(manager.IsAutoPresetOn()); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4fff8e65184e70d46875dc2c53eca00f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class WarlordPavilionDropdownItem : MonoBehaviour |
| | | { |
| | | [SerializeField] Text txtTitle; |
| | | [SerializeField] Image imgCheck; |
| | | [SerializeField] Color32 selectCol; |
| | | [SerializeField] Color32 unSelectCol; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | void Start() |
| | | { |
| | | int myIndex = Mathf.Max(transform.GetSiblingIndex()-1,0); |
| | | |
| | | var dict = manager.GetIndexToAttrIds(); |
| | | if (dict == null) |
| | | return; |
| | | |
| | | if (myIndex == 0) |
| | | { |
| | | ShowDefault(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (!dict.ContainsKey(myIndex)) |
| | | { |
| | | ShowDefault(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | int attrID = dict[myIndex]; |
| | | int index = manager.IndexOf(attrID); |
| | | if (index < 0) |
| | | { |
| | | ShowDefault(); |
| | | return; |
| | | } |
| | | |
| | | txtTitle.color = selectCol; |
| | | imgCheck.SetActive(true); |
| | | } |
| | | |
| | | public void ShowDefault() |
| | | { |
| | | txtTitle.color = unSelectCol; |
| | | imgCheck.SetActive(false); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 418a93fb8f74ef94890e0fc7bc00f856 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class WarlordPavilionGiftCell : MonoBehaviour |
| | | { |
| | | |
| | | Image m_QualityBG; |
| | | Image qualityBG |
| | | { |
| | | get |
| | | { |
| | | if (m_QualityBG == null) |
| | | { |
| | | m_QualityBG = this.transform.GetComponent<Image>("Container_GiftCell/qualityIcon"); |
| | | } |
| | | return m_QualityBG; |
| | | } |
| | | } |
| | | |
| | | Button m_GiftBtn; |
| | | Button giftBtn |
| | | { |
| | | get |
| | | { |
| | | if (m_GiftBtn == null) |
| | | { |
| | | m_GiftBtn = this.transform.GetComponent<Button>("Container_GiftCell"); |
| | | } |
| | | return m_GiftBtn; |
| | | } |
| | | } |
| | | |
| | | |
| | | Text m_GiftName; |
| | | Text giftName |
| | | { |
| | | get |
| | | { |
| | | if (m_GiftName == null) |
| | | { |
| | | m_GiftName = this.transform.GetComponent<Text>("Container_GiftCell/name"); |
| | | } |
| | | return m_GiftName; |
| | | } |
| | | } |
| | | |
| | | OutlineEx m_TextOutline; |
| | | OutlineEx textOutline |
| | | { |
| | | get |
| | | { |
| | | if (m_TextOutline == null) |
| | | { |
| | | m_TextOutline = this.transform.GetComponent<OutlineEx>("Container_GiftCell/name"); |
| | | } |
| | | return m_TextOutline; |
| | | } |
| | | } |
| | | |
| | | Transform m_LvRect; |
| | | Transform lvRect |
| | | { |
| | | get |
| | | { |
| | | if (m_LvRect == null) |
| | | { |
| | | m_LvRect = this.transform.Find("Container_GiftCell/lvrect"); |
| | | } |
| | | return m_LvRect; |
| | | } |
| | | } |
| | | |
| | | Text m_LvText; |
| | | Text lvText |
| | | { |
| | | get |
| | | { |
| | | if (m_LvText == null) |
| | | { |
| | | m_LvText = this.transform.GetComponent<Text>("Container_GiftCell/lvrect/lv"); |
| | | } |
| | | return m_LvText; |
| | | } |
| | | } |
| | | |
| | | Image m_StateImg; |
| | | Image stateImg |
| | | { |
| | | get |
| | | { |
| | | if (m_StateImg == null) |
| | | { |
| | | m_StateImg = this.transform.GetComponent<Image>("Container_GiftCell/state"); |
| | | } |
| | | return m_StateImg; |
| | | } |
| | | } |
| | | |
| | | Image m_AwakeLockImg; //重生降低觉醒等级锁定的图片 |
| | | Image awakeLockImg |
| | | { |
| | | get |
| | | { |
| | | if (m_AwakeLockImg == null) |
| | | { |
| | | m_AwakeLockImg = this.transform.GetComponent<Image>("Container_GiftCell/lock"); |
| | | } |
| | | return m_AwakeLockImg; |
| | | } |
| | | } |
| | | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | } |
| | | |
| | | //showState 0:不显示 1:新增 2:提升 |
| | | public void Init(int giftID, int lv, int showState = 0, bool isShowTip = true) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | if (FBDJGEffectConfig.HasKey(giftID)) |
| | | { |
| | | var config = FBDJGEffectConfig.Get(giftID); |
| | | qualityBG.SetSprite("GiftQualityBG" + config.EffQuality); |
| | | giftName.text = config.Name; |
| | | giftName.color = GetColor(config.EffQuality); |
| | | textOutline.OutlineColor = GetOutlineColor(config.EffQuality); |
| | | lvText.text = lv.ToString(); |
| | | lvRect.SetActive(lv > 0); |
| | | stateImg.SetActive(showState > 0); |
| | | stateImg.SetSprite("GiftState" + showState); |
| | | stateImg.SetNativeSize(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | qualityBG.SetSprite("GiftQualityBG" + giftID); |
| | | giftName.text = string.Empty; |
| | | lvRect.SetActive(false); |
| | | stateImg.SetActive(false); |
| | | awakeLockImg.SetActive(false); |
| | | } |
| | | giftBtn.AddListener(() => |
| | | { |
| | | if (isShowTip) |
| | | { |
| | | ShowSmallTip(giftID, lv); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | void ShowSmallTip(int giftID, int giftLV) |
| | | { |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | if (giftID > 0) |
| | | { |
| | | var giftConfig = FBDJGEffectConfig.Get(giftID); |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV), |
| | | Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue * giftLV))); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | Color32 GetColor(int quality) |
| | | { |
| | | if (quality == 1) |
| | | { |
| | | //D196FF |
| | | return new Color32(209, 150, 255, 255); |
| | | } |
| | | else if (quality == 2) |
| | | { |
| | | //ffda8c |
| | | return new Color32(255, 218, 140, 255); |
| | | } |
| | | else if (quality == 3) |
| | | { |
| | | //ffbd88 |
| | | return new Color32(255, 189, 136, 255); |
| | | } |
| | | else if (quality == 4) |
| | | { |
| | | //ff8888 |
| | | return new Color32(255, 136, 136, 255); |
| | | } |
| | | return new Color32(255, 255, 255, 255); |
| | | } |
| | | |
| | | Color32 GetOutlineColor(int quality) |
| | | { |
| | | if (quality == 1) |
| | | { |
| | | //692088 |
| | | return new Color32(105, 32, 136, 128); |
| | | } |
| | | else if (quality == 2) |
| | | { |
| | | //886220 |
| | | return new Color32(136, 98, 32, 128); |
| | | } |
| | | else if (quality == 3) |
| | | { |
| | | //884a20 |
| | | return new Color32(136, 74, 32, 128); |
| | | } |
| | | else if (quality == 4) |
| | | { |
| | | //882020 |
| | | return new Color32(136, 32, 32, 128); |
| | | } |
| | | return new Color32(0, 0, 0, 128); |
| | | } |
| | | |
| | | GameObject cellContainer; |
| | | protected void LoadPrefab() |
| | | { |
| | | if (cellContainer != null) |
| | | return; |
| | | |
| | | var tmp = transform.Find("Container_GiftCell"); |
| | | if (tmp != null) |
| | | { |
| | | cellContainer = tmp.gameObject; |
| | | return; |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell"); |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | cellContainer.transform.SetAsFirstSibling(); |
| | | } |
| | | } |
| | | |
| | | //缩放到和父rect一样大 |
| | | var scale = 1f; |
| | | var rect = cellContainer.GetComponent<RectTransform>(); |
| | | var parentRect = transform.GetComponent<RectTransform>(); |
| | | float width = parentRect.sizeDelta.x; |
| | | if (width <= 0f) |
| | | { |
| | | //外部控制了尺寸获取为0 |
| | | GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>(); |
| | | if (grid != null) |
| | | { |
| | | width = grid.cellSize.x; |
| | | } |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e3e3ef1c58f0527418883447a7ca3746 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.Events; |
| | | using UnityEngine.UI; |
| | | public class WarlordPavilionGiftDiyButtonCell : MonoBehaviour |
| | | { |
| | | |
| | | Image m_QualityBG; |
| | | Image qualityBG |
| | | { |
| | | get |
| | | { |
| | | if (m_QualityBG == null) |
| | | { |
| | | m_QualityBG = this.transform.GetComponent<Image>("Container_GiftCell/qualityIcon"); |
| | | } |
| | | return m_QualityBG; |
| | | } |
| | | } |
| | | |
| | | Button m_GiftBtn; |
| | | Button giftBtn |
| | | { |
| | | get |
| | | { |
| | | if (m_GiftBtn == null) |
| | | { |
| | | m_GiftBtn = this.transform.GetComponent<Button>("Container_GiftCell"); |
| | | } |
| | | return m_GiftBtn; |
| | | } |
| | | } |
| | | |
| | | |
| | | Text m_GiftName; |
| | | Text giftName |
| | | { |
| | | get |
| | | { |
| | | if (m_GiftName == null) |
| | | { |
| | | m_GiftName = this.transform.GetComponent<Text>("Container_GiftCell/name"); |
| | | } |
| | | return m_GiftName; |
| | | } |
| | | } |
| | | |
| | | OutlineEx m_TextOutline; |
| | | OutlineEx textOutline |
| | | { |
| | | get |
| | | { |
| | | if (m_TextOutline == null) |
| | | { |
| | | m_TextOutline = this.transform.GetComponent<OutlineEx>("Container_GiftCell/name"); |
| | | } |
| | | return m_TextOutline; |
| | | } |
| | | } |
| | | |
| | | Transform m_LvRect; |
| | | Transform lvRect |
| | | { |
| | | get |
| | | { |
| | | if (m_LvRect == null) |
| | | { |
| | | m_LvRect = this.transform.Find("Container_GiftCell/lvrect"); |
| | | } |
| | | return m_LvRect; |
| | | } |
| | | } |
| | | |
| | | Text m_LvText; |
| | | Text lvText |
| | | { |
| | | get |
| | | { |
| | | if (m_LvText == null) |
| | | { |
| | | m_LvText = this.transform.GetComponent<Text>("Container_GiftCell/lvrect/lv"); |
| | | } |
| | | return m_LvText; |
| | | } |
| | | } |
| | | |
| | | Image m_StateImg; |
| | | Image stateImg |
| | | { |
| | | get |
| | | { |
| | | if (m_StateImg == null) |
| | | { |
| | | m_StateImg = this.transform.GetComponent<Image>("Container_GiftCell/state"); |
| | | } |
| | | return m_StateImg; |
| | | } |
| | | } |
| | | |
| | | Image m_AwakeLockImg; //重生降低觉醒等级锁定的图片 |
| | | Image awakeLockImg |
| | | { |
| | | get |
| | | { |
| | | if (m_AwakeLockImg == null) |
| | | { |
| | | m_AwakeLockImg = this.transform.GetComponent<Image>("Container_GiftCell/lock"); |
| | | } |
| | | return m_AwakeLockImg; |
| | | } |
| | | } |
| | | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | } |
| | | private bool hasCustomListener = false; |
| | | |
| | | // 设置自定义监听器 |
| | | public void SetListener(UnityAction action) |
| | | { |
| | | hasCustomListener = true; // 标记已设置自定义监听 |
| | | giftBtn.SetListener(action); |
| | | } |
| | | |
| | | //showState 0:不显示 1:新增 2:提升 |
| | | public void Init(int giftID, int lv, int showState = 0) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | if (FBDJGEffectConfig.HasKey(giftID)) |
| | | { |
| | | var config = FBDJGEffectConfig.Get(giftID); |
| | | qualityBG.SetSprite("GiftQualityBG" + config.EffQuality); |
| | | giftName.text = config.Name; |
| | | giftName.color = GetColor(config.EffQuality); |
| | | textOutline.OutlineColor = GetOutlineColor(config.EffQuality); |
| | | lvText.text = lv.ToString(); |
| | | lvRect.SetActive(lv > 0); |
| | | stateImg.SetActive(showState > 0); |
| | | stateImg.SetSprite("GiftState" + showState); |
| | | stateImg.SetNativeSize(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | qualityBG.SetSprite("GiftQualityBG" + giftID); |
| | | giftName.text = string.Empty; |
| | | lvRect.SetActive(false); |
| | | stateImg.SetActive(false); |
| | | awakeLockImg.SetActive(false); |
| | | } |
| | | // 如果已经设置了自定义监听器,不覆盖 |
| | | if (!hasCustomListener) |
| | | { |
| | | giftBtn.SetListener(() => |
| | | { |
| | | ShowSmallTip(giftID, lv); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public void ShowSmallTip(int giftID, int giftLV) |
| | | { |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | if (giftID > 0) |
| | | { |
| | | var giftConfig = FBDJGEffectConfig.Get(giftID); |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV), |
| | | Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue * giftLV))); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | Color32 GetColor(int quality) |
| | | { |
| | | if (quality == 1) |
| | | { |
| | | //D196FF |
| | | return new Color32(209, 150, 255, 255); |
| | | } |
| | | else if (quality == 2) |
| | | { |
| | | //ffda8c |
| | | return new Color32(255, 218, 140, 255); |
| | | } |
| | | else if (quality == 3) |
| | | { |
| | | //ffbd88 |
| | | return new Color32(255, 189, 136, 255); |
| | | } |
| | | else if (quality == 4) |
| | | { |
| | | //ff8888 |
| | | return new Color32(255, 136, 136, 255); |
| | | } |
| | | return new Color32(255, 255, 255, 255); |
| | | } |
| | | |
| | | Color32 GetOutlineColor(int quality) |
| | | { |
| | | if (quality == 1) |
| | | { |
| | | //692088 |
| | | return new Color32(105, 32, 136, 128); |
| | | } |
| | | else if (quality == 2) |
| | | { |
| | | //886220 |
| | | return new Color32(136, 98, 32, 128); |
| | | } |
| | | else if (quality == 3) |
| | | { |
| | | //884a20 |
| | | return new Color32(136, 74, 32, 128); |
| | | } |
| | | else if (quality == 4) |
| | | { |
| | | //882020 |
| | | return new Color32(136, 32, 32, 128); |
| | | } |
| | | return new Color32(0, 0, 0, 128); |
| | | } |
| | | |
| | | GameObject cellContainer; |
| | | protected void LoadPrefab() |
| | | { |
| | | if (cellContainer != null) |
| | | return; |
| | | |
| | | var tmp = transform.Find("Container_GiftCell"); |
| | | if (tmp != null) |
| | | { |
| | | cellContainer = tmp.gameObject; |
| | | return; |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell"); |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | cellContainer.transform.SetAsFirstSibling(); |
| | | } |
| | | } |
| | | |
| | | //缩放到和父rect一样大 |
| | | var scale = 1f; |
| | | var rect = cellContainer.GetComponent<RectTransform>(); |
| | | var parentRect = transform.GetComponent<RectTransform>(); |
| | | float width = parentRect.sizeDelta.x; |
| | | if (width <= 0f) |
| | | { |
| | | //外部控制了尺寸获取为0 |
| | | GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>(); |
| | | if (grid != null) |
| | | { |
| | | width = grid.cellSize.x; |
| | | } |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7450261499a35894f83167fd90f9e418 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | |
| | | using UnityEngine; |
| | | public class WarlordPavilionGiftGird : MonoBehaviour |
| | | { |
| | | [SerializeField] ImageEx imgBG; |
| | | [SerializeField] Transform transUnlock; |
| | | [SerializeField] TextEx txtUnlock; |
| | | [SerializeField] ImageEx imgAdd; |
| | | [SerializeField] WarlordPavilionGiftCell cell; |
| | | [SerializeField] UIEffectPlayer effectPlayer; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | public void Display(int index, bool isPlay = false) |
| | | { |
| | | effectPlayer.Stop(); |
| | | // 0-未解锁 1-已解锁无效果 2-已解锁有效果 |
| | | int state = manager.GetGiftGirdState(index); |
| | | imgBG.SetActive(state != 2); |
| | | transUnlock.SetActive(state == 0); |
| | | imgAdd.SetActive(state == 1); |
| | | cell.SetActive(state == 2); |
| | | |
| | | if (state == 0) |
| | | { |
| | | bool hasNeedLayerNumAndLevelNum = manager.TryGetNeedLayerNumAndLevelNum(index, out int needLayerNum, out int needLevelNum); |
| | | txtUnlock.text = hasNeedLayerNumAndLevelNum ? Language.Get("Arena15", needLayerNum, needLevelNum) : string.Empty; |
| | | } |
| | | if (state == 2) |
| | | { |
| | | if (!manager.TryGetEff(index, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff)) |
| | | return; |
| | | cell.Init(eff.EffID, eff.EffLV); |
| | | } |
| | | if (isPlay) |
| | | { |
| | | effectPlayer.Play(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: bd30321d34ea2d740926495996da4bad |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | |
| | | public class WarlordPavilionManager : GameSystemManager<WarlordPavilionManager> |
| | | { |
| | | public readonly int RankType = 5; |
| | | public readonly int DataMapID = 30030; |
| | | |
| | | public uint TodayPass; //今日过关进度 层*100+关卡编号,历史最高过关记录取A320中的PassLineID |
| | | public Dictionary<int, HB202_tagSCDingjungeInfo.tagSCDingjungeEff> lastEffDict = new Dictionary<int, HB202_tagSCDingjungeInfo.tagSCDingjungeEff>(); |
| | | public HB202_tagSCDingjungeInfo.tagSCDingjungeEff[] EffList; //已生效的效果列表 |
| | | public uint[] SelectEffList; //待手动选择的效果ID列表 |
| | | public ushort UnSelectCnt; //还有几个未选择的效果 |
| | | public byte SelectAuto; //是否启用自动选择 |
| | | public ushort[] SelectSetAttrIDList; //预设优先选择属性ID列表 [优先级1属性ID, ...] |
| | | |
| | | public int[] unlockGiftGirdLevelIDs; //效果槽解锁所需过关关卡ID列表 [第1槽所需关卡ID, ...],列表的长度也是效果槽的总数 |
| | | public int giftGirdMaxCnt; //效果槽的总数 |
| | | public int bonusPresetMaxCnt; //预设加成效果可预设数 |
| | | public int[] funcOpenArr; |
| | | public int openLayerNum; |
| | | public int openLevelNum; |
| | | public int openLV; |
| | | public int backLayerCnt; // 每日回退层数,每日从回退后的层第1关开始挑战,若回退后的层数大于1,则强制需先进行快速挑战才能继续挑战 |
| | | public int[] sortIndexList; |
| | | private int m_SelectEffID; |
| | | public int selectEffID |
| | | { |
| | | get |
| | | { |
| | | return m_SelectEffID; |
| | | } |
| | | set |
| | | { |
| | | if (m_SelectEffID == value) |
| | | return; |
| | | m_SelectEffID = value; |
| | | } |
| | | } |
| | | |
| | | private int m_SelectIndex; |
| | | public int selectIndex |
| | | { |
| | | get |
| | | { |
| | | return m_SelectIndex; |
| | | } |
| | | set |
| | | { |
| | | if (m_SelectIndex == value) |
| | | return; |
| | | m_SelectIndex = value; |
| | | UpdateSelectGiftGirdIndexEvent?.Invoke(); |
| | | } |
| | | } |
| | | |
| | | private int m_SelectReplaceIndex; |
| | | public int selectReplaceIndex |
| | | { |
| | | get |
| | | { |
| | | return m_SelectReplaceIndex; |
| | | } |
| | | set |
| | | { |
| | | if (m_SelectReplaceIndex == value) |
| | | return; |
| | | m_SelectReplaceIndex = value; |
| | | UpdateSelectReplaceGiftGirdIndexEvent?.Invoke(); |
| | | } |
| | | } |
| | | public event Action UpdateSelectReplaceGiftGirdIndexEvent; |
| | | public event Action UpdateSelectGiftGirdIndexEvent; |
| | | public event Action<List<int>> OnUpdateDingjungeInfoEvent; |
| | | |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEventOnRelogin; |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh; |
| | | |
| | | var config = FuncConfigConfig.Get("DingjungeEff"); |
| | | unlockGiftGirdLevelIDs = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | giftGirdMaxCnt = unlockGiftGirdLevelIDs == null ? 0 : unlockGiftGirdLevelIDs.Length; |
| | | bonusPresetMaxCnt = int.Parse(config.Numerical4); |
| | | config = FuncConfigConfig.Get("Dingjunge"); |
| | | backLayerCnt = int.Parse(config.Numerical1); |
| | | sortIndexList = JsonMapper.ToObject<int[]>(config.Numerical2); |
| | | funcOpenArr = JsonMapper.ToObject<int[]>(config.Numerical3); |
| | | bool funcOpenArrNotExist = funcOpenArr == null || funcOpenArr.Length < 3; |
| | | openLayerNum = funcOpenArrNotExist ? 0 : funcOpenArr[0]; |
| | | openLevelNum = funcOpenArrNotExist ? 0 : funcOpenArr[1]; |
| | | openLV = funcOpenArrNotExist ? 0 : funcOpenArr[2]; |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitializeEventOnRelogin; |
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh; |
| | | } |
| | | |
| | | private void OnBeforePlayerDataInitializeEventOnRelogin() |
| | | { |
| | | isGiveupToggleOn = false; |
| | | |
| | | TodayPass = 0; |
| | | lastEffDict = new Dictionary<int, HB202_tagSCDingjungeInfo.tagSCDingjungeEff>(); |
| | | EffList = null; |
| | | SelectEffList = null; |
| | | UnSelectCnt = 0; |
| | | SelectAuto = 0; |
| | | SelectSetAttrIDList = null; |
| | | } |
| | | |
| | | private void PlayerDataRefresh(PlayerDataType type) |
| | | { |
| | | if (PlayerDataType.LV == type) |
| | | { |
| | | UpdateRedpoint(); |
| | | } |
| | | } |
| | | |
| | | private void OnFuncStateChangeEvent(int obj) |
| | | { |
| | | if (obj == (int)FuncOpenEnum.WarlordPavilion) |
| | | { |
| | | UpdateRedpoint(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public bool IsFuncOpen(bool isTip = false) |
| | | { |
| | | GetCurrentFinishProgress(out int layerNum, out int levelNum); |
| | | int lv = PlayerDatas.Instance.baseData.LV; |
| | | bool isOpen = false; |
| | | if (lv >= openLV) |
| | | { |
| | | if (layerNum < openLayerNum) |
| | | { |
| | | isOpen = false; |
| | | } |
| | | else if (layerNum == openLayerNum) |
| | | { |
| | | isOpen = levelNum >= openLevelNum; |
| | | } |
| | | else |
| | | { |
| | | isOpen = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | isOpen = false; |
| | | } |
| | | |
| | | if (!isOpen && isTip) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("WarlordPavilion01", openLayerNum, openLevelNum, openLV); |
| | | } |
| | | return isOpen; |
| | | } |
| | | |
| | | public Redpoint parentRedpoint = new Redpoint(MainRedDot.WarlordPavilionRepoint); |
| | | public void UpdateRedpoint() |
| | | { |
| | | parentRedpoint.state = RedPointState.None; |
| | | |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.WarlordPavilion)) |
| | | return; |
| | | |
| | | //当日可以快速挑战 |
| | | bool canFastChallenge = CanFastChallenge(); |
| | | if (canFastChallenge) |
| | | { |
| | | parentRedpoint.state = RedPointState.Simple; |
| | | return; |
| | | } |
| | | //每日0点显示加成预设红点 |
| | | bool isTodayShowSelectBonusRed = IsTodayShowSelectBonusRed(); |
| | | if (isTodayShowSelectBonusRed) |
| | | { |
| | | parentRedpoint.state = RedPointState.Simple; |
| | | return; |
| | | } |
| | | } |
| | | |
| | | string key |
| | | { |
| | | get |
| | | { |
| | | return StringUtility.Concat( |
| | | "WarlordPavilion_SelectBonus_", |
| | | PlayerDatas.Instance.PlayerId.ToString() |
| | | ); |
| | | } |
| | | } |
| | | |
| | | public int GetLoacl() |
| | | { |
| | | int hasLocal = LocalSave.GetInt(key); |
| | | return hasLocal; |
| | | } |
| | | |
| | | public void SetLoacl() |
| | | { |
| | | LocalSave.SetInt(key, TimeUtility.AllSeconds); |
| | | } |
| | | |
| | | public bool IsTodayShowSelectBonusRed() |
| | | { |
| | | bool isOpen = IsFuncOpen(); |
| | | if (!isOpen) |
| | | return false; |
| | | |
| | | int localTime = GetLoacl(); |
| | | if (localTime <= 0) |
| | | return true; |
| | | DateTime lastFailTime = TimeUtility.GetTime((uint)localTime); |
| | | DateTime now = TimeUtility.ServerNow; |
| | | if (lastFailTime.Year != now.Year || lastFailTime.Month != now.Month || lastFailTime.Day != now.Day) |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | ushort[] chooseAttrIDList = null; |
| | | public ushort[] GetChooseAttrIDList() |
| | | { |
| | | if (chooseAttrIDList == null) |
| | | { |
| | | chooseAttrIDList = new ushort[giftGirdMaxCnt]; |
| | | } |
| | | return chooseAttrIDList; |
| | | } |
| | | |
| | | public event Action OnChooseAttrIDListChangeEvent; |
| | | public void SetChooseAttrIDList(int index, int attrID) |
| | | { |
| | | if (chooseAttrIDList == null) |
| | | chooseAttrIDList = new ushort[giftGirdMaxCnt]; |
| | | if (index < 0 || index >= giftGirdMaxCnt) |
| | | return; |
| | | List<int> attrIds = GetAttrIds(); |
| | | if (attrIds.IsNullOrEmpty()) |
| | | return; |
| | | if (attrID < 0 && !attrIds.Contains(attrID)) |
| | | return; |
| | | |
| | | if (attrID <= 0) |
| | | { |
| | | chooseAttrIDList[index] = 0; |
| | | } |
| | | else |
| | | { |
| | | if (!chooseAttrIDList.Contains((ushort)attrID)) |
| | | { |
| | | chooseAttrIDList[index] = (ushort)attrID; |
| | | return; |
| | | } |
| | | int oldIndex = IndexOf(attrID); |
| | | if (oldIndex < 0) |
| | | return; |
| | | ushort temp = chooseAttrIDList[index]; |
| | | chooseAttrIDList[oldIndex] = temp; |
| | | chooseAttrIDList[index] = (ushort)attrID; |
| | | } |
| | | OnChooseAttrIDListChangeEvent?.Invoke(); |
| | | } |
| | | |
| | | public int IndexOf(int attrID) |
| | | { |
| | | if (chooseAttrIDList == null) |
| | | return -1; |
| | | for (int i = 0; i < chooseAttrIDList.Length; i++) |
| | | { |
| | | int tempAttrID = chooseAttrIDList[i]; |
| | | if (tempAttrID == attrID) |
| | | return i; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | public void SetChooseAttrIDList() |
| | | { |
| | | chooseAttrIDList = null; |
| | | |
| | | if (SelectSetAttrIDList != null) |
| | | { |
| | | chooseAttrIDList = new ushort[SelectSetAttrIDList.Length]; |
| | | Array.Copy(SelectSetAttrIDList, chooseAttrIDList, SelectSetAttrIDList.Length); |
| | | } |
| | | } |
| | | |
| | | List<string> options = null; |
| | | public List<string> GetOptions() |
| | | { |
| | | List<int> attrIdList = GetAttrIds(); |
| | | if (options == null) |
| | | { |
| | | options = new List<string>(); |
| | | options.Add(Language.Get("L1125")); // 添加"无"选项 |
| | | |
| | | if (attrIdList.IsNullOrEmpty()) |
| | | return options; |
| | | foreach (int attrId in attrIdList) |
| | | { |
| | | if (!PlayerPropertyConfig.HasKey(attrId)) |
| | | continue; |
| | | PlayerPropertyConfig playerPropertyConfig = PlayerPropertyConfig.Get(attrId); |
| | | options.Add(playerPropertyConfig.ShowName); |
| | | } |
| | | } |
| | | return options; |
| | | } |
| | | |
| | | Dictionary<int, int> indexToAttrIds = null; |
| | | public Dictionary<int, int> GetIndexToAttrIds() |
| | | { |
| | | List<int> attrIdList = GetAttrIds(); |
| | | if (indexToAttrIds == null) |
| | | { |
| | | indexToAttrIds = new Dictionary<int, int>(); |
| | | indexToAttrIds[0] = 0; |
| | | if (attrIdList.IsNullOrEmpty()) |
| | | return indexToAttrIds; |
| | | for (int i = 0; i < attrIdList.Count; i++) |
| | | { |
| | | indexToAttrIds[i + 1] = attrIdList[i]; |
| | | } |
| | | } |
| | | return indexToAttrIds; |
| | | } |
| | | |
| | | |
| | | private List<int> attrIds = null; |
| | | public List<int> GetAttrIds() |
| | | { |
| | | if (attrIds.IsNullOrEmpty()) |
| | | { |
| | | attrIds = new List<int>(); |
| | | foreach (var config in FBDJGEffectConfig.GetValues()) |
| | | { |
| | | int attrId = config.AttrID; |
| | | if (!attrIds.Contains(attrId)) |
| | | { |
| | | attrIds.Add(attrId); |
| | | } |
| | | } |
| | | attrIds.Sort((a, b) => |
| | | { |
| | | if (sortIndexList.IsNullOrEmpty()) |
| | | { |
| | | return a.CompareTo(b); // fallback到数字排序 |
| | | } |
| | | int indexA = Array.IndexOf(sortIndexList, a); |
| | | int indexB = Array.IndexOf(sortIndexList, b); |
| | | if (indexA < 0) indexA = int.MaxValue; |
| | | if (indexB < 0) indexB = int.MaxValue; |
| | | return indexA.CompareTo(indexB); |
| | | }); |
| | | |
| | | } |
| | | return attrIds; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 尝试获取指定效果ID所在的效果槽索引 |
| | | /// </summary> |
| | | /// <param name="effID">要查找的效果ID</param> |
| | | /// <param name="gridIndex">输出:效果ID所在的效果槽索引</param> |
| | | /// <returns>效果槽中是否存在指定的效果ID</returns> |
| | | public bool TryGetEffGridIndex(int effID, out int gridIndex) |
| | | { |
| | | gridIndex = -1; |
| | | |
| | | if (EffList.IsNullOrEmpty()) |
| | | return false; |
| | | |
| | | foreach (var eff in EffList) |
| | | { |
| | | if (eff.EffID == effID) |
| | | { |
| | | gridIndex = eff.EffIndex; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 尝试获取已解锁且没有效果的格子索引 |
| | | /// </summary> |
| | | /// <param name="emptyIndex">输出:索引最小的已解锁且没有效果的格子索引</param> |
| | | /// <returns>是否存在已解锁且没有效果的格子</returns> |
| | | public bool TryGetEmptyUnlockedGiftGrid(out int emptyIndex) |
| | | { |
| | | emptyIndex = 0; |
| | | |
| | | if (giftGirdMaxCnt <= 0) |
| | | return false; |
| | | |
| | | for (int i = 0; i < giftGirdMaxCnt; i++) |
| | | { |
| | | // 检查是否已解锁且没有效果 |
| | | int state = GetGiftGirdState(i); // 0-未解锁 1-已解锁无效果 2-已解锁有效果 |
| | | if (state == 1) |
| | | { |
| | | emptyIndex = i; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | // 是否达到满层 |
| | | public bool IsPass() |
| | | { |
| | | // 防护 拿不到满层数据视为满层 |
| | | if (!FBDJGLevelConfig.TryGetMaxFBDJGLevelConfig(out FBDJGLevelConfig maxConfig)) |
| | | return true; |
| | | GetCurrentFinishProgress(out int curLayer, out int curLevel); |
| | | return maxConfig.LayerNum <= curLayer && maxConfig.LevelNum <= curLevel; |
| | | } |
| | | |
| | | //是否有未选择的效果 |
| | | public bool HasBonusToSelect() |
| | | { |
| | | return !SelectEffList.IsNullOrEmpty(); |
| | | } |
| | | |
| | | // 是否开启了自动预设 |
| | | public bool IsAutoPresetOn() |
| | | { |
| | | return SelectAuto == 1; |
| | | } |
| | | |
| | | // 是否可以快速挑战 |
| | | public bool CanFastChallenge() |
| | | { |
| | | GetHistoryMaxFinishProgress(out int maxLayer, out int maxLevel); |
| | | bool hasNext = FBDJGLevelConfig.TryGetNextLevel(maxLayer, maxLevel, out int nextLayerNum, out int nextLevelNum); |
| | | int curMaxLayer = hasNext ? nextLayerNum : maxLayer; |
| | | //若玩家历史最高层数-2>1,则次日可使用快速挑战功能 |
| | | bool isTodayNoFight = IsTodayNoFight(); |
| | | if (isTodayNoFight && curMaxLayer - backLayerCnt > 1) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public bool TryGetEff(int index, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff) |
| | | { |
| | | eff = null; |
| | | if (EffList.IsNullOrEmpty()) |
| | | return false; |
| | | |
| | | foreach (var tempEff in EffList) |
| | | { |
| | | if (tempEff.EffIndex == index) |
| | | { |
| | | eff = tempEff; |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | public bool TryGetEffByEffID(int effID, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff) |
| | | { |
| | | eff = null; |
| | | if (EffList.IsNullOrEmpty()) |
| | | return false; |
| | | |
| | | foreach (var tempEff in EffList) |
| | | { |
| | | if (tempEff.EffID == effID) |
| | | { |
| | | eff = tempEff; |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // 0-未解锁 1-已解锁无效果 2-已解锁有效果 |
| | | public int GetGiftGirdState(int index) |
| | | { |
| | | return !IsGiftGridUnlock(index) ? 0 : !hasEffGiftGrid(index) ? 1 : 2; |
| | | } |
| | | |
| | | public bool hasEffGiftGrid(int index) |
| | | { |
| | | if (EffList.IsNullOrEmpty() || index < 0 || index >= EffList.Length) |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | public bool IsGiftGridUnlock(int index) |
| | | { |
| | | if (!TryGetNeedLayerNumAndLevelNum(index, out int needLayerNum, out int needLevelNum)) |
| | | return true; |
| | | GetCurrentFinishProgress(out int layerNum, out int levelNum); |
| | | if (needLayerNum > layerNum) |
| | | return false; |
| | | if (needLayerNum < layerNum) |
| | | return true; |
| | | return needLevelNum <= levelNum; |
| | | } |
| | | |
| | | |
| | | public bool TryGetNeedLayerNumAndLevelNum(int index, out int needLayerNum, out int needLevelNum) |
| | | { |
| | | needLayerNum = 0; |
| | | needLevelNum = 0; |
| | | if (unlockGiftGirdLevelIDs.IsNullOrEmpty() || index < 0 || index >= unlockGiftGirdLevelIDs.Length) |
| | | return false; |
| | | int levelID = unlockGiftGirdLevelIDs[index]; |
| | | if (!FBDJGLevelConfig.TryGetFBDJGLevelConfig(levelID, out FBDJGLevelConfig config)) |
| | | return false; |
| | | needLayerNum = config.LayerNum; |
| | | needLevelNum = config.LevelNum; |
| | | return true; |
| | | } |
| | | |
| | | public string GetCountdownToNextDay() |
| | | { |
| | | int remainSeconds = TimeUtility.GetTodayRemainSeconds(); |
| | | return TimeUtility.SecondsToShortDHMS(remainSeconds); |
| | | } |
| | | |
| | | public bool isGiveupToggleOn = false; |
| | | private List<int> awards = new List<int>(); |
| | | |
| | | public List<int> GetAwardList() |
| | | { |
| | | if (awards.IsNullOrEmpty()) |
| | | { |
| | | awards = FBDJGQuickConfig.GetKeys(); |
| | | awards.Sort(); |
| | | } |
| | | return awards; |
| | | } |
| | | public void DisplayItemCell(ItemCell[] cells, int[][] items) |
| | | { |
| | | if (cells.IsNullOrEmpty() || items.IsNullOrEmpty()) |
| | | return; |
| | | |
| | | for (int i = 0; i < cells.Length; i++) |
| | | { |
| | | if (i < items.Length) |
| | | { |
| | | cells[i].SetActive(true); |
| | | int itemID = items[i][0]; |
| | | int count = items[i][1]; |
| | | cells[i].Init(new ItemCellModel(itemID, false, count)); |
| | | cells[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | | cells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | public bool TryGetShowLayerNumAndLevelNum(out int showLayerNum, out int showLevelNum) |
| | | { |
| | | showLayerNum = 0; |
| | | showLevelNum = 0; |
| | | if (!FBDJGLevelConfig.TryGetMinFBDJGLevelConfig(out FBDJGLevelConfig minConfig)) |
| | | return false; |
| | | // 没战斗过 显示第一层 |
| | | bool isNoFinishProgress = IsTodayNoFight(); |
| | | if (isNoFinishProgress) |
| | | { |
| | | showLayerNum = minConfig.LayerNum; |
| | | showLevelNum = minConfig.LevelNum; |
| | | } |
| | | else |
| | | { |
| | | //不是最后一层,就显示下一层 |
| | | GetCurrentFinishProgress(out int layerNum, out int levelNum); |
| | | bool isShowNoMaxLevel = FBDJGLevelConfig.TryGetNextLevel(layerNum, levelNum, out int nextLayerNum, out int nextLevelNum); |
| | | showLayerNum = isShowNoMaxLevel ? nextLayerNum : layerNum; |
| | | showLevelNum = isShowNoMaxLevel ? nextLevelNum : levelNum; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public bool TryGetNPCConfig(int layerNum, int levelNum, out NPCLineupConfig npcLineupConfig, out NPCConfig npcConfig) |
| | | { |
| | | npcConfig = null; |
| | | npcLineupConfig = null; |
| | | if (!FBDJGLevelConfig.TryGetFBDJGLevelConfig(layerNum, levelNum, out var config)) |
| | | return false; |
| | | int[] lineupIDList = config.LineupIDList; |
| | | if (lineupIDList.IsNullOrEmpty()) |
| | | return false; |
| | | int lineupID = lineupIDList[0]; |
| | | if (!NPCLineupConfig.HasKey(lineupID)) |
| | | return false; |
| | | npcLineupConfig = NPCLineupConfig.Get(lineupID); |
| | | int bossId = npcLineupConfig.BossID; |
| | | if (!NPCConfig.HasKey(bossId)) |
| | | return false; |
| | | npcConfig = NPCConfig.Get(bossId); |
| | | return true; |
| | | } |
| | | |
| | | public bool IsTodayNoFight() |
| | | { |
| | | return TodayPass <= 0; |
| | | } |
| | | |
| | | public void AnalysisFinishProgress(int value, out int layerNum, out int levelNum) |
| | | { |
| | | layerNum = value / 100; |
| | | levelNum = value % 100; |
| | | } |
| | | |
| | | public int GetLineID(int layerNum, int levelNum) |
| | | { |
| | | return layerNum * 100 + levelNum; |
| | | } |
| | | |
| | | // 获取当前完成的层数和关卡编号 |
| | | public void GetCurrentFinishProgress(out int layerNum, out int levelNum) |
| | | { |
| | | AnalysisFinishProgress((int)TodayPass, out layerNum, out levelNum); |
| | | } |
| | | |
| | | // 获取历史完成的最高层数和关卡编号 |
| | | public void GetHistoryMaxFinishProgress(out int layerNum, out int levelNum) |
| | | { |
| | | layerNum = 0; |
| | | levelNum = 0; |
| | | if (!FBDJGLevelConfig.TryGetMinFBDJGLevelConfig(out FBDJGLevelConfig minConfig)) |
| | | return; |
| | | layerNum = minConfig.LayerNum; |
| | | levelNum = minConfig.LevelNum; |
| | | if (!DungeonManager.Instance.TryGetFBInfoByMapID(DataMapID, out var fbInfo) || fbInfo == null) |
| | | return; |
| | | AnalysisFinishProgress((int)fbInfo.PassLineID, out layerNum, out levelNum); |
| | | } |
| | | |
| | | public void GetHistoryMaxPassLayerNum(out int layerNum) |
| | | { |
| | | layerNum = 0; |
| | | GetHistoryMaxFinishProgress(out int finishLayerNum, out int finishLevelNum); |
| | | if (!FBDJGLevelConfig.TryGetMinFBDJGLevelConfig(out FBDJGLevelConfig minConfig)) |
| | | return; |
| | | if (!FBDJGLevelConfig.TryGetMaxLevelNumInLayer(finishLayerNum, out int maxLevelNum)) |
| | | return; |
| | | layerNum = finishLevelNum >= maxLevelNum ? finishLayerNum : Mathf.Max(finishLayerNum - 1, minConfig.LayerNum); |
| | | } |
| | | |
| | | |
| | | public void UpdateDingjungeInfo(HB202_tagSCDingjungeInfo vNetData) |
| | | { |
| | | TodayPass = vNetData.TodayPass; |
| | | SelectEffList = vNetData.SelectEffList; |
| | | UnSelectCnt = vNetData.UnSelectCnt; |
| | | SelectAuto = vNetData.SelectAuto; |
| | | SelectSetAttrIDList = vNetData.SelectSetAttrIDList; |
| | | List<int> effectIndexList = GetEffectIndexList(vNetData.EffList); |
| | | |
| | | EffList = vNetData.EffList; |
| | | UpdateRedpoint(); |
| | | OnUpdateDingjungeInfoEvent?.Invoke(effectIndexList); |
| | | |
| | | } |
| | | |
| | | public List<int> GetEffectIndexList(HB202_tagSCDingjungeInfo.tagSCDingjungeEff[] EffList) |
| | | { |
| | | if (EffList.IsNullOrEmpty()) |
| | | return null; |
| | | List<int> result = new List<int>(); |
| | | foreach (var eff in EffList) |
| | | { |
| | | if (!lastEffDict.ContainsKey(eff.EffIndex)) |
| | | { |
| | | if (eff.EffID == 0) |
| | | continue; |
| | | result.Add(eff.EffIndex); |
| | | } |
| | | else |
| | | { |
| | | if (lastEffDict[eff.EffIndex].EffID != eff.EffID || lastEffDict[eff.EffIndex].EffLV != eff.EffLV) |
| | | { |
| | | result.Add(eff.EffIndex); |
| | | } |
| | | } |
| | | lastEffDict[eff.EffIndex] = eff; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public void SendDingjungeEffSelect(int selectType, int selectIndex, int replaceHole) |
| | | { |
| | | CB102_tagCSDingjungeEffSelect pack = new CB102_tagCSDingjungeEffSelect(); |
| | | pack.SelectType = (byte)selectType; //0-手动选择,1-放弃本次选择,2-一键选择(仅开启了自动选择时有效) |
| | | pack.SelectIndex = (byte)selectIndex; //手动选择索引 0~n |
| | | pack.ReplaceHole = (byte)replaceHole; //手动选择替换槽位 1~n,槽位=槽索引+1,升级时可直接发0 |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | public void SendDingjungeEffSet(bool isSelectAuto, ushort[] selectSetAttrIDList) |
| | | { |
| | | CB101_tagCSDingjungeEffSet pack = new CB101_tagCSDingjungeEffSet(); |
| | | pack.SelectAuto = isSelectAuto ? (byte)1 : (byte)0; |
| | | pack.SelectSetAttrIDList = selectSetAttrIDList.IsNullOrEmpty() ? new ushort[bonusPresetMaxCnt] : selectSetAttrIDList; |
| | | pack.SelectSetCnt = (byte)pack.SelectSetAttrIDList.Length; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | |
| | | public void SendFBQuickPass(int dataMapID, int lineID) |
| | | { |
| | | CB108_tagCMFBQuickPass pack = new CB108_tagCMFBQuickPass(); |
| | | pack.MapID = (uint)dataMapID; |
| | | pack.LineID = (ushort)lineID; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ec3bcd654e946944784378b1e6ae50bd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class WarlordPavilionPlayerRankCell : MonoBehaviour |
| | | { |
| | | [SerializeField] AvatarCell avatarCell; |
| | | [SerializeField] Text rankText; |
| | | [SerializeField] Text rankValueText; //排名比较内容 |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] OfficialTitleCell officialTitleCell; |
| | | [SerializeField] Button queryPlayerBtn; //后续添加点击查看玩家详情 |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | // rank 为0 代表玩家自己 |
| | | public void Display(int rankType, int rank, string valueFormat) |
| | | { |
| | | RankData rankData = null; |
| | | int viewPlayerId = (int)PlayerDatas.Instance.baseData.PlayerID; |
| | | if (rank != 0) |
| | | { |
| | | rankData = RankModel.Instance.GetRankDataByRank(rankType, rank); |
| | | } |
| | | else |
| | | { |
| | | rankData = RankModel.Instance.GetMyRank(rankType); |
| | | if (rankData == null) |
| | | { |
| | | //取玩家自己的数据 |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | nameText.text = PlayerDatas.Instance.baseData.PlayerName; |
| | | officialTitleCell.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | return; |
| | | } |
| | | rank = rankData.rank; |
| | | } |
| | | if (rankData == null) |
| | | { |
| | | officialTitleCell.SetActive(false); |
| | | avatarCell.SetActive(false); |
| | | nameText.text = Language.Get("L1124"); |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | } |
| | | else |
| | | { |
| | | officialTitleCell.SetActive(true); |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2); |
| | | avatarCell.SetActive(true); |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | viewPlayerId = (int)rankData.id; |
| | | nameText.text = rankData.name1; |
| | | manager.AnalysisFinishProgress((int)rankData.cmpValue, out int layerNum, out int levelNum); |
| | | rankValueText.text = Language.Get("WarlordPavilion23", layerNum, levelNum); |
| | | } |
| | | |
| | | rankText.text = rank.ToString(); |
| | | if (queryPlayerBtn != null) |
| | | { |
| | | queryPlayerBtn.AddListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo(viewPlayerId); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a709f52774c19354f84d8bdec0782fa0 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Wednesday, September 26, 2018 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class WarlordPavilionPlayerTop3Cell : MonoBehaviour |
| | | { |
| | | //[SerializeField] Model 显示NPC 武将模型 |
| | | [SerializeField] Text rankValueText; //排名比较内容 |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] OfficialTitleCell officialTitleCell; |
| | | [SerializeField] Button queryPlayerBtn; //后续添加点击查看玩家详情 |
| | | [SerializeField] HorseController model; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | public void Display(int rankType, int rank, string valueFormat = "{0}") |
| | | { |
| | | var rankData = RankModel.Instance.GetRankDataByRank(rankType, rank); |
| | | if (rankData == null) |
| | | { |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | nameText.text = Language.Get("L1124"); |
| | | officialTitleCell.SetActive(false); |
| | | model.SetActive(false); |
| | | return; |
| | | } |
| | | officialTitleCell.SetActive(true); |
| | | manager.AnalysisFinishProgress((int)rankData.cmpValue, out int layerNum, out int levelNum); |
| | | rankValueText.text = Language.Get("WarlordPavilion23", layerNum, levelNum); |
| | | nameText.text = rankData.name1; |
| | | officialTitleCell.InitUI((int)rankData.value1, (int)rankData.value2); |
| | | model.SetActive(true); |
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, rank == 1 ? 1f : 0.8f); |
| | | queryPlayerBtn.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 17533cedcfb10a44a8b1256ca7f8c6a2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | public class WarlordPavilionRankWin : UIBase |
| | | { |
| | | [SerializeField] List<WarlordPavilionPlayerTop3Cell> playerTop3Cells; |
| | | [SerializeField] TextEx rankText; |
| | | [SerializeField] TextEx rankValueText; //排名比较内容 |
| | | [HideInInspector] public string valueFormat = "{0}"; |
| | | [HideInInspector] public int groupValue1 = 0; //一般用于跨服 |
| | | [HideInInspector] public int groupValue2 = 0; //一般用于跨服 |
| | | [SerializeField] ScrollerController scroller; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | RankModel.Instance.ResetQueryParam(); |
| | | RankModel.Instance.QueryRankByPage(manager.RankType, watchID: (int)PlayerDatas.Instance.baseData.PlayerID); |
| | | RankModel.Instance.onRankRefresh += OnRankRefresh; |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | ShowTop3(); |
| | | CreateScroller(); |
| | | DisplayMyRank(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | RankModel.Instance.onRankRefresh -= OnRankRefresh; |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | } |
| | | void OnRankRefresh(int type) |
| | | { |
| | | RefreshAll(); |
| | | } |
| | | void RefreshAll() |
| | | { |
| | | ShowTop3(); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | DisplayMyRank(); |
| | | } |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell.GetComponent<WarlordPavilionPlayerRankCell>(); |
| | | _cell.Display(manager.RankType, cell.index + 1, valueFormat); |
| | | RankModel.Instance.ListenRankPage(manager.RankType, cell.index, groupValue1, groupValue2); |
| | | } |
| | | |
| | | void CreateScroller() |
| | | { |
| | | scroller.Refresh(); |
| | | var cnt = RankModel.Instance.GetRankShowMaxCnt(manager.RankType); |
| | | for (int i = 3; i < cnt; i++) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | |
| | | void ShowTop3() |
| | | { |
| | | for (int i = 0; i < playerTop3Cells.Count; i++) |
| | | { |
| | | playerTop3Cells[i].Display(manager.RankType, i + 1); |
| | | } |
| | | } |
| | | |
| | | private void DisplayMyRank() |
| | | { |
| | | int rankType = manager.RankType; |
| | | int rank = 0; |
| | | RankData rankData = null; |
| | | if (rank != 0) |
| | | { |
| | | rankData = RankModel.Instance.GetRankDataByRank(rankType, rank); |
| | | } |
| | | else |
| | | { |
| | | rankData = RankModel.Instance.GetMyRank(rankType); |
| | | if (rankData == null) |
| | | { |
| | | //取玩家自己的数据 |
| | | rankText.text = Language.Get("L1045"); |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | return; |
| | | } |
| | | rank = rankData.rank; |
| | | } |
| | | if (rankData == null) |
| | | { |
| | | rankValueText.text = "";//Language.Get("L1125"); |
| | | } |
| | | else |
| | | { |
| | | manager.AnalysisFinishProgress((int)rankData.cmpValue, out int layerNum, out int levelNum); |
| | | rankValueText.text = Language.Get("WarlordPavilion23", layerNum, levelNum); |
| | | } |
| | | rankText.text = Language.Get("WarlordPavilion12", rank); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 58b1a69c39aec164ab846ac94cc6a701 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | |
| | | public class WarlordPavilionReplaceBonusWin : UIBase |
| | | { |
| | | [SerializeField] WarlordPavilionReplaceGiftGird[] giftCells; |
| | | [SerializeField] ButtonEx btnOk; |
| | | [SerializeField] ButtonEx btnClose; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | btnOk.SetListener(() => |
| | | { |
| | | if (manager.selectReplaceIndex < 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("WarlordPavilion02"); |
| | | return; |
| | | } |
| | | manager.SendDingjungeEffSelect(0, manager.selectIndex, manager.selectReplaceIndex + 1); |
| | | CloseWindow(); |
| | | }); |
| | | btnClose.SetListener(() => |
| | | { |
| | | CloseWindow(); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | manager.UpdateSelectReplaceGiftGirdIndexEvent += UpdateSelectReplaceGiftGirdIndexEvent; |
| | | manager.selectReplaceIndex = -1;//默认不选中 |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | manager.UpdateSelectReplaceGiftGirdIndexEvent -= UpdateSelectReplaceGiftGirdIndexEvent; |
| | | } |
| | | |
| | | private void UpdateSelectReplaceGiftGirdIndexEvent() |
| | | { |
| | | Display(); |
| | | } |
| | | |
| | | private void Display() |
| | | { |
| | | for (int i = 0; i < giftCells.Length; i++) |
| | | { |
| | | bool isChoose = manager.selectReplaceIndex == i; |
| | | giftCells[i].Display(i, isChoose); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f95498841dec2e04b849e65e1b1bf4a5 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | public class WarlordPavilionReplaceGiftGird : MonoBehaviour |
| | | { |
| | | |
| | | [SerializeField] ImageEx imgBG; |
| | | [SerializeField] Transform transUnlock; |
| | | [SerializeField] TextEx txtUnlock; |
| | | [SerializeField] ImageEx imgAdd; |
| | | [SerializeField] UIEffectPlayer effectPlayer; |
| | | [SerializeField] ImageEx imgChoose; |
| | | [SerializeField] WarlordPavilionGiftDiyButtonCell cell; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | public void Display(int index, bool isChoose = false) |
| | | { |
| | | imgChoose.SetActive(isChoose); |
| | | // 0-未解锁 1-已解锁无效果 2-已解锁有效果 |
| | | int state = manager.GetGiftGirdState(index); |
| | | imgBG.SetActive(state != 2); |
| | | transUnlock.SetActive(state == 0); |
| | | imgAdd.SetActive(state == 1); |
| | | cell.SetActive(state == 2); |
| | | |
| | | if (state == 0) |
| | | { |
| | | bool hasNeedLayerNumAndLevelNum = manager.TryGetNeedLayerNumAndLevelNum(index, out int needLayerNum, out int needLevelNum); |
| | | txtUnlock.text = hasNeedLayerNumAndLevelNum ? Language.Get("Arena15", needLayerNum, needLevelNum) : string.Empty; |
| | | } |
| | | if (state == 2) |
| | | { |
| | | if (!manager.TryGetEff(index, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff)) |
| | | return; |
| | | cell.Init(eff.EffID, eff.EffLV); |
| | | cell.SetListener(() => |
| | | { |
| | | if (manager.selectReplaceIndex == index) |
| | | { |
| | | cell.ShowSmallTip(eff.EffID, eff.EffLV); |
| | | } |
| | | manager.selectReplaceIndex = index; |
| | | }); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0fcd5717f6117be4fae12d9dd1ba1b07 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | |
| | | public class WarlordPavilionSelectBonusCell : MonoBehaviour |
| | | { |
| | | |
| | | [SerializeField] WarlordPavilionSelectGiftGird chooseCell; |
| | | |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | public void Display(int index) |
| | | { |
| | | if (manager.SelectEffList.IsNullOrEmpty() || index < 0 || index >= manager.SelectEffList.Length) |
| | | return; |
| | | int effID = (int)manager.SelectEffList[index]; |
| | | bool isChoose = effID == manager.selectEffID; |
| | | bool isUp = manager.TryGetEffByEffID(effID, out HB202_tagSCDingjungeInfo.tagSCDingjungeEff eff); |
| | | chooseCell.Display(index, effID, isChoose, isUp); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 438258b01785bdf468dfac5038b76244 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class WarlordPavilionSelectBonusWin : UIBase |
| | | { |
| | | [SerializeField] WarlordPavilionGiftGird[] giftCells; |
| | | [SerializeField] TextEx txtAttr; |
| | | [SerializeField] TextEx txtAttrValue; |
| | | [SerializeField] TextEx txtCnt; |
| | | [SerializeField] ScrollerController scroller; |
| | | [SerializeField] ButtonEx btnOk; |
| | | [SerializeField] ButtonEx btnGiveup; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | btnOk.SetListener(() => |
| | | { |
| | | // 效果槽里有指定效果 |
| | | if (manager.TryGetEffGridIndex(manager.selectEffID, out int gridIndex)) |
| | | { |
| | | manager.SendDingjungeEffSelect(0, manager.selectIndex, 0); |
| | | TryClose(); |
| | | return; |
| | | } |
| | | |
| | | // 效果槽里有已解锁且没有效果的格子 |
| | | if (manager.TryGetEmptyUnlockedGiftGrid(out int emptyIndex)) |
| | | { |
| | | manager.SendDingjungeEffSelect(0, manager.selectIndex, emptyIndex + 1); |
| | | TryClose(); |
| | | return; |
| | | } |
| | | UIManager.Instance.OpenWindow<WarlordPavilionReplaceBonusWin>(); |
| | | }); |
| | | btnGiveup.SetListener(() => |
| | | { |
| | | if (!manager.isGiveupToggleOn) |
| | | { |
| | | ConfirmCancel.ToggleConfirmCancel( |
| | | Language.Get("L1003"), |
| | | Language.Get("WarlordPavilion27"), |
| | | Language.Get("TianziBillborad08"), |
| | | Language.Get("PopConfirmWin_OK"), |
| | | null, |
| | | (bool isOK, bool isToggle) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | manager.isGiveupToggleOn = isToggle; |
| | | GiveUp(); |
| | | } |
| | | }, |
| | | false |
| | | ); |
| | | return; |
| | | } |
| | | GiveUp(); |
| | | }); |
| | | } |
| | | |
| | | void GiveUp() |
| | | { |
| | | manager.SendDingjungeEffSelect(1, 0, 0); |
| | | TryClose(); |
| | | } |
| | | |
| | | void TryClose() |
| | | { |
| | | // 没有未选择的效果 |
| | | if (manager.UnSelectCnt <= 0 && manager.SelectEffList.IsNullOrEmpty()) |
| | | { |
| | | CloseWindow(); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | manager.UpdateSelectGiftGirdIndexEvent += UpdateSelectGiftGirdIndexEvent; |
| | | manager.OnUpdateDingjungeInfoEvent += OnUpdateDingjungeInfo; |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | AutoChoose(); |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | manager.UpdateSelectGiftGirdIndexEvent -= UpdateSelectGiftGirdIndexEvent; |
| | | manager.OnUpdateDingjungeInfoEvent -= OnUpdateDingjungeInfo; |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | } |
| | | |
| | | private void UpdateSelectGiftGirdIndexEvent() |
| | | { |
| | | Display(); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell.GetComponent<WarlordPavilionSelectBonusCell>(); |
| | | _cell?.Display(cell.index); |
| | | } |
| | | private void OnUpdateDingjungeInfo(List<int> indexs) |
| | | { |
| | | TryClose(); |
| | | AutoChoose(); |
| | | Display(); |
| | | PlayerEffects(indexs); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | void PlayerEffects(List<int> indexs) |
| | | { |
| | | if (indexs.IsNullOrEmpty()) |
| | | return; |
| | | for (int i = 0; i < giftCells.Length; i++) |
| | | { |
| | | giftCells[i].Display(i, indexs.Contains(i)); |
| | | } |
| | | } |
| | | // 默认选中第一个加成效果 |
| | | private void AutoChoose() |
| | | { |
| | | if (manager.SelectEffList.IsNullOrEmpty()) |
| | | return; |
| | | manager.selectIndex = 0; |
| | | manager.selectEffID = (int)manager.SelectEffList[0]; |
| | | } |
| | | |
| | | private void Display() |
| | | { |
| | | for (int i = 0; i < giftCells.Length; i++) |
| | | { |
| | | giftCells[i].Display(i); |
| | | } |
| | | |
| | | int selectEffID = manager.selectEffID; |
| | | |
| | | CreateScroller(); |
| | | |
| | | if (FBDJGEffectConfig.HasKey(selectEffID)) |
| | | { |
| | | FBDJGEffectConfig config = FBDJGEffectConfig.Get(selectEffID); |
| | | txtAttr.text = config.Name; |
| | | txtAttrValue.text = Language.Get( |
| | | "HeroGift5", |
| | | PlayerPropertyConfig.Get(config.AttrID).Name, |
| | | PlayerPropertyConfig.GetValueDescription(config.AttrID, config.AttrValue) |
| | | ); |
| | | } |
| | | txtCnt.text = Language.Get("WarlordPavilion26", manager.UnSelectCnt); |
| | | } |
| | | |
| | | private void CreateScroller() |
| | | { |
| | | |
| | | scroller.Refresh(); |
| | | List<int> list = manager.GetAwardList(); |
| | | if (!manager.SelectEffList.IsNullOrEmpty()) |
| | | { |
| | | for (int i = 0; i < manager.SelectEffList.Length; i++) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 144d23ba33b0f494bb5b5ad3ac72532f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | public class WarlordPavilionSelectGiftGird : MonoBehaviour |
| | | { |
| | | [SerializeField] ImageEx imgChoose; |
| | | [SerializeField] ImageEx imgUp; |
| | | [SerializeField] WarlordPavilionGiftDiyButtonCell cell; |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | |
| | | public void Display(int index, int effID, bool isChoose = false, bool isUp = false) |
| | | { |
| | | imgChoose.SetActive(isChoose); |
| | | imgUp.SetActive(isUp); |
| | | cell.Init(effID, 1);//显示1级的 |
| | | cell.SetListener(() => |
| | | { |
| | | manager.selectEffID = effID; |
| | | manager.selectIndex = index; |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e3028fce7f0c67947a39942b48467336 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class WarlordPavilionWin : UIBase |
| | | { |
| | | [SerializeField] float modelSize; |
| | | [SerializeField] TextEx txtCurrentLevel; //当前关卡 |
| | | [SerializeField] TextEx txtBossName; |
| | | [SerializeField] UIHeroController uiHeroController; |
| | | [SerializeField] List<SkillWordCell> skillWords; |
| | | [SerializeField] ItemCell[] firstAwards; |
| | | [SerializeField] ImageEx[] firstAwardMasks; |
| | | [SerializeField] ItemCell[] challengeAwards; |
| | | [SerializeField] WarlordPavilionGiftGird[] giftCells; |
| | | [SerializeField] TextEx txtTime; |
| | | [SerializeField] TextEx txtMax; |
| | | [SerializeField] ButtonEx btnRank; |
| | | [SerializeField] ButtonEx btnAward; |
| | | [SerializeField] ButtonEx btnBossInfo; |
| | | [SerializeField] ButtonEx btnFormation; //布阵 |
| | | [SerializeField] ButtonEx btnBonusPreset; //加成预设 |
| | | [SerializeField] TextEx txtBonusPreset; //加成预设 |
| | | [SerializeField] ButtonEx btnChallenge; //挑战 |
| | | [SerializeField] ButtonEx btnSelectOneClick; //一键选择 |
| | | [SerializeField] ButtonEx btnQuickChallenge; //快速挑战 |
| | | [SerializeField] ButtonEx btnSelectBonus; //选择加成 |
| | | [SerializeField] Image imgSelectBonusRed; //加成预设红点 |
| | | [SerializeField] UIEffectPlayer uIEffectPlayer; //选择加成开启特效 |
| | | WarlordPavilionManager manager { get { return WarlordPavilionManager.Instance; } } |
| | | protected override void InitComponent() |
| | | { |
| | | btnBossInfo.SetListener(() => |
| | | { |
| | | if (npcConfig == null) |
| | | return; |
| | | uint mapID = (uint)manager.DataMapID; |
| | | uint funcLineID = (uint)manager.GetLineID(showLayerNum, showLevelNum); |
| | | uint npcID = (uint)npcConfig.NPCID; |
| | | if (ViewNPCManager.Instance.TryGetNPCAttr(mapID, funcLineID, npcID, out var npcAttr) && npcAttr != null && npcAttr.AttrDict != null) |
| | | { |
| | | AttributeManager.Instance.OpenTotalAttributeWin(npcAttr.AttrDict); |
| | | return; |
| | | } |
| | | ViewNPCManager.Instance.SendViewNPCAttr(mapID, funcLineID, npcID); |
| | | }); |
| | | btnRank.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<WarlordPavilionRankWin>(); |
| | | }); |
| | | btnAward.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<WarlordPavilionAwardWin>(); |
| | | }); |
| | | btnFormation.SetListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.Story; |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | btnSelectOneClick.SetListener(() => |
| | | { |
| | | manager.SendDingjungeEffSelect(2, 0, 0); |
| | | }); |
| | | btnQuickChallenge.SetListener(() => |
| | | { |
| | | manager.SendFBQuickPass(manager.DataMapID, 0); |
| | | }); |
| | | btnChallenge.SetListener(() => |
| | | { |
| | | BattleManager.Instance.SendTurnFight((uint)manager.DataMapID, 0); |
| | | }); |
| | | btnSelectBonus.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<WarlordPavilionSelectBonusWin>(); |
| | | }); |
| | | btnBonusPreset.SetListener(() => |
| | | { |
| | | if (!manager.IsFuncOpen(true)) |
| | | return; |
| | | UIManager.Instance.OpenWindow<WarlordPavilionBonusPresetWin>(); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | ViewNPCManager.Instance.OnUpdateViewNPCAttrRet += OnUpdateViewNPCAttrRet; |
| | | manager.OnUpdateDingjungeInfoEvent += OnUpdateDingjungeInfo; |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | ViewNPCManager.Instance.OnUpdateViewNPCAttrRet -= OnUpdateViewNPCAttrRet; |
| | | manager.OnUpdateDingjungeInfoEvent -= OnUpdateDingjungeInfo; |
| | | } |
| | | |
| | | private void OnUpdateDingjungeInfo(List<int> indexs) |
| | | { |
| | | Display(); |
| | | PlayerEffects(indexs); |
| | | } |
| | | |
| | | void PlayerEffects(List<int> indexs) |
| | | { |
| | | if (indexs.IsNullOrEmpty()) |
| | | return; |
| | | for (int i = 0; i < giftCells.Length; i++) |
| | | { |
| | | giftCells[i].Display(i, indexs.Contains(i)); |
| | | } |
| | | } |
| | | |
| | | private void OnUpdateViewNPCAttrRet(uint mapID, uint funcLineID) |
| | | { |
| | | if (mapID != manager.DataMapID) |
| | | return; |
| | | if (npcConfig == null) |
| | | return; |
| | | uint npcID = (uint)npcConfig.NPCID; |
| | | if (ViewNPCManager.Instance.TryGetNPCAttr(mapID, funcLineID, npcID, out var npcAttr) && npcAttr != null && npcAttr.AttrDict != null) |
| | | { |
| | | AttributeManager.Instance.OpenTotalAttributeWin(npcAttr.AttrDict); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | void OnSecondEvent() |
| | | { |
| | | txtTime.text = Language.Get("WarlordPavilion10", manager.GetCountdownToNextDay()); |
| | | bool isShowRed = manager.IsTodayShowSelectBonusRed(); |
| | | imgSelectBonusRed.SetActive(isShowRed); |
| | | } |
| | | |
| | | int showLayerNum; |
| | | int showLevelNum; |
| | | FBDJGLevelConfig config; |
| | | NPCLineupConfig npcLineupConfig; |
| | | NPCConfig npcConfig; |
| | | private void Display() |
| | | { |
| | | uIEffectPlayer.Stop(); |
| | | OnSecondEvent(); |
| | | int dataMapID = manager.DataMapID; |
| | | if (!DungeonManager.Instance.TryGetFBInfoByMapID(dataMapID, out var fbInfo)) |
| | | return; |
| | | if (!manager.TryGetShowLayerNumAndLevelNum(out showLayerNum, out showLevelNum)) |
| | | return; |
| | | if (!FBDJGLevelConfig.TryGetFBDJGLevelConfig(showLayerNum, showLevelNum, out config)) |
| | | return; |
| | | if (!manager.TryGetNPCConfig(showLayerNum, showLevelNum, out npcLineupConfig, out npcConfig)) |
| | | return; |
| | | |
| | | txtCurrentLevel.text = Language.Get("WarlordPavilion22", showLayerNum, showLevelNum); |
| | | txtBossName.text = npcConfig.NPCName; |
| | | uiHeroController.Create(npcConfig.SkinID, modelSize); |
| | | DisplaySkillWordsList(npcLineupConfig); |
| | | DisplayItemCell(firstAwards, config.PassAwardList); |
| | | manager.DisplayItemCell(challengeAwards, config.AwardList); |
| | | DisplayButtons(); |
| | | |
| | | for (int i = 0; i < giftCells.Length; i++) |
| | | { |
| | | giftCells[i].Display(i); |
| | | } |
| | | txtBonusPreset.text = Language.Get(manager.SelectAuto == 1 ? "WarlordPavilion30" : "WarlordPavilion08"); |
| | | if (manager.SelectAuto == 1) |
| | | { |
| | | uIEffectPlayer.Play(); |
| | | } |
| | | } |
| | | private void DisplayButtons() |
| | | { |
| | | bool isPass = manager.IsPass(); |
| | | bool hasBonusToSelect = manager.HasBonusToSelect(); |
| | | bool isAutoPresetOn = manager.IsAutoPresetOn(); |
| | | bool canFastChallenge = manager.CanFastChallenge(); |
| | | |
| | | txtMax.SetActive(false); |
| | | btnSelectOneClick.SetActive(false); |
| | | btnSelectBonus.SetActive(false); |
| | | btnQuickChallenge.SetActive(false); |
| | | btnChallenge.SetActive(false); |
| | | |
| | | txtMax.SetActive(isPass); |
| | | |
| | | if (isPass) |
| | | return; |
| | | if (hasBonusToSelect) |
| | | { |
| | | btnSelectOneClick.SetActive(isAutoPresetOn); |
| | | btnSelectBonus.SetActive(!isAutoPresetOn); |
| | | return; |
| | | } |
| | | btnQuickChallenge.SetActive(canFastChallenge); |
| | | btnChallenge.SetActive(!canFastChallenge); |
| | | |
| | | } |
| | | public bool IsNowPass() |
| | | { |
| | | manager.GetHistoryMaxFinishProgress(out int layerNum, out int levelNum); |
| | | if (layerNum <= 0 || levelNum <= 0) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (showLayerNum < layerNum) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (showLayerNum == layerNum) |
| | | { |
| | | if (showLevelNum <= levelNum) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public void DisplayItemCell(ItemCell[] cells, int[][] items) |
| | | { |
| | | bool isPass = IsNowPass(); |
| | | |
| | | if (cells.IsNullOrEmpty() || items.IsNullOrEmpty()) |
| | | return; |
| | | |
| | | for (int i = 0; i < cells.Length; i++) |
| | | { |
| | | if (i < items.Length) |
| | | { |
| | | if (i < firstAwardMasks.Length) |
| | | { |
| | | firstAwardMasks[i].SetActive(isPass); |
| | | } |
| | | else |
| | | { |
| | | firstAwardMasks[i].SetActive(false); |
| | | } |
| | | |
| | | cells[i].SetActive(true); |
| | | int itemID = items[i][0]; |
| | | int count = items[i][1]; |
| | | cells[i].Init(new ItemCellModel(itemID, false, count)); |
| | | cells[i].button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | | cells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void DisplaySkillWordsList(NPCLineupConfig lineUPConfig) |
| | | { |
| | | if (skillWords.IsNullOrEmpty()) |
| | | return; |
| | | for (int i = 0; i < skillWords.Count; i++) |
| | | { |
| | | if (i < lineUPConfig.SkillIDExList.Length) |
| | | { |
| | | skillWords[i].SetActive(true); |
| | | int skillID = lineUPConfig.SkillIDExList[i]; |
| | | skillWords[i].Init(skillID, () => |
| | | { |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", SkillConfig.Get(skillID)?.SkillName, SkillConfig.Get(skillID)?.Description); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | SmallTipWin.isDownShow = true; |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | skillWords[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 22e78d9e59c01994f9cd2e8e2e5f83a2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | LineupRecommend = 50, //阵容推荐 |
| | | DailySpecials = 51, //每日特惠 |
| | | Mail = 52, //邮箱 |
| | | WarlordPavilion = 55, //定军阁 |
| | | } |
| | | |
| | | |