public void GameCity_install_autoId() { var gameCity = new GameCity(_cityManager, new GameCityConfig()); Assert.NotEmpty(_gameCity_ticket_0.Id); Assert.NotEmpty(gameCity.Id); }
public void AddRoom_failed2(decimal money_) { GameCity gameCity = new GameCity("收费开房", _cityManager, ticketPrice_: 50); int preCount = gameCity.Rooms.Count; bool success = true; gameCity.FailAddRoomNotEnoughMoney += delegate { success = false; }; // gameCity.DAddRoomChek += delegate { return true; }; gameCity.AddRoom(_room); Assert.False(success); }
public GameCityTest() { _mock = new MockRepository(MockBehavior.Default); _playerFactory = _mock.Create <IPlayerJoinRoom>(); _roomFactory = _mock.Create <Room>(); _cityManager = _mock.Create <ICityManager>().Object; _gameCity_ticket_0 = new GameCity("拉斯维加斯", _cityManager); _gameCity_ticket_5 = new GameCity("拉斯维加斯", _cityManager, ticketPrice_: 5); _player = _mock.Create <IPlayerJoinRoom>().Object; _inningGame = _mock.Create <IInningeGame>().Object; _roomConfig = new RoomConfig(_inningGame); _room = new Room(DateTime.Now.AddHours(1), 10, _inningGame, _player, ticketPrice_: 50); }
private void PopulateBuildings(GameData data) { GameCountry country = GameManager.SystemManager.GameDataCollection.Countrys[data.TagCountry]; GameCity city = country.Regions.Values.Where(x => x.City.TagName == data.TagName).Select(x=>x.City).SingleOrDefault(); Texts["CityName"].GetComponent<Text>().text = city.Name; int count = 1; foreach (var chain in GameManager.SystemManager.GameDataCollection.AllBuildings.Values) { if (!Buildings.ContainsKey(chain.BuildingChain)) { Buildings.Add(chain.BuildingChain, CreateButton(_panel.transform, new Vector2(200, 20), new Vector2(0, -(30 * count)), chain.Name, delegate { OnCancel(); })); count++; } } foreach (var complete in city.ListOfCompleteBuilding.Values) { if (Buildings.ContainsKey(complete.BuildingChain)) { var go = Buildings[complete.BuildingChain]; go.GetComponentInChildren<Text>().text = city.ListOfPotentialBuilding[complete.UpgradesTo].Name; } } //int count = 1; //foreach (var value in city.ListOfPotentialBuilding.Values.Where(x=> string.IsNullOrEmpty(x.UpgradesFrom))) //{ // Buildings.Add(value.TagName, CreateButton(_panel.transform, new Vector2(200, 20), new Vector2(0, -(30 * count)), value.Name, // delegate { OnCancel(); })); // count++; //} //foreach (var value in city.ListOfCompleteBuilding.Values) //{ // // if Building is built and there is next level show that // CreateButton(_panel.transform, new Vector2(200, 20), new Vector2(0, -(30 * count)), value.Name, // delegate { OnCancel(); }); // count++; //} }
public void AddRoom_deductMoney(decimal money_) { var gameCityConfig = new GameCityConfig() { TicketPrice = 5 }; gameCityConfig.DAddRoomChek += delegate { return(true); }; GameCity gameCity = new GameCity(_cityManager, gameCityConfig); _playerFactory.Setup(p => p.Account).Returns(money_); _playerFactory.Setup(p => p.DecutMoney(5, "")); var room = new Room(_playerFactory.Object, _roomConfig); gameCity.AddRoom(room); _playerFactory.Verify(p => p.DecutMoney(gameCity.TicketPrice, "")); }
public void AddRoom_success(decimal money_, decimal ticket_) { _playerFactory.Setup(p => p.Account).Returns(money_); _playerFactory.Setup(p => p.DecutMoney(ticket_, "")).Returns(true); var player = _playerFactory.Object; var gameCityConfig = new GameCityConfig() { TicketPrice = ticket_ }; GameCity gameCity = new GameCity(_cityManager, gameCityConfig); var room = new Room(player, new RoomConfig(_inningGame)); bool result = false; gameCity.AfterAddRoomHandler += delegate { result = true; }; gameCity.AddRoom(room); Assert.True(result); }
public void CreatGameCity(List <IGameCity> gameCityList, Player cityManager, string cityName = "游戏城") { ICityManager cityManager_; if (cityManager != null) { cityManager_ = cityManager; } else { cityManager_ = ManagePlayer.GetOnlyInstance(); } IGameCityConfig config_ = new GameCityConfig() { Name = cityName }; IGameCity gameCity_ = new GameCity(cityManager_, config_); gameCityList.Add(gameCity_); }