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("Результат уже сохранен!"); } }
/// <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)); } }); }
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 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 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 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"); }
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"); }, "НЕТ"); }
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; } }
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); }
public void OnIconEnumButtonClicked() { m_VectorImage.SetImageData(MaterialIconHelper.GetIcon(MaterialIconEnum.SHOPPING_CART)); }
public void OnIconNameButtonClicked() { m_VectorImage.SetImageData(MaterialIconHelper.GetIcon("volume_off")); //m_VectorImage.SetImageData(GetIconFromIconFont("FontAwesome", "gift")); }
private void Start() { instance = this; if (Application.internetReachability == NetworkReachability.NotReachable) { DialogManager.ShowAlert("Please check your internet connection.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); } GameObject canvas = GameObject.Find("Canvas"); this.screenView = canvas.transform.Find("Screen View").GetComponent <ScreenView>(); this.loginButton = canvas.transform.Find("Screen View/WelcomeScreen/pnlWelcome/PanelLayer/btnStart").GetComponent <Button>(); this.signupButton = canvas.transform.Find("Screen View/WelcomeScreen/pnlWelcome/PanelLayer/btnSignup").GetComponent <Button>(); this.registerButton = canvas.transform.Find("Screen View/RegisterScreen/pnlRegister/PanelLayer/btnStart").GetComponent <Button>(); this.inputPasswordOnSignup = canvas.transform.Find("Screen View/RegisterScreen/pnlRegister/PanelLayer/inputPassword").GetComponent <InputField>(); this.inputEmailOnSignup = canvas.transform.Find("Screen View/RegisterScreen/pnlRegister/PanelLayer/inputEmail").GetComponent <InputField>(); this.inputEmailOnLogin = canvas.transform.Find("Screen View/WelcomeScreen/pnlWelcome/PanelLayer/inputEmail").GetComponent <InputField>(); this.inputPasswordOnLogin = canvas.transform.Find("Screen View/WelcomeScreen/pnlWelcome/PanelLayer/inputPassword").GetComponent <InputField>(); this.inputNickname = canvas.transform.Find("Screen View/RegisterScreen/pnlRegister/PanelLayer/inputNickname").GetComponent <InputField>(); this.messageObjectParent = canvas.transform.Find("Screen View/ConversationScreen/Scroll View/Viewport/Content"); new ChatPanelManager(canvas.transform.Find("Screen View/WelcomeScreen"), canvas.transform.Find("Screen View/RegisterScreen"), canvas.transform.Find("Screen View/TalksScreen"), canvas.transform.Find("Screen View/ConversationScreen")); this.loginButton.onClick.AddListener(delegate() { string email = inputEmailOnLogin.text; string password = inputPasswordOnLogin.text; if (email.Length <= 0 || password.Length <= 0) { DialogManager.ShowAlert("Please enter your email and password.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); return; } if (!ServerManager.instance.canLogin) { DialogManager.ShowAlert("Server connection error.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); return; } ARWObject obj = new IARWObject(); obj.PutString("player_id", email); obj.PutString("player_password", password); Debug.Log("+++++"); PlayerPrefs.SetString("player_id", email); PlayerPrefs.SetString("player_pass", password); ARWServer.instance.SendExtensionRequest("Login", obj, false); }); this.registerButton.onClick.AddListener(delegate() { string nickname = inputNickname.text; string password = inputPasswordOnSignup.text; string email = inputEmailOnSignup.text; string language = Application.systemLanguage.ToString(); if (nickname.Length <= 0 || email.Length <= 0 || password.Length <= 0) { DialogManager.ShowAlert("Please enter your nickname, email and password.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); return; } if (!ServerManager.instance.canLogin) { DialogManager.ShowAlert("Server connection error.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); return; } ARWObject obj = new IARWObject(); obj.PutString("player_id", email); obj.PutString("player_password", password); obj.PutString("language", language); obj.PutString("player_nickname", nickname); PlayerPrefs.SetString("player_id", email); PlayerPrefs.SetString("player_pass", password); ARWServer.instance.SendExtensionRequest("Register", obj, false); }); ServerManager.instance.Init(); ServerManager.instance.arwServer.SendLoginRequest("GUEST", null); // TextAsset playerData = Resources.Load<TextAsset>("ExamplePlayer"); }
public static IEnumerator UncompressAssetBundles(System.Action <bool> onFinish) { GameObject LoadingEffect = Instantiate((GameObject)Resources.Load("UI/AssetUncompressLoading"), Vector3.zero, Quaternion.identity); LinearProgressIndicator ProgressSlider = LoadingEffect.transform.Find("Progress").GetComponent <LinearProgressIndicator>(); Text assetText = LoadingEffect.transform.Find("Text").GetComponent <Text>(); string[] assetBundlesToUncompress = assetBundleManifest.GetAllAssetBundles(); for (int i = 0; i < assetBundlesToUncompress.Length; i++) { assetText.text = string.Format("Uncompress game assets. Progress{0}/{1} Current{2}", i, assetBundlesToUncompress.Length, assetBundlesToUncompress[i]); if (assetBundlesToUncompress[i].Contains("master")) { continue; } WWW www = new WWW(GetStreamingAssetsPath() + assetBundlesToUncompress[i]); while (!www.isDone) { ProgressSlider.SetProgress(www.progress, true); yield return(new WaitForEndOfFrame()); } if (string.IsNullOrEmpty(www.error)) { System.IO.File.WriteAllBytes(GetUncompressAssetsPath() + assetBundlesToUncompress[i], www.bytes); } else { DialogManager.ShowAlert(string.Format("Uncompress assets failed Reason{0} Please contact the developer for further detial.", www.error), "Critical Error", MaterialIconHelper.GetIcon(MaterialIconEnum.ERROR)); onFinish(false); yield break; } www.Dispose(); } Destroy(LoadingEffect); onFinish(true); yield break; }
public DialogProgress ShowDialog() { return(DialogManager.ShowProgressLinear(UIManager.FilesReadingText, UIManager.LoadingText, MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY))); }
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)); }
private void CannotFindActiveUser(ARWObject obj, object value) { DialogManager.ShowAlert("There is no active user in server.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); }
public void OnAddFloorButtonPress() { DialogManager.ShowPrompt("Floor Name", CreateFloor, "CREATE", "Create Floor", MaterialIconHelper.GetIcon(MaterialIconEnum.CREATE), null, "CANCEL"); }
public void OnProgressLinearButtonClicked() { DialogProgress dialog = DialogManager.ShowProgressLinear(UIManager.FilesReadingText, UIManager.LoadingText, MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); StartCoroutine(HideWindowAfterSeconds(dialog, 5.0f)); }
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 override async void Execute() { ExtensionFilter[] extensions = { new ExtensionFilter("Sound Files", "mp3", "wav"), }; string[] paths = StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, false); if (paths.Length > 0 && !string.IsNullOrEmpty(paths[0])) { string filepath = paths[0]; DialogProgress dialog = DialogManager.ShowProgressLinear("Loading " + filepath, "Loading music", MaterialIconHelper.GetIcon(MaterialIconEnum.INFO_OUTLINE)); Tuple <AudioFileReader, float[]> data = await Task.Run(() => ReadAudioFile(filepath)); AudioClip clip = AudioClip.Create(filepath, (int)(data.Item1.Length / sizeof(float) / data.Item1.WaveFormat.Channels), data.Item1.WaveFormat.Channels, data.Item1.WaveFormat.SampleRate, false); clip.SetData(data.Item2, 0); dialog.Hide(); SongLoadedSignal.Dispatch(clip); AudioPeerService.SetupAudioSource(clip); } }
public void EnterTalk() { ChatPanelManager.instance.currentTalkText.GetComponent <Text>().text = this.receiverName; AppManager.instance.appStatus = AppManager.AppStatus.CONVERSATION; AppManager.instance.currentTalk = this; ChatPanelManager.instance.talksScreen.gameObject.SetActive(false); if (this.talkMessages.Length != 0 && this.talkMessages[this.talkMessages.Length - 1].senderPlayerId == this.senderPlayerId) { this.canISendMsg = false; } for (int ii = this.talkMessages.Length; ii >= 0; ii--) { try{ Message currentMessage = this.talkMessages[ii]; float x = currentMessage.InitMessage(this, ii, tempDelta); if (x > 30) { tempDelta += x; } }catch (System.IndexOutOfRangeException) { } } ChatPanelManager.instance.conversationScreen.gameObject.SetActive(true); ChatPanelManager.instance.sendMessageInputField.text = String.Empty; ChatPanelManager.instance.sendMessageButton.onClick.RemoveAllListeners(); ChatPanelManager.instance.sendMessageButton.onClick.AddListener(delegate(){ if (ChatPanelManager.instance.sendMessageInputField.text == "") { return; } if (!this.canISendMsg) { DialogManager.ShowAlert("You can not send more messages. Please wait response.", "Spam Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT)); return; } ARWObject obj = new IARWObject(); obj.PutString("sender_id", this.senderPlayerId); obj.PutString("body", ChatPanelManager.instance.sendMessageInputField.text); obj.PutString("send_date", System.DateTime.Now.ToString()); obj.PutInt("talk_id", this.talkId); Debug.Log("Sending msj : " + this.talkId + " : " + this.senderPlayerId); ARWServer.instance.SendExtensionRequest("SendMessage", obj, false); ChatPanelManager.instance.sendMessageInputField.text = ""; this.canISendMsg = false; }); ChatPanelManager.instance.conversationScreen.GetChild(0).GetComponent <ScrollRect>().normalizedPosition = Vector2.zero; }
public void OnCreateLibraryButtonPress() { DialogManager.ShowPrompt("Library Name", CreateLibrary, "CREATE", "Create Library", MaterialIconHelper.GetIcon(MaterialIconEnum.CREATE), null, "CANCEL"); }