public LvlUpAwardPanel(Transform trans) : base(trans)
        {
            this.root           = trans;
            this.lvlUpAwardsDic = new Dictionary <uint, awardCenterItem4zhuan>();
            this.itemsParent    = this.root.FindChild("awardItems/content");
            List <WelfareModel.itemWelfareData> levelReward = ModelBase <WelfareModel> .getInstance().getLevelReward();

            foreach (WelfareModel.itemWelfareData current in levelReward)
            {
                WelfareModel.itemWelfareData iwd = current;
                iwd.desc = this.strDesc;
                a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.itemId);

                GameObject gameObject = IconImageMgr.getInstance().creatItemAwardCenterIcon(itemDataById);
                gameObject.name = "itemWelfare";
                gameObject.transform.SetParent(this.itemsParent);
                gameObject.transform.localScale = Vector3.one;
                awardCenterItem4zhuan value = new awardCenterItem4zhuan(gameObject.transform, iwd);
                uint id = current.itemId;
                new BaseButton(gameObject.transform.FindChild("icon"), 1, 1).onClick = delegate(GameObject oo)
                {
                    bool flag = a3_awardCenter.instan;
                    if (flag)
                    {
                        a3_awardCenter.instan.showtip(id);
                    }
                };
                this.lvlUpAwardsDic.Add(current.id, value);
            }
            this.itemsParent.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(100 * (this.lvlUpAwardsDic.Count + 2)));
            BaseProxy <welfareProxy> .getInstance().addEventListener(welfareProxy.UPLEVELAWARD, new Action <GameEvent>(this.onUpLevelAward));
        }
Exemple #2
0
        public PayPanel(Transform trans) : base(trans)
        {
            this.root = trans;
            this.consumptionAwardsDic = new Dictionary <uint, awardCenterItem4Consumption>();
            this.itemsParent          = this.root.FindChild("awardItems/content");
            List <WelfareModel.itemWelfareData> cumulateConsumption = ModelBase <WelfareModel> .getInstance().getCumulateConsumption();

            foreach (WelfareModel.itemWelfareData current in cumulateConsumption)
            {
                WelfareModel.itemWelfareData iwd = current;
                iwd.desc = this.strDesc;
                a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.itemId);

                iwd.awardName = itemDataById.item_name;
                GameObject gameObject = IconImageMgr.getInstance().creatItemAwardCenterIcon(itemDataById);
                gameObject.name = "itemWelfare";
                gameObject.transform.SetParent(this.itemsParent);
                gameObject.transform.localScale = Vector3.one;
                uint id = current.itemId;
                new BaseButton(gameObject.transform.FindChild("icon"), 1, 1).onClick = delegate(GameObject oo)
                {
                    bool flag = a3_awardCenter.instan;
                    if (flag)
                    {
                        a3_awardCenter.instan.showtip(id);
                    }
                };
                awardCenterItem4Consumption value = new awardCenterItem4Consumption(gameObject.transform, iwd);
                this.consumptionAwardsDic.Add(current.id, value);
            }
            this.itemsParent.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(100 * (this.consumptionAwardsDic.Count + 2)));
            BaseProxy <welfareProxy> .getInstance().addEventListener(welfareProxy.ACCUMULATECONSUMPTION, new Action <GameEvent>(this.onAccumulateConsumption));
        }
Exemple #3
0
        void createAward(uint dayCount)
        {
            //for (int n=0;n< objlist.Count;n++) {
            //    objlist[n].des();
            //}
            //objlist.Clear();
            awdlist.Clear();
            List <WelfareModel.itemWelfareData> iwdList = WelfareModel.getInstance().getDailyLogin();

            for (int i = 0; i < iwdList.Count; i++)
            {
                if (i < 7)
                {
                    WelfareModel.itemWelfareData iwd = iwdList[i];
                    a3_ItemData itemData             = a3_BagModel.getInstance().getItemDataById(iwd.itemId);
                    bool        claim  = false;
                    bool        canget = false;
                    if (i < dayCount)
                    {
                        claim = true;
                    }

                    if (i == dayCount)
                    {
                        canget = true;
                    }

                    GameObject goItemAward = transform.FindChild("body/awardItems/content/itemAward" + (i + 1)).gameObject;

                    itemAwardData iad = new itemAwardData();
                    iad.parent = _content;
                    iad.trSelf = goItemAward.transform;
                    //iad.trAward = goIcon.transform;./seven_day 1
                    iad.dayNum    = (uint)i;
                    iad.dayCount  = dayCount;
                    iad.isChecked = claim;
                    iad.canGet    = canget;
                    iad.name      = itemData.item_name;
                    iad.awardnum  = iwd.num;
                    // itemAward ad = new itemAward(iad);
                    // objlist.Add(ad);
                    SetAwd(iad);
                    awdlist[i + 1] = iad;
                }
            }
        }
        public awardCenterItem4Consumption(Transform trans, WelfareModel.itemWelfareData iwd) : base(trans)
        {
            this.root           = trans;
            this.m_iwd          = iwd;
            this.txtInfo        = base.getComponentByPath <Text>("txtInfor");
            this.imgChecked     = base.getGameObjectByPath("state/imgChecked").transform;
            this.btnGet         = new BaseButton(this.root.transform.FindChild("state/btnGet"), 1, 1);
            this.btnGet.onClick = new Action <GameObject>(this.onBtnGetClick);
            this.txtInfo.text   = string.Format(iwd.desc, iwd.cumulateNum, iwd.awardName);
            bool flag = iwd.zhuan > ModelBase <PlayerModel> .getInstance().up_lvl;

            if (flag)
            {
                this.btnGet.interactable = false;
                this.btnGet.transform.FindChild("Text").GetComponent <Text>().text = "未达成";
            }
            else
            {
                this.btnGet.transform.FindChild("Text").GetComponent <Text>().text = "领取";
                this.btnGet.interactable = true;
            }
        }
        private void createAward(uint dayCount)
        {
            List <WelfareModel.itemWelfareData> dailyLogin = ModelBase <WelfareModel> .getInstance().getDailyLogin();

            for (int i = 0; i < dailyLogin.Count; i++)
            {
                bool flag = i < 7;
                if (flag)
                {
                    WelfareModel.itemWelfareData itemWelfareData = dailyLogin[i];
                    a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(itemWelfareData.itemId);

                    bool isChecked = false;
                    bool canGet    = false;
                    bool flag2     = (long)i < (long)((ulong)dayCount);
                    if (flag2)
                    {
                        isChecked = true;
                    }
                    bool flag3 = (long)i == (long)((ulong)dayCount);
                    if (flag3)
                    {
                        canGet = true;
                    }
                    GameObject gameObject = base.transform.FindChild("body/awardItems/content/itemAward" + (i + 1)).gameObject;
                    a3_everydayLogin.itemAward itemAward = new a3_everydayLogin.itemAward(new a3_everydayLogin.itemAwardData
                    {
                        parent    = this._content,
                        trSelf    = gameObject.transform,
                        dayNum    = (uint)i,
                        dayCount  = dayCount,
                        isChecked = isChecked,
                        canGet    = canGet,
                        name      = itemDataById.item_name,
                        awardnum  = itemWelfareData.num
                    });
                }
            }
        }