public static void disconnectedCleanup()
        {// End mission, if it's running.
            if (Globals.GetBool("Client::missionRunning"))
            {
                LevelLoad.clientEndMission();
            }

            // Disable mission lighting if it's going, this is here
            // in case we're disconnected while the mission is loading.

            Globals.SetBool("lightingMission", false);
            Globals.SetBool("sceneLighting::terminateLighting", true);

            // Back to the launch screen
            if (Global.isObject("MainMenuGui"))
            {
                Core.Canvas.GameCanvas.setContent(Sim.FindObject <GuiControl>("MainMenuGui"));
            }

            // Before we destroy the client physics world
            // make sure all ServerConnection objects are deleted.
            if (Global.isObject("ServerConnection"))
            {
                Sim.FindObject <GameConnectionToServer>("ServerConnection").deleteAllObjects();
            }

            // We can now delete the client physics simulation.
            Global.physicsDestroyWorld("client");
        }
Exemplo n.º 2
0
        public static void initClient()
        {
            string appName = Globals.GetString("appName");

            Global.echo("\n--------- Initializing " + appName + ": Client Scripts ---------");

            // Make sure this variable reflects the correct state.
            Globals.SetBool("Server.Server::Dedicated", false);

            // Game information used to query the master server
            Globals.SetString("Client::GameTypeQuery", appName);
            Globals.SetString("Client::MissionTypeQuery", "Any");

            Message.Init();
            GameConnectionToServer.Init();
            LevelDownload.Init();
            LevelLoad.Init();

            //load prefs
            string prefPath = Core.HelperFunctions.getPrefpath();

            if (Global.isFile(prefPath + "/clientPrefs.cs"))
            {
                Global.exec(prefPath + "/clientPrefs.cs");
            }
            else
            {
                Global.exec("data/defaults.cs");
            }

            Core.HelperFunctions.loadMaterials();

            // Copy saved script prefs into C++ code.
            Global.setDefaultFov(Globals.GetFloat("pref::Player::defaultFov"));
            Global.setZoomSpeed(Globals.GetInt("pref::Player::zoomSpeed"));
        }