123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- using System;
- using I2.Loc;
- using UnityEngine;
- using UnityEngine.UI;
- public class FacilityInfoUI : MonoBehaviour
- {
- public FacilityInfoUI.ViewType viewType
- {
- get
- {
- return this.m_ViewType;
- }
- set
- {
- this.m_ViewType = value;
- this.UpdateViewTypeUI();
- }
- }
- public InputField textFacilityName
- {
- get
- {
- return this.m_TextFacilityName;
- }
- set
- {
- this.m_TextFacilityName = value;
- }
- }
- public Image imageFacilityThumbnail
- {
- get
- {
- return this.m_ImageFacilityThumbnail;
- }
- }
- public Facility facility
- {
- get
- {
- return this.m_Facility;
- }
- }
- public void SetFacilityInfo(Facility facility, bool nullCheck = true)
- {
- ScheduleMgr.ScheduleTime scheduleTime = (!GameMain.Instance.CharacterMgr.status.isDaytime) ? ScheduleMgr.ScheduleTime.Night : ScheduleMgr.ScheduleTime.DayTime;
- ScheduleMgr.ScheduleTime nowScheduleTime = this.m_NowScheduleTime;
- if (nowScheduleTime != ScheduleMgr.ScheduleTime.DayTime)
- {
- if (nowScheduleTime == ScheduleMgr.ScheduleTime.Night)
- {
- scheduleTime = this.m_NowScheduleTime;
- }
- }
- else
- {
- scheduleTime = this.m_NowScheduleTime;
- }
- this.SetFacilityInfo(facility, scheduleTime, nullCheck);
- }
- public void SetFacilityInfo(Facility facility, ScheduleMgr.ScheduleTime scheduleTime, bool nullCheck = true)
- {
- this.m_Facility = facility;
- string text = string.Empty;
- string text2 = string.Empty;
- string text3 = string.Empty;
- string text4 = string.Empty;
- string text5 = string.Empty;
- string text6 = string.Empty;
- string text7 = string.Empty;
- Sprite sprite = null;
- int itemCount;
- int itemCount2;
- if (this.m_Facility)
- {
- text = this.m_Facility.facilityName;
- text2 = this.m_Facility.NowMaidCount(scheduleTime).ToString();
- text3 = this.m_Facility.minMaidCount.ToString();
- text4 = this.m_Facility.maxMaidCount.ToString();
- text5 = this.m_Facility.defaultData.cost.ToString();
- text6 = this.m_Facility.facilityLevel.ToString();
- itemCount = this.m_Facility.defaultData.rank;
- itemCount2 = this.m_Facility.GetStaffRank(scheduleTime);
- if (this.m_Facility.defaultData.isBusiness)
- {
- text7 = ((!this.m_Facility.IsOperation(scheduleTime)) ? "未稼働" : "営業可能");
- }
- else
- {
- text7 = ((!this.m_Facility.IsOperation(scheduleTime)) ? "未稼働" : "稼働中");
- }
- sprite = FacilityDataTable.GetFacilityThumbnail(this.m_Facility.param.typeID, true);
- }
- else
- {
- text = "空き部屋";
- text2 = "---";
- text3 = "---";
- text4 = "---";
- text5 = "---";
- text6 = "--";
- text7 = "---";
- itemCount = 0;
- itemCount2 = 0;
- }
- if (this.m_TextFacilityName)
- {
- this.m_TextFacilityName.text = text;
- Localize componentInChildren = this.m_TextFacilityName.GetComponentInChildren<Localize>();
- if (componentInChildren != null)
- {
- if (text == "空き部屋")
- {
- this.m_TextFacilityName.enabled = false;
- componentInChildren.SetTerm("SceneFacilityManagement/" + text);
- }
- else if (this.m_Facility != null && this.m_Facility.defaultName == text)
- {
- componentInChildren.SetTerm(this.m_Facility.defaultData.termName);
- }
- }
- }
- if (this.m_ImageFacilityThumbnail)
- {
- this.m_ImageFacilityThumbnail.sprite = sprite;
- }
- if (this.m_TextNumberOfPeople)
- {
- this.m_TextNumberOfPeople.text = text2;
- }
- if (this.m_TextNumberOfMinPeople)
- {
- this.m_TextNumberOfMinPeople.text = text3;
- }
- if (this.m_TextNumberOfMaxPeople)
- {
- this.m_TextNumberOfMaxPeople.text = text4;
- }
- if (this.m_TextNumberOfCost)
- {
- this.m_TextNumberOfCost.text = text5;
- }
- if (this.m_TextLevelOfFacility)
- {
- this.m_TextLevelOfFacility.text = text6;
- }
- if (this.m_TextStatusOfFacility)
- {
- this.m_TextStatusOfFacility.text = text7;
- Localize component = this.m_TextStatusOfFacility.GetComponent<Localize>();
- if (component != null)
- {
- component.SetTerm("SceneFacilityManagement/" + text7);
- }
- }
- if (this.m_uGUIListRankStar)
- {
- this.m_uGUIListRankStar.Show<Transform>(itemCount, null);
- }
- if (this.m_uGUIListStaffStar)
- {
- this.m_uGUIListStaffStar.Show<Transform>(itemCount2, null);
- }
- }
- public void UpdateFacilityInfo(bool nullCheck = true)
- {
- this.SetFacilityInfo(this.m_Facility, nullCheck);
- }
- public void UpdateFacilityInfo(ScheduleMgr.ScheduleTime scheduleTime, bool nullCheck = true)
- {
- this.m_NowScheduleTime = scheduleTime;
- this.SetFacilityInfo(this.m_Facility, scheduleTime, nullCheck);
- }
- public bool IsInteractable
- {
- get
- {
- return this.m_IsInteractable;
- }
- set
- {
- this.m_IsInteractable = value;
- Selectable componentInChildren = base.GetComponentInChildren<Selectable>();
- if (componentInChildren != null)
- {
- componentInChildren.interactable = this.m_IsInteractable;
- }
- Graphic componentInChildren2 = base.GetComponentInChildren<Graphic>();
- if (componentInChildren2 != null)
- {
- componentInChildren2.raycastTarget = this.m_IsInteractable;
- }
- GameObject childObject = UTY.GetChildObject(base.gameObject, "Image Inactive mask", true);
- if (childObject)
- {
- childObject.SetActive(!this.m_IsInteractable);
- }
- }
- }
- public void SetNameChangeEnable(bool enable)
- {
- this.m_TextFacilityName.interactable = enable;
- }
- public void SetMaidIcon(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
- {
- if (this.m_MaidIconObject == null)
- {
- return;
- }
- if (this.m_Facility == null)
- {
- return;
- }
- if (maid == null)
- {
- this.SetMaidIconShowFlag(false);
- return;
- }
- RawImage componentInChildren = this.m_MaidIconObject.GetComponentInChildren<RawImage>();
- if (componentInChildren == null)
- {
- Debug.LogWarning("メイドの顔アイコン表示オブジェクトが見つかりませんでした。");
- return;
- }
- bool flag = this.IsAllocationMaid(maid, scheduleTime);
- Texture texture = null;
- if (maid != null && flag)
- {
- texture = maid.GetThumIcon();
- }
- componentInChildren.texture = texture;
- this.SetMaidIconShowFlag(texture != null);
- }
- public bool IsAllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
- {
- return !(this.m_Facility == null) && !(maid == null) && this.m_Facility.IsAllocationMaid(maid, scheduleTime);
- }
- public void SetMaidIconShowFlag(bool isShow)
- {
- if (this.m_MaidIconObject == null)
- {
- return;
- }
- if (isShow)
- {
- if (!this.m_MaidIconObject.activeSelf)
- {
- this.m_MaidIconObject.SetActive(true);
- }
- }
- else if (this.m_MaidIconObject.activeSelf)
- {
- this.m_MaidIconObject.SetActive(false);
- }
- }
- private void UpdateViewTypeUI()
- {
- if (this.m_ViewType == FacilityInfoUI.ViewType.Free)
- {
- return;
- }
- bool active = false;
- bool active2 = false;
- bool active3 = false;
- bool active4 = false;
- bool active5 = false;
- bool active6 = false;
- bool active7 = false;
- bool active8 = false;
- switch (this.m_ViewType)
- {
- case FacilityInfoUI.ViewType.DefaultMode:
- case FacilityInfoUI.ViewType.MiniDefaultMode:
- active2 = (active = (active3 = (active4 = (active5 = true))));
- break;
- case FacilityInfoUI.ViewType.MaidAllocateMode:
- active2 = (active = (active3 = (active6 = (active4 = true))));
- break;
- case FacilityInfoUI.ViewType.ConstructMode:
- active6 = (active = (active7 = (active4 = (active8 = true))));
- break;
- }
- if (this.m_uGUIListRankStar)
- {
- this.m_uGUIListRankStar.gameObject.SetActive(active);
- }
- if (this.m_uGUIListStaffStar)
- {
- this.m_uGUIListStaffStar.gameObject.SetActive(active2);
- }
- if (this.m_TextNumberOfPeople)
- {
- this.m_TextNumberOfPeople.gameObject.SetActive(active3);
- }
- if (this.m_TextLevelOfFacility)
- {
- this.m_TextLevelOfFacility.gameObject.SetActive(active4);
- }
- if (this.m_TextStatusOfFacility)
- {
- this.m_TextStatusOfFacility.gameObject.SetActive(active5);
- }
- if (this.m_TextNumberOfMinPeople)
- {
- this.m_TextNumberOfMinPeople.gameObject.SetActive(active6);
- }
- if (this.m_TextNumberOfMaxPeople)
- {
- this.m_TextNumberOfMaxPeople.gameObject.SetActive(active7);
- }
- if (this.m_TextNumberOfCost)
- {
- this.m_TextNumberOfCost.gameObject.SetActive(active8);
- }
- Image image = null;
- GameObject childObject = UTY.GetChildObject(base.gameObject, "Parent Info", true);
- if (childObject != null)
- {
- image = childObject.GetComponent<Image>();
- }
- if (image == null)
- {
- image = base.gameObject.GetComponent<Image>();
- }
- if (image != null)
- {
- image.sprite = this.GetViewTypePlate(this.m_ViewType);
- }
- }
- private Sprite GetViewTypePlate(FacilityInfoUI.ViewType viewType)
- {
- Sprite result = null;
- switch (viewType)
- {
- case FacilityInfoUI.ViewType.DefaultMode:
- result = Resources.Load<Sprite>("SceneFacilityPowerUp/Sprites/myroom_info_plate");
- break;
- case FacilityInfoUI.ViewType.MaidAllocateMode:
- result = Resources.Load<Sprite>("SceneFacilityManagement/Sprites/shisetsu_infoplate_s2");
- break;
- case FacilityInfoUI.ViewType.ConstructMode:
- result = Resources.Load<Sprite>("SceneFacilityPowerUp/Sprites/myroom_info_plate2");
- break;
- case FacilityInfoUI.ViewType.MiniDefaultMode:
- result = Resources.Load<Sprite>("SceneFacilityManagement/Sprites/shisetsu_infoplate_s");
- break;
- }
- return result;
- }
- private FacilityInfoUI.ViewType m_ViewType = FacilityInfoUI.ViewType.Free;
- [SerializeField]
- protected InputField m_TextFacilityName;
- [SerializeField]
- protected Image m_ImageFacilityThumbnail;
- [SerializeField]
- protected Text m_TextNumberOfPeople;
- [SerializeField]
- protected Text m_TextLevelOfFacility;
- [SerializeField]
- protected Text m_TextStatusOfFacility;
- [SerializeField]
- protected uGUIListViewer m_uGUIListRankStar;
- [SerializeField]
- protected uGUIListViewer m_uGUIListStaffStar;
- [SerializeField]
- protected Text m_TextNumberOfMinPeople;
- [SerializeField]
- protected Text m_TextNumberOfMaxPeople;
- [SerializeField]
- protected Text m_TextNumberOfCost;
- [SerializeField]
- protected GameObject m_MaidIconObject;
- private ScheduleMgr.ScheduleTime m_NowScheduleTime = (ScheduleMgr.ScheduleTime)(-1);
- protected Facility m_Facility;
- private bool m_IsInteractable = true;
- public enum ViewType
- {
- DefaultMode,
- MaidAllocateMode,
- ConstructMode,
- MiniDefaultMode,
- Free
- }
- }
|