Beispiel #1
0
        public SS14Server(ICommandLineArgs args)
        {
            var    assemblies  = new List <Assembly>();
            string assemblyDir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);

            assemblies.Add(Assembly.LoadFrom(Path.Combine(assemblyDir, "SS14.Server.Services.dll")));

            IoCManager.AddAssemblies(assemblies);


            IoCManager.Resolve <ISS14Server>().SetServerInstance(this);

            //Init serializer
            var serializer = IoCManager.Resolve <ISS14Serializer>();

            Runlevel   = RunLevel.Init;
            _singleton = this;

            var configMgr = IoCManager.Resolve <IServerConfigurationManager>();

            configMgr.Initialize(PathHelpers.ExecutableRelativeFile("server_config.xml"));
            string logPath = configMgr.LogPath;

            if (!Path.IsPathRooted(logPath))
            {
                logPath = PathHelpers.ExecutableRelativeFile(logPath);
            }

            LogManager.Initialize(logPath, configMgr.LogLevel);

            TickRate   = IoCManager.Resolve <IServerConfigurationManager>().TickRate;
            ServerRate = 1000.0f / TickRate;
        }
        public GameController()
        {
            var    assemblies  = new List <Assembly>();
            string assemblyDir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);

            assemblies.Add(Assembly.LoadFrom(Path.Combine(assemblyDir, "SS14.Client.Services.dll")));

            IoCManager.AddAssemblies(assemblies);

            _configurationManager = IoCManager.Resolve <IPlayerConfigurationManager>();
            _configurationManager.Initialize("./player_config.xml");

            _resourceManager = IoCManager.Resolve <IResourceManager>();

            _resourceManager.LoadBaseResources();
            _resourceManager.LoadLocalResources();

            //Setup Cluwne first, as the rest depends on it.
            SetupCluwne();

            //Initialization of private members
            _networkManager       = IoCManager.Resolve <INetworkManager>();
            _netGrapher           = IoCManager.Resolve <INetworkGrapher>();
            _stateManager         = IoCManager.Resolve <IStateManager>();
            _userInterfaceManager = IoCManager.Resolve <IUserInterfaceManager>();

            _stateManager.RequestStateChange <MainScreen> ();

            FrameEventArgs _frameEvent;
            EventArgs      _frameEventArgs;

            _clock = new SFML.System.Clock();

            while (CluwneLib.IsRunning == true)
            {
                var lastFrameTime = _clock.ElapsedTime.AsSeconds();
                _clock.Restart();
                _frameEvent = new FrameEventArgs(lastFrameTime);
                CluwneLib.ClearCurrentRendertarget(Color.Black);
                CluwneLib.Screen.DispatchEvents();
                CluwneLib.RunIdle(this, _frameEvent);
                CluwneLib.Screen.Display();
            }
            CluwneLib.Terminate();
            Console.WriteLine("Gameloop terminated.");
        }
        public SS14UnitTest()
        {
            var    assemblies  = new List <Assembly>();
            string assemblyDir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);

            assemblies.Add(Assembly.LoadFrom(Path.Combine(assemblyDir, "SS14.Client.Services.dll")));
            assemblies.Add(Assembly.LoadFrom(Path.Combine(assemblyDir, "SS14.Server.Services.dll")));

            IoCManager.AddAssemblies(assemblies);

            //ConfigurationManager setup
            GetConfigurationManager = IoCManager.Resolve <IPlayerConfigurationManager>();
            GetConfigurationManager.Initialize("./player_config.xml");

            #if !HEADLESS
            //ResourceManager Setup
            GetResourceManager = IoCManager.Resolve <IResourceManager>();
            InitializeResources();
            #endif
        }