Exemplo n.º 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>();
        }
Exemplo n.º 2
0
        public override void Main(Godot.SceneTree tree)
        {
            PreInitIoC();
            IoCManager.Resolve <ISceneTreeHolder>().Initialize(tree);
            InitIoC();
            Godot.OS.SetWindowTitle("Space Station 14");

            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"))
            {
                if (!AssemblyLoader.TryLoadAssembly <GameShared>(_resourceManager, $"Sandbox.Shared"))
                {
                    Logger.Warning($"[ENG] Could not load any Shared DLL.");
                }
            }

            if (!AssemblyLoader.TryLoadAssembly <GameClient>(_resourceManager, $"Content.Client"))
            {
                if (!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();
            inputManager.Initialize();
            _serializer.Initialize();
            _userInterfaceManager.Initialize();
            _tileDefinitionManager.Initialize();
            _networkManager.Initialize(false);
            _console.Initialize();
            _prototypeManager.LoadDirectory(@"./Prototypes/");
            _prototypeManager.Resync();
            _mapManager.Initialize();
            placementManager.Initialize();
            lightManager.Initialize();
            _entityManager.Initialize();

            _networkManager.RegisterNetMessage <MsgFullState>(MsgFullState.NAME, message => IoCManager.Resolve <IGameStateManager>().HandleFullStateMessage((MsgFullState)message));
            _networkManager.RegisterNetMessage <MsgStateUpdate>(MsgStateUpdate.NAME, message => IoCManager.Resolve <IGameStateManager>().HandleStateUpdateMessage((MsgStateUpdate)message));

            _client.Initialize();

            _stateManager.RequestStateChange <MainScreen>();
        }
        public void Initialize(Godot.SceneTree tree)
        {
            SceneTree = tree ?? throw new ArgumentNullException(nameof(tree));

            WorldRoot = new Godot.Node2D
            {
                Name = "WorldRoot"
            };
            SceneTree.GetRoot().AddChild(WorldRoot);
        }
Exemplo n.º 4
0
        public void Initialize(Godot.SceneTree tree)
        {
            SceneTree = tree ?? throw new ArgumentNullException(nameof(tree));

            BelowWorldScreenSpace = new Godot.CanvasLayer
            {
                Name  = "ScreenSubWorld",
                Layer = CanvasLayers.LAYER_SCREEN_BELOW_WORLD
            };
            SceneTree.GetRoot().AddChild(BelowWorldScreenSpace);

            WorldRoot = new Godot.Node2D
            {
                Name = "WorldRoot"
            };
            SceneTree.GetRoot().AddChild(WorldRoot);
        }
        public override void Main(Godot.SceneTree tree)
        {
#if !X64
            throw new InvalidOperationException("The client cannot start outside x64.");
#endif
            Mode = DisplayMode.Godot;
            tree.SetAutoAcceptQuit(false);
            IoCManager.Register <ISceneTreeHolder, SceneTreeHolder>();
            IoCManager.BuildGraph();
            IoCManager.Resolve <ISceneTreeHolder>().Initialize(tree);

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

            Startup();

            _gameTimingGodotGodot = IoCManager.Resolve <GameTimingGodot>();
        }
Exemplo n.º 6
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);
            }
        }