Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.

Commit

Permalink
Version 0.3.0
Browse files Browse the repository at this point in the history
- Added alerts
- Added input alerts
- Added faster menu creation
  • Loading branch information
AtiLion committed Aug 15, 2019
1 parent 13d9c88 commit 3575479
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
4 changes: 2 additions & 2 deletions VRCMenuUtils/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.2.1")]
[assembly: AssemblyFileVersion("0.0.2.1")]
[assembly: AssemblyVersion("0.0.3.0")]
[assembly: AssemblyFileVersion("0.0.3.0")]
41 changes: 40 additions & 1 deletion VRCMenuUtils/VRCMenuUtilsAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static class VRCMenuUtilsAPI
#endregion
#region VRCMenuUtils Properties
public static bool IsIntialized => _UIInitialized;
public static string Version => "0.2.1";
public static string Version => "0.3.0";
#endregion
#region VRCMenuUtils Delegates
public delegate void ElementChangeDelegate(Transform transform);
Expand Down Expand Up @@ -152,6 +152,24 @@ IEnumerator placeUi()
VRCUiManager.StartCoroutine(placeUi());
VRCUiManager.ShowScreen(page);
}
public static void HideCurrentPopup() =>
VRCUiPopupManager?.HideCurrentPopup();

public static void Alert(string title, string body, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowStandardPopup(title, body, additionalSetup);
public static void Alert(string title, string body, string middleButtonText, Action middleButtonAction, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowStandardPopup(title, body, middleButtonText, middleButtonAction, additionalSetup);
public static void AlertV2(string title, string body, string middleButtonText, Action middleButtonAction, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowStandardPopupV2(title, body, middleButtonText, middleButtonAction, additionalSetup);
public static void Alert(string title, string body, string leftButtonText, Action leftButtonAction, string rightButtonText, Action rightButtonAction, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowStandardPopup(title, body, leftButtonText, leftButtonAction, rightButtonText, rightButtonAction, additionalSetup);
public static void AlertV2(string title, string body, string leftButtonText, Action leftButtonAction, string rightButtonText, Action rightButtonAction, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowStandardPopupV2(title, body, leftButtonText, leftButtonAction, rightButtonText, rightButtonAction, additionalSetup);

public static void InputAlert(string title, string text, InputField.InputType type, bool useNumericKeypad, string buttonText, Action<string, List<KeyCode>, Text> submitAction, string placeHolder = "Enter text....", bool hideOnSubmit = true, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowUnityInputPopup(title, text, type, useNumericKeypad, buttonText, submitAction, placeHolder, hideOnSubmit, additionalSetup);
public static void InputAlert(string title, string text, InputField.InputType type, bool useNumericKeypad, string buttonText, Action<string, List<KeyCode>, Text> submitAction, Action cancelAction, string placeHolder = "Enter text....", bool hideOnSubmit = true, Action<VRCUiPopup> additionalSetup = null) =>
VRCUiPopupManager?.ShowUnityInputPopupWithCancel(title, text, type, useNumericKeypad, buttonText, submitAction, cancelAction, placeHolder, hideOnSubmit, additionalSetup);

internal static void EnableFlowManager()
{
Expand Down Expand Up @@ -189,6 +207,16 @@ public static void AddUserInfoButton(Transform button)

OnUserInfoButtonAdd?.Invoke(button);
}
public static VRCEUiButton AddUserInfoButton(string name, string text, Action clickAction)
{
if (!_UIInitialized)
return null;
VRCEUiButton button = new VRCEUiButton(name, new Vector2(0f, 0f), text);
button.OnClick += clickAction;

OnUserInfoButtonAdd?.Invoke(button.Control);
return button;
}
#endregion
#region UserInfo Control Functions
internal static void SetUserInfoUIState(bool active)
Expand Down Expand Up @@ -224,6 +252,17 @@ public static void AddQuickMenuButton(VRCEUiQuickButton button)

OnQuickMenuButtonAdd?.Invoke(button);
}
public static VRCEUiQuickButton AddQuickMenuButton(string name, string text, string tooltip, Action clickAction)
{
if (!_UIInitialized)
return null;
VRCEUiQuickButton button = new VRCEUiQuickButton(name, new Vector2(0f, 0f), text, tooltip);
button.OnClick += clickAction;

OnQuickMenuButtonAdd?.Invoke(button);
return button;
}

public static void ShowQuickMenuPage(string page)
{
if (string.IsNullOrEmpty(page))
Expand Down

0 comments on commit 3575479

Please sign in to comment.