Ejemplo n.º 1
0
        public static void Main()
        {
            var assemblyNames = new []
            {
                Assembly.GetExecutingAssembly().FullName,
                "EOLib",
                "EOLib.Config",
                "EOLib.Graphics",
                "EOLib.IO",
                "EOLib.Localization",
                "EOLib.Logger"
            };

            using (ITypeRegistry registry = new UnityRegistry(assemblyNames))
            {
#if DEBUG
                _gameRunner = new DebugGameRunner(registry);
#else
                _gameRunner = new ReleaseGameRunner(registry);
#endif
                if (_gameRunner.SetupDependencies())
                {
                    _gameRunner.RunGame();
                }
            }
        }
Ejemplo n.º 2
0
 public FooBarSystem(IGameRunner game, FooSystem foo, TestSystem test, EmptySystem empty) : base(game)
 {
     TestSwitch = false;
     _foo       = foo;
     _test      = test;
     _empty     = empty;
 }
Ejemplo n.º 3
0
 public TestSystem(IGameRunner game, EmptySystem emptySystem) : base(game)
 {
     _prevStates            = new Dictionary <TestComponent, bool>();
     ComponentRegistered   += OnComponentRegistered;
     ComponentUnRegistered += OnComponentUnRegistered;
     _emptySystem           = emptySystem;
 }
Ejemplo n.º 4
0
 public GameHostServerImpl(
     IGameRunner gameRunner,
     HostedEventEngineHook hostedEventEngineHook)
 {
     _gameRunner            = gameRunner;
     _hostedEventEngineHook = hostedEventEngineHook;
     _formatter             = new BinaryFormatter();
 }
Ejemplo n.º 5
0
 public TestSystem(IGameRunner game, SharperInputSystem inputSystem) : base(game)
 {
     _prevStates  = new Dictionary <TestComponent, bool>();
     _inputSystem = inputSystem;
     _inputSystem.NewInputEntityCreated += OnNewInputEntity;
     ComponentRegistered   += OnComponentRegistered;
     ComponentUnRegistered += OnComponentUnRegistered;
 }
Ejemplo n.º 6
0
 public void Shutdown()
 {
     if (Runner != null)
     {
         Runner.Shutdown();
         Runner = null;
     }
 }
Ejemplo n.º 7
0
    public object?LaunchGame(IGameRunner runner, string sessionId, int region, int expansionLevel,
                             bool isSteamServiceAccount, string additionalArguments,
                             DirectoryInfo gamePath, bool isDx11, ClientLanguage language,
                             bool encryptArguments, DpiAwareness dpiAwareness)
    {
        Log.Information(
            $"XivGame::LaunchGame(steamServiceAccount:{isSteamServiceAccount}, args:{additionalArguments})");

        var exePath = Path.Combine(gamePath.FullName, "game", "ffxiv_dx11.exe");

        if (!isDx11)
        {
            exePath = Path.Combine(gamePath.FullName, "game", "ffxiv.exe");
        }

        var environment = new Dictionary <string, string>();

        var argumentBuilder = new ArgumentBuilder()
                              .Append("DEV.DataPathType", "1")
                              .Append("DEV.MaxEntitledExpansionID", expansionLevel.ToString())
                              .Append("DEV.TestSID", sessionId)
                              .Append("DEV.UseSqPack", "1")
                              .Append("SYS.Region", region.ToString())
                              .Append("language", ((int)language).ToString())
                              .Append("resetConfig", "0")
                              .Append("ver", Repository.Ffxiv.GetVer(gamePath));

        if (isSteamServiceAccount)
        {
            // These environment variable and arguments seems to be set when ffxivboot is started with "-issteam" (27.08.2019)
            environment.Add("IS_FFXIV_LAUNCH_FROM_STEAM", "1");
            argumentBuilder.Append("IsSteam", "1");
        }

        // This is a bit of a hack; ideally additionalArguments would be a dictionary or some KeyValue structure
        if (!string.IsNullOrEmpty(additionalArguments))
        {
            var regex = new Regex(@"\s*(?<key>[^=]+)\s*=\s*(?<value>[^\s]+)\s*", RegexOptions.Compiled);
            foreach (Match match in regex.Matches(additionalArguments))
            {
                argumentBuilder.Append(match.Groups["key"].Value, match.Groups["value"].Value);
            }
        }

        if (!File.Exists(exePath))
        {
            throw new BinaryNotPresentException(exePath);
        }

        var workingDir = Path.Combine(gamePath.FullName, "game");

        var arguments = encryptArguments
            ? argumentBuilder.BuildEncrypted()
            : argumentBuilder.Build();

        return(runner.Start(exePath, workingDir, arguments, environment, dpiAwareness));
    }
 public MainInitializerApiController(IServiceProvider serviceProvider) : base(serviceProvider, false)
 {
     //Request.UserHostAddress
     _mainInitializer      = serviceProvider.GetService <IMainInitializer>();
     _authUsersInitializer = serviceProvider.GetService <IAuthUsersInitializer>();
     _npcTaskRunner        = serviceProvider.GetService <INpcTaskRunner>();
     _hub        = serviceProvider.GetService <IHubContext <MainGameHub> >();
     _gameRunner = serviceProvider.GetService <IGameRunner>();
 }
Ejemplo n.º 9
0
 public static IApplicationBuilder AddTimerExecutor(this IApplicationBuilder builder, IServiceProvider svp)
 {
     if (_gameRunner == null)
     {
         _svp        = svp;
         _gameRunner = _svp.GetService <IGameRunner>();
     }
     return(builder);
 }
Ejemplo n.º 10
0
 public Cowboy(Game1 game, IGameRunner runner)
     :base(game, runner)
 {
     animationIdle = new SpriteRenderable(game, cowboyIdle, 1, 1);
     animationWalk = new SpriteRenderable(game, cowboyRun, 10, 1);
     animationJump = new SpriteRenderable(game, cowboyJump, 11, 1);
     animationCelebrate = new SpriteRenderable(game, cowboyCelebrate, 11, 1);
     animationDie = new SpriteRenderable(game, cowboyDie, 12, 1);
 }
Ejemplo n.º 11
0
        public MathGameSystem(IGameRunner game, SharperInputSystem input) : base(game)
        {
            _game   = game;
            _input  = input;
            _random = new Random();

            _input.NewInputEntityCreated += async(s, e) =>
            {
                await RegisterComponentAsync(new MathGameComponent(await game.CreateEntityAsync(), e.Entity));

                _inputEntity = e.Entity;
            };
        }
Ejemplo n.º 12
0
        public static void Main()
        {
            using (var unityContainer = new UnityContainer())
            {
#if DEBUG
                _gameRunner = new DebugGameRunner(unityContainer);
#else
                _gameRunner = new ReleaseGameRunner(unityContainer);
#endif
                if (_gameRunner.SetupDependencies())
                {
                    _gameRunner.RunGame();
                }
            }
        }
Ejemplo n.º 13
0
        public void UpdateGameView(IGameRunner runner)
        {
            var gs  = (VsGame)runner.Game;
            var ngs = runner.GameInfo;

            var fighterGss = gs._fighters;

            if (fighterViews.Length != fighterGss.Length)
            {
                ResetView(gs);
            }
            for (int i = 0; i < fighterGss.Length; ++i)
            {
                fighterViews[i].Populate(fighterGss[i], ngs.players[i]);
            }
        }
Ejemplo n.º 14
0
        public Game(IGameRunner runner, IGameRunnerStateBuilder gameStateBuilder, Field field, Team firstTeam, Team secondTeam, Ball ball)
        {
            Contract.Requires<ArgumentNullException>(runner != null);
            Contract.Requires<ArgumentNullException>(gameStateBuilder != null);

            Contract.Requires<ArgumentNullException>(firstTeam != null);
            Contract.Requires<ArgumentNullException>(secondTeam != null);
            Contract.Requires<ArgumentNullException>(ball != null);

            _runner = runner;
            _gameStateBuilder = gameStateBuilder;
            _field = field;
            _firstTeam = firstTeam;
            _secondTeam = secondTeam;
            _ball = ball;
        }
Ejemplo n.º 15
0
        public void UpdateGameView(IGameRunner runner)
        {
            var gs  = (VwGame)runner.Game;
            var ngs = runner.GameInfo;

            var shipsGss = gs._ships;

            if (shipViews.Length != shipsGss.Length)
            {
                ResetView(gs);
            }
            for (int i = 0; i < shipsGss.Length; ++i)
            {
                shipViews[i].Populate(shipsGss[i], ngs.players[i]);
                UpdateBullets(shipsGss[i].bullets, bulletLists[i]);
            }
        }
Ejemplo n.º 16
0
 public NpcTaskRunner(IGameRunner gameRunner)
 {
     _gameRunner = gameRunner;
     _provider   = _svp.GetService <IDbProvider>();
 }
Ejemplo n.º 17
0
 public BarExportSystem(IGameRunner game) : base(game)
 {
 }
Ejemplo n.º 18
0
 public override void StartGGPOGame(IPerfUpdate perfPanel, IList <Connections> connections, int playerIndex)
 {
     runner = new GGPORunner("ecsgame", new EcsGame(ecsSceneInfo), perfPanel);
     ((GGPORunner)runner).Init(connections, playerIndex);
     StartGame(runner);
 }
Ejemplo n.º 19
0
 public override void StartLocalGame()
 {
     runner = new LocalRunner(new EcsGame(ecsSceneInfo));
     StartGame(runner);
 }
 public AppVarsReader(IGameRunner gameRunner)
 {
     _gameRunner = gameRunner;
 }
Ejemplo n.º 21
0
 public EmptySystem(IGameRunner game) : base(game)
 {
     TestSwitch = false;
 }
Ejemplo n.º 22
0
 public LiteDbProvider(List <ISharperSystem> systems, IGameRunner runner)
 {
     _systems = systems;
     _runner  = runner;
 }
 public GameController(IServiceProvider serviceProvider, IGameUserService gameUserService, UserManager <ApplicationUser> userManager) : base(serviceProvider)
 {
     _gameUserService = gameUserService;
     _userManager     = userManager;
     _gameRunner      = _svp.GetService <IGameRunner>();
 }
 /// <summary>
 /// Base constructor for any <see cref="BaseSharperSystem{T}"/>. This must be called for the system to function correctly. Do not pass <see cref="ISharperSystem{T}"/> types in an overriden constructor. Instead, use <see cref="SharperInjectAttribute"/>.
 /// </summary>
 /// <param name="game">The current GameRunner this system should be registered to.</param>
 protected BaseSharperSystem(IGameRunner game)
 {
     Components = new List <T>();
     game.RegisterSystem(this);
     Game = game;
 }
Ejemplo n.º 25
0
 public FooSystem(IGameRunner game, BarSystem barSystem) : base(game)
 {
     TestSwitch = false;
     _barSystem = barSystem;
 }
Ejemplo n.º 26
0
 public void StartGame(IGameRunner runner)
 {
     Runner = runner;
 }
 /// <param name="provider">The typeof <see cref="IDatabaseProvider"/> to use.</param>
 /// <param name="connectionString">The string for connecting to the database.</param>
 /// <param name="systems">The systems in the current <see cref="IGameRunner"/>.</param>
 /// <param name="runner">The <see cref="IGameRunner"/> for this game.</param>
 public PersistenceManager(Type provider, string connectionString, List <ISharperSystem> systems, IGameRunner runner)
 {
     _provider = (IDatabaseProvider)Activator.CreateInstance(provider, systems, runner);
     _provider.ConnectionString = connectionString;
 }
Ejemplo n.º 28
0
        public MainGameHub(IServiceProvider svp)
        {
            #region Main

            _svp      = svp;
            _hubCache = _svp.GetService <IMainGameHubLocalStorageCache>();

            #endregion

            #region Main User

            _gameUserService = _svp.GetService <IGameUserService>();
            _allianceService = _svp.GetService <IAllianceService>();
            _channelService  = (ChannelService)_svp.GetService <IChannelService>();

            _mothershipService = _svp.GetService <IMothershipService>();
            _motherJumpService = _svp.GetService <IUMotherJumpService>();
            _storeService      = _svp.GetService <IStoreService>();

            #endregion

            #region World

            _gameTypeService        = _svp.GetService <IGameTypeService>();
            _gGeometryPlanetService = _svp.GetService <IGGeometryPlanetService>();
            _gDetailPlanetService   = _svp.GetService <IGDetailPlanetService>();
            _gSectorsService        = _svp.GetService <IGSectorsService>();
            _mapInfoService         = _svp.GetService <IMapInfoService>();
            _systemService          = _svp.GetService <ISystemService>();
            _worldService           = _svp.GetService <IWorldService>();
            _gUserBookmarkService   = (GUserBookmarkService)_svp.GetService <IGUserBookmarkService>();

            #endregion

            #region builds

            //collections
            _commandCenter     = _svp.GetService <ICommandCenter>();
            _industrialComplex = _svp.GetService <IIndustrialComplex>();
            _laboratory        = _svp.GetService <ILaboratory>();
            _shipyard          = _svp.GetService <IShipyard>();


            //items
            _energyConverter  = _svp.GetService <IEnergyConverter>();
            _extractionModule = _svp.GetService <IExtractionModule>();
            _extractionModule = _svp.GetService <IExtractionModule>();
            _spaceShipyard    = _svp.GetService <ISpaceShipyard>();
            _storage          = _svp.GetService <IStorage>();
            _turels           = _svp.GetService <ITurels>();

            //common
            _unit                    = _svp.GetService <IUnit>();
            _storageResources        = _svp.GetService <IStorageResourcesService>();
            _transferResourceService = _svp.GetService <ITransferResourceService>();

            #endregion

            #region Global User

            _estateOwnService  = _svp.GetService <IEstateOwnService>();
            _synchronizer      = _svp.GetService <ISynchronizer>();
            _estateListService = _svp.GetService <IEstateListService>();
            _journalOutService = _svp.GetService <IJournalOutService>();
            _gameRunner        = _svp.GetService <IGameRunner>();
            _dbProvider        = _svp.GetService <IDbProvider>();

            #endregion

            #region Confederation

            _confederationService = _svp.GetService <IConfederationService>();

            #endregion
        }
Ejemplo n.º 29
0
 public GameObjectAsync(Game game, IGameRunner runner)
     : base(game)
 {
     this.Runner = runner;
 }