コード例 #1
0
        public override void Main(Godot.SceneTree tree)
        {
#if !X64
            throw new InvalidOperationException("The client cannot start outside x64.");
#endif

            PreInitIoC();
            IoCManager.Resolve <ISceneTreeHolder>().Initialize(tree);
            InitIoC();
            Godot.OS.SetWindowTitle("Space Station 14");
            SetupLogging();

            tree.SetAutoAcceptQuit(false);

            // Load config.
            _configurationManager.LoadFromFile(PathHelpers.ExecutableRelativeFile("client_config.toml"));

            displayManager.Initialize();

            // Init resources.
            // Doesn't do anything right now because TODO Godot asset management is a bit ad-hoc.
            _resourceCache.LoadBaseResources();
            _resourceCache.LoadLocalResources();

            //identical code for server in baseserver
            if (!AssemblyLoader.TryLoadAssembly <GameShared>(_resourceManager, $"Content.Shared") &&
                !AssemblyLoader.TryLoadAssembly <GameShared>(_resourceManager, $"Sandbox.Shared"))
            {
                Logger.Warning($"[ENG] Could not load any Shared DLL.");
            }

            if (!AssemblyLoader.TryLoadAssembly <GameClient>(_resourceManager, $"Content.Client") &&
                !AssemblyLoader.TryLoadAssembly <GameClient>(_resourceManager, $"Sandbox.Client"))
            {
                Logger.Warning($"[ENG] Could not load any Client DLL.");
            }

            // Call Init in game assemblies.
            AssemblyLoader.BroadcastRunLevel(AssemblyLoader.RunLevel.Init);

            eyeManager.Initialize();
            _serializer.Initialize();
            _userInterfaceManager.Initialize();
            _tileDefinitionManager.Initialize();
            _networkManager.Initialize(false);
            inputManager.Initialize();
            _console.Initialize();
            _prototypeManager.LoadDirectory(new ResourcePath(@"/Prototypes/"));
            _prototypeManager.Resync();
            _mapManager.Initialize();
            placementManager.Initialize();
            lightManager.Initialize();
            _entityManager.Initialize();
            gameStateManager.Initialize();
            overlayManager.Initialize();

            _client.Initialize();

            _stateManager.RequestStateChange <MainScreen>();
        }
コード例 #2
0
        public override void Main(Godot.SceneTree tree)
        {
#if !X64
            throw new InvalidOperationException("The client cannot start outside x64.");
#endif
            ThreadUtility.MainThread = Thread.CurrentThread;
            PreInitIoC();
            IoCManager.Resolve <ISceneTreeHolder>().Initialize(tree);
            InitIoC();
            Godot.OS.SetWindowTitle("Space Station 14");
            SetupLogging();

            // Set up custom synchronization context.
            // Sorry Godot.
            _taskManager.Initialize();

            tree.SetAutoAcceptQuit(false);

            // Load config.
            _configurationManager.LoadFromFile(PathHelpers.ExecutableRelativeFile("client_config.toml"));

            displayManager.Initialize();

            // Ensure Godot's side of the resources are up to date.
#if DEBUG
            GodotResourceCopy.DoDirCopy("../Resources", "Engine");
#endif

            // Init resources.
            // Doesn't do anything right now because TODO Godot asset management is a bit ad-hoc.
            _resourceCache.LoadBaseResources();
            _resourceCache.LoadLocalResources();

            //identical code for server in baseserver
            if (!AssemblyLoader.TryLoadAssembly <GameShared>(_resourceManager, $"Content.Shared"))
            {
                Logger.Warning($"[ENG] Could not load any Shared DLL.");
            }

            if (!AssemblyLoader.TryLoadAssembly <GameClient>(_resourceManager, $"Content.Client"))
            {
                Logger.Warning($"[ENG] Could not load any Client DLL.");
            }

            // Call Init in game assemblies.
            AssemblyLoader.BroadcastRunLevel(AssemblyLoader.RunLevel.Init);

            eyeManager.Initialize();
            _serializer.Initialize();
            _userInterfaceManager.Initialize();
            _networkManager.Initialize(false);
            inputManager.Initialize();
            _console.Initialize();
            _prototypeManager.LoadDirectory(new ResourcePath(@"/Prototypes/"));
            _prototypeManager.Resync();
            _tileDefinitionManager.Initialize();
            _mapManager.Initialize();
            placementManager.Initialize();
            lightManager.Initialize();
            _entityManager.Initialize();
            gameStateManager.Initialize();
            overlayManager.Initialize();
            _viewVariablesManager.Initialize();

            _client.Initialize();

            AssemblyLoader.BroadcastRunLevel(AssemblyLoader.RunLevel.PostInit);

            _stateManager.RequestStateChange <MainScreen>();

            var args = (ICollection <string>)Godot.OS.GetCmdlineArgs();
            if (args.Contains("--connect"))
            {
                _client.ConnectToServer("127.0.0.1", 1212);
            }
        }