public void LoginLaunchBrowser() { try { LoginDialog login = new LoginDialog(); login.succ = delegate(byte[] a) { StreamReader streamReader = new StreamReader(new MemoryStream(a)); JsonObject json = (JsonObject)SimpleJson.SimpleJson.DeserializeObject(streamReader.ReadToEnd()); int code = int.Parse(json["code"].ToString()); string msg = json["msg"].ToString(); if (code == 200) { JsonObject token = (JsonObject)json["data"]; SettingsManager.ScpboxAccessToken = token["accessToken"].ToString(); DialogsManager.HideAllDialogs(); } else { login.tip.Text = msg; } }; login.fail = delegate(Exception e) { login.tip.Text = e.ToString(); }; DialogsManager.ShowDialog(null, login); } catch (Exception error) { m_loginProcessData.Fail(this, error); } }
public override bool OnEditInventoryItem(IInventory inventory, int slotIndex, ComponentPlayer componentPlayer) { int value1 = inventory.GetSlotValue(slotIndex); int count = inventory.GetSlotCount(slotIndex); int id = Terrain.ExtractData(value1); var commandBlockData = GetItemData(id); if (commandBlockData != null) { commandBlockData = (CommandData)commandBlockData.Copy(); } else { commandBlockData = new CommandData(); } DialogsManager.ShowDialog(componentPlayer.View.GameWidget, new TextBoxDialog("enter a one-line command", commandBlockData.Command, 300, delegate(string result) { commandBlockData.Command = result; var data = StoreItemDataAtUniqueId(commandBlockData); var value = Terrain.ReplaceData(value1, data); inventory.RemoveSlotItems(slotIndex, count); inventory.AddSlotItems(slotIndex, value, 1); })); return(true); }
public void Update(float dt) { if (IsSleeping && m_componentPlayer.ComponentHealth.Health > 0f) { m_sleepFactor = MathUtils.Min(m_sleepFactor + 0.33f * Time.FrameDuration, 1f); m_minWetness = MathUtils.Min(m_minWetness, m_componentPlayer.ComponentVitalStats.Wetness); m_componentPlayer.PlayerStats.TimeSlept += m_subsystemGameInfo.TotalElapsedGameTimeDelta; if ((m_componentPlayer.ComponentVitalStats.Sleep >= 1f || m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative) && m_subsystemTimeOfDay.TimeOfDay > 0.3f && m_subsystemTimeOfDay.TimeOfDay < 0.599999964f && m_sleepStartTime.HasValue && m_subsystemGameInfo.TotalElapsedGameTime > m_sleepStartTime + 180.0) { WakeUp(); } if (m_componentPlayer.ComponentHealth.HealthChange < 0f && (m_componentPlayer.ComponentHealth.Health < 0.5f || m_componentPlayer.ComponentVitalStats.Sleep > 0.5f)) { WakeUp(); } if (m_componentPlayer.ComponentVitalStats.Wetness > m_minWetness + 0.05f && m_componentPlayer.ComponentVitalStats.Sleep > 0.2f) { WakeUp(); m_subsystemTime.QueueGameTimeDelayedExecution(m_subsystemTime.GameTime + 1.0, delegate { m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 6), Color.White, blinking: true, playNotificationSound: true); }); } if (m_sleepStartTime.HasValue) { float num = (float)(m_subsystemGameInfo.TotalElapsedGameTime - m_sleepStartTime.Value); if (m_allowManualWakeUp && num > 10f) { if (m_componentPlayer.GameWidget.Input.Any && !DialogsManager.HasDialogs(m_componentPlayer.GameWidget)) { m_componentPlayer.GameWidget.Input.Clear(); WakeUp(); m_subsystemTime.QueueGameTimeDelayedExecution(m_subsystemTime.GameTime + 2.0, delegate { m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 7), Color.White, blinking: true, playNotificationSound: false); }); } m_messageFactor = MathUtils.Min(m_messageFactor + 0.5f * Time.FrameDuration, 1f); m_componentPlayer.ComponentScreenOverlays.Message = LanguageControl.Get(fName, 8); m_componentPlayer.ComponentScreenOverlays.MessageFactor = m_messageFactor; } if (!m_allowManualWakeUp && num > 5f) { m_messageFactor = MathUtils.Min(m_messageFactor + 1f * Time.FrameDuration, 1f); m_componentPlayer.ComponentScreenOverlays.Message = LanguageControl.Get(fName, 9); m_componentPlayer.ComponentScreenOverlays.MessageFactor = m_messageFactor; } } } else { m_sleepFactor = MathUtils.Max(m_sleepFactor - 1f * Time.FrameDuration, 0f); } m_componentPlayer.ComponentScreenOverlays.BlackoutFactor = MathUtils.Max(m_componentPlayer.ComponentScreenOverlays.BlackoutFactor, m_sleepFactor); if (m_sleepFactor > 0.01f) { m_componentPlayer.ComponentScreenOverlays.FloatingMessage = LanguageControl.Get(fName, 10); m_componentPlayer.ComponentScreenOverlays.FloatingMessageFactor = MathUtils.Saturate(10f * (m_sleepFactor - 0.9f)); } }
public override void Enter(object[] parameters) { BusyDialog dialog = new BusyDialog("Scanning Worlds", (string)null); DialogsManager.ShowDialog((Dialog)dialog); Task.Run((Action)(() => { WorldInfo selectedItem = (WorldInfo)this.m_worldsListWidget.SelectedItem; WorldsManager.UpdateWorldsList(); List <WorldInfo> worldInfos = new List <WorldInfo>((IEnumerable <WorldInfo>)(object) WorldsManager.WorldInfos); worldInfos.Sort((Comparison <WorldInfo>)((w1, w2) => DateTime.Compare(w2.LastSaveTime, w1.LastSaveTime))); Dispatcher.Dispatch((Action)(() => { this.m_worldsListWidget.ClearItems(); foreach (object obj in worldInfos) { this.m_worldsListWidget.AddItem(obj); } if (selectedItem != null) { this.m_worldsListWidget.SelectedItem = (object)worldInfos.FirstOrDefault <WorldInfo>((Func <WorldInfo, bool>)(wi => wi.DirectoryName == selectedItem.DirectoryName)); } DialogsManager.HideDialog((Dialog)dialog); }), false); })); }
public override void Enter(object[] parameters) { BusyDialog dialog = new BusyDialog(LanguageControl.GetContentWidgets(fName, 5), null); DialogsManager.ShowDialog(null, dialog); Task.Run(delegate { WorldInfo selectedItem = (WorldInfo)m_worldsListWidget.SelectedItem; WorldsManager.UpdateWorldsList(); List <WorldInfo> worldInfos = new List <WorldInfo>(WorldsManager.WorldInfos); worldInfos.Sort((WorldInfo w1, WorldInfo w2) => DateTime.Compare(w2.LastSaveTime, w1.LastSaveTime)); Dispatcher.Dispatch(delegate { m_worldsListWidget.ClearItems(); foreach (WorldInfo item in worldInfos) { m_worldsListWidget.AddItem(item); } if (selectedItem != null) { m_worldsListWidget.SelectedItem = worldInfos.FirstOrDefault((WorldInfo wi) => wi.DirectoryName == selectedItem.DirectoryName); } DialogsManager.HideDialog(dialog); }); }); }
public override void Update() { if (m_windowModeButton.IsClicked) { SettingsManager.WindowMode = (WindowMode)((int)(SettingsManager.WindowMode + 1) % EnumUtils.GetEnumValues(typeof(WindowMode)).Count); } if (m_languageButton.IsClicked) { DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 1), LanguageControl.Get(fName, 2), LanguageControl.Get("Usual", "yes"), LanguageControl.Get("Usual", "no"), delegate(MessageDialogButton button) { if (button == MessageDialogButton.Button1) { ModsManager.modSettings.languageType = (LanguageControl.LanguageType)((int)(ModsManager.modSettings.languageType + 1) % EnumUtils.GetEnumValues(typeof(LanguageControl.LanguageType)).Count); ModsManager.SaveSettings(); System.Environment.Exit(0); } })); } if (m_uiSizeButton.IsClicked) { SettingsManager.GuiSize = (GuiSize)((int)(SettingsManager.GuiSize + 1) % EnumUtils.GetEnumValues(typeof(GuiSize)).Count); } if (m_upsideDownButton.IsClicked) { SettingsManager.UpsideDownLayout = !SettingsManager.UpsideDownLayout; } if (m_hideMoveLookPadsButton.IsClicked) { SettingsManager.HideMoveLookPads = !SettingsManager.HideMoveLookPads; } if (m_showGuiInScreenshotsButton.IsClicked) { SettingsManager.ShowGuiInScreenshots = !SettingsManager.ShowGuiInScreenshots; } if (m_showLogoInScreenshotsButton.IsClicked) { SettingsManager.ShowLogoInScreenshots = !SettingsManager.ShowLogoInScreenshots; } if (m_screenshotSizeButton.IsClicked) { SettingsManager.ScreenshotSize = (ScreenshotSize)((int)(SettingsManager.ScreenshotSize + 1) % EnumUtils.GetEnumValues(typeof(ScreenshotSize)).Count); } if (m_communityContentModeButton.IsClicked) { SettingsManager.CommunityContentMode = (CommunityContentMode)((int)(SettingsManager.CommunityContentMode + 1) % EnumUtils.GetEnumValues(typeof(CommunityContentMode)).Count); } m_windowModeButton.Text = LanguageControl.Get("WindowMode", SettingsManager.WindowMode.ToString()); m_uiSizeButton.Text = LanguageControl.Get("GuiSize", SettingsManager.GuiSize.ToString()); m_languageButton.Text = LanguageControl.LName(); m_upsideDownButton.Text = (SettingsManager.UpsideDownLayout ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_hideMoveLookPadsButton.Text = (SettingsManager.HideMoveLookPads ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_showGuiInScreenshotsButton.Text = (SettingsManager.ShowGuiInScreenshots ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_showLogoInScreenshotsButton.Text = (SettingsManager.ShowLogoInScreenshots ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_screenshotSizeButton.Text = LanguageControl.Get("ScreenshotSize", SettingsManager.ScreenshotSize.ToString()); m_communityContentModeButton.Text = LanguageControl.Get("CommunityContentMode", SettingsManager.CommunityContentMode.ToString()); if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked) { ScreensManager.SwitchScreen(ScreensManager.PreviousScreen); } }
public override void Update() { if (m_singlethreadedTerrainUpdateButton.IsClicked) { SettingsManager.MultithreadedTerrainUpdate = !SettingsManager.MultithreadedTerrainUpdate; m_descriptionLabel.Text = StringsManager.GetString("Settings.Compatibility.SinglethreadedTerrainUpdate.Description"); } if (m_useReducedZRangeButton.IsClicked) { SettingsManager.UseReducedZRange = !SettingsManager.UseReducedZRange; m_descriptionLabel.Text = StringsManager.GetString("Settings.Compatibility.UseReducedZRange.Description"); } if (m_viewGameLogButton.IsClicked) { DialogsManager.ShowDialog(null, new ViewGameLogDialog()); } if (m_resetDefaultsButton.IsClicked) { SettingsManager.MultithreadedTerrainUpdate = true; SettingsManager.UseReducedZRange = false; } if (m_useAudioTrackCachingButton.IsClicked) { SettingsManager.EnableAndroidAudioTrackCaching = !SettingsManager.EnableAndroidAudioTrackCaching; } m_singlethreadedTerrainUpdateButton.Text = (SettingsManager.MultithreadedTerrainUpdate ? LanguageControl.Get("Usual", "off") : LanguageControl.Get("Usual", "on")); m_useReducedZRangeButton.Text = (SettingsManager.UseReducedZRange ? LanguageControl.Get("Usual", "on") : LanguageControl.Get("Usual", "off")); m_useAudioTrackCachingButton.Text = (SettingsManager.EnableAndroidAudioTrackCaching? LanguageControl.Get("Usual", "on") : LanguageControl.Get("Usual", "off")); m_resetDefaultsButton.IsEnabled = (!SettingsManager.MultithreadedTerrainUpdate || SettingsManager.UseReducedZRange); if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked) { ScreensManager.SwitchScreen(ScreensManager.PreviousScreen); } }
public override void Update() { if (base.Input.Cancel || m_okButtonWidget.IsClicked) { DialogsManager.HideDialog(this); } }
public override void Update() { if (animals.IsChecked) { DialogsManager.ShowDialog(ParentWidget, new ListSelectionDialog("select a animal name to copy", SearchForKeyWord(textBoxAnimal.Text, commandEngine.creatureTemplateNames.Keys), 64f, arg => arg.ToString(), obj => { string result = obj.ToString(); ClipboardManager.ClipboardString = result; })); } if (blocks.IsChecked) { DialogsManager.ShowDialog(ParentWidget, new ListSelectionDialog("select a block to copy id", SearchForKeyWord(textBoxBlock.Text, commandEngine.blockIds.Keys), 64f, arg => arg.ToString(), obj => { int result = commandEngine.blockIds[obj.ToString()]; ClipboardManager.ClipboardString = result.ToString(); })); } if (Input.Cancel || back.IsClicked) { DialogsManager.HideDialog(this); } }
public void UpdateList() { m_directoryList.ClearItems(); if (m_externalContentProvider != null && m_externalContentProvider.IsLoggedIn) { CancellableBusyDialog busyDialog = new CancellableBusyDialog(LanguageControl.Get(fName, 9), autoHideOnCancel: false); DialogsManager.ShowDialog(null, busyDialog); m_externalContentProvider.List(m_path, busyDialog.Progress, delegate(ExternalContentEntry entry) { DialogsManager.HideDialog(busyDialog); List <ExternalContentEntry> list = new List <ExternalContentEntry>(entry.ChildEntries.Where((ExternalContentEntry e) => EntryFilter(e)).Take(1000)); m_directoryList.ClearItems(); list.Sort(delegate(ExternalContentEntry e1, ExternalContentEntry e2) { if (e1.Type == ExternalContentType.Directory && e2.Type != ExternalContentType.Directory) { return(-1); } return((e1.Type != ExternalContentType.Directory && e2.Type == ExternalContentType.Directory) ? 1 : string.Compare(e1.Path, e2.Path)); }); foreach (ExternalContentEntry item in list) { m_directoryList.AddItem(item); } }, delegate(Exception error) { DialogsManager.HideDialog(busyDialog); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null)); }); } }
public override void Update() { m_rateButton.IsEnabled = (m_starRating.Rating != 0f); if (m_rateButton.IsClicked) { DialogsManager.HideDialog(this); CancellableBusyDialog busyDialog = new CancellableBusyDialog("иб╦═к└иоол...", autoHideOnCancel: false); DialogsManager.ShowDialog(base.ParentWidget, busyDialog); CommunityContentManager.Rate(m_address, m_userId, (int)m_starRating.Rating, busyDialog.Progress, delegate { DialogsManager.HideDialog(busyDialog); }, delegate { DialogsManager.HideDialog(busyDialog); }); } if (m_reportLink.IsClicked && UserManager.ActiveUser != null) { DialogsManager.HideDialog(this); DialogsManager.ShowDialog(base.ParentWidget, new ReportCommunityContentDialog(m_address, m_displayName, UserManager.ActiveUser.UniqueId)); } if (base.Input.Cancel || m_cancelButton.IsClicked) { DialogsManager.HideDialog(this); } }
public void HideSpawnDialog() { if (m_spawnDialog != null) { DialogsManager.HideDialog(m_spawnDialog); m_spawnDialog = null; } }
public void Dismiss(string result) { if (AutoHide) { DialogsManager.HideDialog(this); } m_handler?.Invoke(result); }
public void Dismiss(int?result) { DialogsManager.HideDialog(this); if (m_handler != null && result.HasValue) { m_handler(result.Value); } }
public void Dismiss(bool result) { DialogsManager.HideDialog(this); if (m_handler != null && result) { m_handler(); } }
public void PopulateList(string cursor) { string text = string.Empty; if (SettingsManager.CommunityContentMode == CommunityContentMode.Strict) { text = "1"; } if (SettingsManager.CommunityContentMode == CommunityContentMode.Normal) { text = "0"; } string text2 = (m_filter is string) ? ((string)m_filter) : string.Empty; string text3 = (m_filter is ExternalContentType) ? LanguageControl.Get(fName, m_filter.ToString()) : string.Empty; string text4 = LanguageControl.Get(fName, m_order.ToString()); string cacheKey = text2 + "\n" + text3 + "\n" + text4 + "\n" + text; m_moreLink = null; if (string.IsNullOrEmpty(cursor)) { m_listPanel.ClearItems(); m_listPanel.ScrollPosition = 0f; if (m_contentExpiryTime != 0.0 && Time.RealTime < m_contentExpiryTime && m_itemsCache.TryGetValue(cacheKey, out IEnumerable <object> value)) { foreach (object item in value) { m_listPanel.AddItem(item); } return; } } CancellableBusyDialog busyDialog = new CancellableBusyDialog(LanguageControl.Get(fName, 2), autoHideOnCancel: false); DialogsManager.ShowDialog(null, busyDialog); CommunityContentManager.List(cursor, text2, text3, text, text4, busyDialog.Progress, delegate(List <CommunityContentEntry> list, string nextCursor) { DialogsManager.HideDialog(busyDialog); m_contentExpiryTime = Time.RealTime + 300.0; while (m_listPanel.Items.Count > 0 && !(m_listPanel.Items[m_listPanel.Items.Count - 1] is CommunityContentEntry)) { m_listPanel.RemoveItemAt(m_listPanel.Items.Count - 1); } foreach (CommunityContentEntry item2 in list) { m_listPanel.AddItem(item2); } if (list.Count > 0 && !string.IsNullOrEmpty(nextCursor)) { m_listPanel.AddItem(nextCursor); } m_itemsCache[cacheKey] = new List <object>(m_listPanel.Items); }, delegate(Exception error) { DialogsManager.HideDialog(busyDialog); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null)); }); }
public static void Run() { VrManager.WaitGetPoses(); double realTime = Time.RealTime; LastFrameTime = (float)(realTime - m_frameBeginTime); LastCpuFrameTime = (float)(m_cpuEndTime - m_frameBeginTime); m_frameBeginTime = realTime; Window.PresentationInterval = ((!VrManager.IsVrStarted) ? SettingsManager.PresentationInterval : 0); try { if (ExceptionManager.Error == null) { while (m_urisToHandle.Count > 0) { Uri obj = m_urisToHandle[0]; m_urisToHandle.RemoveAt(0); Program.HandleUri?.Invoke(obj); } PerformanceManager.Update(); MotdManager.Update(); MusicManager.Update(); ScreensManager.Update(); DialogsManager.Update(); } else { ExceptionManager.UpdateExceptionScreen(); } } catch (Exception e) { ExceptionManager.ReportExceptionToUser(null, e); ScreensManager.SwitchScreen("MainMenu"); } try { Display.RenderTarget = null; if (ExceptionManager.Error == null) { ScreensManager.Draw(); PerformanceManager.Draw(); ScreenCaptureManager.Run(); } else { ExceptionManager.DrawExceptionScreen(); } m_cpuEndTime = Time.RealTime; } catch (Exception e2) { ExceptionManager.ReportExceptionToUser(null, e2); ScreensManager.SwitchScreen("MainMenu"); } }
public bool OnInteract(TerrainRaycastResult raycastResult, ComponentMiner componentMiner) { ComponentPlayer = componentMiner.ComponentPlayer; if (!Powered || ComponentPlayer == null) { return(false); } DialogsManager.ShowDialog(ComponentPlayer.View.GameWidget, new TextBoxDialog("Enter Code", lastcode, int.MaxValue, Execute)); return(true); }
public void Dismiss(MessageDialogButton button) { if (AutoHide) { DialogsManager.HideDialog(this); } if (m_handler != null) { m_handler(button); } }
public override void Update() { for (int j = 0; j < 16; j++) { m_labels[j].Text = m_tmpPalette.Names[j]; m_rectangles[j].CenterColor = m_tmpPalette.Colors[j]; m_resetButtons[j].IsEnabled = (m_tmpPalette.Colors[j] != WorldPalette.DefaultColors[j] || m_tmpPalette.Names[j] != LanguageControl.Get("WorldPalette", j)); } for (int k = 0; k < 16; k++) { int i = k; if (m_labels[k].IsClicked) { DialogsManager.ShowDialog(this, new TextBoxDialog("Edit Color Name", m_labels[k].Text, 16, delegate(string s) { if (s != null) { if (WorldPalette.VerifyColorName(s)) { m_tmpPalette.Names[i] = s; } else { DialogsManager.ShowDialog(this, new MessageDialog("Invalid name", null, "OK", null, null)); } } })); } if (m_rectangles[k].IsClicked) { DialogsManager.ShowDialog(this, new EditColorDialog(m_tmpPalette.Colors[k], delegate(Color? color) { if (color.HasValue) { m_tmpPalette.Colors[i] = color.Value; } })); } if (m_resetButtons[k].IsClicked) { m_tmpPalette.Colors[k] = WorldPalette.DefaultColors[k]; m_tmpPalette.Names[k] = LanguageControl.Get("WorldPalette", k); } } if (m_okButton.IsClicked) { m_tmpPalette.CopyTo(m_palette); Dismiss(); } if (base.Input.Cancel || m_cancelButton.IsClicked) { Dismiss(); } }
public override void Update() { if (!m_loadingStarted) { m_loadingStarted = true; } else { if (m_loadingFinished) { return; } double realTime = Time.RealTime; while (!m_pauseLoading && m_index < m_loadActions.Count) { try { m_loadActions[m_index++](); } catch (Exception ex) { Log.Error("Loading error. Reason: " + ex.Message); if (!m_loadingErrorsSuppressed) { m_pauseLoading = true; DialogsManager.ShowDialog(ScreensManager.RootWidget, new MessageDialog("Loading Error", ExceptionManager.MakeFullErrorMessage(ex), LanguageControl.Get("Usual", "ok"), "Suppress", delegate(MessageDialogButton b) { switch (b) { case MessageDialogButton.Button1: m_pauseLoading = false; break; case MessageDialogButton.Button2: m_loadingErrorsSuppressed = true; break; } })); } } if (Time.RealTime - realTime > 0.1) { break; } } if (m_index >= m_loadActions.Count) { m_loadingFinished = true; AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f); ScreensManager.SwitchScreen("MainMenu"); } } }
public override void Update() { try { m_stateMachine.Update(); } catch (Exception e) { ScreensManager.SwitchScreen(ScreensManager.PreviousScreen); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 1), ExceptionManager.MakeFullErrorMessage(e), LanguageControl.Get("Usual", "ok"), null, null)); } }
public void Dismiss(object result) { if (!m_isDismissed) { m_isDismissed = true; DialogsManager.HideDialog(this); if (m_selectionHandler != null && result != null) { m_selectionHandler(result); } } }
public override void Update() { if (okButton.IsClicked) { commandData.Command = textBox.Text; DialogsManager.HideDialog(this); } else if (cancelButton.IsClicked || Input.Cancel) { DialogsManager.HideDialog(this); } }
public void WindowActivated() { if (m_loginProcessData != null && !m_loginProcessData.IsTokenFlow) { LoginProcessData loginProcessData = m_loginProcessData; m_loginProcessData = null; TextBoxDialog dialog = new TextBoxDialog("输入用户登录Token:", "", 256, delegate(string s) { if (s != null) { try { WebManager.Post(m_redirectUri + "/com/oauth2/token", new Dictionary <string, string> { { "code", s.Trim() }, { "client_id", "1unnzwkb8igx70k" }, { "client_secret", "3i5u3j3141php7u" }, { "grant_type", "authorization_code" } }, null, new MemoryStream(), loginProcessData.Progress, delegate(byte[] result) { SettingsManager.ScpboxAccessToken = ((IDictionary <string, object>)WebManager.JsonFromBytes(result))["access_token"].ToString(); loginProcessData.Succeed(this); }, delegate(Exception error) { loginProcessData.Fail(this, error); }); } catch (Exception error2) { loginProcessData.Fail(this, error2); } } else { loginProcessData.Fail(this, null); } }); DialogsManager.ShowDialog(null, dialog); } }
public void ExportFurnitureSet() { try { FurnitureDesign[] designs = SubsystemFurnitureBlockBehavior.GetFurnitureSetDesigns(ComponentFurnitureInventory.FurnitureSet).ToArray(); string displayName = FurniturePacksManager.GetDisplayName(FurniturePacksManager.CreateFurniturePack(ComponentFurnitureInventory.FurnitureSet.Name, designs)); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 21), string.Format(LanguageControl.Get(fName, 22), displayName), LanguageControl.Get("Usual", "ok"), null, null)); } catch (Exception ex) { DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 23), ex.Message, LanguageControl.Get("Usual", "ok"), null, null)); } }
public bool VerifyName() { if (m_nameWasInvalid) { return(false); } if (PlayerData.VerifyName(m_nameTextBox.Text.Trim())) { return(true); } DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), LanguageControl.Get(fName, 12), LanguageControl.Get("Usual", "ok"), null, null)); return(false); }
public override void Update() { m_helpButton.IsVisible = !(ScreensManager.CurrentScreen is HelpScreen); if (m_okButton.IsClicked || base.Input.Cancel || base.Input.IsPadButtonDownOnce(GamePadButton.Start)) { DialogsManager.HideDialog(this); } if (m_helpButton.IsClicked) { DialogsManager.HideDialog(this); ScreensManager.SwitchScreen("Help"); } }
public static void SaveProject(bool waitForCompletion, bool showErrorDialog) { if (m_project != null) { double realTime = Time.RealTime; ProjectData projectData = m_project.Save(); m_saveCompleted.WaitOne(); m_saveCompleted.Reset(); SubsystemGameInfo subsystemGameInfo = m_project.FindSubsystem <SubsystemGameInfo>(throwOnError: true); string projectFileName = Storage.CombinePaths(subsystemGameInfo.DirectoryName, "Project.xml"); Exception e = default(Exception); Task.Run(delegate { try { WorldsManager.MakeQuickWorldBackup(subsystemGameInfo.DirectoryName); XElement xElement = new XElement("Project"); projectData.Save(xElement); XmlUtils.SetAttributeValue(xElement, "Version", VersionsManager.SerializationVersion); Storage.CreateDirectory(subsystemGameInfo.DirectoryName); using (Stream stream = Storage.OpenFile(projectFileName, OpenFileMode.Create)) { XmlUtils.SaveXmlToStream(xElement, stream, null, throwOnError: true); } } catch (Exception ex) { e = ex; if (showErrorDialog) { Dispatcher.Dispatch(delegate { DialogsManager.ShowDialog(null, new MessageDialog("Error saving game", e.Message, LanguageControl.Get("Usual", "ok"), null, null)); }); } } finally { m_saveCompleted.Set(); } }); if (waitForCompletion) { m_saveCompleted.WaitOne(); } double realTime2 = Time.RealTime; Log.Verbose($"Saved project, {MathUtils.Round((realTime2 - realTime) * 1000.0)}ms"); } }
public void ShowTopic(HelpTopic helpTopic) { if (helpTopic.Name == "Keyboard") { DialogsManager.ShowDialog(null, new KeyboardHelpDialog()); } else if (helpTopic.Name == "Gamepad") { DialogsManager.ShowDialog(null, new GamepadHelpDialog()); } else { ScreensManager.SwitchScreen("HelpTopic", helpTopic); } }