| | |
| | | |
| | | [SerializeField] Text m_MaxTrainLevel; |
| | | [SerializeField] ItemCell m_TargetEquip; |
| | | [SerializeField] ItemBehaviour m_Material; |
| | | [SerializeField] Text m_MaterialCount; |
| | | [SerializeField] ItemBehaviour m_InevitableMaterial; |
| | | [SerializeField] Text m_InevitableMaterialCount; |
| | | [SerializeField] RectTransform m_DiamondContainer; |
| | | [SerializeField] Text m_DiamondCount; |
| | | |
| | | [SerializeField] MaterialCell m_MaterialCell; |
| | | [SerializeField] InevitableMaterialCell m_InevitableMaterial; |
| | | |
| | | [SerializeField] RectTransform m_UnTrainableContainer; |
| | | [SerializeField] RectTransform m_TrainableContainer; |
| | | [SerializeField] Text m_TrainLevel; |
| | | [SerializeField] EquipTrainPropertyBarBehaviour[] m_PropertyBarBehaviours; |
| | | [SerializeField] RectTransform m_MaxLevelContainer; |
| | |
| | | var place = model.selectedPlace.value; |
| | | var maxTrain = model.equipTrainMaxLevel.Fetch(); |
| | | |
| | | var star = starModel.GetEquipStarLevel(level, place); |
| | | m_MaxTrainLevel.text = string.Format("{0}星装备最高可洗练至{1}级", star, maxTrain); |
| | | if (maxTrain > 0) |
| | | { |
| | | var star = starModel.GetEquipStarLevel(level, place); |
| | | m_MaxTrainLevel.text = string.Format("{0}星装备最高可洗练至{1}级", star, maxTrain); |
| | | } |
| | | else |
| | | { |
| | | m_MaxTrainLevel.text = "提升装备星级可洗练"; |
| | | } |
| | | } |
| | | |
| | | if (force || model.material.dirty) |
| | |
| | | |
| | | private void DisplayMaterial(int level, int place, int itemId) |
| | | { |
| | | var own = 0; |
| | | var need = 0; |
| | | if (itemId > 0) |
| | | { |
| | | m_Material.gameObject.SetActive(true); |
| | | m_MaterialCount.gameObject.SetActive(true); |
| | | m_Material.SetItem(itemId, 1); |
| | | var need = model.GetMaterialNeed(level, place); |
| | | var own = packModel.GetItemCountByID(PackType.Item, itemId); |
| | | var enough = own >= need; |
| | | m_MaterialCount.text = string.Format("{0}/{1}", UIHelper.AppendStringColor(enough ? TextColType.White : TextColType.Red, own.ToString(), true), need); |
| | | need = model.GetMaterialNeed(level, place); |
| | | own = packModel.GetItemCountByID(PackType.Item, itemId); |
| | | } |
| | | else |
| | | { |
| | | m_Material.gameObject.SetActive(false); |
| | | m_MaterialCount.gameObject.SetActive(false); |
| | | } |
| | | |
| | | m_MaterialCell.Display(itemId, need, own); |
| | | } |
| | | |
| | | private void DisplayInevitableMaterial(int level, int place, int need) |
| | | { |
| | | m_InevitableMaterial.SetItem(GeneralDefine.equipTrainMustItemId, 1); |
| | | var own = packModel.GetItemCountByID(PackType.Item, GeneralDefine.equipTrainMustItemId); |
| | | var enough = own >= need; |
| | | |
| | | m_InevitableMaterialCount.text = string.Format("{0}/{1}", |
| | | UIHelper.AppendStringColor(enough ? TextColType.White : TextColType.Red, own.ToString(), true), need); |
| | | |
| | | if (enough) |
| | | var equipGuid = equipModel.GetEquip(level, place); |
| | | var trainable = model.IsEquipPlaceTrainable(equipGuid); |
| | | if (trainable) |
| | | { |
| | | m_DiamondContainer.gameObject.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | m_DiamondContainer.gameObject.SetActive(true); |
| | | var own = packModel.GetItemCountByID(PackType.Item, GeneralDefine.equipTrainMustItemId); |
| | | var type = EquipTrainModel.GetTrainType(place); |
| | | var trainLevel = model.GetTrainLevel(level, place); |
| | | var config = EquipWashConfig.Get(type, trainLevel + 1); |
| | | m_DiamondCount.text = config.mustCosts[need - 1].ToString(); |
| | | m_InevitableMaterial.Display(false, own, need, config.mustCosts[need - 1]); |
| | | } |
| | | else |
| | | { |
| | | m_InevitableMaterial.Display(true, 0, 0, 0); |
| | | } |
| | | } |
| | | |
| | | private void DisplayProperty(List<EquipTrainPropertyBar> propertyBars) |
| | | { |
| | | for (int i = 0; i < m_PropertyBarBehaviours.Length; i++) |
| | | var isTrainable = !propertyBars.IsNullOrEmpty(); |
| | | if (isTrainable) |
| | | { |
| | | var behaviour = m_PropertyBarBehaviours[i]; |
| | | if (i < propertyBars.Count) |
| | | m_UnTrainableContainer.gameObject.SetActive(false); |
| | | m_TrainableContainer.gameObject.SetActive(true); |
| | | for (int i = 0; i < m_PropertyBarBehaviours.Length; i++) |
| | | { |
| | | behaviour.gameObject.SetActive(true); |
| | | behaviour.Display(propertyBars[i]); |
| | | } |
| | | else |
| | | { |
| | | behaviour.gameObject.SetActive(false); |
| | | var behaviour = m_PropertyBarBehaviours[i]; |
| | | if (i < propertyBars.Count) |
| | | { |
| | | behaviour.gameObject.SetActive(true); |
| | | behaviour.Display(propertyBars[i]); |
| | | } |
| | | else |
| | | { |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | else |
| | | { |
| | | m_UnTrainableContainer.gameObject.SetActive(true); |
| | | m_TrainableContainer.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | private void DisplayOperateButton(EquipTrainModel.TrainOperateType opreateType) |
| | |
| | | switch (opreateType) |
| | | { |
| | | case EquipTrainModel.TrainOperateType.None: |
| | | m_Train.gameObject.SetActive(false); |
| | | m_Save.gameObject.SetActive(false); |
| | | m_GiveUp.gameObject.SetActive(false); |
| | | break; |
| | | case EquipTrainModel.TrainOperateType.Train: |
| | | m_Train.gameObject.SetActive(true); |
| | |
| | | m_GiveUp.gameObject.SetActive(false); |
| | | break; |
| | | case EquipTrainModel.TrainOperateType.Max: |
| | | m_Train.gameObject.SetActive(false); |
| | | m_Save.gameObject.SetActive(false); |
| | | m_GiveUp.gameObject.SetActive(false); |
| | | break; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | [Serializable] |
| | | public class MaterialCell |
| | | { |
| | | public RectTransform m_LockContainer; |
| | | public ItemBehaviour m_Material; |
| | | public Text m_MaterialCount; |
| | | |
| | | public void Display(int itemId, int need, int own) |
| | | { |
| | | if (itemId > 0) |
| | | { |
| | | m_LockContainer.gameObject.SetActive(false); |
| | | m_Material.gameObject.SetActive(true); |
| | | m_MaterialCount.gameObject.SetActive(true); |
| | | m_Material.SetItem(itemId, 1); |
| | | var enough = own >= need; |
| | | m_MaterialCount.text = string.Format("{0}/{1}", UIHelper.AppendStringColor(enough ? TextColType.White : TextColType.Red, own.ToString(), true), need); |
| | | } |
| | | else |
| | | { |
| | | m_LockContainer.gameObject.SetActive(true); |
| | | m_Material.gameObject.SetActive(false); |
| | | m_MaterialCount.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | [Serializable] |
| | | public class InevitableMaterialCell |
| | | { |
| | | public RectTransform m_LockContainer; |
| | | public ItemBehaviour m_InevitableMaterial; |
| | | public Text m_InevitableMaterialCount; |
| | | public RectTransform m_DiamondContainer; |
| | | public Text m_DiamondCount; |
| | | |
| | | public void Display(bool locked, int need, int own, int diamond) |
| | | { |
| | | if (locked) |
| | | { |
| | | m_LockContainer.gameObject.SetActive(true); |
| | | m_InevitableMaterial.gameObject.SetActive(false); |
| | | m_InevitableMaterialCount.gameObject.SetActive(false); |
| | | m_DiamondContainer.gameObject.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | m_LockContainer.gameObject.SetActive(false); |
| | | m_InevitableMaterial.gameObject.SetActive(true); |
| | | m_InevitableMaterialCount.gameObject.SetActive(true); |
| | | |
| | | m_InevitableMaterial.SetItem(GeneralDefine.equipTrainMustItemId, 1); |
| | | var enough = own >= need; |
| | | |
| | | m_InevitableMaterialCount.text = string.Format("{0}/{1}", |
| | | UIHelper.AppendStringColor(enough ? TextColType.White : TextColType.Red, own.ToString(), true), need); |
| | | |
| | | if (diamond > 0) |
| | | { |
| | | m_DiamondContainer.gameObject.SetActive(true); |
| | | m_DiamondCount.text = diamond.ToString(); |
| | | } |
| | | else |
| | | { |
| | | m_DiamondContainer.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |