public Map(IGameData gameData) { this.gameData = gameData; Regions = new ObservableCollection <Region>(gameData.GetRegions()); adjacency = gameData.GetRegionAdjacencies(); //BackgroundDimensions = gameData.GetBackgroundDimensions(); }
public void Execute(string sessionID, string messageID, IGameData gameData) { if (InvalidIDString(sessionID)) { throw new InvalidSessionIDException(); } if (InvalidIDString(messageID)) { throw new InvalidMessageIDException(); } if (InvalidIDString(gameData.CurrentCardID)) { throw new InvalidCardIDException(); } _gameDataGateway.Save(sessionID, gameData); _publishMessageAdaptor.Publish(new GameResponse { SessionID = sessionID, MessageID = messageID, CardsToAdd = gameData.CardsToAdd, CurrentCardID = gameData.CurrentCardID, Seed = gameData.Seed, PackVersion = gameData.PackVersion, CurrentStats = gameData.CurrentStats }); }
public ReplayFileWriter(ILogger <ReplayFileWriter> logger, Settings settings, IHeroesProfileService heroesProfileService, IGameData gameData) { this.logger = logger; this.heroesProfileService = heroesProfileService; this.gameData = gameData; this.settings = settings; }
public ClanManager( IGameData gameData, INotificationManager notificationManager) { this.gameData = gameData; this.notificationManager = notificationManager; }
public ItemManager(IGameData gameData, IItemReader itemReader) { var file = gameData.Files[$"AM2_CPU"].Files[1]; file.Position = 0; var data = AmigaExecutable.Read(file).Last(h => h.Type == AmigaExecutable.HunkType.Data).Data; file = new DataReader(data); // First find the item offset (the lamed ailment is the first item) long offset = file.FindString("LAMED", 0); if (offset == -1) { offset = file.FindString("GELÄHMT", 0); } if (offset == -1) { throw new AmbermoonException(ExceptionScope.Data, "Could not find item data in AM2_CPU."); } offset -= 40; // item name has a 40 byte offset to the item data offset file.Position = (int)offset; for (uint i = 1; i <= 402; ++i) // there are 402 items { items.Add(i, Item.Load(itemReader, file)); } }
public PatreonManager( IGameData gameData, IPlayerInventoryProvider playerInventory) { this.gameData = gameData; this.playerInventory = playerInventory; }
private void InitializeControls() { if (!(objectManipulationInputController.CurrentlySelectedObject != null)) { return; } ManipulatableObject componentInParent = objectManipulationInputController.CurrentlySelectedObject.GetComponentInParent <ManipulatableObject>(); ObjectManipulator componentInParent2 = objectManipulationInputController.CurrentlySelectedObject.GetComponentInParent <ObjectManipulator>(); if (!(componentInParent2 != null)) { return; } switch (componentInParent.Type) { case DecorationLayoutData.DefinitionType.Structure: HideRotationControls(); HideScaleControls(); break; case DecorationLayoutData.DefinitionType.Decoration: { IGameData gameData = Service.Get <IGameData>(); Dictionary <int, DecorationDefinition> dictionary = gameData.Get <Dictionary <int, DecorationDefinition> >(); if (dictionary.ContainsKey(componentInParent.DefinitionId)) { DecorationDefinition def = dictionary[componentInParent.DefinitionId]; ConfigureScalingOptions(def, componentInParent2); ConfigureRotationOptions(def, componentInParent2); } break; } } }
public WebSocketConnection( ILogger logger, IRavenBotApiClient ravenBotApi, IIntegrityChecker integrityChecker, IPlayerInventoryProvider inventoryProvider, IGameData gameData, IGameManager gameManager, IGamePacketManager packetManager, IGamePacketSerializer packetSerializer, ISessionManager sessionManager, IExtensionWebSocketConnectionProvider extWsProvider, GameWebSocketConnectionProvider sessionProvider, WebSocket ws, SessionToken sessionToken) { this.receiveLoop = new Thread(ReceiveLoop); this.sendLoop = new Thread(SendLoop); this.gameLoop = new Thread(GameUpdateLoop); this.logger = logger; this.sessionToken = sessionToken; this.packetManager = packetManager; this.packetSerializer = packetSerializer; this.sessionManager = sessionManager; this.sessionProvider = sessionProvider; this.ws = ws; this.killTask = new TaskCompletionSource <object>(); this.gameProcessor = new GameProcessor( ravenBotApi, integrityChecker, this, extWsProvider, sessionManager, inventoryProvider, gameData, gameManager, sessionToken); }
private static void RecreateState(IGameData gameData) { if (gameData != null) { gameData.RecreateState(); } }
public BiologProgress(IGameData gameData, BiologLoadingProcess loadingProcess) { _unlockedEntries = new List <BiologEntry>(); _dataStorage = new TransientDataStorage();// PersistentDataStorage("biologProgress.txt"); _dataStorage.ReadData(); switch (loadingProcess) { case BiologLoadingProcess.UnlockAll: foreach (BiologEntry entry in gameData.BiologData.Entries) { _unlockedEntries.Add(entry); } break; case BiologLoadingProcess.UnlockNone: break; case BiologLoadingProcess.UseProgressData: _unlockedEntries = new List <BiologEntry>(); _dataStorage = new TransientDataStorage(); //new PersistentDataStorage("biologProgress.txt"); _dataStorage.ReadData(); foreach (KeyValuePair <string, object> value in _dataStorage) { _unlockedEntries.Add(gameData.BiologData.Entries.Find((e) => e.EntryName.Equals(value.Key))); } break; } }
protected void UpdateResources( IGameData gameData, DataModels.GameSession session, Character character, DataModels.Resources resources) { if (resources == null) { resources = new DataModels.Resources { Id = Guid.NewGuid(), }; gameData.Add(resources); character.ResourcesId = resources.Id; } var user = gameData.GetUser(character.UserId); var gameEvent = gameData.CreateSessionEvent(GameEventType.ResourceUpdate, session, new ResourceUpdate { UserId = user.UserId, FishAmount = resources.Fish, OreAmount = resources.Ore, WheatAmount = resources.Wheat, WoodAmount = resources.Wood, CoinsAmount = resources.Coins }); gameData.Add(gameEvent); }
public void Initialize(IGameData gameData) { _model = new T1(); _model.StateChanged += OnModelStateChanged; _model.Initialize(gameData, _configuration); _isInitialized = true; }
public MarketplaceService( IGameData gameData, IMarketplaceManager marketplaceManager) { this.gameData = gameData; this.marketplaceManager = marketplaceManager; }
public MapManager(IGameData gameData, IMapReader mapReader, ITilesetReader tilesetReader, ILabdataReader labdataReader) { foreach (var tilesetFile in gameData.Files["Icon_data.amb"].Files) { var tileset = Tileset.Load(tilesetReader, tilesetFile.Value); tilesets.Add((uint)tilesetFile.Key, tileset); tileset.Index = (uint)tilesetFile.Key; } // Map 1-256 -> File 1 // Map 300-369 -> File 2 // Map 257-299, 400-455, 513-528 -> File 3 for (int i = 1; i <= 3; ++i) { var file = gameData.Files[$"{i}Map_data.amb"]; var textFiles = gameData.Files[$"{i}Map_texts.amb"]; foreach (var mapFile in file.Files) { uint index = (uint)mapFile.Key; var textFile = textFiles.Files.ContainsKey(mapFile.Key) ? textFiles.Files[mapFile.Key] : null; maps.Add(index, Map.Load(index, mapReader, mapFile.Value, textFile, tilesets)); } } foreach (var labdataFile in gameData.Files["2Lab_data.amb"].Files) // Note: 2Lab_data.amb and 3Lab_data.amb both contain all lab data files { var labdata = Labdata.Load(labdataReader, labdataFile.Value, gameData); labdatas.Add((uint)labdataFile.Key, labdata); } }
public abstract void Process( IIntegrityChecker integrityChecker, IGameData gameData, IPlayerInventoryProvider inventoryProvider, DataModels.GameSession session, Character character, DataModels.CharacterState state);
public ItemManager( IMemoryCache memoryCache, IGameData gameData) { this.memoryCache = memoryCache; this.gameData = gameData; }
private async void RefreshGameInfo() { var bearer = "Bearer " + loginData.Access_Token; HttpClient _httpClient = new HttpClient(); _httpClient.DefaultRequestHeaders.Add("Authorization", bearer); var response = await _httpClient.GetAsync(Endpoint.GameById + gameData.Id); this.gameData = await response.Content.ReadAsAsync <OnlineGame>(); if (response.IsSuccessStatusCode) { this.LabelGameName.Content = gameData.Name; this.LabelGameState.Content = gameData.GameState; this.LabelFirstPlayer.Content = gameData.FirstPlayerName; this.LabelSecondPlayer.Content = gameData.SecondPlayerName; this.Button0.Content = gameData.Field[0] == '0' ? ' ' : gameData.Field[0]; this.Button1.Content = gameData.Field[1] == '0' ? ' ' : gameData.Field[1]; this.Button2.Content = gameData.Field[2] == '0' ? ' ' : gameData.Field[2]; this.Button3.Content = gameData.Field[3] == '0' ? ' ' : gameData.Field[3]; this.Button4.Content = gameData.Field[4] == '0' ? ' ' : gameData.Field[4]; this.Button5.Content = gameData.Field[5] == '0' ? ' ' : gameData.Field[5]; this.Button6.Content = gameData.Field[6] == '0' ? ' ' : gameData.Field[6]; this.Button7.Content = gameData.Field[7] == '0' ? ' ' : gameData.Field[7]; this.Button8.Content = gameData.Field[8] == '0' ? ' ' : gameData.Field[8]; } else { MessageBox.Show(await response.Content.ReadAsStringAsync()); } }
public static Models.GameSession Map(IGameData gameData, DataModels.GameSession data) { var session = DataMapper.Map <Models.GameSession, DataModels.GameSession>(data); var user = gameData.GetUser(session.UserId); if (user == null) { return(null); } var state = gameData.GetSessionState(session.Id); if (state != null) { session.ClientVersion = state.ClientVersion; session.SyncTime = state.SyncTime; } session.TwitchUserId = user.UserId; session.UserName = user.UserName; session.AdminPrivileges = user.IsAdmin.GetValueOrDefault(); session.ModPrivileges = user.IsModerator.GetValueOrDefault(); session.Players = gameData.GetSessionCharacters(data) .Select(x => Map(gameData, x)) .Where(x => x != null) .ToList(); return(session); }
public override void Handle( IIntegrityChecker integrityChecker, IGameData gameData, DataModels.GameSession session, Character character, CharacterState characterState) { var now = DateTime.UtcNow; var resources = gameData.GetResources(character.ResourcesId); var state = gameData.GetCharacterSessionState(session.Id, character.Id); if (now - state.LastTaskUpdate >= TimeSpan.FromSeconds(ResourceGatherInterval)) { session.Updated = DateTime.UtcNow; state.LastTaskUpdate = DateTime.UtcNow; if (resources.Ore >= OrePerIngot) { resources.Ore -= OrePerIngot; IncrementItemStack(gameData, session, character, IngotId); } if (resources.Wood >= WoodPerPlank) { resources.Wood -= WoodPerPlank; IncrementItemStack(gameData, session, character, PlankId); } UpdateResources(gameData, session, character, resources); } }
public RoomHandler( IGameData gameData, SnakeGenerator charGenerator, GameConfigurations configurations) : base(gameData.Room, configurations.RoomConfiguration) { _charGenerator = charGenerator; }
private static void UpdateGameData <T>(string name, Action onUpdated) where T : IGameData { GetJsonString(name, delegate(string data) { T[] _data = JsonReader.Deserialize <T[]>(data); IGameData[] _gameData = new IGameData[_data.Length]; for (int i = 0; i < _data.Length; i++) { _gameData[i] = _data[i]; } if (m_gameData.ContainsKey(typeof(T))) { m_gameData[typeof(T)] = _gameData; } else { m_gameData.Add(typeof(T), _gameData); } if (onUpdated != null) { onUpdated(); } }); }
//private static readonly Version ClientVersion_ClanLevel = new Version(0, 7, 1); public override void Process( IIntegrityChecker integrityChecker, IGameData gameData, IPlayerInventoryProvider inventoryProvider, GameSession session, Character character, CharacterState state) { var membership = gameData.GetClanMembership(character.Id); if (membership == null) { return; } var clan = gameData.GetClan(membership.ClanId); if (clan == null) { return; } UpdateClanExperience(gameData, session, clan); UpdateClanSkillsExperience(gameData, session, character, state, clan); }
private static ClanSkill GetTrainingSkill(IGameData gameData, CharacterState state, List <ClanSkill> clanSkills) { ClanSkill trainingSkill = null; foreach (var cs in clanSkills) { var skill = gameData.GetSkill(cs.SkillId); var task = state.Task; var taskArg = state.TaskArgument; if (string.IsNullOrEmpty(task)) { continue; } if (task.Equals(skill.Name, StringComparison.OrdinalIgnoreCase) || (!string.IsNullOrEmpty(taskArg) && taskArg.Equals(skill.Name, StringComparison.OrdinalIgnoreCase))) { trainingSkill = cs; break; } } return(trainingSkill); }
public void Execute(string sessionID, string messageID, IGameData gameData) { SessionID = sessionID; ExecuteCalled = true; MessageID = messageID; GameDataToSave = gameData; }
public Map(IGameData gameData) { this.gameData = gameData; Regions = new ObservableCollection<Region>(gameData.GetRegions()); adjacency = gameData.GetRegionAdjacencies(); //BackgroundDimensions = gameData.GetBackgroundDimensions(); }
public UserPlayerDeleteHandler( IGameData gameData, IWorldProcessor worldProcessor) { this.gameData = gameData; this.worldProcessor = worldProcessor; }
public void Execute(object parameter) { PuzzleEditScreen screen = (PuzzleEditScreen)parameter; screen.Editor.ResolveAmbiguity(); var facade = new PiCrossFacade(); bool am = false; foreach (IPuzzleEditorSquare square in screen.Editor.Grid.Items) { if (square.Ambiguity.Value == Ambiguity.Ambiguous) { am = true; break; } } if (!am) { IGameData gameData = facade.LoadGameData("../../../../python/picross.zip", true); Puzzle puzzle = screen.Editor.BuildPuzzle(); IPuzzleLibraryEntry entry = gameData.PuzzleLibrary.Create(puzzle, "Jonas"); screen.navigator.selectionScreen.cell.Value.Add(new PuzzleViewModel(entry)); screen.navigator.selectionScreen.PuzzleSizes.Add(puzzle.Size); screen.SwitchTo(new MenuScreen(screen.navigator)); } }
public ReplayAnalyzer(ILogger <ReplayAnalyzer> logger, Settings settings, IEnumerable <IFocusCalculator> calculators, IGameData gameData) { this.calculators = calculators; this.gameData = gameData; this.logger = logger; this.settings = settings; }
public static T[] LoadGameData <T>(string path, bool isForceUpdate = false) where T : IGameData { if (m_gameData.ContainsKey(typeof(T))) { if (!isForceUpdate) { return(GetAllGameData <T>()); } T[] _data = JsonReader.Deserialize <T[]>(GetJsonString(path)); m_gameData[typeof(T)] = new IGameData[_data.Length]; for (int i = 0; i < _data.Length; i++) { m_gameData[typeof(T)][i] = _data[i]; } return(GetAllGameData <T>()); } else { T[] _data = JsonReader.Deserialize <T[]>(GetJsonString(path)); IGameData[] _gameData = new IGameData[_data.Length]; for (int i = 0; i < _data.Length; i++) { _gameData[i] = _data[i]; } m_gameData.Add(typeof(T), _gameData); return(GetAllGameData <T>()); } }
public MultiplayerGameMoveHandler(Connection connection, User user, IGameHubContext gameHubContext, IGameData gameData) { _connection = connection; _user = user; _gameHubContext = gameHubContext; _gameData = gameData; }
public MenuViewModel(Action <Puzzle> puzzleScreenSwitcher) { var facade = new PiCrossFacade(); IGameData gameData = facade.CreateDummyGameData(); this.Choices = gameData.PuzzleLibrary.Entries.Select((IPuzzleLibraryEntry s) => new ChoiceViewModel(s.Puzzle, puzzleScreenSwitcher)); }
public Engine(IHacherGroupFactory hacherGroupFactory, IWarEffectFactory warEffect, IReader reader, IWriter writer, IGameData gameData) { this.hacherGroupFactory = hacherGroupFactory; this.warEffectFactory = warEffect; this.reader = reader; this.writer = writer; this.gameData = gameData; }
public Engine( IInputHandler reader, IOutputRenderer writer, IGameData gameData, ICommandManager commandManager) { this.Reader = reader; this.Writer = writer; this.GameData = gameData; this.CommandManager = commandManager; }
public GameEngine( IInputReader reader, IOutputWriter writer, IGameData data, IBlobFactory blobFactory) { this.reader = reader; this.writer = writer; this.data = data; this.blobFactory = blobFactory; }
public GameWindow(LoginData loginData, string placement, GameMode gameMode, OnlineGame gameData = null) { InitializeComponent(); this._placement = placement; this.gameMode = gameMode; this.loginData = loginData; if (gameMode == GameMode.Online) { this.gameData = gameData; this.LabelFirstPlayer.Content = gameData.FirstPlayerName; this.LabelSecondPlayer.Content = gameData.SecondPlayerName; this.LabelGameState.Content = gameData.GameState; this.LabelGameName.Content = gameData.Name; HubConnectAsync(); } else if (gameMode == GameMode.Multiplayer) { this.LabelFirstPlayer.Content = this.loginData.UserName; this.LabelGameName.Content = "Multiplayer"; this.LabelSecondPlayer.Content = "Other guy"; this.gameData = new MultiPlayerGame() { FirstPlayerName = this.loginData.UserName, SecondPlayerName = "Other guy", EnumGameState = GameState.FirstPlayer, Field = new String('0', 9), Name = "Multiplayer" }; } else if (gameMode == GameMode.Singleplayer) { this.LabelFirstPlayer.Content = this.loginData.UserName; this.LabelGameName.Content = "Singleplayer"; this.LabelSecondPlayer.Content = "Bot"; this.gameData = new SinglePlayerGame() { FirstPlayerName = this.loginData.UserName, EnumGameState = GameState.FirstPlayer, Field = new String('0', 9), Name = "Singleplayer" }; } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IGameData gameData) { Map = new Map(gameData); }
public DrawableComponent(IGameData game) : base(game) { this._device=game.GraphicsDevice; _contentManager = game.ContentManager; }
public UpdatableComponent(IGameData game) { this._game = game; _game.Components.Add(this); }
public ClosedQuestionsController(IGameData context) { this.data = context; }
public SceneModel(IGameData game) : base(game) { }
public Bloom(IGameData game) : base(game) { }
public BaseApiController(IGameData data) { this.data = data; }
public PlayersController(IGameData data) { this.data = data; }
private async void RefreshGameInfo() { var bearer = "Bearer " + loginData.Access_Token; HttpClient _httpClient = new HttpClient(); _httpClient.DefaultRequestHeaders.Add("Authorization", bearer); var response = await _httpClient.GetAsync(Endpoint.GameById + gameData.Id); this.gameData = await response.Content.ReadAsAsync<OnlineGame>(); if (response.IsSuccessStatusCode) { this.LabelGameName.Content = gameData.Name; this.LabelGameState.Content = gameData.GameState; this.LabelFirstPlayer.Content = gameData.FirstPlayerName; this.LabelSecondPlayer.Content = gameData.SecondPlayerName; this.Button0.Content = gameData.Field[0] == '0' ? ' ' : gameData.Field[0]; this.Button1.Content = gameData.Field[1] == '0' ? ' ' : gameData.Field[1]; this.Button2.Content = gameData.Field[2] == '0' ? ' ' : gameData.Field[2]; this.Button3.Content = gameData.Field[3] == '0' ? ' ' : gameData.Field[3]; this.Button4.Content = gameData.Field[4] == '0' ? ' ' : gameData.Field[4]; this.Button5.Content = gameData.Field[5] == '0' ? ' ' : gameData.Field[5]; this.Button6.Content = gameData.Field[6] == '0' ? ' ' : gameData.Field[6]; this.Button7.Content = gameData.Field[7] == '0' ? ' ' : gameData.Field[7]; this.Button8.Content = gameData.Field[8] == '0' ? ' ' : gameData.Field[8]; } else { MessageBox.Show(await response.Content.ReadAsStringAsync()); } }
/// <summary> /// Creates a new <see cref="GameDataEventArgs"/> instance /// </summary> /// <param name="gameData"></param> public GameDataEventArgs(IGameData gameData) { this.GameData = gameData; }
public OpenQuestionsController(IGameData context) { this.data = context; }
public GamesController(IGameData data) : base(data) { }