internal static void Display(int windowId) { Title = SmUtils.SmTags["#smloc_settings_001"]; // set input locks when mouseover window... //_inputLocked = GuiUtils.PreventClickthrough(ShowWindow, Position, _inputLocked); // Reset Tooltip active flag... ToolTipActive = false; Rect rect = new Rect(Position.width - 20, 4, 16, 16); // "Close Window.\r\nSettings will not be immediately saved,\r\n but will be remembered while in game."))) if (GUI.Button(rect, new GUIContent("", SmUtils.SmTags["#smloc_settings_tt_001"]))) { ToolTip = ""; if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { SMAddon.OnSmSettingsClicked(); } else { SMSettings.MemStoreTempSettings(); ShowWindow = false; } } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.BeginVertical(); DisplayTabButtons(); _displayViewerPosition = GUILayout.BeginScrollView(_displayViewerPosition, SMStyle.ScrollStyle, GUILayout.Height(300), GUILayout.Width(380)); GUILayout.BeginVertical(); DisplaySelectedTab(_displayViewerPosition); GUILayout.EndVertical(); GUILayout.EndScrollView(); DisplayActionButtons(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); }
private static void DisplayActionButtons() { GUILayout.BeginHorizontal(); // Save //GUIContent label = new GUIContent("Save", "Save the current settings to file."); GUIContent label = new GUIContent(SmUtils.Localize("#smloc_settings_002"), SmUtils.Localize("#smloc_settings_tt_002")); if (GUILayout.Button(label, GUILayout.Height(20))) { ToolTip = ""; SMSettings.SaveIntervalSec = int.Parse(TabConfig.TxtSaveInterval); SMSettings.SaveSettings(); // Sync SM to CLS override settings with CLS if (SMSettings.EnableCls && HighLogic.LoadedSceneIsFlight) { SMSettings.UpdateClsOverride(); } if (HighLogic.LoadedScene == GameScenes.SPACECENTER) SMAddon.OnSmSettingsClicked(); else ShowWindow = false; } Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); // Cancel //label = new GUIContent("Cancel", "Cancel the changes made.\nSettings will revert to before changes were made."); label = new GUIContent(SmUtils.Localize("#smloc_settings_003"), SmUtils.Localize("#smloc_settings_tt_003")); if (GUILayout.Button(label, GUILayout.Height(20))) { ToolTip = ""; // We've canclled, so restore original settings. SMSettings.MemRestoreTempSettings(); if (HighLogic.LoadedScene == GameScenes.SPACECENTER) SMAddon.OnSmSettingsClicked(); else ShowWindow = false; } rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); GUILayout.EndHorizontal(); }
private static void WindowToggleButtons() { GUILayout.BeginHorizontal(); GUIStyle settingsStyle = WindowSettings.ShowWindow ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_012"), settingsStyle, GUILayout.Height(20))) // "Settings" { try { WindowSettings.ShowWindow = !WindowSettings.ShowWindow; if (WindowSettings.ShowWindow) { // Store settings in case we cancel later... SMSettings.MemStoreTempSettings(); } } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Settings Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } GUIStyle rosterStyle = WindowRoster.ShowWindow ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_013"), rosterStyle, GUILayout.Height(20))) // "Roster" { try { WindowRoster.ShowWindow = !WindowRoster.ShowWindow; if (WindowRoster.ShowWindow) { WindowRoster.GetRosterList(); } else { WindowRoster.SelectedKerbal = null; WindowRoster.ToolTip = ""; } } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Roster Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } GUIStyle controlStyle = WindowControl.ShowWindow ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle; if (GUILayout.Button(SMUtils.Localize("#smloc_manifest_014"), controlStyle, GUILayout.Height(20))) // "Control" { try { WindowControl.ShowWindow = !WindowControl.ShowWindow; } catch (Exception ex) { SMUtils.LogMessage( string.Format(" opening Control Window. Error: {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), SMUtils.LogType.Error, true); } } GUILayout.EndHorizontal(); }
private static void DisplayRealismButtons() { // RealismMode options GUIContent[] options = { new GUIContent(SmUtils.SmTags["#smloc_settings_realism_004"], SmUtils.SmTags["#smloc_settings_realism_tt_003"]), new GUIContent(SmUtils.SmTags["#smloc_settings_realism_005"], SmUtils.SmTags["#smloc_settings_realism_tt_004"]), new GUIContent(SmUtils.SmTags["#smloc_settings_realism_006"], SmUtils.SmTags["#smloc_settings_realism_tt_005"]), new GUIContent(SmUtils.SmTags["#smloc_settings_realism_007"], SmUtils.SmTags["#smloc_settings_realism_tt_006"]) }; GUIStyle[] styles = { SMSettings.RealismMode == 0 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, SMSettings.RealismMode == 1 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, SMSettings.RealismMode == 2 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, SMSettings.RealismMode == 3 ? SMStyle.ButtonToggledStyle : SMStyle.ButtonStyle, }; // "Realism Mode Label" _label = $"{SmUtils.SmTags["#smloc_settings_realism_003"]}:"; _toolTip = SmUtils.SmTags["#smloc_settings_realism_tt_002"]; _guiLabel = new GUIContent(_label, _toolTip); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.Label(_guiLabel, SMStyle.LabelStyleNoWrap, GUILayout.Width(90)); _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && _canShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } // Build Option Buttons SMSettings.RealismMode = SMSettings.GetRealismMode(); for (int x = 0; x <= 3; x++) { if (x == 3) { GUI.enabled = false; } if (GUILayout.Button(options[x], styles[x], GUILayout.Height(20))) { if (x != SMSettings.RealismMode) { SMSettings.SetRealismMode(x); } } _rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(_rect, GUI.tooltip, ref ToolTipActive, 10); } GUI.enabled = true; } GUILayout.EndHorizontal(); }
internal static void Display(int windowId) { Title = $"{SmUtils.SmTags["#smloc_debug_000"]}: {SMSettings.CurVersion}"; // set input locks when mouseover window... //_inputLocked = GuiUtils.PreventClickthrough(ShowWindow, Position, _inputLocked); // Reset Tooltip active flag... ToolTipActive = false; Rect rect = new Rect(Position.width - 20, 4, 16, 16); if (GUI.Button(rect, new GUIContent("", SmUtils.SmTags["#smloc_window_tt_001"]))) // "Close Window" { ShowWindow = false; SMSettings.MemStoreTempSettings(); ToolTip = ""; } if (Event.current.type == EventType.Repaint && ShowToolTips) { ToolTip = SMToolTips.SetActiveToolTip(rect, GUI.tooltip, ref ToolTipActive, 10); } GUILayout.BeginVertical(); SmUtils.DebugScrollPosition = GUILayout.BeginScrollView(SmUtils.DebugScrollPosition, SMStyle.ScrollStyle, GUILayout.Height(300), GUILayout.Width(500)); GUILayout.BeginVertical(); List <string> .Enumerator errors = SmUtils.LogItemList.GetEnumerator(); while (errors.MoveNext()) { if (errors.Current == null) { continue; } GUILayout.TextArea(errors.Current, GUILayout.Width(460)); } errors.Dispose(); GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); if (GUILayout.Button(SmUtils.SmTags["#smloc_debug_001"], GUILayout.Height(20))) //"Clear log" { SmUtils.LogItemList.Clear(); SmUtils.LogItemList.Add($"Info: Log Cleared at {DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)} UTC."); } if (GUILayout.Button(SmUtils.SmTags["#smloc_debug_002"], GUILayout.Height(20))) // "Save Log" { // Create log file and save. Savelog(); } if (GUILayout.Button(SmUtils.SmTags["#smloc_debug_003"], GUILayout.Height(20))) // "Close" { // Create log file and save. ShowWindow = false; SMSettings.MemStoreTempSettings(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(new Rect(0, 0, Screen.width, 30)); SMAddon.RepositionWindow(ref Position); }
public override void OnCreate() { //Initialize the Selligent Mobile SDK like this var url = "https://mobile.slgnt.eu/MobilePush/api/"; var clientId = ""; var key = ""; SMSettings settings = new SMSettings(); settings.WebServiceUrl = url; settings.ClientId = clientId; settings.PrivateKey = key; //If you want to allow in app messages management, set this value settings.InAppMessageRefreshType = SMInAppRefreshType.Minutely; //If you want to allow in app contents management, set this value settings.InAppContentRefreshType = SMInAppRefreshType.Minutely; //If you want to specify a specific lifespan for the items in the cache. settings.ClearCacheIntervalValue = SMClearCache.Month; //If you want to disable the automatic display of remote messages settings.RemoteMessageDisplayType = SMRemoteMessageDisplayType.Notification; //If you want the SDK to manage geofencing, set the following setting to true. //If you do not, the enable/disable geolocation methods will not do anything settings.ConfigureGeolocation = true; //Set it to true to be able to see the logs created by the Selligent Mobile SDK SMManager.Debug = true; //Do this to specify which activity will be called when clicking on a notification created after receiving a push when the app is in background SMManager.NotificationActivity = new MainActivity().Class; //Do this to specify which activity is teh main one of the app. This allows the SDK to show potentially show a dialog only on that activity (mainly for old OS versions when the user needs to update Google services or some security protocol) SMManager.MainActivity = new MainActivity().Class; SMManager.Instance.Start(settings, this); SMManager.Instance.SetNotificationLargeIcon(Resource.Drawable.large_logo); SMManager.Instance.NotificationSmallIcon = Resource.Drawable.ic_selligent_logo; //If you extend SMApplication, you have to use the following version: //SMManager.getInstance().start(settings); //You can specify your own icon for the notifications this way //SMManager.getInstance().setNotificationSmallIcon(R.drawable.your_notif_icon); //!!!!!The following methods are placed here as examples, they should not be called right after a start or, as a matter of fact, in an Application class!!!!! //If you want to disable the notifications, call this method //SMManager.getInstance().disableNotifications(); //If you want to re-enable the notifications after disabling them, call this method. //Typically, this will be used if you want to give the user the ability to enable/disable the notifications //Notifications are enabled by default so you should not call this method unless a disabled was previously done. SMManager.Instance.EnableNotifications(); //If you want to disable the in app messages, call this method //SMManager.getInstance().disableInAppMessages(); //If you want to re-enable the in-app messages after disabling them, or change the refresh type, call this method //Typically, this will be used if you want to give the user the ability to enable/disable the in-app messages or change the way they are retrieved //In-app messages are enabled by setting a value to InAppMessageRefreshType on the SMSettings object. //SMManager.getInstance().enableInAppMessages(SMInAppRefreshType.Daily); //If you want to know if the automatic display of remote messages is enabled //SMRemoteMessageDisplayType displayType = SMManager.getInstance().getRemoteMessagesDisplayType(); base.OnCreate(); }