Пример #1
0
        public void SetWeekMissionActivity()
        {
            _weekactivityReward.DeltaX = 0;
            if (_missionModel.WeekMissionActivityInfoPb == null)
            {
                _weekactivityReward.Progress = 0;
            }
            else
            {
                _weekactivityReward.Progress =
                    (int)((float)_missionModel.WeekMissionActivityInfoPb.Progress / 120 * 100f);
            }

            for (int i = 0; i < weekRewardList.childCount; i++)
            {
                int weight     = _missionModel.GetReceiveWeight(i);
                var reward     = weekRewardList.GetChild(i).Find("Background/Checkmark").GetComponent <RawImage>();
                var point      = weekRewardList.GetChild(i).Find("Point").GetImage();
                var arrow      = weekRewardList.GetChild(i).Find("Background/Checkmark/Arrow").gameObject;
                var numText    = weekRewardList.GetChild(i).Find("Background/Checkmark/Num").GetComponent <Text>();
                var rewardmask = weekRewardList.GetChild(i).Find("Background/Checkmark/Mask");
                arrow.SetActive(false);
                rewardmask.gameObject.SetActive(false);
                PointerClickListener.Get(reward.gameObject).onClick = null;
                var      rewardlist = _missionModel.GetWeekMissionRewardPBByCount(weight);
                int      gemNum     = 0;
                RewardVo rewardVo   = null;
                foreach (var v in rewardlist)
                {
                    rewardVo = new RewardVo(v);
                    gemNum   = rewardVo.Num;
                }

                numText.text = gemNum.ToString();
                numText.gameObject.SetActive(false);
                if (_missionModel.WeekMissionActivityInfoPb == null)
                {
                    numText.gameObject.SetActive(true);
                    reward.texture = ResourceManager.Load <Texture>(rewardVo?.IconPath);
                    point.sprite   =
                        AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_whitePoint");
                }
                else
                {
                    if (_missionModel.WeekMissionActivityInfoPb.List.Contains(weight))
                    {
                        numText.gameObject.SetActive(false);

                        reward.texture = ResourceManager.Load <Texture>(rewardVo?.IconPath);
                        point.sprite   =
                            AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_Showpoint");
                        rewardmask.gameObject.SetActive(true);
                        PointerClickListener.Get(reward.gameObject).onClick = go =>
                        {
                            FlowText.ShowMessage(I18NManager.Get("Task_HasReceive"));
                        };
                    }
                    else
                    {
                        if (weight > _missionModel.WeekMissionActivityInfoPb.Progress)
                        {
                            numText.gameObject.SetActive(true);
                            reward.texture = ResourceManager.Load <Texture>(rewardVo?.IconPath);
                            point.sprite   =
                                AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_whitePoint");
                        }
                        else
                        {
                            //待领取状态
                            numText.gameObject.SetActive(true);
                            reward.texture = ResourceManager.Load <Texture>(rewardVo?.IconPath);
                            point.sprite   =
                                AssetManager.Instance.GetSpriteAtlas("UIAtlas_Task_whitePoint");
                            arrow.SetActive(true);
                        }

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

                    //reward.SetNativeSize();
                }
            }
        }