public void SetData(ActivityCapsuleTemplateModel model)
    {
        //Debug.Log("draw view setdata");
        for (int i = 0; i < _drawPool.Length; ++i)
        {
            if (i >= model.capsuleItemIds.Count)
            {
                continue;
            }
            int id = model.capsuleItemIds[i];
            ActivityCapsuleItemPB awardData = model.GetCapsuleItem(model.capsuleItemIds[i]);
            _drawPool[i].id = id;
            //Debug.Log("capsuleItem id:"+id);
            _drawPool[i].SetData(awardData, model);
        }
        _disableIds = model.gainCapsuleItems;


        if (model.costItem != null)
        {
            _haveNumIcon.texture = PropUtils.GetPropIcon(model.costItem.ResourceId);
            _haveNumIcon.color   = Color.white;
            _haveNumText.text    = PropUtils.GetUserPropNum(model.costItem.ResourceId).ToString();

            _costNumIcon.texture = PropUtils.GetPropIcon(model.costItem.ResourceId);
            _costNumIcon.color   = Color.white;
            _costNumText.text    = "x" + model.costItem.Num;
        }
    }
 public void UpdateUserProp(ActivityCapsuleTemplateModel model)
 {
     if (model.costItem != null)
     {
         _haveNumText.text = PropUtils.GetUserPropNum(model.costItem.ResourceId).ToString();
     }
 }
    //扭蛋
    private void SendDrawReq(System.Action <int> finishCallback = null)
    {
        ActivityCapsuleTemplateModel model = GetData <ActivityCapsuleTemplateModel>();

        if (model.costItem != null)
        {
            int num = PropUtils.GetUserPropNum(model.costItem.ResourceId);
            if (num < model.costItem.Num)
            {
                PopupManager.ShowAlertWindow(I18NManager.Get("ActivityCapsuleTemplate_drawNoEnoughItem"));
                return;
            }
        }

        DrawAwardReq req = new DrawAwardReq
        {
            ActivityId = model.CurActivityId
        };

        byte[] data = NetWorkManager.GetByteData(req);
        NetWorkManager.Instance.Send <DrawAwardRes>(CMD.ACTIVITYC_CAPSULE_DRAW_AWARD, data, (res) =>
        {
            GlobalData.PropModel.UpdateProps(new[] { res.UserItem });
            View.UpdateUserProp(GetData <ActivityCapsuleTemplateModel>());
            if (finishCallback != null)
            {
                finishCallback(res.AwardId);
            }
        });
    }
    public void SetData(ActivityCapsuleItemPB data, ActivityCapsuleTemplateModel model)
    {
        _light.gameObject.SetActive(false);
        _credit.gameObject.SetActive(false);
        _rewardData = new RewardVo(data.AwardPB);
        PropUtils.SetPropItemIcon(_rewardData, _icon, ModuleConfig.MODULE_ACTIVITYCAPSULETEMPLATE, false, false);
        _icon.color     = Color.white;
        _countText.text = "x" + _rewardData.Num;

        CheckBg(_rewardData);
        SetDisable(model.IsGainCapsuleItem(data.Id));
    }
Exemple #5
0
    public void RefreshNum(ActivityCapsuleTemplateModel model)
    {
        if (model.costItem != null)
        {
            _costIcon.texture = PropUtils.GetPropIcon(model.costItem.ResourceId);
            _costIcon.color   = Color.white;
            int num = PropUtils.GetUserPropNum(model.costItem.ResourceId);
            //Debug.LogError("num====?"+num);
            _costNumText.text = num.ToString();

            bool capsuleState = false;
            if (num >= model.costItem.Num && !model.GainAllCapsuleItem())
            {
                capsuleState = true;
            }
            _lotteryRedPoint.SetActive(capsuleState);
        }
        _uiEffectObj.SetActive(true);
    }
Exemple #6
0
    public void SetData(string id, ActivityCapsuleTemplateModel model, bool isClearPre)
    {
        _isClearPre = isClearPre;

        ActivityCapsuleStoryRule rule = model.GetStoryRule(id);

        _data = rule;
        if (_data == null)
        {
            return;
        }
        long curTime = ClientTimer.Instance.GetCurrentTimeStamp();

        //Debug.Log("openTime:"+ _data.data.OpenTime + " curTime:"+curTime);
        _contentText.text = "剧情" + rule.index;
        if (curTime < _data.data.OpenTime)
        {
            _btnBg.interactable = false;
            _openObj.Hide();
            _lockObj.Show();
            _bg.texture    = null;
            _bg.color      = new Color(0.9f, 0.9f, 0.9f, 1);
            _lockText.text = I18NManager.Get("ActivityCapsuleTemplate_storyOpenTips", DateUtil.GetYMDD(_data.data.OpenTime));
        }
        else
        {
            _btnBg.interactable = true;
            _bg.texture         = ResourceManager.Load <Texture>("ActivityCapsuleTemplate/story_" + _data.index);
            _openObj.Show();
            _lockObj.Hide();

            if (!isClearPre)
            {
                _redPoint.Hide();
            }
            else
            {
                _redPoint.SetActive(!model.IsReadStory(id));
            }
        }
    }
    public void SetData(ActivityCapsuleTemplateModel model)
    {
        var prefab = GetPrefab("ActivityCapsuleTemplate/Prefabs/ActivityCapsuleTemplateStoryItem");

        ClearItems();
        //for (int i = 0; i < 10; ++i)
        //{
        //    GameObject go = Instantiate(prefab, _storyListGrid, false);
        //}

        bool lastIsClear = true;

        for (int i = 0; i < model.storyIds.Count; ++i)
        {
            GameObject go = Instantiate(prefab, _storyListGrid, false);
            ActivityCapsuleTemplateStoryItem item = go.GetComponent <ActivityCapsuleTemplateStoryItem>();
            item.SetData(model.storyIds[i], model, lastIsClear);
            lastIsClear = model.IsReadStory(model.storyIds[i]);
            _itemList.Add(item);
        }
    }
Exemple #8
0
    public void SetData(ActivityCapsuleTemplateModel model)
    {
        //Debug.LogWarning("view  setData:" + model.GainAllCapsuleItem());
        if (model.costItem != null)
        {
            _costIcon.texture = PropUtils.GetPropIcon(model.costItem.ResourceId);
            _costIcon.color   = Color.white;
            int num = PropUtils.GetUserPropNum(model.costItem.ResourceId);
            _costNumText.text = num.ToString();

            bool capsuleState = false;
            if (num >= model.costItem.Num && !model.GainAllCapsuleItem())
            {
                capsuleState = true;
            }
            _lotteryRedPoint.SetActive(capsuleState);
        }
        _endTimeStamp = model.EndTimeStamp;
        SetActivityTime();

        _storyRedPoint.SetActive(model.HaveCanReadStory());

        _uiEffectObj.SetActive(true);
    }