//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, April 01, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class TipModelWidget : MonoBehaviour
|
{
|
|
[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>(); } }
|
|
void OnDisable()
|
{
|
switch (showType)
|
{
|
case ModelShowType.Treasure:
|
UI3DTreasureExhibition.Instance.Stop();
|
break;
|
case ModelShowType.Mount:
|
break;
|
case ModelShowType.Pet:
|
break;
|
}
|
}
|
|
public void Display(int id, ModelShowType showType, int fightValue = 0)
|
{
|
this.showType = showType;
|
|
switch (showType)
|
{
|
case ModelShowType.Treasure:
|
m_Fight.SetSprite("FightingLv_Normal");
|
UI3DTreasureExhibition.Instance.ShowTreasure(id, m_Model);
|
break;
|
case ModelShowType.Mount:
|
m_Fight.SetSprite("FightingLv_Normal");
|
UI3DModelExhibition.Instance.ShowHourse(id, m_Model);
|
break;
|
case ModelShowType.Pet:
|
m_Fight.SetSprite("FightingLv_Normal");
|
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)
|
{
|
var fashionType = 0;
|
var fashionId = 0;
|
var 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.SetActive(false);
|
m_FightPower.SetActive(false);
|
}
|
else
|
{
|
m_Fight.SetActive(true);
|
m_FightPower.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;
|
}
|
|
}
|
|
}
|