123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using UnityEngine;
- using wf;
- public class TrophyInfo : MonoBehaviour
- {
- private void Awake()
- {
- this.bg_ = UTY.GetChildObject(base.gameObject, "BG", false).GetComponent<UISprite>();
- this.trophy_image_sprite_ = UTY.GetChildObject(base.gameObject, "TrophyImage/Image", false).GetComponent<UISprite>();
- this.title_label_ = UTY.GetChildObject(base.gameObject, "TitleLabel", false).GetComponent<UILabel>();
- this.comment_label_ = UTY.GetChildObject(base.gameObject, "CommentParent/CommentLabel", false).GetComponent<UILabel>();
- this.get_item_label_ = UTY.GetChildObject(base.gameObject, "CommentParent/GetItemLabel", false).GetComponent<UILabel>();
- this.maid_point_label_ = UTY.GetChildObject(base.gameObject, "MaidPoint/PointLabel", false).GetComponent<UILabel>();
- this.card_button_ = UTY.GetChildObject(base.gameObject, "Card", false).GetComponentInChildren<UIButton>();
- this.card_sprite_ = UTY.GetChildObject(base.gameObject, "Card", false).GetComponentInChildren<UI2DSprite>();
- 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;
- Utility.SetLocalizeTerm(this.comment_label_, this.trophy_data_.infoTextTerm);
- 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<BoxCollider>().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<BoxCollider>().enabled = false;
- this.card_sprite_.gameObject.SetActive(false);
- }
- if (!this.trophy_data_.titleMask)
- {
- Utility.SetLocalizeTerm(this.title_label_, this.trophy_data_.nameTerm);
- }
- }
- 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<Trophy.Data, Vector3> 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_;
- }
|