Пример #1
0
        private void UpdateData()
        {
            List <Hotfix_LT.Data.TimeLimitActivityStageTemplate> stages = Hotfix_LT.Data.EventTemplateManager.Instance.GetTimeLimitActivityStages(activity_id);

            Hotfix_LT.Data.TimeLimitActivityTemplate activity = Hotfix_LT.Data.EventTemplateManager.Instance.GetTimeLimitActivity(activity_id);
            string[] rewardStrs = activity.parameter1.Split(';');
            if (rewardStrs.Length < stages.Count)
            {
                EB.Debug.LogError("LuckyCat Activity Error!Events TimeLimitActivity Parameter is lower");
                return;
            }

            Hashtable activityData;

            DataLookupsCache.Instance.SearchDataByID("tl_acs." + activity_id, out activityData);
            curIndex = -1;
            for (int i = 0; i < stages.Count; ++i)
            {
                int selfgot = EB.Dot.Integer(string.Format("stages.{0}", stages[i].id), activityData, 0);
                if (selfgot == 0)
                {
                    curIndex = i;
                    break;
                }
            }
            if (curIndex == -1)
            {
                //已领取完毕
                TimesLabel.text = "0";
                CostLabel.text  = GetLabel.text = EB.Localizer.GetString("ID_LEGION_MEDAL_NOT");
                CostLabel.color = LT.Hotfix.Utility.ColorUtility.GreenColor;
            }
            else
            {
                Cur             = stages[curIndex];
                TimesLabel.text = (VIPTemplateManager.Instance.GetTotalNum(VIPPrivilegeKey.LuckyCat) - curIndex).ToString();
                CostLabel.color = (BalanceResourceUtil.GetUserDiamond() < Cur.stage) ? LT.Hotfix.Utility.ColorUtility.RedColor : LT.Hotfix.Utility.ColorUtility.GreenColor;
                CostLabel.text  = Cur.stage.ToString();
                GetLabel.text   = rewardStrs[curIndex].Replace(",", " - ");
            }
        }
Пример #2
0
        protected override void CreateSubItem(Hotfix_LT.Data.TimeLimitActivityStageTemplate stage)
        {
            int    stageid  = stage.id;
            var    rewards  = stage.reward_items;
            var    item     = UIControllerHotfix.InstantiateEx(RewardTemplate, RewardTemplate.transform.parent, stageid.ToString());
            UIGrid GiftGrid = mDMono.transform.Find(string.Format("ScrollView/Placeholder/Grid/{0}/GiftGrid", stageid)).GetComponent <UIGrid>();

            Hashtable activityData;

            DataLookupsCache.Instance.SearchDataByID("tl_acs." + activity_id, out activityData);

            for (var i = 0; i < rewards.Count; i++)
            {
                var rewardItem = UIControllerHotfix.InstantiateEx <LTShowItem>(ItemTemplate, GiftGrid.transform, i.ToString());
                rewardItem.LTItemData = new LTShowItemData(rewards[i].id, rewards[i].quantity, rewards[i].type, false);
            }
            GiftGrid.Reposition();

            int score = EB.Dot.Integer("current", activityData, 0);

            UIButton   btn      = mDMono.transform.Find(string.Format("ScrollView/Placeholder/Grid/{0}/ReceiveButton", stageid)).GetComponent <UIButton>();
            LTShowItem Source   = mDMono.transform.Find(string.Format("ScrollView/Placeholder/Grid/{0}/Source", stageid)).GetMonoILRComponent <LTShowItem>();
            UILabel    progress = mDMono.transform.Find(string.Format("ScrollView/Placeholder/Grid/{0}/Source/Count", stageid)).GetComponent <UILabel>();

            Source.LTItemData = new LTShowItemData(activity_id.ToString(), 1, "act", false);

            int     rewardgot = EB.Dot.Integer(string.Format("stages.{0}", stageid), activityData, 0);
            UILabel gotLabel  = mDMono.transform.Find(string.Format("ScrollView/Placeholder/Grid/{0}/ReceiveButton/Count", stageid)).GetComponent <UILabel>();

            gotLabel.text = string.Format("({0}/{1})", rewardgot, stage.num);

            if (score >= stage.stage)
            {
                btn.isEnabled = true;
                progress.text = string.Format("{0}/{1}", score, stage.stage);


                if (rewardgot >= stage.num)
                {
                    SetButtonToReceived(stageid, EB.Localizer.GetString("ID_EXCHANGE"));
                }
                else
                {
                    UILabel btnlabel = mDMono.transform.Find(string.Format("ScrollView/Placeholder/Grid/{0}/ReceiveButton/Label", stageid)).GetComponent <UILabel>();

                    btnlabel.text = EB.Localizer.GetString("ID_EXCHANGE");
                    btn.onClick.Add(new EventDelegate(GetReward(stageid, delegate()
                    {
                        DataLookupsCache.Instance.SearchDataByID("tl_acs." + activity_id, out activityData);
                        score     = EB.Dot.Integer("current", activityData, 0);
                        rewardgot = EB.Dot.Integer(string.Format("stages.{0}", stageid), activityData, 0);
                        UpdateAllSubItem(score);
                        gotLabel.text = string.Format("({0}/{1})", rewardgot, stage.num);
                        if (rewardgot >= stage.num)
                        {
                            SetButtonToReceived(stageid, EB.Localizer.GetString("ID_EXCHANGE"));
                        }
                        progress.text = string.Format("{0}/{1}", score, stage.stage);
                    })));
                }
            }
            else
            {
                SetButtonToNotReach(stageid, EB.Localizer.GetString("ID_EXCHANGE"));
                progress.text = string.Format("{0}/{1}", score, stage.stage);
            }
        }