using System; using System.Collections; using System.Collections.Generic; using PlayerStatus; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class SceneFacilityManagement : MonoBehaviour { private FacilityManager FacilityMgr { get { if (this.m_FacilityMgr == null) { this.m_FacilityMgr = GameMain.Instance.FacilityMgr; } return this.m_FacilityMgr; } } public FacilityInfoUI UIFacilityInfoBottomViewer { get { return this.m_UIFacilityInfoConstruction; } } public bool enableSetUpCameraAndBG { get { return this.m_EnableSetUpCameraAndBG; } set { this.m_EnableSetUpCameraAndBG = value; } } public long nowMoney { get { Status status = GameMain.Instance.CharacterMgr.status; return status.money; } set { Status status = GameMain.Instance.CharacterMgr.status; status.money = value; this.UpdateTextNumber(this.m_UITextNowMoney, value); } } public long nowCost { get { return this.m_NowCost; } set { this.m_NowCost = value; this.UpdateTextNumber(this.m_UITextNowCost, value); } } private void Awake() { if (this.m_StartDestroyEventObject != null) { this.m_StartDestroyEventObject.m_EventOnStart.AddListener(delegate { GameMain.Instance.SoundMgr.PlayBGM(this.m_PlayBGM, 0.5f, true); }); } } private void Start() { if (this.m_UIClubStatusViewer) { this.m_UIClubStatusViewer.gameObject.SetActive(false); } if (this.enableSetUpCameraAndBG) { this.SetUpBackGroundAndCamera(); } this.UpdateTextNumber(this.m_UITextNowMoney, this.nowMoney); this.UpdateTextNumber(this.m_UITextNowCost, this.nowCost); this.m_UITextNowMoney.transform.parent.gameObject.SetActive(false); this.m_UITextNowCost.transform.parent.gameObject.SetActive(false); int typeID = FacilityDataTable.GetFacilityStatusArray(true)[0].typeID; this.m_CreatingFacility = GameMain.Instance.FacilityMgr.CreateNewFacility(typeID); this.m_CreatingFacility.transform.SetParent(base.transform, false); this.OpenFacilityUIConstruction(); this.GetTagBackup(); } private void SetUpBackGroundAndCamera() { GameMain.Instance.BgMgr.ChangeBg("EmpireClub_Entrance"); GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color)); CameraMain mainCamera = GameMain.Instance.MainCamera; GameMain.Instance.MainLight.Reset(); mainCamera.Reset(CameraMain.CameraType.Target, false); mainCamera.SetTargetPos(new Vector3(0f, 5.5f, 11f), true); mainCamera.SetDistance(1.4f, true); mainCamera.SetAroundAngle(new Vector2(180f, 3f), true); mainCamera.SetTargetOffset(Vector3.zero, false); } private void UpdateTextNumber(Text text, long number) { text.text = string.Format("{0:#,0}", number); } public long CalcNowCost() { long num = 0L; Dictionary nextDayFacilityArray = this.FacilityMgr.GetNextDayFacilityArray(); List list = new List(nextDayFacilityArray.Values); for (int i = 0; i < list.Count; i++) { Facility facility = list[i]; if (facility != null) { num += (long)FacilityDataTable.GetFacilityDefaultCost(facility.param.typeID, true); } } return num; } public void OpenDialog(string messageText, SystemDialog.TYPE openType, Action actionOK, Action actionCANCEL) { uGUIUtility.SetActiveEventSystem(false); GameMain.Instance.SysDlg.Show(messageText, openType, delegate { GameMain.Instance.SysDlg.Close(); uGUIUtility.SetActiveEventSystem(true); if (actionOK != null) { actionOK(); } }, delegate { GameMain.Instance.SysDlg.Close(); uGUIUtility.SetActiveEventSystem(true); if (actionCANCEL != null) { actionCANCEL(); } }); } private void ButtonEvent_OK_OpenMainMenu() { this.ButtonEventSceneClose(); } private void SetMoneyParamWindowVisible(bool isVisible) { Transform parent = this.m_UITextNowMoney.transform.parent; if (parent) { parent.gameObject.SetActive(isVisible); } } public void OpenFacilityUIMaidSchedule() { this.m_UIMainMenu.gameObject.SetActive(true); this.m_UIFacilityDetails.gameObject.SetActive(true); this.m_UIFacilityPowerUpList.gameObject.SetActive(false); this.m_UIFacilityTypeList.gameObject.SetActive(false); this.m_UIFacilityCostume.gameObject.SetActive(false); this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false); this.m_UIButtonOK.gameObject.SetActive(true); this.m_UIButtonRESET.gameObject.SetActive(true); this.m_UIButtonCANCEL.gameObject.SetActive(false); this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(true); if (this.m_UIClubStatusViewer) { this.m_UIClubStatusViewer.gameObject.SetActive(false); } this.SetMoneyParamWindowVisible(true); this.nowMoney = this.nowMoney; this.nowCost = this.CalcNowCost(); this.m_UIToggleVisibleFacilityInfo.isOn = false; this.m_UIButtonOK.onClick.RemoveAllListeners(); this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu)); this.SetOKButtonEnable(true); this.m_UIFacilityInfoConstruction.gameObject.SetActive(false); this.m_UIButtonRESET.interactable = (this.FacilityMgr.GetNextDayFacilityArray().Count > 0); int facilityCountMax = this.FacilityMgr.FacilityCountMax; uGUIListViewer component = this.m_UIFacilityDetails.GetComponent(); component.Show(facilityCountMax, delegate(int i, Transform trans) { GameObject gameObject = trans.gameObject; SceneFacilityManagement.FacilityDetailsUI facilityDetailsUI = gameObject.AddComponent(); Facility facility = this.FacilityMgr.GetFacility(i); if (facility == null) { facilityDetailsUI.m_Button.gameObject.SetActive(false); facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(0f, 0f, 0f, 0.25f); ColorBlock colors = facilityDetailsUI.m_Toggle.colors; Color highlightedColor = colors.highlightedColor; highlightedColor.a = 0f; colors.highlightedColor = highlightedColor; facilityDetailsUI.m_Toggle.colors = colors; } else { facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(1f, 1f, 1f, 1f); } FacilityInfoUI component2 = trans.GetComponent(); component2.SetFacilityInfo(facility, false); component2.SetNameChangeEnable(facility != null); facilityDetailsUI.m_Toggle.onValueChanged.RemoveAllListeners(); facilityDetailsUI.m_Toggle.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } this.m_SelectingFacilityIndex = i; if (!this.m_UIFacilityInfoConstruction.gameObject.activeSelf) { this.m_UIFacilityInfoConstruction.gameObject.SetActive(true); } this.m_UIFacilityInfoConstruction.SetFacilityInfo(facility, false); this.m_UIButtonDestroyFacility.interactable = (facility != null); }); if (i == this.m_SelectingFacilityIndex) { Selectable componentInChildren = trans.GetComponentInChildren(); if (componentInChildren.interactable) { uGUIUtility.SetSelectedGameObject(gameObject); facilityDetailsUI.m_Toggle.isOn = true; } } }); } public void OpenFacilityUIConstruction(bool isOn) { if (!isOn) { return; } this.OpenFacilityUIConstruction(); } public void OpenFacilityUIConstruction() { this.m_UIMainMenu.gameObject.SetActive(true); this.m_UIFacilityDetails.gameObject.SetActive(true); this.m_UIFacilityPowerUpList.gameObject.SetActive(false); this.m_UIFacilityTypeList.gameObject.SetActive(false); this.m_UIFacilityCostume.gameObject.SetActive(false); this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false); this.m_UIButtonOK.gameObject.SetActive(true); this.m_UIButtonRESET.gameObject.SetActive(true); this.m_UIButtonCANCEL.gameObject.SetActive(false); this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(true); if (this.m_UIClubStatusViewer) { this.m_UIClubStatusViewer.gameObject.SetActive(false); } this.SetMoneyParamWindowVisible(true); this.nowMoney = this.nowMoney; this.nowCost = this.CalcNowCost(); this.m_UIToggleVisibleFacilityInfo.isOn = false; this.m_UIButtonOK.onClick.RemoveAllListeners(); this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu)); this.SetOKButtonEnable(true); this.m_UIFacilityInfoConstruction.gameObject.SetActive(false); this.m_UIButtonRESET.interactable = (this.FacilityMgr.GetNextDayFacilityArray().Count > 0); int facilityCountMax = this.FacilityMgr.FacilityCountMax; uGUIListViewer component = this.m_UIFacilityDetails.GetComponent(); component.Show(facilityCountMax, delegate(int i, Transform trans) { GameObject gameObject = trans.gameObject; SceneFacilityManagement.FacilityDetailsUI facilityDetailsUI = gameObject.AddComponent(); Facility facility = null; if (this.FacilityMgr.GetNextDayFacilityExist(i)) { facility = this.FacilityMgr.GetNextDayFacility(i); facilityDetailsUI.m_ChangeImage.SetActive(facility != null); facilityDetailsUI.m_DeleteImage.SetActive(facility == null && this.FacilityMgr.GetFacility(i) != null); if (facility == null) { facility = this.FacilityMgr.GetFacility(i); } } else { facility = this.FacilityMgr.GetFacility(i); } if (facility == null) { facilityDetailsUI.m_Button.gameObject.SetActive(false); facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(0f, 0f, 0f, 0.25f); ColorBlock colors = facilityDetailsUI.m_Toggle.colors; Color highlightedColor = colors.highlightedColor; highlightedColor.a = 0f; colors.highlightedColor = highlightedColor; facilityDetailsUI.m_Toggle.colors = colors; } else { facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(1f, 1f, 1f, 1f); } FacilityInfoUI component2 = trans.GetComponent(); component2.SetFacilityInfo(facility, false); component2.SetNameChangeEnable(facility != null); facilityDetailsUI.m_Toggle.onValueChanged.RemoveAllListeners(); facilityDetailsUI.m_Toggle.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } this.m_SelectingFacilityIndex = i; if (!this.m_UIFacilityInfoConstruction.gameObject.activeSelf) { this.m_UIFacilityInfoConstruction.gameObject.SetActive(true); } this.m_UIFacilityInfoConstruction.SetFacilityInfo(facility, false); this.m_UIButtonDestroyFacility.interactable = (facility != null); }); if (i == this.m_SelectingFacilityIndex) { Selectable componentInChildren = trans.GetComponentInChildren(); if (componentInChildren.interactable) { uGUIUtility.SetSelectedGameObject(gameObject); facilityDetailsUI.m_Toggle.isOn = true; } } }); } public void ButtonEvent_FacilityReplace() { int selectingFacilityIndex = this.m_SelectingFacilityIndex; Facility facility; if (this.FacilityMgr.GetNextDayFacilityExist(selectingFacilityIndex)) { facility = this.FacilityMgr.GetNextDayFacility(selectingFacilityIndex); } else { facility = this.FacilityMgr.GetFacility(selectingFacilityIndex); } string messageText = string.Empty; if (facility == null) { messageText = "空き部屋に施設を配置しますか?"; } else { messageText = "『" + facility.facilityName + "』\nが配置されています。\n施設を変更しますか?"; } if (facility && !FacilityDataTable.GetFacilityCanBeDestroy(facility.param.typeID, true)) { this.OpenDialog("『" + facility.facilityName + "』\nは変更出来ない施設です。", SystemDialog.TYPE.OK, null, null); } else { this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate { this.m_CreatingFacility.param.typeID = 0; this.ShowFacilityTypeList(); this.m_UIButtonRESET.gameObject.SetActive(false); this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false); this.m_UIMainMenu.gameObject.SetActive(false); this.SetMoneyParamWindowVisible(true); }, null); } } public void ToggleEvent_VisibleFacilityInfo(bool b) { uGUIListViewer component = this.m_UIFacilityDetails.GetComponent(); GameObject[] itemArray = component.ItemArray; if (itemArray == null) { return; } foreach (GameObject gameObject in itemArray) { SceneFacilityManagement.FacilityDetailsUI component2 = gameObject.GetComponent(); component2.m_ParentInfo.SetActive(b); } } public void ShowFacilityTypeList() { this.m_UIFacilityDetails.gameObject.SetActive(false); this.m_UIFacilityTypeList.gameObject.SetActive(true); this.m_UIFacilityPowerUpList.gameObject.SetActive(false); this.m_UIButtonCANCEL.gameObject.SetActive(true); this.m_UIButtonCANCEL.onClick.RemoveAllListeners(); this.m_UIButtonCANCEL.onClick.AddListener(new UnityAction(this.OpenFacilityUIConstruction)); this.m_UIButtonCANCEL.onClick.AddListener(delegate { this.m_UIMainMenu.gameObject.SetActive(true); }); this.m_UIButtonOK.onClick.RemoveAllListeners(); this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_FacilityConstruction)); this.SetOKButtonEnable(this.IsOKButtonEnable()); this.SetUpFacilityTypeList(); } private void SetUpFacilityTypeList() { uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent(); Facility facility; if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex)) { facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex); } else { facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex); } int num = -1; if (facility) { num = facility.param.typeID; } Facility.FacilityStatus[] facilityStatusArray = FacilityDataTable.GetFacilityStatusArray(true); List canBePlaceFacilityDataArray = new List(); Facility value; for (int j = 0; j < facilityStatusArray.Length; j++) { int typeID = facilityStatusArray[j].typeID; FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(typeID, true); if (num != typeID) { if (!FacilityDataTable.GetFacilityDefaultPlacement(typeID, true)) { if (GameMain.Instance.CharacterMgr.status.lockNTRPlay) { if (!facilityDefaultData.isEnableNTR) { goto IL_280; } } else if (facilityDefaultData.isOnlyNTR) { goto IL_280; } if (facilityDefaultData.name == "カジノ") { if (this.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID)) { goto IL_280; } bool flag = false; foreach (KeyValuePair keyValuePair in this.FacilityMgr.GetNextDayFacilityArray()) { value = keyValuePair.Value; if (value != null && value.defaultName == "カジノ") { flag = true; break; } } if (flag) { goto IL_280; } } else if (facilityDefaultData.name == "高級カジノ") { if (this.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID)) { goto IL_280; } bool flag2 = false; foreach (KeyValuePair keyValuePair2 in this.FacilityMgr.GetNextDayFacilityArray()) { Facility value2 = keyValuePair2.Value; if (value2 != null && value2.defaultName == "高級カジノ") { flag2 = true; break; } } if (flag2) { goto IL_280; } } canBePlaceFacilityDataArray.Add(facilityStatusArray[j]); } } IL_280:; } component.Show(canBePlaceFacilityDataArray.Count, delegate(int i, Transform trans) { Facility.FacilityStatus facilityStatus = canBePlaceFacilityDataArray[i]; Toggle componentInChildren = trans.GetComponentInChildren(); Text componentInChildren2 = trans.GetComponentInChildren(); componentInChildren2.text = facilityStatus.name; componentInChildren.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } this.m_CreatingFacility.Init(facilityStatus.typeID); this.ShowFacilityPowerUpList(this.m_CreatingFacility); long num2 = this.CalcNowCost(); num2 += (long)FacilityDataTable.GetFacilityDefaultCost(facilityStatus.typeID, true); if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex)) { Facility nextDayFacility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex); if (nextDayFacility) { num2 -= (long)FacilityDataTable.GetFacilityDefaultCost(nextDayFacility.param.typeID, true); } } this.nowCost = num2; this.m_CreatingFacility.Init(facilityStatus.typeID); this.SetOKButtonEnable(this.IsOKButtonEnable()); if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf) { this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true); } this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(this.m_CreatingFacility, true); this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.ConstructMode; }); }); } public void ResetFacilityTypeList() { uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent(); component.ResetList(); } private void ShowFacilityPowerUpList(Facility facility) { this.m_UIFacilityPowerUpList.gameObject.SetActive(true); this.SetUpFacilityPowerUpList(facility); } private void SetUpFacilityPowerUpList(Facility facility) { uGUIListViewer componentInChildren = this.m_UIFacilityPowerUpList.GetComponentInChildren(); if (FacilityDataTable.IsExistFacilityPowerUpRecipe(facility.param.typeID, true)) { Facility.RecipeData[] recipeArray = facility.recipe; componentInChildren.Show(recipeArray.Length, delegate(int i, Transform trans) { Text component = trans.Find("Text Recipe Name").GetComponent(); Text component2 = trans.Find("Text Recipe Number").GetComponent(); uGUIListViewer component3 = trans.Find("parent materials").GetComponent(); uGUIListViewer component4 = trans.Find("parent conditions").GetComponent(); uGUIListViewer component5 = trans.Find("parent default parameter").GetComponent(); uGUIListViewer component6 = trans.Find("parent additional parameter").GetComponent(); Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(recipeArray[i].id); component.text = facilityPowerUpRecipe.name; component2.text = string.Format("RECIPE {0}", i + 1); this.SetUpRecipeMaterialList(component3, recipeArray[i]); this.SetUpRecipeConditionList(component4, recipeArray[i].id); this.SetUpFacilityParams(component5, recipeArray[i].defaultParameter); this.SetUpFacilityParams(component6, recipeArray[i].additionalParameter); }); } else { componentInChildren.Show(1, delegate(int i, Transform trans) { Text component = trans.Find("Text Recipe Name").GetComponent(); Text component2 = trans.Find("Text Recipe Number").GetComponent(); uGUIListViewer component3 = trans.Find("parent materials").GetComponent(); uGUIListViewer component4 = trans.Find("parent conditions").GetComponent(); uGUIListViewer component5 = trans.Find("parent default parameter").GetComponent(); uGUIListViewer component6 = trans.Find("parent additional parameter").GetComponent(); component.text = "レシピ無し"; component2.text = string.Empty; component3.ResetList(); component4.ResetList(); component5.ResetList(); component6.ResetList(); }); } } public void ResetFacilityPowerUpList() { uGUIListViewer componentInChildren = this.m_UIFacilityPowerUpList.GetComponentInChildren(); if (componentInChildren) { componentInChildren.ResetList(); } else { Debug.LogWarningFormat("{0}\u3000には「{1}」コンポーネントが無い", new object[] { this.m_UIFacilityPowerUpList.name, typeof(uGUIListViewer) }); } } private void SetUpRecipeMaterialList(uGUIListViewer listViewer, Facility.RecipeData recipeData) { Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(recipeData.id); int[] materialCategoryIDArray = facilityPowerUpRecipe.materialCategoryIDArray; listViewer.Show(materialCategoryIDArray.Length, delegate(int i, Transform trans) { int categoryID = materialCategoryIDArray[i]; int materialID = recipeData.materialIDArray[i]; Text component = trans.Find("Text Category Name").GetComponent(); Text component2 = trans.Find("Text Category Number").GetComponent(); Text component3 = trans.Find("Text Material Name").GetComponent(); string facilityPowerUpMaterialCategoryName = FacilityDataTable.GetFacilityPowerUpMaterialCategoryName(categoryID); string text = string.Empty; if (FacilityDataTable.IsExistPowerUpMaterial(materialID)) { text = FacilityDataTable.GetFacilityPowerUpMaterial(materialID).name; } component.text = facilityPowerUpMaterialCategoryName; component3.text = text; component2.text = string.Format("CATEGORY {0}", i + 1); }); } private void SetUpRecipeConditionList(uGUIListViewer listViewer, int recipeID) { FacilityDataTable.FacilityRecipeData data = FacilityDataTable.GetFacilityRecipeData(recipeID); listViewer.Show(data.conditions.Length, delegate(int i, Transform trans) { Text[] componentsInChildren = trans.GetComponentsInChildren(); componentsInChildren[0].text = data.conditions[i]; componentsInChildren[1].text = (i + 1).ToString(); }); } private void SetUpFacilityParams(uGUIListViewer listViewer, Facility.FacilityParameter parameter) { List> paramList = new List>(); for (int j = 0; j < parameter.Length; j++) { if (parameter[j] > 0) { paramList.Add(new KeyValuePair(parameter.GetParameterName(j), parameter[j])); } } listViewer.Show(paramList.Count, delegate(int i, Transform trans) { Text componentInChildren = trans.GetComponentInChildren(); KeyValuePair keyValuePair = paramList[i]; componentInChildren.text = string.Format("{0} +{1}", keyValuePair.Key, keyValuePair.Value); }); } public void ButtonEvent_OK_FacilityConstruction() { Facility facility; if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex)) { facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex); } else { facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex); } long num = this.CalcNowCost(); num += (long)FacilityDataTable.GetFacilityDefaultCost(this.m_CreatingFacility.param.typeID, true); if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex)) { Facility nextDayFacility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex); if (nextDayFacility) { num -= (long)FacilityDataTable.GetFacilityDefaultCost(nextDayFacility.param.typeID, true); } } if (num > this.nowMoney) { this.OpenDialog("資金が不足する設定は出来ません。", SystemDialog.TYPE.OK, null, null); return; } string messageText = string.Empty; if (facility) { messageText = string.Concat(new string[] { "『", facility.facilityName, "』\nを、\n『", this.m_CreatingFacility.defaultName, "』\nに設定します。\nよろしいですか?" }); } else { messageText = "『" + this.m_CreatingFacility.defaultName + "』\nを設定します。\nよろしいですか?"; } this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate { Facility nextDayFacility2 = this.FacilityMgr.CreateNewFacility(this.m_CreatingFacility.param.typeID); this.FacilityMgr.SetNextDayFacility(this.m_SelectingFacilityIndex, nextDayFacility2); this.OpenDialog("『" + this.m_CreatingFacility.defaultName + "』\nを設定しました。", SystemDialog.TYPE.OK, delegate { this.ResetFacilityTypeList(); this.ResetFacilityPowerUpList(); }, null); this.m_CreatingFacility.param.typeID = 0; this.OpenFacilityUIConstruction(); }, delegate { }); } private bool IsOKButtonEnable() { return !(this.m_CreatingFacility == null) && FacilityDataTable.IsExistFacilityData(this.m_CreatingFacility.param.typeID, true); } private void SetOKButtonEnable(bool b) { this.m_UIButtonOK.interactable = b; } public void ButtonEvent_RESET_FacilityConstruction() { string messageText = "施設の設定をリセットします。\nよろしいですか?"; this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate { this.OpenDialog("施設の設定をリセットしました。", SystemDialog.TYPE.OK, delegate { this.ResetFacilityTypeList(); this.ResetFacilityPowerUpList(); }, null); this.FacilityMgr.ClearNextDayFacilityArray(); this.OpenFacilityUIConstruction(); this.m_CreatingFacility.param.typeID = 0; this.nowCost = this.CalcNowCost(); }, delegate { }); } private bool CheckFacilityCanBeDestroy(Facility facility) { return FacilityDataTable.GetFacilityCanBeDestroy(facility.param.typeID, true); } public void OpenDialogFacilityDestroy() { Facility facility; if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex)) { facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex); } else { facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex); } if (facility == null) { Debug.Log("[FacilityUIDestroy]撤去したい施設としてnullが指定されました"); return; } string facilityName = facility.facilityName; if (this.CheckFacilityCanBeDestroy(facility)) { this.OpenDialog("『" + facilityName + "』\nを撤去します。\nよろしいですか?\n※施設強化及び服装設定もリセットされます", SystemDialog.TYPE.YES_NO, delegate { this.FacilityMgr.SetNextDayFacility(this.m_SelectingFacilityIndex, null); this.OpenDialog("『" + facilityName + "』\nを撤去予定に設定しました。", SystemDialog.TYPE.OK, null, null); this.OpenFacilityUIConstruction(); }, delegate { }); } else { this.OpenDialog("『" + facilityName + "』\nは撤去出来ない施設です。", SystemDialog.TYPE.OK, null, null); } } public void OpenNowFacilityList(bool isOn) { if (!isOn) { return; } this.m_UIFacilityDetails.gameObject.SetActive(false); this.m_UIFacilityPowerUpList.gameObject.SetActive(false); this.m_UIFacilityCostume.gameObject.SetActive(false); this.m_UIButtonOK.gameObject.SetActive(true); this.m_UIButtonRESET.gameObject.SetActive(false); this.m_UIButtonCANCEL.gameObject.SetActive(false); this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false); if (this.m_UIClubStatusViewer) { this.m_UIClubStatusViewer.gameObject.SetActive(false); } this.m_UIFacilityTypeList.gameObject.SetActive(true); this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false); this.SetMoneyParamWindowVisible(false); this.m_UIButtonOK.onClick.RemoveAllListeners(); this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu)); this.SetOKButtonEnable(true); Facility[] facilityArray = this.FacilityMgr.GetFacilityArray(); List enableFacilityArray = new List(); for (int j = 0; j < facilityArray.Length; j++) { if (facilityArray[j]) { enableFacilityArray.Add(facilityArray[j]); } } uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent(); component.Show(enableFacilityArray.Count, delegate(int i, Transform trans) { Text componentInChildren = trans.GetComponentInChildren(); Toggle componentInChildren2 = trans.GetComponentInChildren(); componentInChildren.text = enableFacilityArray[i].facilityName; componentInChildren2.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } this.ShowFacilityPowerUpList(enableFacilityArray[i]); if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf) { this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true); } this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(enableFacilityArray[i], true); this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.DefaultMode; }); }); } public void OpenFacilityInfoList(bool isOn) { if (!isOn) { return; } this.m_UIFacilityDetails.gameObject.SetActive(false); this.m_UIFacilityPowerUpList.gameObject.SetActive(false); this.m_UIFacilityCostume.gameObject.SetActive(false); this.m_UIButtonOK.gameObject.SetActive(true); this.m_UIButtonRESET.gameObject.SetActive(false); this.m_UIButtonCANCEL.gameObject.SetActive(false); this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false); if (this.m_UIClubStatusViewer) { this.m_UIClubStatusViewer.gameObject.SetActive(false); } this.m_UIFacilityTypeList.gameObject.SetActive(true); this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false); this.SetMoneyParamWindowVisible(false); this.m_UIButtonOK.onClick.RemoveAllListeners(); this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu)); this.SetOKButtonEnable(true); Facility.FacilityStatus[] facilityStatusArray = FacilityDataTable.GetFacilityStatusArray(true); List enableFacilityArray = new List(); for (int j = 0; j < facilityStatusArray.Length; j++) { FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(facilityStatusArray[j].typeID, true); if (!facilityDefaultData.isDefaultPlace) { if (GameMain.Instance.CharacterMgr.status.lockNTRPlay) { if (!facilityDefaultData.isEnableNTR) { goto IL_18C; } } else if (facilityDefaultData.isOnlyNTR) { goto IL_18C; } enableFacilityArray.Add(facilityStatusArray[j]); } IL_18C:; } uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent(); component.Show(enableFacilityArray.Count, delegate(int i, Transform trans) { Text componentInChildren = trans.GetComponentInChildren(); Toggle componentInChildren2 = trans.GetComponentInChildren(); componentInChildren.text = enableFacilityArray[i].name; componentInChildren2.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } this.m_CreatingFacility.Init(enableFacilityArray[i].typeID); this.ShowFacilityPowerUpList(this.m_CreatingFacility); if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf) { this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true); } this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(this.m_CreatingFacility, true); this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.ConstructMode; }); }); } public void OpenFacilityCostumeSettingWindow(bool isOn) { if (!isOn) { return; } this.OpenFacilityCostumeSettingWindow(); } public void OpenFacilityCostumeSettingWindow() { this.nowCost = this.CalcNowCost(); this.m_UIFacilityDetails.gameObject.SetActive(false); this.m_UIFacilityPowerUpList.gameObject.SetActive(false); this.m_UIButtonOK.gameObject.SetActive(true); this.m_UIButtonRESET.gameObject.SetActive(false); this.m_UIButtonCANCEL.gameObject.SetActive(false); this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false); if (this.m_UIClubStatusViewer) { this.m_UIClubStatusViewer.gameObject.SetActive(false); } this.m_UIFacilityTypeList.gameObject.SetActive(true); this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false); this.SetMoneyParamWindowVisible(false); this.m_UIButtonOK.onClick.RemoveAllListeners(); this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu)); this.SetOKButtonEnable(true); Facility[] facilityArray = this.FacilityMgr.GetFacilityArray(); List enableFacilityArray = new List(); for (int j = 0; j < facilityArray.Length; j++) { Facility facility = null; if (this.FacilityMgr.GetNextDayFacilityExist(j)) { facility = this.FacilityMgr.GetNextDayFacility(j); } else if (facilityArray[j]) { facility = facilityArray[j]; } if (facility != null) { enableFacilityArray.Add(facility); } } uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent(); Facility tempSelectFacility = GameMain.Instance.FacilityMgr.tempSelectFacility; component.Show(enableFacilityArray.Count, delegate(int i, Transform trans) { Text componentInChildren = trans.GetComponentInChildren(); Toggle componentInChildren2 = trans.GetComponentInChildren(); componentInChildren.text = enableFacilityArray[i].facilityName; componentInChildren2.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } this.OpenCostumeSettingWindow(enableFacilityArray[i]); if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf) { this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true); } this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(enableFacilityArray[i], true); this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.DefaultMode; }); if (tempSelectFacility != null && enableFacilityArray[i] == tempSelectFacility) { componentInChildren2.isOn = true; } }); } private void OpenCostumeSettingWindow(Facility facility) { SceneFacilityManagement.m_CostumeEditFacilityIndex = GameMain.Instance.FacilityMgr.GetFacilityIndex(facility); GameMain.Instance.FacilityMgr.tempSelectFacility = facility; this.m_UIFacilityCostume.gameObject.SetActive(true); Facility.CostumeType typeCostume = facility.typeCostume; Toggle[] componentsInChildren = this.m_UIFacilityCostume.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { int num = i; Toggle toggle = componentsInChildren[num]; Facility.CostumeType toggleType = (Facility.CostumeType)num; toggle.onValueChanged.RemoveAllListeners(); toggle.onValueChanged.AddListener(delegate(bool value) { if (!value) { return; } facility.typeCostume = toggleType; this.m_UIButtonBeginCostumeSetting.interactable = (toggleType == Facility.CostumeType.Edit); Transform transform = this.m_UIFacilityCostume.Find("image thumbnail"); if (transform != null) { RawImage component = transform.GetComponent(); bool flag = facility.IsExistEditCostumeThumbnail(); if (toggleType == Facility.CostumeType.Edit) { flag = facility.IsExistEditCostumeThumbnail(); } else if (toggleType == Facility.CostumeType.Default) { flag = !string.IsNullOrEmpty(facility.defaultCostumeThumbnailName); } bool flag2 = (toggleType == Facility.CostumeType.Edit || toggleType == Facility.CostumeType.Default) && flag; if (transform.gameObject.activeSelf != flag2) { transform.gameObject.SetActive(flag2); } if (component.texture != null && string.IsNullOrEmpty(component.texture.name)) { try { UnityEngine.Object.DestroyImmediate(component.texture, false); } catch { component.texture = null; } } if (flag2) { Texture2D texture = null; if (toggleType == Facility.CostumeType.Edit) { texture = facility.GetEditCostumeThumbnail(); } else if (toggleType == Facility.CostumeType.Default) { texture = facility.GetDefaultCostumeThumbnail(); } component.texture = texture; } else { component.texture = null; } } else { NDebug.Assert("メイドのサムネイル表示オブジェクトがありません", false); } }); } for (int j = 0; j < componentsInChildren.Length; j++) { Toggle toggle2 = componentsInChildren[j]; Facility.CostumeType costumeType = (Facility.CostumeType)j; toggle2.isOn = (typeCostume == costumeType); toggle2.onValueChanged.Invoke(toggle2.isOn); } this.m_UIButtonBeginCostumeSetting.interactable = (typeCostume == Facility.CostumeType.Edit); } public void ButtonEventBeginCostumeSetting() { GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate { this.UpdateMaidPropOfCostume(SceneFacilityManagement.m_CostumeEditFacilityIndex, delegate { ScriptManager scriptMgr = GameMain.Instance.ScriptMgr; scriptMgr.adv_kag.JumpLabel(this.m_strScriptEditLabel); scriptMgr.adv_kag.Exec(); }); }, true, default(Color)); } public void ButtonEventSceneClose() { if (string.IsNullOrEmpty(this.m_strScriptReturnLabel)) { Debug.Log("[SceneFacilityManagement]シーン終了時に飛ぶラベルがありませんでした"); return; } GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate { ScriptManager scriptMgr = GameMain.Instance.ScriptMgr; scriptMgr.adv_kag.JumpLabel(this.m_strScriptReturnLabel); scriptMgr.adv_kag.Exec(); }, true, default(Color)); } private void GetTagBackup() { Dictionary tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup; string a; if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneFacilityManagement") { if (!tag_backup.TryGetValue("label", out this.m_strScriptReturnLabel)) { this.m_strScriptReturnLabel = "*施設の管理画面を抜ける"; } if (!tag_backup.TryGetValue("label_edit", out this.m_strScriptEditLabel)) { this.m_strScriptEditLabel = "*施設のコスチュームのエディットを開く"; } if (tag_backup.ContainsKey("update_costume")) { this.UpdateFacilityCostume(SceneFacilityManagement.m_CostumeEditFacilityIndex); this.OpenFacilityCostumeSettingWindow(); this.OpenCostumeSettingWindow(GameMain.Instance.FacilityMgr.tempSelectFacility); } else { SceneFacilityManagement.m_CostumeEditFacilityIndex = -1; GameMain.Instance.FacilityMgr.tempSelectFacility = null; } } } private void UpdateFacilityCostume(int facilityIndex) { FacilityManager facilityMgr = GameMain.Instance.FacilityMgr; Facility facility = facilityMgr.GetNextDayFacility(facilityIndex); if (facility == null) { facility = facilityMgr.GetFacility(facilityIndex); if (facility == null) { Debug.LogWarning(string.Format("[SceneFacilityManagement]インデックス[{0}]番目の施設は存在しない", facilityIndex)); return; } } Maid maidLeader = this.GetMaidLeader(); if (maidLeader == null) { NDebug.Warning("メイド長が見つかりません"); return; } facility.UpdateEditCostumeToMaidCostume(maidLeader); MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN(); for (int i = 0; i < facilityCostumeEnableMPN.Length; i++) { maidLeader.ResetProp(facilityCostumeEnableMPN[i], true); } maidLeader.AllProcPropSeqStart(); maidLeader.Visible = false; Debug.Log(string.Format("[SceneFacilityManagement]施設「{0}」の指定コスチュームの更新終了", facility.facilityName)); } private void UpdateMaidPropOfCostume(int facilityIndex, Action callback = null) { FacilityManager facilityMgr = GameMain.Instance.FacilityMgr; Facility facility = facilityMgr.GetNextDayFacility(facilityIndex); if (facility == null) { facility = facilityMgr.GetFacility(facilityIndex); if (facility == null) { Debug.LogWarning(string.Format("[SceneFacilityManagement]インデックス[{0}]番目の施設は存在しない", facilityIndex)); if (callback != null) { callback(); } return; } } Maid maid = this.GetMaidLeader(); if (maid == null) { NDebug.Warning("メイド長が見つかりません"); if (callback != null) { callback(); } return; } GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0); maid.Visible = true; maid.AllProcPropSeqStart(); base.StartCoroutine(this.coroutine_WaitmaidPropBusy(maid, delegate { facility.UpdateMaidCostumeToEditCostume(maid, true); maid.AllProcPropSeqStart(); this.StartCoroutine(this.coroutine_WaitmaidPropBusy(maid, callback)); })); } private IEnumerator coroutine_WaitmaidPropBusy(Maid maid, Action callback) { while (maid.IsBusy) { yield return null; } if (callback != null) { callback(); } yield break; } private Maid GetMaidLeader() { Maid maid = null; CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetMaidCount(); i++) { Maid maid2 = characterMgr.GetMaid(i); if (maid2 != null && maid2.status.leader) { maid = maid2; break; } } if (maid == null) { for (int j = 0; j < characterMgr.GetStockMaidCount(); j++) { Maid stockMaid = characterMgr.GetStockMaid(j); if (stockMaid != null && stockMaid.status.leader) { maid = stockMaid; break; } } } if (maid == null) { for (int k = 0; k < characterMgr.GetMaidCount(); k++) { Maid maid3 = characterMgr.GetMaid(k); if (maid3 != null) { maid = maid3; break; } } } if (maid == null) { for (int l = 0; l < characterMgr.GetStockMaidCount(); l++) { Maid stockMaid2 = characterMgr.GetStockMaid(l); if (stockMaid2 != null) { maid = stockMaid2; break; } } } return maid; } private FacilityManager m_FacilityMgr; [SerializeField] private Text m_UITextNowMoney; [SerializeField] private Text m_UITextNowCost; [SerializeField] private RectTransform m_UIMainMenu; [SerializeField] private RectTransform m_UIFacilityDetails; [SerializeField] private RectTransform m_UIFacilityTypeList; [SerializeField] private RectTransform m_UIFacilityCostume; [SerializeField] private RectTransform m_UIFacilityPowerUpList; [SerializeField] private FacilityInfoUI m_UIFacilityInfoConstruction; [SerializeField] private FacilityInfoUI m_UIFacilityInfoMiniWindow; [SerializeField] private Button m_UIButtonOK; [SerializeField] private Button m_UIButtonCANCEL; [SerializeField] private Button m_UIButtonRESET; [SerializeField] private Button m_UIButtonDestroyFacility; [SerializeField] private Toggle m_UIToggleVisibleFacilityInfo; [SerializeField] private Button m_UIButtonBeginCostumeSetting; [SerializeField] private StatusViewer m_UIClubStatusViewer; [SerializeField] private bool m_EnableSetUpCameraAndBG = true; private Facility m_CreatingFacility; private int m_SelectingFacilityIndex; private static int m_CostumeEditFacilityIndex = -1; [SerializeField] private StartDestroyEventObject m_StartDestroyEventObject; private string m_PlayBGM = "BGM009.ogg"; private long m_NowCost; private string m_strScriptReturnLabel = string.Empty; private string m_strScriptEditLabel = string.Empty; private class FacilityDetailsUI : MonoBehaviour { private void Awake() { this.m_FacilityInfoUI = base.GetComponent(); this.m_Toggle = base.GetComponent(); this.m_Button = base.GetComponentInChildren