Exemplo n.º 1
0
 public void NewGame()
 {
     LoadingScreenManager.LoadScene(1);
     gameManager.currentRoom  = 0;
     gameManager.currentState = 0;
     SaveLoadManager.SaveGameState(gameManager);
 }
Exemplo n.º 2
0
    void createLoadingScreen()
    {
        GameObject NewLoadingScreen = Instantiate(LoadingScreenPrefab, GameObject.Find("Canvas").transform);

        loadingScreenManager = NewLoadingScreen.GetComponent <LoadingScreenManager>();
        loadingText          = loadingScreenManager.GetLoadingText();
    }
Exemplo n.º 3
0
    /// <summary>
    /// Sets all values.
    /// </summary>
    /// <param name="lsm">A reference to the loading screen manager.</param>
    /// <param name="player">The player which the loading element is representing. Can be null</param>
    /// <param name="backgroundColor">The background color of the element.</param>
    /// <param name="overrideFadeFromRight">True: force the panel to come from right, false: force the panel to come from left, null: do the expected entry.</param>
    public void Set(LoadingScreenManager lsm, Player player, Color backgroundColor, bool?overrideFadeFromRight = null)
    {
        loadingScreenManager = lsm;

        if (overrideFadeFromRight.HasValue)
        {
            fadeFromRight = overrideFadeFromRight.Value;
        }

        background.color = backgroundColor;

        if (player == null)
        {
            return;
        }

        this.player     = player;
        username.text   = player.entityName;
        unitIcon.sprite = CharacterDict.Instance.GetSpriteForType(player.CharacterType);

        if (lsm.Reconnecting == false)
        {
            player.StateCommunicator.OnPercentageChanged += percentageAsText.UpdateValue;
            player.StateCommunicator.OnPercentageChanged += percentageAsImage.UpdateValue;
        }
        else
        {
            percentageAsText.UpdateValue(1.0f);
            percentageAsImage.UpdateValue(1.0f);
        }
    }
Exemplo n.º 4
0
    IEnumerator ChangeScene(int i)
    {
        yield return(new WaitForSeconds(3f));

        //        SceneManager.LoadScene(i);
        LoadingScreenManager.LoadScene(i);
    }
Exemplo n.º 5
0
        // Button handlers
        public void OnStartGame()
        {
            SoundManager.Play(SingletonSOSounds.Instance.Click01);

            // Return if no network address is specified
            if (string.IsNullOrEmpty(serverAddressInput.text))
            {
                return;
            }

            // Set and cache player name
            PlayerPrefs.SetString(UserNamePlayerPref, PlayerManager.CurrentCharacterSettings.Name);

            // Start game
            dialogueTitle.text = "Starting Game...";
            if (!hostServerToggle.isOn)
            {
                ConnectToServer();
            }
            else
            {
                LoadingScreenManager.LoadFromLobby(CustomNetworkManager.Instance.StartHost);
            }

            // Hide dialogue and show status text
            gameObject.SetActive(false);
            //	UIManager.Chat.CurrentChannelText.text = "<color=green>Loading game please wait..</color>\r\n";
        }
Exemplo n.º 6
0
 void OnTriggerEnter(Collider iCollide)
 {
     if (iCollide.transform.name == "Player")
     {
         LoadingScreenManager.LoadScene(num);
     }
 }
Exemplo n.º 7
0
 public static void LoadGame(string levelName, int laps, int players, bool isReverse)
 {
     try
     {
         WriteLog.Debug("Starting generating and loading multiplayer scene...");
         GameSetupScript.Instance.ReverseTrack = isReverse;
         if (GameManager.Instance != null)
         {
             GameManager.Instance.CurrentGameMode = GameManager.GameMode.QuickRace;
             GameManager.Instance.CurrentGameType = GameManager.GameType.SinglePlayer;
             GameManager.Instance.CurrentRaceType = GameManager.RaceType.Single;
             WriteLog.Verbose("Setting Game mode/type/racetype to QuickRace/singleplayer/single");
         }
         LevelData levelData = LevelDatabase.Instance.LevelDataList.Find((LevelData level) => level.BuildName == levelName && (level.IsReverseLevel == isReverse));
         if (levelData == null)
         {
             WriteLog.Debug("Potential error, levelData is null");
         }
         GameSetupScript.Instance.SetCurrentLevel(levelData);
         GameSetupScript.Instance.GetCurrentLevel().RaceMode = GameManager.RaceType.Single;
         GameSetupScript.Instance.EnableTutorial  = false;
         GameSetupScript.Instance.Bots            = players;
         GameSetupScript.Instance.Laps            = laps;
         GameSetupScript.Instance.NumberOfPlayers = 1;
         WriteLog.Verbose("Starting to load game scene");
         LoadingScreenManager.LoadScene(GameSetupScript.Instance.GetCurrentLevel().BuildName, GameSetupScript.Instance.GetCurrentLevel().BuildIndex);
     }
     catch (Exception ex)
     {
         WriteLog.Error("Error while trying to load game: " + ex.Message + ex.StackTrace);
     }
 }
Exemplo n.º 8
0
 public void yesExit()
 {
     ExitGameObject.SetActive(false);
     Time.timeScale = 1;
     //SceneManager.LoadScene("newMenu");
     LoadingScreenManager.LoadScene(1);
 }
Exemplo n.º 9
0
        public static bool Prefix(LoadingScreenManager __instance)
        {
            if (Main.IsConnected)
            {
                try
                {
                    WriteLog.Debug("Game scene loading completed");
                    FieldInfo progressBarInfo = __instance.GetType().GetField("_progressBar", BindingFlags.NonPublic | BindingFlags.Instance);
                    Image     progressBar     = (Image)progressBarInfo.GetValue(__instance);
                    FieldInfo loadingTextInfo = __instance.GetType().GetField("_loadingLocalize", BindingFlags.NonPublic | BindingFlags.Instance);
                    Localize  loadingText     = (Localize)loadingTextInfo.GetValue(__instance);
                    progressBar.fillAmount = 1f;
                    loadingText.SetTerm("LOADING COMPLETE: Waiting for other players (ZeroG)");
                }
                catch (Exception ex)
                {
                }


                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 10
0
    public IEnumerator WaitGameOver()
    {
        yield return(new WaitForSeconds(2));

        //SceneManager.LoadScene ("Score");
        LoadingScreenManager.LoadScene(10);
    }
Exemplo n.º 11
0
    IEnumerator GameOver()
    {
        AnaliticsControl.ovosTime = tempo;
        yield return(new WaitForSeconds(2));

        //SceneManager.LoadScene("Score");
        LoadingScreenManager.LoadScene(10);
    }
Exemplo n.º 12
0
 public void LoadSceneNum(int num)
 {
     if (num < 0 || num >= SceneManager.sceneCountInBuildSettings)
     {
         return;
     }
     LoadingScreenManager.LoadScene(num);
 }
Exemplo n.º 13
0
    private IEnumerator PlaySoundButton(int scene)
    {
        aud.Stop();
        aud.Play();
        yield return(new WaitForSeconds(aud.clip.length));

        LoadingScreenManager.LoadScene(scene);
    }
Exemplo n.º 14
0
    void ToScore()
    {
        notaFinal = 0;
        if (tempo <= 5f)
        {
            notaFinal = 20;
        }
        else if (tempo <= 7f)
        {
            notaFinal = 10;
        }
        else if (tempo <= 10f)
        {
            notaFinal = 7;
        }

        else if (tempo <= 15f)
        {
            notaFinal = 5;
        }

        PlayerPrefs.SetInt("notaFinalTemp" + idTema.ToString(), notaFinal);

        if (gamelevel == 0)
        {
            if (notaFinal > PlayerPrefs.GetInt("piqueFacil" + idTema.ToString()))
            {
                PlayerPrefs.SetInt("piqueFacil" + idTema.ToString(), notaFinal);
            }
            if (PlayerPrefs.GetString("dificuldade" + idTema) == "F" || PlayerPrefs.GetString("dificuldade" + idTema) == "")
            {
                PlayerPrefs.SetString("dificuldade" + idTema, "M");
            }
        }
        else if (gamelevel == 1)
        {
            if (notaFinal > PlayerPrefs.GetInt("piqueMedio" + idTema.ToString()))
            {
                PlayerPrefs.SetInt("piqueMedio" + idTema.ToString(), notaFinal);
            }

            if (PlayerPrefs.GetString("dificuldade" + idTema) == "M")
            {
                PlayerPrefs.SetString("dificuldade" + idTema, "D");
            }
        }
        else if (gamelevel == 2)
        {
            if (notaFinal > PlayerPrefs.GetInt("piqueDificil" + idTema.ToString()))
            {
                PlayerPrefs.SetInt("piqueDificil" + idTema.ToString(), notaFinal);
            }
        }

        //Score.infoValue = string.Format ("Parabéns, você me achou em {0} segundos e tirou {1}!", tempo.ToString ("0.0"), notaFinal);
        //SceneManager.LoadScene ("Score");
        LoadingScreenManager.LoadScene(10);
    }
Exemplo n.º 15
0
    public IEnumerator StartGameOver()
    {
        memoriaData.tempoJogo = tempo;
        //dataController.SetMemoriaData(memoriaData);
        yield return(new WaitForSeconds(2));

        //SceneManager.LoadScene ("Score");
        LoadingScreenManager.LoadScene(10);
    }
Exemplo n.º 16
0
    public void RejectSave()
    {
        if (Time.timeScale == 0)
        {
            Time.timeScale = 1;
        }

        LoadingScreenManager.LoadScene(1);
    }
Exemplo n.º 17
0
 public void LoadSceneNumber(int num)
 {
     if (num < 0 || num >= SceneManager.sceneCountInBuildSettings)
     {
         Debug.LogWarning("Can't load scene num " + num + ", SenceManager only has " + SceneManager.sceneCountInBuildSettings + "Scenes is BuildSetting !");
         return;
     }
     LoadingScreenManager.LoadScene(num);
 }
Exemplo n.º 18
0
    public void LoadSceneNum(string name)
    {
        /*if (num < 0 || num >= SceneManager.sceneCountInBuildSettings) {
         *      Debug.LogWarning("Can't load scene num " + num + ", SceneManager only has " + SceneManager.sceneCountInBuildSettings + " scenes in BuildSettings");
         *      return;
         * }*/

        LoadingScreenManager.LoadScene(name);
    }
Exemplo n.º 19
0
    public IEnumerator GameOver()
    {
        if (acertos == 12)
        {
            notaFinal = 20;
        }
        else if (acertos <= 11 && acertos >= 8)
        {
            notaFinal = 10;
        }
        else if (acertos <= 7 && acertos >= 4)
        {
            notaFinal = 7;
        }
        else if (acertos < 4)
        {
            notaFinal = 5;
        }
        if (gamelevel == 0)
        {
            if (notaFinal > PlayerPrefs.GetInt("piqueFacil" + idTema.ToString()))
            {
                PlayerPrefs.SetInt("piqueFacil" + idTema.ToString(), notaFinal);
            }
            if (PlayerPrefs.GetString("dificuldade" + idTema) == "F" || PlayerPrefs.GetString("dificuldade" + idTema) == "")
            {
                PlayerPrefs.SetString("dificuldade" + idTema, "M");
            }
        }
        else if (gamelevel == 1)
        {
            if (notaFinal > PlayerPrefs.GetInt("piqueMedio" + idTema.ToString()))
            {
                PlayerPrefs.SetInt("piqueMedio" + idTema.ToString(), notaFinal);
            }

            if (PlayerPrefs.GetString("dificuldade" + idTema) == "M")
            {
                PlayerPrefs.SetString("dificuldade" + idTema, "D");
            }
        }
        else if (gamelevel == 2)
        {
            if (notaFinal > PlayerPrefs.GetInt("piqueDificil" + idTema.ToString()))
            {
                PlayerPrefs.SetInt("piqueDificil" + idTema.ToString(), notaFinal);
            }
        }
        PlayerPrefs.SetInt("notaFinalTemp" + idTema.ToString(), notaFinal);
        alimentosData.nota = notaFinal;
        //dataController.SetAlimentosData(alimentosData);
        yield return(new WaitForSeconds(2));

        //SceneManager.LoadScene ("Score");
        LoadingScreenManager.LoadScene(10);
    }
Exemplo n.º 20
0
    //-------------------------------
    // UI controls

    public void Retry()
    {
        if (Time.timeScale == 0)
        {
            Time.timeScale = 1;
        }

        GameController.Player.GetComponent <FirstPersonController>().m_MouseLook.SetCursorLock(true);
        LoadingScreenManager.LoadScene(GameController.CurrentLevel);
    }
Exemplo n.º 21
0
 public void LoadSceneNum(int num)
 {
     if (num < 0 || num >= SceneManager.sceneCountInBuildSettings)
     {
         Debug.LogWarning("CANT LOAD SCENE " + num);
         return;
     }
     Debug.Log("Running THIS NOW");
     LoadingScreenManager.LoadScene(num);
 }
Exemplo n.º 22
0
    public IEnumerator GameOver()
    {
        isGame = false;
        gameOverPrefab.SetActive(true);
        gameOverPanel.SetTrigger("DoFade");
        PlayerPrefs.SetInt("gold", getGold);
        yield return(new WaitForSeconds(1.5f));

        LoadingScreenManager.LoadScene(1);
    }
Exemplo n.º 23
0
    // Update is called once per frame
    void Update()
    {
        if (player.transform.position.x >= this.transform.position.x)
        {
            PersistentGameObject PGO = GameObject.FindGameObjectWithTag("PersistentObject").GetComponent <PersistentGameObject> ();
            PGO.setPlayerWeapon(player.transform.Find("RifleWeapon").gameObject.GetComponent <TrackMouse> ().weapon);

            LoadingScreenManager.LoadScene(sceneIndexToLoad);
        }
    }
Exemplo n.º 24
0
    public void LoadSceneNum(int num)
    {
        if (num < 0 || num >= SceneManager.sceneCountInBuildSettings)
        {
            Debug.LogWarning("Can't load scene " + num + ". It's beyond the scene count for this project. Did you add the scene to build settings?");
            return;
        }

        LoadingScreenManager.LoadScene(num);
    }
    public void LoadSceneNum(int num)
    {
        if (num < 0 || num >= SceneManager.sceneCountInBuildSettings)
        {
            Debug.LogWarning($"Can't load scene num {num}, SceneManager only has {SceneManager.sceneCountInBuildSettings} scenes in BuildSettings!");
            return;
        }

        LoadingScreenManager.LoadScene(num);
    }
Exemplo n.º 26
0
 public void LoadScreenNum(int num, int fromScene)
 {
     if (num < 0 || num >= SceneManager.sceneCountInBuildSettings) //błąd
     {
         Debug.LogWarning("Cant load scene num" + num + ", Scene manager only has " + SceneManager.sceneCountInBuildSettings + " scenes in BuildSettings!");
         return;
     }
     LoadingScreenManager.LoadScene(num, fromScene);     //wywołanie skryptu umożliwiającego ładowanie sceny
     Debug.Log("Load Scene: " + num);
 }
Exemplo n.º 27
0
 public void ReloadPlacingPhase()
 {
     Gamestate.Instance.currentState = 1;
     SaveLoadManager.SaveGameState(Gamestate.Instance);
     isReloaded = true;
     SaveLoadManager.SavePlacingData(this);
     //Inventory.Instance.GetListCount();
     LoadingScreenManager.LoadScene(1);
     Time.timeScale = 1.0f;
 }
Exemplo n.º 28
0
    private void Awake()
    {
        Instance = this;

        if (duration <= 0f)
        {
            duration = 0.1f;
        }
        duration += endThreshold;
        duration += cinematicDelay;
    }
Exemplo n.º 29
0
 public void LoadSceneNum(int num)
 {
     if (num < 0 || num >= SceneManager.sceneCountInBuildSettings)
     {
         Debug.LogError("Can't load scene with index " + num);
     }
     else
     {
         LoadingScreenManager.LoadScene(num);
     }
 }
Exemplo n.º 30
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 31
0
 void Start()
 {
     Instance = this;
 }