using Snxxz.UI;
|
using TableConfig;
|
using System.Text;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
public class GetItemPathModel : Model
|
{
|
public ItemConfig chinItemModel { get; private set; }
|
public int isBind { get; private set;}
|
public int level { get; private set; }
|
public string[] extraInfos { get; private set; }
|
private StringBuilder _extraInfoBuider = new StringBuilder();
|
private StringBuilder _allInfoDesBuider = new StringBuilder();
|
|
public override void Init()
|
{
|
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
public void SetChinItemModel(int itemId, int isBind = 0,bool isNoOpen = false ,params string[] extraInfos)
|
{
|
DebugEx.Log("物品ID:" + itemId);
|
chinItemModel = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (chinItemModel == null) return;
|
|
this.isBind = isBind;
|
this.extraInfos = extraInfos;
|
if(!isNoOpen)
|
{
|
if (chinItemModel != null)
|
{
|
int equipPlace = chinItemModel.EquipPlace;
|
if (equipPlace > 0 && equipPlace < 13)
|
{
|
WindowCenter.Instance.Open<GetEquipPathWin>();
|
}
|
else if (equipPlace == 0)
|
{
|
WindowCenter.Instance.Open<GetItemPathWin>();
|
}
|
else
|
{
|
DebugEx.Log("暂无此装备位的处理:" + equipPlace);
|
}
|
}
|
}
|
|
}
|
|
public void SetRuneModel(int itemId,int _level, params string[] extraInfos)
|
{
|
DebugEx.Log("物品ID:" + itemId);
|
chinItemModel = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (chinItemModel == null) return;
|
this.isBind = 0;
|
this.level = _level;
|
this.extraInfos = extraInfos;
|
WindowCenter.Instance.Open<RunePathWin>();
|
}
|
|
public void SetPetMatUnlockModel(int itemId, int isBind = 0,params string[] extraInfos)
|
{
|
DebugEx.Log("物品ID:" + itemId);
|
chinItemModel = ConfigManager.Instance.GetTemplate<ItemConfig>(itemId);
|
if (chinItemModel == null) return;
|
|
this.isBind = 0;
|
this.extraInfos = extraInfos;
|
WindowCenter.Instance.Open<GetPetMatPathWin>();
|
}
|
|
public string GetExtraInfos()
|
{
|
_extraInfoBuider.Length = 0;
|
if (extraInfos == null)
|
return "";
|
|
int i = 0;
|
for(i = 0; i < extraInfos.Length; i++)
|
{
|
_extraInfoBuider.Append(extraInfos[i] + "\n");
|
}
|
return _extraInfoBuider.ToString();
|
}
|
|
public string GetAllInfoDes()
|
{
|
_allInfoDesBuider.Length = 0;
|
if (chinItemModel == null)
|
return "";
|
|
_allInfoDesBuider.Append(chinItemModel.Description + "\n");
|
_allInfoDesBuider.Append(GetExtraInfos());
|
|
return _allInfoDesBuider.ToString();
|
}
|
|
public void ResetAllModel()
|
{
|
chinItemModel = null;
|
isBind = 0;
|
extraInfos = null;
|
}
|
|
private List<GetItemWaysConfig> getWayslist = new List<GetItemWaysConfig>();
|
private int[] waysArray = null;
|
public List<GetItemWaysConfig> GetWaysList()
|
{
|
getWayslist.Clear();
|
waysArray = null;
|
if (chinItemModel == null)
|
return getWayslist;
|
|
waysArray = chinItemModel.GetWay;
|
if(waysArray != null)
|
{
|
int i = 0;
|
for (i = 0; i < waysArray.Length; i++)
|
{
|
GetItemWaysConfig itemWaysModel = ConfigManager.Instance.GetTemplate<GetItemWaysConfig>(waysArray[i]);
|
if (itemWaysModel != null)
|
{
|
if (itemWaysModel.FuncOpenId == 0)
|
{
|
bool isAddSpec = false;
|
if (CheckIsSpecGetWay(itemWaysModel, out isAddSpec))
|
{
|
if (isAddSpec)
|
{
|
getWayslist.Add(itemWaysModel);
|
}
|
}
|
else
|
{
|
getWayslist.Add(itemWaysModel);
|
}
|
}
|
else
|
{
|
if (FuncOpen.Instance.IsFuncOpen(itemWaysModel.FuncOpenId))
|
{
|
bool isAddSpec = false;
|
if (CheckIsSpecGetWay(itemWaysModel, out isAddSpec))
|
{
|
if (isAddSpec)
|
{
|
getWayslist.Add(itemWaysModel);
|
}
|
}
|
else
|
{
|
getWayslist.Add(itemWaysModel);
|
}
|
}
|
}
|
}
|
|
}
|
}
|
|
return getWayslist;
|
}
|
|
private bool CheckIsSpecGetWay(GetItemWaysConfig itemWaysModel,out bool isAddSpec)
|
{
|
isAddSpec = false;
|
switch (itemWaysModel.ID)
|
{
|
case 85:
|
TreasureFindHostModel hostModel = ModelCenter.Instance.GetModel<TreasureFindHostModel>();
|
Treasure treasure;
|
ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(hostModel.treasureIdlist[0],out treasure);
|
if(treasure != null && treasure.state != TreasureState.Collected)
|
{
|
isAddSpec = true;
|
}
|
return true;
|
default:
|
break;
|
|
}
|
return false;
|
}
|
|
#region 设置弹框位置
|
private RectTransform infoTip = null;
|
private RectTransform waysTip = null;
|
|
public void SetInfoTipsPos(RectTransform infoTip,RectTransform waysTip)
|
{
|
this.infoTip = infoTip;
|
this.waysTip = waysTip;
|
float y = -750 / 2 + infoTip.sizeDelta.y / 2;
|
infoTip.anchoredPosition3D = new Vector3(infoTip.anchoredPosition3D.x,y,0);
|
waysTip.anchoredPosition3D = new Vector3(waysTip.anchoredPosition3D.x, y, 0);
|
}
|
|
#endregion
|
}
|
|
|