| Main/SDK/SDKUtils.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/GeneralConfig/GeneralDefine.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/ItemTip/OwnMoneyCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Tip/PayMethodConfirmWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Main/SDK/SDKUtils.cs
@@ -958,8 +958,9 @@ long cashVoucher = UIHelper.GetMoneyCnt(97); long diamond = UIHelper.GetMoneyCnt(99); bool hasEnoughVoucher = cashVoucher >= needMoney; bool hasEnoughDiamond = diamond >= needMoney; var availableMoneyTypes = GeneralDefine.GetPayMethodAvailableMoneyTypes(); bool hasEnoughVoucher = availableMoneyTypes.Contains(97) && cashVoucher >= needMoney; bool hasEnoughDiamond = availableMoneyTypes.Contains(99) && diamond >= needMoney; if (hasEnoughVoucher || hasEnoughDiamond) { Main/System/GeneralConfig/GeneralDefine.cs
@@ -8,31 +8,35 @@ public class GeneralDefine { static readonly List<int> DEFAULT_PAY_METHOD_MONEY_TYPES = new List<int> { 97, 99 }; static Dictionary<string, int[]> payMethodMoneyTypeByChannel; public static Dictionary<int, int> MoneyDisplayModel { get; private set; } public static int activityItemID { get; private set; } public static int expDisplayId { get; private set; } //参数int,int ,string 分别表示职业,转生等级,icon static Dictionary<int, Dictionary<int, string>> jobHeadPortrait = new Dictionary<int, Dictionary<int, string>>(); static Dictionary<int, Dictionary<int, string>> otherjobHeadPortrait = new Dictionary<int, Dictionary<int, string>>(); public static int rechargeRedpointLv { get; private set; } public static int rechargeRedpointMinLv { get; private set; } public static List<int> inGameDownLoadLevelCheckPoints = new List<int>(); public static int inGameDownLoadHighLevel { get; private set; } public static Dictionary<int, List<int>> itemPutInPackDict { get; private set; } public static Dictionary<int, int> itemMoneyCountDict { get; private set; } //背包中用于展示货币数量的物品 public static int UISpringDecorate { get; private set; } public static Dictionary<int, List<int>> skillAttrIDDict { get; private set; } public static int acutionItemHour { get; private set; } public static float blockRatio; @@ -52,6 +56,7 @@ public static int[] heroSkinGiftList; public static void Init() { payMethodMoneyTypeByChannel = null; try { MoneyDisplayModel = ConfigParse.ParseIntDict(GetInputString("MoneyDisplayModel", 1)); @@ -117,6 +122,8 @@ config = FuncConfigConfig.Get("HeroSkinGift"); heroSkinGiftList = JsonMapper.ToObject<int[]>(config.Numerical1); payMethodMoneyTypeByChannel = JsonMapper.ToObject<Dictionary<string, int[]>>(FuncConfigConfig.Get("DJQShow").Numerical1); } catch (Exception ex) { @@ -323,4 +330,31 @@ { return playerID < 1000000; } public static List<int> GetPayMethodAvailableMoneyTypes() { if (payMethodMoneyTypeByChannel == null) return new List<int>(DEFAULT_PAY_METHOD_MONEY_TYPES); var versionConfig = VersionConfig.Get(); string channel = versionConfig != null ? versionConfig.appId : string.Empty; if (string.IsNullOrEmpty(channel) || payMethodMoneyTypeByChannel == null || !payMethodMoneyTypeByChannel.TryGetValue(channel, out var moneyTypes) || moneyTypes == null || moneyTypes.Length == 0) { return new List<int>(DEFAULT_PAY_METHOD_MONEY_TYPES); } var result = new List<int>(); for (int i = 0; i < moneyTypes.Length; i++) { if (!result.Contains(moneyTypes[i])) { result.Add(moneyTypes[i]); } } return result.Count > 0 ? result : new List<int>(DEFAULT_PAY_METHOD_MONEY_TYPES); } } Main/System/ItemTip/OwnMoneyCell.cs
@@ -1,4 +1,5 @@ using UnityEngine; using UnityEngine; using System.Collections.Generic; using UnityEngine.UI; //拥有的货币:数量显示,点击按钮打开对应获取界面 @@ -13,9 +14,9 @@ { if (moneyType != 0) moneyIcon.SetIconWithMoneyType(moneyType); if (wayBtn != null) { { wayBtn.AddListener(()=> { switch (moneyType) @@ -77,8 +78,16 @@ }); } } void OnEnable() { bool shouldShow = ShouldShowByChannelConfig(); if (!shouldShow) { gameObject.SetActive(false); return; } PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh; Display(); } @@ -91,10 +100,10 @@ void PlayerDataRefresh(PlayerDataType type) { if (type != UIHelper.moneyTypeToPlayerDataType[moneyType]) { { return; } Display(); } @@ -116,9 +125,19 @@ } numText.text = UIHelper.ReplaceLargeNum(count, decimalPlaces); if (resetIcon) { { moneyIcon.SetIconWithMoneyType(moneyType); } } } bool ShouldShowByChannelConfig() { if (moneyType != 97 && moneyType != 99) { return true; } List<int> availableMoneyTypes = GeneralDefine.GetPayMethodAvailableMoneyTypes(); return availableMoneyTypes.Contains(moneyType); } } Main/System/Tip/PayMethodConfirmWin.cs
@@ -1,12 +1,11 @@ using UnityEngine; using UnityEngine.UI; // 支付方式选择确认框:双货币(现金礼券/玄玉)二选一 public class PayMethodConfirmWin : UIBase { [SerializeField] Text m_Content; [SerializeField] Toggle m_Toggle1; //代金礼券 [SerializeField] Toggle m_Toggle2; //玄玉 [SerializeField] Toggle m_Toggle1; [SerializeField] Toggle m_Toggle2; [SerializeField] Text m_ToggleTxt1; [SerializeField] Text m_ToggleTxt2; [SerializeField] Button m_ConfirmBtn; @@ -15,6 +14,7 @@ [SerializeField] Text moneyText; int m_SelectedMoneyType; int m_SelectedNeedCount; int m_NeedMoney1; int m_NeedMoney2; @@ -27,14 +27,14 @@ { if (isOn) { TrySelectMoneyType(ConfirmCancel.moneyType1, ConfirmCancel.moneyNeedCount1); TrySelectMoneyType(ConfirmCancel.moneyType1, m_NeedMoney1); } }); m_Toggle2.onValueChanged.AddListener((bool isOn) => { if (isOn) { TrySelectMoneyType(ConfirmCancel.moneyType2, ConfirmCancel.moneyNeedCount2); TrySelectMoneyType(ConfirmCancel.moneyType2, m_NeedMoney2); } }); } @@ -44,11 +44,18 @@ m_NeedMoney1 = ConfirmCancel.moneyNeedCount1; m_NeedMoney2 = ConfirmCancel.moneyNeedCount2; // 设置两个 Toggle 的文字 m_ToggleTxt1.text = ConfirmCancel.toggleText1; m_ToggleTxt2.text = ConfirmCancel.toggleText2; // 先设互斥 ToggleGroup,避免初始化时 listener 触发状态错乱 var availableMoneyTypes = GeneralDefine.GetPayMethodAvailableMoneyTypes(); bool showMoney1 = availableMoneyTypes.Contains(ConfirmCancel.moneyType1); bool showMoney2 = availableMoneyTypes.Contains(ConfirmCancel.moneyType2); if (!showMoney1 && !showMoney2) { showMoney1 = true; showMoney2 = true; } var group = gameObject.GetComponent<ToggleGroup>(); if (group == null) { @@ -58,32 +65,32 @@ m_Toggle1.group = group; m_Toggle2.group = group; // 判断各货币是否充足 int showCount = (showMoney1 ? 1 : 0) + (showMoney2 ? 1 : 0); bool showToggles = showCount > 1; m_Toggle1.gameObject.SetActive(showToggles && showMoney1); m_Toggle2.gameObject.SetActive(showToggles && showMoney2); long have1 = UIHelper.GetMoneyCnt(ConfirmCancel.moneyType1); long have2 = UIHelper.GetMoneyCnt(ConfirmCancel.moneyType2); bool enough1 = have1 >= m_NeedMoney1; bool enough2 = have2 >= m_NeedMoney2; bool enough1 = showMoney1 && have1 >= m_NeedMoney1; bool enough2 = showMoney2 && have2 >= m_NeedMoney2; // 用 SetIsOnWithoutNotify 避免触发 listener,然后手动初始化 if (enough1) if (enough1 || (!enough2 && showMoney1)) { m_Toggle1.SetIsOnWithoutNotify(true); m_Toggle1.SetIsOnWithoutNotify(showToggles); m_Toggle2.SetIsOnWithoutNotify(false); m_SelectedMoneyType = ConfirmCancel.moneyType1; } else if (enough2) { m_Toggle1.SetIsOnWithoutNotify(false); m_Toggle2.SetIsOnWithoutNotify(true); m_SelectedMoneyType = ConfirmCancel.moneyType2; m_SelectedNeedCount = m_NeedMoney1; } else { m_Toggle1.SetIsOnWithoutNotify(true); m_Toggle2.SetIsOnWithoutNotify(false); m_SelectedMoneyType = ConfirmCancel.moneyType1; m_Toggle1.SetIsOnWithoutNotify(false); m_Toggle2.SetIsOnWithoutNotify(showToggles); m_SelectedMoneyType = ConfirmCancel.moneyType2; m_SelectedNeedCount = m_NeedMoney2; } UpdateMoneyDisplay(m_SelectedMoneyType, m_SelectedMoneyType == ConfirmCancel.moneyType1 ? m_NeedMoney1 : m_NeedMoney2); UpdateMoneyDisplay(m_SelectedMoneyType, m_SelectedNeedCount); } void TrySelectMoneyType(int moneyType, int needCount) @@ -91,10 +98,7 @@ long have = UIHelper.GetMoneyCnt(moneyType); if (have < needCount) { // 货币不足,弹出提示并切回原来的选中项 string moneyName = ItemConfig.Get(UIHelper.GetItemIDWithMoneyType(moneyType))?.ItemName ?? moneyType.ToString(); SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); // 恢复原来的选中 if (m_SelectedMoneyType == ConfirmCancel.moneyType1) { m_Toggle1.isOn = true; @@ -107,6 +111,7 @@ } m_SelectedMoneyType = moneyType; m_SelectedNeedCount = needCount; UpdateMoneyDisplay(moneyType, needCount); } @@ -114,7 +119,6 @@ { moneyIcon.SetIconWithMoneyType(moneyType); moneyText.text = GetPayMethodMoneyText(moneyType, needCount); // 切换选项时同步刷新 Recharge6 内容(货币图标+名称变化) m_Content.text = Language.Get("Recharge6", UIHelper.GetIconNameWithMoneyType(moneyType), ConfirmCancel.payMethodMoney, ConfirmCancel.payMethodTitle); } @@ -133,6 +137,12 @@ private void OnConfirm() { if (UIHelper.GetMoneyCnt(m_SelectedMoneyType) < m_SelectedNeedCount) { SysNotifyMgr.Instance.ShowTip("LackMoney", m_SelectedMoneyType); return; } CloseWindow(); ConfirmCancel.OnDualToggleConfirmEvent?.Invoke(true, m_SelectedMoneyType); }