/// <summary> /// Syncs the currently editing floor to the database. /// </summary> public void SaveFloor() { if (!root.activeInHierarchy) { DialogManager.ShowAlert("Open a library first!", "Unable to Save", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); return; } DialogComplexProgress d = (DialogComplexProgress)DialogManager.CreateComplexProgressLinear(); d.Initialize("Uploading changes to database...", "Saving", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); d.InitializeCancelButton("CANCEL", ServiceController.shared.CancelUpdateFloor); d.Show(); ServiceController.shared.UpdateFloor(floorController.floor, (suc1, suc2) => { d.Hide(); if (!suc1) { DialogManager.ShowAlert("Unable to communicate with server!", "Connection Error", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else if (!suc2) { DialogManager.ShowAlert("Login has expired! Please copy the text from File > Export Floor, relogin, open this floor again, File > Import Floor, and try again.", "Login Expired", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else { DialogManager.ShowAlert("Floor has been updated.", "Success", MaterialIconHelper.GetIcon(MaterialIconEnum.CHECK)); } }); }
public void SaveButtonClick() { ClickSource.PlayOneShot(clickSound); if (!IsResultSaved) { DialogManager.ShowAlert( "Сохранить результат в таблицу результатов?", () => { ClickSource.PlayOneShot(clickSound); if (SQLiteHelper.InsertResult()) { IsResultSaved = true; ToastManager.Show("Результат сохранен в таблицу результатов!"); } else { ToastManager.Show("Результат не удалось сохранить в таблицу!"); } }, "ДА", "Сохранить?", MaterialIconHelper.GetIcon(MaterialIconEnum.QUESTION_ANSWER), () => { ClickSource.PlayOneShot(clickSound); }, "НЕТ"); } else { ToastManager.Show("Результат уже сохранен!"); } }
void CreateLibrary(string libName) { DialogComplexProgress d = (DialogComplexProgress)DialogManager.CreateComplexProgressLinear(); d.Initialize("Creating new library...", "Loading", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); d.InitializeCancelButton("CANCEL", ServiceController.shared.CancelCreateLibrary); d.Show(); ServiceController.shared.CreateLibrary(libName, (suc1, suc2, id) => { d.Hide(); if (!suc1) { DialogManager.ShowAlert("Unable to communicate with server!", "Connection Error", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else if (!suc2) { DialogManager.ShowAlert("Login has expired! Please relogin and try again.", "Login Expired", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else { DialogManager.ShowAlert("Library has been created.", "Success", MaterialIconHelper.GetIcon(MaterialIconEnum.CHECK)); // Add the newly created library here. Library lib = new Library(); lib.libraryId = id; lib.libraryName = libName; libraryExplorer.libraries.Add(lib); libraryExplorer.ConfigureCells(); } }); }
public void PlaySound(AudioClip clip) { _songNameText.SetText(clip.name); _audioSource.clip = clip; DisplaySongDuration(); OnStopClicked(); _playPauseButton.iconVectorImageData = MaterialIconHelper.GetIcon("play_arrow").vectorImageData; }
private void Start() { // ReSharper disable StringLiteralTypo var dialog = DialogManager.ShowProgressLinear( "Выполняеться построение меню настроек... Подождите!", "Построение", MaterialIconHelper.GetIcon(MaterialIconEnum.SETTINGS_OVERSCAN)); StartCoroutine(CheckSettingsOnEnable(dialog, 1.0f)); }
public override void Execute() { if (SaveManager.IsSaveAvailable()) { DialogManager.ShowAlert("", OnAffirmativeClicked, "Yes", "Project unsaved, save changes to file?", MaterialIconHelper.GetIcon(MaterialIconEnum.INFO_OUTLINE), OnDismissiveClicked, "No"); } else { FullCleanupSignal.Dispatch(); } }
// ReSharper disable once InconsistentNaming public void PGNButtonClick() { ClickSource.PlayOneShot(clickSound); DialogManager.ShowAlert(GameStatData.PGN, () => ClickSource.PlayOneShot(clickSound), "OK", "Portable Game Notation (PGN)", MaterialIconHelper.GetIcon(MaterialIconEnum.BOOK), () => { GameStatData.PGN.CopyToClipboard(); ToastManager.Show("Скопировано в буфер!"); }, "СКОПИРОВАТЬ В БУФЕР"); }
/// <summary> /// The login button is pressed. /// </summary> public void OnLoginButtonPress() { // Placeholder string username = usernameInputField.inputField.text; string password = passwordInputField.inputField.text; string api = addressInputField.inputField.text; DialogComplexProgress d = (DialogComplexProgress)DialogManager.CreateComplexProgressLinear(); d.Initialize("Connecting to server...", "Loading", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); d.InitializeCancelButton("Cancel", () => { ServiceController.shared.CancelLogin(); d.Hide(); }); d.Show(); ServiceController.shared.Login(api, username, password, (success, authenticated) => { if (success && authenticated) { PlayerPrefs.SetString(PlayerPrefsKey.SavedAddress, api); PlayerPrefs.SetString(PlayerPrefsKey.SavedUsername, username); AsyncOperation o = SceneManager.LoadSceneAsync(1); o.allowSceneActivation = false; TweenManager.TweenFloat(v => { Color c = screenTransitionMask.color; c.a = v; screenTransitionMask.color = c; }, 0, 1, 0.6f, 0, () => o.allowSceneActivation = true); } else { if (!success) { DialogManager.ShowAlert("Unable to connect to the given address.", "Connection Error", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else { DialogManager.ShowAlert("Incorrect username or password.", "Login Failed", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } } d.Hide(); }); }
public void OnSimpleListBigVectorButtonClicked() { List <OptionData> options = new List <OptionData>(); for (int i = 0; i < m_BigStringList.Length; i++) { string itemValue = m_BigStringList[i]; OptionData optionData = new OptionData(itemValue, MaterialIconHelper.GetRandomIcon(), () => { Debug.Log("I am selected: " + itemValue); }); options.Add(optionData); } DialogManager.ShowSimpleList(options.ToArray(), (int selectedIndex) => { ToastManager.Show("Item #" + selectedIndex + " selected: " + m_BigStringList[selectedIndex]); }, "Big Simple List - Vector", MaterialIconHelper.GetRandomIcon()); }
public void LoadGameButtonClick() { ClickSource.PlayOneShot(clickSound); Debug.Log("Load Game Button pressed"); if (!SaveGameHelper.IsSaveGameDirExist()) { ToastManager.Show("Сохранений не найдено!"); return; } var saveFiles = SaveGameHelper.GetAllSaveFileNames(); if (saveFiles.Length == 0) { ToastManager.Show("Файлов сохранений не найдено!"); return; } DialogManager.ShowRadioList(saveFiles, selectedIndex => { ClickSource.PlayOneShot(clickSound); var saveData = SaveGameHelper.ReadFile(saveFiles[selectedIndex]); if (string.IsNullOrEmpty(saveData)) { ToastManager.Show( "Файл " + saveFiles[selectedIndex] + " поврежден!"); return; } SaveGameData.Data = GameData.Deserialize(saveData); SaveGameData.LogList = SaveGameData.Data.logs; StartGame(); }, "ЗАГРУЗИТЬ", "Список сохранений", MaterialIconHelper.GetIcon(MaterialIconEnum.FILE_DOWNLOAD), () => { ClickSource.PlayOneShot(clickSound); Debug.Log("Clicked the Cancel button"); }, "НАЗАД"); //menu.SetActive(false); //loadGameMenu.SetActive(true); }
private void FindedConversationHandler(ARWObject obj, object value) { string newTalkData = obj.GetString("talk_data"); JSONObject talkJson = new JSONObject(newTalkData); Talk newTalk = new Talk(talkJson); if (newTalk.receiverName == "") { DialogManager.ShowAlert("Server connection error.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); return; } ChatPanelManager.instance.user.AddTalk(newTalk); ChatPanelManager.instance.InitNewTalk(newTalk); Debug.Log(newTalk.talkId + " : " + newTalk.receiverName + " : " + newTalk.talkMessages.Length); }
private void OnStopClicked() { if (_audioSource.clip == null) { return; } _active = false; _isPlaying = false; _audioSource.Stop(); _audioSource.time = 0; _playPauseButton.iconVectorImageData = MaterialIconHelper.GetIcon("pause").vectorImageData; _amount = 0f; _songPlayerSlider.value = 0f; _songPlayerBar.fillAmount = 0; _actualPositionText.SetText("00:00"); }
private void Update() { if (SettingsData.Settings != null) { return; } if (isSettingsChecked) { return; } // ReSharper disable StringLiteralTypo var dialog = DialogManager.ShowProgressLinear( "Выполняеться проверка файла настроек... Подождите пару секунд!", "Проверка", MaterialIconHelper.GetIcon(MaterialIconEnum.SETTINGS_OVERSCAN)); StartCoroutine(CheckSettingsOnEnable(dialog, 2.0f)); isSettingsChecked = true; }
private void OnPlayOrPauseClicked() { if (_audioSource.clip == null) { return; } if (_isPlaying) { _active = false; _isPlaying = false; _audioSource.Pause(); _playPauseButton.iconVectorImageData = MaterialIconHelper.GetIcon("play_arrow").vectorImageData; } else { _audioSource.Play(); _playPauseButton.iconVectorImageData = MaterialIconHelper.GetIcon("pause").vectorImageData; _isPlaying = true; _active = true; } }
public void QuitButtonClick() { ClickSource.PlayOneShot(clickSound); Debug.Log("Quit Button pressed"); DialogManager.ShowAlert( "Выйти из игры?", () => { ClickSource.PlayOneShot(clickSound); Debug.Log("Quit affirmative pressed"); Application.Quit(); }, "ДА", "Выйти?", MaterialIconHelper.GetIcon(MaterialIconEnum.QUESTION_ANSWER), () => { ClickSource.PlayOneShot(clickSound); Debug.Log("Quit Dismiss pressed"); }, "НЕТ"); }
void OnLibraryCellPress(int index) { // Configure library view controller. if (libraries[index].floors == null) { // We need to load this library from server first! That means a loading // dialog. DialogComplexProgress d = (DialogComplexProgress)DialogManager.CreateComplexProgressLinear(); d.Initialize("Getting library floor plans...", "Loading", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); d.InitializeCancelButton("Cancel", () => { ServiceController.shared.CancelGetLibrary(); d.Hide(); }); d.Show(); ServiceController.shared.GetLibrary(libraries[index].libraryId, (success, lib) => { d.Hide(); if (success) { // Load the library. libraries[index] = lib; libraryViewController.Show(libraries[index]); } else { // Display error. DialogManager.ShowAlert("Unable to connect to server!", "Connection Error", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } }); } else { libraryViewController.Show(libraries[index]); } }
void CreateFloor(string floorName) { int libId = displayingLibrary.libraryId; int order = displayingLibrary.floors.Count; DialogComplexProgress d = (DialogComplexProgress)DialogManager.CreateComplexProgressLinear(); d.Initialize("Creating new floor...", "Loading", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); d.InitializeCancelButton("CANCEL", ServiceController.shared.CancelCreateFloor); d.Show(); ServiceController.shared.CreateFloor(libId, floorName, order, (suc1, suc2, id) => { d.Hide(); if (!suc1) { DialogManager.ShowAlert("Unable to communicate with server!", "Connection Error", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else if (!suc2) { DialogManager.ShowAlert("Login has expired! Please relogin and try again.", "Login Expired", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); } else { DialogManager.ShowAlert("Floor has been created.", "Success", MaterialIconHelper.GetIcon(MaterialIconEnum.CHECK)); // Add the newly created floor here. Floor f = new Floor(); f.floorId = id; f.floorName = floorName; f.floorOrder = order; displayingLibrary.floors.Add(f); UpdateFloorPreviews(displayingLibrary); } }); }
public void RecordsButtonClick() { ClickSource.PlayOneShot(clickSound); Debug.Log("Records Table Button pressed"); var strings = SQLiteHelper.GetRecords(); var rec = SQLiteHelper.GetGameResults().ToArray(); if (strings == null) { ToastManager.Show("Таблица рекордов пуста!"); return; } DialogManager.ShowSimpleList(strings, selectedIndex => { ClickSource.PlayOneShot(clickSound); DialogManager.ShowAlert(rec[selectedIndex].PGN, () => ClickSource.PlayOneShot(clickSound), "OK", "Portable Game Notation (PGN)", MaterialIconHelper.GetIcon(MaterialIconEnum.BOOK), () => { rec[selectedIndex].PGN.CopyToClipboard(); ToastManager.Show("Скопировано в буфер!"); }, "СКОПИРОВАТЬ В БУФЕР"); }, "Список рекордов ", MaterialIconHelper.GetIcon(MaterialIconEnum.LIST)); //menu.SetActive(false); //recordsMenu.SetActive(true); }
private void OnConnectionLost(ARWObject obj, object value) { Debug.Log("Connection Fail"); DialogManager.ShowAlert("Please check your internet connection.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); ChatPanelManager.instance.welcomeScreen.gameObject.SetActive(false); }
public void OnAlertTwoCallbacksButtonClicked() { DialogManager.ShowAlert("Example with one affirmative and one dismissive button", () => { ToastManager.Show("You clicked the affirmative button"); }, "YES", "Two callbacks", MaterialIconHelper.GetRandomIcon(), () => { ToastManager.Show("You clicked the dismissive button"); }, "NO"); }
public void OnAlertFromLeftButtonClicked() { DialogAlert dialog = DialogManager.CreateAlert(); dialog.Initialize("Example with a dialog animation that comes from the left", null, "OK", "Alert!", MaterialIconHelper.GetRandomIcon(), null, null); var oldAnimator = dialog.GetComponent <AbstractTweenBehaviour>() as Component; if (oldAnimator != null) { Object.DestroyImmediate(oldAnimator); } var animator = dialog.gameObject.AddComponent <EasyFrameAnimator>(); animator.slideIn = true; animator.slideInDirection = ScreenView.SlideDirection.Left; animator.slideOut = true; animator.slideOutDirection = ScreenView.SlideDirection.Left; dialog.Show(); }
public void OnAlertSimpleButtonClicked() { DialogManager.ShowAlert("Hello world", "Alert!", MaterialIconHelper.GetRandomIcon()); }
public void OnAlertOneCallbackButtonClicked() { DialogManager.ShowAlert("Example with just one button", () => { ToastManager.Show("You clicked the affirmative button"); }, "OK", "One callback", MaterialIconHelper.GetRandomIcon()); }
public void OnProgressCircularButtonClicked() { DialogProgress dialog = DialogManager.ShowProgressCircular("Doing some hard work... Should be done in 5 seconds!", "Loading", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); StartCoroutine(HideWindowAfterSeconds(dialog, 5.0f)); }
public void OnIconRandomButtonClicked() { m_VectorImage.SetImageData(MaterialIconHelper.GetRandomIcon()); }
public void OnTwoFieldsPromptButtonClicked() { DialogManager.ShowPrompt("First name", "Last name", (string firstInputFieldValue, string secondInputFieldValue) => { ToastManager.Show("Returned: " + firstInputFieldValue + " and " + secondInputFieldValue); }, "OK", "Prompt Two Fields", MaterialIconHelper.GetRandomIcon(), () => { ToastManager.Show("You clicked the cancel button"); }, "CANCEL"); }
public void OnOneFieldPromptButtonClicked() { DialogManager.ShowPrompt("Username", (string inputFieldValue) => { ToastManager.Show("Returned: " + inputFieldValue); }, "OK", "Prompt One Field", MaterialIconHelper.GetRandomIcon(), () => { ToastManager.Show("You clicked the cancel button"); }, "CANCEL"); }
public void OnRadioListBigButtonClicked() { DialogManager.ShowRadioList(m_BigStringList, (int selectedIndex) => { ToastManager.Show("Item #" + selectedIndex + " selected: " + m_BigStringList[selectedIndex]); }, "OK", "Big Radio List", MaterialIconHelper.GetRandomIcon(), () => { ToastManager.Show("You clicked the cancel button"); }, "CANCEL"); }
public void OnCheckboxListBigButtonClicked() { DialogManager.ShowCheckboxList(m_BigStringList, OnCheckboxValidateClicked, "OK", "Big Checkbox List", MaterialIconHelper.GetRandomIcon(), () => { ToastManager.Show("You clicked the cancel button"); }, "CANCEL"); }
private void CannotFindActiveUser(ARWObject obj, object value) { DialogManager.ShowAlert("There is no active user in server.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); }