public RtsClient(UnitySyncContext syncContext) { mSyncContext = syncContext; mWorkerCreationStateListener = new WorkerCreationStateListener(syncContext); mWorkerCreationStateListener.Created += (orders, info) => WorkerCreated?.Invoke(orders, info); mWorkerCreationStateListener.Destroyed += info => ObjectDestroyed?.Invoke(info); mBuildingTemplateCreationStateListener = new BuildingTemplateCreationStateListener(syncContext); mBuildingTemplateCreationStateListener.Created += (orders, info) => BuildingTemplateCreated?.Invoke(orders, info); mBuildingTemplateCreationStateListener.Destroyed += info => ObjectDestroyed?.Invoke(info); mCentralBuildingCreationStateListener = new CentralBuildingCreationListener(syncContext); mCentralBuildingCreationStateListener.Created += (orders, info) => CentralBuildingCreated?.Invoke(orders, info); mCentralBuildingCreationStateListener.Destroyed += info => ObjectDestroyed?.Invoke(info); mMiningCampCreationListener = new MiningCampCreationListener(syncContext); mMiningCampCreationListener.Created += (orders, info) => MiningCampCreated?.Invoke(orders, info); mMiningCampCreationListener.Destroyed += info => ObjectDestroyed?.Invoke(info); mBarrakCreationListener = new BarrakCreationListener(syncContext); mBarrakCreationListener.Created += (orders, info) => BarrakCreated?.Invoke(orders, info); mBarrakCreationListener.Destroyed += info => ObjectDestroyed?.Invoke(info); mRangedWarriorCreationStateListener = new RangedWarriorCreationStateListener(syncContext); mRangedWarriorCreationStateListener.Created += (orders, info) => RangedWarriorCreated?.Invoke(orders, info); mRangedWarriorCreationStateListener.Destroyed += info => ObjectDestroyed?.Invoke(info); mMeeleeWarriorCreationStateListener = new MeeleeWarriorCreationStateListener(syncContext); mMeeleeWarriorCreationStateListener.Created += (orders, info) => MeeleeWarriorCreated?.Invoke(orders, info); mMeeleeWarriorCreationStateListener.Destroyed += info => ObjectDestroyed?.Invoke(info); }
public Factory(Root root) { mServer = root.mServer; mSyncContext = root.SyncContext; mGame = root.mGame; mMap = root.MapView; mRangedWarriorPrefab = root.RangedWarriorPrefab; mMeeleeWarriorPrefab = root.MeeleeWarriorPrefab; mWorkerPrefab = root.WorkerPrefab; mBuildingTemplatePrefab = root.BuildingTemplatePrefab; mCentralBuildingPrefab = root.CentralBuildingPrefab; mMiningCampPrefab = root.MiningCampPrefab; mBarrakPrefab = root.BarrakPrefab; }
public void Listen(UnitySyncContext syncContext, IGameObjectFactory enemyFactory, Game game) { mServer = new Server(); mServer.Ports.Add(new ServerPort(IPAddress.Any.ToString(), GameUtils.GamePort, ServerCredentials.Insecure)); mServer.Services.Add(GameService.BindService(mGameService = new GameServiceImpl(game, enemyFactory, syncContext))); mGameService.MessageRecived += GameServiceOnMessageRecived; var meeleeWarriorService = new MeeleeWarriorServiceImpl(); MeeleeWarriorRegistrator = meeleeWarriorService; mServer.Services.Add(MeeleeWarriorService.BindService(meeleeWarriorService)); var rangedWarriorService = new RangedWarriorServiceImpl(); RangedWarriorRegistrator = rangedWarriorService; mServer.Services.Add(RangedWarriorService.BindService(rangedWarriorService)); var workerService = new WorkerServiceImpl(); WorkerRegistrator = workerService; mServer.Services.Add(WorkerService.BindService(workerService)); var buildingTemplateService = new BuildingTemplateServiceImpl(); BuildingTemplateRegistrator = buildingTemplateService; mServer.Services.Add(BuildingTemplateService.BindService(buildingTemplateService)); var centralBuildingService = new CentralBuildingServiceImpl(); CentralBuildingRegistrator = centralBuildingService; mServer.Services.Add(CentralBuildingService.BindService(centralBuildingService)); var miningCampService = new MiningCampServiceImpl(); MiningCampRegistrator = miningCampService; mServer.Services.Add(MiningCampService.BindService(miningCampService)); var barrakService = new BarrakServiceImpl(); BarrakRegistrator = barrakService; mServer.Services.Add(BarrakService.BindService(barrakService)); mServer.Start(); }
public GameServiceImpl(Game game, IGameObjectFactory serverFactory, UnitySyncContext syncContext) { mGame = game; mServerFactory = serverFactory; mSyncContext = syncContext; }
public MeeleeWarriorCreationStateListener(UnitySyncContext syncContext) : base(syncContext) { }
public Interpreter() { SyncCtx = new UnitySyncContext(this); InterpThread = new Thread(ThreadEntry); InterpThread.Start(); }
public CentralBuildingCreationListener(UnitySyncContext syncContext) : base(syncContext) { }
public WorkerCreationStateListener(UnitySyncContext syncContext) : base(syncContext) { }
public CommonCreationStateListener(UnitySyncContext syncContext) { mSyncContext = syncContext; }
public RangedWarriorCreationStateListener(UnitySyncContext syncContext) : base(syncContext) { }
public BuildingTemplateCreationStateListener(UnitySyncContext syncContext) : base(syncContext) { }
public MiningCampCreationListener(UnitySyncContext syncContext) : base(syncContext) { }
public BarrakCreationListener(UnitySyncContext syncContext) : base(syncContext) { }