コード例 #1
0
    void Refresh()
    {
        WdfActiveTypeData data = GameCenter.weekCardMng.loginBonusData;

        if (data == null || this == null)
        {
            return;
        }
        //Debug.Log("刷新活动详情" + GameCenter.wdfActiveMng.CurWdfActiveType);
        //this.gameObject.SetActive(true);

        if (redRechargeBtn != null)
        {
            redRechargeBtn.gameObject.SetActive(!GameCenter.weekCardMng.isCanTakeLoginBunus);
        }
        if (recharged != null)
        {
            recharged.SetActive(GameCenter.weekCardMng.isCanTakeLoginBunus);
        }

        Vector3 V3 = Vector3.zero;

        DestroyItem();
        for (int i = 0, max = data.details.Count; i < max; i++)
        {
            if (rewardGrid == null || rewardItemInstance == null)
            {
                return;
            }
            GameObject obj = Instantiate(rewardItemInstance) as GameObject;
            if (obj == null)
            {
                return;
            }
            Transform parentTransf = rewardGrid.transform;
            obj.transform.parent        = parentTransf;
            obj.transform.localPosition = V3;
            obj.transform.localScale    = Vector3.one;
            obj.SetActive(true);
            V3 = new Vector3(V3.x, V3.y - 130, V3.z);
            WdfActiveRewardItem ui = obj.GetComponent <WdfActiveRewardItem>();
            if (ui != null)
            {
                ui.Refresh(data.details[i], data);
            }
        }
        if (view != null)
        {
            view.ResetPosition();
        }
    }
コード例 #2
0
    public void Refresh(WdfActiveTypeData _info)
    {
        if (this == null || _info == null)
        {
            return;
        }
        red = false;
        //Debug.Log("刷新活动详情" + GameCenter.wdfActiveMng.CurWdfActiveType);
        this.gameObject.SetActive(true);
        if (remainTime != null)
        {
            remainTime.StartIntervalTimer((int)_info.rest_time);
            remainTime.onTimeOut = (x) =>
            {
                ReFreshInfo();
            };
        }

        if (redRechargeBtn != null)
        {
            redRechargeBtn.gameObject.SetActive(_info.counter_value != 1);
        }
        if (recharged != null)
        {
            recharged.SetActive(_info.counter_value == 1);
        }

        if (activeDes != null)
        {
            activeDes.text = _info.desc;
        }
        if (activeCount != null)
        {
            //string[] word = { _info.counter_value.ToString() };


            switch (_info.type)
            {
            case 1:
                activeCount.text = ConfigMng.Instance.GetUItext(357) + _info.counter_value.ToString() + ConfigMng.Instance.GetUItext(341);
                break;

            case 2:
            case 3:
            case 4:
                activeCount.text = ConfigMng.Instance.GetUItext(357) + _info.counter_value.ToString() + ConfigMng.Instance.GetUItext(309);
                break;

            default:
                activeCount.text = string.Empty;
                break;
            }
        }
        Vector3 V3 = Vector3.zero;

        DestroyItem();
        for (int i = 0; i < _info.details.Count; i++)
        {
            if (rewardGrid == null || rewardItemInstance == null)
            {
                return;
            }
            GameObject obj = Instantiate(rewardItemInstance) as GameObject;
            if (obj == null)
            {
                return;
            }
            Transform parentTransf = rewardGrid.transform;
            obj.transform.parent        = parentTransf;
            obj.transform.localPosition = V3;
            obj.transform.localScale    = Vector3.one;
            obj.SetActive(true);
            V3 = new Vector3(V3.x, V3.y - 130, V3.z);
            WdfActiveRewardItem ui = obj.GetComponent <WdfActiveRewardItem>();
            if (ui != null)
            {
                ui.Refresh(_info.details[i], _info);
            }

            if (!red && _info.details[i].total_reward_times > _info.details[i].reward_times && _info.details[i].total_reward_times > 0)
            {
                //Debug.Log("有奖励" + _info.details[i].total_reward_times + ":" + _info.details[i].reward_times);
                red = true;
            }
        }
        if (!red && GameCenter.wdfActiveMng.RedDic.ContainsKey(GameCenter.wdfActiveMng.CurWdfActiveType))
        {
            if (GameCenter.wdfActiveMng.RedDic[GameCenter.wdfActiveMng.CurWdfActiveType])
            {
                //Debug.Log("设置为没有奖励");
                GameCenter.wdfActiveMng.RedDic[GameCenter.wdfActiveMng.CurWdfActiveType] = false;
                if (GameCenter.wdfActiveMng.RefreshRed != null)
                {
                    GameCenter.wdfActiveMng.RefreshRed();
                }
            }
        }

        if (view != null && GameCenter.wdfActiveMng.needReset)
        {
            view.ResetPosition();
            GameCenter.wdfActiveMng.needReset = false;
        }
    }