private static void ManuallyEnterIP() { object[] args = null; #if ANDROID args = new object[] { Android.Text.InputTypes.ClassPhone }; #endif PlatformFunctions.OpenInputDialog("Enter Roku IP Address", ButtonManuallyEnterIP.ParseIPText, 0, args); }
public void Show(bool animated = true) { ModalPresentationStyle = UIModalPresentationStyle.Popover; ModalTransitionStyle = UIModalTransitionStyle.CoverVertical; ModalPresentationCapturesStatusBarAppearance = true; var nav = PlatformFunctions.GetNavigationController(); nav.PushViewController(this, animated); }
public async Task WhenShownAsync() { ModalPresentationStyle = UIModalPresentationStyle.FullScreen; ModalTransitionStyle = UIModalTransitionStyle.CoverVertical; TaskCompletionSource <object> presentedTaskCompletionSource = new TaskCompletionSource <object>(); PlatformFunctions.GetTopViewController().PresentViewController(this, true, () => { presentedTaskCompletionSource.TrySetResult(null); }); await presentedTaskCompletionSource.Task; }
public virtual void Dismiss() { if (PlatformFunctions.GetTopViewController() == this) { NavigationController?.PopViewController(true); } else { this.View?.RemoveFromSuperview(); this.RemoveFromParentViewController(); } this.DismissViewController(true, null); }
private static void ParseIPText(string ip_string) { bool success = IPAddress.TryParse(ip_string, out IPAddress ip) && ip_string.Split('.').Length == 4; if (success && ip != null) { Settings.RokuName = ""; Settings.RokuIP = ip; Engine.ChangeRoom <RoomMain>(); } else { PlatformFunctions.OpenMessageDialog("Invalid IP", ip_string + " is not a valid IP address"); } }
// ---------[ INITIALIZATION ]--------- /// <summary>Loads the platform I/O behaviour.</summary> static UserDataStorage() { // Select the platform appropriate functions #if UNITY_EDITOR && !DISABLE_EDITOR_CODEPATH UserDataStorage.PLATFORM = UserDataStorage.GetPlatformFunctions_Editor(); #elif MODIO_FACEPUNCH_SUPPORT UserDataStorage.PLATFORM = UserDataStorage.GetPlatformFunctions_Facepunch(); #elif MODIO_STEAMWORKSNET_SUPPORT UserDataStorage.PLATFORM = UserDataStorage.GetPlatformFunctions_SteamworksNET(); #else UserDataStorage.PLATFORM = UserDataStorage.GetPlatformFunctions_Standalone(); #endif Debug.Assert(UserDataStorage.PLATFORM.InitializeWithInt != null); Debug.Assert(UserDataStorage.PLATFORM.InitializeWithString != null); Debug.Assert(UserDataStorage.PLATFORM.ReadFile != null); Debug.Assert(UserDataStorage.PLATFORM.WriteFile != null); Debug.Assert(UserDataStorage.PLATFORM.DeleteFile != null); Debug.Assert(UserDataStorage.PLATFORM.ClearAllData != null); }
public void ShowOver(bool animated = true) { ShowOver(PlatformFunctions.GetTopViewController(), animated); }
public async Task ShowOverAsync(bool animated = true) { await ShowOverAsync(PlatformFunctions.GetTopViewController(), animated); }
public void ShowMessageShort(string message) { PlatformFunctions.ShowToast(message, shortDelay); }
public void ShowMessageLong(string message) { PlatformFunctions.ShowToast(message, longDelay); }
public CultureInfo GetDefaultCulture() { return(PlatformFunctions.GetFormattingLanguage()); }
public void GoToTopPage() { PlatformFunctions.GetNavigationController()?.PopToRootViewController(true); }
private static void SetName() { PlatformFunctions.OpenInputDialog("Enter Name", result => Settings.PlayerName = result.Trim(), Settings.MaxNameLength); }
/// <summary> /// Draw connection error overlay. Retry connection and close. /// </summary> private void DrawConnectionErrorOverlay() { bool unused_open = true; ImGui.OpenPopup("NetworkDisconnected"); if (ImGui.BeginPopupModal("NetworkDisconnected", ref unused_open, ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.AlwaysAutoResize)) { ImGui.PushFont((ImFontPtr)Frame.Fonts.NormalFont); if (Platform == Platform.Android) { ImGui.SetWindowFontScale(1 - downScaleNetworkDisconnectedWindow); } ImGui.TextUnformatted("Lost connection to server."); float buttonPositionX = ImGui.CalcTextSize("Lost connection to server.").X; ImGui.SetCursorPosX(buttonPositionX); ImGui.SetCursorPosY(ImGui.CalcTextSize("UNUSED").Y * 2); ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(1, 1, 1, 1)); ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 0, 0, 1)); Vector2 buttonPadding = new Vector2(14, 20); if (Platform == Platform.Android) { buttonPadding = new Vector2(14, 60); } if (runningConnectCheck) { ImGui.Button("Retrying Connection... ", ImGui.CalcTextSize("Retrying Connection... ") + buttonPadding); } else { if (ImGui.Button("Retry Connection", ImGui.CalcTextSize("Retrying Connection... ") + buttonPadding)) { Task.Factory.StartNew(() => { runningConnectCheck = true; if (Networking.ReConnect()) { string localSessionId = LocalData.RetrieveSession(); if (localSessionId != null && localSessionId.Length != 0) { Networking.SessionVerificationResult += Networking_SessionVerificationResult; Networking.Send(PacketName.RequestSessionVerification.ToString(), localSessionId); } else { // User is not logged in. drawNetworkDisconnected = false; } } runningConnectCheck = false; }); } } ImGui.SetCursorPosX(buttonPositionX); if (ImGui.Button("Close app", ImGui.CalcTextSize("Retrying Connection... ") + buttonPadding)) { PlatformFunctions.Exit(); } Vector2 windowSize = ImGui.GetWindowSize(); Vector2 screenSize = new Vector2(Frame.Width, Frame.Height); Vector2 loginWindowPosition = new Vector2((screenSize.X / 2) - (windowSize.X / 2), (screenSize.Y / 2) - (windowSize.Y / 2)); if ((ImGui.GetWindowWidth() + (15 * PlatformFunctions.ScreenDensity())) > (screenSize.X)) { downScaleNetworkDisconnectedWindow += 0.05f; } ImGui.SetWindowPos(loginWindowPosition); ImGui.PopStyleColor(); ImGui.PopFont(); ImGui.EndPopup(); } }
/// <summary> /// This method is used to draw the GUI. /// </summary> public override void Draw() { ImGui.GetStyle().WindowBorderSize = 0; if (drawNetworkDisconnected) { DrawConnectionErrorOverlay(); } if (drawLogin) { loginView.Draw(); DrawLoginOverlay(); } if (drawAppSelectionView) { float overlayHeight = DrawMainOverlay(); appSelectionView.Draw(overlayHeight); } if (drawApp) { float overlayHeight = DrawpAppOverlay(); ImGui.SetNextWindowPos(new Vector2(ImGui.GetWindowPos().X, overlayHeight + 10 * PlatformFunctions.ScreenDensity()), ImGuiCond.Once); DrawApp(); } }