9904 子 【BT0.1】【主干】新增每周、每月限购活动与活动显示限制 / 【BT0.1】【主干】新增每周、每月限购 - 周月礼包 可同步主干
# Conflicts:
# Core/GameEngine/Model/Config/CTGConfig.cs
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A1 10 充值购买次数信息 #tagMCCoinToGoldCountInfo
|
| | |
|
| | | // A1 10 充值购买次数信息 #tagMCCoinToGoldCountInfo
|
| | |
|
| | | public class HA110_tagMCCoinToGoldCountInfo : GameNetPackBasic {
|
| | | public byte RecordCount;
|
| | | public tagMCCoinToGoldCount[] CTGCountInfoList;
|
| | |
|
| | | public HA110_tagMCCoinToGoldCountInfo () {
|
| | | _cmd = (ushort)0xA110;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out RecordCount, vBytes, NetDataType.BYTE);
|
| | | CTGCountInfoList = new tagMCCoinToGoldCount[RecordCount];
|
| | | for (int i = 0; i < RecordCount; i ++) {
|
| | | CTGCountInfoList[i] = new tagMCCoinToGoldCount();
|
| | | TransBytes (out CTGCountInfoList[i].RecordID, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out CTGCountInfoList[i].TodayPayCount, vBytes, NetDataType.WORD);
|
| | | TransBytes (out CTGCountInfoList[i].TotalPayCount, vBytes, NetDataType.DWORD);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCCoinToGoldCount {
|
| | | public byte RecordID;
|
| | | public ushort TodayPayCount; // 今日已购买次数
|
| | | public uint TotalPayCount; // 累计总购买次数
|
| | | }
|
| | |
|
| | | }
|
| | | public class HA110_tagMCCoinToGoldCountInfo : GameNetPackBasic {
|
| | | public byte RecordCount;
|
| | | public tagMCCoinToGoldCount[] CTGCountInfoList;
|
| | |
|
| | | public HA110_tagMCCoinToGoldCountInfo () {
|
| | | _cmd = (ushort)0xA110;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out RecordCount, vBytes, NetDataType.BYTE);
|
| | | CTGCountInfoList = new tagMCCoinToGoldCount[RecordCount];
|
| | | for (int i = 0; i < RecordCount; i ++) {
|
| | | CTGCountInfoList[i] = new tagMCCoinToGoldCount();
|
| | | TransBytes (out CTGCountInfoList[i].RecordID, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out CTGCountInfoList[i].TodayPayCount, vBytes, NetDataType.WORD);
|
| | | TransBytes (out CTGCountInfoList[i].TotalPayCount, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out CTGCountInfoList[i].WeekPayCount, vBytes, NetDataType.WORD);
|
| | | TransBytes (out CTGCountInfoList[i].MonthPayCount, vBytes, NetDataType.WORD);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCCoinToGoldCount {
|
| | | public byte RecordID;
|
| | | public ushort TodayPayCount; // 今日已购买次数
|
| | | public uint TotalPayCount; // 累计总购买次数
|
| | | public ushort WeekPayCount; // 周总购买次数
|
| | | public ushort MonthPayCount; // 月总购买次数
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 25 每日礼包活动信息 #tagMCDailyGiftbagInfo |
| | | |
| | | public class HAA25_tagMCDailyGiftbagInfo : GameNetPackBasic { |
| | | public ushort LimitLV; // 限制等级 |
| | | public byte GiftbagCount; // 礼包数 |
| | | public tagMCDailyGiftbag[] GiftbagInfo; // 礼包信息 |
| | | |
| | | public HAA25_tagMCDailyGiftbagInfo () { |
| | | _cmd = (ushort)0xAA25; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out LimitLV, vBytes, NetDataType.WORD); |
| | | TransBytes (out GiftbagCount, vBytes, NetDataType.BYTE); |
| | | GiftbagInfo = new tagMCDailyGiftbag[GiftbagCount]; |
| | | for (int i = 0; i < GiftbagCount; i ++) { |
| | | GiftbagInfo[i] = new tagMCDailyGiftbag(); |
| | | TransBytes (out GiftbagInfo[i].GiftID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out GiftbagInfo[i].OrderInfoLen, vBytes, NetDataType.BYTE); |
| | | TransBytes (out GiftbagInfo[i].OrderInfo, vBytes, NetDataType.Chars, GiftbagInfo[i].OrderInfoLen); |
| | | TransBytes (out GiftbagInfo[i].BuyCountLimit, vBytes, NetDataType.BYTE); |
| | | TransBytes (out GiftbagInfo[i].RMB, vBytes, NetDataType.DWORD); |
| | | TransBytes (out GiftbagInfo[i].GiftItemCount, vBytes, NetDataType.BYTE); |
| | | GiftbagInfo[i].ItemInfo = new tagMCDailyGiftbagItem[GiftbagInfo[i].GiftItemCount]; |
| | | for (int j = 0; j < GiftbagInfo[i].GiftItemCount; j ++) { |
| | | GiftbagInfo[i].ItemInfo[j] = new tagMCDailyGiftbagItem(); |
| | | TransBytes (out GiftbagInfo[i].ItemInfo[j].ItemID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out GiftbagInfo[i].ItemInfo[j].ItemCount, vBytes, NetDataType.WORD); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public struct tagMCDailyGiftbag { |
| | | public uint GiftID; //礼包ID,0为免费 |
| | | public byte OrderInfoLen; |
| | | public string OrderInfo; //商品编号 |
| | | public byte BuyCountLimit; //限购数 |
| | | public uint RMB; //所需RMB,元 |
| | | public byte GiftItemCount; // 礼包物品数 |
| | | public tagMCDailyGiftbagItem[] ItemInfo; // 物品信息 |
| | | } |
| | | |
| | | public struct tagMCDailyGiftbagItem { |
| | | public uint ItemID; |
| | | public ushort ItemCount; |
| | | } |
| | | |
| | | } |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 25 每日礼包活动信息 #tagMCDailyGiftbagInfo
|
| | |
|
| | | public class HAA25_tagMCDailyGiftbagInfo : GameNetPackBasic {
|
| | | public ushort LimitLV; // 限制等级
|
| | | public byte GiftbagCount; // 礼包数
|
| | | public tagMCDailyGiftbag[] GiftbagInfo; // 礼包信息
|
| | |
|
| | | public HAA25_tagMCDailyGiftbagInfo () {
|
| | | _cmd = (ushort)0xAA25;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out LimitLV, vBytes, NetDataType.WORD);
|
| | | TransBytes (out GiftbagCount, vBytes, NetDataType.BYTE);
|
| | | GiftbagInfo = new tagMCDailyGiftbag[GiftbagCount];
|
| | | for (int i = 0; i < GiftbagCount; i ++) {
|
| | | GiftbagInfo[i] = new tagMCDailyGiftbag();
|
| | | TransBytes (out GiftbagInfo[i].GiftID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out GiftbagInfo[i].OrderInfoLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out GiftbagInfo[i].OrderInfo, vBytes, NetDataType.Chars, GiftbagInfo[i].OrderInfoLen);
|
| | | TransBytes (out GiftbagInfo[i].BuyCountLimit, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out GiftbagInfo[i].RMB, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out GiftbagInfo[i].GiftItemCount, vBytes, NetDataType.BYTE);
|
| | | GiftbagInfo[i].ItemInfo = new tagMCDailyGiftbagItem[GiftbagInfo[i].GiftItemCount];
|
| | | for (int j = 0; j < GiftbagInfo[i].GiftItemCount; j ++) {
|
| | | GiftbagInfo[i].ItemInfo[j] = new tagMCDailyGiftbagItem();
|
| | | TransBytes (out GiftbagInfo[i].ItemInfo[j].ItemID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out GiftbagInfo[i].ItemInfo[j].ItemCount, vBytes, NetDataType.WORD);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCDailyGiftbag {
|
| | | public uint GiftID; //礼包ID,0为免费
|
| | | public byte OrderInfoLen;
|
| | | public string OrderInfo; //商品编号
|
| | | public byte BuyCountLimit; //限购数
|
| | | public uint RMB; //所需RMB,分
|
| | | public byte GiftItemCount; // 礼包物品数
|
| | | public tagMCDailyGiftbagItem[] ItemInfo; // 物品信息
|
| | | }
|
| | |
|
| | | public struct tagMCDailyGiftbagItem {
|
| | | public uint ItemID;
|
| | | public ushort ItemCount;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return shopItemlist;
|
| | | }
|
| | |
|
| | |
|
| | | public List<int[]> GetShopItemlistEx(StoreConfig storeConfig)
|
| | | {
|
| | | if (storeConfig == null) return null;
|
| | |
|
| | | List<int[]> shopItemlist = new List<int[]>();
|
| | | if (storeConfig.ItemID != 0)
|
| | | {
|
| | | int replaceId = GetReplaceId(storeConfig.ID, storeConfig.ItemID);
|
| | | shopItemlist.Add(new int[] { replaceId, storeConfig.ItemCnt, 0 });
|
| | | }
|
| | | var extraItem = JsonMapper.ToObject<int[][]>(storeConfig.ItemListEx);
|
| | | for (int i = 0; i < extraItem.Length; i++)
|
| | | {
|
| | | shopItemlist.Add(extraItem[i]);
|
| | | }
|
| | | return shopItemlist;
|
| | | }
|
| | |
|
| | | public bool TryGetShopItemInfo(StoreFunc _type, int _id, out List<ShopItemInfo> _shopItems)
|
| | | {
|
| | | _shopItems = null;
|
| | |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | |
| | | using UnityEngine.UI;
|
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class DayGoods : MonoBehaviour |
| | | { |
| | | [SerializeField] LimitedTimeItemInfo[] m_Items; |
| | | [SerializeField] Text m_GoodsName; |
| | | [SerializeField] Text m_BuyLimitCnt; //限购 |
| | | [SerializeField] Button m_Buy; |
| | | [SerializeField] Text m_BuyText; |
| | | [SerializeField] Text m_BuyText; //免费 货币 充值额度 |
| | | [SerializeField] Image m_SellOut; |
| | | |
| | | [SerializeField] Image m_MustBuy;
|
| | |
|
| | | StoreModel storeModel
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<StoreModel>(); }
|
| | | } |
| | | DayPackageItemClassModel dayPackageItemModel { get { return ModelCenter.Instance.GetModel<DayPackageItemClassModel>(); } } |
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } |
| | | |
| | | float m_time = 0; |
| | | public void Display(int goodsID) |
| | | { |
| | | string title; |
| | | var goods = dayPackageItemModel.m_RechargeDict[goodsID]; |
| | | string title;
|
| | | DayPackageItemClassModel.DayGift goods;
|
| | |
|
| | | if (dayPackageItemModel.selectIndex == 0)
|
| | | { |
| | | goods = dayPackageItemModel.m_RechargeDict[goodsID]; |
| | | } |
| | | else if(dayPackageItemModel.selectIndex == 1)
|
| | | { |
| | | goods = dayPackageItemModel.m_WeekRechargeDict[goodsID]; |
| | | } |
| | | else
|
| | | { |
| | | goods = dayPackageItemModel.m_MonthRechargeDict[goodsID]; |
| | | } |
| | | |
| | | if (goodsID == 0) |
| | | { |
| | | title = Language.Get("DayGoods_0"); |
| | |
| | | title = Language.Get("DayGoods_1", (goods.money/100.0).ToString("0.##")); |
| | | } |
| | | |
| | | m_GoodsName.text = title; |
| | | m_BuyLimitCnt.text = Language.Get("LimitGiftCnt", goods.buyCountLimit - goods.getCount); |
| | | |
| | | m_Buy.SetActive(goods.getCount == 0); |
| | | m_SellOut.SetActive(goods.getCount > 0); |
| | | m_Buy.SetActive(goods.getCount < goods.buyCountLimit); |
| | | m_SellOut.SetActive(goods.getCount >= goods.buyCountLimit); |
| | | |
| | | for (int i = 0; i < m_Items.Length; i++) |
| | | { |
| | |
| | | }); |
| | | |
| | | } |
| | | if (goods.getCount == 0) |
| | | { |
| | | m_BuyText.text = Language.Get(goodsID == 0 ? "Z2014" : "Z2015"); |
| | | m_Buy.SetListener(() => { |
| | | int moneyType = 0; |
| | | int.TryParse(goods.orderInfo, out moneyType); |
| | | |
| | | if (goodsID == 0) |
| | | { |
| | | dayPackageItemModel.RequestReward(); |
| | | } |
| | | else |
| | | { |
| | | m_Buy.interactable = false; |
| | | m_MustBuy.SetActive(goods.money == 0); |
| | | |
| | | vipModel.OpenFreePlat(title, (float)System.Math.Round(goods.money/100.0, 2), goods.orderInfo); |
| | | } |
| | | |
| | | }); |
| | | if (goods.money == 0)
|
| | | {
|
| | | m_BuyText.text = Language.Get("Z2014"); |
| | | } |
| | | else if (moneyType != 0)
|
| | | { |
| | | m_BuyText.text = goods.money + RichTextMsgReplaceConfig.GetRichReplace("MONEY", moneyType); |
| | | } |
| | | else
|
| | | { |
| | | m_BuyText.text = Language.Get("PayMoneyNum", (goods.money / 100.0).ToString("0.##")); |
| | | } |
| | | |
| | | m_Buy.SetListener(() => { |
| | | |
| | | if (goodsID == 0) |
| | | { |
| | | dayPackageItemModel.RequestReward(); |
| | | } |
| | | else if (moneyType != 0)
|
| | | { |
| | | storeModel.SendBuyShopItem(StoreConfig.Get(goodsID - 100000000), 1); |
| | | } |
| | | else |
| | | { |
| | | m_Buy.interactable = false; |
| | | |
| | | vipModel.OpenFreePlat(title, (float)System.Math.Round(goods.money / 100.0, 2), goods.orderInfo); |
| | | } |
| | | |
| | | }); |
| | | |
| | | } |
| | | |
| | |
| | | if (m_Buy.interactable == false) |
| | | { |
| | | m_time += Time.deltaTime; |
| | | int showTime = (int)(8 - m_time); |
| | | int showTime = (int)(3 - m_time); |
| | | if (showTime <= 0) |
| | | { |
| | | m_Buy.interactable = true; |
| | | m_Buy.SetColorful(m_BuyText, true); |
| | | m_BuyText.text = Language.Get("Z2015"); |
| | | m_time = 0; |
| | | } |
| | | else |
| | | { |
| | | m_Buy.SetColorful(m_BuyText, false); |
| | | m_BuyText.text = Language.Get("Market_Text_31" ) + "(" + showTime.ToString() + ")"; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | public class DayPackageItemCell : CellView |
| | | { |
| | | [SerializeField] DayPackageItemBehaviour m_LimitedTimePackage; |
| | | [SerializeField] DayGoods[] goods; |
| | | |
| | | DayPackageItemClassModel dayPackageItemModel { get { return ModelCenter.Instance.GetModel<DayPackageItemClassModel>(); } } |
| | | public void Display(int index) |
| | | { |
| | | m_LimitedTimePackage.Display(index); |
| | | {
|
| | | List<int> showIDs = new List<int>(); |
| | | if (dayPackageItemModel.selectIndex == 0) |
| | | { |
| | | showIDs = dayPackageItemModel.recordIDs; |
| | | } |
| | | else if (dayPackageItemModel.selectIndex == 1) |
| | | { |
| | | showIDs = dayPackageItemModel.weekStoreListSort; |
| | | } |
| | | else if (dayPackageItemModel.selectIndex == 2) |
| | | { |
| | | showIDs = dayPackageItemModel.monthStoreListSort; |
| | | } |
| | | |
| | | foreach (var goods in goods) |
| | | { |
| | | if (index >= showIDs.Count) |
| | | { |
| | | goods.SetActive(false); |
| | | continue; |
| | | } |
| | | goods.SetActive(true); |
| | | goods.Display(showIDs[index]); |
| | | index++; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using LitJson; |
| | | |
| | | using System.Linq; |
| | | |
| | | public class DayPackageItemClassModel : Model, IPlayerLoginOk, IOpenServerActivity, IBeforePlayerDataInitialize |
| | | { |
| | | int m_SelectIndex = 0; |
| | | VipModel vipModel |
| | | { |
| | | get { return ModelCenter.Instance.GetModel<VipModel>(); } |
| | | }
|
| | |
|
| | | StoreModel storeModel |
| | | { |
| | | get { return ModelCenter.Instance.GetModel<StoreModel>(); } |
| | | } |
| | | |
| | | // 每日礼包由服务端通知,每周/月礼包取充值表和商城表 |
| | | // 0 每日礼包 1 每周礼包 2 每月礼包 |
| | | int m_SelectIndex = 0; |
| | | public int selectIndex |
| | | { |
| | | get { return m_SelectIndex; } |
| | |
| | | m_SelectIndex = value; |
| | | if (selectUpdate != null) |
| | | { |
| | | selectUpdate(value); |
| | | selectUpdate(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | public int getCount; // 已获得次数 |
| | | public List<int[]> items; |
| | | public int money; |
| | | public int money; //orderInfo是数字字符串代表货币类型,否则代表充值 单位分 |
| | | public string orderInfo; |
| | | public int buyCountLimit; |
| | | } |
| | | |
| | | |
| | | public List<int> recordIDs = new List<int>(); |
| | | public Dictionary<int, DayGift> m_RechargeDict = new Dictionary<int, DayGift>(); |
| | | public event Action<int> selectUpdate; |
| | | public Dictionary<int, DayGift> m_WeekRechargeDict = new Dictionary<int, DayGift>(); |
| | | public Dictionary<int, DayGift> m_MonthRechargeDict = new Dictionary<int, DayGift>();
|
| | |
|
| | | public int weekBuyType = 0;
|
| | | public int monthBuyType = 0;
|
| | | public int[] weekStoreList;
|
| | | public int[] monthStoreList;
|
| | | public List<int> weekStoreListSort = new List<int>(); //显示顺序
|
| | | public List<int> monthStoreListSort = new List<int>(); |
| | | |
| | | |
| | | public event Action selectUpdate; |
| | | public event Action<int> onStateUpdate; |
| | | public event Action onDayGoodsUpdate; |
| | | public override void Init() |
| | | { |
| | | OpenServerActivityCenter.Instance.Register(23, this); |
| | | //recordIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("DayFreeGoldGift").Numerical2); |
| | | //if (!m_RechargeDict.ContainsKey(0)) |
| | | //{ |
| | | // var _sortArray = JsonMapper.ToObject<int[][]>(FuncConfigConfig.Get("DayFreeGoldGift").Numerical1); |
| | | |
| | | // foreach (int recordID in recordIDs) |
| | | // { |
| | | // if (recordID == 0) |
| | | // { |
| | | // m_RechargeDict[recordID] = new DayGift() |
| | | // { |
| | | // title = "免费礼包", |
| | | // items = _sortArray, |
| | | // getCount = 0, |
| | | // money = 0, |
| | | // }; |
| | | // } |
| | | // else |
| | | // { |
| | | // var ctg = CTGConfig.Get(recordID); |
| | | // OrderInfoConfig config; |
| | | // vipModel.TryGetOrderInfo(recordID, out config); |
| | | // m_RechargeDict[recordID] = new DayGift() |
| | | // { |
| | | // title = ctg.Title, |
| | | // items = LitJson.JsonMapper.ToObject<int[][]>(ctg.GainItemList), |
| | | // getCount = 0, |
| | | // money = (int)config.PayRMBNum, |
| | | // orderInfo = config.OrderInfo, |
| | | // }; |
| | | // } |
| | | // } |
| | | //} |
| | | ParseConfig(); |
| | | } |
| | | private const int Redpoint_key1 = 20923; |
| | | public Redpoint redPointStre1 = new Redpoint(209, Redpoint_key1); //每日免费礼包 |
| | | public Redpoint redPointStre1 = new Redpoint(209, Redpoint_key1); |
| | | public Redpoint redPoint1 = new Redpoint(Redpoint_key1, Redpoint_key1 * 10); //每日免费礼包 |
| | | public Redpoint redPoint2 = new Redpoint(Redpoint_key1, Redpoint_key1 * 10 + 1); //每周免费礼包 |
| | | public Redpoint redPoint3 = new Redpoint(Redpoint_key1, Redpoint_key1 * 10 + 2); //每月免费礼包 |
| | | public bool IsOpen |
| | | { |
| | | get |
| | |
| | | { |
| | | m_RechargeDict.Clear(); |
| | | recordIDs.Clear(); |
| | | m_WeekRechargeDict.Clear(); |
| | | m_MonthRechargeDict.Clear(); |
| | | } |
| | | |
| | | |
| | |
| | | else |
| | | redPointStre1.state = RedPointState.None; |
| | | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | void ParseConfig()
|
| | | {
|
| | | var config = FuncConfigConfig.Get("BuyPackage"); |
| | | weekStoreList = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | monthStoreList = JsonMapper.ToObject<int[]>(config.Numerical2); |
| | | weekBuyType = int.Parse(config.Numerical3); |
| | | monthBuyType = int.Parse(config.Numerical4);
|
| | |
|
| | | // 商店购买也存入充值 orderInfo存储货币类型
|
| | | foreach (var id in weekStoreList)
|
| | | {
|
| | | weekStoreListSort.Add(id + 100000000);
|
| | | StoreConfig storeCfg = StoreConfig.Get(id);
|
| | | m_WeekRechargeDict[id + 100000000] = new DayGift()
|
| | | {
|
| | | money = storeCfg.MoneyNumber,
|
| | | orderInfo = storeCfg.MoneyType.ToString(),
|
| | | items = storeModel.GetShopItemlistEx(storeCfg),
|
| | | buyCountLimit = storeCfg.PurchaseNumber[0],
|
| | | };
|
| | | }
|
| | | foreach (var id in monthStoreList)
|
| | | {
|
| | | monthStoreListSort.Add(id + 100000000);
|
| | | StoreConfig storeCfg = StoreConfig.Get(id);
|
| | | m_MonthRechargeDict[id + 100000000] = new DayGift()
|
| | | {
|
| | | money = storeCfg.MoneyNumber,
|
| | | orderInfo = storeCfg.MoneyType.ToString(),
|
| | | items = storeModel.GetShopItemlistEx(storeCfg),
|
| | | buyCountLimit = storeCfg.PurchaseNumber[0],
|
| | | };
|
| | | }
|
| | |
|
| | | var list = vipModel.GetCTGConfigs(VersionConfig.Get().appId);
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var ctgConfig = CTGConfig.Get(list[i]);
|
| | | if (ctgConfig.PayType == weekBuyType)
|
| | | {
|
| | | OrderInfoConfig orderCfg;
|
| | | vipModel.TryGetOrderInfo(ctgConfig.RecordID, out orderCfg);
|
| | | m_WeekRechargeDict[ctgConfig.RecordID] = new DayGift()
|
| | | {
|
| | | money = (int)orderCfg.PayRMBNum * 100,
|
| | | orderInfo = orderCfg.OrderInfo,
|
| | | items = JsonMapper.ToObject<int[][]>(ctgConfig.GainItemList).ToList(),
|
| | | buyCountLimit = ctgConfig.WeekBuyCount,
|
| | | };
|
| | | weekStoreListSort.Add(ctgConfig.RecordID);
|
| | | }
|
| | | else if (ctgConfig.PayType == monthBuyType)
|
| | | {
|
| | | OrderInfoConfig orderCfg;
|
| | | vipModel.TryGetOrderInfo(ctgConfig.RecordID, out orderCfg);
|
| | | m_MonthRechargeDict[ctgConfig.RecordID] = new DayGift()
|
| | | {
|
| | | money = (int)orderCfg.PayRMBNum * 100,
|
| | | orderInfo = orderCfg.OrderInfo,
|
| | | items = JsonMapper.ToObject<int[][]>(ctgConfig.GainItemList).ToList(),
|
| | | buyCountLimit = ctgConfig.MonthBuyCount,
|
| | | };
|
| | | monthStoreListSort.Add(ctgConfig.RecordID);
|
| | | }
|
| | | } |
| | | } |
| | | //public void UpdateRechargeCount(HA110_tagMCCoinToGoldCountInfo package) |
| | | //{ |
| | | // for (int i = 0; i < package.RecordCount; i++) |
| | | // { |
| | | // var _data = package.CTGCountInfoList[i]; |
| | | // if (m_RechargeDict.ContainsKey(_data.RecordID)) |
| | | // m_RechargeDict[_data.RecordID].getCount = _data.TodayPayCount; |
| | | // } |
| | | // if (onStateUpdate != null) onStateUpdate(selectIndex); |
| | | //} |
| | | |
| | | //public void FreeGoldGiftState(HAA24_tagMCDayFreeGoldGiftState package) |
| | | //{ |
| | | |
| | | // m_RechargeDict[0].getCount = package.DayFreeGoldGiftState; |
| | | |
| | | // if (onStateUpdate != null) onStateUpdate(selectIndex); |
| | | |
| | | // IsShowTip(); |
| | | //} |
| | | |
| | | public void DayGoodsInfo(HAA25_tagMCDailyGiftbagInfo pack) |
| | | { |
| | |
| | | money = (int)goods.RMB, |
| | | orderInfo = goods.OrderInfo, |
| | | items = tmpItems, |
| | | buyCountLimit = (int)goods.BuyCountLimit, |
| | | }; |
| | | |
| | | |
| | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | // 每日礼包由服务端通知,每周/月礼包取充值表和商城表 |
| | | public class DayPackageWin : Window |
| | | { |
| | | [SerializeField] DayGoods[] m_DayGoods; |
| | | |
| | | [SerializeField] ScrollerController scroller; |
| | | [SerializeField] Button[] m_TimeBtn; |
| | | |
| | | #region Built-in |
| | | DayPackageItemClassModel dayPackageItemModel { get { return ModelCenter.Instance.GetModel<DayPackageItemClassModel>(); } } |
| | | |
| | | DayPackageItemClassModel dayPackageItemModel { get { return ModelCenter.Instance.GetModel<DayPackageItemClassModel>(); } }
|
| | | StoreModel storeModel
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<StoreModel>(); }
|
| | | }
|
| | |
|
| | | VipModel vipModel
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<VipModel>(); }
|
| | | } |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | |
| | | for (int i = 0; i < m_TimeBtn.Length; i++)
|
| | | { |
| | | int index = i; |
| | | m_TimeBtn[i].AddListener(() => {
|
| | | dayPackageItemModel.selectIndex = index; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | dayPackageItemModel.onDayGoodsUpdate += onDayGoodsUpdate; |
| | | scroller.OnRefreshCell += Scroller_OnRefreshCell; |
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent; |
| | | vipModel.rechargeCountEvent += VipModel_rechargeCountEvent; |
| | | dayPackageItemModel.selectUpdate += OnSelect; |
| | | RefreshBuyShopLimitEvent(); |
| | | VipModel_rechargeCountEvent(0); |
| | | DisPlay(); |
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void VipModel_rechargeCountEvent(int obj)
|
| | | {
|
| | | foreach (var item in dayPackageItemModel.m_WeekRechargeDict)
|
| | | { |
| | | var info = item.Value; |
| | | if (info.orderInfo.Length > 3)
|
| | | { |
| | | VipModel.RechargeCount rechargeCount; |
| | | if (vipModel.TryGetRechargeCount(vipModel.orderInfoToCTGID[info.orderInfo], out rechargeCount))
|
| | | { |
| | | dayPackageItemModel.m_WeekRechargeDict[item.Key].getCount = rechargeCount.weekPayCount;
|
| | | } |
| | | } |
| | | }
|
| | |
|
| | | foreach (var item in dayPackageItemModel.m_MonthRechargeDict)
|
| | | { |
| | | var info = item.Value; |
| | | if (info.orderInfo.Length > 3)
|
| | | { |
| | | VipModel.RechargeCount rechargeCount; |
| | | if (vipModel.TryGetRechargeCount(vipModel.orderInfoToCTGID[info.orderInfo], out rechargeCount))
|
| | | {
|
| | | dayPackageItemModel.m_MonthRechargeDict[item.Key].getCount = rechargeCount.monthPayCount;
|
| | | } |
| | | } |
| | | }
|
| | |
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | private void Scroller_OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | if (type == ScrollerDataType.Header)
|
| | | {
|
| | | var header = cell as DayPackageItemCell;
|
| | | header.Display(cell.index);
|
| | | }
|
| | | }
|
| | |
|
| | | private void onDayGoodsUpdate() |
| | | { |
| | | DisPlay(); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | private void DisPlay() |
| | | { |
| | | int index = -1; |
| | | foreach (var goods in m_DayGoods) |
| | | { |
| | | index++; |
| | | if (index >= dayPackageItemModel.recordIDs.Count) |
| | | { |
| | | goods.SetActive(false); |
| | | continue; |
| | | } |
| | | goods.SetActive(true); |
| | | goods.Display(dayPackageItemModel.recordIDs[index]); |
| | | } |
| | | |
| | | |
| | | ShowButton(); |
| | | CreateScroller(); |
| | | } |
| | | |
| | | |
| | |
| | | protected override void OnPreClose() |
| | | { |
| | | dayPackageItemModel.onDayGoodsUpdate -= onDayGoodsUpdate; |
| | | |
| | | storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
|
| | | scroller.OnRefreshCell -= Scroller_OnRefreshCell; |
| | | vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent; |
| | | dayPackageItemModel.selectUpdate -= OnSelect; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | void OnSelect()
|
| | | {
|
| | | ShowButton();
|
| | | CreateScroller(); |
| | | } |
| | | |
| | | void ShowButton()
|
| | | { |
| | | for (int i = 0; i < m_TimeBtn.Length; i++)
|
| | | { |
| | | m_TimeBtn[i].FindComponent("Image", "select").SetActive(dayPackageItemModel.selectIndex == i); |
| | | } |
| | | } |
| | | |
| | | void RefreshBuyShopLimitEvent()
|
| | | {
|
| | | foreach (var item in dayPackageItemModel.m_WeekRechargeDict)
|
| | | { |
| | | var info = item.Value; |
| | | if (info.orderInfo.Length < 3)
|
| | | { |
| | | var shopInfo = storeModel.GetBuyShopLimit((uint)(item.Key - 100000000)); |
| | | if (shopInfo != null) |
| | | {
|
| | | dayPackageItemModel.m_WeekRechargeDict[item.Key].getCount = shopInfo.BuyCnt;
|
| | | } |
| | | } |
| | | } |
| | | |
| | | foreach (var item in dayPackageItemModel.m_MonthRechargeDict)
|
| | | { |
| | | var info = item.Value; |
| | | if (info.orderInfo.Length < 3)
|
| | | { |
| | | var shopInfo = storeModel.GetBuyShopLimit((uint)(item.Key - 100000000)); |
| | | if (shopInfo != null) |
| | | {
|
| | | dayPackageItemModel.m_MonthRechargeDict[item.Key].getCount = shopInfo.BuyCnt;
|
| | | } |
| | | } |
| | | } |
| | | |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | void CreateScroller()
|
| | | {
|
| | | scroller.Refresh(); |
| | | List<int> showIDs = new List<int>(); |
| | | if (dayPackageItemModel.selectIndex == 0)
|
| | | { |
| | | showIDs = dayPackageItemModel.recordIDs; |
| | | } |
| | | else if (dayPackageItemModel.selectIndex == 1)
|
| | | { |
| | | showIDs = dayPackageItemModel.weekStoreListSort; |
| | | } |
| | | else if (dayPackageItemModel.selectIndex == 2)
|
| | | { |
| | | showIDs = dayPackageItemModel.monthStoreListSort; |
| | | } |
| | | |
| | | for (int i = 0; i < showIDs.Count; i++)
|
| | | { |
| | | if (i % 3 == 0)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | |
| | | } |
| | | scroller.Restart(); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | m_OrderInfoDict.Add(configs[i].AppId, list);
|
| | | }
|
| | | list.Add(configs[i]);
|
| | |
|
| | | if (configs[i].AppId == VersionConfig.Get().appId)
|
| | | { |
| | | orderInfoToCTGID[configs[i].OrderInfo] = configs[i].CTGID;
|
| | | }
|
| | |
|
| | | if (configs[i].CTGID == 0)
|
| | | {
|
| | | continue;
|
| | |
| | | public Dictionary<int, List<Item>> m_RechargeGainItemDict { get; private set; }
|
| | | private Dictionary<int, RechargeCount> m_RechargeCountDict = new Dictionary<int, RechargeCount>();
|
| | | Dictionary<string, List<OrderInfoConfig>> m_OrderInfoDict = new Dictionary<string, List<OrderInfoConfig>>();
|
| | | public Dictionary<string, int> orderInfoToCTGID = new Dictionary<string, int>();
|
| | |
|
| | | public int presentSelectRechargeId { get; private set; }
|
| | | public bool beforeRecharge { get; private set; }
|
| | | private int beforeVipLv { get; set; }
|
| | |
| | | {
|
| | | todayCount = _data.TodayPayCount,
|
| | | totalCount = (int)_data.TotalPayCount,
|
| | | };
|
| | | weekPayCount = _data.WeekPayCount,
|
| | | monthPayCount = _data.MonthPayCount,
|
| | |
|
| | | };
|
| | | if (rechargeCountEvent != null)
|
| | | {
|
| | | rechargeCountEvent(_data.RecordID);
|
| | |
| | | {
|
| | | public int todayCount;
|
| | | public int totalCount;
|
| | | public int weekPayCount;
|
| | | public int monthPayCount;
|
| | | }
|
| | |
|
| | | public int FirstGoldServerDay = 0; //0表示未充值,首充时为开服第几天(openday+1)
|