422 子 【内政】命格系统 / 【内政】命格系统-客户端 - 临时
3 文件已复制
1个文件已删除
1 文件已重命名
4个文件已添加
16个文件已修改
| | |
| | | public partial class PresetUnlockConfig : ConfigBase<int, PresetUnlockConfig> |
| | | { |
| | | static Dictionary<int, Dictionary<int, PresetUnlockConfig>> m_PresetUnlockDict = new Dictionary<int, Dictionary<int, PresetUnlockConfig>>(); |
| | | |
| | | static Dictionary<int, int> m_UnLockTypeDict = new Dictionary<int, int>(); |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | if (!m_PresetUnlockDict.ContainsKey(PresetType)) |
| | |
| | | m_PresetUnlockDict[PresetType] = new Dictionary<int, PresetUnlockConfig>(); |
| | | } |
| | | m_PresetUnlockDict[PresetType][PresetID] = this; |
| | | |
| | | if (!m_UnLockTypeDict.ContainsKey(PresetType)) |
| | | { |
| | | m_UnLockTypeDict[PresetType] = UnlockType; |
| | | } |
| | | else if (m_UnLockTypeDict[PresetType] < UnlockType) |
| | | { |
| | | m_UnLockTypeDict[PresetType] = UnlockType; |
| | | } |
| | | } |
| | | |
| | | public static PresetUnlockConfig GetPresetUnlockConfig(int presetType, int presetID) |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static int GetUnlockType(int presetType) |
| | | { |
| | | if (m_UnLockTypeDict.ContainsKey(presetType)) |
| | | { |
| | | return m_UnLockTypeDict[presetType]; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public static int GetFuncPresetMaxCount(int presetType) |
| | | { |
| | | if (m_PresetUnlockDict.ContainsKey(presetType)) |
| | | { |
| | | return m_PresetUnlockDict[presetType].Count; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B1 32 命格信息 #tagSCMinggeInfo
|
| | |
|
| | | public class DTCB132_tagSCMinggeInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HB132_tagSCMinggeInfo vNetData = vNetPack as HB132_tagSCMinggeInfo;
|
| | | MinggeManager.Instance.UpdateMinggeInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | //处理所有掉落的物品 |
| | | public void CalcAllFloorItems() |
| | | { |
| | | int cnt = PackManager.Instance.GetSinglePack(PackType.DropItem).GetItems().Count; |
| | | if (cnt == 0) |
| | | { |
| | | Debug.Log("CalcAllFloorItems 没有掉落物品"); |
| | | |
| | | var items = PackManager.Instance.GetItems(PackType.DropItem); |
| | | if (items.IsNullOrEmpty()) |
| | | return; |
| | | } |
| | | |
| | | |
| | | int cnt = items.Count; |
| | | needMoreDrop = cnt == 20; |
| | | |
| | | //构建所有物品 |
| | | foreach (var item in PackManager.Instance.GetSinglePack(PackType.DropItem).GetItems()) |
| | | foreach (var item in items) |
| | | { |
| | | CalcFloorEquip(item.gridIndex); |
| | | } |
| | |
| | | return equip.GetUseData(23); |
| | | } |
| | | |
| | | //战斗属性ID列表 |
| | | //装备战斗属性ID列表, 如果是卦玉的话基础和战斗都放一起 |
| | | public List<int> GetEquipFightAttrs(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | |
| | | return equip.GetUseData(37); |
| | | } |
| | | |
| | | public int GetEquipSkillID(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return 0; |
| | | } |
| | | var _list = equip.GetUseData(37); |
| | | return _list.IsNullOrEmpty() ? 0 : _list[0]; |
| | | } |
| | | |
| | | |
| | | //得到装备位对应的部位名称 |
| | | public string GetEquipPlaceName(int place) |
| | | { |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //方案预设 方案选择组件 |
| | | public class FuncPresetChooseCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Transform unFoldObj; //展开 |
| | | [SerializeField] Transform foldObj; //折叠 在此状态也有选中非选中 |
| | | [SerializeField] Image lockImg; |
| | | [SerializeField] Text numText; |
| | | [SerializeField] Image selectImg; |
| | | [SerializeField] Button unFoldBtn; //解锁或者展开 |
| | | |
| | | [SerializeField] Text caseNameText; |
| | | [SerializeField] Button changeNameBtn; |
| | | [SerializeField] Text numUnFoldText; |
| | | [SerializeField] Button foldBtn; //折叠 |
| | | |
| | | |
| | | public void Display(int battleType, int funcType, int id, bool isUnFold) |
| | | { |
| | | var data = FuncPresetManager.Instance.GetFuncPreset(funcType, id); |
| | | if (data == null) |
| | | { |
| | | return; |
| | | } |
| | | var selectID = FuncPresetManager.Instance.GetFuncPresetIDByBattleType(battleType, funcType); |
| | | if (isUnFold) |
| | | { |
| | | unFoldObj.SetActive(true); |
| | | foldObj.SetActive(false); |
| | | |
| | | caseNameText.text = data.PresetName; |
| | | numUnFoldText.text = id.ToString(); |
| | | changeNameBtn.AddListener(ChangeName); |
| | | foldBtn.AddListener(()=>Fold(funcType, id)); |
| | | } |
| | | else |
| | | { |
| | | unFoldObj.SetActive(false); |
| | | foldObj.SetActive(true); |
| | | |
| | | unFoldBtn.AddListener(() => UnFold(funcType, id)); |
| | | lockImg.SetActive(!data.unLock); |
| | | numText.text = id.ToString(); |
| | | selectImg.SetActive(selectID == id); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | void ChangeName() |
| | | { |
| | | // UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(); |
| | | } |
| | | |
| | | void Fold(int funcType, int id) |
| | | { |
| | | FuncPresetManager.Instance.OnSelectPresetEvent?.Invoke(funcType, id, false); |
| | | } |
| | | |
| | | void UnFold(int funcType, int id) |
| | | { |
| | | var data = FuncPresetManager.Instance.GetFuncPreset(funcType, id); |
| | | if (!data.unLock) |
| | | { |
| | | // 未解锁 则购买 |
| | | return; |
| | | } |
| | | FuncPresetManager.Instance.OnSelectPresetEvent?.Invoke(funcType, id, true); |
| | | } |
| | | } |
| File was renamed from Main/System/Mingge/MinggeCaseCell.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d82ac7d0e4493ee4fb4fe720c72564fb |
| | | guid: e19596bebfefd1e4c943e65ebddd11f1 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using UnityEngine; |
| | | |
| | | //方案预设: 多方案选择组件 |
| | | //控制显隐: 1.未开启时全不显示 |
| | | // 2.开启后显示已解锁 + 未解锁 3+0 |
| | | //a. 按元宝解锁的为逐一开启,默认开启x个,第x+1个显示条件需要【流派预设】功能开启, 可解锁后逐一保留一个锁住的(直到全开启); |
| | | //b. 按功能条件开启的,如果默认只开其一个方案的情况不显示,达到下一个方案的条件满足后全显示;默认大于1个的情况直接全显示 |
| | | // 3.当小于4个的时候,没有下拉显示,如果可以超过4个的显示下拉 |
| | | // 4.当大于4个的时候,选择超过方案4时,第四个显示为选中的方案; 否则重开的时候默认显示1-4 不记录历史点击 |
| | | // 5.名字展开分两种情况,外层功能默认不展开,点击后切换展开状态;流派预设界面里只有展开状态不可收缩 |
| | | public class FuncPresetChooseCells : MonoBehaviour |
| | | { |
| | | [SerializeField] FuncPresetChooseCell[] cells; |
| | | |
| | | int curBbattleType; |
| | | bool isUnFold = false; //是否展开 |
| | | bool forceUnFold = false; //强制展开,不能收缩 |
| | | |
| | | /// <summary> |
| | | /// 显示方案预设 |
| | | /// </summary> |
| | | /// <param name="battleType"></param> |
| | | /// <param name="funcType"></param> |
| | | /// <param name="forceUnFold"> 强制展开,不能收缩</param> |
| | | public void Display(int battleType, int funcType, bool _forceUnFold = false) |
| | | { |
| | | forceUnFold = _forceUnFold; |
| | | var _unFoldState = forceUnFold ? true : isUnFold; |
| | | curBbattleType = battleType; |
| | | var selectID = FuncPresetManager.Instance.GetFuncPresetIDByBattleType(battleType, funcType); |
| | | for (int i = 0; i < cells.Length; i++) |
| | | { |
| | | if (i < 3) |
| | | { |
| | | cells[i].Display(battleType, funcType, i + 1, _unFoldState); |
| | | } |
| | | else |
| | | { |
| | | //第四个动态变化 |
| | | cells[i].Display(battleType, funcType, selectID > 4 ? selectID : 4, _unFoldState); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | void OnEnable() |
| | | { |
| | | if (!forceUnFold) |
| | | { |
| | | FuncPresetManager.Instance.OnSelectPresetEvent += OnSelectPresetEvent; |
| | | } |
| | | } |
| | | |
| | | void OnDisable() |
| | | { |
| | | if (!forceUnFold) |
| | | { |
| | | isUnFold = false; |
| | | FuncPresetManager.Instance.OnSelectPresetEvent -= OnSelectPresetEvent; |
| | | } |
| | | } |
| | | |
| | | void OnSelectPresetEvent(int funcType, int id, bool _isUnFold) |
| | | { |
| | | isUnFold = _isUnFold; |
| | | int index = id > 4 ? 3 : id - 1; |
| | | cells[index].Display(curBbattleType, funcType, id, isUnFold); |
| | | } |
| | | } |
copy from Main/System/Mingge/MinggeCaseCell.cs.meta
copy to Main/System/FuncPreset/FuncPresetChooseCells.cs.meta
| File was copied from Main/System/Mingge/MinggeCaseCell.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d82ac7d0e4493ee4fb4fe720c72564fb |
| | | guid: c377e47a1d94e154387ee9c6b4b1d106 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | public const int GlobalDefaultPresetID = 1; //默认全局方案ID |
| | | public const int FuncDefaultPresetID = 1; //默认子功能方案ID |
| | | |
| | | public int teamPresetMaxID = 1; //阵容预设最大ID, 默认1按解锁开放 |
| | | public int[] openConditions; //流派预设(也叫全局方案/战斗方案) 开启条件【开服第N天,主线通关X-Y,定军阁达到N层】 |
| | | |
| | | public Action<int, int, bool> OnSelectPresetEvent; //选择功能预设方案事件 功能类型 方案ID 是否展开 |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | |
| | | void ParseConfig() |
| | | { |
| | | |
| | | var config = FuncConfigConfig.Get("FuncPreset"); |
| | | openConditions = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | } |
| | | |
| | | private void OnBeforePlayerDataInitialize() |
| | | { |
| | | battlePreSetDict.Clear(); |
| | | m_FuncPresetSaveDict.Clear(); |
| | | InitFuncPreset(); |
| | | } |
| | | |
| | | //流派解锁 |
| | | public bool IsOpen() |
| | | { |
| | | //特殊约定 |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge)) |
| | | return false; |
| | | |
| | | if (TimeUtility.OpenDay < openConditions[0] - 1) |
| | | { |
| | | return false; |
| | | } |
| | | if (PlayerDatas.Instance.baseData.ExAttr1 / 100 <= openConditions[1]) |
| | | { |
| | | return false; |
| | | } |
| | | int layerNum = 0; |
| | | WarlordPavilionManager.Instance.TryGetHistoryMaxPassLayerNum(out layerNum); |
| | | if (layerNum < openConditions[2]) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | //提前显示 |
| | | public bool IsPreShow() |
| | | { |
| | | return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge); |
| | | } |
| | | |
| | | void InitFuncPreset() |
| | |
| | | unLock = config.UnlockType == 0, |
| | | PresetName = Language.Get("Mingge13") + config.PresetID, |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | public void UpdateFuncPresetInfoList(HB161_tagSCFuncPresetInfoList vNetData) |
| | |
| | | OnBattelePresetEvent?.Invoke(); |
| | | } |
| | | |
| | | //获取全局方案ID,如果取不到默认方案1 |
| | | public int GetGlobalPresetID(int type) |
| | | //根据战斗获取全局方案ID,如果取不到默认方案1 |
| | | public int GetGlobalPresetID(int battlePresetType) |
| | | { |
| | | if (battlePreSetDict.ContainsKey(type)) |
| | | if (battlePreSetDict.ContainsKey(battlePresetType)) |
| | | { |
| | | return battlePreSetDict[type]; |
| | | return battlePreSetDict[battlePresetType]; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //获取子功能方案ID,如果取不到默认方案1 |
| | | public int GetFuncPresetID(int type, int presetID) |
| | | //指定战斗模式下获取子功能方案ID,如果取不到默认方案1 |
| | | public int GetFuncPresetIDByBattleType(int battlePresetType, int funcType) |
| | | { |
| | | if (m_FuncPresetSaveDict.ContainsKey(presetID) && m_FuncPresetSaveDict[presetID].ContainsKey(type)) |
| | | int globalPresetID = GetGlobalPresetID(battlePresetType); |
| | | if (m_FuncPresetSaveDict.ContainsKey(globalPresetID) && m_FuncPresetSaveDict[globalPresetID].ContainsKey(funcType)) |
| | | { |
| | | return m_FuncPresetSaveDict[presetID][type]; |
| | | return m_FuncPresetSaveDict[globalPresetID][funcType]; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //指定流派获取子功能方案ID,如果取不到默认方案1 |
| | | public int GetFuncPresetID(int globalPresetID, int funcType) |
| | | { |
| | | if (m_FuncPresetSaveDict.ContainsKey(globalPresetID) && m_FuncPresetSaveDict[globalPresetID].ContainsKey(funcType)) |
| | | { |
| | | return m_FuncPresetSaveDict[globalPresetID][funcType]; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //获取子功能方案ID,如果取不到默认方案1; 默认取当前流派下的 |
| | | public int GetFuncPresetID(int funcType) |
| | | { |
| | | int globalPresetID = GetGlobalPresetID((int)BattlePreSetType.Story); |
| | | if (m_FuncPresetSaveDict.ContainsKey(globalPresetID) && m_FuncPresetSaveDict[globalPresetID].ContainsKey(funcType)) |
| | | { |
| | | return m_FuncPresetSaveDict[globalPresetID][funcType]; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | // |
| | | public FuncPreset GetFuncPreset(int funcType, int presetID) |
| | | { |
| | | if (m_FuncPresetDict.ContainsKey(funcType) && m_FuncPresetDict[funcType].ContainsKey(presetID)) |
| | | { |
| | | return m_FuncPresetDict[funcType][presetID]; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // 这里虽然传的是 battleType,但是实际还是根据全局方案ID做对应修改;如果这个全局方案其他地方有使用也是同步变化 |
| | | public void SaveFuncPresetID(int battleType, int funcType, int presetID) |
| | | { |
| | | var pack = new CB262_tagCSFuncPresetSwitch(); |
| | | pack.FuncPresetType = (byte)funcType; |
| | | pack.PresetID = (byte)presetID; |
| | | pack.BatPresetID = (byte)battleType; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | public void SaveBattlePresetID(int battleType, int globalPresetID) |
| | | { |
| | | var pack = new CB263_tagCSBatPresetSwitch(); |
| | | pack.BatPresetID = (byte)globalPresetID; |
| | | pack.BatPresetType = (byte)battleType; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | //要显示的方案数量; 根据情况会包含未解锁 |
| | | //a. 按元宝解锁的为逐一开启,默认开启x个,第x+1个显示条件需要【流派预设】功能开启, 可解锁后逐一保留一个锁住的(直到全开启); |
| | | //b. 按功能条件开启的,如果默认只开其一个方案的情况不显示,达到下一个方案的条件满足后全显示;默认大于1个的情况直接全显示 |
| | | public int GetShowFuncPresetCount(int funcType) |
| | | { |
| | | var showCount = GetUnlockCnt(funcType); |
| | | var maxCount = PresetUnlockConfig.GetFuncPresetMaxCount(funcType); |
| | | var unlockType = PresetUnlockConfig.GetUnlockType((int)FuncPresetType.Mingge); |
| | | if (unlockType > 1) |
| | | { |
| | | //非元宝解锁 |
| | | //只有1个方案则不显示,大于1个则全显示 |
| | | return showCount == 1 ? 0 : maxCount; |
| | | } |
| | | if (!IsOpen()) |
| | | { |
| | | //未开启时,默认大于1则显示 |
| | | return showCount == 1 ? 0 : showCount; |
| | | } |
| | | |
| | | return showCount == maxCount ? showCount : showCount + 1; |
| | | } |
| | | |
| | | public int GetUnlockCnt(int funcType) |
| | | { |
| | | int count = 0; |
| | | if (m_FuncPresetDict.ContainsKey(funcType)) |
| | | { |
| | | for (int i = 0; i < m_FuncPresetDict[funcType].Count; i++) |
| | | { |
| | | if (m_FuncPresetDict[funcType][i + 1].unLock) |
| | | { |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | get |
| | | { |
| | | return itemHero.GetUseDataFirstValue(80) == 1; |
| | | return itemHero.GetUseDataFirstValue(83) != 0; |
| | | } |
| | | } |
| | | |
| | |
| | | //是否上任何阵容 |
| | | public bool IsInAnyTeam() |
| | | { |
| | | for (int i = 1; i < FuncPresetManager.Instance.teamPresetMaxID; i++) |
| | | var maxCnt = FuncPresetManager.Instance.GetUnlockCnt((int)FuncPresetType.Mingge); |
| | | for (int i = 1; i < maxCnt + 1; i++) |
| | | { |
| | | if (TeamManager.Instance.GetTeam(i).HasHeroInServer(itemHero.guid)) |
| | | { |
| | |
| | | //是否上任何阵容,且只有一只 |
| | | public bool IsInAnyTeamJustOne() |
| | | { |
| | | for (int i = 1; i < FuncPresetManager.Instance.teamPresetMaxID; i++) |
| | | var maxCnt = FuncPresetManager.Instance.GetUnlockCnt((int)FuncPresetType.Mingge); |
| | | for (int i = 1; i < maxCnt + 1; i++) |
| | | { |
| | | var team = TeamManager.Instance.GetTeam(i); |
| | | if (team.HasHeroInServer(itemHero.guid)) |
| | |
| | | //下阵所有阵容 |
| | | public void LeaveAllTeam() |
| | | { |
| | | for (int i = 1; i < FuncPresetManager.Instance.teamPresetMaxID; i++) |
| | | var maxCnt = FuncPresetManager.Instance.GetUnlockCnt((int)FuncPresetType.Mingge); |
| | | for (int i = 1; i < maxCnt + 1; i++) |
| | | { |
| | | int pos; |
| | | var team = TeamManager.Instance.GetTeam(i); |
| | |
| | | } |
| | | else if (funcID == 54) |
| | | { |
| | | UIManager.Instance.OpenWindow<GubaoBaseWin>(); |
| | | UIManager.Instance.OpenWindow<MinggeWin>(); |
| | | } |
| | | |
| | | |
| | |
| | | BoxChooseItem, //宝箱自选物品 |
| | | TreasurePavilion, //古宝物品(碎片) |
| | | Hero, //武将 |
| | | Mingge, //命格 |
| | | } |
| | | |
| | | public class TipData |
| | |
| | | mainTipData.guid = PackManager.Instance.GetItemGUIDByID(itemId, true, PackType.DropItem); |
| | | } |
| | | |
| | | // mainTipData = CreateNormalEquipData(itemId); |
| | | // if (item.isAuctionEquip && !item.legendProperty.Equals(default(LegendProperty))) |
| | | // { |
| | | // mainTipData.legendProperty = item.legendProperty; |
| | | // mainTipData.baseInfo.score = item.score; |
| | | // mainTipData.baseInfo.isPreview = false; |
| | | // } |
| | | |
| | | // if (item.compare) |
| | | // { |
| | | // if (ItemLogicUtility.Instance.IsJobCompatibleItem(itemId)) |
| | | // { |
| | | // var equipedGuid = equipModel.GetEquip(new Int2(config.LV, config.EquipPlace)); |
| | | // if (equipedGuid != string.Empty) |
| | | // { |
| | | // secondaryData = CreateNormalEquipData(equipedGuid, false); |
| | | // } |
| | | // } |
| | | // } |
| | | break; |
| | | |
| | | default: |
| | | mainTipData = CreateItemData(itemId); |
| | | break; |
| | |
| | | mainTipData = new TipData() { guid = guid }; |
| | | break; |
| | | default: |
| | | // if (item.isAuction) |
| | | // { |
| | | // mainTipData = CreateEquipAuctionData(guid, operatable); |
| | | |
| | | // if (ItemLogicUtility.Instance.IsJobCompatibleItem(item.itemId)) |
| | | // { |
| | | // var equipedGuid = equipModel.GetEquip(new Int2(item.config.LV, item.config.EquipPlace)); |
| | | // if (equipedGuid != string.Empty) |
| | | // { |
| | | // secondaryData = CreateNormalEquipData(equipedGuid, false); |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // mainTipData = CreateNormalEquipData(guid, operatable); |
| | | // var equipedGuid = equipModel.GetEquip(new Int2(item.config.LV, item.config.EquipPlace)); |
| | | // if (equipedGuid != guid) |
| | | // { |
| | | // secondaryData = CreateNormalEquipData(equipedGuid, false); |
| | | // } |
| | | // } |
| | | break; |
| | | } |
| | | break; |
| | | |
| | | case TipType.Mingge: |
| | | mainTipData = new TipData() { guid = guid }; |
| | | break; |
| | | default: |
| | | mainTipData = CreateItemData(guid, operatable); |
| | | break; |
| | |
| | | case TipType.BoxChooseItem: |
| | | UIManager.Instance.OpenWindow<ChooseItemsWin>(); |
| | | break; |
| | | // case TipType.TreasurePavilion: |
| | | // TreasurePavilionModel.Instance.selectGubao = item.config.EffectValueA1; |
| | | // TreasurePavilionModel.Instance.showTipFromPiece = item.itemId; |
| | | // WindowCenter.Instance.OpenIL<TreasurePavilionTipWin>(); |
| | | // break; |
| | | case TipType.Mingge: |
| | | // UIManager.Instance.OpenWindow<MinggeWin>(); |
| | | break; |
| | | default: |
| | | UIManager.Instance.OpenWindow<ItemTipWin>(); |
| | | break; |
| | |
| | | return TipType.TreasurePavilion; |
| | | case 150: |
| | | return TipType.Hero; |
| | | case 201: |
| | | case 202: |
| | | case 203: |
| | | case 204: |
| | | case 205: |
| | | case 206: |
| | | case 207: |
| | | case 208: |
| | | case 209: |
| | | case 210: |
| | | case 211: |
| | | case 212: |
| | | return TipType.Mingge; |
| | | default: |
| | | return TipType.Item; |
| | | } |
| | |
| | | int teamTypeCalc = 1; //不同阵容战力不同 |
| | | bool isPreviewTeamPower; //预览阵容(队伍)战力 |
| | | int dropIndexCalc = -1; //掉落装备在阵容的索引,用于预览战力对比 |
| | | int minggePresetID; //命格预设ID |
| | | int minggeDropIndex; //掉落命格在背包的索引 ,用于预览战力对比 |
| | | |
| | | //计算阵容战力,装备对比等情况需要代入 |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="teamType">阵容类型</param> |
| | | /// <param name="teamType">阵容类型:方案ID下的队伍</param> |
| | | /// <param name="dropindex">掉落装备的索引,-1代表不替换计算</param> |
| | | /// <param name="ispreview">预览阵容战力</param> |
| | | public void InitFightPowerParam(int teamType = 1, int dropindex = -1, bool ispreview = false) |
| | | public void InitFightPowerParam(int teamType = 0, int dropindex = -1, bool ispreview = false, |
| | | int _minggePresetID = 0, int _minggeDropIndex = -1) |
| | | { |
| | | #if !UNITY_EDITOR |
| | | openLog = false; |
| | | #endif |
| | | if (teamType == 0) |
| | | { |
| | | // 没有设置默认使用主阵容 |
| | | teamType = TeamManager.Instance.GetMainTeamID(); |
| | | } |
| | | if (_minggePresetID == 0) |
| | | { |
| | | // 没有设置默认当前流派下命格方案 |
| | | _minggePresetID = FuncPresetManager.Instance.GetFuncPresetID((int)FuncPresetType.Mingge); |
| | | } |
| | | teamTypeCalc = teamType; |
| | | minggePresetID = _minggePresetID; |
| | | isPreviewTeamPower = ispreview; |
| | | |
| | | dropIndexCalc = dropindex; |
| | | minggeDropIndex = _minggeDropIndex; |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:初始化参数 dropIndex:" + dropIndexCalc + " 阵型:" + teamTypeCalc + " ispreview:" + ispreview); |
| | | #endif |
| | |
| | | public Dictionary<int, int> equipAttrs = new Dictionary<int, int>(); //装备属性 |
| | | // public Dictionary<string, int> lineUpPerDict = new Dictionary<string, int>(); //阵容属性加成 |
| | | public Dictionary<int, int> countryAttrs = new Dictionary<int, int>(); //阵容国家(光环)属性 |
| | | public Dictionary<int, int> minggeAttrs = new Dictionary<int, int>(); //命格属性 技能战力为固定的只算个数区别即可 |
| | | |
| | | float allHeroAddPer = 0; //所有武将加成 |
| | | |
| | |
| | | void RefrehEquipAttrs() |
| | | { |
| | | equipAttrs.Clear(); //身上装备属性重置 |
| | | ItemModel dropEquip = null; |
| | | if (dropIndexCalc != -1) |
| | | { |
| | | dropEquip = PackManager.Instance.GetItemByIndex(PackType.DropItem, dropIndexCalc); |
| | | } |
| | | |
| | | for (int i = 0; i < EquipModel.TotleEquip; i++) |
| | | { |
| | | var equip = EquipModel.Instance.GetEquip(i); |
| | | if (dropIndexCalc != -1) |
| | | { |
| | | var dropEquip = PackManager.Instance.GetItemByIndex(PackType.DropItem, dropIndexCalc); |
| | | if (dropEquip.config.EquipPlace - 1 == i) |
| | | if (dropEquip != null && dropEquip.config.EquipPlace - 1 == i) |
| | | { |
| | | equip = dropEquip; //替换计算总战力 |
| | | } |
| | |
| | | #endif |
| | | } |
| | | |
| | | //类似装备需要实时替换对比;功能处查看重算一次显示 |
| | | void RefrehMinggeAttrs() |
| | | { |
| | | minggeAttrs.Clear(); //身上命格属性重置 |
| | | ItemModel dropEquip = null; |
| | | int packIndex = -1; |
| | | if (minggeDropIndex != -1) |
| | | { |
| | | dropEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, minggeDropIndex); |
| | | packIndex = MinggeManager.Instance.GetPackIndex(minggePresetID, dropEquip.config.EquipPlace); |
| | | } |
| | | |
| | | var starIndex = (minggePresetID - 1) * MinggeManager.TotleEquip; |
| | | |
| | | for (int i = starIndex; i < starIndex + MinggeManager.TotleEquip; i++) |
| | | { |
| | | var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, i); |
| | | if (minggeDropIndex != -1) |
| | | { |
| | | if (dropEquip != null && packIndex == i) |
| | | { |
| | | equip = dropEquip; //替换计算总战力 |
| | | } |
| | | } |
| | | if (equip == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var fightIDAttrs = EquipModel.Instance.GetEquipFightAttrs(equip); |
| | | var fightValueAttrs = EquipModel.Instance.GetEquipFightValues(equip); |
| | | if (fightIDAttrs != null) |
| | | { |
| | | for (int j = 0; j < fightIDAttrs.Count; j++) |
| | | { |
| | | if (!minggeAttrs.ContainsKey(fightIDAttrs[j])) |
| | | { |
| | | minggeAttrs[fightIDAttrs[j]] = fightValueAttrs[j]; |
| | | } |
| | | else |
| | | { |
| | | minggeAttrs[fightIDAttrs[j]] += fightValueAttrs[j]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:命格属性 " + JsonMapper.ToJson(minggeAttrs)); |
| | | #endif |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | //单属性公式分基础三维和战斗属性 |
| | |
| | | public double GetPropertyVaule(int attrType, HeroInfo hero, int type) |
| | | { |
| | | // propertyVariables.Clear(); |
| | | |
| | | |
| | | propertyVariables[LV_VALUE] = lvAttrs.ContainsKey(attrType) ? lvAttrs[attrType] : 0; |
| | | propertyVariables[EQUIP_VALUE] = equipAttrs.ContainsKey(attrType) ? equipAttrs[attrType] : 0; |
| | | // propertyVariables[BOOK_VALUE] = 0; |
| | |
| | | propertyVariables[FATES_PER] = HeroFatesManager.Instance.GetAttrPer(attrType) / 10000.0f; |
| | | propertyVariables[DINGJUNGE_VALUE] = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | propertyVariables[DINGJUNGE_PER] = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | propertyVariables[MINGGE_VALUE] = 0; |
| | | propertyVariables[MINGGE_PER] = 0; |
| | | propertyVariables[MINGGE_VALUE] = minggeAttrs.ContainsKey(attrType) ? minggeAttrs[attrType] : 0; |
| | | propertyVariables[MINGGE_PER] = (minggeAttrs.ContainsKey(attrType) ? minggeAttrs[attrType] : 0) / 10000.0f; |
| | | |
| | | //全体卡牌加成 |
| | | propertyVariables[HERO_CARDPER] = allHeroAddPer; |
| | |
| | | RefreshLVAttrs(); |
| | | RefreshOfficialAttrs(); |
| | | RefrehEquipAttrs(); |
| | | RefrehMinggeAttrs(); |
| | | RefreshTeamAttrs(); |
| | | |
| | | // --- 算单武将功能属性战力 后相加--- |
| | |
| | | |
| | | } |
| | | |
| | | fightPower += GetMinggeSkillPower(); |
| | | // #if UNITY_EDITOR |
| | | FightPowerDebug("战力:计算完毕 " + fightPower); |
| | | FightPowerDebug("战力:计算完毕 " + fightPower); |
| | | // #endif |
| | | return fightPower; |
| | | } |
| | |
| | | return fightPower + skillPower; |
| | | } |
| | | |
| | | //命格技能战力:技能战力*个数;如果是替换的要判断是否技能个数变化 |
| | | long GetMinggeSkillPower() |
| | | { |
| | | //当前方案技能信息 |
| | | int _skillTypeID = 0; //取其中一个用于计算即可 |
| | | var count = MinggeManager.Instance.GetMinggeSkillCountByPresetID(minggePresetID, out _skillTypeID); |
| | | |
| | | ItemModel dropEquip = null; |
| | | if (minggeDropIndex != -1) |
| | | { |
| | | dropEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, minggeDropIndex); |
| | | //带技能的命格 需判断是否技能个数变化 |
| | | if (MinggeManager.Instance.minggeSkillEquipPlaceList.Contains(dropEquip.config.EquipPlace)) |
| | | { |
| | | var packIndex = MinggeManager.Instance.GetPackIndex(minggePresetID, minggeDropIndex); |
| | | //要对比的装备 |
| | | var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, packIndex); |
| | | if (equip == null) |
| | | { |
| | | count++; |
| | | if (_skillTypeID == 0) |
| | | { |
| | | _skillTypeID = EquipModel.Instance.GetEquipSkillID(dropEquip); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (_skillTypeID == 0) |
| | | return 0; |
| | | |
| | | |
| | | //加上技能战力 |
| | | fightPowerVariables.Clear(); |
| | | fightPowerVariables[PLAYER_LV] = PlayerDatas.Instance.baseData.LV; |
| | | fightPowerVariables[OFFICIAL_LV] = PlayerDatas.Instance.baseData.realmLevel; |
| | | fightPowerVariables[SKILL_POWER] = SkillConfig.Get(_skillTypeID).FightPower; |
| | | |
| | | long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables); |
| | | |
| | | return skillPower * count; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | InitFightPowerParam(); |
| | | var fightPower = CalculatePower(); |
| | | |
| | | |
| | | InitFightPowerParam(dropindex: item.gridIndex); |
| | | var tmpFightPower = CalculatePower(); |
| | | return tmpFightPower - fightPower; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 命格装备对比 |
| | | /// </summary> |
| | | /// minggePresetID 指要对比的哪套方案下的命格,玩家可以点击切换对比,自动默认会遍历所有激活方案 |
| | | public long GetFightPowerMinggeChange(ItemModel item, int minggePresetID) |
| | | { |
| | | InitFightPowerParam(_minggePresetID: minggePresetID); |
| | | var fightPower = CalculatePower(); |
| | | |
| | | InitFightPowerParam(_minggePresetID: minggePresetID, _minggeDropIndex: item.gridIndex); |
| | | var tmpFightPower = CalculatePower(); |
| | | return tmpFightPower - fightPower; |
| | | } |
| | | |
| | | |
| | | // 单英雄查看战力 |
| | | // 1. 上阵英雄显示,在主线阵容下的战力 |
| | |
| | | InitFightPowerParam(ispreview: ispreview); |
| | | RefreshLVAttrs(); |
| | | RefreshOfficialAttrs(); |
| | | RefrehMinggeAttrs(); |
| | | RefrehEquipAttrs(); |
| | | RefreshTeamAttrs(); |
| | | |
| | | var fightPower = CalculateTeamHeroPower(heroInfo); |
| | | |
| | | fightPower += GetMinggeSkillPower(); |
| | | |
| | | //计算完恢复队伍 |
| | | if (ispreview) |
| | | team.RestoreTeam(); |
| | |
| | | //查看阵容战力 |
| | | public long GetTeamFightPower(int team, bool isPreview) |
| | | { |
| | | InitFightPowerParam(team, -1, isPreview); |
| | | InitFightPowerParam(team, ispreview:isPreview); |
| | | return CalculatePower(); |
| | | } |
| | | #endregion |
| | |
| | | /// <param name="targetPosition">目的地坐标</param>
|
| | | /// <param name="moneyType">货币类型</param>
|
| | | /// <param name="num">掉几个货币</param>
|
| | | public void PlayAnimation(int moneyType, int num)
|
| | | /// <param name="type">1 货币 2 物品</param>
|
| | | public void PlayAnimation(int id, int num, int type = 1)
|
| | | {
|
| | | int createImgCnt = 0;
|
| | | if (imgMoneys.IsNullOrEmpty())
|
| | |
| | | //挂父节点
|
| | | imgMoney.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | var moneyImg = imgMoney.GetComponent<ImageEx>();
|
| | | moneyImg.SetIconWithMoneyType(moneyType);
|
| | | if (type == 1)
|
| | | moneyImg.SetIconWithMoneyType(id);
|
| | | else
|
| | | moneyImg.SetItemSprite(id);
|
| | | moneyImg.raycastTarget = false;
|
| | | moneyImg.GetComponent<RectTransform>().sizeDelta = IconSize;
|
| | | imgMoneys.Add(moneyImg);
|
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using DG.Tweening; |
| | | |
| | | |
| | | //实装的显示 |
| | | public class MinggeEquipCell : MonoBehaviour |
| | | { |
| | | [SerializeField] UIEffectPlayer loopEffect; |
| | |
| | | [SerializeField] Image skillImage; //只有带意象技能才显示 |
| | | [SerializeField] UIEffectPlayer activeEffect; |
| | | [SerializeField] Button button; |
| | | [SerializeField] Transform flyStartObj; |
| | | |
| | | [Header("命格装备位")] |
| | | public int equipIndex; |
| | | public int equipIndex; |
| | | |
| | | string lastGuid = "uninit"; |
| | | public void Display() |
| | | { |
| | | var packIndex = equipIndex - 1; //对应卦玉背包索引 = (套编号-1)*12+装备位-1 |
| | | var presetID = FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge); |
| | | var packIndex = MinggeManager.Instance.GetPackIndex(presetID, equipIndex);//对应卦玉背包索引 |
| | | var item = PackManager.Instance.GetItemByIndex(PackType.Mingge, packIndex); |
| | | if (item == null) |
| | | { |
| | | loopEffect?.Stop(); |
| | | posNameText.text = Language.Get($"MinggeGird{packIndex}"); |
| | | posNameText.text = Language.Get($"MinggeGird{equipIndex}"); |
| | | iconImage.SetActive(false); |
| | | button.RemoveAllListeners(); |
| | | lastGuid = ""; |
| | | return; |
| | | } |
| | | posNameText.text = ""; |
| | |
| | | if (packIndex <= 4 && skillImage != null) |
| | | { |
| | | skillImage.SetActive(true); |
| | | skillImage.SetSprite($"MinggeSkill_{itemID}"); |
| | | loopEffect.Play(); |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(item); |
| | | if (skillID != 0) |
| | | { |
| | | skillImage.SetSprite($"MinggeSkill_{skillID}"); |
| | | loopEffect.Play(); |
| | | } |
| | | else |
| | | { |
| | | skillImage.SetActive(false); |
| | | loopEffect.Stop(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | }); |
| | | |
| | | if (lastGuid == "uninit") |
| | | { |
| | | lastGuid = item.guid; |
| | | } |
| | | else if (lastGuid != item.guid) |
| | | { |
| | | lastGuid = item.guid; |
| | | PlayEffect(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public void PlayEffect() |
| | | { |
| | | activeEffect.Play(); |
| | | iconImage.transform.position = flyStartObj.position; |
| | | iconImage.transform.DOLocalMove(Vector3.zero, 0.2f).SetEase(Ease.InQuad).OnComplete(() => |
| | | { |
| | | activeEffect.Play(); |
| | | }); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | |
| | | |
| | | public class MinggeEquipChangeCell : MonoBehaviour |
| | | { |
| | | |
| | | [SerializeField] MinggeItemCell itemCell; |
| | | [SerializeField] Text itemName; |
| | | [SerializeField] OutlineEx itemNameOutline; |
| | | [SerializeField] GameObject presetGO; |
| | | [SerializeField] Text presetName; |
| | | [SerializeField] Image nameBG; |
| | | [SerializeField] Image bgFlower; //背景花纹变色 |
| | | [SerializeField] Text fightPowerNum; |
| | | [SerializeField] List<Text> fightAttrNames; |
| | | [SerializeField] List<Text> fightAttrValues; |
| | | [SerializeField] List<Image> fightAttrStates; |
| | | [SerializeField] Text skillDesc; |
| | | [SerializeField] GameObject decomposeObject; |
| | | [SerializeField] Toggle decomposeCheck; |
| | | [SerializeField] Button decomposeButton; |
| | | [SerializeField] Button exchangeButton; |
| | | [SerializeField] Button putonButton; |
| | | |
| | | [SerializeField] UIEffectPlayer uieffect; |
| | | |
| | | int cmpResult = 0; // 装备对比结果 0相同 1更强 2更弱 |
| | | bool isToggle = true; |
| | | int selectMinggePresetID = 0; |
| | | |
| | | void Start() |
| | | { |
| | | if (putonButton == null) |
| | | { |
| | | return; |
| | | } |
| | | putonButton.AddListener(() => |
| | | { |
| | | MinggeManager.Instance.SendChangeMingge(selectMinggePresetID, MinggeManager.Instance.selectFloorEquip.gridIndex, decomposeCheck.isOn); |
| | | }); |
| | | |
| | | exchangeButton.AddListener(ExchangeEquip); |
| | | decomposeButton.AddListener(DecomposeEquip); |
| | | |
| | | decomposeCheck.onValueChanged.RemoveAllListeners(); |
| | | decomposeCheck.onValueChanged.AddListener((bool isOn) => |
| | | { |
| | | isToggle = !isToggle; |
| | | }); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="equip">本件命格物品数据</param> |
| | | /// <param name="isNewEquip">是否新装备(即命格掉落背包里的装备)</param> |
| | | /// <param name="oldEquip">比对的装备</param> |
| | | /// <param name="selectPresetID">选中的方案对比</param> |
| | | public void Display(ItemModel equip, bool isNewEquip, ItemModel oldEquip, int selectPresetID) |
| | | { |
| | | selectMinggePresetID = selectPresetID; |
| | | if (oldEquip == null) |
| | | cmpResult = 1; |
| | | |
| | | itemCell.Display(equip.guid); |
| | | string qualityName = Language.Get("L1039", MGGuayuQualityConfig.Get(equip.config.ItemColor).ColorName); |
| | | itemName.text = UIHelper.AppendColor(equip.config.ItemColor, qualityName + equip.config.ItemName, true, 2); |
| | | itemNameOutline.OutlineColor = UIHelper.GetUIOutlineColor(equip.config.ItemColor); |
| | | nameBG.SetSprite("MinggeNameBG" + equip.config.ItemColor); |
| | | bgFlower.color = UIHelper.GetUIColor(equip.config.ItemColor + 1); |
| | | |
| | | var activePresetCnt = FuncPresetManager.Instance.GetUnlockCnt((int)FuncPresetType.Mingge); |
| | | if (!isNewEquip) |
| | | { |
| | | presetGO.SetActive(activePresetCnt > 1); |
| | | presetName.text = FuncPresetManager.Instance.GetFuncPreset((int)FuncPresetType.Mingge, MinggeManager.Instance.equipShowPresetID).PresetName; |
| | | } |
| | | else |
| | | { |
| | | if (oldEquip == null) |
| | | { |
| | | presetGO.SetActive(activePresetCnt > 1); |
| | | presetName.text = FuncPresetManager.Instance.GetFuncPreset((int)FuncPresetType.Mingge, MinggeManager.Instance.equipShowPresetID).PresetName; |
| | | } |
| | | else |
| | | { |
| | | presetGO.SetActive(false); |
| | | } |
| | | decomposeCheck.isOn = isToggle; |
| | | |
| | | if (oldEquip == null) |
| | | { |
| | | decomposeObject.SetActive(false); |
| | | decomposeButton.SetActive(false); |
| | | exchangeButton.SetActive(false); |
| | | putonButton.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | decomposeObject.SetActive(true); |
| | | decomposeButton.SetActive(true); |
| | | exchangeButton.SetActive(true); |
| | | putonButton.SetActive(false); |
| | | } |
| | | |
| | | |
| | | long showFightPower = FightPowerManager.Instance.GetFightPowerMinggeChange(MinggeManager.Instance.selectFloorEquip, selectPresetID); |
| | | |
| | | if (showFightPower < 0) |
| | | { |
| | | fightPowerNum.text = UIHelper.AppendColor(TextColType.Red, $"-{UIHelper.ReplaceLargeNum(Math.Abs(showFightPower))}", false); |
| | | cmpResult = 2; |
| | | } |
| | | else |
| | | { |
| | | cmpResult = showFightPower > 0 ? 1 : 0; |
| | | fightPowerNum.text = UIHelper.AppendColor(TextColType.Green, $"+{UIHelper.ReplaceLargeNum(showFightPower)}", false); |
| | | |
| | | } |
| | | } |
| | | |
| | | var fightAttrs = EquipModel.Instance.GetEquipFightAttrs(equip); |
| | | var fightValues = EquipModel.Instance.GetEquipFightValues(equip); |
| | | |
| | | |
| | | for (var i = 0; i < fightAttrNames.Count; i++) |
| | | { |
| | | if (i >= fightAttrs.Count) |
| | | { |
| | | //显示锁住 |
| | | fightAttrNames[i].text = Language.Get("Mingge27", MinggeManager.Instance.unlockAttrLVList[i - 1] - 1); |
| | | fightAttrValues[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrNames[i].text = PlayerPropertyConfig.Get(fightAttrs[i]).Name; |
| | | fightAttrValues[i].SetActive(true); |
| | | fightAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(fightAttrs[i], fightValues[i]); |
| | | } |
| | | } |
| | | |
| | | ShowAttrState(isNewEquip); |
| | | RefreshEffect(equip); |
| | | |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(equip); |
| | | if (skillID == 0) |
| | | { |
| | | skillDesc.text = ""; |
| | | } |
| | | else |
| | | { |
| | | var dict = MinggeManager.Instance.GetMinggeSkillTypeIDDict(); |
| | | //如果是旧装备 显示当前数量;新装备不同技能数量+1,同技能不变 |
| | | var hasCnt = dict.ContainsKey(skillID) ? dict[skillID].Count : 0; |
| | | var oldSkillID = isNewEquip && oldEquip != null ? EquipModel.Instance.GetEquipSkillID(oldEquip) : 0; |
| | | var showCnt = isNewEquip ? (oldSkillID == skillID ? hasCnt : hasCnt + 1) : hasCnt; |
| | | skillDesc.text = SkillConfig.Get(skillID).Description + " " + Language.Get("HeroFates11", showCnt, MinggeManager.Instance.maxSuiteSkillCount); |
| | | } |
| | | } |
| | | |
| | | |
| | | void RefreshEffect(ItemModel equip) |
| | | { |
| | | int effectID = EquipModel.Instance.equipUIEffects[Math.Min(equip.config.ItemColor + 1, EquipModel.Instance.equipUIEffects.Length) - 1]; |
| | | if (effectID == 0) |
| | | { |
| | | uieffect.Stop(); |
| | | } |
| | | else |
| | | { |
| | | uieffect.Stop(); |
| | | uieffect.effectId = effectID; |
| | | uieffect.Play(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //替换装备 |
| | | void ExchangeEquip() |
| | | { |
| | | //穿更弱装备 要提示 |
| | | if (cmpResult == 2 && decomposeCheck.isOn) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("Mingge28"), (bool ok) => |
| | | { |
| | | if (ok) |
| | | { |
| | | MinggeManager.Instance.SendChangeMingge(selectMinggePresetID, MinggeManager.Instance.selectFloorEquip.gridIndex, decomposeCheck.isOn); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | MinggeManager.Instance.SendChangeMingge(selectMinggePresetID, MinggeManager.Instance.selectFloorEquip.gridIndex, decomposeCheck.isOn); |
| | | } |
| | | |
| | | } |
| | | |
| | | //分解装备 |
| | | void DecomposeEquip() |
| | | { |
| | | //分解更强装备要提示 |
| | | if (cmpResult == 1) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("Mingge29"), (bool ok) => |
| | | { |
| | | if (ok) |
| | | { |
| | | MinggeManager.Instance.SendDecompose(new byte[] { (byte)MinggeManager.Instance.selectFloorEquip.gridIndex }); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | MinggeManager.Instance.SendDecompose(new byte[] { (byte)MinggeManager.Instance.selectFloorEquip.gridIndex }); |
| | | } |
| | | } |
| | | |
| | | void ShowAttrState(bool isNewEquip) |
| | | { |
| | | ItemModel oldEquip = null; |
| | | |
| | | if (isNewEquip) |
| | | { |
| | | //找对比装备 |
| | | oldEquip = PackManager.Instance.GetItemByIndex(PackType.Mingge, MinggeManager.Instance.GetPackIndex(selectMinggePresetID, |
| | | MinggeManager.Instance.selectFloorEquip.config.EquipPlace)); |
| | | } |
| | | |
| | | if (oldEquip == null) |
| | | { |
| | | |
| | | for (int i = 0; i < fightAttrStates.Count; i++) |
| | | { |
| | | if (!isNewEquip) |
| | | { |
| | | //原装备不对比显示 |
| | | fightAttrStates[i].SetActive(false); |
| | | continue; |
| | | } |
| | | var list = EquipModel.Instance.GetEquipFightValues(MinggeManager.Instance.selectFloorEquip); |
| | | if (list == null || i >= list.Count) |
| | | { |
| | | fightAttrStates[i].SetOrgSprite("heroreborn_img_108", "Common"); |
| | | fightAttrStates[i].SetNativeSize(); |
| | | fightAttrStates[i].transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetSprite("GiftState2"); |
| | | fightAttrStates[i].SetNativeSize(); |
| | | |
| | | fightAttrStates[i].transform.localScale = Vector3.one; |
| | | } |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | for (int i = 0; i < fightAttrStates.Count; i++) |
| | | { |
| | | //战斗属性 排序和个数不一致 根据ID进行对比 |
| | | var list = EquipModel.Instance.GetEquipFightValues(MinggeManager.Instance.selectFloorEquip); |
| | | var list2 = EquipModel.Instance.GetEquipFightValues(oldEquip); |
| | | |
| | | var idList = EquipModel.Instance.GetEquipFightAttrs(MinggeManager.Instance.selectFloorEquip); |
| | | var idList2 = EquipModel.Instance.GetEquipFightAttrs(oldEquip); |
| | | |
| | | if (list == null || i >= list.Count) |
| | | { |
| | | fightAttrStates[i].SetOrgSprite("heroreborn_img_108", "Common"); |
| | | fightAttrStates[i].SetNativeSize(); |
| | | fightAttrStates[i].transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].transform.localScale = Vector3.one; |
| | | fightAttrStates[i].SetActive(true); |
| | | var value = !list2.IsNullOrEmpty() && i < list2.Count ? list2[i] : 0; |
| | | var id = !idList2.IsNullOrEmpty() && i < idList2.Count ? idList2[i] : 0; |
| | | if (idList[i] == id && list[i] == value) |
| | | { |
| | | fightAttrStates[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetActive(true); |
| | | if (idList[i] != id) |
| | | { |
| | | fightAttrStates[i].SetSprite("GiftState1"); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetSprite(list[i] > value ? "EquipUpIcon" : "EquipDownIcon"); |
| | | } |
| | | fightAttrStates[i].SetNativeSize(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
copy from Main/System/Mingge/MinggeCaseCell.cs.meta
copy to Main/System/Mingge/MinggeEquipChangeCell.cs.meta
| File was copied from Main/System/Mingge/MinggeCaseCell.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d82ac7d0e4493ee4fb4fe720c72564fb |
| | | guid: 12d21be6f160f244d9d97557fda832a8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class MinggeEquipWin : UIBase |
| | | { |
| | | [SerializeField] MinggeEquipChangeCell oldEquipCell; |
| | | [SerializeField] MinggeEquipChangeCell newEquipCell; |
| | | [SerializeField] Transform presetObj; |
| | | [SerializeField] GroupButtonEx[] presetBtns; |
| | | |
| | | int selectPresetID = 0; |
| | | int lastDropIndex = -1; |
| | | protected override void InitComponent() |
| | | { |
| | | for (int i = 0; i < presetBtns.Length; i++) |
| | | { |
| | | presetBtns[i].AddListener(() => |
| | | { |
| | | selectPresetID = i; |
| | | Display(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | selectPresetID = MinggeManager.Instance.equipShowPresetID; |
| | | lastDropIndex = MinggeManager.Instance.selectFloorEquip.gridIndex; |
| | | PackManager.Instance.RefreshItemEvent += RefreshItemEvent; |
| | | Display(); |
| | | |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | PackManager.Instance.RefreshItemEvent -= RefreshItemEvent; |
| | | } |
| | | |
| | | void RefreshItemEvent(PackType packType, int index, int itemID) |
| | | { |
| | | if (packType == PackType.Mingge) |
| | | { |
| | | MinggeManager.Instance.selectFloorEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, lastDropIndex); |
| | | Display(); |
| | | } |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | var cnt = FuncPresetManager.Instance.GetUnlockCnt((int)FuncPresetType.Mingge); |
| | | if (cnt == 1) |
| | | { |
| | | cnt = 0; |
| | | } |
| | | if (cnt > 0) |
| | | { |
| | | presetObj.SetActive(true); |
| | | for (int i = 0; i < presetBtns.Length; i++) |
| | | { |
| | | presetBtns[i].SetActive(i < cnt); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | presetObj.SetActive(false); |
| | | } |
| | | |
| | | var packIndex = MinggeManager.Instance.GetPackIndex(selectPresetID, MinggeManager.Instance.selectFloorEquip.config.EquipPlace); |
| | | var oldEquip = PackManager.Instance.GetItemByIndex(PackType.Mingge, packIndex); |
| | | if (oldEquip == null) |
| | | { |
| | | oldEquipCell.SetActive(false); |
| | | newEquipCell.SetActive(true); |
| | | newEquipCell.Display(MinggeManager.Instance.selectFloorEquip, true, oldEquip, selectPresetID); |
| | | } |
| | | else |
| | | { |
| | | if (oldEquip.guid == MinggeManager.Instance.selectFloorEquip.guid) |
| | | { |
| | | Debug.LogError("Display: 新旧命格相同GUID 客户端主动删除背包物品索引=" + MinggeManager.Instance.selectFloorEquip.gridIndex); |
| | | PackManager.Instance.GetSinglePack(PackType.MinggeDrop).RemoveItem(MinggeManager.Instance.selectFloorEquip.gridIndex); |
| | | CloseWindow(); |
| | | return; |
| | | } |
| | | oldEquipCell.SetActive(true); |
| | | newEquipCell.SetActive(true); |
| | | oldEquipCell.Display(oldEquip, false, null, selectPresetID); |
| | | newEquipCell.Display(MinggeManager.Instance.selectFloorEquip, true, oldEquip, selectPresetID); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
copy from Main/System/Mingge/MinggeCaseCell.cs.meta
copy to Main/System/Mingge/MinggeEquipWin.cs.meta
| File was copied from Main/System/Mingge/MinggeCaseCell.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d82ac7d0e4493ee4fb4fe720c72564fb |
| | | guid: 70c6870ff9894174fabb4d0d87940a3f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | | |
| | | //物品图标显示 |
| | | public class MinggeItemCell : MonoBehaviour |
| | | { |
| | | |
| | | |
| | | public void Display(int index) |
| | | [SerializeField] UIEffectPlayer loopEffect; //基础品质特效 |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] Image iconImage; |
| | | [SerializeField] Image skillImage; //只有带意象技能才显示 |
| | | [SerializeField] Image bgIcon; |
| | | public void Display(string guid) |
| | | { |
| | | |
| | | var item = PackManager.Instance.GetItemByGuid(guid); |
| | | if (item == null) |
| | | { |
| | | return; |
| | | } |
| | | int itemID = item.config.ID; |
| | | iconImage.SetItemSprite(itemID); |
| | | |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(item); |
| | | if (skillID != 0) |
| | | { |
| | | skillImage.SetActive(true); |
| | | skillImage.SetSprite($"MinggeSkill_{skillID}"); |
| | | } |
| | | else |
| | | { |
| | | skillImage.SetActive(false); |
| | | } |
| | | var lv = EquipModel.Instance.GetEquipLV(item); |
| | | |
| | | lvText.text = lv == 0 ? "" : Language.Get("L1113", lv); |
| | | DisPlayEffect(item.config); |
| | | |
| | | bgIcon.SetSprite("equipQuality" + (item.config.ItemColor + 1)); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | void DisPlayEffect(ItemConfig config) |
| | | { |
| | | |
| | | if (config.ItemColor >= 6) |
| | | { |
| | | loopEffect.effectId = 1026; |
| | | |
| | | loopEffect.PlayByArrIndex(config.ItemColor - 6, true, true); |
| | | } |
| | | else |
| | | { |
| | | loopEffect.Stop(); |
| | | } |
| | | //特效参考尺寸106*150 同比例缩放 |
| | | loopEffect.transform.localScale = new Vector3(1, 0.76f, 1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public class MinggeManager : GameSystemManager<MinggeManager> |
| | | { |
| | | public int m_GanwuLV; //感悟等级,从1开始 |
| | | public int m_GanwuExp; //当前感悟等级经验,每级从0开始 |
| | | public int m_Lingying; //当前灵应值 |
| | | public event Action OnMinggeInfoUpdate; |
| | | |
| | | public int equipShowPresetID; // 显示装备时,当前的子方案ID |
| | | public ItemModel selectFloorEquip; |
| | | |
| | | bool waitTYOPPack; |
| | | public event Action<int> OnOPCallbackEvent; |
| | | |
| | | public Dictionary<int, long> minggeAttrDict = new Dictionary<int, long>(); |
| | | |
| | | |
| | | //自动设置 |
| | | public int autoCostCnt; //自动推演消耗个数 |
| | | public bool isOpenAuto; |
| | | |
| | | |
| | | |
| | | //配置 |
| | | public const int TotleEquip = 12; //一套装备的总数 |
| | | public int[] unlockAttrLVList; //解锁属性所需命格物品等级列表 |
| | | public int tyItemID; //推演物品ID |
| | | public int qlItemID; //祈灵物品ID |
| | | public int[] minggeItemTypeList; //可携带意象的卦玉类型列表 |
| | | public List<int> minggeSkillEquipPlaceList = new List<int>(); //可携带意象的卦玉类型的装备位置 |
| | | public int maxSuiteSkillCount; |
| | | public int[] minggeSkillTypeIDList; //意向效果技能TypeID列表 |
| | | public int deitemID; //卦玉分解的物品ID |
| | | |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | | PackManager.Instance.RefreshItemEvent += RefreshItemEvent; |
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnEquipResult; |
| | | ParseConfig(); |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; |
| | | PackManager.Instance.RefreshItemEvent -= RefreshItemEvent; |
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnEquipResult; |
| | | } |
| | | |
| | | |
| | | void ParseConfig() |
| | | { |
| | | var config = FuncConfigConfig.Get("MinggeCfg"); |
| | | unlockAttrLVList = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | tyItemID = int.Parse(config.Numerical2); |
| | | qlItemID = int.Parse(config.Numerical3); |
| | | |
| | | config = FuncConfigConfig.Get("MinggeTY"); |
| | | deitemID = ConfigParse.GetMultipleStr<int>(config.Numerical1)[0]; |
| | | minggeItemTypeList = JsonMapper.ToObject<int[]>(config.Numerical4); |
| | | minggeSkillTypeIDList = JsonMapper.ToObject<int[]>(config.Numerical5); |
| | | |
| | | for (int i = 0; i < minggeItemTypeList.Length; i++) |
| | | { |
| | | minggeSkillEquipPlaceList.Add(MGGuayuTypeConfig.Get(minggeItemTypeList[i]).EquipPlace); |
| | | } |
| | | maxSuiteSkillCount = minggeSkillEquipPlaceList.Count; |
| | | |
| | | } |
| | | |
| | | private void OnBeforePlayerDataInitialize() |
| | | { |
| | | m_GanwuLV = 1; |
| | | m_GanwuExp = 0; |
| | | m_Lingying = 0; |
| | | waitTYOPPack = false; |
| | | } |
| | | private void OnEquipResult(HA814_tagMCMakeItemAnswer info) |
| | | { |
| | | if (info.MakeType != (int)MakeType.MinggeTY) |
| | | return; |
| | | |
| | | OnOPCallbackEvent?.Invoke(0); |
| | | |
| | | } |
| | | |
| | | void RefreshItemEvent(PackType type, int index, int itemID) |
| | | { |
| | | if (type == PackType.MinggeDrop) |
| | | { |
| | | waitTYOPPack = false; |
| | | CalcEquip(); |
| | | } |
| | | } |
| | | |
| | | //处理未处理的命格 |
| | | public bool CalcEquip() |
| | | { |
| | | var items = PackManager.Instance.GetItems(PackType.MinggeDrop); |
| | | if (items.IsNullOrEmpty()) |
| | | { |
| | | if (UIManager.Instance.IsOpened<MinggeEquipWin>()) |
| | | { |
| | | UIManager.Instance.CloseWindow<MinggeEquipWin>(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | foreach (var item in items) |
| | | { |
| | | if (OpenMinggeEquipWin(item)) |
| | | { |
| | | //需要玩家处理的时候退出 |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public void UpdateMinggeInfo(HB132_tagSCMinggeInfo netPack) |
| | | { |
| | | m_GanwuLV = netPack.GanwuLV; |
| | | m_GanwuExp = (int)netPack.GanwuExp; |
| | | m_Lingying = (int)netPack.Lingying; |
| | | |
| | | OnMinggeInfoUpdate?.Invoke(); |
| | | } |
| | | |
| | | |
| | | //意向技能ID:【guid..】 |
| | | public Dictionary<int, List<string>> GetMinggeSkillTypeIDDict() |
| | | { |
| | | var presetID = FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge); |
| | | var startIndex = (presetID - 1) * TotleEquip;//对应卦玉背包索引 = (套编号-1)*12+装备位-1 |
| | | |
| | | var dict = new Dictionary<int, List<string>>(); |
| | | for (int i = 0; i < minggeSkillEquipPlaceList.Count; i++) |
| | | { |
| | | var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, startIndex + minggeSkillEquipPlaceList[i] - 1); |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(equip); |
| | | if (skillID == 0) continue; |
| | | if (dict.ContainsKey(skillID)) |
| | | { |
| | | dict[skillID].Add(equip.guid); |
| | | } |
| | | else |
| | | { |
| | | dict[skillID] = new List<string>() { equip.guid }; |
| | | } |
| | | } |
| | | return dict; |
| | | } |
| | | |
| | | //获得命格技能个数,返回个数和技能ID,不管什么技能战力都是一样的 |
| | | public int GetMinggeSkillCountByPresetID(int presetID, out int _skillTypeID) |
| | | { |
| | | _skillTypeID = 0; |
| | | var startIndex = (presetID - 1) * TotleEquip;//对应卦玉背包索引 = (套编号-1)*12+装备位-1 |
| | | |
| | | int count = 0; |
| | | for (int i = 0; i < minggeSkillEquipPlaceList.Count; i++) |
| | | { |
| | | var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, startIndex + minggeSkillEquipPlaceList[i] - 1); |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(equip); |
| | | if (skillID == 0) |
| | | continue; |
| | | |
| | | count++; |
| | | _skillTypeID = skillID; |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public bool OpenMinggeEquipWin(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (UIManager.Instance.IsOpened<MinggeEquipWin>()) |
| | | { |
| | | return false; |
| | | } |
| | | //自动处理: 判断分解 和战力高低 和决定是哪个方案下的装备对比 |
| | | |
| | | |
| | | //非自动情况下,默认当前方案 |
| | | equipShowPresetID = FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge); |
| | | selectFloorEquip = equip; |
| | | if (UIManager.Instance.IsOpened<MinggeWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<MinggeEquipWin>(); |
| | | } |
| | | return true; |
| | | |
| | | } |
| | | |
| | | public int GetPackIndex(int presetID, int equipPlace) |
| | | { |
| | | return (presetID - 1) * TotleEquip + equipPlace - 1;//对应卦玉背包索引 = (套编号-1)*12+装备位-1 |
| | | } |
| | | |
| | | public void SendTY(int count) |
| | | { |
| | | |
| | | if (CalcEquip()) |
| | | { |
| | | return; |
| | | } |
| | | if (waitTYOPPack) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (!ItemLogicUtility.CheckItemCount(PackType.Item, tyItemID, count, 2)) |
| | | { |
| | | return; |
| | | } |
| | | waitTYOPPack = true; |
| | | |
| | | var pack = new CB250_tagCSMinggeTuiyan(); |
| | | pack.Count = (byte)count; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | public void SendChangeMingge(int selectMinggePresetID, int dropIndex, bool autodec) |
| | | { |
| | | var pack = new CB252_tagCSMinggeEquip(); |
| | | pack.MGNum = (byte)selectMinggePresetID; |
| | | pack.Index = (byte)dropIndex; |
| | | pack.AutoDec = (byte)(autodec ? 1 : 0); |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | public void SendDecompose(byte[] itemIndexList) |
| | | { |
| | | var pack = new CB251_tagCSMinggeDecompose(); |
| | | pack.IndexList = itemIndexList; |
| | | pack.Count = (byte)itemIndexList.Length; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | |
| | | public void RefrehMinggeAttrs() |
| | | { |
| | | minggeAttrDict.Clear(); //身上命格属性重置 |
| | | |
| | | var minggePresetID = FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge); |
| | | var starIndex = (minggePresetID - 1) * TotleEquip; |
| | | |
| | | for (int i = starIndex; i < starIndex + TotleEquip; i++) |
| | | { |
| | | var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, i); |
| | | if (equip == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var fightIDAttrs = EquipModel.Instance.GetEquipFightAttrs(equip); |
| | | var fightValueAttrs = EquipModel.Instance.GetEquipFightValues(equip); |
| | | if (fightIDAttrs != null) |
| | | { |
| | | for (int j = 0; j < fightIDAttrs.Count; j++) |
| | | { |
| | | if (!minggeAttrDict.ContainsKey(fightIDAttrs[j])) |
| | | { |
| | | minggeAttrDict[fightIDAttrs[j]] = fightValueAttrs[j]; |
| | | } |
| | | else |
| | | { |
| | | minggeAttrDict[fightIDAttrs[j]] += fightValueAttrs[j]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #region 红点 |
| | | Redpoint tmpRP = new Redpoint(MainRedDot.MainAffairsRedpoint, MainRedDot.RedPoint_Mingge); |
| | | Redpoint redpointMG = new Redpoint(MainRedDot.RedPoint_Mingge, MainRedDot.RedPoint_Mingge * 10 + 1); |
| | | Redpoint redpointPray = new Redpoint(MainRedDot.RedPoint_Mingge, MainRedDot.RedPoint_Mingge * 10 + 2); |
| | | |
| | | #endregion |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class MinggeWin : UIBase |
| | | { |
| | | [SerializeField] Button seeAttrBtn; |
| | | [SerializeField] MinggeEquipCell[] equipCells; |
| | | [SerializeField] MinggeCaseCell[] caseCells; |
| | | [SerializeField] UIEffectPlayer tyEffect; //推演特效 |
| | | [SerializeField] Image dropIcon; |
| | | [SerializeField] Image dropSkillIcon; |
| | | [SerializeField] MoneyMoveByPath moneyMoveByPathCell; //掉落物金钱 |
| | | [SerializeField] Transform caseesObj; |
| | | [SerializeField] Text rankLevelText; |
| | | |
| | | [SerializeField] Text processExpText; |
| | | [SerializeField] Image processImg; |
| | | [SerializeField] UIEffectPlayer processEffect; |
| | | [SerializeField] UIEffectPlayer lvUpEffect; |
| | | [SerializeField] Text[] suiteNameTexts; //带按钮 |
| | | [SerializeField] Text[] baseAttrTexts; |
| | | [SerializeField] Text[] fightAttrTexts; |
| | | |
| | | [SerializeField] Button autoBtn; |
| | | [SerializeField] UIEffectPlayer autoEffect; //开 |
| | | [SerializeField] Image autoImg; //关 |
| | | [SerializeField] Button prayBtn; |
| | | [SerializeField] Button tyBtn; |
| | | [SerializeField] Image tyItemImg; |
| | | [SerializeField] Text tyItemCntText; |
| | | |
| | | |
| | | int lastLV = 0; |
| | | int lastExp = 0; |
| | | protected override void InitComponent() |
| | | { |
| | | |
| | | var presetObj = UIUtility.CreateWidget("FuncPresetChooseCells", "FuncPresetChooseCells"); |
| | | presetObj.transform.SetParentEx(caseesObj, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | seeAttrBtn.AddListener(() => |
| | | { |
| | | AttributeManager.Instance.OpenTotalAttributeWin(MinggeManager.Instance.minggeAttrDict); |
| | | }); |
| | | tyBtn.AddListener(SendTuiyan); |
| | | for (int i = 0; i < suiteNameTexts.Length; i++) |
| | | { |
| | | int index = i; |
| | | suiteNameTexts[i].GetComponent<Button>().AddListener(() => |
| | | { |
| | | ClickSuite(index); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | |
| | | MinggeManager.Instance.RefrehMinggeAttrs(); |
| | | PackManager.Instance.RefreshItemEvent += RefreshItemEvent; |
| | | PackManager.Instance.DeleteItemEvent += DeleteDropItem; |
| | | MinggeManager.Instance.OnMinggeInfoUpdate += OnMinggeInfoUpdate; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | lastLV = MinggeManager.Instance.m_GanwuLV; |
| | | lastExp = MinggeManager.Instance.m_GanwuExp; |
| | | Display(); |
| | | |
| | | |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | PackManager.Instance.RefreshItemEvent -= RefreshItemEvent; |
| | | PackManager.Instance.DeleteItemEvent -= DeleteDropItem; |
| | | MinggeManager.Instance.OnMinggeInfoUpdate -= OnMinggeInfoUpdate; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | } |
| | | |
| | | void OnCloseWindow(UIBase win) |
| | | { |
| | | if (win is MinggeEquipWin) |
| | | { |
| | | if (MinggeManager.Instance.m_GanwuExp == 0) |
| | | { |
| | | lvUpEffect.Play(); |
| | | } |
| | | processEffect.Play(); |
| | | } |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | DisplayMGGanwu(); |
| | | DisplaySlotEquip(); |
| | | DisplayDrop(); |
| | | |
| | | DisplayCostItem(); |
| | | moneyMoveByPathCell.SetActive(false); |
| | | } |
| | | void RefreshItemEvent(PackType type, int index, int itemID) |
| | | { |
| | | if (type == PackType.Mingge) |
| | | { |
| | | DisplaySlotEquip(); |
| | | } |
| | | else if (type == PackType.MinggeDrop) |
| | | { |
| | | DisplayDrop(); |
| | | } |
| | | else if (type == PackType.Item) |
| | | { |
| | | if (itemID == MinggeManager.Instance.tyItemID) |
| | | { |
| | | DisplayCostItem(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void DisplayCostItem() |
| | | { |
| | | tyItemImg.SetItemSprite(MinggeManager.Instance.tyItemID); |
| | | tyItemCntText.text = UIHelper.ShowUseItem(PackType.Item, MinggeManager.Instance.tyItemID, 1); |
| | | } |
| | | |
| | | void DisplaySlotEquip() |
| | | { |
| | | for (int i = 0; i < equipCells.Length; i++) |
| | | { |
| | | equipCells[i].Display(); |
| | | } |
| | | DisplaySuite(); |
| | | DisplayAttr(); |
| | | } |
| | | |
| | | void DisplayAttr() |
| | | { |
| | | var attrIDList = PlayerPropertyConfig.playerPropertyDict[PlayerPropertyConfig.baseType]; |
| | | string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}", false); |
| | | for (int i = 0; i < baseAttrTexts.Length; i++) |
| | | { |
| | | var value = MinggeManager.Instance.minggeAttrDict.ContainsKey(attrIDList[i]) ? MinggeManager.Instance.minggeAttrDict[attrIDList[i]] : 0; |
| | | baseAttrTexts[i].text = PlayerPropertyConfig.GetFullDescription(attrIDList[i], value, format); |
| | | } |
| | | |
| | | List<int> attrIDList1 = new List<int>(); |
| | | attrIDList1.AddRange(PlayerPropertyConfig.playerPropertyDict[PlayerPropertyConfig.fightType]); |
| | | attrIDList1.AddRange(PlayerPropertyConfig.playerPropertyDict[PlayerPropertyConfig.fightAntiType]); |
| | | for (int i = 0; i < fightAttrTexts.Length; i++) |
| | | { |
| | | var value = MinggeManager.Instance.minggeAttrDict.ContainsKey(attrIDList1[i]) ? MinggeManager.Instance.minggeAttrDict[attrIDList1[i]] : 0; |
| | | fightAttrTexts[i].text = PlayerPropertyConfig.GetFullDescription(attrIDList1[i], value, format); |
| | | } |
| | | } |
| | | |
| | | void DisplayDrop() |
| | | { |
| | | //找到第一件显示 |
| | | var dropItems = PackManager.Instance.GetItems(PackType.MinggeDrop); |
| | | if (dropItems.IsNullOrEmpty()) |
| | | { |
| | | dropIcon.SetActive(false); |
| | | // moneyMoveByPathCell.SetActive(false); |
| | | return; |
| | | } |
| | | dropIcon.SetActive(true); |
| | | dropIcon.SetOrgSprite(dropItems[0].config.IconKey, "Icon"); |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(dropItems[0]); |
| | | if (skillID == 0) |
| | | { |
| | | dropSkillIcon.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | dropSkillIcon.SetActive(true); |
| | | dropSkillIcon.SetSprite($"MinggeSkill_{skillID}"); |
| | | } |
| | | } |
| | | |
| | | void DeleteDropItem(PackType packType, string guid, int itemID, int index, int clearType) |
| | | { |
| | | if (packType != PackType.MinggeDrop) |
| | | return; |
| | | |
| | | dropIcon.SetActive(false); |
| | | moneyMoveByPathCell.SetActive(true); |
| | | moneyMoveByPathCell.PlayAnimation(MinggeManager.Instance.deitemID, 8, 2); |
| | | } |
| | | |
| | | void SendTuiyan() |
| | | { |
| | | MinggeManager.Instance.SendTY(1); |
| | | tyEffect.Play(); |
| | | } |
| | | |
| | | |
| | | void OnMinggeInfoUpdate() |
| | | { |
| | | DisplayMGGanwu(); |
| | | } |
| | | |
| | | void DisplayMGGanwu() |
| | | { |
| | | var config = MGGanwuLVConfig.Get(MinggeManager.Instance.m_GanwuLV); |
| | | rankLevelText.text = Language.Get("Mingge26", UIHelper.ChineseNumber(MinggeManager.Instance.m_GanwuLV)); |
| | | processExpText.text = $"{MinggeManager.Instance.m_GanwuExp}/{config.NextNeedExp}"; |
| | | processImg.fillAmount = MinggeManager.Instance.m_GanwuExp / (float)config.NextNeedExp; |
| | | |
| | | if (lastLV != MinggeManager.Instance.m_GanwuLV) |
| | | { |
| | | lastLV = MinggeManager.Instance.m_GanwuLV; |
| | | lvUpEffect.Play(); |
| | | } |
| | | |
| | | if (lastExp != MinggeManager.Instance.m_GanwuExp) |
| | | { |
| | | lastExp = MinggeManager.Instance.m_GanwuExp; |
| | | processEffect.Play(); |
| | | } |
| | | } |
| | | |
| | | void DisplaySuite() |
| | | { |
| | | var dict = MinggeManager.Instance.GetMinggeSkillTypeIDDict(); |
| | | var keys = dict.Keys.ToList(); |
| | | keys.Sort(); |
| | | for (int i = 0; i < suiteNameTexts.Length; i++) |
| | | { |
| | | if (i >= keys.Count) |
| | | { |
| | | suiteNameTexts[i].SetActive(false); |
| | | continue; |
| | | } |
| | | suiteNameTexts[i].SetActive(true); |
| | | suiteNameTexts[i].text = Language.Get($"MinggeSkillType_{keys[i]}") + $"({dict[keys[i]].Count})"; |
| | | } |
| | | } |
| | | |
| | | void ClickSuite(int index) |
| | | { |
| | | var dict = MinggeManager.Instance.GetMinggeSkillTypeIDDict(); |
| | | var keys = dict.Keys.ToList(); |
| | | keys.Sort(); |
| | | if (index >= keys.Count) |
| | | return; |
| | | |
| | | ItemTipUtility.Show(dict[keys[index]][0]); |
| | | } |
| | | } |
| | | |
| | |
| | | return teamDict.ContainsKey(teamType); |
| | | } |
| | | |
| | | //通过阵容方案ID获取阵容 |
| | | public TeamBase GetTeam(int teamType) |
| | | //通过阵容方案ID获取阵容 从1开始 |
| | | public TeamBase GetTeam(int presetID) |
| | | { |
| | | TeamBase team = null; |
| | | |
| | | if (!teamDict.TryGetValue(teamType, out team)) |
| | | if (!teamDict.TryGetValue(presetID, out team)) |
| | | { |
| | | team = new TeamBase(teamType); |
| | | team = new TeamBase(presetID); |
| | | // team.CreateDefault(HeroManager.Instance.GetPowerfulHeroList()); |
| | | teamDict.Add(teamType, team); |
| | | teamDict.Add(presetID, team); |
| | | } |
| | | |
| | | return team; |
| | |
| | | return FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Team); |
| | | } |
| | | |
| | | // 获取指定的方案ID |
| | | public int GetTeamID(int battleType) |
| | | { |
| | | return FuncPresetManager.Instance.GetFuncPresetID(battleType, (int)FuncPresetType.Team); |
| | |
| | | RuneCompound = 22,//符印合成 |
| | | GatherSoulCompound = 23,//聚魂合成 |
| | | GatherSoulDecompose = 24,//聚魂分解 |
| | | EquipOP, // 25 主界面装备分解/替换回复 对应 B4 15 主线掉落物品操作 #tagCSMainDropItemOP |
| | | EquipOP = 25, // 25 主界面装备分解/替换回复 对应 B4 15 主线掉落物品操作 #tagCSMainDropItemOP |
| | | MinggeTY = 26, |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | //物品 各功能品质 从精良1品质 对应 3开始 |
| | | /// <summary> |
| | | /// 颜色定义根据分组处理,如普通物品的颜色精良是1开始,树和装备也是粗糙1开始,需要调整匹配 |
| | | /// 颜色定义根据分组处理,如普通物品的颜色精良是1开始,树和装备也是粗糙1开始,命格是从颜色2开始需要调整匹配 |
| | | /// </summary> |
| | | /// <param name="itemColor"></param> |
| | | /// <param name="msg"></param> |
| | | /// <param name="bright"></param> |
| | | /// <param name="colorGroupType">0 通用功能品质分组精良到神话</param> |
| | | /// <param name="colorGroupType">0 通用功能品质分组精良到神话 1 祝福和装备用 2命格用</param> |
| | | /// <returns></returns> |
| | | public static string AppendColor(int itemColor, string msg, bool bright = true, int colorGroupType = 0) |
| | | { |
| | |
| | | { |
| | | itemColor = itemColor + 2; |
| | | } |
| | | else if (colorGroupType == 2) |
| | | { |
| | | itemColor = itemColor + 1; |
| | | } |
| | | |
| | | switch (itemColor) |
| | | { |