Example #1
0
        //bool _isChecked = false;
        void SetAwd(itemAwardData iad)
        {
            Transform trans = iad.trSelf;
            //Transform _root = iad.trSelf;
            //_root.SetParent(iad.parent);
            // _root.localScale = Vector3.one;
            // BaseButton _btnGet = new BaseButton(trans.FindChild("btnGet"));
            // _btnGet.onClick = onThisClick;
            Transform _toggleImage   = trans.transform.FindChild("btnGet/toggleImage");
            Transform _trAwardParent = trans.transform.FindChild("btnGet/parent");
            Transform canget_obj     = trans.transform.FindChild("btnGet/canget");

            uint _dayNum   = iad.dayNum;
            uint _dayCount = iad.dayCount;

            _toggleImage.gameObject.SetActive(iad.isChecked);


            if (_dayNum == _dayCount)
            {
                canget_obj.gameObject.SetActive(true);
                trans.transform.FindChild("btnGet/this").gameObject.SetActive(true);
                new BaseButton(canget_obj.transform).onClick = (GameObject go) => {
                    if (_dayNum < _dayCount)
                    {
                        flytxt.instance.fly(ContMgr.getCont("a3_everydayLogin_oldlq")); return;
                    }
                    if (_dayNum > _dayCount)
                    {
                        flytxt.instance.fly(ContMgr.getCont("a3_everydayLogin_nolq")); return;
                    }
                    // if (_isChecked) { flytxt.instance.fly(ContMgr.getCont("a3_everydayLogin_oldlq")); return; }
                    if (a3_new_pet.instance != null)
                    {
                        a3_new_pet.instance.openEveryLogin = false;
                    }
                    a3_everydayLogin.instans.open = false;
                    welfareProxy.getInstance().sendWelfare(welfareProxy.ActiveType.accumulateLogin);
                    a3_expbar.instance.getGameObjectByPath("operator/LightTips/everyDayLogin").SetActive(false);
                };
                trans.transform.FindChild("icon").gameObject.SetActive(true);
                trans.transform.FindChild("iconh").gameObject.SetActive(false);
            }
            else
            {
                canget_obj.gameObject.SetActive(false);
                trans.transform.FindChild("btnGet/this").gameObject.SetActive(false);
                trans.transform.FindChild("icon").gameObject.SetActive(false);
                trans.transform.FindChild("iconh").gameObject.SetActive(true);
            }

            string _name = iad.name;
            uint   _num  = iad.awardnum;
        }
Example #2
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;
                }
            }
        }