public void UpdateUserProp(ActivityCapsuleTemplateModel model)
 {
     if (model.costItem != null)
     {
         _haveNumText.text = PropUtils.GetUserPropNum(model.costItem.ResourceId).ToString();
     }
 }
    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;
        }
    }
    //扭蛋
    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);
            }
        });
    }
示例#4
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);
    }
示例#5
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);
    }