Пример #1
0
        private FirstChargeAward ParseFirstChargeTemplate(GM.DataCache.DailyReward dict)
        {
            FirstChargeAward award = new FirstChargeAward();

            award.Type          = dict.Type;
            award.Title         = dict.Title;
            award.Desc          = dict.Desc;
            award.AwardItemList = new List <LTShowItemData>();
            string type  = dict.ItemType;
            string id    = dict.ItemId;
            int    count = dict.ItemNum;

            if (!string.IsNullOrEmpty(id))
            {
                award.AwardItemList.Add(new LTShowItemData(id, count, type));
            }
            type  = dict.ItemType2;
            id    = dict.ItemId2;
            count = dict.ItemNum2;
            if (!string.IsNullOrEmpty(id))
            {
                award.AwardItemList.Add(new LTShowItemData(id, count, type));
            }
            type  = dict.ItemType3;
            id    = dict.ItemId3;
            count = dict.ItemNum3;
            if (!string.IsNullOrEmpty(id))
            {
                award.AwardItemList.Add(new LTShowItemData(id, count, type));
            }
            type  = dict.ItemType4;
            id    = dict.ItemId4;
            count = dict.ItemNum4;
            if (!string.IsNullOrEmpty(id))
            {
                award.AwardItemList.Add(new LTShowItemData(id, count, type));
            }
            return(award);
        }
Пример #2
0
        public bool InitTemplateFromCache(GM.DataCache.Event evt)
        {
            if (evt == null)
            {
                EB.Debug.LogError("can not find sign_in_reward data");
                return(false);
            }

            SigninDic.Clear();
            var conditionSet = evt.GetArray(0);

            for (int i = 0; i < conditionSet.SignInRewardLength; ++i)
            {
                var d         = conditionSet.GetSignInReward(i);
                int month     = d.Month;
                int signCount = d.SignCount;
                if (!SigninDic.ContainsKey(month))
                {
                    SigninDic.Add(month, new List <SigninAward>());
                    if (signCount != 1)
                    {
                        EB.Debug.LogError("InitTemplateFromCache: signCount != 1");
                    }
                    SigninDic[month].Add(ParseSigninTemplate(d));
                }
                else
                {
                    if (signCount != SigninDic[month].Count + 1)
                    {
                        EB.Debug.LogError("InitTemplateFromCache: signCount!= SigninDic[month].Count+1");
                    }
                    SigninDic[month].Add(ParseSigninTemplate(d));
                }
            }

            EverydayAwardList.Clear();
            for (int i = 0; i < conditionSet.DailyRewardLength; ++i)
            {
                var    data = conditionSet.GetDailyReward(i);
                string type = data.Type;
                if (type == "first_charge")
                {
                    FirstChargeAwardData = ParseFirstChargeTemplate(data);
                }
                else if (type == "first_charge_1")
                {
                    FirstChargeAward1Data = ParseFirstChargeTemplate(data);
                }
                else if (type == "first_charge_2")
                {
                    FirstChargeAward2Data = ParseFirstChargeTemplate(data);
                }
                else if (type == "first_charge_3")
                {
                    FirstChargeAward3Data = ParseFirstChargeTemplate(data);
                }
                else if (type != "share_reward")
                {
                    EverydayAwardList.Add(ParseEverydayTemplate(data));
                }
            }

            return(true);
        }