using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
class PetHorseAwakingBehaviour
|
{
|
int id;
|
|
ScrollItem scrollItem;
|
Button btnSelect;
|
Image imgSelect;
|
RichText txtQuality;
|
Text txtName;
|
Text txtLevel;
|
RedpointBehaviour redpoint;
|
|
PetHorseAwakingModel model {
|
get { return PetHorseAwakingModel.Instance; }
|
}
|
|
public void Bind(Transform parent)
|
{
|
this.scrollItem = parent.GetComponentEx<ScrollItem>();
|
this.scrollItem.LuaRegister(Display, Dispose);
|
|
this.btnSelect = parent.GetComponentEx<Button>();
|
this.imgSelect = parent.FindComponentEx<Image>("Img_Select");
|
this.txtQuality = parent.FindComponentEx<RichText>("Txt_Quality");
|
this.txtName = parent.FindComponentEx<Text>("Txt_Name");
|
this.txtLevel = parent.FindComponentEx<Text>("Txt_Level");
|
this.redpoint = parent.FindComponentEx<RedpointBehaviour>("RedPoint");
|
|
this.btnSelect.SetListener(() =>
|
{
|
if (model.selectId != this.id)
|
{
|
model.selectId = this.id;
|
model.ExecuteEvent(1);
|
}
|
});
|
}
|
|
void Display(int index)
|
{
|
this.id = model.displayIds.Get(index);
|
var data = model.GetData(this.id);
|
if (data.Type == 1)
|
{
|
var config = HorseConfig.Get(this.id);
|
this.txtName.text = config.Name;
|
this.txtQuality.text = model.GetQualityLabel(config.Quality);
|
}
|
else if (data.Type == 2)
|
{
|
var config = PetInfoConfig.Get(this.id);
|
this.txtName.text = config.Name;
|
this.txtQuality.text = model.GetQualityLabel(config.Quality);
|
}
|
|
this.DisplaySelect();
|
this.DisplayLevel();
|
|
this.redpoint.redpointId = data.Redpoint.id;
|
|
model.AddEvent(1, DisplaySelect);
|
}
|
|
public void DisplayLevel()
|
{
|
if (this.id == 0)
|
return;
|
|
var data = model.GetData(this.id);
|
var level = data.Level;
|
|
this.txtLevel.text = Language.Get("PetHorseAwaking_1", Language.Get("Num_CHS_" + level));
|
}
|
|
void DisplaySelect()
|
{
|
this.imgSelect.SetActiveIL(model.selectId == this.id);
|
}
|
|
void Dispose()
|
{
|
model.RemoveEvent(1, DisplaySelect);
|
}
|
}
|