using Snxxz.UI;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
public class EquipSuitCell : CellView
|
{
|
[SerializeField]
|
public Button suitCellToggle;
|
[SerializeField]
|
public GameObject equipBg;
|
[SerializeField]
|
public ItemCell itemCell;
|
[SerializeField]
|
public GameObject haveEquip;
|
[SerializeField]
|
public Text haveCondiText;
|
[SerializeField]
|
public GameObject noEquip;
|
[SerializeField]
|
public Text placeText;
|
[SerializeField]
|
public Text condiText;
|
|
[SerializeField]
|
public Text nameText;
|
[SerializeField]
|
public GameObject suitLvObj;
|
[SerializeField]
|
public Text suitLvText;
|
[SerializeField]
|
public GameObject selectImg;
|
[SerializeField]
|
public GameObject unSelectImg;
|
[SerializeField]
|
public Image groupTypeIcon;
|
[SerializeField]
|
public RedpointBehaviour redpoint;
|
|
PlayerSuitModel _suitModel;
|
PlayerSuitModel SuitModel
|
{
|
get { return _suitModel ?? (_suitModel = ModelCenter.Instance.GetModel<PlayerSuitModel>()); }
|
}
|
|
PackModel _playerPack;
|
PackModel playerPack
|
{
|
get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
|
}
|
|
public void SetDisplayModel(int repointId,int equipPlace,SuitType suitType,int selectIndex)
|
{
|
redpoint.redpointId = repointId;
|
int suitLv = SuitModel.GetServerSuitLv(equipPlace, (int)suitType);
|
int groupType = SuitModel.GetGroupType(equipPlace);
|
ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip,equipPlace);
|
suitLvObj.SetActive(false);
|
haveCondiText.gameObject.SetActive(false);
|
if (itemModel != null)
|
{
|
itemCell.gameObject.SetActive(true);
|
itemCell.Init(itemModel);
|
bool isMaker = SuitModel.IsMakerSuit(suitType, itemModel.config.ItemColor, itemModel.config.StarLevel);
|
switch (suitType)
|
{
|
case SuitType.LowSuit:
|
if (!isMaker)
|
{
|
haveEquip.SetActive(false);
|
noEquip.SetActive(true);
|
placeText.text = Language.Get("EquipWash101") + UIHelper.GetEquipPlaceName(equipPlace);
|
condiText.text = Language.Get("EquipSuitUnLowNeed",StringUtility.Contact(Language.Get("EquipSuitOrange"), 1, Language.Get("EquipSuitStar")));
|
}
|
else
|
{
|
haveEquip.SetActive(true);
|
noEquip.SetActive(false);
|
|
if (suitLv > 0)
|
{
|
suitLvObj.SetActive(true);
|
suitLvText.text = Language.Get("EquipSuitLV", suitLv);
|
}
|
}
|
break;
|
case SuitType.HighSuit:
|
int lowSuitLv = SuitModel.GetServerSuitLv(equipPlace,(int)SuitType.LowSuit);
|
if (!isMaker)
|
{
|
haveEquip.SetActive(false);
|
noEquip.SetActive(true);
|
placeText.text = Language.Get("EquipWash101") + UIHelper.GetEquipPlaceName(equipPlace);
|
condiText.text = Language.Get("EquipSuitUnLowNeed", StringUtility.Contact(Language.Get("EquipSuitRed"),2, Language.Get("EquipSuitStar")));
|
}
|
else
|
{
|
haveEquip.SetActive(true);
|
noEquip.SetActive(false);
|
if (suitLv > 0)
|
{
|
suitLvObj.SetActive(true);
|
suitLvText.text = Language.Get("EquipSuitLV", suitLv);
|
}
|
|
if(suitLv >= lowSuitLv && !SuitModel.IsReachMax(equipPlace,(int)suitType,suitLv))
|
{
|
haveCondiText.gameObject.SetActive(true);
|
haveCondiText.text = Language.Get("NewEquipSuitNormal",lowSuitLv + 1);
|
}
|
}
|
break;
|
}
|
nameText.text = UIHelper.AppendStringColor(itemModel.config.ItemColor, itemModel.config.ItemName, true);
|
}
|
else
|
{
|
haveEquip.SetActive(false);
|
noEquip.SetActive(true);
|
itemCell.gameObject.SetActive(false);
|
placeText.text = Language.Get("EquipWash101") + UIHelper.GetEquipPlaceName(equipPlace);
|
switch (suitType)
|
{
|
case SuitType.LowSuit:
|
condiText.text = Language.Get("EquipSuitUnLowNeed", StringUtility.Contact(Language.Get("EquipSuitOrange"), 1, Language.Get("EquipSuitStar")));
|
break;
|
case SuitType.HighSuit:
|
condiText.text = Language.Get("EquipSuitUnLowNeed", StringUtility.Contact(Language.Get("EquipSuitRed"), 2, Language.Get("EquipSuitStar")));
|
break;
|
}
|
}
|
|
if (this.index == selectIndex)
|
{
|
selectImg.SetActive(true);
|
unSelectImg.SetActive(false);
|
}
|
else
|
{
|
selectImg.SetActive(false);
|
unSelectImg.SetActive(true);
|
}
|
|
switch(groupType)
|
{
|
case 1:
|
groupTypeIcon.SetSprite("Biaoqian_fang");
|
break;
|
case 2:
|
groupTypeIcon.SetSprite("Biaoqian_Xian");
|
break;
|
}
|
}
|
|
|
}
|