示例#1
0
        private BattlePassTemplate ParseBattlePass(GM.DataCache.BattlePass obj)
        {
            BattlePassTemplate tpl = new BattlePassTemplate();

            if (obj == null || string.IsNullOrEmpty(obj.Id))
            {
                return(null);
            }
            tpl.id     = int.Parse(obj.Id);
            tpl.awards = new List <LTShowItemData>();
            if (!string.IsNullOrEmpty(obj.Ri1))
            {
                tpl.awards.Add(new LTShowItemData(obj.Ri1, obj.Rn1, obj.Rt1));
            }
            if (!string.IsNullOrEmpty(obj.Ri2))
            {
                tpl.awards.Add(new LTShowItemData(obj.Ri2, obj.Rn2, obj.Rt2));
            }
            if (!string.IsNullOrEmpty(obj.Ri3))
            {
                tpl.awards.Add(new LTShowItemData(obj.Ri3, obj.Rn3, obj.Rt3));
            }
            if (!string.IsNullOrEmpty(obj.Ri4))
            {
                tpl.awards.Add(new LTShowItemData(obj.Ri4, obj.Rn4, obj.Rt4));
            }

            return(tpl);
        }
示例#2
0
        private bool InitBattlePass(GM.DataCache.ConditionTask tasks)
        {
            if (tasks == null)
            {
                EB.Debug.LogError("InitBattlePass: BattlePass is null");
                return(false);
            }

            mBattlePassDic = new Dictionary <int, BattlePassTemplate>();
            for (int i = 0; i < tasks.BattlePassLength; ++i)
            {
                BattlePassTemplate data = ParseBattlePass(tasks.GetBattlePass(i));
                if (data != null && data.id > 0)
                {
                    mBattlePassDic.Add(data.id, data);
                }
            }

            return(true);
        }