示例#1
0
        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;
        }
示例#2
0
 public UsersController(IUserService service,
                        IGameDataService gameDataService
                        )
 {
     _service         = service;
     _gameDataService = gameDataService;
 }
示例#3
0
        /// <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();
                }
            }
        }
示例#4
0
        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);
        }
示例#5
0
 public GameController(IGameDataService gameDataService, IPlayerRepository playerRepository, IGameHub gameHub, IGameService gameService)
 {
     this._gameDataService  = gameDataService;
     this._playerRepository = playerRepository;
     this._gameHub          = gameHub;
     this._gameService      = gameService;
 }
示例#6
0
        public VoteControllerTest()
        {
            _gameDataService   = Substitute.For <IGameDataService>();
            _gameStateProvider = Substitute.For <IGameStateProvider>();

            sut = new VoteController(_gameDataService, _gameStateProvider);
        }
示例#7
0
 public UnitBuilder(IConnectionService connectionService, IConstantManager constantManager,
                    IGameDataService gameDataService)
 {
     _connectionService = connectionService;
     _constantManager   = constantManager;
     _gameDataService   = gameDataService;
 }
示例#8
0
        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;
        }
示例#9
0
 public GameDataProvider(
     IGameDataService gameDataService,
     IGameRoundDataService gameRoundDataService)
 {
     this.gameDataService      = gameDataService;
     this.gameRoundDataService = gameRoundDataService;
 }
示例#10
0
 public HeroesManager(IGameDataService dataService)
 {
     _dataService = dataService;
     _heroes = new Dictionary<string, Hero>();
     _foes = new List<BattleCharacter>();
     AreDead = false;
 }
示例#11
0
 public ChoosePresidentGameState(IChoiceRoundRepository choiceRoundRepository,
                                 IChoiceRepository choiceRepository,
                                 IGameDataService gameDataService)
 {
     this._choiceRoundRepository = choiceRoundRepository;
     this._choiceRepository      = choiceRepository;
     this._gameDataService       = gameDataService;
 }
示例#12
0
        public GameServiceTest()
        {
            _policyRepository = Substitute.For <IPolicyRepository>();
            _playerRepository = Substitute.For <IPlayerRepository>();
            _gameDataService  = Substitute.For <IGameDataService>();

            sut = new GameService(_policyRepository, _playerRepository, _gameDataService);
        }
示例#13
0
        /// <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();
        }
示例#14
0
 public GameService(IPolicyRepository policyRepository,
                    IPlayerRepository playerRepository,
                    IGameDataService gameDataService)
 {
     this._policyRepository = policyRepository;
     this._playerRepository = playerRepository;
     this._gameDataService  = gameDataService;
 }
示例#15
0
 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);
        }
示例#17
0
        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();
        }
示例#18
0
        public ItemView()
        {
            this.InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            this.gameData = Module.Services.Get <IGameDataService>();
        }
示例#19
0
        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);
        }
示例#20
0
        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);
        }
示例#21
0
        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));
        }
示例#22
0
        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 = "";
        }
示例#23
0
        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);
            });
        }
示例#24
0
        public ItemView()
        {
            this.InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            this.ContentArea.DataContext = this;
            this.gameData = Services.Get <IGameDataService>();
        }
示例#25
0
        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();
        }
示例#26
0
        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();
        }
示例#27
0
        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();
        }
示例#28
0
        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;
        }
示例#29
0
        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;
        }
示例#30
0
        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();
        }
示例#31
0
        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();
        }
示例#32
0
        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();
        }
示例#33
0
        // 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;
            }
        }
示例#34
0
 public ItemLibrary(IGameDataService gameDataService)
 {
     _gameDataService = gameDataService;
     Equipments = new Dictionary<EquipmentData, int>();
 }
示例#35
0
 protected GamePlayer( IGameDataService service, Guid userId )
 {
     DataService = service;
       Guid = userId;
 }
示例#36
0
        /// <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();
              }
        }
示例#37
0
        /// <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();
        }
示例#38
0
文件: Unit.cs 项目: Ivony/HelloWorld
        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;
        }