1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using UnityEngine;
- namespace COM3D2.MeidoPhotoStudio.Plugin
- {
- internal class TabsPane : BasePane
- {
- private SelectionGrid Tabs;
- private Constants.Window selectedTab;
- public Constants.Window SelectedTab
- {
- get => selectedTab;
- set => Tabs.SelectedItemIndex = (int)value;
- }
- public event EventHandler TabChange;
- private new bool updating;
- private readonly string[] tabNames = { "call", "pose", "face", "bg", "bg2" };
- public TabsPane()
- {
- Translation.ReloadTranslationEvent += (s, a) => ReloadTranslation();
- Tabs = new SelectionGrid(Translation.GetArray("tabs", tabNames));
- Tabs.ControlEvent += (s, a) => OnChangeTab();
- }
- protected override void ReloadTranslation()
- {
- updating = true;
- Tabs.SetItems(Translation.GetArray("tabs", tabNames), Tabs.SelectedItemIndex);
- updating = false;
- }
- private void OnChangeTab()
- {
- if (updating) return;
- selectedTab = (Constants.Window)Tabs.SelectedItemIndex;
- TabChange?.Invoke(null, EventArgs.Empty);
- }
- public override void Draw()
- {
- Tabs.Draw(GUILayout.ExpandWidth(false));
- MiscGUI.BlackLine();
- }
- }
- }
|