123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- public class PresetButtonMgr : BaseMgr<PresetButtonMgr>
- {
- private void Start()
- {
- UIRoot componentInParent = base.GetComponentInParent<UIRoot>();
- 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<PresetButtonCtrl>();
- 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<SceneEdit>();
- 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<ProfileMgr>.Instance != null)
- {
- BaseMgr<ProfileMgr>.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<string, PresetButtonCtrl.ItemPreset> m_dicItem;
- public enum ItemTypes
- {
- Pose,
- Clothes,
- PriSave,
- Voice,
- BG
- }
- }
|