123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- using System;
- using System.Collections.Generic;
- using I2.Loc;
- using MaidStatus;
- using UnityEngine;
- using wf;
- public class MaidPlate : MonoBehaviour
- {
- public void Awake()
- {
- this.back_plate_ = UTY.GetChildObject(base.gameObject, "Black", false).GetComponent<UISprite>();
- this.left_plate_.main = UTY.GetChildObject(base.gameObject, "LeftPlate", false);
- this.left_plate_.crown_sprite = new UISprite[3];
- for (int i = 0; i < 3; i++)
- {
- this.left_plate_.crown_sprite[i] = UTY.GetChildObject(this.left_plate_.main, "FrameRankingData/Rank" + (i + 1), false).GetComponent<UISprite>();
- this.left_plate_.crown_sprite[i].gameObject.SetActive(false);
- }
- List<UISprite> list = new List<UISprite>();
- int num = 0;
- for (;;)
- {
- GameObject childObject = UTY.GetChildObject(this.left_plate_.main, "FrameThumbnail/Select" + (num + 1), true);
- if (childObject == null)
- {
- break;
- }
- UISprite component = childObject.GetComponent<UISprite>();
- component.gameObject.SetActive(false);
- list.Add(component);
- num++;
- }
- this.left_plate_.select_no = list.ToArray();
- this.left_plate_.rank_label = UTY.GetChildObject(this.left_plate_.main, "FrameRankingData/RankLabel", false).GetComponent<UILabel>();
- this.left_plate_.thumbnail_sprite = UTY.GetChildObject(this.left_plate_.main, "FrameThumbnail/Thum", false).GetComponent<UI2DSprite>();
- this.left_plate_.engage_heart = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/Engage", false).GetComponent<UILabel>();
- this.left_plate_.leader_plate_sprite = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/LeaderPlate", false).GetComponent<UISprite>();
- this.left_plate_.last_name_label = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/TextLastName", false).GetComponent<UILabel>();
- this.left_plate_.first_name_label = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/TextFirstName", false).GetComponent<UILabel>();
- this.left_plate_.contract_type_label = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/TextTypeName", false).GetComponent<UILabel>();
- GameObject childObject2 = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/public/TextTypeName_public", true);
- if (childObject2 != null)
- {
- this.left_plate_.heroineTypeLocalize = childObject2.GetComponent<Localize>();
- }
- this.right_plate_.main = UTY.GetChildObject(base.gameObject, "RightPlate", false);
- this.right_plate_.evaluation_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/TextEvaluation", false).GetComponent<UILabel>();
- this.right_plate_.total_evaluation_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/Frame0/TextTotalEvaluation", false).GetComponent<UILabel>();
- this.right_plate_.sales_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/TextSales", false).GetComponent<UILabel>();
- this.right_plate_.total_sales_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/Frame0/TextTotalSales", false).GetComponent<UILabel>();
- this.SetMaidData(GameMain.Instance.CharacterMgr.GetMaid(0));
- this.SetRightPlateVisible(false);
- }
- private void Start()
- {
- if (Product.isPublic && this.left_plate_.contract_type_label != null)
- {
- this.left_plate_.contract_type_label.gameObject.SetActive(false);
- GameObject childObject = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/FixText2", true);
- if (childObject != null)
- {
- childObject.SetActive(false);
- }
- if (this.left_plate_.heroineTypeLocalize != null)
- {
- this.left_plate_.heroineTypeLocalize.transform.parent.gameObject.SetActive(true);
- }
- }
- if (!Product.isPublic && !Product.isJapan)
- {
- Vector3 localPosition = this.left_plate_.contract_type_label.transform.localPosition;
- this.left_plate_.contract_type_label.transform.localPosition = new Vector3(78f, localPosition.y, localPosition.z);
- }
- }
- public void SetRightPlateVisible(bool is_visible)
- {
- if (this.miniMode)
- {
- return;
- }
- BoxCollider component = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<BoxCollider>();
- UIWidget component2 = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIWidget>();
- UIPlayAnimation component3 = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIPlayAnimation>();
- Vector3 zero = Vector3.zero;
- Vector3 zero2 = Vector3.zero;
- Vector2 zero3 = Vector2.zero;
- Vector3 zero4 = Vector3.zero;
- zero2.y = 111f;
- zero3.y = 111f;
- if (!is_visible)
- {
- zero.x = -140f;
- zero2.x = 419f;
- zero3.x = 419f;
- component3.target = UTY.GetChildObject(base.gameObject, "LeftPlate", false).GetComponent<Animation>();
- UTY.GetChildObject(base.gameObject, "RightPlate", false).SetActive(false);
- }
- else
- {
- zero2.x = 700f;
- zero3.x = 700f;
- zero4.x = 140f;
- component3.target = base.gameObject.GetComponent<Animation>();
- UTY.GetChildObject(base.gameObject, "RightPlate", false).SetActive(true);
- }
- component.center = zero;
- if (component.size != Vector3.zero)
- {
- component.size = zero2;
- }
- component2.width = (int)zero2.x;
- component2.height = (int)zero2.y;
- this.back_plate_.width = (int)zero3.x;
- this.back_plate_.height = (int)zero3.y;
- this.back_plate_.transform.localPosition = zero4;
- }
- public void SetSelectNoVisible(int no, bool is_visible)
- {
- this.left_plate_.select_no[no - 1].gameObject.SetActive(is_visible);
- }
- public void SetSelectNoVisibleAllOff()
- {
- foreach (UISprite uisprite in this.left_plate_.select_no)
- {
- uisprite.gameObject.SetActive(false);
- }
- }
- public void SetMaidData(Maid maid)
- {
- this.maid_ = maid;
- if (this.maid_ == null)
- {
- return;
- }
- Status status = this.maid_.status;
- for (int i = 0; i < this.left_plate_.crown_sprite.Length; i++)
- {
- this.left_plate_.crown_sprite[i].gameObject.SetActive(false);
- }
- if (1 <= status.popularRank && status.popularRank <= 3)
- {
- this.left_plate_.crown_sprite[status.popularRank - 1].gameObject.SetActive(true);
- }
- if (1 <= status.popularRank && status.popularRank <= 99)
- {
- this.left_plate_.rank_label.text = status.popularRank.ToString();
- }
- else
- {
- this.left_plate_.rank_label.text = "-";
- }
- if (status.OldStatus != null && (status.OldStatus.isMarriage || status.OldStatus.isNewWife))
- {
- this.left_plate_.engage_heart.enabled = true;
- }
- else
- {
- this.left_plate_.engage_heart.enabled = false;
- }
- this.left_plate_.leader_plate_sprite.gameObject.SetActive(status.leader);
- NamePair charaName = status.charaName;
- this.left_plate_.last_name_label.text = charaName.name1;
- this.left_plate_.first_name_label.text = charaName.name2;
- if (status.heroineType != HeroineType.Sub)
- {
- this.left_plate_.contract_type_label.text = EnumConvert.GetString(status.contract);
- Utility.SetLocalizeTerm(this.left_plate_.contract_type_label, EnumConvert.GetTerm(status.contract), false);
- }
- else
- {
- this.left_plate_.contract_type_label.text = status.subCharaStatus.contractText;
- Utility.SetLocalizeTerm(this.left_plate_.contract_type_label, status.subCharaStatus.contractTextTerm, false);
- }
- if (Product.isPublic && this.left_plate_.heroineTypeLocalize != null)
- {
- if (maid.status.heroineType == HeroineType.Sub && maid.status.subCharaStatus != null)
- {
- this.left_plate_.heroineTypeLocalize.GetComponent<UILabel>().text = maid.status.subCharaStatus.personalText;
- this.left_plate_.heroineTypeLocalize.SetTerm(maid.status.subCharaStatus.personalTextTerm);
- }
- else
- {
- this.left_plate_.heroineTypeLocalize.GetComponent<UILabel>().text = maid.status.personal.drawName;
- this.left_plate_.heroineTypeLocalize.SetTerm(maid.status.personal.termName);
- }
- }
- this.right_plate_.evaluation_label.text = status.evaluation.ToString();
- this.right_plate_.total_evaluation_label.text = status.totalEvaluations.ToString();
- this.right_plate_.sales_label.text = Utility.ConvertMoneyText(status.sales);
- this.right_plate_.total_sales_label.text = Utility.ConvertMoneyText(status.totalSales);
- Texture2D thumIcon = this.maid_.GetThumIcon();
- if (thumIcon != null)
- {
- Sprite sprite2D = Sprite.Create(thumIcon, new Rect(0f, 0f, (float)thumIcon.width, (float)thumIcon.height), default(Vector2));
- this.left_plate_.thumbnail_sprite.sprite2D = sprite2D;
- if (this.miniMode)
- {
- this.left_plate_.thumbnail_sprite.SetDimensions(50, 50);
- }
- else
- {
- this.left_plate_.thumbnail_sprite.SetDimensions(thumIcon.width, thumIcon.height);
- }
- }
- else
- {
- this.left_plate_.thumbnail_sprite.sprite2D = null;
- }
- }
- public void SetEmpty()
- {
- this.maid_ = null;
- this.left_plate_.first_name_label.text = string.Empty;
- this.left_plate_.last_name_label.text = string.Empty;
- this.left_plate_.leader_plate_sprite.gameObject.SetActive(false);
- this.left_plate_.engage_heart.gameObject.SetActive(false);
- this.left_plate_.contract_type_label.text = string.Empty;
- this.left_plate_.thumbnail_sprite.sprite2D = null;
- }
- public Maid maid
- {
- get
- {
- return this.maid_;
- }
- }
- [SerializeField]
- private bool miniMode;
- private Maid maid_;
- private UISprite back_plate_;
- private MaidPlate.LeftPlate left_plate_;
- private MaidPlate.RightPlate right_plate_;
- private struct LeftPlate
- {
- public GameObject main;
- public UISprite[] crown_sprite;
- public UISprite[] select_no;
- public UILabel rank_label;
- public UI2DSprite thumbnail_sprite;
- public UISprite leader_plate_sprite;
- public UILabel engage_heart;
- public UILabel last_name_label;
- public UILabel first_name_label;
- public UILabel contract_type_label;
- public Localize heroineTypeLocalize;
- }
- private struct RightPlate
- {
- public GameObject main;
- public UILabel evaluation_label;
- public UILabel total_evaluation_label;
- public UILabel sales_label;
- public UILabel total_sales_label;
- }
- }
|