2020-09-04 21:36:40 +10:00
|
|
|
|
using System;
|
2020-09-30 01:52:49 +10:00
|
|
|
|
using System.Collections.Generic;
|
2020-09-18 18:38:11 +10:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using UnityEngine;
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
using Explorer.UnstripInternals;
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#endif
|
2020-09-04 21:36:40 +10:00
|
|
|
|
|
|
|
|
|
namespace Explorer
|
|
|
|
|
{
|
|
|
|
|
public class GUIUnstrip
|
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
public static void BeginHorizontal(params GUILayoutOption[] options)
|
|
|
|
|
=> BeginHorizontal(GUIContent.none, GUIStyle.none, options);
|
|
|
|
|
|
|
|
|
|
public static void BeginHorizontal(GUIStyle style, params GUILayoutOption[] options)
|
|
|
|
|
=> BeginHorizontal(GUIContent.none, style, options);
|
|
|
|
|
|
|
|
|
|
public static void BeginHorizontal(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
|
|
|
|
Internal.BeginLayoutDirection(false, content, style, options);
|
|
|
|
|
#else
|
|
|
|
|
GUILayout.BeginHorizontal(content, style, options);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void BeginVertical(params GUILayoutOption[] options)
|
|
|
|
|
=> BeginVertical(GUIContent.none, GUIStyle.none, options);
|
|
|
|
|
|
|
|
|
|
public static void BeginVertical(GUIStyle style, params GUILayoutOption[] options)
|
|
|
|
|
=> BeginVertical(GUIContent.none, style, options);
|
|
|
|
|
|
|
|
|
|
public static void BeginVertical(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
|
|
|
|
Internal.BeginLayoutDirection(true, content, style, options);
|
|
|
|
|
#else
|
|
|
|
|
GUILayout.BeginVertical(content, style, options);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Rect GetLastRect()
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
|
|
|
|
return Internal_LayoutUtility.GetLastRect();
|
|
|
|
|
#else
|
|
|
|
|
return GUILayoutUtility.GetLastRect();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-30 01:52:49 +10:00
|
|
|
|
public static string TextField(string text, GUILayoutOption[] options)
|
2020-09-04 21:36:40 +10:00
|
|
|
|
{
|
2020-09-30 01:52:49 +10:00
|
|
|
|
#if CPP
|
|
|
|
|
return Internal.TextField(text, options);
|
|
|
|
|
#else
|
2020-09-30 01:59:35 +10:00
|
|
|
|
return GUILayout.TextField(text, options);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#endif
|
2020-10-01 18:57:28 +10:00
|
|
|
|
}
|
2020-09-12 16:14:42 +10:00
|
|
|
|
|
2020-09-27 22:04:23 +10:00
|
|
|
|
public static Rect Window(int id, Rect rect, GUI.WindowFunction windowFunc, string title)
|
2020-09-04 21:36:40 +10:00
|
|
|
|
{
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#if CPP
|
|
|
|
|
return GUI.Window(id, rect, windowFunc, GUIContent.Temp(title), GUI.skin.window);
|
|
|
|
|
#else
|
|
|
|
|
return GUI.Window(id, rect, windowFunc, title);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool Button(Rect rect, string title)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
|
|
|
|
return GUI.Button(rect, GUIContent.Temp(title), GUI.skin.button);
|
|
|
|
|
#else
|
|
|
|
|
return GUI.Button(rect, title);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string TextArea(string text, params GUILayoutOption[] options)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
|
|
|
|
return GUILayout.DoTextField(text, -1, true, GUI.skin.textArea, options);
|
|
|
|
|
#else
|
|
|
|
|
return GUILayout.TextArea(text, options);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void BringWindowToFront(int id)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
Internal.BringWindowToFront(id);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#else
|
|
|
|
|
GUI.BringWindowToFront(id);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Vector2 ScreenToGUIPoint(Vector2 screenPoint)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
return Internal.ScreenToGUIPoint(screenPoint);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#else
|
|
|
|
|
return GUIUtility.ScreenToGUIPoint(screenPoint);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Space(float pixels)
|
|
|
|
|
{
|
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
Internal.Space(pixels);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#else
|
|
|
|
|
GUILayout.Space(pixels);
|
|
|
|
|
#endif
|
2020-09-04 21:36:40 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 18:57:28 +10:00
|
|
|
|
public static bool RepeatButton(string text, params GUILayoutOption[] options)
|
|
|
|
|
{
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#if CPP
|
2020-10-01 18:57:28 +10:00
|
|
|
|
return Internal.DoRepeatButton(GUIContent.Temp(text), GUI.skin.button, options);
|
2020-09-30 01:52:49 +10:00
|
|
|
|
#else
|
2020-10-01 18:57:28 +10:00
|
|
|
|
return GUILayout.RepeatButton(text, options);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#endif
|
2020-10-01 18:57:28 +10:00
|
|
|
|
}
|
2020-09-14 20:25:38 +10:00
|
|
|
|
|
2020-10-01 18:57:28 +10:00
|
|
|
|
public static void BeginArea(Rect screenRect, GUIStyle style)
|
2020-09-13 17:11:15 +10:00
|
|
|
|
{
|
2020-10-01 18:57:28 +10:00
|
|
|
|
#if CPP
|
|
|
|
|
Internal.BeginArea(screenRect, GUIContent.none, style);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#else
|
2020-10-01 18:57:28 +10:00
|
|
|
|
GUILayout.BeginArea(screenRect, style);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#endif
|
2020-10-01 18:57:28 +10:00
|
|
|
|
}
|
2020-09-13 17:11:15 +10:00
|
|
|
|
|
|
|
|
|
static public void EndArea()
|
|
|
|
|
{
|
2020-10-01 18:57:28 +10:00
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
Internal.EndArea();
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#else
|
|
|
|
|
GUILayout.EndArea();
|
|
|
|
|
#endif
|
2020-10-01 18:57:28 +10:00
|
|
|
|
}
|
2020-09-13 17:11:15 +10:00
|
|
|
|
|
2020-09-04 21:36:40 +10:00
|
|
|
|
|
|
|
|
|
public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options)
|
|
|
|
|
{
|
2020-10-01 18:57:28 +10:00
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
return Internal.BeginScrollView(scroll, options);
|
2020-10-01 18:57:28 +10:00
|
|
|
|
#else
|
|
|
|
|
return GUILayout.BeginScrollView(scroll, options);
|
|
|
|
|
#endif
|
2020-09-04 21:36:40 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void EndScrollView(bool handleScrollWheel = true)
|
|
|
|
|
{
|
2020-10-01 18:57:28 +10:00
|
|
|
|
#if CPP
|
2020-09-30 01:52:49 +10:00
|
|
|
|
Internal.EndScrollView(handleScrollWheel);
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#else
|
|
|
|
|
GUILayout.EndScrollView();
|
|
|
|
|
#endif
|
2020-10-01 18:57:28 +10:00
|
|
|
|
}
|
2020-09-04 21:36:40 +10:00
|
|
|
|
}
|
2020-09-27 22:04:23 +10:00
|
|
|
|
}
|