4 文件已复制
1个文件已删除
1 文件已重命名
6个文件已添加
49个文件已修改
| | |
| | | typeof(OrderInfoConfig),
|
| | | typeof(PlayerAttrConfig),
|
| | | typeof(PlayerFaceConfig),
|
| | | typeof(PresetUnlockConfig),
|
| | | typeof(PriorBundleConfig),
|
| | | typeof(RandomNameConfig),
|
| | | typeof(SignInConfig),
|
| | |
| | | ClearConfigDictionary<PlayerAttrConfig>();
|
| | | // 清空 PlayerFaceConfig 字典
|
| | | ClearConfigDictionary<PlayerFaceConfig>();
|
| | | // 清空 PresetUnlockConfig 字典
|
| | | ClearConfigDictionary<PresetUnlockConfig>();
|
| | | // 清空 PriorBundleConfig 字典
|
| | | ClearConfigDictionary<PriorBundleConfig>();
|
| | | // 清空 RandomNameConfig 字典
|
| New file |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2026年1月19日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | |
|
| | | public partial class PresetUnlockConfig : ConfigBase<int, PresetUnlockConfig>
|
| | | {
|
| | | static PresetUnlockConfig()
|
| | | {
|
| | | // 访问过静态构造函数
|
| | | visit = true; |
| | | }
|
| | |
|
| | | public int ID;
|
| | | public int PresetType;
|
| | | public int PresetID;
|
| | | public int UnlockType;
|
| | | public int UnlockValue;
|
| | |
|
| | | 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 ID); |
| | |
|
| | | int.TryParse(tables[1],out PresetType); |
| | |
|
| | | int.TryParse(tables[2],out PresetID); |
| | |
|
| | | int.TryParse(tables[3],out UnlockType); |
| | |
|
| | | int.TryParse(tables[4],out UnlockValue); |
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | | Debug.LogError(exception);
|
| | | }
|
| | | }
|
| | | }
|
copy from Main/System/Team/TeamType.cs.meta
copy to Main/Config/Configs/PresetUnlockConfig.cs.meta
| File was copied from Main/System/Team/TeamType.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 097080eb83a42b54bbc2b10bc100993b |
| | | guid: 8ecdeb51d01330b43960aae797dd7d53 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | public partial class PresetUnlockConfig : ConfigBase<int, PresetUnlockConfig> |
| | | { |
| | | static Dictionary<int, Dictionary<int, PresetUnlockConfig>> m_PresetUnlockDict = new Dictionary<int, Dictionary<int, PresetUnlockConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | if (!m_PresetUnlockDict.ContainsKey(PresetType)) |
| | | { |
| | | m_PresetUnlockDict[PresetType] = new Dictionary<int, PresetUnlockConfig>(); |
| | | } |
| | | m_PresetUnlockDict[PresetType][PresetID] = this; |
| | | } |
| | | |
| | | public static PresetUnlockConfig GetPresetUnlockConfig(int presetType, int presetID) |
| | | { |
| | | if (m_PresetUnlockDict.ContainsKey(presetType) && m_PresetUnlockDict[presetType].ContainsKey(presetID)) |
| | | { |
| | | return m_PresetUnlockDict[presetType][presetID]; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
copy from Main/System/Team/TeamType.cs.meta
copy to Main/Config/PartialConfigs/PresetUnlockConfig.cs.meta
| File was copied from Main/System/Team/TeamType.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 097080eb83a42b54bbc2b10bc100993b |
| | | guid: 25d58f7d8e96c334aa6041e24810a2d2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | |
|
| | | public class CB412_tagCSHeroPresetSave : GameNetPackBasic {
|
| | | public byte PresetID; //阵容方案预设ID
|
| | | public byte ShapeType; //本阵容阵型,0为默认阵型,可扩展不同的阵型
|
| | | public byte PosCnt;
|
| | | public tagCSHeroPresetPos[] HeroPosList; // 保存的阵容,只发送最终的阵容武将位置即可
|
| | |
|
| | |
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (PresetID, NetDataType.BYTE);
|
| | | WriteBytes (ShapeType, NetDataType.BYTE);
|
| | | WriteBytes (PosCnt, NetDataType.BYTE);
|
| | | for (int i = 0; i < PosCnt; i ++) {
|
| | | WriteBytes (HeroPosList[i].ItemIndex, NetDataType.WORD);
|
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B1 61 功能预设信息 #tagSCFuncPresetInfoList
|
| | |
|
| | | public class DTCB161_tagSCFuncPresetInfoList : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HB161_tagSCFuncPresetInfoList vNetData = vNetPack as HB161_tagSCFuncPresetInfoList;
|
| | | FuncPresetManager.Instance.UpdateFuncPresetInfoList(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B1 62 功能预设切换信息 #tagSCFuncPresetSwitchInfo
|
| | |
|
| | | public class DTCB162_tagSCFuncPresetSwitchInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HB162_tagSCFuncPresetSwitchInfo vNetData = vNetPack as HB162_tagSCFuncPresetSwitchInfo;
|
| | | FuncPresetManager.Instance.UpdateFuncPresetUseData(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B1 63 战斗预设切换信息 #tagSCBatPresetSwitchInfo
|
| | |
|
| | | public class DTCB163_tagSCBatPresetSwitchInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HB163_tagSCBatPresetSwitchInfo vNetData = vNetPack as HB163_tagSCBatPresetSwitchInfo;
|
| | | FuncPresetManager.Instance.UpdateBatPresetNowUseInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | Register(typeof(HA503_tagSCFamilyTaofaInfo), typeof(DTCA503_tagSCFamilyTaofaInfo)); |
| | | Register(typeof(HA504_tagSCFamilyTaofaAtkRet), typeof(DTCA504_tagSCFamilyTaofaAtkRet)); |
| | | Register(typeof(HB132_tagSCMinggeInfo), typeof(DTCB132_tagSCMinggeInfo)); |
| | | Register(typeof(HB161_tagSCFuncPresetInfoList), typeof(DTCB161_tagSCFuncPresetInfoList)); |
| | | Register(typeof(HB162_tagSCFuncPresetSwitchInfo), typeof(DTCB162_tagSCFuncPresetSwitchInfo)); |
| | | Register(typeof(HB163_tagSCBatPresetSwitchInfo), typeof(DTCB163_tagSCBatPresetSwitchInfo)); |
| | | } |
| | | |
| | | //主工程注册封包 |
| | |
| | | for (int i = 0; i < PresetCnt; i ++) {
|
| | | PresetList[i] = new tagSCHeroPreset();
|
| | | TransBytes (out PresetList[i].PresetID, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out PresetList[i].ShapeType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out PresetList[i].HeroCnt, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out PresetList[i].HeroItemIndexList, vBytes, NetDataType.WORD, PresetList[i].HeroCnt);
|
| | | }
|
| | |
| | |
|
| | | public class tagSCHeroPreset {
|
| | | public byte PresetID; //阵容方案预设ID
|
| | | public byte ShapeType; // 阵型
|
| | | public byte HeroCnt;
|
| | | public ushort[] HeroItemIndexList; // 所在武将背包索引+1列表 [站位1物品索引+1, 站位2, ...],站位无武将时为0
|
| | | }
|
| | |
| | | managers.Add(ViewNPCManager.Instance);
|
| | | managers.Add(EquipRecordManager.Instance);
|
| | | managers.Add(MinggeManager.Instance);
|
| | | managers.Add(FuncPresetManager.Instance);
|
| | |
|
| | | foreach (var manager in managers)
|
| | | {
|
| | |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)); |
| | | enemyAvatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | |
| | | txtMyName.text = PlayerDatas.Instance.baseData.PlayerName; |
| | |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)tagPlayerID, (int)enemyFace, (int)enemyFacePic)); |
| | | enemyAvatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)tagPlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | |
| | | txtMyName.text = PlayerDatas.Instance.baseData.PlayerName; |
| | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaMatchInfo.PlayerID, (int)arenaMatchInfo.Face, (int)arenaMatchInfo.FacePic)); |
| | | avatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)arenaMatchInfo.PlayerID, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)arenaMatchInfo.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | |
| | | txtName.text = UIHelper.ServerStringTrim(arenaMatchInfo.PlayerName); |
| | |
| | | //优先取进攻队伍的战力,没有进攻队伍,取主线战力 |
| | | public long GetMyFightPower() |
| | | { |
| | | var arenaDefenseTeam = TeamManager.Instance.GetTeam(TeamType.Arena); |
| | | var arenaDefenseTeam = TeamManager.Instance.GetTeam(BattlePreSetType.Arena); |
| | | return arenaDefenseTeam.IsEmpty() || arenaDefenseTeam.GetTeamHeroCount() <= 0 ? |
| | | PlayerDatas.Instance.baseData.FightPower : |
| | | FightPowerManager.Instance.GetTeamFightPower(TeamType.Arena, false); |
| | | FightPowerManager.Instance.GetTeamFightPower(TeamManager.Instance.GetTeamID((int)BattlePreSetType.Arena), false); |
| | | } |
| | | } |
| | | |
| | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)rankData.id, (int)rankData.value3, (int)rankData.value4)); |
| | | avatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | nameText.text = rankData.name1; |
| | | rankValueText.text = string.Format(valueFormat, UIHelper.ReplaceLargeNum(rankData.cmpValue)); |
| | |
| | | { |
| | | queryPlayerBtn.AddListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo(viewPlayerId, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo(viewPlayerId, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | } |
| | | } |
| | |
| | | model.Create(HorseManager.Instance.GetOtherPlayerHorseSkinID((int)rankData.value6), (int)rankData.value5, 1); |
| | | queryPlayerBtn.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)rankData.id, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | } |
| | | |
| | |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaGameRec.Value3, (int)arenaGameRec.Value5, (int)arenaGameRec.Value6)); |
| | | avatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)arenaGameRec.Value3, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)arenaGameRec.Value3, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | txtName.text = arenaGameRec.Name; |
| | | txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaGameRec.FightPower); |
| | |
| | | }); |
| | | btnDeployTroops.SetListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.ArenaDefense; |
| | | HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetTeamID((int)BattlePreSetType.Arena); |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(1); // 竞技场标签页 |
| | | }); |
| | | } |
| | |
| | | enemyAvatarCell.InitUI(AvatarHelper.GetAvatarModel((int)info.PlayerID, (int)info.Face, (int)info.FacePic)); |
| | | enemyAvatarCell.SetListener(() => |
| | | { |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)info.PlayerID, viewPlayerLineupType: (int)TeamType.ArenaDefense); |
| | | AvatarHelper.TryViewOtherPlayerInfo((int)info.PlayerID, viewPlayerLineupType: (int)BattlePreSetType.Arena); |
| | | }); |
| | | var team = GetTeamHeroList(enemyTeam); |
| | | enemyCountry.RefreshOnTeamCountry(team, true); |
| | |
| | | base.OnTurnFightState(turnNum, State, FuncLineID, extendData); |
| | | } |
| | | |
| | | protected void OnTeamChange(TeamType teamType) |
| | | protected void OnTeamChange(int teamType) |
| | | { |
| | | if (teamType == TeamType.Story) |
| | | if (teamType == TeamManager.Instance.GetMainTeamID()) |
| | | { |
| | | if (battleState == StoryBattleState.Break) |
| | | { |
| | |
| | | |
| | | protected void ReloadTeam() |
| | | { |
| | | PreloadResources(new List<TeamBase>() { TeamManager.Instance.GetTeam(TeamType.Story) }, null); |
| | | battleObjMgr.ReloadTeam(TeamManager.Instance.GetTeam(TeamType.Story), BattleCamp.Red); |
| | | PreloadResources(new List<TeamBase>() { TeamManager.Instance.GetTeam(BattlePreSetType.Story) }, null); |
| | | battleObjMgr.ReloadTeam(TeamManager.Instance.GetTeam(BattlePreSetType.Story), BattleCamp.Red); |
| | | } |
| | | |
| | | // public override void OnBattleEnd(JsonData turnFightStateData) |
| | |
| | | { |
| | | var redTeamList = new List<TeamBase>(); |
| | | |
| | | TeamBase storyTeam = TeamManager.Instance.GetTeam(TeamType.Story); |
| | | TeamBase storyTeam = TeamManager.Instance.GetTeam(BattlePreSetType.Story); |
| | | |
| | | redTeamList.Add(storyTeam); |
| | | |
| | |
| | | {
|
| | | uieff.effectId = 1026;
|
| | |
|
| | | uieff.PlayByArrIndex(equip.config.ItemColor - 7, true, true);
|
| | | uieff.PlayByArrIndex(equip.config.ItemColor - 7, true);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | return equip.GetUseData(19); |
| | | } |
| | | |
| | | //技能ID列表 |
| | | public List<int> GetEquipSkillIDs(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return new List<int>(); |
| | | } |
| | | return equip.GetUseData(37); |
| | | } |
| | | |
| | | //得到装备位对应的部位名称 |
| | | public string GetEquipPlaceName(int place) |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: aa86b940defc60440ac6c5e73d67dc70 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System; |
| | | |
| | | //方案预设:流派设定 |
| | | // 这里存储的是流派id设定; 功能预设在各个功能里如命格的是存在命格背包对应,武将是另外通知使用的格子索引 |
| | | public class FuncPresetManager : GameSystemManager<FuncPresetManager> |
| | | { |
| | | //预设方案:功能类型(含全局和子功能,配表)-子方案ID-预设方案解锁名称信息 |
| | | Dictionary<int, Dictionary<int, FuncPreset>> m_FuncPresetDict = new Dictionary<int, Dictionary<int, FuncPreset>>(); |
| | | public event Action OnFuncPresetInfoListChanged; //流派设置总信息 |
| | | |
| | | //对应 BattlePreSetType 战斗类型 : 全局方案ID |
| | | Dictionary<int, int> battlePreSetDict = new Dictionary<int, int>(); |
| | | public event Action OnBattelePresetEvent; |
| | | |
| | | //所有预设方案的保存信息 全局方案ID :子功能类型(配表):子方案ID |
| | | Dictionary<int, Dictionary<int, int>> m_FuncPresetSaveDict = new Dictionary<int, Dictionary<int, int>>(); |
| | | public event Action OnFuncPresetUseDataEvent; |
| | | |
| | | public const int GlobalDefaultPresetID = 1; //默认全局方案ID |
| | | public const int FuncDefaultPresetID = 1; //默认子功能方案ID |
| | | |
| | | public int teamPresetMaxID = 1; //阵容预设最大ID, 默认1按解锁开放 |
| | | |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitialize; |
| | | ParseConfig(); |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitialize; |
| | | } |
| | | |
| | | |
| | | void ParseConfig() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OnBeforePlayerDataInitialize() |
| | | { |
| | | battlePreSetDict.Clear(); |
| | | InitFuncPreset(); |
| | | } |
| | | |
| | | void InitFuncPreset() |
| | | { |
| | | m_FuncPresetDict.Clear(); |
| | | // if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge)) |
| | | // { |
| | | // return; |
| | | // } |
| | | var keys = PresetUnlockConfig.GetKeys(); |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | var config = PresetUnlockConfig.Get(keys[i]); |
| | | if (!m_FuncPresetDict.ContainsKey(config.PresetType)) |
| | | { |
| | | m_FuncPresetDict[config.PresetType] = new Dictionary<int, FuncPreset>(); |
| | | } |
| | | m_FuncPresetDict[config.PresetType][config.PresetID] = new FuncPreset() |
| | | { |
| | | PresetID = config.PresetID, |
| | | unLock = config.UnlockType == 0, |
| | | PresetName = Language.Get("Mingge13") + config.PresetID, |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | public void UpdateFuncPresetInfoList(HB161_tagSCFuncPresetInfoList vNetData) |
| | | { |
| | | for (int i = 0; i < vNetData.FuncCnt; i++) |
| | | { |
| | | var funcPresetInfo = vNetData.FuncPresetList[i]; |
| | | if (!m_FuncPresetDict.ContainsKey(funcPresetInfo.FuncPresetType)) |
| | | { |
| | | m_FuncPresetDict[funcPresetInfo.FuncPresetType] = new Dictionary<int, FuncPreset>(); |
| | | } |
| | | for (int j = 0; j < funcPresetInfo.PresetCnt; j++) |
| | | { |
| | | var preset = funcPresetInfo.PresetList[j]; |
| | | //该功能预设解锁状态,按预设ID二进制位运算记录是否已解锁 |
| | | m_FuncPresetDict[funcPresetInfo.FuncPresetType][preset.PresetID] = new FuncPreset() |
| | | { |
| | | PresetID = preset.PresetID, |
| | | unLock = (funcPresetInfo.UnlockState & (1 << preset.PresetID)) != 0, |
| | | PresetName = string.IsNullOrEmpty(preset.PresetName) ? Language.Get("Mingge13") + preset.PresetID : preset.PresetName, |
| | | }; |
| | | } |
| | | } |
| | | |
| | | OnFuncPresetInfoListChanged?.Invoke(); |
| | | } |
| | | |
| | | //每个全局方案的存储信息 |
| | | public void UpdateFuncPresetUseData(HB162_tagSCFuncPresetSwitchInfo vNetData) |
| | | { |
| | | for (int i = 0; i < vNetData.BatPresetCnt; i++) |
| | | { |
| | | var batPreset = vNetData.BatPresetList[i]; |
| | | if (!m_FuncPresetSaveDict.ContainsKey(batPreset.BatPresetID)) |
| | | { |
| | | m_FuncPresetSaveDict[batPreset.BatPresetID] = new Dictionary<int, int>(); |
| | | } |
| | | for (int j = 0; j < batPreset.FuncCnt; j++) |
| | | { |
| | | var funcPreset = batPreset.FuncPresetList[j]; |
| | | m_FuncPresetSaveDict[batPreset.BatPresetID][funcPreset.FuncPresetType] = funcPreset.FuncPresetID; |
| | | } |
| | | } |
| | | OnFuncPresetUseDataEvent?.Invoke(); |
| | | } |
| | | |
| | | //当前战斗功能的全局方案ID使用情况 |
| | | public void UpdateBatPresetNowUseInfo(HB163_tagSCBatPresetSwitchInfo netPack) |
| | | { |
| | | for (int i = 0; i < netPack.BatFuncCnt; i++) |
| | | { |
| | | battlePreSetDict[netPack.BatPresetList[i].BatPresetType] = netPack.BatPresetList[i].BatPresetID; |
| | | } |
| | | OnBattelePresetEvent?.Invoke(); |
| | | } |
| | | |
| | | //获取全局方案ID,如果取不到默认方案1 |
| | | public int GetGlobalPresetID(int type) |
| | | { |
| | | if (battlePreSetDict.ContainsKey(type)) |
| | | { |
| | | return battlePreSetDict[type]; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //获取子功能方案ID,如果取不到默认方案1 |
| | | public int GetFuncPresetID(int type, int presetID) |
| | | { |
| | | if (m_FuncPresetSaveDict.ContainsKey(presetID) && m_FuncPresetSaveDict[presetID].ContainsKey(type)) |
| | | { |
| | | return m_FuncPresetSaveDict[presetID][type]; |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | public class FuncPreset |
| | | { |
| | | public int PresetID; //预设方案ID |
| | | public bool unLock; //是否解锁 |
| | | public string PresetName; //预设名称 |
| | | } |
| | | |
| | | |
| | | |
| | | //战斗功能区分对应存储全局方案ID,如演武场防守用哪个全局方案ID的分类 |
| | | public enum BattlePreSetType |
| | | { |
| | | None = 0, |
| | | Story = 1, //主线 |
| | | Arena = 2, //演武场防守 |
| | | |
| | | } |
| | | |
| | | //功能预设类型 1-全局战斗;2-阵容;3-命格; |
| | | public enum FuncPresetType |
| | | { |
| | | Global = 1, |
| | | Team = 2, |
| | | Mingge = 3, |
| | | } |
copy from Main/System/Team/TeamType.cs.meta
copy to Main/System/FuncPreset/FuncPresetManager.cs.meta
| File was copied from Main/System/Team/TeamType.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 097080eb83a42b54bbc2b10bc100993b |
| | | guid: a8f801f20f111f944bcd09b9bfa9c1b0 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | |
| | | |
| | | //不同阵容羁绊属性不同,实时计算,与其他缓存的不同 |
| | | public void RefreshFetterAttrsWhenCalcPower(TeamType teamType) |
| | | public void RefreshFetterAttrsWhenCalcPower(int teamType) |
| | | { |
| | | fetterAttrs.Clear(); |
| | | var list = GetActiveFetter(heroConfig, TeamManager.Instance.GetTeam(teamType)); |
| | |
| | | //阵容布阵 |
| | | public partial class HeroInfo |
| | | { |
| | | public Dictionary<TeamType, KeyValuePair<int, int>> GetTeamTypeShapeTypePositionDict() |
| | | public Dictionary<int, KeyValuePair<int, int>> GetTeamTypeShapeTypePositionDict() |
| | | { |
| | | // 英雄当前所有在的队伍 |
| | | List<int> heroTeams = itemHero.GetUseData(81); |
| | | |
| | | Dictionary<TeamType, KeyValuePair<int, int>> teamTypeShapeTypePositionDict = new Dictionary<TeamType, KeyValuePair<int, int>>(); |
| | | Dictionary<int, KeyValuePair<int, int>> teamTypeShapeTypePositionDict = new Dictionary<int, KeyValuePair<int, int>>(); |
| | | foreach (var teamMsg in heroTeams) |
| | | { |
| | | // 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...] |
| | |
| | | int shapeType = (teamMsg % 10000) / 100; |
| | | int positionIndex = teamMsg % 100; |
| | | |
| | | if (teamTypeShapeTypePositionDict.ContainsKey((TeamType)teamType)) |
| | | if (teamTypeShapeTypePositionDict.ContainsKey(teamType)) |
| | | { |
| | | // 队伍类型相同,更新阵型和位置 |
| | | Debug.LogError("当前英雄拥有两个相同的队伍信息: " + teamType + " " + shapeType + " " + positionIndex + ", hero guid is " + itemHero.guid); |
| | |
| | | { |
| | | // 队伍类型不同,添加新的 |
| | | KeyValuePair<int, int> shapeTypePosition = new KeyValuePair<int, int>(shapeType, positionIndex); |
| | | teamTypeShapeTypePositionDict.Add((TeamType)teamType, shapeTypePosition); |
| | | teamTypeShapeTypePositionDict.Add(teamType, shapeTypePosition); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | //是否上x阵 服务端队伍 |
| | | public bool IsInTeamByTeamType(TeamType teamType) |
| | | public bool IsInTeamByTeamType(BattlePreSetType battleType) |
| | | { |
| | | return TeamManager.Instance.GetTeam(teamType).HasHeroInServer(itemHero.guid); |
| | | return TeamManager.Instance.GetTeam(battleType).HasHeroInServer(itemHero.guid); |
| | | } |
| | | |
| | | //是否上任何阵容 |
| | | public bool IsInAnyTeam() |
| | | { |
| | | for (int i = 1; i < (int)TeamType.Max; i++) |
| | | for (int i = 1; i < FuncPresetManager.Instance.teamPresetMaxID; i++) |
| | | { |
| | | if (TeamManager.Instance.GetTeam((TeamType)i).HasHeroInServer(itemHero.guid)) |
| | | if (TeamManager.Instance.GetTeam(i).HasHeroInServer(itemHero.guid)) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | //是否上任何阵容,且只有一只 |
| | | public bool IsInAnyTeamJustOne() |
| | | { |
| | | for (int i = 1; i < (int)TeamType.Max; i++) |
| | | for (int i = 1; i < FuncPresetManager.Instance.teamPresetMaxID; i++) |
| | | { |
| | | var team = TeamManager.Instance.GetTeam((TeamType)i); |
| | | var team = TeamManager.Instance.GetTeam(i); |
| | | if (team.HasHeroInServer(itemHero.guid)) |
| | | { |
| | | if (team.GetTeamHeroCount() == 1) |
| | |
| | | //下阵所有阵容 |
| | | public void LeaveAllTeam() |
| | | { |
| | | for (int i = 1; i < (int)TeamType.Max; i++) |
| | | for (int i = 1; i < FuncPresetManager.Instance.teamPresetMaxID; i++) |
| | | { |
| | | int pos; |
| | | var team = TeamManager.Instance.GetTeam((TeamType)i); |
| | | if (TeamManager.Instance.GetTeam((TeamType)i).RemoveHero(this, out pos)) |
| | | var team = TeamManager.Instance.GetTeam(i); |
| | | if (TeamManager.Instance.GetTeam(i).RemoveHero(this, out pos)) |
| | | { |
| | | //如果是最后一个武将,则默认上阵一个 |
| | | team.SaveTeam(); |
| | |
| | | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale); |
| | | onStateImg.SetActive(hero.IsInTeamByTeamType(TeamType.Story)); |
| | | onStateImg.SetActive(hero.IsInTeamByTeamType(BattlePreSetType.Story)); |
| | | |
| | | int teamPos = TeamManager.Instance.GetTeam(TeamType.Story).GetPosition(hero.itemHero.guid); |
| | | int teamPos = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetPosition(hero.itemHero.guid); |
| | | if (teamPos >= 0) |
| | | { |
| | | redpoint.redpointId = MainRedDot.HeroCardRedpoint * 10 + teamPos; |
| | |
| | | } |
| | | } |
| | | |
| | | void OnTeamChange(TeamType type) |
| | | void OnTeamChange(int type) |
| | | { |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | |
| | | HeroGiftRoleListCell heroGiftRoleListCell = cellView as HeroGiftRoleListCell; |
| | | heroGiftRoleListCell.Display(cellView.index); |
| | | } |
| | | void OnTeamChange(TeamType type) |
| | | void OnTeamChange(int type) |
| | | { |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | |
| | | }); |
| | | changeHeroPosBtn.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.Story; |
| | | HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetMainTeamID(); |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | attrOnTipBtn.AddListener(() => |
| | |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | attackTeamBtn.AddListener(() => |
| | | { |
| | | SelectTeamFunc((TeamType)HeroUIManager.Instance.GetSelectTeamTypeByAttackType(0)); |
| | | }); |
| | | defendTeamBtn.AddListener(() => |
| | | { |
| | | SelectTeamFunc((TeamType)HeroUIManager.Instance.GetSelectTeamTypeByAttackType(1)); |
| | | }); |
| | | |
| | | mainFBBtn.AddListener(() => |
| | | { |
| | | SelectTeamFunc(TeamType.Story); |
| | | SelectTeamFunc(TeamManager.Instance.GetMainTeamID()); |
| | | }); |
| | | |
| | | jjcBtn.AddListener(() => |
| | | { |
| | | SelectTeamFunc(TeamType.Arena); |
| | | SelectTeamFunc(TeamManager.Instance.GetTeamID((int)BattlePreSetType.Arena)); |
| | | }); |
| | | // tttBtn.AddListener(() => |
| | | // { |
| | |
| | | //管理布阵入口按钮:如竞技场是否根据功能显隐,通天塔和主线只有进攻方布阵默认不显示 |
| | | void RefreshOnTeamBtn() |
| | | { |
| | | if (HeroUIManager.Instance.selectTeamType == TeamType.Arena || |
| | | HeroUIManager.Instance.selectTeamType == TeamType.ArenaDefense) |
| | | { |
| | | attackTeamBtn.SetActive(true); |
| | | defendTeamBtn.SetActive(true); |
| | | if (HeroUIManager.Instance.selectTeamType == TeamType.Arena) |
| | | { |
| | | attackTeamBtn.SelectBtn(true); |
| | | } |
| | | else |
| | | { |
| | | defendTeamBtn.SelectBtn(true); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | attackTeamBtn.SetActive(false); |
| | | defendTeamBtn.SetActive(false); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | team.SaveTeam(); |
| | | } |
| | | |
| | | void SelectTeamFunc(TeamType type) |
| | | void SelectTeamFunc(int type) |
| | | { |
| | | if (HeroUIManager.Instance.selectTeamType == type) |
| | | { |
| | |
| | | heroListScroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | protected void OnTeamChange(TeamType teamType) |
| | | protected void OnTeamChange(int teamType) |
| | | { |
| | | if (HeroUIManager.Instance.selectTeamType == teamType) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | void TeamPosChangeEvent(TeamType teamType) |
| | | void TeamPosChangeEvent(int teamType) |
| | | { |
| | | if (teamType != TeamType.Story) |
| | | if (teamType != TeamManager.Instance.GetMainTeamID()) |
| | | return; |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculateFightPower()); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | if (!hero.IsInTeamByTeamType(TeamType.Story)) |
| | | if (!hero.IsInTeamByTeamType(BattlePreSetType.Story)) |
| | | { |
| | | return; |
| | | } |
| | |
| | | #region 布阵界面 |
| | | public List<string> heroOnTeamSortList { get; private set; } = new List<string>(); //不同上阵的列表排序 |
| | | |
| | | private TeamType m_SelectTeamType = TeamType.Story; //当前选中的是哪个阵容, 布阵相关逻辑使用 |
| | | public TeamType selectTeamType |
| | | private int m_SelectTeamType = 1; //当前选中的是哪个全局方案ID, 布阵相关逻辑使用 |
| | | public int selectTeamType |
| | | { |
| | | get { return m_SelectTeamType; } |
| | | set |
| | |
| | | if (m_SelectTeamType == value) |
| | | return; |
| | | //上一个阵容需要恢复到原状态 |
| | | if (m_SelectTeamType != TeamType.None) |
| | | if (m_SelectTeamType != 0) |
| | | { |
| | | TeamManager.Instance.GetTeam(m_SelectTeamType).RestoreTeam(); |
| | | } |
| | |
| | | m_SelectTeamType = value; |
| | | } |
| | | } |
| | | |
| | | public int setlectTabIndex = 0; //战斗总标签 对应 BattlePreSetType |
| | | |
| | | public List<int> selectListTeamPos = new List<int>(); //布阵界面 筛选条件 |
| | | |
| | |
| | | /// <summary> |
| | | /// 按队伍获得阵型(国家光环)属性 |
| | | /// </summary> |
| | | /// <param name="teamType"></param> |
| | | /// <param name="isPreview">true 客户端预览阵容,默认false 服务器阵容</param> |
| | | /// <returns></returns> |
| | | public Dictionary<int, int> GetCountryAttrs(TeamType teamType, bool isPreview = false) |
| | | public Dictionary<int, int> GetCountryAttrs(int teamType, bool isPreview = false) |
| | | { |
| | | Dictionary<int, int> countryAttrs = new Dictionary<int, int>(); |
| | | Int2 result = GetMaxCountHeroCountry(teamType, isPreview); |
| | |
| | | /// <param name="teamType"></param> |
| | | /// <param name="isPreview">true 客户端预览阵容,默认false 服务器阵容</param> |
| | | /// <returns></returns> |
| | | public Dictionary<HeroCountry, int> GetCountryHeroCountByTeamType(TeamType teamType, bool isPreview = false) |
| | | public Dictionary<HeroCountry, int> GetCountryHeroCountByTeamType(int teamType, bool isPreview = false) |
| | | { |
| | | Dictionary<HeroCountry, int> heroCountryCount = new Dictionary<HeroCountry, int>(); |
| | | |
| | |
| | | /// <param name="teamType"></param> |
| | | /// <param name="isPreview">true 客户端预览阵容,默认false 服务器阵容</param> |
| | | /// <returns></returns> |
| | | public Int2 GetMaxCountHeroCountry(TeamType teamType, bool isPreview = false) |
| | | public Int2 GetMaxCountHeroCountry(int teamType, bool isPreview = false) |
| | | { |
| | | var countryCountDict = GetCountryHeroCountByTeamType(teamType, isPreview); |
| | | //找到最大的国家和数量 |
| | |
| | | } |
| | | } |
| | | return new Int2((int)country, maxValue); |
| | | } |
| | | |
| | | //在不同页签下选AttackType 0 攻击阵容 1 防守阵容 |
| | | public int GetSelectTeamTypeByAttackType(int AttackType) |
| | | { |
| | | if (selectTeamType == TeamType.Arena || selectTeamType == TeamType.ArenaDefense) |
| | | { |
| | | return AttackType == 0 ? (int)TeamType.Arena : (int)TeamType.ArenaDefense; |
| | | } |
| | | |
| | | |
| | | return (int)TeamType.Story; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | int minLV = int.MaxValue; |
| | | int minID = -1; |
| | | var team = TeamManager.Instance.GetTeam(TeamType.Story); |
| | | var team = TeamManager.Instance.GetTeam(TeamManager.Instance.GetMainTeamID()); |
| | | for (int i = 0; i < team.serverHeroes.Length; i++) |
| | | { |
| | | if (team.serverHeroes[i] != null) |
| | |
| | | } |
| | | |
| | | // 排序规则:上阵>武将等级>突破等级>武将觉醒阶级>武将品质>武将吞噬星级>武将ID |
| | | bool isInTeamA = heroA.IsInTeamByTeamType(TeamType.Story); |
| | | bool isInTeamB = heroB.IsInTeamByTeamType(TeamType.Story); |
| | | bool isInTeamA = heroA.IsInTeamByTeamType(BattlePreSetType.Story); |
| | | bool isInTeamB = heroB.IsInTeamByTeamType(BattlePreSetType.Story); |
| | | if (isInTeamA != isInTeamB) |
| | | { |
| | | return isInTeamA ? -1 : 1; |
| | |
| | | return 0; |
| | | |
| | | var heroCnt = PackManager.Instance.GetItemCountByID(PackType.Hero, hero.heroId); |
| | | if (!hero.IsInTeamByTeamType(TeamType.Story)) |
| | | if (!hero.IsInTeamByTeamType(BattlePreSetType.Story)) |
| | | { |
| | | if (hero.heroStar < hero.GetCurMaxStar() && heroCnt > 1) |
| | | { |
| | |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Hero)) |
| | | return; |
| | | |
| | | var team = TeamManager.Instance.GetTeam(TeamType.Story); |
| | | var team = TeamManager.Instance.GetTeam(BattlePreSetType.Story); |
| | | for (int i = 0; i < heroOnTeamRedpointList.Count; i++) |
| | | { |
| | | var redpoint = heroOnTeamRedpointList[i]; |
| | |
| | | } |
| | | } |
| | | |
| | | void OnTeamChangeEvent(TeamType teamType) |
| | | void OnTeamChangeEvent(int teamType) |
| | | { |
| | | if (teamType == TeamType.Story) |
| | | if (teamType == TeamManager.Instance.GetMainTeamID()) |
| | | { |
| | | refreshRedPoint = true; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | TeamBase storyTeam = TeamManager.Instance.GetTeam(TeamType.Story); |
| | | TeamBase storyTeam = TeamManager.Instance.GetTeam(BattlePreSetType.Story); |
| | | storyTeam.RemoveAllHeroes(); |
| | | |
| | | int currentMaxLineupCount = TeamConst.MaxTeamHeroCount - HeroUIManager.Instance.lockIndexList.Count; |
| | |
| | | |
| | | fightingHeroSkinID = teamHero.SkinID; |
| | | //战斗时没有GUID ,通过heroid查找 |
| | | var hero = TeamManager.Instance.GetTeam(TeamType.Story).GetHeroByHeroID(teamHero.heroId); |
| | | var hero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetHeroByHeroID(teamHero.heroId); |
| | | if (hero != null) |
| | | { |
| | | heroGuid = hero.guid; |
| | |
| | | } |
| | | |
| | | #region 初始化战力计算的信息 |
| | | TeamType teamTypeCalc = TeamType.Story; //不同阵容战力不同 |
| | | int teamTypeCalc = 1; //不同阵容战力不同 |
| | | bool isPreviewTeamPower; //预览阵容(队伍)战力 |
| | | int dropIndexCalc = -1; //掉落装备在阵容的索引,用于预览战力对比 |
| | | |
| | |
| | | /// <param name="teamType">阵容类型</param> |
| | | /// <param name="dropindex">掉落装备的索引,-1代表不替换计算</param> |
| | | /// <param name="ispreview">预览阵容战力</param> |
| | | public void InitFightPowerParam(TeamType teamType = TeamType.Story, int dropindex = -1, bool ispreview = false) |
| | | public void InitFightPowerParam(int teamType = 1, int dropindex = -1, bool ispreview = false) |
| | | { |
| | | #if !UNITY_EDITOR |
| | | openLog = false; |
| | |
| | | public long GetHeroFightPower(HeroInfo heroInfo) |
| | | { |
| | | bool ispreview = false; |
| | | var team = TeamManager.Instance.GetTeam(TeamType.Story); |
| | | var team = TeamManager.Instance.GetTeam(TeamManager.Instance.GetMainTeamID()); |
| | | if (!team.HasHero(heroInfo.itemHero.guid)) |
| | | { |
| | | //替换上阵位置 |
| | |
| | | |
| | | |
| | | //查看阵容战力 |
| | | public long GetTeamFightPower(TeamType team, bool isPreview) |
| | | public long GetTeamFightPower(int team, bool isPreview) |
| | | { |
| | | InitFightPowerParam(team, -1, isPreview); |
| | | return CalculatePower(); |
| | |
| | | { |
| | | |
| | | Dictionary<int, long> tmpAttrs = new Dictionary<int, long>(); |
| | | hero.RefreshFetterAttrsWhenCalcPower(TeamType.Story); //羁绊属性要实时算 |
| | | hero.RefreshFetterAttrsWhenCalcPower(TeamManager.Instance.GetMainTeamID()); //羁绊属性要实时算 |
| | | |
| | | #if UNITY_EDITOR |
| | | propertyStrForDebug = ""; |
| | |
| | | |
| | | changeHeroPosBtn.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.Story; |
| | | HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetMainTeamID(); |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | |
| | |
| | | RefreshRecharge(); |
| | | ShowBlessLV(); |
| | | DisplayAutoFight(); |
| | | DisplayCard(TeamType.Story); |
| | | DisplayCard(TeamManager.Instance.GetMainTeamID()); |
| | | DisplayLevel(); |
| | | DisplayRestState(); |
| | | |
| | |
| | | TaskManager.Instance.ClickTask(); |
| | | } |
| | | |
| | | void DisplayCard(TeamType teamType) |
| | | void DisplayCard(int presetID) |
| | | { |
| | | if (teamType != TeamType.Story) |
| | | if (presetID != TeamManager.Instance.GetMainTeamID()) |
| | | return; |
| | | var team = TeamManager.Instance.GetTeam(teamType); |
| | | var team = TeamManager.Instance.GetTeam(presetID); |
| | | var heros = team.GetHerosOnTeam(); |
| | | //显示卡牌 |
| | | for (int i = 0; i < heroFightingCardCells.Length; i++) |
| | |
| | | //其他武将功能产生数据变化,需要刷新武将列表 |
| | | if (closeUI is HeroTrainWin) |
| | | { |
| | | DisplayCard(TeamType.Story); |
| | | DisplayCard(TeamManager.Instance.GetMainTeamID()); |
| | | } |
| | | |
| | | if (closeUI is ChatWin) |
| | |
| | | |
| | | void OnUnLockHeroCountEvent() |
| | | { |
| | | DisplayCard(TeamType.Story); |
| | | DisplayCard(TeamManager.Instance.GetMainTeamID()); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (string.IsNullOrEmpty(guid)) |
| | | { |
| | | var tmpHero = TeamManager.Instance.GetTeam(TeamType.Story).GetNextServerHero(""); |
| | | var tmpHero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetNextServerHero(""); |
| | | if (tmpHero != null) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = tmpHero.SkinID; |
| | |
| | | cdTween.SetStartState(); |
| | | cdTween.Play(() => |
| | | { |
| | | var tmpHero = TeamManager.Instance.GetTeam(TeamType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid); |
| | | var tmpHero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid); |
| | | if (tmpHero != null) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = tmpHero.SkinID; |
| | |
| | | |
| | | if (AutoFightModel.Instance.fightingHeroSkinID == 0) |
| | | { |
| | | var tmpHero = TeamManager.Instance.GetTeam(TeamType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid); |
| | | var tmpHero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid); |
| | | if (tmpHero != null) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = tmpHero.SkinID; |
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (hero.IsInTeamByTeamType(TeamType.Story))
|
| | | if (hero.IsInTeamByTeamType(BattlePreSetType.Story))
|
| | | {
|
| | | return;
|
| | | }
|
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | | //命格方案 |
| | | public class MinggeCaseCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Text caseNameText; |
| | | [SerializeField] Transform selectObj; |
| | | [SerializeField] Transform unSelectObj; |
| | | |
| | | public void Display(int index) |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| File was renamed from Main/System/Team/TeamType.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 097080eb83a42b54bbc2b10bc100993b |
| | | guid: d82ac7d0e4493ee4fb4fe720c72564fb |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | | |
| | | public class MinggeEquipCell : MonoBehaviour |
| | | { |
| | | [SerializeField] UIEffectPlayer loopEffect; |
| | | [SerializeField] Text posNameText; |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] Image iconImage; |
| | | [SerializeField] Image skillImage; //只有带意象技能才显示 |
| | | [SerializeField] UIEffectPlayer activeEffect; |
| | | [SerializeField] Button button; |
| | | |
| | | [Header("命格装备位")] |
| | | public int equipIndex; |
| | | |
| | | public void Display() |
| | | { |
| | | var packIndex = equipIndex - 1; //对应卦玉背包索引 = (套编号-1)*12+装备位-1 |
| | | var item = PackManager.Instance.GetItemByIndex(PackType.Mingge, packIndex); |
| | | if (item == null) |
| | | { |
| | | loopEffect?.Stop(); |
| | | posNameText.text = Language.Get($"MinggeGird{packIndex}"); |
| | | iconImage.SetActive(false); |
| | | button.RemoveAllListeners(); |
| | | return; |
| | | } |
| | | posNameText.text = ""; |
| | | iconImage.SetActive(true); |
| | | int itemID = item.config.ID; |
| | | iconImage.SetItemSprite(itemID); |
| | | if (packIndex <= 4 && skillImage != null) |
| | | { |
| | | skillImage.SetActive(true); |
| | | skillImage.SetSprite($"MinggeSkill_{itemID}"); |
| | | loopEffect.Play(); |
| | | } |
| | | else |
| | | { |
| | | skillImage.SetActive(false); |
| | | } |
| | | |
| | | lvText.text = EquipModel.Instance.GetEquipLV(item).ToString(); |
| | | |
| | | button.AddListener(() => |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | }); |
| | | } |
| | | |
| | | public void PlayEffect() |
| | | { |
| | | activeEffect.Play(); |
| | | } |
| | | |
| | | } |
| | | |
copy from Main/System/Team/TeamType.cs.meta
copy to Main/System/Mingge/MinggeEquipCell.cs.meta
| File was copied from Main/System/Team/TeamType.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 097080eb83a42b54bbc2b10bc100993b |
| | | guid: df66a8f8775cbdb4bbbc68542b32bbc9 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | |
| | | public class MinggeManager : GameSystemManager<MinggeManager> |
| | | { |
| | | public int tyItemID; //推演物品ID |
| | | public int qlItemID; //祈灵物品ID |
| | | public int[] minggeItemTypeList; //可携带意象的卦玉类型列表 |
| | | public int[] minggeSkillTypeIDList; //意向效果技能TypeID列表 |
| | | |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | | ParseConfig(); |
| | | } |
| | | |
| | | public override void Release() |
| | |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; |
| | | } |
| | | |
| | | |
| | | void ParseConfig() |
| | | { |
| | | var config = FuncConfigConfig.Get("MinggeCfg"); |
| | | tyItemID = int.Parse(config.Numerical2); |
| | | qlItemID = int.Parse(config.Numerical3); |
| | | |
| | | config = FuncConfigConfig.Get("MinggeTY"); |
| | | minggeItemTypeList = JsonMapper.ToObject<int[]>(config.Numerical4); |
| | | minggeSkillTypeIDList = JsonMapper.ToObject<int[]>(config.Numerical5); |
| | | |
| | | } |
| | | |
| | | private void OnBeforePlayerDataInitialize() |
| | | { |
| | | } |
| | |
| | | using System; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class MinggeWin : UIBase |
| | | { |
| | | |
| | | [SerializeField] Button seeAttrBtn; |
| | | [SerializeField] MinggeEquipCell[] equipCells; |
| | | [SerializeField] MinggeCaseCell[] caseCells; |
| | | [SerializeField] Text rankLevelText; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | |
| | |
| | | |
| | | |
| | | // 向服务端请求其他玩家数据 |
| | | public void ViewPlayerDetail(int _playerId, int viewType = (int)ViewPlayerType.viewPlayerData, int viewPlayerLineupType = (int)TeamType.Story) |
| | | public void ViewPlayerDetail(int _playerId, int viewType = (int)ViewPlayerType.viewPlayerData, int viewPlayerLineupType = (int)BattlePreSetType.Story) |
| | | { |
| | | if (_playerId == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | |
| | | viewPlayerLineupType = -1; |
| | | } |
| | | #region 获取PlusData中的数据 |
| | | public Dictionary<int, RolePlusData.HeroData> GetHeroDataDict(int playerID, int lineupType) |
| | | |
| | | public int GetFuncPresetID(int playerID, int battleType, int funcType) |
| | | { |
| | | ViewPlayerData viewPlayerData = GetViewPlayerData(playerID); |
| | | if (viewPlayerData?.rolePlusData?.LineupDic?.TryGetValue(lineupType, out var lineupData) != true) |
| | | if (viewPlayerData?.rolePlusData?.BatPresetDic?.TryGetValue(battleType, out var data) != true) |
| | | { |
| | | return 1; |
| | | } |
| | | return data.ContainsKey(funcType) ? data[funcType] : 1; |
| | | } |
| | | |
| | | public Dictionary<int, RolePlusData.HeroData> GetHeroDataDict(int playerID, int presetID) |
| | | { |
| | | ViewPlayerData viewPlayerData = GetViewPlayerData(playerID); |
| | | if (viewPlayerData?.rolePlusData?.LineupDic?.TryGetValue(presetID, out var lineupData) != true) |
| | | { |
| | | return null; |
| | | } |
| | | return lineupData?.HeroDic; |
| | | } |
| | | |
| | | public List<RolePlusData.HeroData> GetHeroDataSortList(int playerID, int lineupType) |
| | | public List<RolePlusData.HeroData> GetHeroDataSortList(int playerID, int presetID) |
| | | { |
| | | var heroDataDict = GetHeroDataDict(playerID, lineupType); |
| | | var heroDataDict = GetHeroDataDict(playerID, presetID); |
| | | if (heroDataDict == null) |
| | | { |
| | | return null; |
| | |
| | | return res; |
| | | } |
| | | |
| | | public bool TryGetFightPointByTeamType(int playerID, int teamType, out long fightPower) |
| | | public bool TryGetFightPointByTeamType(int playerID, int presetID, out long fightPower) |
| | | { |
| | | fightPower = 0; |
| | | var lineupDic = GetViewPlayerData(playerID)?.rolePlusData?.LineupDic; |
| | | if (lineupDic != null && lineupDic.TryGetValue(teamType, out var lineupData)) |
| | | if (lineupDic != null && lineupDic.TryGetValue(presetID, out var lineupData)) |
| | | { |
| | | fightPower = lineupData.FightPower; |
| | | return true; |
| | |
| | | |
| | | // 阵容字典 <阵容ID, 阵容数据> |
| | | public Dictionary<int, LineupData> LineupDic = new Dictionary<int, LineupData>(); |
| | | public Dictionary<int, Dictionary<int, int>> BatPresetDic = new Dictionary<int, Dictionary<int, int>>(); |
| | | |
| | | // 红颜数据 |
| | | public BeautyData beautyData; |
| | |
| | | |
| | | EquipDic.Clear(); |
| | | LineupDic.Clear(); |
| | | BatPresetDic.Clear(); |
| | | beautyData = null; // 必须置空,防止显示上一个玩家的数据 |
| | | horseData = null; // 必须置空 |
| | | // 1. 转为 JsonData 对象 |
| | |
| | | } |
| | | } |
| | | } |
| | | //BatPreset - {"战斗预设类型":{"预设类型":使用的方案ID, ...}, ...} |
| | | if (jd.Keys.Contains("BatPreset")) |
| | | { |
| | | JsonData batPresetJson = jd["BatPreset"]; |
| | | BatPresetDic = new Dictionary<int, Dictionary<int, int>>(); |
| | | foreach (string outerKey in batPresetJson.Keys) |
| | | { |
| | | if (int.TryParse(outerKey, out int outerKeyInt)) |
| | | { |
| | | JsonData innerJson = batPresetJson[outerKey]; |
| | | var innerDict = new Dictionary<int, int>(); |
| | | foreach (string innerKey in innerJson.Keys) |
| | | { |
| | | if (int.TryParse(innerKey, out int innerKeyInt)) |
| | | { |
| | | innerDict[innerKeyInt] = int.Parse(innerJson[innerKey].ToString()); |
| | | } |
| | | } |
| | | BatPresetDic[outerKeyInt] = innerDict; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | |
| | | OtherPlayerDetailManager.ViewPlayerData viewPlayerData; |
| | | OtherPlayerDetailManager manager { get { return OtherPlayerDetailManager.Instance; } } |
| | | |
| | | int teamType = -1; |
| | | int funcPresetID = -1; //子方案ID |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | |
| | | protected override void OnPreOpen() |
| | | { |
| | | GuildManager.Instance.OnRefreshFairyList += OnRefreshFairyList; |
| | | teamType = functionOrder; |
| | | funcPresetID = OtherPlayerDetailManager.Instance.GetFuncPresetID(manager.viewPlayer, functionOrder, (int)FuncPresetType.Team); |
| | | Display(); |
| | | } |
| | | |
| | |
| | | |
| | | DisplayMM(playerID); |
| | | |
| | | var heroList = manager.GetHeroDataSortList(playerID, teamType); |
| | | var heroList = manager.GetHeroDataSortList(playerID, funcPresetID); |
| | | if (heroList.IsNullOrEmpty()) |
| | | { |
| | | heroList = manager.GetHeroDataSortList(playerID, (int)TeamType.Story); |
| | | heroList = manager.GetHeroDataSortList(playerID, FuncPresetManager.FuncDefaultPresetID); |
| | | } |
| | | DisplayCard(heroList); |
| | | |
| | | long fightPonit; |
| | | if (!manager.TryGetFightPointByTeamType(playerID, teamType, out fightPonit)) |
| | | if (!manager.TryGetFightPointByTeamType(playerID, funcPresetID, out fightPonit)) |
| | | { |
| | | if (!manager.TryGetFightPointByTeamType(playerID, (int)TeamType.Story, out fightPonit)) |
| | | if (!manager.TryGetFightPointByTeamType(playerID, FuncPresetManager.FuncDefaultPresetID, out fightPonit)) |
| | | { |
| | | fightPonit = 0; |
| | | } |
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | AvatarHelper.TryViewOtherPlayerInfo(avatarModel.playerID, (int)ViewPlayerType.viewPlayerData, (int)TeamType.Story);
|
| | | AvatarHelper.TryViewOtherPlayerInfo(avatarModel.playerID, (int)ViewPlayerType.viewPlayerData);
|
| | | });
|
| | | }
|
| | |
|
| | |
| | |
|
| | | public static class AvatarHelper
|
| | | {
|
| | | public static void TryViewOtherPlayerInfo(int _playerId, int viewType = (int)ViewPlayerType.viewPlayerData, int viewPlayerLineupType = (int)TeamType.Story)
|
| | | public static void TryViewOtherPlayerInfo(int _playerId, int viewType = (int)ViewPlayerType.viewPlayerData, int viewPlayerLineupType = (int)BattlePreSetType.Story)
|
| | | {
|
| | | if (_playerId == PlayerDatas.Instance.PlayerId || UIManager.Instance.IsOpened<OtherPlayerDetailWin>())
|
| | | return;
|
| | |
| | | |
| | | |
| | | // 服务器下发的阵型和阵容,只能通过网络协议赋值,外部只读 |
| | | public TeamType teamType |
| | | public int teamType |
| | | { |
| | | get; |
| | | private set; |
| | | } |
| | | |
| | | private int ShapeType; |
| | | public int ServerShapeType { get; private set; } |
| | | |
| | | |
| | | public TeamHero[] tempHeroes { get; private set; } = new TeamHero[TeamConst.MaxTeamHeroCount]; |
| | | |
| | | public TeamHero[] serverHeroes { get; private set; } = new TeamHero[TeamConst.MaxTeamHeroCount]; |
| | | |
| | | public TeamBase(TeamType _teamType) |
| | | public TeamBase(int _teamType) |
| | | { |
| | | teamType = _teamType; |
| | | teamIndex = 0; |
| | |
| | | } |
| | | teamIndex = lineUp.Num; |
| | | playerId = lineUp.OwnerID; |
| | | ShapeType = lineUp.ShapeType; |
| | | ServerShapeType = lineUp.ShapeType; |
| | | |
| | | for (int i = 0; i < lineUp.ObjCnt; i++) |
| | | { |
| | |
| | | |
| | | CB412_tagCSHeroPresetSave savePack = new CB412_tagCSHeroPresetSave(); |
| | | savePack.PresetID = (byte)teamType; |
| | | savePack.ShapeType = (byte)ShapeType; |
| | | savePack.PosCnt = (byte)GetTeamHeroCount(); |
| | | savePack.HeroPosList = new CB412_tagCSHeroPresetSave.tagCSHeroPresetPos[savePack.PosCnt]; |
| | | |
| | |
| | | //非主线阵容客户端自己做战力变化,主线阵容服务端战力变更会同步推送 |
| | | } |
| | | |
| | | public void OnChangeShapeType(int newShapeType) |
| | | { |
| | | ShapeType = newShapeType; |
| | | } |
| | | |
| | | public void OnServerChangeShapeType(int newShapeType) |
| | | { |
| | | ServerShapeType = newShapeType; |
| | | ShapeType = newShapeType; |
| | | } |
| | | |
| | | |
| | | |
| | | public void RefreshServerData(int shapeType, int positionIndex, HeroInfo heroInfo) |
| | | public void RefreshServerData(int positionIndex, HeroInfo heroInfo) |
| | | { |
| | | TeamHero teamHero = heroInfo == null ? null : new TeamHero(heroInfo, positionIndex, this); |
| | | SetServerTeamHero(positionIndex, teamHero); |
| | | OnServerChangeShapeType(shapeType); |
| | | } |
| | | |
| | | public void CreateDefault(List<HeroInfo> heroInfos) |
| | | { |
| | | teamIndex = 0; |
| | | playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | OnServerChangeShapeType(0); |
| | | |
| | | for (int i = 0; i < heroInfos.Count; i++) |
| | | { |
| | |
| | | |
| | | public class TeamManager : GameSystemManager<TeamManager> |
| | | { |
| | | protected Dictionary<TeamType, TeamBase> teamDict = new Dictionary<TeamType, TeamBase>(); |
| | | protected Dictionary<int, TeamBase> teamDict = new Dictionary<int, TeamBase>(); |
| | | |
| | | public Action<TeamType> OnTeamChange = null; |
| | | public Action<int> OnTeamChange = null; |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | public void OnHeroChangeEvent(HB124_tagSCHeroPresetInfo vNetData) |
| | | { |
| | | var heroPack = PackManager.Instance.GetSinglePack(PackType.Hero); |
| | | HashSet<TeamType> teamTypeSet = new HashSet<TeamType>(); |
| | | HashSet<int> teamTypeSet = new HashSet<int>(); |
| | | for (int i = 0; i < vNetData.PresetCnt; i++) |
| | | { |
| | | TeamType teamType = (TeamType)vNetData.PresetList[i].PresetID; |
| | | int teamType = vNetData.PresetList[i].PresetID; |
| | | teamTypeSet.Add(teamType); |
| | | var team = GetTeam(teamType); |
| | | for (int j = 0; j < vNetData.PresetList[i].HeroCnt; j++) |
| | |
| | | hero = HeroManager.Instance.GetHero(item.guid); |
| | | |
| | | } |
| | | team.RefreshServerData(vNetData.PresetList[i].ShapeType, j, hero); |
| | | team.RefreshServerData(j, hero); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public bool HasTeam(TeamType teamType) |
| | | public bool HasTeam(int teamType) |
| | | { |
| | | return teamDict.ContainsKey(teamType); |
| | | } |
| | | |
| | | public TeamBase GetTeam(TeamType teamType) |
| | | //通过阵容方案ID获取阵容 |
| | | public TeamBase GetTeam(int teamType) |
| | | { |
| | | TeamBase team = null; |
| | | |
| | |
| | | |
| | | return team; |
| | | } |
| | | |
| | | //通过战斗类型获取阵容 |
| | | public TeamBase GetTeam(BattlePreSetType battlePassType) |
| | | { |
| | | int presetID = GetTeamID((int)battlePassType); |
| | | TeamBase team = null; |
| | | |
| | | if (!teamDict.TryGetValue(presetID, out team)) |
| | | { |
| | | team = new TeamBase(presetID); |
| | | // team.CreateDefault(HeroManager.Instance.GetPowerfulHeroList()); |
| | | teamDict.Add(presetID, team); |
| | | } |
| | | |
| | | return team; |
| | | } |
| | | |
| | | // 获取主阵容方案ID |
| | | public int GetMainTeamID() |
| | | { |
| | | return FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Team); |
| | | } |
| | | |
| | | public int GetTeamID(int battleType) |
| | | { |
| | | return FuncPresetManager.Instance.GetFuncPresetID(battleType, (int)FuncPresetType.Team); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | OnPreOpen(); |
| | | if (layout != null) |
| | | { |
| | | UIUtility.ForceRefreshLayout(layout).Forget(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | try |
| | | { |
| | | NextFrameAfterOpen(); |
| | | if (layout != null) |
| | | { |
| | | UIUtility.ForceRefreshLayout(layout).Forget(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | }); |
| | | btnFormation.SetListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.Story; |
| | | HeroUIManager.Instance.selectTeamType = TeamManager.Instance.GetMainTeamID(); |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | btnSelectOneClick.SetListener(() => |
| | |
| | | DogzEquip = 33, //神兽装备背包(神兽穿戴) |
| | | |
| | | Hero = 35, // 武将背包 |
| | | Mingge = 36, // 命格装备背包 |
| | | MinggeDrop = 37, //命格掉落背包 |
| | | |
| | | //后续IL开发添加预设 |
| | | default1, //34 垃圾回收 |
| | | default2, |
| | | default3, |
| | | default4, |
| | | default5, |
| | | default6, |
| | | default7, |
| | | default8, |
| | | default9, |
| | | default10, |
| | | |
| | | GatherSoul = 254,//聚魂 |
| | | RunePack = 255,//符印背包 |
| | |
| | | LineupRecommend = 50, //阵容推荐 |
| | | DailySpecials = 51, //每日特惠 |
| | | Mail = 52, //邮箱 |
| | | Mingge = 54, //命格 |
| | | WarlordPavilion = 55, //定军阁 |
| | | } |
| | | |