123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- public class PresetMgr : BaseMgr<PresetMgr>
- {
- private void Start()
- {
- this.Init();
- }
- private void Init()
- {
- UIRoot componentInParent = base.GetComponentInParent<UIRoot>();
- NDebug.Assert(componentInParent != null, "UI Rootがみつかりません。");
- this.m_goPresetPanel = componentInParent.transform.Find("PresetPanel").gameObject;
- if (this.m_goPresetPanel == null)
- {
- NDebug.Assert(string.Format("{0}が見つかりませんでした", "PresetPanel"), false);
- return;
- }
- this.m_presetCtrl = this.m_goPresetPanel.GetComponent<PresetCtrl>();
- NDebug.Assert(this.m_presetCtrl != null, "PresetCtrlコンポーネントがみつかりません。");
- GameMain instance = GameMain.Instance;
- NDebug.Assert(instance != null, "GameMainがありません。");
- Maid maid = instance.CharacterMgr.GetMaid(0);
- NDebug.Assert(maid != null, "メイド0が居ません。");
- this.m_presetCtrl.Init(this.m_goPresetPanel, maid);
- this.m_goPresetPanel.SetActive(false);
- }
- public void OpenPresetPanel()
- {
- this.m_presetCtrl.InitFilterButtonActive(PresetMgr.m_currentActiveFilterBtnName);
- PresetMgr.m_currentActiveFilterBtnName = PresetMgr.Filter.NotFilter;
- this.listPre = GameMain.Instance.CharacterMgr.PresetListLoad();
- Resources.UnloadUnusedAssets();
- this.m_goPresetPanel.SetActive(true);
- this.m_presetCtrl.CreatePresetList(this.listPre);
- }
- public void UpdatePresetList()
- {
- List<CharacterMgr.Preset> listPreset = GameMain.Instance.CharacterMgr.PresetListLoad();
- Resources.UnloadUnusedAssets();
- this.m_presetCtrl.CreatePresetList(listPreset);
- }
- public void ClosePresetPanel()
- {
- this.m_presetCtrl.InitFilterButtonActive(PresetMgr.m_currentActiveFilterBtnName);
- this.m_goPresetPanel.SetActive(false);
- Resources.UnloadUnusedAssets();
- }
- public void ClickPreset()
- {
- if (GameMain.Instance.CharacterMgr.GetMaid(0).IsBusy)
- {
- return;
- }
- string name = UIButton.current.name;
- if (UICamera.currentTouchID == -1)
- {
- this.currentPreset = name;
- this.m_presetCtrl.PresetSet();
- }
- if (UICamera.currentTouchID == -2)
- {
- this.m_presetCtrl.DeletePreset(name);
- }
- }
- public void ClickFilterPreset()
- {
- string name = UIButton.current.name;
- if (!Enum.IsDefined(typeof(PresetMgr.Filter), name))
- {
- Debug.LogError(string.Format("不適切なボタンがクリックされました。クリックされたボタン名={0}", name));
- return;
- }
- PresetMgr.Filter filter = (PresetMgr.Filter)Enum.Parse(typeof(PresetMgr.Filter), name);
- if (filter != PresetMgr.m_currentActiveFilterBtnName)
- {
- this.ClickFilterPresetByEnum(filter);
- }
- }
- public void ClickFilterPresetByEnum(PresetMgr.Filter clickBtnName)
- {
- this.m_presetCtrl.FilterPreset(clickBtnName, PresetMgr.m_currentActiveFilterBtnName);
- PresetMgr.m_currentActiveFilterBtnName = clickBtnName;
- }
- public void UpdateFilterPreset(PresetMgr.Filter btnName)
- {
- this.m_presetCtrl.FilterPreset(btnName, PresetMgr.Filter.None, false);
- }
- public float GetScrollBarValue()
- {
- return this.m_presetCtrl.GetScrollBarValue();
- }
- public void SetScrollBar(float scrollBarValue)
- {
- this.m_presetCtrl.SetScrollBar(scrollBarValue);
- }
- private GameObject m_goPresetPanel;
- private PresetCtrl m_presetCtrl;
- private const int LeftClick = -1;
- private const int RightClick = -2;
- private string currentPreset;
- public static PresetMgr.Filter m_currentActiveFilterBtnName = PresetMgr.Filter.None;
- private List<CharacterMgr.Preset> listPre;
- public enum Filter
- {
- None = -1,
- NotFilter,
- All,
- Wear,
- Body
- }
- }
|