Example #1
0
    protected void S2C_GotMustDoState(Pt _info)
    {
        pt_update_liveness_reward_c103 pt = _info as pt_update_liveness_reward_c103;

        if (pt != null)
        {
            //Debug.Log("S2C_GotMustDoState");
            bool needRedTip = false;
            for (int i = 0, length = pt.liveness_reward.Count; i < length; i++)
            {
                MustDoStateDic[pt.liveness_reward[i].reward_id] = (pt.liveness_reward[i].state == 1);
                //Debug.Log("S2C_GotMustDoState id:" + pt.liveness_reward[i].reward_id + ",state:" + pt.liveness_reward[i].state);
                LivelyRewardRef reward = ConfigMng.Instance.GetLivelyRewardRef(pt.liveness_reward[i].reward_id);
                if (reward != null && pt.liveness_reward[i].state == 0 && reward.need <= CurLivelyCount)
                {
                    needRedTip = true;
                }
            }
            GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.DAILYMUSTDO, needRedTip);
            if (OnDailyMustDoStateUpdateEvent != null)
            {
                OnDailyMustDoStateUpdateEvent();
            }
        }
    }
Example #2
0
 public void SetData(LivelyRewardRef _livelyRewardRef)
 {
     if (gameObject != null)
     {
         gameObject.SetActive(true);
     }
     if (labName != null)
     {
         labName.text = _livelyRewardRef.name.ToString();
     }
     if (items != null)
     {
         items.RefreshItems(_livelyRewardRef.reward, 4, _livelyRewardRef.reward.Count);
     }
     if (btnReward != null)
     {
         bool haveGot = GameCenter.dailyMustDoMng.MustDoStateDic.ContainsKey(_livelyRewardRef.id) ? GameCenter.dailyMustDoMng.MustDoStateDic[_livelyRewardRef.id] : false;
         if (haveGot || GameCenter.dailyMustDoMng.CurLivelyCount < _livelyRewardRef.need)
         {
             btnReward.isEnabled = false;
         }
         else
         {
             btnReward.isEnabled = true;
             UIEventListener.Get(btnReward.gameObject).onClick = (x) =>
             {
                 GameCenter.dailyMustDoMng.C2S_ReqGetLivelyReward(_livelyRewardRef.id);
             };
         }
     }
 }
Example #3
0
 void ShowLivelyBoxReward(LivelyRewardRef _livelyRewardRef)
 {
     if (boxUI != null)
     {
         boxUI.SetData(_livelyRewardRef);
     }
 }
Example #4
0
    public void SetData(LivelyRewardRef _livelyRewardRef, System.Action <LivelyRewardRef> _OnClick)
    {
        if (_livelyRewardRef == null)
        {
            return;
        }
        OnClickRewardEvent = _OnClick;
        curLively          = _livelyRewardRef;
        if (livelyAmount != null)
        {
            livelyAmount.text = ConfigMng.Instance.GetUItext(138, new string[1] {
                _livelyRewardRef.need.ToString()
            });
        }
        ;
        if (doubleRewardDes != null)
        {
            doubleRewardDes.text = string.Format(format, _livelyRewardRef.vip);
        }
        bool haveGot        = GameCenter.dailyMustDoMng.MustDoStateDic.ContainsKey(_livelyRewardRef.id)?GameCenter.dailyMustDoMng.MustDoStateDic[_livelyRewardRef.id]:false;
        bool canGet         = GameCenter.dailyMustDoMng.CurLivelyCount >= _livelyRewardRef.need;
        int  curLivelyCount = GameCenter.dailyMustDoMng.CurLivelyCount;

        if (haveGot)
        {
            UIEventListener.Get(gameObject).onClick = null;
        }
        else
        {
            UIEventListener.Get(gameObject).onClick = OnClickReward;
        }
        if (getPic != null)
        {
            getPic.enabled = canGet;
            getPic.IsGray  = haveGot ? UISpriteEx.ColorGray.Gray : UISpriteEx.ColorGray.normal;
        }
        if (cantGetPic != null)
        {
            cantGetPic.enabled = !canGet;                    //不可领显示
        }
        if (redTipIcon != null)
        {
            redTipIcon.enabled = canGet && !haveGot;
        }
    }