Пример #1
0
 public bool Back()
 {
     if (templateSelectorMenu.IsOpen())
     {
         templateSelectorMenu.Close();
         return(true);
     }
     else if (menuPanelManager.Back())
     {
         return(true);
     }
     else if (IsOpenSaveOrWorkshop())
     {
         SetOpenSaveOrWorkshop(false);
         return(true);
     }
     else if (multiplayerGameMenu.IsOpen())
     {
         multiplayerGameMenu.SetOpen(false);
         return(true);
     }
     else if (userMain.systemMenu.IsOpen())
     {
         userMain.systemMenu.Back();
         return(true);
     }
     else
     {
         userMain.systemMenu.Open();
         return(true);
     }
 }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F8) && Input.GetKey(KeyCode.LeftControl))
        {
            PerfBenchmark.CommandBenchmark(null);
        }

#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.F9) && Input.GetKey(KeyCode.LeftControl))
        {
            var gameOpts = new GameBuilderApplication.GameOptions
            {
                playOptions = new GameBuilderApplication.PlayOptions
                {
                    isMultiplayer    = true,
                    startAsPublic    = false,
                    startInBuildMode = true
                }
            };
            string path = System.IO.Path.Combine(Application.streamingAssetsPath, "ExampleGames", "Internal", "template-small.voos");
            loadingScreen.ShowAndDo(() => sceneController.RestartAndLoad(path, gameOpts));
        }
#endif

#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.F10) && Input.GetKey(KeyCode.LeftControl))
        {
            sceneController.JoinMultiplayerGameByCode($"1-dev-{System.Net.Dns.GetHostName().ToLowerInvariant()}");
        }
#endif

        if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.N))
        {
            sceneController.RestartAndLoadMinimalScene(new GameBuilderApplication.GameOptions());
        }

        if (Input.GetButtonDown("Cancel"))
        {
            if (creditsObject.activeSelf)
            {
                creditsObject.SetActive(false);
            }
            else if (templateSelectorMenu.IsOpen())
            {
                templateSelectorMenu.Close();
            }
            else
            {
                menuPanelManager.Back();
            }
        }

        AudioListener.volume = Application.isFocused ? 1 : 0;
    }