Exemplo n.º 1
0
        /// <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));
                }
            });
        }
Exemplo n.º 2
0
    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("Результат уже сохранен!");
        }
    }
Exemplo n.º 3
0
        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();
                }
            });
        }
Exemplo n.º 4
0
 public void PlaySound(AudioClip clip)
 {
     _songNameText.SetText(clip.name);
     _audioSource.clip = clip;
     DisplaySongDuration();
     OnStopClicked();
     _playPauseButton.iconVectorImageData = MaterialIconHelper.GetIcon("play_arrow").vectorImageData;
 }
Exemplo n.º 5
0
    private void Start()
    {
        // ReSharper disable StringLiteralTypo
        var dialog = DialogManager.ShowProgressLinear(
            "Выполняеться построение меню настроек... Подождите!",
            "Построение",
            MaterialIconHelper.GetIcon(MaterialIconEnum.SETTINGS_OVERSCAN));

        StartCoroutine(CheckSettingsOnEnable(dialog, 1.0f));
    }
Exemplo n.º 6
0
 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();
     }
 }
Exemplo n.º 7
0
 // 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("Скопировано в буфер!");
     },
                             "СКОПИРОВАТЬ В БУФЕР");
 }
Exemplo n.º 8
0
        /// <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();
            });
        }
Exemplo n.º 9
0
    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());
    }
Exemplo n.º 10
0
    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);
    }
Exemplo n.º 11
0
    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);
    }
Exemplo n.º 12
0
        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");
        }
Exemplo n.º 13
0
    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;
    }
Exemplo n.º 14
0
        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;
            }
        }
Exemplo n.º 15
0
    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");
        }, "НЕТ");
    }
Exemplo n.º 16
0
        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]);
            }
        }
Exemplo n.º 17
0
        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);
                }
            });
        }
Exemplo n.º 18
0
    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);
    }
Exemplo n.º 19
0
 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);
 }
Exemplo n.º 20
0
 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");
 }
Exemplo n.º 21
0
    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();
    }
Exemplo n.º 22
0
 public void OnAlertSimpleButtonClicked()
 {
     DialogManager.ShowAlert("Hello world", "Alert!", MaterialIconHelper.GetRandomIcon());
 }
Exemplo n.º 23
0
 public void OnAlertOneCallbackButtonClicked()
 {
     DialogManager.ShowAlert("Example with just one button", () => { ToastManager.Show("You clicked the affirmative button"); }, "OK", "One callback", MaterialIconHelper.GetRandomIcon());
 }
Exemplo n.º 24
0
    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));
    }
Exemplo n.º 25
0
 public void OnIconRandomButtonClicked()
 {
     m_VectorImage.SetImageData(MaterialIconHelper.GetRandomIcon());
 }
Exemplo n.º 26
0
 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");
 }
Exemplo n.º 27
0
 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");
 }
Exemplo n.º 28
0
 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");
 }
Exemplo n.º 29
0
 public void OnCheckboxListBigButtonClicked()
 {
     DialogManager.ShowCheckboxList(m_BigStringList, OnCheckboxValidateClicked, "OK", "Big Checkbox List", MaterialIconHelper.GetRandomIcon(), () => { ToastManager.Show("You clicked the cancel button"); }, "CANCEL");
 }
Exemplo n.º 30
0
 private void CannotFindActiveUser(ARWObject obj, object value)
 {
     DialogManager.ShowAlert("There is no active user in server.", "Alert!", MaterialIconHelper.GetIcon(MaterialIconEnum.ADD_ALERT));
 }