public void SetData(MissionModel missionModel, int player) { _missionModel = missionModel; playepb = (PlayerPB)player; _title.text = missionModel.GetPlayerName(playepb); //PointerClickListener.Get(_rewardTran.gameObject).onClick = null; if (missionModel.StarCourseSchedule.ContainsKey(playepb)) { usermissioninfo = missionModel.StarCourseSchedule[playepb]; _roadnum.text = I18NManager.Get("Achievement_LongKM2", usermissioninfo.Progress);//"星路里程:" + usermissioninfo.Progress+"km"; weight = 0; var rewardList = missionModel.GetStarRoadRewardPBByCount(usermissioninfo.Progress, playepb, ref weight, usermissioninfo.List); _activityReward.DeltaX = 0; _activityReward.Progress = (int)((float)usermissioninfo.Progress / weight * 100f); RewardVo rewardVo = null; foreach (var v in rewardList) { rewardVo = new RewardVo(v); } _rewardImage.texture = ResourceManager.Load <Texture>(rewardVo?.IconPath); _rewardName.text = weight + I18NManager.Get("Achievement_KMReward"); _rewardNum.text = rewardVo?.Num.ToString(); //可领取的状态! _rewardRedpoint.SetActive(usermissioninfo.Progress >= weight && usermissioninfo.Progress > 0); } else { _activityReward.DeltaX = 0; _activityReward.Progress = 0; if (missionModel.StarCourseSchedule.ContainsKey(playepb)) { SetActReward(0, missionModel.StarCourseSchedule[playepb].Progress, null, missionModel.StarCourseSchedule[playepb].List, playepb); } else { SetActReward(0, 0, null, null, playepb); } } _data = missionModel.GetMissionByPlayerPB(playepb); _data.Sort(); SetStarRoadItemData(); }
private void SetActReward(int roadnum, int progress, RewardVo vo, RepeatedField <int> receiveList, PlayerPB playerPb) { _roadnum.text = I18NManager.Get("Achievement_LongKM2", roadnum);//"星路里程:" +roadnum+"km"; weight = 0; var rewardList = _missionModel.GetStarRoadRewardPBByCount(progress, playerPb, ref weight, receiveList); RewardVo rewardVo = vo; foreach (var v in rewardList) { rewardVo = new RewardVo(v); } _rewardImage.texture = ResourceManager.Load <Texture>(rewardVo?.IconPath); if (rewardVo != null) { _rewardName.text = weight + I18NManager.Get("Achievement_KMReward"); //rewardVo.Name + " X" + rewardVo.Num; _rewardNum.text = rewardVo?.Num.ToString(); } else { _rewardName.text = weight + I18NManager.Get("Achievement_KMReward"); _rewardNum.text = ""; } }