//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, November 14, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
|
//宠物按钮
|
namespace Snxxz.UI
|
{
|
|
public class PetButton : MonoBehaviour
|
{
|
|
[SerializeField] Button m_PetButton1;//按钮点击
|
[SerializeField] GameObject m_ChoosenImg;//选中状态
|
[SerializeField] GameObject m_UnchooseBtn1;//未中状态
|
[SerializeField] GameObject m_LockText;//未解锁状态
|
[SerializeField] Text m_ChoosenNameTxt1;//灵宠名
|
[SerializeField] Text m_QualityTxt1;//灵宠品质
|
[SerializeField] Text m_UseText;//灵宠阶级
|
[SerializeField] GameObject appearanceImgObj; //外观切换图标
|
[SerializeField] Text m_Textappearance;//
|
[SerializeField] RedpointBehaviour redPonint;//红点
|
[SerializeField] PetAttributeMethods _PetAttributeMethods;
|
[SerializeField] Button m_PlayedButton;//出战按钮
|
[SerializeField] Text m_Played_Text;//出战文本
|
PetModel m_petModel;
|
PetModel petmodel { get { return m_petModel ?? (m_petModel = ModelCenter.Instance.GetModel<PetModel>()); } }
|
|
public Button PetButton1
|
{
|
get { return m_PetButton1; }
|
set { m_PetButton1 = value; }
|
|
}
|
public GameObject ChoosenImg
|
{
|
get { return m_ChoosenImg; }
|
set { m_ChoosenImg = value; }
|
|
}
|
public GameObject UnchooseBtn1
|
{
|
get { return m_UnchooseBtn1; }
|
set { m_UnchooseBtn1 = value; }
|
|
}
|
public GameObject LockText
|
{
|
get { return m_LockText; }
|
set { m_LockText = value; }
|
|
}
|
public Button PlayedButton
|
{
|
get { return m_PlayedButton; }
|
set { m_PlayedButton = value; }
|
}
|
public Text Played_Text
|
{
|
get { return m_Played_Text; }
|
set { m_Played_Text = value; }
|
}
|
|
public Text UseText
|
{
|
get { return m_UseText; }
|
set { m_UseText = value; }
|
}
|
private void OnEnable()
|
{
|
|
}
|
private void OnDisable()
|
{
|
|
}
|
|
private void Start()
|
{
|
}
|
|
public void ButtonAssignment(int PetID)//面板赋值
|
{
|
var config = PetInfoConfig.Get(PetID);
|
|
if (petmodel._DicPetBack.ContainsKey(PetID))
|
{
|
LockText.SetActive(false);
|
m_UseText.gameObject.SetActive(true);
|
if (petmodel._DicPetBack[PetID].PetClass >= config.MaxRank)
|
{
|
m_UseText.text = string.Format(Language.Get("Z1020"), petmodel._DicPetBack[PetID].PetClass);
|
}
|
else
|
{
|
m_UseText.text = string.Format(Language.Get("LoadIconLV"), petmodel._DicPetBack[PetID].PetClass); ;
|
}
|
|
if(petmodel._DicPetBack[PetID].PetStatus == 1)
|
{
|
appearanceImgObj.SetActive(true);
|
m_Textappearance.text = Language.Get("Petwin5");
|
}
|
else
|
{
|
appearanceImgObj.SetActive(false);
|
}
|
}
|
else
|
{
|
LockText.SetActive(true);
|
LockText.GetComponent<Text>().text = Language.Get("Petwin6");
|
m_UseText.gameObject.SetActive(false);
|
appearanceImgObj.SetActive(false);
|
}
|
|
m_ChoosenNameTxt1.text = config.Name;
|
m_QualityTxt1.text = ProductOrder(config.Quality.ToString());
|
if (petmodel.PetRedpoint.ContainsKey(PetID))
|
{
|
redPonint.redpointId = petmodel.PetRedpoint[PetID].id;
|
}
|
|
}
|
|
string ProductOrder(string _petProductOrder)//灵宠品质
|
{
|
FuncConfigConfig _PetQuality = FuncConfigConfig.Get("PetQuality");
|
string[] _productlist = _PetQuality.Numerical1.Split('|');
|
for (int i = 0; i < _productlist.Length; i++)
|
{
|
if (_petProductOrder == _productlist[i])
|
{
|
string[] _productText = _PetQuality.Numerical2.Split('|');
|
string str = _productText[i];
|
return str;
|
}
|
|
}
|
return null;
|
}
|
//public void PetShowAttribute(int PetID)
|
//{
|
// _PetAttributeMethods.ModelShow(PetID);
|
//}
|
}
|
|
|
}
|
|
|
|