| | |
| | | slider.value -= 1; |
| | | }); |
| | | |
| | | maxBtn.AddListener(() => |
| | | maxBtn?.AddListener(() => |
| | | { |
| | | slider.value = slider.maxValue; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化 |
| | | /// </summary> |
| | | /// <param name="_OnChangeEvent">数量变化事件</param> |
| | | /// <param name="_maxCount">最大数量 可以设置最小1</param> |
| | | /// <param name="_count">初始显示数量</param> |
| | | public void Init(Action<int> _OnChangeEvent, int _maxCount, int _count = 1) |
| | | { |
| | | count = _count; |
| | | maxCount = _maxCount; |
| | | slider.value = count; |
| | | slider.minValue = 0; |
| | | slider.maxValue = _maxCount; |
| | | slider.value = count; |
| | | |
| | | Refresh(); |
| | | OnChangeEvent = _OnChangeEvent; |
| | |
| | | { |
| | | addBtn.interactable = false; |
| | | addBtn.SetColorful(null, false); |
| | | maxBtn.interactable = false; |
| | | maxBtn.SetColorful(null, false); |
| | | if (maxBtn != null) |
| | | { |
| | | maxBtn.interactable = false; |
| | | maxBtn.SetColorful(null, false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | addBtn.interactable = true; |
| | | addBtn.SetColorful(null, true); |
| | | maxBtn.interactable = true; |
| | | maxBtn.SetColorful(null, true); |
| | | if (maxBtn != null) |
| | | { |
| | | maxBtn.interactable = true; |
| | | maxBtn.SetColorful(null, true); |
| | | } |
| | | } |
| | | |
| | | if (count <= 1) |
| | |
| | | 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>(); |
| | | static Dictionary<int, int> m_UnLockTypeDict = new Dictionary<int, int>(); // 预设类型 解锁类型,暂约定只有1种 |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | if (!m_PresetUnlockDict.ContainsKey(PresetType)) |
| | |
| | | }); |
| | | } |
| | | |
| | | ForceRefreshLayout(); |
| | | ForceRefreshLayout().Forget(); |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | using System.Text; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class FuncPresetChangeNameWin : UIBase |
| | | { |
| | | [SerializeField] InputField nameText; |
| | | [SerializeField] Button confirmBtn; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | confirmBtn.AddListener(OnConfirm); |
| | | } |
| | | |
| | | void OnConfirm() |
| | | { |
| | | var len = (byte)Encoding.Default.GetBytes(nameText.text).Length; |
| | | |
| | | if (len > 12) |
| | | { |
| | | return; |
| | | } |
| | | var pack = new CB261_tagCSFuncPresetUpdName(); |
| | | pack.FuncPresetType = (byte)(functionOrder/100); |
| | | pack.PresetID = (byte)(functionOrder % 100); |
| | | pack.NameLen = len; |
| | | pack.PresetName = nameText.text; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | CloseWindow(); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ddcba8cfb66dcd146b86ec62bffcd50d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | [SerializeField] Image lockImg; |
| | | [SerializeField] Text numText; |
| | | [SerializeField] Image selectImg; |
| | | [SerializeField] Button unFoldBtn; //解锁或者展开 |
| | | [SerializeField] Button unFoldBtn; //解锁 或选中 |
| | | |
| | | [SerializeField] Text caseNameText; |
| | | [SerializeField] Button changeNameBtn; |
| | | [SerializeField] Text numUnFoldText; |
| | | [SerializeField] Button foldBtn; //折叠 |
| | | |
| | | [SerializeField] FuncPresetChooseCells pareant; |
| | | |
| | | |
| | | public void Display(int battleType, int funcType, int id, bool isUnFold) |
| | |
| | | |
| | | caseNameText.text = data.PresetName; |
| | | numUnFoldText.text = id.ToString(); |
| | | changeNameBtn.AddListener(ChangeName); |
| | | changeNameBtn.AddListener(()=>ChangeName(funcType, id)); |
| | | foldBtn.AddListener(()=>Fold(funcType, id)); |
| | | } |
| | | else |
| | |
| | | unFoldObj.SetActive(false); |
| | | foldObj.SetActive(true); |
| | | |
| | | unFoldBtn.AddListener(() => UnFold(funcType, id)); |
| | | unFoldBtn.AddListener(() => |
| | | { |
| | | if (id == selectID && pareant.unFoldID == 0) |
| | | { |
| | | //选中状态下点击折叠,则不折叠 |
| | | pareant.unFoldID = id; |
| | | } |
| | | if (pareant.unFoldID == id) |
| | | { |
| | | FuncPresetManager.Instance.OnSelectPresetEvent?.Invoke(funcType, id, true); |
| | | } |
| | | else |
| | | { |
| | | if (FuncPresetManager.Instance.ClickFuncPreset(battleType, funcType, id)) |
| | | { |
| | | pareant.unFoldID = id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | lockImg.SetActive(!data.unLock); |
| | | numText.text = id.ToString(); |
| | | numText.text = !data.unLock ? "" :id.ToString(); |
| | | selectImg.SetActive(selectID == id); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | void ChangeName() |
| | | void ChangeName(int funcType, int id) |
| | | { |
| | | // UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(); |
| | | UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(funcType*100 + id); |
| | | } |
| | | |
| | | void Fold(int funcType, int id) |
| | | { |
| | | pareant.unFoldID = 0; |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //方案预设: 多方案选择组件 |
| | | //控制显隐: 1.未开启时全不显示 |
| | | // 2.开启后显示已解锁 + 未解锁 3+0 |
| | | //a. 按元宝解锁的为逐一开启,默认开启x个,第x+1个显示条件需要【流派预设】功能开启, 可解锁后逐一保留一个锁住的(直到全开启); |
| | | //b. 按功能条件开启的,如果默认只开其一个方案的情况不显示,达到下一个方案的条件满足后全显示;默认大于1个的情况直接全显示 |
| | | //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; //强制展开,不能收缩 |
| | | [SerializeField] Button unFoldBtn; //展开更多 |
| | | //被选中的方案会显示在外层,如果不是第四个则第四个会显示在最上面 |
| | | [SerializeField] FuncPresetChooseMoreCell[] moreCells; |
| | | bool forceUnFold = false; //强制展开,不能收缩; 流派界面的需求 |
| | | [NonSerialized] public int unFoldID = 0; //当前展开的方案ID,在选中的情况下才生效 |
| | | int curBattleType; |
| | | |
| | | /// <summary> |
| | | /// 显示方案预设 |
| | | /// </summary> |
| | | /// <param name="battleType"></param> |
| | | /// <param name="funcType"></param> |
| | | /// <param name="battleType">主线战斗 其他防守</param> |
| | | /// <param name="funcType">功能类型</param> |
| | | /// <param name="unFoldID">展开的方案ID,默认0,不展开</param> |
| | | /// <param name="forceUnFold"> 强制展开,不能收缩</param> |
| | | public void Display(int battleType, int funcType, bool _forceUnFold = false) |
| | | { |
| | | forceUnFold = _forceUnFold; |
| | | var _unFoldState = forceUnFold ? true : isUnFold; |
| | | curBbattleType = battleType; |
| | | curBattleType = battleType; |
| | | |
| | | var selectID = FuncPresetManager.Instance.GetFuncPresetIDByBattleType(battleType, funcType); |
| | | var showCount = FuncPresetManager.Instance.GetShowFuncPresetCount(funcType); |
| | | unFoldBtn.SetActive(showCount > 4); |
| | | |
| | | for (int i = 0; i < cells.Length; i++) |
| | | { |
| | | if (i < 3) |
| | | if (i < showCount) |
| | | { |
| | | cells[i].Display(battleType, funcType, i + 1, _unFoldState); |
| | | cells[i].SetActive(true); |
| | | if (i < 3) |
| | | { |
| | | var _unFoldState = forceUnFold ? true : i + 1 == unFoldID; |
| | | cells[i].Display(battleType, funcType, i + 1, _unFoldState); |
| | | } |
| | | else |
| | | { |
| | | var _unFoldState = forceUnFold ? true : (selectID > 4 ? selectID : 4) == unFoldID; |
| | | //第四个动态变化 |
| | | cells[i].Display(battleType, funcType, selectID > 4 ? selectID : 4, _unFoldState); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //第四个动态变化 |
| | | cells[i].Display(battleType, funcType, selectID > 4 ? selectID : 4, _unFoldState); |
| | | cells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | var showMoreCount = showCount - 4; |
| | | for (int i = 0; i < showMoreCount; i++) |
| | | { |
| | | if (i < showMoreCount) |
| | | { |
| | | moreCells[i].SetActive(true); |
| | | var id = i + 5; |
| | | if (i == 0 && selectID > 4) |
| | | { |
| | | id = 4; |
| | | } |
| | | moreCells[i].Display(battleType, funcType, id); |
| | | } |
| | | else |
| | | { |
| | | moreCells[i].SetActive(false); |
| | | } |
| | | } |
| | | |
| | | UIUtility.ForceRefreshLayout(this.transform).Forget(); |
| | | } |
| | | |
| | | void OnEnable() |
| | | { |
| | | if (!forceUnFold) |
| | | { |
| | | FuncPresetManager.Instance.OnSelectPresetEvent += OnSelectPresetEvent; |
| | | } |
| | | FuncPresetManager.Instance.OnSelectPresetEvent += OnSelectPresetEvent; |
| | | } |
| | | |
| | | void OnDisable() |
| | | { |
| | | if (!forceUnFold) |
| | | { |
| | | isUnFold = false; |
| | | FuncPresetManager.Instance.OnSelectPresetEvent -= OnSelectPresetEvent; |
| | | } |
| | | unFoldID = 0; |
| | | FuncPresetManager.Instance.OnSelectPresetEvent -= OnSelectPresetEvent; |
| | | } |
| | | |
| | | void OnSelectPresetEvent(int funcType, int id, bool _isUnFold) |
| | | void OnSelectPresetEvent(int funcType, int id, bool isUnFold) |
| | | { |
| | | isUnFold = _isUnFold; |
| | | int index = id > 4 ? 3 : id - 1; |
| | | cells[index].Display(curBbattleType, funcType, id, isUnFold); |
| | | Display(curBattleType, funcType, forceUnFold); |
| | | } |
| | | } |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //方案预设 方案选择组件, 隐藏的方案 |
| | | public class FuncPresetChooseMoreCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Button lockBtn; |
| | | [SerializeField] Button changeNameBtn; |
| | | [SerializeField] Text caseNameText; |
| | | [SerializeField] Button chooseBtn; |
| | | |
| | | [SerializeField] Transform selectObj; //流派名才有选中,方案名选中后就显示在外层第四个 |
| | | [SerializeField] FuncPresetChooseCells pareant; |
| | | |
| | | |
| | | public void Display(int battleType, int funcType, int id) |
| | | { |
| | | var data = FuncPresetManager.Instance.GetFuncPreset(funcType, id); |
| | | if (data == null) |
| | | { |
| | | return; |
| | | } |
| | | var selectID = FuncPresetManager.Instance.GetFuncPresetIDByBattleType(battleType, funcType); |
| | | caseNameText.text = Language.Get("FuncPreset11", id, UIHelper.AppendColor(selectID == id ? TextColType.titleSelectColor : TextColType.titleUnSelectColor, data.PresetName)); |
| | | if (data.unLock) |
| | | { |
| | | lockBtn.SetActive(false); |
| | | changeNameBtn.SetActive(true); |
| | | changeNameBtn.AddListener(()=> |
| | | { |
| | | ChangeName(funcType, id); |
| | | }); |
| | | chooseBtn.AddListener(() => |
| | | { |
| | | if (pareant) |
| | | { |
| | | pareant.unFoldID = id; |
| | | } |
| | | FuncPresetManager.Instance.ClickFuncPreset(battleType, funcType, id); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | lockBtn.SetActive(true); |
| | | lockBtn.AddListener(() => FuncPresetManager.Instance.ClickFuncPreset(battleType, funcType, id)); |
| | | changeNameBtn.SetActive(false); |
| | | chooseBtn.RemoveAllListeners(); |
| | | } |
| | | selectObj?.SetActive(selectID == id); |
| | | |
| | | } |
| | | |
| | | |
| | | void ChangeName(int funcType, int id) |
| | | { |
| | | UIManager.Instance.OpenWindow<FuncPresetChangeNameWin>(funcType*100 + id); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9872e1f383702764ab1534fe3f862fe4 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | { |
| | | //预设方案:功能类型(含全局和子功能,配表)-子方案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>(); |
| | |
| | | } |
| | | m_FuncPresetDict[config.PresetType][config.PresetID] = new FuncPreset() |
| | | { |
| | | PresetID = config.PresetID, |
| | | unLock = config.UnlockType == 0, |
| | | PresetName = Language.Get("Mingge13") + config.PresetID, |
| | | PresetName = Language.Get("Mingge13", config.PresetID) |
| | | }; |
| | | } |
| | | } |
| | |
| | | { |
| | | var preset = funcPresetInfo.PresetList[j]; |
| | | //该功能预设解锁状态,按预设ID二进制位运算记录是否已解锁 |
| | | bool _unlock = (funcPresetInfo.UnlockState & (1 << preset.PresetID)) != 0; |
| | | 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, |
| | | unLock = _unlock, |
| | | PresetName = string.IsNullOrEmpty(preset.PresetName) ? Language.Get("Mingge13", preset.PresetID) : preset.PresetName, |
| | | }; |
| | | } |
| | | } |
| | | |
| | | OnFuncPresetInfoListChanged?.Invoke(); |
| | | OnFuncPresetUseDataEvent?.Invoke(); |
| | | } |
| | | |
| | | //每个全局方案的存储信息 |
| | |
| | | return 1; |
| | | } |
| | | |
| | | //获取子功能方案ID,如果取不到默认方案1; 默认取当前流派下的 |
| | | //获取当前流派下的子功能的方案ID,如果取不到默认方案1 |
| | | public int GetFuncPresetID(int funcType) |
| | | { |
| | | int globalPresetID = GetGlobalPresetID((int)BattlePreSetType.Story); |
| | |
| | | return 1; |
| | | } |
| | | |
| | | // |
| | | //指定预设信息 |
| | | public FuncPreset GetFuncPreset(int funcType, int presetID) |
| | | { |
| | | if (m_FuncPresetDict.ContainsKey(funcType) && m_FuncPresetDict[funcType].ContainsKey(presetID)) |
| | |
| | | // 这里虽然传的是 battleType,但是实际还是根据全局方案ID做对应修改;如果这个全局方案其他地方有使用也是同步变化 |
| | | public void SaveFuncPresetID(int battleType, int funcType, int presetID) |
| | | { |
| | | if (funcType == 1) |
| | | { |
| | | SaveBattlePresetID(battleType, presetID); |
| | | return; |
| | | } |
| | | var pack = new CB262_tagCSFuncPresetSwitch(); |
| | | pack.FuncPresetType = (byte)funcType; |
| | | pack.PresetID = (byte)presetID; |
| | |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | public void UnLockPreset(int funcType, int presetID) |
| | | { |
| | | var pack = new CB260_tagCSFuncPresetUnlock(); |
| | | pack.FuncPresetType = (byte)funcType; |
| | | pack.PresetID = (byte)presetID; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | //要显示的方案数量; 根据情况会包含未解锁 |
| | | //a. 按元宝解锁的为逐一开启,默认开启x个,第x+1个显示条件需要【流派预设】功能开启, 可解锁后逐一保留一个锁住的(直到全开启); |
| | | //b. 按功能条件开启的,如果默认只开其一个方案的情况不显示,达到下一个方案的条件满足后全显示;默认大于1个的情况直接全显示 |
| | | public int GetShowFuncPresetCount(int funcType) |
| | | { |
| | | var showCount = GetUnlockCnt(funcType); |
| | | var unlockCnt = GetUnlockCnt(funcType); |
| | | var maxCount = PresetUnlockConfig.GetFuncPresetMaxCount(funcType); |
| | | var unlockType = PresetUnlockConfig.GetUnlockType((int)FuncPresetType.Mingge); |
| | | if (unlockType > 1) |
| | | if (unlockType == 2) |
| | | { |
| | | //非元宝解锁 |
| | | //命格按推演境界解锁 |
| | | //只有1个方案则不显示,大于1个则全显示 |
| | | return showCount == 1 ? 0 : maxCount; |
| | | if (unlockCnt == 1) |
| | | { |
| | | var config = PresetUnlockConfig.GetPresetUnlockConfig((int)FuncPresetType.Mingge, 2); |
| | | if (MinggeManager.Instance.m_GanwuLV >= config.UnlockValue) |
| | | { |
| | | return maxCount; |
| | | } |
| | | return 0; |
| | | } |
| | | return maxCount; |
| | | } |
| | | if (!IsOpen()) |
| | | { |
| | | //未开启时,默认大于1则显示 |
| | | return showCount == 1 ? 0 : showCount; |
| | | return unlockCnt == 1 ? 0 : unlockCnt; |
| | | } |
| | | |
| | | return showCount == maxCount ? showCount : showCount + 1; |
| | | return unlockCnt == maxCount ? unlockCnt : unlockCnt + 1; |
| | | } |
| | | |
| | | public int GetUnlockCnt(int funcType) |
| | |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | //选择方案:解锁或选中 |
| | | // 选择方案返回true,否则返回false |
| | | public bool ClickFuncPreset(int battleType, int funcType, int id) |
| | | { |
| | | var config = PresetUnlockConfig.GetPresetUnlockConfig(funcType, id); |
| | | var data = GetFuncPreset(funcType, id); |
| | | if (!data.unLock) |
| | | { |
| | | // 未解锁 则购买 |
| | | if (config.UnlockType == 1) |
| | | { |
| | | ConfirmCancel.MoneyIconToggleConfirmByType(ToggleCheckType.FuncPreset, config.UnlockValue, 1, |
| | | Language.Get("FuncPreset12", UIHelper.GetIconNameWithMoneyType(1), config.UnlockValue), () => |
| | | { |
| | | if (!UIHelper.CheckMoneyCount(1, config.UnlockValue, 2)) |
| | | return; |
| | | |
| | | UnLockPreset(funcType, id); |
| | | }); |
| | | } |
| | | else if (config.UnlockType == 2) |
| | | { |
| | | |
| | | if (MinggeManager.Instance.m_GanwuLV < config.UnlockValue) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("FuncPreset1", config.UnlockValue); |
| | | return false; |
| | | } |
| | | UnLockPreset(funcType, id); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | SaveFuncPresetID(battleType, funcType, id); |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public class FuncPreset |
| | | { |
| | | public int PresetID; //预设方案ID |
| | | public bool unLock; //是否解锁 |
| | | public string PresetName; //预设名称 |
| | | } |
| | |
| | | { |
| | | get |
| | | { |
| | | return itemHero.GetUseDataFirstValue(83) != 0; |
| | | var _list = itemHero.GetUseData(83); |
| | | // 默认没有预设的话就是生效的 |
| | | if (_list == null || _list.Count == 0) |
| | | return true; |
| | | var id = FuncPresetManager.Instance.GetFuncPresetID((int)FuncPresetType.Team); |
| | | return _list.Contains(id); |
| | | } |
| | | } |
| | | |
| | |
| | | UIManager.Instance.OpenWindow<ChooseItemsWin>(); |
| | | break; |
| | | case TipType.Mingge: |
| | | // UIManager.Instance.OpenWindow<MinggeWin>(); |
| | | UIManager.Instance.OpenWindow<MinggeSmallTipWin>(); |
| | | break; |
| | | default: |
| | | UIManager.Instance.OpenWindow<ItemTipWin>(); |
| | |
| | | fightPowerVariables.Clear(); |
| | | fightPowerVariables[PLAYER_LV] = PlayerDatas.Instance.baseData.LV; |
| | | fightPowerVariables[OFFICIAL_LV] = PlayerDatas.Instance.baseData.realmLevel; |
| | | fightPowerVariables[SKILL_POWER] = SkillConfig.Get(item.Key + item.Value - 1).FightPower; |
| | | if (item.Value == 0) |
| | | { |
| | | continue; |
| | | } |
| | | var skill = SkillConfig.Get(item.Key + item.Value - 1); |
| | | if (skill == null) |
| | | { |
| | | Debug.LogError("skill is null" + (item.Key + item.Value - 1)); |
| | | continue; |
| | | } |
| | | fightPowerVariables[SKILL_POWER] = skill.FightPower; |
| | | skillPower += (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables); |
| | | } |
| | | |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using System; |
| | | |
| | | |
| | | //实装的显示 |
| | |
| | | if (skillID != 0) |
| | | { |
| | | skillImage.SetSprite($"MinggeSkill_{skillID}"); |
| | | loopEffect.Play(); |
| | | var index = Array.IndexOf(EffectConfig.Get(loopEffect.effectId).animIndex, skillID); |
| | | loopEffect.Play(index); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | button.AddListener(() => |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | ItemTipUtility.Show(item.guid); |
| | | }); |
| | | |
| | | if (lastGuid == "uninit") |
| | |
| | | [SerializeField] MinggeEquipChangeCell newEquipCell; |
| | | [SerializeField] Transform presetObj; |
| | | [SerializeField] GroupButtonEx[] presetBtns; |
| | | [SerializeField] Text[] presetNameTexts; |
| | | |
| | | int selectPresetID = 0; |
| | | int lastDropIndex = -1; |
| | |
| | | { |
| | | for (int i = 0; i < presetBtns.Length; i++) |
| | | { |
| | | int index = i + 1; |
| | | presetBtns[i].AddListener(() => |
| | | { |
| | | selectPresetID = i; |
| | | selectPresetID = index; |
| | | Display(); |
| | | }); |
| | | } |
| | |
| | | presetObj.SetActive(true); |
| | | for (int i = 0; i < presetBtns.Length; i++) |
| | | { |
| | | presetBtns[i].SetActive(i < cnt); |
| | | if (i < cnt) |
| | | { |
| | | presetBtns[i].SetActive(true); |
| | | presetNameTexts[i].text = FuncPresetManager.Instance.GetFuncPreset((int)FuncPresetType.Mingge, i + 1).PresetName; |
| | | } |
| | | else |
| | | { |
| | | presetBtns[i].SetActive(false); |
| | | } |
| | | } |
| | | |
| | | presetBtns[selectPresetID -1].SelectBtn(); |
| | | } |
| | | else |
| | | { |
| | |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | | PackManager.Instance.RefreshItemEvent += RefreshItemEvent; |
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnEquipResult; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOK; |
| | | ParseConfig(); |
| | | } |
| | | |
| | |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; |
| | | PackManager.Instance.RefreshItemEvent -= RefreshItemEvent; |
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnEquipResult; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOK; |
| | | } |
| | | |
| | | |
| | |
| | | m_Lingying = 0; |
| | | waitTYOPPack = false; |
| | | } |
| | | |
| | | void OnPlayerLoginOK() |
| | | { |
| | | UpdateRedPoint(); |
| | | } |
| | | |
| | | private void OnEquipResult(HA814_tagMCMakeItemAnswer info) |
| | | { |
| | | if (info.MakeType != (int)MakeType.MinggeTY) |
| | |
| | | { |
| | | waitTYOPPack = false; |
| | | CalcEquip(); |
| | | } |
| | | |
| | | if (type == PackType.Item && (itemID == tyItemID || itemID == qlItemID)) |
| | | { |
| | | UpdateRedPoint(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (OpenMinggeEquipWin(item)) |
| | | { |
| | | //需要玩家处理的时候退出 |
| | | //需要玩家处理装备 |
| | | return true; |
| | | } |
| | | } |
| | |
| | | selectFloorEquip = equip; |
| | | if (UIManager.Instance.IsOpened<MinggeWin>()) |
| | | { |
| | | if (selectFloorEquip.config.EquipPlace == 0) |
| | | { |
| | | Debug.LogError($"配置错误物品 {selectFloorEquip.itemId} 装备位为0"); |
| | | return true; |
| | | } |
| | | UIManager.Instance.OpenWindow<MinggeEquipWin>(); |
| | | } |
| | | return true; |
| | |
| | | |
| | | public void SendTY(int count) |
| | | { |
| | | |
| | | if (CalcEquip()) |
| | | { |
| | | return; |
| | |
| | | Redpoint redpointMG = new Redpoint(MainRedDot.RedPoint_Mingge, MainRedDot.RedPoint_Mingge * 10 + 1); |
| | | Redpoint redpointPray = new Redpoint(MainRedDot.RedPoint_Mingge, MainRedDot.RedPoint_Mingge * 10 + 2); |
| | | |
| | | void UpdateRedPoint() |
| | | { |
| | | |
| | | redpointMG.state = RedPointState.None; |
| | | redpointPray.state = RedPointState.None; |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge)) |
| | | { |
| | | return; |
| | | } |
| | | if (PackManager.Instance.GetItemCountByID(PackType.Item, tyItemID) > 0) |
| | | { |
| | | redpointMG.state = RedPointState.Simple; |
| | | } |
| | | |
| | | if (PackManager.Instance.GetItemCountByID(PackType.Item, qlItemID) > 0) |
| | | { |
| | | redpointPray.state = RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | |
| | | //祈灵概率 |
| | | public class MinggePrayRateCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Text rateText; |
| | | [SerializeField] Text nextRateText; |
| | | [SerializeField] Image qualityImg; |
| | | [SerializeField] Image arrowImg; |
| | | |
| | | // maxRateNum 概率最大值,用于计算百分比取最后两位 |
| | | public void Display(int index, List<int> bigRateList, List<int> littleRateList, int maxRateNum) |
| | | { |
| | | var rate = littleRateList[index]; |
| | | var nextRate = bigRateList[index]; |
| | | |
| | | rateText.text = (rate / (float)maxRateNum * 100).ToString("0.##") + "%"; |
| | | nextRateText.text = (nextRate / (float)maxRateNum * 100).ToString("0.##") + "%"; |
| | | qualityImg.SetSprite("MinggeNameBG" + (index + 1)); |
| | | if (rate == nextRate) |
| | | { |
| | | arrowImg.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | arrowImg.SetActive(true); |
| | | arrowImg.SetSprite(rate > nextRate ? "FightPointDown" : "FightPointUP"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 71422f21c99778c40b1975f8e35aa6e3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class MinggePrayWin : UIBase |
| | | { |
| | | [SerializeField] ItemCell itemCell; |
| | | [SerializeField] Text itemName; |
| | | [SerializeField] Text desce; |
| | | [SerializeField] Text qlValueText; |
| | | [SerializeField] MinggePrayRateCell[] prayRateCells; |
| | | [SerializeField] SliderPanel sliderPanel; |
| | | [SerializeField] Image itemIcon; |
| | | [SerializeField] Text countText; |
| | | [SerializeField] Button qlBtn; |
| | | [SerializeField] UIEffectPlayer qlEffect; |
| | | |
| | | int useCnt = 1; |
| | | |
| | | int qualityCnt; |
| | | int maxRateNum = 0; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | qlBtn.AddListener(QL); |
| | | var rateList = MGLingyingQualityConfig.Get(0).ItemColorWeightList; |
| | | qualityCnt = rateList.Length; |
| | | foreach (var rate in rateList) |
| | | { |
| | | maxRateNum += rate; |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | MinggeManager.Instance.OnMinggeInfoUpdate += Display; |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | MinggeManager.Instance.OnMinggeInfoUpdate -= Display; |
| | | } |
| | | |
| | | public void Display() |
| | | { |
| | | var config = ItemConfig.Get(MinggeManager.Instance.qlItemID); |
| | | itemCell.Init(new ItemCellModel(MinggeManager.Instance.qlItemID, false, 0)); |
| | | itemName.text = config.ItemName; |
| | | desce.text = config.Description; |
| | | var maxCnt = PackManager.Instance.GetItemCountByID(PackType.Item, MinggeManager.Instance.qlItemID); |
| | | useCnt = Math.Max(1, (int)maxCnt); |
| | | sliderPanel.Init((value) => { OnSliderChange(value); }, useCnt, useCnt); |
| | | DisplayPrayRate(); |
| | | DisplayCostItem(); |
| | | } |
| | | |
| | | |
| | | void DisplayPrayRate() |
| | | { |
| | | qlValueText.text = MinggeManager.Instance.m_Lingying.ToString(); |
| | | var littleRateList = GetRate(MinggeManager.Instance.m_Lingying); |
| | | var bigRateList = GetRate(MinggeManager.Instance.m_Lingying + useCnt); |
| | | |
| | | for (int i = 0; i < prayRateCells.Length; i++) |
| | | { |
| | | if (i < qualityCnt) |
| | | { |
| | | prayRateCells[i].SetActive(true); |
| | | prayRateCells[i].Display(i, bigRateList, littleRateList, maxRateNum); |
| | | } |
| | | else |
| | | { |
| | | prayRateCells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void DisplayCostItem() |
| | | { |
| | | itemIcon.SetItemSprite(MinggeManager.Instance.qlItemID); |
| | | countText.text = UIHelper.ShowUseItem(PackType.Item, MinggeManager.Instance.qlItemID, useCnt); |
| | | } |
| | | |
| | | void OnSliderChange(int value) |
| | | { |
| | | useCnt = Math.Max(1, value); |
| | | DisplayPrayRate(); |
| | | DisplayCostItem(); |
| | | } |
| | | |
| | | void QL() |
| | | { |
| | | if (useCnt == 0) |
| | | { |
| | | return; |
| | | } |
| | | if (!ItemLogicUtility.CheckItemCount(PackType.Item, MinggeManager.Instance.qlItemID, useCnt, 2)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var pack = new CB253_tagCSMinggeQiling(); |
| | | pack.UseCount = (uint)useCnt; |
| | | |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | qlEffect.Play(); |
| | | } |
| | | |
| | | |
| | | public List<int> GetRate(int value) |
| | | { |
| | | var keys = MGLingyingQualityConfig.GetKeys(); |
| | | keys.Sort(); |
| | | |
| | | int littleValue = 0; |
| | | int bigValue = 0; |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | var key = keys[i]; |
| | | if (value < key) |
| | | { |
| | | bigValue = key; |
| | | littleValue = keys[i - 1]; |
| | | break; |
| | | } |
| | | else if (i == keys.Count - 1 && value >= key) |
| | | { |
| | | bigValue = key; |
| | | littleValue = key; |
| | | } |
| | | } |
| | | |
| | | var littleRateList = MGLingyingQualityConfig.Get(littleValue).ItemColorWeightList; |
| | | if (littleValue == bigValue) |
| | | { |
| | | return littleRateList.ToList(); |
| | | } |
| | | var bigRateList = MGLingyingQualityConfig.Get(bigValue).ItemColorWeightList; |
| | | |
| | | //对比下一阶段的灵应值配置,比较同品质的权重差值与两个阶段的灵应差值求出每增加1点灵应对某个品质的权重变化值,变化值可能提升或者降低 |
| | | |
| | | var rateList = new List<int>(); |
| | | |
| | | for (int i = 0; i < littleRateList.Length; i++) |
| | | { |
| | | var littleRateValue = littleRateList[i]; |
| | | var bigRateValue = bigRateList[i]; |
| | | var diffRate = littleRateValue + (bigRateValue - littleRateValue) / (bigValue - littleValue) * (value - littleValue); |
| | | rateList.Add(diffRate); |
| | | } |
| | | |
| | | return rateList; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 35f6dd00232ff4447a857ee3d82bd456 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | public class MinggeSmallTipWin : UIBase |
| | | { |
| | | [SerializeField] Text m_text; |
| | | protected override void InitComponent() |
| | | { |
| | | [SerializeField] RectTransform content; |
| | | [SerializeField] RectTransform arrow; |
| | | [SerializeField] MinggeItemCell itemCell; |
| | | [SerializeField] Text itemName; |
| | | [SerializeField] OutlineEx itemNameOutline; |
| | | [SerializeField] List<TextEx> fightAttrNames; |
| | | [SerializeField] List<TextEx> fightAttrValues; |
| | | [SerializeField] TextEx[] skillDesces; |
| | | |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | |
| | | Display(); |
| | | |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | protected override void NextFrameAfterOpen() |
| | | { |
| | | var worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | |
| | | |
| | | Vector2 screenAdjustedPos = CameraManager.uiCamera.WorldToScreenPoint(worldPos); |
| | | |
| | | var beforePos = screenAdjustedPos; |
| | | var beforeAdjustedPos = CameraManager.uiCamera.ScreenToWorldPoint(beforePos); |
| | | |
| | | var rectWidth = content.rect.width * Screen.width / canvasScaler.referenceResolution.x; |
| | | screenAdjustedPos.x = Mathf.Clamp(screenAdjustedPos.x, rectWidth * 0.5f, Screen.width - rectWidth * 0.5f); |
| | | screenAdjustedPos.y -= 40; |
| | | var adjustedPos = CameraManager.uiCamera.ScreenToWorldPoint(screenAdjustedPos); |
| | | adjustedPos.z = 0; |
| | | content.position = adjustedPos; |
| | | |
| | | arrow.position = new Vector3(beforeAdjustedPos.x, arrow.position.y, 0); |
| | | } |
| | | |
| | | |
| | | void Display() |
| | | public void Display() |
| | | { |
| | | var guid = ItemTipUtility.mainTipData.guid; |
| | | if (string.IsNullOrEmpty(guid)) |
| | | { |
| | | DelayCloseWindow().Forget(); |
| | | return; |
| | | } |
| | | var equip = PackManager.Instance.GetItemByGuid(guid); |
| | | |
| | | 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); |
| | | |
| | | |
| | | |
| | | 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 = "?"; |
| | | fightAttrNames[i].colorType = TextColType.NavyGray; |
| | | fightAttrValues[i].text = Language.Get("Mingge27", MinggeManager.Instance.unlockAttrLVList[i - 1] - 1); |
| | | fightAttrValues[i].colorType = TextColType.NavyGray; |
| | | } |
| | | else |
| | | { |
| | | fightAttrNames[i].text = PlayerPropertyConfig.Get(fightAttrs[i]).Name; |
| | | fightAttrNames[i].colorType = TextColType.lightYellow; |
| | | fightAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(fightAttrs[i], fightValues[i]); |
| | | fightAttrValues[i].colorType = TextColType.lightYellow; |
| | | } |
| | | } |
| | | |
| | | //技能描述 所有技能全显示 |
| | | var skillID = EquipModel.Instance.GetEquipSkillID(equip); |
| | | if (skillID == 0) |
| | | { |
| | | for (int i = 0; i < skillDesces.Length; i++) |
| | | { |
| | | skillDesces[i].SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var dict = MinggeManager.Instance.GetMinggeSkillTypeIDDict(); |
| | | //如果是旧装备 显示当前数量;新装备不同技能数量+1,同技能不变 |
| | | var hasCnt = dict[skillID].Count; |
| | | for (int i = 0; i < skillDesces.Length; i++) |
| | | { |
| | | skillDesces[i].SetActive(true); |
| | | skillDesces[i].colorType = i == hasCnt - 1 ? TextColType.lightYellow : TextColType.NavyGray; |
| | | var showCnt = Math.Min(hasCnt, i + 1); |
| | | skillDesces[i].text = SkillConfig.Get(skillID).Description + " " + Language.Get("HeroFates11", showCnt, i + 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | [SerializeField] Image tyItemImg; |
| | | [SerializeField] Text tyItemCntText; |
| | | |
| | | |
| | | FuncPresetChooseCells presetChooseCells; |
| | | 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); |
| | | presetChooseCells = presetObj.GetComponent<FuncPresetChooseCells>(); |
| | | seeAttrBtn.AddListener(() => |
| | | { |
| | | AttributeManager.Instance.OpenTotalAttributeWin(MinggeManager.Instance.minggeAttrDict); |
| | |
| | | ClickSuite(index); |
| | | }); |
| | | } |
| | | prayBtn.AddListener(()=> |
| | | { |
| | | UIManager.Instance.OpenWindow<MinggePrayWin>(); |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | |
| | | PackManager.Instance.DeleteItemEvent += DeleteDropItem; |
| | | MinggeManager.Instance.OnMinggeInfoUpdate += OnMinggeInfoUpdate; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | FuncPresetManager.Instance.OnFuncPresetUseDataEvent += OnFuncPresetUseDataEvent; |
| | | lastLV = MinggeManager.Instance.m_GanwuLV; |
| | | lastExp = MinggeManager.Instance.m_GanwuExp; |
| | | Display(); |
| | |
| | | PackManager.Instance.DeleteItemEvent -= DeleteDropItem; |
| | | MinggeManager.Instance.OnMinggeInfoUpdate -= OnMinggeInfoUpdate; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | FuncPresetManager.Instance.OnFuncPresetUseDataEvent -= OnFuncPresetUseDataEvent; |
| | | } |
| | | |
| | | void OnCloseWindow(UIBase win) |
| | |
| | | } |
| | | } |
| | | |
| | | void OnFuncPresetUseDataEvent() |
| | | { |
| | | MinggeManager.Instance.RefrehMinggeAttrs(); |
| | | Display(); |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | DisplayMGGanwu(); |
| | |
| | | |
| | | DisplayCostItem(); |
| | | moneyMoveByPathCell.SetActive(false); |
| | | presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge); |
| | | } |
| | | void RefreshItemEvent(PackType type, int index, int itemID) |
| | | { |
| | |
| | | |
| | | void SendTuiyan() |
| | | { |
| | | MinggeManager.Instance.SendTY(1); |
| | | if (MinggeManager.Instance.CalcEquip()) |
| | | { |
| | | return; |
| | | } |
| | | tyEffect.onComplete += () => |
| | | { |
| | | MinggeManager.Instance.SendTY(1); |
| | | }; |
| | | tyEffect.Play(); |
| | | } |
| | | |
| | |
| | | void OnMinggeInfoUpdate() |
| | | { |
| | | DisplayMGGanwu(); |
| | | presetChooseCells.Display((int)BattlePreSetType.Story, (int)FuncPresetType.Mingge); |
| | | } |
| | | |
| | | void DisplayMGGanwu() |
| | |
| | | } |
| | | |
| | | |
| | | //货币确认框:有显示勾选的 消耗元宝勾选类型 |
| | | public static void MoneyIconToggleConfirmByType(ToggleCheckType type, int moneyCnt, int _moneyType, string fullTip, Action func) |
| | | { |
| | | if (toggleCheckDict.ContainsKey(type) && toggleCheckDict[type]) |
| | |
| | | WashCancel = 1, //洗练取消 |
| | | GoldRush = 2, //淘金 |
| | | BoneField = 3, //白骨盈野 |
| | | FuncPreset = 4, //功能(流派)预设 |
| | | } |
| | | |
| | | |