using Snxxz.UI;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
public class EquipTip : MonoBehaviour
|
{
|
#region TopUI
|
[SerializeField]
|
Button closeBtn;
|
[SerializeField]
|
GameObject putOnIcon;
|
[SerializeField]
|
Text titleText;
|
[SerializeField]
|
Text equipScoreDes;
|
[SerializeField]
|
Text equipScoreValue;
|
[SerializeField]
|
Text needLvDes;
|
[SerializeField]
|
Text needLvValue;
|
[SerializeField]
|
List<Text> needPointTextlist = new List<Text>();
|
[SerializeField]
|
List<Text> needPointNumlist = new List<Text>();
|
[SerializeField]
|
Text dateText;
|
[SerializeField]
|
ItemCell itemCell;
|
|
[SerializeField]
|
Text realmTitleText;
|
[SerializeField] Image realmImg;
|
[SerializeField] GameObject container_FightPower;
|
[SerializeField] Text fightPowerText;
|
#endregion
|
|
#region MidUI
|
[SerializeField]
|
RectTransform attrContent;
|
[SerializeField]
|
ScrollRect scrollRect;
|
[SerializeField]
|
LayoutElement scrollLayout;
|
|
[SerializeField]
|
GameObject basicAttr;
|
[SerializeField]
|
Text basicTitleText;
|
[SerializeField]
|
Text basicAttrDes;
|
|
[SerializeField]
|
GameObject exhaustedAttr;
|
[SerializeField]
|
Text exhaustedTitleText;
|
[SerializeField]
|
Text exhaustedAttrDes;
|
|
[SerializeField]
|
GameObject legendAttr;
|
[SerializeField]
|
Text legendTitleText;
|
[SerializeField]
|
Text legendCntPreview;
|
[SerializeField]
|
Text legendAttrDes;
|
|
[SerializeField]
|
GameObject washAttr;
|
[SerializeField]
|
Text washTitleText;
|
[SerializeField]
|
Text washAttrDes;
|
|
[SerializeField]
|
GameObject gemAttr;
|
[SerializeField]
|
Text gemTitleText;
|
[SerializeField]
|
List<GemElementObj> gemObjlist = new List<GemElementObj>();
|
|
[SerializeField]
|
GameObject suitAttr;
|
[SerializeField]
|
Text suitTitleText;
|
[SerializeField]
|
ScrollerController suirAttrCtrl;
|
|
[Header("诛仙套装")]
|
[SerializeField] GameObject jadeDynastySuitObj;
|
[SerializeField] JadeDynastySuitAttrBeh curJadeDynastySuitAttr;
|
[SerializeField] JadeDynastySuitAttrBeh nextJadeDynastySuitAttr;
|
|
[SerializeField] List<GameObject> attrCutLinelist = new List<GameObject>();
|
#endregion
|
|
#region BottomUI
|
[SerializeField]
|
GameObject bottomPart;
|
[SerializeField]
|
EquipSource equipSourceNormal;
|
[SerializeField]
|
EquipSource equipSourceDes;
|
[SerializeField]
|
Text equipSourceText;
|
[SerializeField] Text dogzEquipDesText;
|
#endregion
|
|
[SerializeField]
|
RectTransform btnGroup;
|
|
[SerializeField]
|
GameObject operateBtn;
|
|
[SerializeField]
|
CanvasGroup tipAlpha;
|
|
Dictionary<AttrEnum, int> needPointDict = new Dictionary<AttrEnum, int>();
|
|
ItemTipsModel _itemTipsModel;
|
ItemTipsModel itemTipsModel
|
{
|
get
|
{
|
return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
}
|
}
|
|
PackModelInterface _modelInterface;
|
PackModelInterface modelInterface
|
{
|
get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); }
|
}
|
|
PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
JadeDynastyEquipModel equipModel { get { return ModelCenter.Instance.GetModel<JadeDynastyEquipModel>(); } }
|
|
ItemAttrData itemAttrData;
|
|
|
Color32 conditionColor = new Color32(255, 244, 205, 255);
|
private int curAttrTypeNum = 0;
|
|
public void InitModel(ItemAttrData attrData)
|
{
|
curAttrTypeNum = 0;
|
suirAttrCtrl.OnRefreshCell += RefreshSuitProCell;
|
KnapsackTimeCDMgr.Instance.RefreshItemOverdueTimeAct += RefreshRemainTime;
|
itemAttrData = attrData;
|
InitUI();
|
closeBtn.AddListener(OnClickCloseBtn);
|
}
|
|
private void OnEnable()
|
{
|
bottomPart.gameObject.SetActive(false);
|
StartCoroutine(SetScrollSize());
|
DebugEx.Log("分支测试");
|
}
|
|
IEnumerator SetScrollSize()
|
{
|
yield return null;
|
yield return null;
|
attrContent.anchoredPosition3D = new Vector3(attrContent.anchoredPosition3D.x, 0, 0);
|
SetMidUIHeight(attrContent.rect.height);
|
StartCoroutine(ShowBottomPart());
|
}
|
|
IEnumerator ShowBottomPart()
|
{
|
yield return null;
|
bottomPart.gameObject.SetActive(true);
|
SetBottomUI();
|
SetSuitAttrUI();
|
StartCoroutine(SetPanelScale());
|
}
|
|
IEnumerator SetPanelScale()
|
{
|
yield return null;
|
if(itemAttrData.isCompare)
|
{
|
if (itemAttrData.packType != PackType.Equip
|
&& itemAttrData.packType != PackType.DogzEquip
|
&& itemAttrData.packType != PackType.JadeDynastyEquip)
|
{
|
itemTipsModel.SetCurTips(this.GetComponent<RectTransform>());
|
}
|
else
|
{
|
itemTipsModel.SetCompareTips(this.GetComponent<RectTransform>());
|
}
|
}
|
else
|
{
|
itemTipsModel.SetCurTips(this.GetComponent<RectTransform>());
|
}
|
|
//this.transform.localScale = Vector3.one;
|
tipAlpha.alpha = 1;
|
}
|
|
private void InitUI()
|
{
|
#region 设置TopUI
|
titleText.text = itemTipsModel.GetItemTipsTitle(itemAttrData);
|
titleText.color = UIHelper.GetUIColor(itemAttrData.itemConfig.ItemColor);
|
ItemCellModel cellModel = new ItemCellModel(itemAttrData.itemId,itemAttrData.isPreview, (ulong)itemAttrData.count, itemAttrData.isBind,
|
itemAttrData.guid,itemAttrData.packType,itemAttrData.isCompare, itemAttrData.useDataDict);
|
itemCell.Init(cellModel);
|
if(itemAttrData.packType == PackType.Equip
|
|| itemAttrData.packType == PackType.DogzEquip
|
|| itemAttrData.packType == PackType.JadeDynastyEquip)
|
{
|
putOnIcon.SetActive(true);
|
}
|
else
|
{
|
putOnIcon.SetActive(false);
|
}
|
|
equipScoreDes.text = Language.Get("EquipWin_EquipPointText_1");
|
equipScoreValue.text = itemAttrData.score.ToString();
|
container_FightPower.SetActive(itemTipsModel.IsPeerlessEquip(itemAttrData.itemId));
|
fightPowerText.text = itemTipsModel.GetEquipFightPower(itemAttrData.score).ToString();
|
CheckUselimit();
|
RefreshRemainTime(itemAttrData.guid);
|
#endregion
|
|
#region 设置MidUI
|
SetBasicAttrUI();
|
SetExhaustedAttrUI();
|
SetLegendAttrUI();
|
SetWashAttrUI();
|
SetGemAttrUI();
|
SetSuitAttrUI();
|
SetJadeDynastySuitAttr();
|
for (int i = 0; i < attrCutLinelist.Count; i++)
|
{
|
if (i == curAttrTypeNum - 1)
|
{
|
attrCutLinelist[curAttrTypeNum - 1].SetActive(false);
|
}
|
else
|
{
|
attrCutLinelist[i].SetActive(true);
|
}
|
}
|
#endregion
|
|
#region 设置功能按钮
|
operateBtn.SetActive(false);
|
|
if (itemAttrData.isCompare)
|
{
|
if(itemAttrData.packType != PackType.Equip
|
&& itemAttrData.packType != PackType.DogzEquip)
|
{
|
CreateFuncBtn();
|
}
|
}
|
else
|
{
|
CreateFuncBtn();
|
}
|
#endregion
|
}
|
|
private void CheckUselimit()
|
{
|
int[] uselimits = itemAttrData.itemConfig.UseCondiType;
|
if (uselimits == null) return;
|
|
needLvValue.gameObject.SetActive(false);
|
needLvDes.gameObject.SetActive(false);
|
realmTitleText.gameObject.SetActive(false);
|
realmImg.gameObject.SetActive(false);
|
for(int i = 0; i < needPointTextlist.Count;i++)
|
{
|
needPointTextlist[i].gameObject.SetActive(false);
|
needPointNumlist[i].gameObject.SetActive(false);
|
}
|
for (int i = 0; i < uselimits.Length; i++)
|
{
|
switch (uselimits[i])
|
{
|
case 0:
|
if (itemAttrData.itemConfig.UseLV > 1)
|
{
|
needLvValue.gameObject.SetActive(true);
|
needLvDes.gameObject.SetActive(true);
|
}
|
needLvDes.text = Language.Get("KnapS110");
|
if (itemAttrData.isHavePutLimit)
|
{
|
needLvValue.text = itemAttrData.itemConfig.UseLV.ToString();
|
if (PlayerDatas.Instance.baseData.LV >= itemAttrData.itemConfig.UseLV)
|
{
|
needLvValue.color = conditionColor;
|
needLvDes.color = conditionColor;
|
}
|
else
|
{
|
needLvValue.color = UIHelper.GetUIColor(TextColType.Red);
|
needLvDes.color = UIHelper.GetUIColor(TextColType.Red);
|
}
|
}
|
else
|
{
|
needLvValue.text = 1.ToString();
|
needLvDes.color = conditionColor;
|
needLvValue.color = conditionColor;
|
}
|
|
break;
|
case 1:
|
if(itemAttrData.isHavePutLimit)
|
{
|
realmTitleText.gameObject.SetActive(true);
|
realmImg.gameObject.SetActive(true);
|
realmTitleText.text = Language.Get("RealmLimit1");
|
RealmConfig realmConfig = RealmConfig.Get(itemAttrData.itemConfig.RealmLimit);
|
if (itemAttrData.itemConfig.RealmLimit <= 0)
|
{
|
realmImg.SetSprite("NoRealm");
|
}
|
else
|
{
|
if (realmConfig != null)
|
{
|
realmImg.SetSprite(realmConfig.Img);
|
}
|
}
|
realmImg.SetNativeSize();
|
if (PlayerDatas.Instance.baseData.realmLevel >= itemAttrData.itemConfig.RealmLimit)
|
{
|
realmTitleText.color = conditionColor;
|
}
|
else
|
{
|
realmTitleText.color = UIHelper.GetUIColor(TextColType.Red);
|
}
|
}
|
|
break;
|
case 2:
|
RefreshNeedPointUI();
|
break;
|
}
|
}
|
|
}
|
|
private void OnDisable()
|
{
|
suirAttrCtrl.OnRefreshCell -= RefreshSuitProCell;
|
KnapsackTimeCDMgr.Instance.RefreshItemOverdueTimeAct -= RefreshRemainTime;
|
}
|
|
private void RefreshRemainTime(string guid)
|
{
|
if (guid != itemAttrData.guid)
|
{
|
return;
|
}
|
|
double remainTime = 0;
|
bool isRemain = itemAttrData.TryGetItemRemainTime(out remainTime);
|
dateText.gameObject.SetActive(isRemain);
|
if(isRemain)
|
{
|
SetDateLimitUI(remainTime);
|
}
|
}
|
|
private void SetDateLimitUI(double time)
|
{
|
dateText.gameObject.SetActive(true);
|
TimeSpan t = TimeSpan.FromSeconds(time);
|
if (t.TotalDays > 1)
|
{
|
dateText.text = Language.Get("EquipInfo_OverdueDay", (int)t.TotalDays);
|
}
|
else if (t.TotalHours > 1)
|
{
|
dateText.text = Language.Get("EquipInfo_OverdueHour", (int)t.TotalHours);
|
}
|
else if (t.TotalMinutes > 1)
|
{
|
dateText.text = Language.Get("EquipInfo_OverdueMin", (int)t.TotalMinutes);
|
}
|
else if (t.TotalMinutes > 0)
|
{
|
dateText.text = Language.Get("EquipInfo_OverdueMin", 1);
|
}
|
else if (t.TotalSeconds <= 0)
|
{
|
dateText.text = Language.Get("EquipInfo_Overdued");
|
}
|
}
|
|
private void RefreshNeedPointUI()
|
{
|
needPointDict.Clear();
|
if (itemAttrData.itemConfig.LimitSTR > 0)
|
{
|
needPointDict.Add(AttrEnum.POWER, itemAttrData.itemConfig.LimitSTR);
|
}
|
|
if (itemAttrData.itemConfig.LimitPHY > 0)
|
{
|
needPointDict.Add(AttrEnum.AGILITY, itemAttrData.itemConfig.LimitPHY);
|
}
|
|
if (itemAttrData.itemConfig.LimitPNE > 0)
|
{
|
needPointDict.Add(AttrEnum.MENTALITY, itemAttrData.itemConfig.LimitPNE);
|
}
|
|
List<AttrEnum> needlist = needPointDict.Keys.ToList();
|
|
int i = 0;
|
float offset = 0;
|
for (i = 0; i < needPointTextlist.Count; i++)
|
{
|
if (i < needlist.Count)
|
{
|
needPointTextlist[i].gameObject.SetActive(true);
|
needPointNumlist[i].gameObject.SetActive(true);
|
offset = needPointDict[needlist[i]] - UIHelper.GetPropertyMapPlayerData(needlist[i]);
|
switch (needlist[i])
|
{
|
case AttrEnum.POWER:
|
if (itemAttrData.isHavePutLimit)
|
{
|
SetNeedPointUI(needPointDict[needlist[i]], offset, needPointTextlist[i], needPointNumlist[i], Language.Get("KnapS113"));
|
}
|
else
|
{
|
SetNeedPointUI(1, 0, needPointTextlist[i], needPointNumlist[i], Language.Get("KnapS113"));
|
}
|
break;
|
case AttrEnum.AGILITY:
|
if (itemAttrData.isHavePutLimit)
|
{
|
SetNeedPointUI(needPointDict[needlist[i]], offset, needPointTextlist[i], needPointNumlist[i], Language.Get("KnapS112"));
|
}
|
else
|
{
|
SetNeedPointUI(1, 0, needPointTextlist[i], needPointNumlist[i], Language.Get("KnapS112"));
|
}
|
|
break;
|
case AttrEnum.MENTALITY:
|
if (itemAttrData.isHavePutLimit)
|
{
|
SetNeedPointUI(needPointDict[needlist[i]], offset, needPointTextlist[i], needPointNumlist[i], Language.Get("KnapS111"));
|
}
|
else
|
{
|
SetNeedPointUI(1, 0, needPointTextlist[i], needPointNumlist[i], Language.Get("KnapS111"));
|
}
|
break;
|
}
|
|
}
|
else
|
{
|
needPointTextlist[i].gameObject.SetActive(false);
|
needPointNumlist[i].gameObject.SetActive(false);
|
}
|
}
|
|
}
|
|
private void SetNeedPointUI(float needPoint, float offset, Text needPoinText, Text needPoinNum, string msg)
|
{
|
if (offset > 0)
|
{
|
needPoinNum.text = UIHelper.AppendStringColor(TextColType.Red, StringUtility.Contact(needPoint, Language.Get("KnapS118", offset)));
|
needPoinText.text = UIHelper.AppendStringColor(TextColType.Red, msg);
|
}
|
else
|
{
|
needPoinNum.color = conditionColor;
|
needPoinText.color = conditionColor;
|
needPoinNum.text = needPoint.ToString();
|
needPoinText.text = msg;
|
}
|
}
|
|
#region 设置属性UI
|
private void SetBasicAttrUI()
|
{
|
basicAttr.SetActive(true);
|
basicTitleText.text = Language.Get("RolePanel_BaseAttrText_1");
|
basicAttrDes.text = itemTipsModel.GetBasicAttr(itemAttrData);
|
curAttrTypeNum = 1;
|
}
|
|
private void SetExhaustedAttrUI()
|
{
|
if(itemAttrData.exhaustedMaxDataDict == null)
|
{
|
exhaustedAttr.SetActive(false);
|
return;
|
}
|
curAttrTypeNum = 2;
|
exhaustedAttr.SetActive(true);
|
exhaustedTitleText.text = Language.Get("EquipWin_ExtinctPropObj_Text_1");
|
exhaustedAttrDes.text = itemTipsModel.GetExhaustedAtrr(itemAttrData);
|
}
|
|
private void SetLegendAttrUI()
|
{
|
if(itemAttrData.legendDataDict == null)
|
{
|
legendAttr.SetActive(false);
|
return;
|
}
|
|
curAttrTypeNum = 3;
|
legendAttr.SetActive(true);
|
legendTitleText.text = Language.Get("EquipWin_LegendPropObj_Text_1");
|
legendAttrDes.text = itemTipsModel.GetLegendAttr(itemAttrData);
|
if (itemAttrData.isPreview)
|
{
|
legendCntPreview.gameObject.SetActive(true);
|
|
switch (itemAttrData.itemConfig.EquipPlace)
|
{
|
case 1:
|
case 2:
|
case 3:
|
case 4:
|
case 5:
|
case 6:
|
case 7:
|
case 8:
|
case 9:
|
case 10:
|
case 12:
|
legendCntPreview.text = itemTipsModel.GetEquipLegendAttrCntPreview(itemAttrData);
|
break;
|
case 101:
|
case 102:
|
case 103:
|
case 104:
|
case 105:
|
legendCntPreview.text = itemTipsModel.GetDogzLegendAttrCntPreview(itemAttrData);
|
break;
|
}
|
|
var packType = GeneralDefine.GetPackTypeByItemType(itemAttrData.itemConfig.Type);
|
switch(packType)
|
{
|
case PackType.JadeDynastyItem:
|
legendCntPreview.text = itemTipsModel.GetJadeDynastyAttrCntPreview(itemAttrData);
|
break;
|
}
|
}
|
else
|
{
|
legendCntPreview.gameObject.SetActive(false);
|
}
|
}
|
|
private void SetWashAttrUI()
|
{
|
if(itemAttrData.washDataDict == null)
|
{
|
washAttr.SetActive(false);
|
return;
|
}
|
|
switch (itemAttrData.itemConfig.EquipPlace)
|
{
|
case 101:
|
case 102:
|
case 103:
|
case 104:
|
case 105:
|
washAttr.SetActive(false);
|
return;
|
}
|
|
curAttrTypeNum = 4;
|
washAttr.SetActive(true);
|
washTitleText.text = Language.Get("EquipWin_WashPropObj_Text_1");
|
washAttrDes.text = itemTipsModel.GetWashAttr(itemAttrData);
|
}
|
|
private void SetGemAttrUI()
|
{
|
var packType = GeneralDefine.GetPackTypeByItemType(itemAttrData.itemConfig.Type);
|
int[] gemOpenLvs = packType == PackType.JadeDynastyItem ? itemTipsModel.jadeDynastyGemOpenLvs : itemTipsModel.gemOpenLvs;
|
if (itemAttrData.itemConfig.LV < gemOpenLvs[0])
|
{
|
gemAttr.SetActive(false);
|
return;
|
}
|
|
switch (itemAttrData.itemConfig.EquipPlace)
|
{
|
case 101:
|
case 102:
|
case 103:
|
case 104:
|
case 105:
|
gemAttr.SetActive(false);
|
return;
|
}
|
curAttrTypeNum = 5;
|
gemAttr.SetActive(true);
|
gemTitleText.text = Language.Get("EquipWin_GemPropObj_Text_1");
|
int cnt = 0;
|
int vipCnt = 0;
|
|
if (itemAttrData.itemConfig.LV >= gemOpenLvs[0])
|
{
|
cnt++;
|
}
|
|
if (itemAttrData.itemConfig.LV >= gemOpenLvs[1])
|
{
|
cnt++;
|
}
|
|
if (itemAttrData.itemConfig.LV >= gemOpenLvs[2])
|
{
|
cnt++;
|
}
|
|
if (PlayerDatas.Instance.baseData.VIPLv >= itemTipsModel.gemOpenVipLv)
|
{
|
vipCnt++;
|
}
|
|
int i = 0;
|
for (i = 0; i < gemObjlist.Count; i++)
|
{
|
int stoneId = 0;
|
if (itemAttrData.stones != null)
|
{
|
if(i < itemAttrData.stones.Length)
|
{
|
stoneId = (int)itemAttrData.stones[i];
|
}
|
}
|
|
if(i < gemObjlist.Count - 1)
|
{
|
if (i < cnt)
|
{
|
gemObjlist[i].gameObject.SetActive(true);
|
gemObjlist[i].InitModel(stoneId, i, itemAttrData.itemConfig.EquipPlace, false);
|
}
|
else
|
{
|
gemObjlist[i].InitModel(stoneId, i, itemAttrData.itemConfig.EquipPlace, true);
|
gemObjlist[i].gameObject.SetActive(false);
|
}
|
|
}
|
else
|
{
|
if (vipCnt != 0)
|
{
|
gemObjlist[i].InitModel(stoneId, i, itemAttrData.itemConfig.EquipPlace, false);
|
}
|
else
|
{
|
gemObjlist[i].InitModel(stoneId, i, itemAttrData.itemConfig.EquipPlace,true);
|
}
|
}
|
}
|
}
|
|
private void SetSuitAttrUI()
|
{
|
if(itemAttrData.suitAttrDataDict == null || itemAttrData.suitAttrDataDict.Count < 1)
|
{
|
suitAttr.SetActive(false);
|
return;
|
}
|
|
switch (itemAttrData.itemConfig.EquipPlace)
|
{
|
case 101:
|
case 102:
|
case 103:
|
case 104:
|
case 105:
|
suitAttr.SetActive(false);
|
return;
|
}
|
curAttrTypeNum = 6;
|
suitAttr.SetActive(true);
|
CreateSuitProCell();
|
|
}
|
|
private int length1 = 0;
|
private int length2 = 0;
|
private int length3 = 0;
|
|
private void CreateSuitProCell()
|
{
|
suirAttrCtrl.Refresh();
|
foreach(var type in itemAttrData.suitAttrDataDict.Keys)
|
{
|
int suitCnt = itemAttrData.GetSuitCntByType(type);
|
|
ItemSuitAttrData suitAttrData = itemAttrData.suitAttrDataDict[type];
|
length1 = suitAttrData.firstSuitAttrs.Length;
|
CellInfo info = new CellInfo()
|
{
|
infoInt1 = (int)type,
|
};
|
if (suitCnt > 0)
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Header, (int)type);
|
for (int i = 0; i < length1;i++)
|
{
|
if (i == 0)
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Normal, i,null,info);
|
}
|
else
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Tail, i,null,info);
|
}
|
}
|
length2 = length1 + suitAttrData.secondSuitAttrs.Length;
|
for (int i = length1; i < length2; i++)
|
{
|
if (i == length1)
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Normal, i, null, info);
|
}
|
else
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Tail, i, null, info);
|
}
|
}
|
length3 = length2 + suitAttrData.thirdSuitAttrs.Length;
|
for (int i = length2; i < length3; i++)
|
{
|
if (i == length2)
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Normal, i, null, info);
|
}
|
else
|
{
|
suirAttrCtrl.AddCell(ScrollerDataType.Tail, i, null, info);
|
}
|
}
|
}
|
|
}
|
|
suirAttrCtrl.Restart();
|
}
|
|
private void RefreshSuitProCell(ScrollerDataType type, CellView cell)
|
{
|
ItemSuitAttrData suitAttrData = default(ItemSuitAttrData);
|
switch (type)
|
{
|
case ScrollerDataType.Header:
|
Text titleName = cell.transform.Find("TitleTextCell").GetComponent<Text>();
|
suitAttrData = itemAttrData.suitAttrDataDict[(SuitType)cell.index];
|
titleName.text = StringUtility.Contact(suitAttrData.suitAttrConfig.name, "(", itemAttrData.GetSuitCntByType((SuitType)cell.index), "/", suitAttrData.suitAttrConfig.count3, ")");
|
break;
|
case ScrollerDataType.Normal:
|
case ScrollerDataType.Tail:
|
Text curNum = cell.transform.Find("FirstSuitATT").GetComponent<Text>();
|
Text curPro = cell.transform.Find("ATTTxt").GetComponent<Text>();
|
suitAttrData = itemAttrData.suitAttrDataDict[(SuitType)cell.info.Value.infoInt1];
|
if (cell.index == 0)
|
{
|
curNum.text = Language.Get("EquipSuit111", suitAttrData.suitAttrConfig.count1.ToString());
|
curNum.gameObject.SetActive(true);
|
}
|
else if (cell.index == length1)
|
{
|
curNum.text = Language.Get("EquipSuit111", suitAttrData.suitAttrConfig.count2.ToString());
|
curNum.gameObject.SetActive(true);
|
}
|
else if (cell.index == length2)
|
{
|
curNum.text = Language.Get("EquipSuit111", suitAttrData.suitAttrConfig.count3.ToString());
|
curNum.gameObject.SetActive(true);
|
}
|
else
|
{
|
curNum.gameObject.SetActive(false);
|
}
|
|
PlayerPropertyConfig playerProModel = null;
|
if (cell.index < length1)
|
{
|
playerProModel = PlayerPropertyConfig.Get(suitAttrData.firstSuitAttrs[cell.index]);
|
if (playerProModel.Name.Contains("%s"))
|
{
|
curPro.text = playerProModel.Name.Replace("%s", itemTipsModel.GetProValueTypeStr(playerProModel, suitAttrData.firstSuitAttrValues[cell.index]));
|
}
|
else
|
{
|
curPro.text = StringUtility.Contact(playerProModel.Name, "+", itemTipsModel.GetProValueTypeStr(playerProModel, suitAttrData.firstSuitAttrValues[cell.index]));
|
}
|
ChangeSuitAttrColor(curNum,curPro,itemAttrData.GetSuitCntByType((SuitType)cell.info.Value.infoInt1), suitAttrData.suitAttrConfig.count1);
|
}
|
else if (cell.index >= length1 && cell.index < length2)
|
{
|
playerProModel = PlayerPropertyConfig.Get(suitAttrData.secondSuitAttrs[cell.index - length1]);
|
if (playerProModel.Name.Contains("%s"))
|
{
|
curPro.text = playerProModel.Name.Replace("%s", itemTipsModel.GetProValueTypeStr(playerProModel, suitAttrData.secondSuitAttrValues[cell.index - length1]));
|
}
|
else
|
{
|
curPro.text = StringUtility.Contact(playerProModel.Name, "+", itemTipsModel.GetProValueTypeStr(playerProModel, suitAttrData.secondSuitAttrValues[cell.index - length1]));
|
}
|
ChangeSuitAttrColor(curNum, curPro, itemAttrData.GetSuitCntByType((SuitType)cell.info.Value.infoInt1), suitAttrData.suitAttrConfig.count2);
|
}
|
else if (cell.index >= length2 && cell.index < length3)
|
{
|
playerProModel = PlayerPropertyConfig.Get(suitAttrData.thirdSuitAttrs[cell.index - length2]);
|
if (playerProModel.Name.Contains("%s"))
|
{
|
curPro.text = playerProModel.Name.Replace("%s", itemTipsModel.GetProValueTypeStr(playerProModel, suitAttrData.thirdSuitAttrValues[cell.index - length2]));
|
}
|
else
|
{
|
curPro.text = StringUtility.Contact(playerProModel.Name, "+", itemTipsModel.GetProValueTypeStr(playerProModel, suitAttrData.thirdSuitAttrValues[cell.index - length2]));
|
}
|
ChangeSuitAttrColor(curNum, curPro, itemAttrData.GetSuitCntByType((SuitType)cell.info.Value.infoInt1), suitAttrData.suitAttrConfig.count3);
|
}
|
break;
|
}
|
}
|
|
private void ChangeSuitAttrColor(Text num,Text attr,int suitCnt,int needCnt)
|
{
|
if(suitCnt >= needCnt)
|
{
|
num.text = StringUtility.Contact("<color=#35e122>", num.text, "</color>");
|
attr.text = StringUtility.Contact("<color=#35e122>", attr.text, "</color>");
|
}
|
else
|
{
|
num.text = StringUtility.Contact("<color=#9e8f73>", num.text, "</color>");
|
attr.text = StringUtility.Contact("<color=#9e8f73>", attr.text, "</color>");
|
}
|
}
|
|
private void SetJadeDynastySuitAttr()
|
{
|
if (jadeDynastySuitObj == null) return;
|
|
if(itemAttrData.itemConfig.EquipPlace >= (int)RoleEquipType.JadeDynasty_Cloak
|
&& itemAttrData.itemConfig.EquipPlace <= (int)RoleEquipType.JadeDynasty_Sword4)
|
{
|
jadeDynastySuitObj.SetActive(true);
|
}
|
else
|
{
|
jadeDynastySuitObj.SetActive(false);
|
return;
|
}
|
|
PackType packType = itemAttrData.packType == PackType.Deleted ? PackType.JadeDynastyItem : itemAttrData.packType;
|
|
curJadeDynastySuitAttr.SetDisplay(packType,false,itemAttrData.itemConfig.EquipPlace,itemAttrData.itemId);
|
nextJadeDynastySuitAttr.SetDisplay(packType, true, itemAttrData.itemConfig.EquipPlace,itemAttrData.itemId);
|
}
|
|
private void SetMidUIHeight(float midHeight)
|
{
|
scrollRect.enabled = false;
|
|
if (midHeight < itemTipsModel.equipMidHeights[0])
|
{
|
scrollLayout.preferredHeight = itemTipsModel.equipMidHeights[0];
|
}
|
else if (midHeight > itemTipsModel.equipMidHeights[1])
|
{
|
scrollRect.enabled = true;
|
scrollLayout.preferredHeight = itemTipsModel.equipMidHeights[1];
|
}
|
else
|
{
|
scrollLayout.preferredHeight = midHeight;
|
}
|
}
|
#endregion
|
|
private void SetBottomUI()
|
{
|
if (itemAttrData == null) return;
|
|
switch (itemAttrData.itemConfig.EquipPlace)
|
{
|
case 1:
|
case 2:
|
case 3:
|
case 4:
|
case 5:
|
case 6:
|
case 7:
|
case 8:
|
case 9:
|
case 10:
|
case 12:
|
case 121:
|
case 122:
|
case 123:
|
case 124:
|
case 125:
|
case 126:
|
case 127:
|
case 128:
|
case 129:
|
case 130:
|
case 131:
|
case 132:
|
if (dogzEquipDesText != null)
|
{
|
dogzEquipDesText.gameObject.SetActive(false);
|
}
|
if (itemAttrData.itemConfig.Description == "" || string.IsNullOrEmpty(itemAttrData.itemConfig.Description))
|
{
|
equipSourceNormal.gameObject.SetActive(true);
|
equipSourceDes.gameObject.SetActive(false);
|
equipSourceText.gameObject.SetActive(false);
|
SetBottomText(equipSourceNormal);
|
}
|
else
|
{
|
equipSourceNormal.gameObject.SetActive(false);
|
equipSourceDes.gameObject.SetActive(true);
|
equipSourceText.gameObject.SetActive(true);
|
SetBottomText(equipSourceDes);
|
equipSourceText.text = itemAttrData.itemConfig.Description;
|
}
|
break;
|
case 101:
|
case 102:
|
case 103:
|
case 104:
|
case 105:
|
equipSourceNormal.gameObject.SetActive(false);
|
equipSourceDes.gameObject.SetActive(false);
|
equipSourceText.gameObject.SetActive(false);
|
if (dogzEquipDesText != null)
|
{
|
dogzEquipDesText.gameObject.SetActive(true);
|
dogzEquipDesText.text = itemAttrData.itemConfig.Description;
|
}
|
break;
|
}
|
}
|
|
private void SetBottomText(EquipSource source)
|
{
|
source.jobTitleText.text = Language.Get("EquipWin_JobTitleText_1");
|
source.jobText.text = itemTipsModel.GetEquipJobName(itemAttrData);
|
source.partTitleText.text = Language.Get("EquipWin_PartTitleText_1");
|
int equipPlace = itemAttrData.itemConfig.EquipPlace;
|
switch(equipPlace)
|
{
|
case 1:
|
case 2:
|
case 3:
|
case 4:
|
case 5:
|
case 6:
|
case 7:
|
case 8:
|
case 9:
|
case 10:
|
case 12:
|
source.partText.text = StringUtility.Contact(FuncConfigConfig.GetEquipTipsAreaName(itemAttrData.itemConfig.EquipPlace), itemAttrData.itemConfig.LV, Language.Get("L1047"));
|
break;
|
case 121:
|
case 122:
|
case 123:
|
case 124:
|
case 125:
|
case 126:
|
case 127:
|
case 128:
|
case 129:
|
case 130:
|
case 131:
|
case 132:
|
source.partText.text = StringUtility.Contact(Language.Get(((RoleEquipType)equipPlace).ToString()), itemAttrData.itemConfig.LV, Language.Get("L1047"));
|
break;
|
}
|
}
|
|
private void CreateFuncBtn()
|
{
|
btnGroup.anchoredPosition3D = Vector3.zero;
|
if (itemAttrData.tipsFuncBtnDic.Count > 0)
|
{
|
foreach (ItemOperateType key in itemAttrData.tipsFuncBtnDic.Keys)
|
{
|
Button btn = OnGUIButton(btnGroup.gameObject, operateBtn, key.ToString(), Language.Get(StringUtility.Contact("ItemHandle_", key.ToString())));
|
if(itemAttrData.guid == playerPack.lookItemGUID && playerPack.lookLineIndex != -1)
|
{
|
switch (key)
|
{
|
case ItemOperateType.putOn:
|
SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId);
|
if (successConfig != null
|
&& (successConfig.Type == 39
|
|| successConfig.Type == 82
|
|| successConfig.Type == 83))
|
{
|
AchievementGuideEffect guidEffect = AchievementGuideEffectPool.Require(1);
|
guidEffect.transform.SetParentEx(btn.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
guidEffect.effect.renderQueue = 4500;
|
}
|
break;
|
}
|
}
|
|
btn.RemoveAllListeners();
|
btn.onClick.AddListener(() => {
|
OnClickCloseBtn();
|
itemAttrData.tipsFuncBtnDic[key](key,"");
|
});
|
}
|
}
|
}
|
|
private Button OnGUIButton(GameObject parent, GameObject sourceBtn, string btnName, string textName)
|
{
|
GameObject go = Instantiate(sourceBtn);
|
go.name = btnName;
|
go.transform.SetParent(parent.transform);
|
go.transform.Find("BtnText").GetComponent<Text>().text = textName;
|
go.transform.localPosition = Vector3.zero;
|
go.transform.localScale = Vector3.one;
|
Button btn = go.GetComponent<Button>();
|
go.SetActive(true);
|
KnapSackEventMgr.Instance.SetEquipWinTempObj(go);
|
return btn;
|
}
|
|
private void OnClickCloseBtn()
|
{
|
closeBtn.onClick.RemoveAllListeners();
|
KnapSackEventMgr.Instance.HideItemPopWin();
|
}
|
|
}
|
}
|
|
|