12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- * All rights reserved.
- *
- * This source code is licensed under the license found in the
- * LICENSE file in the root directory of this source tree.
- */
- using Meta.WitAi.Data.Configuration;
- using UnityEditor;
- using UnityEngine;
- namespace Meta.WitAi.Windows
- {
- public abstract class BaseWitWindow : EditorWindow
- {
- // Scroll offset
- private Vector2 ScrollOffset;
- // Override values
- protected abstract GUIContent Title { get; }
- protected virtual Texture2D HeaderIcon => WitTexts.HeaderIcon;
- protected virtual string HeaderUrl => WitTexts.WitUrl;
- protected virtual string DocsUrl => WitTexts.Texts.WitDocsUrl;
- // Window open
- protected virtual void OnEnable()
- {
- titleContent = Title;
- WitConfigurationUtility.ReloadConfigurationData();
- }
- // Window close
- protected virtual void OnDisable()
- {
- ScrollOffset = Vector2.zero;
- }
- // Handle Layout
- protected virtual void OnGUI()
- {
- Vector2 size;
- WitEditorUI.LayoutWindow(Title.text, HeaderIcon, HeaderUrl, DocsUrl, LayoutContent, ref ScrollOffset, out size);
- }
- // Draw content of window
- protected abstract void LayoutContent();
- }
- }
|