using System; using UnityEngine; using wf; public class TrophyInfo : MonoBehaviour { private void Awake() { this.bg_ = UTY.GetChildObject(base.gameObject, "BG", false).GetComponent(); this.trophy_image_sprite_ = UTY.GetChildObject(base.gameObject, "TrophyImage/Image", false).GetComponent(); this.title_label_ = UTY.GetChildObject(base.gameObject, "TitleLabel", false).GetComponent(); this.comment_label_ = UTY.GetChildObject(base.gameObject, "CommentParent/CommentLabel", false).GetComponent(); this.get_item_label_ = UTY.GetChildObject(base.gameObject, "CommentParent/GetItemLabel", false).GetComponent(); this.maid_point_label_ = UTY.GetChildObject(base.gameObject, "MaidPoint/PointLabel", false).GetComponent(); this.card_button_ = UTY.GetChildObject(base.gameObject, "Card", false).GetComponentInChildren(); this.card_sprite_ = UTY.GetChildObject(base.gameObject, "Card", false).GetComponentInChildren(); this.card_sprite_.gameObject.SetActive(false); EventDelegate.Add(this.card_button_.onClick, new EventDelegate.Callback(this.OnClickCardButton)); } private void OnDestroy() { if (this.card_sprite_.sprite2D != null && this.card_sprite_.sprite2D.texture != null) { UnityEngine.Object.DestroyImmediate(this.card_sprite_.sprite2D.texture); } } public void SetData(Trophy.Data trophy_data) { this.trophy_data_ = trophy_data; this.maid_point_label_.text = string.Empty + this.trophy_data_.maidPoint; this.comment_label_.text = this.trophy_data_.infoText; this.get_item_label_.text = this.trophy_data_.bonusText; this.trophy_image_sprite_.spriteName = trophy_data.trophySpriteName; this.SetHaveVisible(GameMain.Instance.CharacterMgr.status.IsHaveTrophy(this.trophy_data_.id)); if (this.card_sprite_.sprite2D != null && this.card_sprite_.sprite2D.texture != null) { UnityEngine.Object.DestroyImmediate(this.card_sprite_.sprite2D.texture); } this.card_sprite_.sprite2D = null; if (!string.IsNullOrEmpty(trophy_data.miniCardTextureFileName)) { Sprite sprite2D = Utility.CreateTextureSprite(trophy_data.miniCardTextureFileName); this.card_sprite_.sprite2D = sprite2D; } } public void SetHaveVisible(bool value) { this.have_visible_ = value; if (value) { this.title_label_.text = this.trophy_data_.name; this.title_label_.color = new Color(0.25f, 0.25f, 0.25f); this.maid_point_label_.color = new Color(0.25f, 0.25f, 0.25f); this.trophy_image_sprite_.alpha = 1f; this.bg_.alpha = 1f; this.card_button_.GetComponent().enabled = true; this.card_sprite_.gameObject.SetActive(true); } else { this.title_label_.text = ((!this.trophy_data_.titleMask) ? this.trophy_data_.name : "????????"); this.title_label_.color = new Color(0.5f, 0.5f, 0.5f); this.maid_point_label_.color = new Color(0.5f, 0.5f, 0.5f); this.trophy_image_sprite_.alpha = 0.3f; this.bg_.alpha = 0.8f; this.card_button_.GetComponent().enabled = false; this.card_sprite_.gameObject.SetActive(false); } } private void OnClickCardButton() { Vector3 position = this.card_sprite_.transform.position; if (this.onClickCardButton != null) { this.onClickCardButton(this.trophy_data_, position); } } public Trophy.Data trophy_data { get { return this.trophy_data_; } } public bool have_visible { get { return this.have_visible_; } } public Action onClickCardButton; private UISprite trophy_image_sprite_; private UISprite bg_; private UILabel title_label_; private UILabel comment_label_; private UILabel get_item_label_; private UILabel maid_point_label_; private UIButton card_button_; private UI2DSprite card_sprite_; private Trophy.Data trophy_data_; private bool have_visible_; }