public EquipmentSelector(ItemSlots slot) { this.slot = slot; this.InitializeComponent(); this.DataContext = this; IGameDataService gameData = Services.Get <IGameDataService>(); this.Selector.Items.Add(EquipmentBaseViewModel.NoneItem); this.Selector.Items.Add(EquipmentBaseViewModel.NpcbodyItem); // Special case for hands to also list props if (slot == ItemSlots.MainHand || slot == ItemSlots.OffHand) { foreach (IItem prop in Module.Props) { this.Selector.Items.Add(prop); } } foreach (IItem item in gameData.Items.All) { this.Selector.Items.Add(item); } this.ClassFilter = Classes.All; }
public UsersController(IUserService service, IGameDataService gameDataService ) { _service = service; _gameDataService = gameDataService; }
/// <summary> /// 从 JSON 数据中初始化对象 /// </summary> /// <param name="dataService">游戏数据服务</param> /// <param name="data">JSON 数据</param> internal void InitializeData(IGameDataService dataService, JObject data) { DataService = dataService; var transaction = BeginSaveTransaction(); bool exception = false; try { JsonObject.Merge(data); Initialize(); } catch { exception = true; throw; } finally { if (exception == false) { transaction.Dispose(); } } }
public IItem GetDyeItem() { if (this.Key == 0) { return(null); } if (this.item == null) { // This always causes an exception from within SC library. /*try * { * this.item = new ItemWrapper(this.Value.Item); * } * catch (Exception) * { * }*/ // use the item id lookup if (this.item == null) { IGameDataService gd = Services.Get <IGameDataService>(); this.item = gd.Items.Get(DyeToItemKey(this.Key)); } } return(this.item); }
public GameController(IGameDataService gameDataService, IPlayerRepository playerRepository, IGameHub gameHub, IGameService gameService) { this._gameDataService = gameDataService; this._playerRepository = playerRepository; this._gameHub = gameHub; this._gameService = gameService; }
public VoteControllerTest() { _gameDataService = Substitute.For <IGameDataService>(); _gameStateProvider = Substitute.For <IGameStateProvider>(); sut = new VoteController(_gameDataService, _gameStateProvider); }
public UnitBuilder(IConnectionService connectionService, IConstantManager constantManager, IGameDataService gameDataService) { _connectionService = connectionService; _constantManager = constantManager; _gameDataService = gameDataService; }
public GamePlayService( IGameDeckCardCollectionRepository gameDeckCardCollectionRepository, IGameDeckRepository gameDeckRepository, IGameRepository gameRepository, IMoveRepository moveRepository, ITurnRepository turnRepository, IDataMapper <GameDeckCardCollectionData, GameDeckCardCollectionModel> gameDeckCardCollectionMapper, IDataMapper <GameDeckData, GameDeckModel> gameDeckMapper, ICardService cardService, IGameDataService gameDataService, IGameValidator gameValidator, IMoveValidator moveValidator ) { _gameDeckCardCollectionRepository = gameDeckCardCollectionRepository; _gameDeckRepository = gameDeckRepository; _gameRepository = gameRepository; _moveRepository = moveRepository; _turnRepository = turnRepository; _gameDeckCardCollectionMapper = gameDeckCardCollectionMapper; _gameDeckMapper = gameDeckMapper; _cardService = cardService; _gameDataService = gameDataService; _gameValidator = gameValidator; _moveValidator = moveValidator; }
public GameDataProvider( IGameDataService gameDataService, IGameRoundDataService gameRoundDataService) { this.gameDataService = gameDataService; this.gameRoundDataService = gameRoundDataService; }
public HeroesManager(IGameDataService dataService) { _dataService = dataService; _heroes = new Dictionary<string, Hero>(); _foes = new List<BattleCharacter>(); AreDead = false; }
public ChoosePresidentGameState(IChoiceRoundRepository choiceRoundRepository, IChoiceRepository choiceRepository, IGameDataService gameDataService) { this._choiceRoundRepository = choiceRoundRepository; this._choiceRepository = choiceRepository; this._gameDataService = gameDataService; }
public GameServiceTest() { _policyRepository = Substitute.For <IPolicyRepository>(); _playerRepository = Substitute.For <IPlayerRepository>(); _gameDataService = Substitute.For <IGameDataService>(); sut = new GameService(_policyRepository, _playerRepository, _gameDataService); }
/// <summary> /// 从 JSON 数据中初始化对象 /// </summary> /// <param name="dataService">游戏数据服务</param> /// <param name="host">数据宿主</param> /// <param name="data">JSON 数据保存对象</param> internal void InitializeData(IGameDataService dataService, GameDataItem host, JsonDataObject data) { DataService = dataService; Host = host; _data = data; Initialize(); }
public GameService(IPolicyRepository policyRepository, IPlayerRepository playerRepository, IGameDataService gameDataService) { this._policyRepository = policyRepository; this._playerRepository = playerRepository; this._gameDataService = gameDataService; }
public GameService( IGameDataService gameDataService, IDispatcher dispatcher, ILogger logger) { this._gameDataService = gameDataService; _dispatcher = dispatcher; this._logger = logger; }
public GameControllerTest() { _gameDataService = Substitute.For <IGameDataService>(); _hubContext = Substitute.For <IHubContext <GameHub> >(); _playerRepository = Substitute.For <IPlayerRepository>(); _gameService = Substitute.For <IGameService>(); sut = new GameController(_gameDataService, _playerRepository, _hubContext, _gameService); }
internal GameViewModel(IGameDataService dataService) { this._dataService = dataService; dataService.GameStarted += dataService_GameStarted; Command_NewOfflineGame = new DelegatingCommand((p) => ExecuteCommand_NewOfflineGame(p as NewOfflineGameOptions)); _gameGroups = new ObservableCollection<GameGroup>(); GetGameGroups(); }
public ItemView() { this.InitializeComponent(); if (DesignerProperties.GetIsInDesignMode(this)) { return; } this.gameData = Module.Services.Get <IGameDataService>(); }
public HairSelectorDrawer(Appearance.Genders gender, Appearance.Tribes tribe, byte value) { this.InitializeComponent(); this.ContentArea.DataContext = this; IGameDataService gameData = Services.Get <IGameDataService>(); this.List.ItemsSource = gameData.CharacterMakeCustomize.GetHair(tribe, gender); this.List.SelectedItem = gameData.CharacterMakeCustomize.GetHair(tribe, gender, value); }
public GameListViewModel(IMvxNavigationService navigation, IGameDataService gameData, IUserCacheService cahche) { _navigation = navigation; _gameData = gameData; _cache = cahche; GamesList = new ObservableCollection <GameModel>(_cache.CachedUser.AvailableGames); ShowGamePageAsyncCommand = new MvxAsyncCommand(async() => await _navigation.Navigate <GameViewModel, GameModel>(SelectedGame)); AddGameCommand = new MvxCommand(AddGame, () => CanAddGame); }
public AppearanceEditor() { this.InitializeComponent(); this.ContentArea.DataContext = this; this.gameDataService = Services.Get <IGameDataService>(); this.GenderComboBox.ItemsSource = Enum.GetValues(typeof(Appearance.Genders)); this.RaceComboBox.ItemsSource = this.gameDataService.Races.All; this.AgeComboBox.ItemsSource = Enum.GetValues(typeof(Appearance.Ages)); }
public BattleGeneratorState(IGameDataService dataService, IHeroesService heroesService, GUI gui) { _dataService = dataService; _heroesService = heroesService; _gui = gui; _choices = _dataService.GetNames(DataType.Hero).ToList(); _choices.Add(FoeMenuTitle); _choices.Add(OK); _textBox = null; _heroMenuTitle = ""; }
internal MainPage() { this.InitializeComponent(); _dataService = _dataService ?? new OfflineGameDataService(); GameViewModel = new GameViewModel(_dataService); GameViewModel.StartNewGameHandler = new GameViewModel.GameNavigationHandler((gameInfo) => { GameDataStore?nullableGameDataStore = gameInfo.GameDataStore; Frame.Navigate(typeof(TwoPlayerGame), nullableGameDataStore); }); }
public ItemView() { this.InitializeComponent(); if (DesignerProperties.GetIsInDesignMode(this)) { return; } this.ContentArea.DataContext = this; this.gameData = Services.Get <IGameDataService>(); }
public NpcSelector() { this.InitializeComponent(); this.DataContext = this; IGameDataService gameData = Services.Get <IGameDataService>(); foreach (INpcResident npc in gameData.ResidentNPCs.All) { this.Selector.Items.Add(npc); } this.Selector.FilterItems(); }
public DyeSelector() { this.InitializeComponent(); this.DataContext = this; IGameDataService gameData = Module.Services.Get <IGameDataService>(); foreach (IDye item in gameData.Dyes.All) { this.Selector.Items.Add(item); } this.Selector.FilterItems(); }
public ModelTypeSelector() { this.InitializeComponent(); this.DataContext = this; IGameDataService gameData = Services.Get <IGameDataService>(); foreach (ModelTypes item in Module.ModelTypes) { this.Selector.Items.Add(item); } this.Selector.FilterItems(); }
public AppearancePage() { this.InitializeComponent(); this.ContentArea.DataContext = this; IGameDataService gameDataService = Module.Services.Get <IGameDataService>(); this.GenderComboBox.ItemsSource = new[] { Appearance.Genders.Masculine, Appearance.Genders.Feminine }; this.RaceComboBox.ItemsSource = gameDataService.Races.All; this.TribeComboBox.ItemsSource = gameDataService.Tribes.All; ColorData.GetSkin(Appearance.Tribes.Highlander, Appearance.Genders.Feminine); this.Gender = Appearance.Genders.Feminine; }
public GameDeckHelper( IGameDeckRepository gameDeckRepository, IDataMapper <GameDeckCardCollectionData, GameDeckCardCollectionModel> gameDeckCardCollectionMapper, IDataMapper <GameDeckData, GameDeckModel> gameDeckMapper, IGameDataService gameDataService, ICardService cardService ) { _gameDeckRepository = gameDeckRepository; _gameDeckCardCollectionMapper = gameDeckCardCollectionMapper; _gameDeckMapper = gameDeckMapper; _gameDataService = gameDataService; _cardService = cardService; }
public EquipmentSelector(ItemSlots slot) { this.slot = slot; this.InitializeComponent(); this.DataContext = this; IGameDataService gameData = Module.Services.Get <IGameDataService>(); this.Selector.Items.Add(EquipmentBaseViewModel.NoneItem); foreach (IItem item in gameData.Items.All) { this.Selector.Items.Add(item); } this.Selector.FilterItems(); }
public MainPanelController( IGameDataService gameDataService, ISyncService syncService, IFileService fileService, IYaasyncStatusService yaasyncStatusService, IYaasyncUpdateService yaasyncUpdateService, IScreenshotService screenshotService ) { _gameDataService = gameDataService; _syncService = syncService; _fileService = fileService; _yaasyncStatusService = yaasyncStatusService; _yaasyncUpdateService = yaasyncUpdateService; _screenshotService = screenshotService; _settings = fileService.readSettings(); }
public static void Initialize( GameRulesBase rules, IGameDataService dataService, IGameMessageService messageService ) { if ( rules == null ) throw new ArgumentNullException( "rules" ); if ( dataService == null ) throw new ArgumentNullException( "dataService" ); if ( messageService == null ) throw new ArgumentNullException( "messageService" ); GameRules = rules; DataService = dataService; MessageService = messageService; rules.Initialize(); DataService.Initialize(); }
// FIXME: learn new way // https://stackoverflow.com/questions/20099743/how-do-i-get-design-time-view-of-a-view-model-first-approach-with-ioc // This make design view but get wrong in Real mode //public GameViewModel() : this(new DesignGameDataService()) { } /// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public GameViewModel(IGameDataService dataService) { log.Info("Initialize"); TextTemplateConfig = TextTemplateType.OutLineKanaBottom; _dataService = dataService; DisplayTextCollection = _dataService.InitTextData(TextTemplateConfig); if (IsInDesignMode) { // Code runs in Blend --> create design time data. CardInfo = new WordCardInfo() { Word = "買う", Ruby = "かう", IsProcess = false, Hinshi = "動詞", Kaisetsu = new ObservableCollection <string>() { "1. 多,多数,许多。(たくさん。多くのもの。)", "2. 多半,大都。(ふつう。一般に。たいてい。)" } }; MainHeight = 800; MainWidth = 600; } else { // Code runs "for real" CardInfo = new WordCardInfo(); _mecabHelper = new MecabHelper(); _mojiHelper = new MojiDictApi(); _baiduHelper = new BaiduWebTranslator(); WordSearchCommand = new RelayCommand <SingleTextItem>(WordSearch, CanWordSearch); PopupCloseCommand = new RelayCommand(() => Messenger.Default.Send(new NotificationMessage("CloseCard"))); PinCommand = new RelayCommand(() => TextPanelPin = !TextPanelPin); TranslateCommand = new RelayCommand(FakeDoTranslate); TranslateTextList = new ObservableCollection <string>(); Textractor.SelectedDataEvent += SelectedDataEventHandler; } }
public ItemLibrary(IGameDataService gameDataService) { _gameDataService = gameDataService; Equipments = new Dictionary<EquipmentData, int>(); }
protected GamePlayer( IGameDataService service, Guid userId ) { DataService = service; Guid = userId; }
/// <summary> /// 从 JSON 数据中初始化对象 /// </summary> /// <param name="dataService">游戏数据服务</param> /// <param name="data">JSON 数据</param> internal void InitializeData( IGameDataService dataService, JObject data ) { DataService = dataService; var transaction = BeginSaveTransaction(); bool exception = false; try { JsonObject.Merge( data ); Initialize(); } catch { exception = true; throw; } finally { if ( exception == false ) transaction.Dispose(); } }
/// <summary> /// 从 JSON 数据中初始化对象 /// </summary> /// <param name="dataService">游戏数据服务</param> /// <param name="host">数据宿主</param> /// <param name="data">JSON 数据保存对象</param> internal void InitializeData( IGameDataService dataService, GameDataItem host, JsonDataObject data ) { DataService = dataService; Host = host; _data = data; Initialize(); }
public static Unit CreateUnit( IGameDataService dataService, UnitDescriptor descriptor, Guid owner, Coordinate coordinate, Guid id, string name ) { var data = new JObject() as dynamic; data.ID = id; data.Name = name; data.Owner = owner; data.Descriptor = descriptor.Guid; data.Coordinate = coordinate.ToString(); data.State = UnitActionState.Idle; data.Mobility = 0m; data.LastActTime = DateTime.UtcNow; var type = descriptor.InstanceType; var unit = (Unit) Activator.CreateInstance( type ); unit.InitializeData( dataService, data ); return unit; }