| | |
| | | using UnityEngine.UI; |
| | | using TableConfig; |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | { |
| | |
| | | { |
| | | |
| | | [SerializeField] Button m_WHYJButton;
|
| | | [SerializeField] GameObject m_Container_WHYJ;
|
| | | [SerializeField] GameObject m_Container_WHYJ; |
| | | [SerializeField] Transform m_Horizontal;
|
| | | [SerializeField] Image m_Rating;//评级
|
| | | DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | |
|
| | | List<int> ListRating = new List<int>();
|
| | | public void Init()
|
| | | {
|
| | | ListRating.Clear();
|
| | | var congfig = Config.Instance.Get<DungeonOpenTimeConfig>(51010).RewardRate;
|
| | | for (int i = 0; i < congfig.Length; i++)
|
| | | {
|
| | | ListRating.Add(congfig[i]);
|
| | | }
|
| | | model.dungeonFightStageChangeEevent -= dungeonFightStageChangeEevent;
|
| | | model.dungeonFightStageChangeEevent += dungeonFightStageChangeEevent;
|
| | | model.updateMissionEvent -= updateMissionEvent;
|
| | |
| | | {
|
| | | m_Container_WHYJ.SetActive(false);
|
| | | }
|
| | | SetRatingImage();
|
| | | SetTranItemCell();
|
| | | }
|
| | |
|
| | | private void updateMissionEvent()
|
| | | {
|
| | | SetRatingImage();
|
| | | SetTranItemCell();
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | m_Horizontal.GetChild(i).gameObject.SetActive(true);
|
| | | ItemCell ItemCell = m_Horizontal.GetChild(i).GetComponent<ItemCell>();
|
| | | ItemCellModel cellModel = new ItemCellModel(RewardList[i], true, (ulong)QuantityList[i], 0);
|
| | | float value = GetRating() * QuantityList[i];
|
| | | ItemCellModel cellModel = new ItemCellModel(RewardList[i], true, (ulong)Math.Floor(value), 0);
|
| | | ItemCell.Init(cellModel);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Horizontal.GetChild(i).gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | } |
| | | private void OnClickButton()
|
| | | {
|
| | | m_Container_WHYJ.SetActive(!m_Container_WHYJ.activeSelf);
|
| | | } |
| | | } |
| | | |
| | | private float GetRating()
|
| | | {
|
| | | float Value = 1f;
|
| | | if (ListRating.Count < 4)
|
| | | {
|
| | | return Value;
|
| | | }
|
| | | switch (model.mission.grade)
|
| | | {
|
| | | case 1:
|
| | | Value =(float)Math.Round((double)ListRating[4] / 100, 1); |
| | | return Value;
|
| | | case 2:
|
| | | Value = (float)Math.Round((double)ListRating[3] / 100, 1);
|
| | | return Value;
|
| | | case 3:
|
| | | Value = (float)Math.Round((double)ListRating[2] / 100, 1);
|
| | | return Value;
|
| | | case 4:
|
| | | Value = (float)Math.Round((double)ListRating[1] / 100, 1);
|
| | | return Value;
|
| | | case 5:
|
| | | Value = (float)Math.Round((double)ListRating[0] / 100, 1);
|
| | | return Value;
|
| | | default:
|
| | | Value = (float)Math.Round((double)ListRating[0] / 100, 1);
|
| | | return Value;
|
| | | } |
| | | } |
| | | private void SetRatingImage()
|
| | | {
|
| | | switch (model.mission.grade)
|
| | | {
|
| | | case 1:
|
| | | m_Rating.SetSprite("Rating_D");
|
| | | break;
|
| | | case 2:
|
| | | m_Rating.SetSprite("Rating_C");
|
| | | break;
|
| | | case 3:
|
| | | m_Rating.SetSprite("Rating_B");
|
| | | break;
|
| | | case 4:
|
| | | m_Rating.SetSprite("Rating_A");
|
| | | break;
|
| | | case 5:
|
| | | m_Rating.SetSprite("Rating_S");
|
| | | break;
|
| | | default:
|
| | | m_Rating.SetSprite("Rating_S");
|
| | | break;
|
| | | }
|
| | | } |
| | | } |
| | | } |
| | | |
| | | |