123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- using System;
- using System.Collections.Generic;
- using Schedule;
- using UnityEngine;
- public class ScheduleFacillityPanelCtrl : MonoBehaviour
- {
- public ScheduleTaskViewer TaskViewr
- {
- set
- {
- this.viewer = value;
- }
- }
- public ScheduleCSVData.Work WorkData
- {
- set
- {
- this.current_workData = value;
- }
- }
- public Maid SelectMaid
- {
- set
- {
- this.current_maid = value;
- }
- }
- public ScheduleMgr.ScheduleTime ScheduleTime
- {
- set
- {
- this.current_time = value;
- }
- }
- public WorkTaskUnit TaskUnit
- {
- set
- {
- this.taskUnit = value;
- }
- }
- private void Awake()
- {
- this.faciltyManagement = base.gameObject.GetComponent<SceneFacilityManagement>();
- this.faciltyManagement.enableSetUpCameraAndBG = false;
- this.parentFacility = UTY.GetChildObject(base.gameObject, "Window Facility Details/Parent Facility Button", false);
- }
- private void Update()
- {
- if (!this.init)
- {
- this.Init();
- }
- }
- public void Active(bool active)
- {
- base.gameObject.SetActive(active);
- if (active)
- {
- GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
- this.UpdateFacilityInfo();
- this.UpdateFacilityInfoInteractable();
- this.faciltyManagement.ToggleEvent_VisibleFacilityInfo(true);
- }
- }
- private void Init()
- {
- this.init = true;
- uGUIListViewer component = GameObject.Find("Window Facility Details").GetComponent<uGUIListViewer>();
- GameObject[] itemArray = component.ItemArray;
- if (itemArray.Length > 0)
- {
- this.infoUiList = new List<FacilityInfoUI>();
- for (int i = 0; i < itemArray.Length; i++)
- {
- FacilityInfoUI component2 = itemArray[i].GetComponent<FacilityInfoUI>();
- GameObject childObject = UTY.GetChildObject(component2.gameObject, "InputField Facility Name/Button Change Name", false);
- childObject.SetActive(false);
- this.infoUiList.Add(component2);
- }
- }
- this.faciltyManagement.ToggleEvent_VisibleFacilityInfo(true);
- this.UpdateFacilityInfo();
- this.UpdateFacilityInfoInteractable();
- }
- public void AddMaid(FacilityInfoUI infoUI)
- {
- if (infoUI == null)
- {
- return;
- }
- if (infoUI.facility == null)
- {
- return;
- }
- if (infoUI.facility.NowMaidCount(this.current_time) >= infoUI.facility.maxMaidCount)
- {
- GameMain.Instance.SysDlg.Show("この施設にはこれ以上メイドを配置出来ません。", SystemDialog.TYPE.OK, null, null);
- return;
- }
- bool flag = infoUI.facility.AllocationMaid(this.current_maid, this.current_time);
- if (flag)
- {
- this.viewer.OnClickTaskUnit(this.taskUnit);
- this.UpdateFacilityInfo();
- }
- }
- private void UpdateFacilityInfoInteractable()
- {
- if (this.infoUiList == null)
- {
- return;
- }
- foreach (FacilityInfoUI facilityInfoUI in this.infoUiList)
- {
- bool isInteractable = false;
- if (facilityInfoUI.facility != null && this.current_workData.facility != null)
- {
- isInteractable = (facilityInfoUI.facility.defaultData.ID == this.current_workData.facility.ID);
- }
- foreach (KeyValuePair<int, Facility> keyValuePair in GameMain.Instance.FacilityMgr.GetNextDayFacilityArray())
- {
- Facility value = keyValuePair.Value;
- if (value != null && facilityInfoUI.facility != null && value == facilityInfoUI.facility)
- {
- isInteractable = false;
- break;
- }
- }
- facilityInfoUI.IsInteractable = isInteractable;
- }
- }
- private void UpdateFacilityInfo()
- {
- if (this.infoUiList == null)
- {
- return;
- }
- foreach (FacilityInfoUI facilityInfoUI in this.infoUiList)
- {
- bool maidIconShowFlag = false;
- if (facilityInfoUI.facility != null)
- {
- Maid[] allocationMaidArray = facilityInfoUI.facility.GetAllocationMaidArray(this.current_time);
- foreach (Maid y in allocationMaidArray)
- {
- if (this.current_maid == y)
- {
- facilityInfoUI.SetMaidIcon(this.current_maid, this.current_time);
- maidIconShowFlag = true;
- break;
- }
- }
- }
- facilityInfoUI.SetMaidIconShowFlag(maidIconShowFlag);
- facilityInfoUI.UpdateFacilityInfo(this.current_time, true);
- }
- this.UpdateFacilityInfoPanel();
- }
- private void UpdateFacilityInfoPanel()
- {
- Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(this.current_maid, this.current_time);
- if (maidAssignedFacility != null)
- {
- this.m_UIFacilityInfoConstruction.SetFacilityInfo(maidAssignedFacility, true);
- this.m_UIFacilityInfoConstruction.UpdateFacilityInfo(this.current_time, true);
- this.m_UIFacilityInfoConstruction.gameObject.SetActive(true);
- }
- else
- {
- this.m_UIFacilityInfoConstruction.gameObject.SetActive(false);
- }
- }
- private SceneFacilityManagement faciltyManagement;
- private GameObject parentFacility;
- private List<FacilityInfoUI> infoUiList;
- private WorkTaskUnit taskUnit;
- private ScheduleTaskViewer viewer;
- private ScheduleMgr.ScheduleTime current_time;
- private Maid current_maid;
- private ScheduleCSVData.Work current_workData;
- [SerializeField]
- private FacilityInfoUI m_UIFacilityInfoConstruction;
- private bool init;
- }
|