123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- using System;
- using UnityEngine;
- public class PhotSaveLoagDataUnit : MonoBehaviour
- {
- public string title
- {
- get
- {
- return this.title_input_.value;
- }
- set
- {
- this.title_input_.value = value;
- }
- }
- public string comment
- {
- get
- {
- return this.comment_input_.value;
- }
- set
- {
- this.comment_input_.value = value;
- }
- }
- public string date_text
- {
- get
- {
- return this.data_label_.text;
- }
- set
- {
- this.data_label_.text = value;
- }
- }
- public int maid_count
- {
- get
- {
- return int.Parse(this.maid_count_label_.text);
- }
- set
- {
- this.maid_count_label_.text = value.ToString("d2");
- }
- }
- public bool new_sloat
- {
- get
- {
- return this.new_sprite_object_.activeSelf;
- }
- set
- {
- this.new_sprite_object_.SetActive(value);
- }
- }
- public bool visible_content
- {
- get
- {
- return this.data_info_obj_.activeSelf;
- }
- set
- {
- this.RemoveInputFocus();
- this.data_info_obj_.SetActive(value);
- }
- }
- public bool enabled_button
- {
- get
- {
- return this.main_btn_.isEnabled;
- }
- set
- {
- this.RemoveInputFocus();
- this.main_btn_.isEnabled = value;
- }
- }
- public object save_data_object
- {
- get
- {
- return this.save_data_object_;
- }
- set
- {
- this.save_data_object_ = value;
- }
- }
- public byte[] thumbnail
- {
- set
- {
- if (value == null || value.Length <= 0)
- {
- if (this.thumbnail_sprite_.sprite2D != null && this.thumbnail_sprite_.sprite2D.texture != null)
- {
- UnityEngine.Object.DestroyImmediate(this.thumbnail_sprite_.sprite2D.texture);
- }
- this.thumbnail_sprite_.sprite2D = null;
- return;
- }
- Texture2D texture2D = new Texture2D(1, 1, TextureFormat.ARGB32, false);
- texture2D.LoadImage(value);
- Sprite sprite2D = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
- if (this.thumbnail_sprite_.sprite2D != null && this.thumbnail_sprite_.sprite2D.texture != null)
- {
- UnityEngine.Object.DestroyImmediate(this.thumbnail_sprite_.sprite2D.texture);
- }
- this.thumbnail_sprite_.sprite2D = sprite2D;
- this.thumbnail_sprite_.SetDimensions(texture2D.width, texture2D.height);
- }
- }
- public Texture2D thumbnail_tex
- {
- set
- {
- if (value == null)
- {
- if (this.thumbnail_sprite_.sprite2D != null && this.thumbnail_sprite_.sprite2D.texture != null)
- {
- UnityEngine.Object.DestroyImmediate(this.thumbnail_sprite_.sprite2D.texture);
- }
- this.thumbnail_sprite_.sprite2D = null;
- return;
- }
- Sprite sprite2D = Sprite.Create(value, new Rect(0f, 0f, (float)value.width, (float)value.height), default(Vector2));
- if (this.thumbnail_sprite_.sprite2D != null && this.thumbnail_sprite_.sprite2D.texture != null)
- {
- UnityEngine.Object.DestroyImmediate(this.thumbnail_sprite_.sprite2D.texture);
- }
- this.thumbnail_sprite_.sprite2D = sprite2D;
- this.thumbnail_sprite_.SetDimensions(value.width, value.height);
- }
- }
- public void Awake()
- {
- this.main_btn_ = base.GetComponent<UIButton>();
- EventDelegate.Add(this.main_btn_.onClick, new EventDelegate.Callback(this.OnClickEvent));
- this.data_info_obj_ = UTY.GetChildObject(base.gameObject, "Content/DataInfo", false);
- this.title_input_ = UTY.GetChildObject(this.data_info_obj_, "Title/InputField", false).GetComponent<UIInput>();
- EventDelegate.Add(this.title_input_.onChange, new EventDelegate.Callback(this.OnChangeTitle));
- this.comment_input_ = UTY.GetChildObject(this.data_info_obj_, "Comment/InputField", false).GetComponent<UIInput>();
- EventDelegate.Add(this.comment_input_.onChange, new EventDelegate.Callback(this.OnChangeComment));
- this.data_label_ = UTY.GetChildObject(this.data_info_obj_, "Date", false).GetComponent<UILabel>();
- this.maid_count_label_ = UTY.GetChildObject(this.data_info_obj_, "NumberOfEmployees/Number", false).GetComponent<UILabel>();
- this.new_sprite_object_ = UTY.GetChildObject(this.data_info_obj_, "NewLabel", false);
- this.new_sprite_object_.SetActive(false);
- this.thumbnail_sprite_ = UTY.GetChildObject(this.data_info_obj_, "Thum", false).GetComponent<UI2DSprite>();
- string empty = string.Empty;
- this.comment = empty;
- this.title = empty;
- this.maid_count = 0;
- }
- public void OnDestroy()
- {
- if (this.thumbnail_sprite_ != null && this.thumbnail_sprite_.sprite2D != null && this.thumbnail_sprite_.sprite2D.texture != null)
- {
- UnityEngine.Object.DestroyImmediate(this.thumbnail_sprite_.sprite2D.texture);
- }
- this.thumbnail_sprite_.sprite2D = null;
- }
- public void RemoveInputFocus()
- {
- this.title_input_.RemoveFocus();
- this.comment_input_.RemoveFocus();
- }
- private void OnChangeTitle()
- {
- if (this.onChangeTitle != null)
- {
- this.onChangeTitle(this);
- }
- }
- private void OnChangeComment()
- {
- if (this.onChangeComment != null)
- {
- this.onChangeComment(this);
- }
- }
- private void OnClickEvent()
- {
- if (this.onClick != null)
- {
- this.onClick(this);
- }
- }
- public Action<PhotSaveLoagDataUnit> onClick;
- public Action<PhotSaveLoagDataUnit> onChangeTitle;
- public Action<PhotSaveLoagDataUnit> onChangeComment;
- private UIButton main_btn_;
- private GameObject data_info_obj_;
- private UIInput title_input_;
- private UIInput comment_input_;
- private UILabel data_label_;
- private UILabel maid_count_label_;
- private GameObject new_sprite_object_;
- private UI2DSprite thumbnail_sprite_;
- private object save_data_object_;
- }
|