//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, April 01, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class TipModelWidget : MonoBehaviour
|
{
|
|
[SerializeField] Text m_Title;
|
[SerializeField] RawImage m_Model;
|
[SerializeField] Text m_FightPower;
|
[SerializeField] Image m_Fight;
|
|
ModelShowType showType;
|
FashionDressModel fashionDressModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } }
|
ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
|
public void OnDisable()
|
{
|
switch (showType)
|
{
|
case ModelShowType.treasure:
|
UI3DTreasureExhibition.Instance.StopShow();
|
break;
|
case ModelShowType.mount:
|
break;
|
case ModelShowType.pet:
|
break;
|
}
|
}
|
|
public void Display(int id, ModelShowType showType, string title, int fightValue = 0)
|
{
|
m_Title.text = title;
|
this.showType = showType;
|
|
switch (showType)
|
{
|
case ModelShowType.treasure:
|
m_Fight.SetSprite("FightingLv_Normal");
|
UI3DTreasureExhibition.Instance.BeginShowTreasure(id, m_Model);
|
break;
|
case ModelShowType.mount:
|
m_Fight.SetSprite("FightingLv_Max");
|
UI3DModelExhibition.Instance.ShowHourse(id, m_Model);
|
break;
|
case ModelShowType.pet:
|
m_Fight.SetSprite("FightingLv_Max");
|
var npcConfig = NPCConfig.Get(id);
|
UI3DModelExhibition.Instance.ShowNPC(id, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_Model);
|
break;
|
case ModelShowType.FashionDress:
|
m_Fight.SetSprite("FightingLv_Normal");
|
var itemConfig = ItemConfig.Get(id);
|
if (itemConfig != null)
|
{
|
int fashionType = 0;
|
int fashionId = 0;
|
bool isFashion = tipsModel.TryGetItemFashionData(itemConfig.ID, out fashionType, out fashionId);
|
if (isFashion)
|
{
|
List<int> fashionIds = null;
|
fashionDressModel.TryGetFashionIds(fashionType, out fashionIds);
|
if (fashionIds != null && fashionIds.Count > 0)
|
{
|
UI3DModelExhibition.Instance.ShowPlayer(m_Model, SetFashionDressData(fashionIds));
|
}
|
}
|
|
}
|
break;
|
}
|
|
if (fightValue == 0)
|
{
|
m_Fight.gameObject.SetActive(false);
|
m_FightPower.gameObject.SetActive(false);
|
}
|
else
|
{
|
m_Fight.gameObject.SetActive(true);
|
m_FightPower.gameObject.SetActive(true);
|
m_FightPower.text = fightValue.ToString();
|
m_Fight.SetNativeSize();
|
}
|
}
|
|
UI3DPlayerExhibitionData SetFashionDressData(List<int> fashionIds)
|
{
|
var job = PlayerDatas.Instance.baseData.Job;
|
var fashionClothesId = 0;
|
var fashionWeaponId = 0;
|
var fashionSecondaryId = 0;
|
foreach (var fashionId in fashionIds)
|
{
|
FashionDress fashionDress = null;
|
var isFashion = fashionDressModel.TryGetFashionDress(fashionId, out fashionDress);
|
if (isFashion)
|
{
|
int itemId = fashionDress.requireLevelUpItem;
|
var itemConfig = ItemConfig.Get(itemId);
|
switch (fashionDress.fashionDressType)
|
{
|
case 1:
|
fashionClothesId = fashionDress.GetEquipItemId();
|
break;
|
case 2:
|
fashionWeaponId = fashionDress.GetEquipItemId();
|
break;
|
case 3:
|
fashionSecondaryId = fashionDress.GetEquipItemId();
|
break;
|
}
|
}
|
|
}
|
|
var data = new UI3DPlayerExhibitionData()
|
{
|
job = job,
|
fashionClothesId = fashionClothesId,
|
fashionWeaponId = fashionWeaponId,
|
fashionSecondaryId = fashionSecondaryId,
|
isDialogue = false,
|
};
|
return data;
|
}
|
|
}
|
|
}
|