Ejemplo n.º 1
0
        public void SetDailyMissionActivity()
        {
            _activityReward.DeltaX   = 0;
            _activityReward.Progress = (int)((float)_missionModel.DailyMissionActivityInfoPb.Progress / 120 * 100f);
            for (int i = 0; i < rewardList.childCount; i++)
            {
                int weight  = _missionModel.GetReceiveWeight(i);
                var reward  = rewardList.GetChild(i).Find("Background/Checkmark").GetComponent <Image>();
                var point   = rewardList.GetChild(i).Find("Point").gameObject;
                var arrow   = rewardList.GetChild(i).Find("Background/Checkmark/Arrow").gameObject;
                var numText = rewardList.GetChild(i).Find("Background/Checkmark/Num").GetComponent <Text>();
                arrow.SetActive(false);
                PointerClickListener.Get(reward.gameObject).onClick = null;
                var rewardlist = _missionModel.GetMissionawardByWeight(weight);
                int gemNum     = 0;
                foreach (var v in rewardlist)
                {
                    if (v.Resource == ResourcePB.Gem)
                    {
                        gemNum = v.Num;
                    }
                }

                numText.text = gemNum.ToString();
                numText.gameObject.SetActive(false);
                if (_missionModel.DailyMissionActivityInfoPb.List.Contains(weight))
                {
                    numText.gameObject.SetActive(false);

                    reward.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_gemDoneIcon");
                    point.GetComponent <Image>().sprite =
                        AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_Showpoint");
                    PointerClickListener.Get(reward.gameObject).onClick = go =>
                    {
                        FlowText.ShowMessage(I18NManager.Get("Task_HasReceive"));
                    };
                }
                else
                {
                    if (weight > _missionModel.DailyMissionActivityInfoPb.Progress)
                    {
                        numText.gameObject.SetActive(true);
                        reward.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_gemOpenIcon");
                        point.GetComponent <Image>().sprite =
                            AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_whitePoint");
                    }
                    else
                    {
                        //待领取状态
                        numText.gameObject.SetActive(true);
                        reward.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_gemIcon");
                        point.GetComponent <Image>().sprite =
                            AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_whitePoint");
                        arrow.SetActive(true);
                    }

                    PointerClickListener.Get(reward.gameObject).onClick = go =>
                    {
                        if (weight > _missionModel.DailyMissionActivityInfoPb.Progress)
                        {
                            FlowText.ShowMessage(I18NManager.Get("Task_NoEnoughActive"));
                        }
                        else
                        {
                            SendMessage(new Message(MessageConst.CMD_TASK_RECEIVE_ACTREWARD,
                                                    Message.MessageReciverType.CONTROLLER, MissionTypePB.Daily, weight));
                        }
                    };
                }

                reward.SetNativeSize();
            }
        }