using System; using System.Collections.Generic; using UnityEngine; public class PresetButtonMgr : BaseMgr { private void Start() { UIRoot componentInParent = base.GetComponentInParent(); this.m_goPresetButtonPanel = componentInParent.transform.Find("PresetButtonPanel").gameObject; if (this.m_goPresetButtonPanel == null) { Debug.LogError(string.Format("{0}が見つかりませんでした", "PresetButtonPanel")); return; } this.m_presetButtonCtrl = this.m_goPresetButtonPanel.GetComponent(); Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0); this.m_presetButtonCtrl.Init(this.m_goPresetButtonPanel, maid); this.m_goItemPresetsViewer = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer", false); this.m_sceneEdit = GameObject.Find("__SceneEdit__").GetComponent(); this.m_goProfilePanel = componentInParent.transform.Find("ProfilePanel").gameObject; this.m_goPresetButtonPanel.SetActive(true); } public void OpenPresetButtonPanel() { this.m_goPresetButtonPanel.SetActive(true); } public void ClosePresetButtonPanel() { this.m_goPresetButtonPanel.SetActive(false); } public void OnButtonClickWithType(string type) { string name = UIButton.current.name; if (type == "PresetButtons" && name == this.m_currentActivePresetBtnName) { this.CloseItemPresetsViewer(); this.m_currentActivePresetBtnName = null; this.m_currentActiveItemPresetBtnName = null; } else if (type == "PresetButtons" && name != this.m_currentActivePresetBtnName) { if (name != "View" && this.IsDisplayingProfilePanel() && BaseMgr.Instance != null) { BaseMgr.instance.CloseProfilePanel(); this.m_sceneEdit.CategoryUnSelect(); this.m_sceneEdit.SetCameraOffset(SceneEdit.CAM_OFFS.CENTER); } this.m_presetButtonCtrl.CreateItemPresetsViewer("PresetButtons", name, this.m_currentActivePresetBtnName); this.m_currentActivePresetBtnName = name; this.m_currentActiveItemPresetBtnName = null; if (name == "View") { this.m_sceneEdit.ToView(); Debug.Log("Call sceneEdit.ToView()"); this.m_currentActivePresetBtnName = null; this.m_currentActiveItemPresetBtnName = null; } } else if (type == "ItemPresetsViewer" && name != this.m_currentActiveItemPresetBtnName) { this.InitItemPresetBtn(type, name, this.m_currentActiveItemPresetBtnName); } } private void InitItemPresetBtn(string type, string clickBtnName, string currentActiveItemPresetBtnName) { this.m_presetButtonCtrl.AdjustItemPresets(type, clickBtnName, currentActiveItemPresetBtnName); this.m_currentActiveItemPresetBtnName = clickBtnName; } public void CloseItemPresetsViewer() { this.m_presetButtonCtrl.CreateItemPresetsViewer("PresetButtons", "View", this.m_currentActivePresetBtnName); this.m_presetButtonCtrl.SetActiveBtn("View", false); this.m_currentActivePresetBtnName = null; } private bool IsDisplayingProfilePanel() { return this.m_goProfilePanel.activeSelf; } public void UpdateClothesByName(string name) { this.m_presetButtonCtrl.ClickClothesByButtonName(name); } private GameObject m_goPresetButtonPanel; private GameObject m_goItemPresetsViewer; private GameObject m_goProfilePanel; private SceneEdit m_sceneEdit; private PresetButtonCtrl m_presetButtonCtrl; private string m_currentActivePresetBtnName; private string m_currentActiveItemPresetBtnName; private Dictionary m_dicItem; public enum ItemTypes { Pose, Clothes, PriSave, Voice, BG } }