public void ShowDetailPanel()
    {
        UnityEngine.Object objTrackPanel = Resources.Load("Prefabs/pnlTrackDetail");
        GameObject         goTrackPanel  = (GameObject)GameObject.Instantiate(objTrackPanel, Vector3.zero, Quaternion.identity, GameObject.Find("MenuCanvas").transform);

        goTrackPanel.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        SaveLoadModel.LoadGameData(_game.GameId);
        goTrackPanel.GetComponent <TrackDetail>().Init(_game);
    }
示例#2
0
 public void ChooseCar()
 {
     PlayerManager.Type = "CarPlayer";
     SaveLoadModel.LoadGameData(SelectedItem.Id);
     if (GameData.current.RdS.Sectns == null)
     {
         Main.Instance.PopupMsg("This track has no road"); return;
     }
     Main.Instance.StartLoadingMenuScene("VehicleSelector");
 }
示例#3
0
 public void ReplayRecordingNotUsed(string Filename)
 {
     Recrdng.Current             = new Recrdng(Filename);
     Main.Instance.OpponentCount = Recrdng.Current.Data[0].Count - 1;
     if (SceneManager.GetActiveScene().buildIndex < 5)
     {
         PlayerManager.Type = "Replayer";
         SaveLoadModel.LoadGameData(_game.GameId);
         SceneManager.LoadScene("Canyon");
         //rest of the procedure happens in Main.SceneChange - if (PlayerManager.Type == "Replayer")
     }
 }
示例#4
0
 public void BuildTrack()
 {
     if (SelectedItem == null)
     {
         return;
     }
     if (SelectedItem.Id == -1)
     {
         Main.Instance.StartLoadingMenuScene("SceneSelector");
     }
     else
     {           //N.B. the SaveLoadModel decides whether to load the game or keep the current one
         if (Game.current != null)
         {
             if (SelectedItem.Id != Game.current.GameId)
             {
                 //TerrainController.Instance.RestoreBackup();
             }
         }
         PlayerManager.Type = "BuilderPlayer";
         SaveLoadModel.LoadGameData(SelectedItem.Id);
         Main.Instance.StartLoadingGameScene(GameData.current.Scene); // Once the scene is loaded it activates and moves the EventSystem across
     }
 }
示例#5
0
    void SceneChange(Scene OldScene, Scene NewScene)
    {
        if (OldScene.name == null)
        {
            return;
        }
        Debug.Log("Main SceneChange from " + OldScene.name + " to " + NewScene.name);
        if (NewScene.name == "SceneSelector")
        {
            return;
        }
        if (NewScene.name == "RaceSelector")
        {
            _musicPlayer.Fade();
        }

        int Level = NewScene.buildIndex;

        if (Level < 6)
        {
            return;
        }
        if (OnLevelLoaded != null)
        {
            OnLevelLoaded(Level);
        }

        if (PlayerManager.Type == "CarPlayer")
        {
            if (GameLoadedFromFileNeedsDecoding)
            {
                SaveLoadModel.DecodeGameScene();
                GameLoadedFromFileNeedsDecoding = false;
            }
            PopupTip();
            StartCoroutine(CreateTrackAndRacers());
        }

        if (PlayerManager.Type == "Replayer")
        {
            if (GameLoadedFromFileNeedsDecoding)
            {
                SaveLoadModel.DecodeGameScene(); GameLoadedFromFileNeedsDecoding = false;
            }
            PopupTip();
            StartCoroutine(CreateTrackAndRacers());
        }

        if (PlayerManager.Type == "BuilderPlayer")
        {
            if (SelectedGameID == -1)
            {
                Game.current           = new Game();
                GameData.current       = new GameData();
                GameData.current.Scene = NewScene.name;
                SaveLoadModel.Save();
                SaveLoadModel.LoadTerrainBackup(NewScene.name);
                TerrainController.Instance.Init();
                //Clear all the bez points and add the 2 empty ones.
                //We need these, because cos although the Constructor calls Init(), its a singleton class so the constructor only gets called at the beginning
                BezierLine.Instance.Init();

                //Clear all the road sections and add the empty Road Section
                //We need these, because cos although the Constructor calls Init(), its a singleton class so the constructor only gets called at the beginning
                Road.Instance.Init();

                //Clear all the PlaceableObjects
                Scenery.Instance.RemoveObjects();
            }
            else
            {
                SaveLoadModel.LoadGameData(SelectedGameID);
                if (GameLoadedFromFileNeedsDecoding)
                {
                    SaveLoadModel.DecodeGameScene();
                    GameLoadedFromFileNeedsDecoding = false;
                }
            }
            PopupTip();
            StartCoroutine(BPMPlayOfflineCoroutine());
        }
    }