| | |
| | | public uint ExAttr11; //预留的扩展属性字段,用来存放项目特定的属性121 现金代币(代金券) |
| | | public uint ExAttr16; //预留的扩展属性字段,用来存放项目特定的属性 全身特效 |
| | | public uint ExAttr17; //账号状态 按位 4 封号 5禁言 6禁设备 |
| | | public uint ServerGroupId; //服务器组ID |
| | | public uint cashVoucher; //现金礼券(货币类型97),存储于ExAttr13,0418刷新类型123 |
| | | public uint hangTime;//现为脱机挂剩余时间 23 |
| | | public uint faction; //阵营 107 |
| | | uint m_coinPointTotal; |
| | |
| | | leaveGuildInfo = (int)_serverInfo.ExAttr12; |
| | | ExAttr16 = _serverInfo.ExAttr16; |
| | | ExAttr17 = _serverInfo.ExAttr17; |
| | | ServerGroupId = _serverInfo.ExAttr13; |
| | | cashVoucher = _serverInfo.ExAttr13; |
| | | faction = _serverInfo.Faction; |
| | | coinPointTotal = _serverInfo.ChangeCoinPointTotal; |
| | | equipShowSwitch = _serverInfo.EquipShowSwitch; |
| | |
| | | // bubbleId = serverInfo.ExAttr10; |
| | | // ExAttr11 = serverInfo.ExAttr11; |
| | | // ExAttr16 = serverInfo.ExAttr16; |
| | | // ServerGroupId = serverInfo.ExAttr13; |
| | | // cashVoucher = serverInfo.ExAttr13; |
| | | // faction = serverInfo.Faction; |
| | | // coinPointTotal = serverInfo.ChangeCoinPointTotal; |
| | | // HP = serverInfo.HP + serverInfo.HPEx * Constants.ExpPointValue; |
| | |
| | | baseData.ExAttr11 = value; |
| | | break; |
| | | case PlayerDataType.ExAttr13: |
| | | baseData.ServerGroupId = value; |
| | | baseData.cashVoucher = value; |
| | | break; |
| | | case PlayerDataType.BattleValEx1: |
| | | extersion.battleValEx1 = (int)value; |
| | |
| | | public string AppID;
|
| | | public byte OrderInfoLen;
|
| | | public string OrderInfo; //商品编号
|
| | | public byte UseMoneyType; //使用货币类型,默认99-代币,可指定使用其他货币,如97-现金礼券
|
| | |
|
| | | public CA125_tagCMCoinBuyOrderInfo () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | |
| | | WriteBytes (AppID, NetDataType.Chars, AppIDLen);
|
| | | WriteBytes (OrderInfoLen, NetDataType.BYTE);
|
| | | WriteBytes (OrderInfo, NetDataType.Chars, OrderInfoLen);
|
| | | WriteBytes (UseMoneyType, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | /// |
| | | public void FreePlatformPay(string title, float money, string cpInfo) |
| | | { |
| | | // 提示是否使用代金券 |
| | | var gameCash = UIHelper.GetAllVourcher(); |
| | | |
| | | bool isBuyGameCash = false; //代金券本身的充值不能用代金券购买 造成循环 |
| | | // 代金券/现金礼券本身的充值不能使用代金券购买 造成循环 |
| | | bool isBuyGameCash = false; |
| | | int ctgID = RechargeManager.Instance.orderInfoToCTGID[cpInfo]; |
| | | if (ctgID != 0) |
| | | { |
| | | isBuyGameCash = CTGConfig.Get(ctgID).PayType == 17; |
| | | var payType = CTGConfig.Get(ctgID).PayType; |
| | | isBuyGameCash = (payType == 17 || payType == 27); |
| | | } |
| | | |
| | | |
| | | if (!isBuyGameCash && gameCash >= money * 100) |
| | | if (isBuyGameCash) |
| | | { |
| | | FreePlatformPayEx(title, money, cpInfo); |
| | | return; |
| | | } |
| | | |
| | | long needMoney = (long)(money * 100); // money是元,needMoney是分 |
| | | long cashVoucher = UIHelper.GetMoneyCnt(97); |
| | | long diamond = UIHelper.GetMoneyCnt(99); |
| | | |
| | | bool hasEnoughVoucher = cashVoucher >= needMoney; |
| | | bool hasEnoughDiamond = diamond >= needMoney; |
| | | |
| | | if (hasEnoughVoucher || hasEnoughDiamond) |
| | | { |
| | | // 弹出支付方式选择框(现金礼券/玄玉二选一) |
| | | UIManager.Instance.CloseWindow<GotoChargeWin>(); |
| | | if (DayRemind.Instance.GetDayRemind(DayRemind.DJQTip)) |
| | | { |
| | | var pack = new CA125_tagCMCoinBuyOrderInfo(); |
| | | pack.AppID = VersionConfig.Get().appId; |
| | | pack.AppIDLen = (byte)pack.AppID.Length; |
| | | pack.OrderInfo = cpInfo; |
| | | pack.OrderInfoLen = (byte)pack.OrderInfo.Length; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | else |
| | | { |
| | | ConfirmCancel.ShowPopConfirm( |
| | | Language.Get("Mail101"), |
| | | Language.Get("GameCashRule1", money, title), |
| | | (bool isOk) => |
| | | int defaultMoneyType = hasEnoughVoucher ? 97 : 99; |
| | | ConfirmCancel.ShowPayMethodConfirm( |
| | | 97, (int)needMoney, Language.Get("Recharge8"), // 现金礼券 |
| | | 99, (int)needMoney, Language.Get("Recharge7"), // 玄玉 |
| | | Language.Get("Recharge6", UIHelper.GetIconNameWithMoneyType(defaultMoneyType), money, title), |
| | | money, title, |
| | | (bool isOk, int selectedMoneyType) => |
| | | { |
| | | if (isOk) |
| | | { |
| | |
| | | pack.AppIDLen = (byte)pack.AppID.Length; |
| | | pack.OrderInfo = cpInfo; |
| | | pack.OrderInfoLen = (byte)pack.OrderInfo.Length; |
| | | pack.UseMoneyType = (byte)selectedMoneyType; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | SendGaoreEvent(dataType, pageType, pageName, pageItemId, money, orderID); |
| | | return; |
| | | } |
| | | else if (appID == "sghy") |
| | | else if (appID == "sghy" && dataType == 7) |
| | | { |
| | | SendOverSeaTraceEvent("tutorial_complete"); |
| | | } |
| | |
| | | } |
| | | } |
| | | break; |
| | | case 97: |
| | | { |
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Recharge, true)) |
| | | { |
| | | RechargeManager.Instance.selectTabIndex = 2; |
| | | if (UIManager.Instance.IsOpened<StoreBaseWin>()) |
| | | { |
| | | UIManager.Instance.GetUI<StoreBaseWin>().ClickFuncBtn(2); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<StoreBaseWin>(2); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 99: |
| | | { |
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Recharge, true)) |
| | |
| | | } |
| | | double count = UIHelper.GetMoneyCnt(moneyType); |
| | | int decimalPlaces = 1; |
| | | if (moneyType == 99) |
| | | if (moneyType == 97 || moneyType == 99) |
| | | { |
| | | count = count / 100.0; |
| | | decimalPlaces = 2; |
| | |
| | |
|
| | | public partial class RechargeManager : GameSystemManager<RechargeManager>
|
| | | {
|
| | | public int selectTabIndex; //0 点券 1 金币
|
| | | public int selectTabIndex = 2; //0 代金券 1 元宝 2 现金礼券(默认)
|
| | |
|
| | | public List<int> GetCTGIDListByType(int type)
|
| | | {
|
| | |
| | | //充值界面 |
| | | public class RechargeWin : UIBase |
| | | { |
| | | |
| | | [SerializeField] GroupButtonEx djq1Btn; |
| | | [SerializeField] GroupButtonEx djqBtn; |
| | | [SerializeField] GroupButtonEx goldBtn; |
| | | |
| | | [SerializeField] ScrollerController djq1Scroller; |
| | | [SerializeField] ScrollerController djqScroller; |
| | | [SerializeField] ScrollerController goldScroller; |
| | | |
| | | [SerializeField] Transform djqInfo; |
| | | [SerializeField] Transform djqInfo1; |
| | | |
| | | |
| | | List<int> _list = new List<int>(); |
| | | protected override void InitComponent() |
| | | { |
| | | djq1Btn.AddListener(() => { OnSelectFuncType(2); }); |
| | | djqBtn.AddListener(() => { OnSelectFuncType(0); }); |
| | | goldBtn.AddListener(() => { OnSelectFuncType(1); }); |
| | | } |
| | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | djq1Scroller.OnRefreshCell += OnDjq1RefreshCell; |
| | | djqScroller.OnRefreshCell += OnDjqRefreshCell; |
| | | goldScroller.OnRefreshCell += OnGoldRefreshCell; |
| | | RechargeManager.Instance.rechargeCountEvent += RechargeEvent; |
| | | |
| | | if (RechargeManager.Instance.selectTabIndex == 0) |
| | | if (RechargeManager.Instance.selectTabIndex == 2) |
| | | { |
| | | djq1Btn.SelectBtn(); |
| | | } |
| | | else if (RechargeManager.Instance.selectTabIndex == 0) |
| | | { |
| | | djqBtn.SelectBtn(); |
| | | } |
| | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | djq1Scroller.OnRefreshCell -= OnDjq1RefreshCell; |
| | | djqScroller.OnRefreshCell -= OnDjqRefreshCell; |
| | | goldScroller.OnRefreshCell -= OnGoldRefreshCell; |
| | | RechargeManager.Instance.rechargeCountEvent -= RechargeEvent; |
| | |
| | | |
| | | void CreateScroller() |
| | | { |
| | | if (RechargeManager.Instance.selectTabIndex == 0) |
| | | if (RechargeManager.Instance.selectTabIndex == 2) |
| | | { |
| | | _list = RechargeManager.Instance.GetCTGIDListByType(27); |
| | | djq1Scroller.SetActive(true); |
| | | djqInfo1.SetActive(true); |
| | | djqScroller.SetActive(false); |
| | | djqInfo.SetActive(false); |
| | | goldScroller.SetActive(false); |
| | | if (djq1Scroller.GetCellTotalCount() == 0) |
| | | { |
| | | djq1Scroller.Refresh(); |
| | | for (int i = 0; i < _list.Count; i++) |
| | | { |
| | | if (i % 3 == 0) |
| | | { |
| | | djq1Scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | } |
| | | djq1Scroller.Restart(); |
| | | } |
| | | else |
| | | { |
| | | djq1Scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | SDKUtils.Instance.SendTraceEvent(8, "充值", "现金礼券", "2"); |
| | | } |
| | | else if (RechargeManager.Instance.selectTabIndex == 0) |
| | | { |
| | | _list = RechargeManager.Instance.GetCTGIDListByType(17); |
| | | djq1Scroller.SetActive(false); |
| | | djqInfo1.SetActive(false); |
| | | djqScroller.SetActive(true); |
| | | djqInfo.SetActive(true); |
| | | goldScroller.SetActive(false); |
| | |
| | | else if (RechargeManager.Instance.selectTabIndex == 1) |
| | | { |
| | | _list = RechargeManager.Instance.GetCTGIDListByType(2); |
| | | djq1Scroller.SetActive(false); |
| | | djqInfo1.SetActive(false); |
| | | djqScroller.SetActive(false); |
| | | djqInfo.SetActive(false); |
| | | goldScroller.SetActive(true); |
| | |
| | | } |
| | | |
| | | |
| | | void OnDjq1RefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as RechargeDJQLineCell; |
| | | _cell.Display(cell.index, _list); |
| | | } |
| | | |
| | | void OnDjqRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as RechargeDJQLineCell; |
| | |
| | | } |
| | | |
| | | |
| | | //双货币支付方式选择(现金礼券/玄玉) |
| | | public static int moneyType1; |
| | | public static int moneyNeedCount1; |
| | | public static int moneyType2; |
| | | public static int moneyNeedCount2; |
| | | public static string toggleText1; //选项1文字(如"代金礼券购买") |
| | | public static string toggleText2; //选项2文字(如"玄玉购买") |
| | | public static Action<bool, int> OnDualToggleConfirmEvent; //回调:(isOk, selectedMoneyType) |
| | | |
| | | // Recharge6 格式参数 |
| | | public static float payMethodMoney; |
| | | public static string payMethodTitle; |
| | | |
| | | public static void ShowPayMethodConfirm(int mType1, int needCnt1, string langKey1, |
| | | int mType2, int needCnt2, string langKey2, string content, |
| | | float _money, string _title, Action<bool, int> func) |
| | | { |
| | | moneyType1 = mType1; |
| | | moneyNeedCount1 = needCnt1; |
| | | toggleText1 = langKey1; |
| | | moneyType2 = mType2; |
| | | moneyNeedCount2 = needCnt2; |
| | | toggleText2 = langKey2; |
| | | OnDualToggleConfirmEvent = func; |
| | | payMethodMoney = _money; |
| | | payMethodTitle = _title; |
| | | generalContent = content; |
| | | if (!UIManager.Instance.IsOpened<PayMethodConfirmWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<PayMethodConfirmWin>(); |
| | | } |
| | | } |
| | | |
| | | //货币确认框:有显示勾选的 消耗元宝勾选类型 |
| | | public static void MoneyIconToggleConfirmByType(ToggleCheckType type, int moneyCnt, int _moneyType, string fullTip, Action func) |
| | | { |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | // 支付方式选择确认框:双货币(现金礼券/玄玉)二选一 |
| | | public class PayMethodConfirmWin : UIBase |
| | | { |
| | | [SerializeField] Text m_Content; |
| | | [SerializeField] Toggle m_Toggle1; //代金礼券 |
| | | [SerializeField] Toggle m_Toggle2; //玄玉 |
| | | [SerializeField] Text m_ToggleTxt1; |
| | | [SerializeField] Text m_ToggleTxt2; |
| | | [SerializeField] Button m_ConfirmBtn; |
| | | [SerializeField] Button m_CancelBtn; |
| | | [SerializeField] Image moneyIcon; |
| | | [SerializeField] Text moneyText; |
| | | |
| | | int m_SelectedMoneyType; |
| | | int m_NeedMoney1; |
| | | int m_NeedMoney2; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | m_ConfirmBtn.AddListener(OnConfirm); |
| | | m_CancelBtn.AddListener(OnCancel); |
| | | |
| | | m_Toggle1.onValueChanged.AddListener((bool isOn) => |
| | | { |
| | | if (isOn) |
| | | { |
| | | TrySelectMoneyType(ConfirmCancel.moneyType1, ConfirmCancel.moneyNeedCount1); |
| | | } |
| | | }); |
| | | m_Toggle2.onValueChanged.AddListener((bool isOn) => |
| | | { |
| | | if (isOn) |
| | | { |
| | | TrySelectMoneyType(ConfirmCancel.moneyType2, ConfirmCancel.moneyNeedCount2); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_NeedMoney1 = ConfirmCancel.moneyNeedCount1; |
| | | m_NeedMoney2 = ConfirmCancel.moneyNeedCount2; |
| | | |
| | | // 设置两个 Toggle 的文字 |
| | | m_ToggleTxt1.text = ConfirmCancel.toggleText1; |
| | | m_ToggleTxt2.text = ConfirmCancel.toggleText2; |
| | | |
| | | // 先设互斥 ToggleGroup,避免初始化时 listener 触发状态错乱 |
| | | var group = gameObject.GetComponent<ToggleGroup>(); |
| | | if (group == null) |
| | | { |
| | | group = gameObject.AddComponent<ToggleGroup>(); |
| | | } |
| | | group.allowSwitchOff = false; |
| | | m_Toggle1.group = group; |
| | | m_Toggle2.group = group; |
| | | |
| | | // 判断各货币是否充足 |
| | | long have1 = UIHelper.GetMoneyCnt(ConfirmCancel.moneyType1); |
| | | long have2 = UIHelper.GetMoneyCnt(ConfirmCancel.moneyType2); |
| | | bool enough1 = have1 >= m_NeedMoney1; |
| | | bool enough2 = have2 >= m_NeedMoney2; |
| | | |
| | | // 用 SetIsOnWithoutNotify 避免触发 listener,然后手动初始化 |
| | | if (enough1) |
| | | { |
| | | m_Toggle1.SetIsOnWithoutNotify(true); |
| | | m_Toggle2.SetIsOnWithoutNotify(false); |
| | | m_SelectedMoneyType = ConfirmCancel.moneyType1; |
| | | } |
| | | else if (enough2) |
| | | { |
| | | m_Toggle1.SetIsOnWithoutNotify(false); |
| | | m_Toggle2.SetIsOnWithoutNotify(true); |
| | | m_SelectedMoneyType = ConfirmCancel.moneyType2; |
| | | } |
| | | else |
| | | { |
| | | m_Toggle1.SetIsOnWithoutNotify(true); |
| | | m_Toggle2.SetIsOnWithoutNotify(false); |
| | | m_SelectedMoneyType = ConfirmCancel.moneyType1; |
| | | } |
| | | UpdateMoneyDisplay(m_SelectedMoneyType, m_SelectedMoneyType == ConfirmCancel.moneyType1 ? m_NeedMoney1 : m_NeedMoney2); |
| | | } |
| | | |
| | | void TrySelectMoneyType(int moneyType, int needCount) |
| | | { |
| | | 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; |
| | | } |
| | | else |
| | | { |
| | | m_Toggle2.isOn = true; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | m_SelectedMoneyType = moneyType; |
| | | UpdateMoneyDisplay(moneyType, needCount); |
| | | } |
| | | |
| | | void UpdateMoneyDisplay(int moneyType, int needCount) |
| | | { |
| | | moneyIcon.SetIconWithMoneyType(moneyType); |
| | | moneyText.text = UIHelper.ShowUseMoney(moneyType, needCount); |
| | | // 切换选项时同步刷新 Recharge6 内容(货币图标+名称变化) |
| | | m_Content.text = Language.Get("Recharge6", UIHelper.GetIconNameWithMoneyType(moneyType), ConfirmCancel.payMethodMoney, ConfirmCancel.payMethodTitle); |
| | | } |
| | | |
| | | private void OnConfirm() |
| | | { |
| | | CloseWindow(); |
| | | ConfirmCancel.OnDualToggleConfirmEvent?.Invoke(true, m_SelectedMoneyType); |
| | | } |
| | | |
| | | private void OnCancel() |
| | | { |
| | | CloseWindow(); |
| | | ConfirmCancel.OnDualToggleConfirmEvent?.Invoke(false, 0); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 50571468d2b150c4bb75e29bc2c7179d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | PrizeCoin = 120, //奖励点券数 120 |
| | | ExAttr11 = 121, //扩展属性11 121 现金代币(代金券) |
| | | ExAttr12 = 122, //扩展属性12 记录离开信息,主动离开次数*100 + 被踢次数*10 + 最后一次是否主动离开的,暂时最多累计记录到9次 |
| | | ExAttr13 = 123, //扩展属性13 服务器组ID |
| | | ExAttr13 = 123, //扩展属性13 现金礼券(货币类型97) |
| | | ExAttr14 = 124, //扩展属性14 124 |
| | | |
| | | SkillAtkRate = 125, ///战斗属性--技能攻击伤害 125 |
| | |
| | | {55, PlayerDataType.OSGalaScore}, |
| | | {57, PlayerDataType.QYScore}, |
| | | {58, PlayerDataType.heroSkin}, |
| | | {97, PlayerDataType.ExAttr13}, |
| | | {99, PlayerDataType.ExAttr11}, |
| | | }; |
| | | |
| | |
| | | //时装货币 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.heroSkin); |
| | | } |
| | | case 97: |
| | | { |
| | | //现金礼券(代金券) |
| | | return PlayerDatas.Instance.baseData.cashVoucher; |
| | | } |
| | | case 98: |
| | | { |
| | | //过期型代金券 |
| | |
| | | |
| | | public static int GetAllVourcher() |
| | | { |
| | | return (int)GetMoneyCnt(98) + (int)GetMoneyCnt(99); |
| | | return (int)GetMoneyCnt(97) + (int)GetMoneyCnt(98) + (int)GetMoneyCnt(99); |
| | | } |
| | | |
| | | //显示数量, 格式n/m, 足够绿色不足红色 |