public PointsExchangeElement(PointsExchangePhase phase, GameObject uiItem, PointsExchangeWgt owner, int index)
 {
     this.phase  = phase;
     this.uiItem = uiItem;
     this.owner  = owner;
     this.index  = index;
     this.Validate();
 }
        public void SetActivity(Activity actv)
        {
            this.Clear();
            base.activity = actv;
            if (actv == null)
            {
                return;
            }
            char[] array = new char[]
            {
                ' ',
                ','
            };
            string[] array2 = actv.Wigets.Split(array, 1);
            float    num    = 0f;

            int[] array3 = new int[16];
            int   num2   = 0;

            for (int i = 0; i < array2.Length; i++)
            {
                int num3 = 0;
                if (!int.TryParse(array2[i], ref num3) || num3 <= 0 || num3 >= 16)
                {
                    DebugHelper.Assert(false, "[CampaignFormView][Activity:{0}] widgets config error!", new object[]
                    {
                        actv.ID
                    });
                }
                else
                {
                    CampaignFormView.WidgetDefine widgetDefine = (CampaignFormView.WidgetDefine)num3;
                    GameObject gameObject = Utility.FindChildSafe(base.root, widgetDefine.ToString());
                    if (null != gameObject)
                    {
                        array3[num2++] = num3;
                        gameObject.SetActive(true);
                        ActivityWidget activityWidget = null;
                        switch (widgetDefine)
                        {
                        case CampaignFormView.WidgetDefine.Introduction:
                            activityWidget = new IntrodWidget(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.Banner:
                            activityWidget = new BannerWidget(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.Progress:
                            activityWidget = new ProgressWidget(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.Rewards:
                            activityWidget = new RewardWidget(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.MultiGain:
                            activityWidget = new MultiGainWgt(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.CheckIn:
                            activityWidget = new CheckInWidget(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.Notice:
                            activityWidget = new NoticeWidget(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.Exchange:
                            activityWidget = new ExchangeWgt(gameObject, this);
                            break;

                        case CampaignFormView.WidgetDefine.PointsExchange:
                            activityWidget = new PointsExchangeWgt(gameObject, this);
                            break;
                        }
                        if (activityWidget != null)
                        {
                            activityWidget.SetPosY(num);
                            num -= activityWidget.Height + 5f;
                            base.WidgetList.Add(activityWidget);
                        }
                    }
                }
            }
            for (int j = 1; j < 16; j++)
            {
                bool flag = false;
                for (int k = 0; k < num2; k++)
                {
                    if (array3[k] == j)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    Utility.FindChildSafe(base.root, ((CampaignFormView.WidgetDefine)j).ToString()).CustomSetActive(false);
                }
            }
            base.root.GetComponent <RectTransform>().sizeDelta = new Vector2(base.root.GetComponent <RectTransform>().sizeDelta.x, -num);
            for (int l = 0; l < base.WidgetList.Count; l++)
            {
                base.WidgetList[l].OnShow();
            }
        }
예제 #3
0
        public void SetActivity(Activity actv)
        {
            this.Clear();
            base.activity = actv;
            if (actv != null)
            {
                char[]   separator = new char[] { ' ', ',' };
                string[] strArray  = actv.Wigets.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                float    val       = 0f;
                int[]    numArray  = new int[0x10];
                int      num2      = 0;
                for (int i = 0; i < strArray.Length; i++)
                {
                    int result = 0;
                    if ((!int.TryParse(strArray[i], out result) || (result <= 0)) || (result >= 0x10))
                    {
                        object[] inParameters = new object[] { actv.ID };
                        DebugHelper.Assert(false, "[CampaignFormView][Activity:{0}] widgets config error!", inParameters);
                        continue;
                    }
                    WidgetDefine define = (WidgetDefine)result;
                    GameObject   node   = Utility.FindChildSafe(base.root, define.ToString());
                    if (null != node)
                    {
                        numArray[num2++] = result;
                        node.SetActive(true);
                        ActivityWidget item = null;
                        switch (define)
                        {
                        case WidgetDefine.Introduction:
                            item = new IntrodWidget(node, this);
                            break;

                        case WidgetDefine.Banner:
                            item = new BannerWidget(node, this);
                            break;

                        case WidgetDefine.Progress:
                            item = new ProgressWidget(node, this);
                            break;

                        case WidgetDefine.Rewards:
                            item = new RewardWidget(node, this);
                            break;

                        case WidgetDefine.MultiGain:
                            item = new MultiGainWgt(node, this);
                            break;

                        case WidgetDefine.CheckIn:
                            item = new CheckInWidget(node, this);
                            break;

                        case WidgetDefine.Notice:
                            item = new NoticeWidget(node, this);
                            break;

                        case WidgetDefine.Exchange:
                            item = new ExchangeWgt(node, this);
                            break;

                        case WidgetDefine.PointsExchange:
                            item = new PointsExchangeWgt(node, this);
                            break;
                        }
                        if (item != null)
                        {
                            item.SetPosY(val);
                            val -= item.Height + 5f;
                            base.WidgetList.Add(item);
                        }
                    }
                }
                for (int j = 1; j < 0x10; j++)
                {
                    bool flag = false;
                    for (int m = 0; m < num2; m++)
                    {
                        if (numArray[m] == j)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        Utility.FindChildSafe(base.root, ((WidgetDefine)j).ToString()).CustomSetActive(false);
                    }
                }
                base.root.GetComponent <RectTransform>().sizeDelta = new Vector2(base.root.GetComponent <RectTransform>().sizeDelta.x, -val);
                for (int k = 0; k < base.WidgetList.Count; k++)
                {
                    base.WidgetList[k].OnShow();
                }
            }
        }