public override void Play(GameModel gameModel) { this.returnedCard = null; Player player = gameModel.CurrentPlayer; CardModel choice = player.Chooser.ChooseOneCard(CardChoiceType.Ambassador, "Choose a card to return to the supply", Chooser.ChoiceSource.FromHand, player.Hand); if (choice != null) { Pile supply = gameModel.SupplyPiles.Where(pile => pile.Card.Name == choice.Name).FirstOrDefault(); if (supply != null) { List<CardModel> toReturn = new List<CardModel>(player.Hand.Where(card => card.Name == choice.Name).Take(2)); this.returnedCard = choice.GetType(); string[] choices = new string[toReturn.Count + 1]; for (int i = 0; i < choices.Length; i++) { choices[i] = i.ToString(); } int trashChoice = player.Chooser.ChooseOneEffect(EffectChoiceType.AmbassadorCount, choice, "Return how many to supply?", choices, choices); for (int i = 0; i < trashChoice; i++) { player.RemoveFromHand(toReturn[i]); supply.PutCardOnPile(toReturn[i]); } } } }
public override void Play(GameModel gameModel) { IEnumerable<int> c = gameModel.CurrentPlayer.Chooser.ChooseSeveralEffects(EffectChoiceType.TrustySteed, "Choose two:", 2, 2, choices, choiceDescriptions); foreach (int choice in c) { switch (choice) { case 0: gameModel.CurrentPlayer.Draw(); gameModel.CurrentPlayer.Draw(); break; case 1: gameModel.CurrentPlayer.AddActionCoin(2); break; case 2: gameModel.CurrentPlayer.GainActions(2); break; case 3: for (int i = 0; i < 4; i++) { gameModel.CurrentPlayer.GainCard(typeof(Silver)); } gameModel.CurrentPlayer.PutDeckInDiscard(); break; } } }
/// <summary> /// Generates the javascript code for the game described in the specified model. /// </summary> /// <param name="model">The model that describes the game.</param> public string GenerateGameCode(GameModel model) { if (model == null) throw new ArgumentNullException("model"); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; UpdateModules(model.Units); UpdateModules(model); var unitModules = new ModuleCollection(); foreach (var unit in model.Units) { unitModules = new ModuleCollection(unitModules.Union(unit.Modules, Module.Comparer)); } string background = model.Background.GenerateCode(); string modules = unitModules.GenerateUnitModulesCode() + "\n" + model.Modules.GenerateGameModulesCode(); string unitConstructors = GenerateUnitConstructors(); string units = unitConstructors + model.Units.GenerateCollectionCode((unit) => unit.GenerateCode()); string bindings = model.KeyBindings.GenerateCollectionCode((binding) => binding.GenerateCode()); string game = Regex.Replace(gameTemplate, BackgroundPlaceholder, background, RegexOptions.None); game = Regex.Replace(game, ModulesPlaceholder, modules, RegexOptions.None); game = Regex.Replace(game, UnitsPlaceholder, units, RegexOptions.None); game = Regex.Replace(game, KeyBindingsPlaceholder, bindings, RegexOptions.None); return game; }
public GameModel GameById(int id) { GameModel ret = new GameModel(); using (ADayInTheLifeEntities db = new ADayInTheLifeEntities()) { try { Game game = db.Games.Where(o => o.GameId == id).FirstOrDefault(); if (game == null) { throw new Exception(String.Format("Issue: Game {0} cannot be found", id)); } ret = new GameModel() { GameId = game.GameId, Players = game.Players, WinCondition1 = game.WinCondition1, WinCondition2 = game.WinCondition2, WinCondition3 = game.WinCondition3, WinCondition4 = game.WinCondition4 }; } catch (Exception e) { //TODO: Log This. } } return ret; }
public override void Play(GameModel gameModel) { for(int i=0;i<gameModel.RightOfCurrentPlayer.GainedLastTurn.Count;i++) { gameModel.CurrentPlayer.GainCard(typeof(Silver)); } }
public override void Play(GameModel gameModel) { List<CardModel> cards = gameModel.CurrentPlayer.DrawCards(5); if (cards.Count > 0) { gameModel.CurrentPlayer.RevealCards(cards); int lookAtCards = gameModel.CurrentPlayer.Chooser.ChooseOneEffect(EffectChoiceType.DiscardOrPutOnDeck, cards, "Discard them?", choices, choices); if (lookAtCards == 0) { IEnumerable<CardModel> order = gameModel.CurrentPlayer.Chooser.ChooseOrder(CardOrderType.OrderOnDeck, "Put them back in any order(first on top)", cards); foreach (CardModel card in order.Reverse()) { gameModel.CurrentPlayer.Deck.PlaceOnTop(card); } } else { foreach (CardModel card in cards) { gameModel.CurrentPlayer.DiscardCard(card); } } } }
void setTitle(GameModel game) { TitleTextScript titleText; // set title titleText = FindObjectOfType<TitleTextScript>(); titleText.setTitle ("Turn " + game.turn); }
public override void OnTrash(GameModel gameModel, Player owner) { if (gameModel.Trash.Remove(this.ThisAsTrashTarget)) { owner.PutInHand(this.ThisAsTrashTarget); } }
protected override void LoadContent() { var device = graphics.GraphicsDevice; spriteBatch = new SpriteBatch(GraphicsDevice); spaceship = new GameModel(Content.Load<Model>("spaceship")) { Position = new Vector3(0, 3500, 0), Scale = new Vector3(50f), BaseRotation = new Vector3(0, MathHelper.Pi, 0), Rotation = new Vector3(0, MathHelper.Pi, 0) }; models.Add(spaceship); var effect = Content.Load<Effect>("BasicTerrainEffect"); effect.Parameters["Texture"].SetValue(Content.Load<Texture2D>("grass")); ground = new Terrain( Content.Load<Texture2D>("heightmap1"), effect, 30, 4800, device ); models.Add(ground); camera = new ChaseCamera( new Vector3(0, 400, 1500), new Vector3(0, 200, 0), new Vector3(0, 0, 0), GraphicsDevice); }
public override void Play(GameModel gameModel) { Player currentPlayer = gameModel.CurrentPlayer; IEnumerable<int> c = currentPlayer.Chooser.ChooseSeveralEffects(EffectChoiceType.Pawn, "Choose 2", 2, 2, choices, choiceDescriptions); foreach (int choice in c) { switch (choice) { case 0: currentPlayer.Draw(); break; case 1: currentPlayer.AddActionCoin(1); break; case 2: currentPlayer.GainActions(1); break; case 3: currentPlayer.GainBuys(1); break; } } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach(Player player in attackedPlayers) { player.HasHauntedWoodsEffect.Add(gameModel.CurrentPlayer); } }
public override void OnBuy(GameModel gameModel) { foreach(CardModel card in gameModel.CurrentPlayer.Chooser.ChooseSeveralCards(Chooser.CardChoiceType.Trash, "Trash up to 2 cards you have in play", Chooser.ChoiceSource.InPlay, 0, 2, gameModel.CurrentPlayer.Played).ToArray()) { gameModel.CurrentPlayer.Trash(card); } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach (Player player in attackedPlayers) { CardModel topCard = player.DrawCard(); if (topCard != null) { if (topCard.Is(CardType.Victory)) { player.GainCard(typeof(Curse)); } else { gameModel.TextLog.WriteLine(player.Name + " reveals a " + topCard.Name + "."); int choice = gameModel.CurrentPlayer.Chooser.ChooseOneEffect(EffectChoiceType.GainForJester, topCard, "Who gains a copy?", choices, choices); if (choice == 0) { gameModel.CurrentPlayer.GainCard(topCard.GetType()); } else { player.GainCard(topCard.GetType()); } } player.DiscardCard(topCard); } } }
public async Task<IHttpActionResult> PutGameModel(int id, GameModel gameModel) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != gameModel.Id) { return BadRequest(); } db.Entry(gameModel).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GameModelExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach (Player player in attackedPlayers) { player.GainCard(gameModel.Ruins); } }
public override void Play(GameModel gameModel) { if (!gameModel.CardModifiers.Any(modifier => modifier.GetType() == typeof(PrincessCardModifier))) { gameModel.AddCardModifier(new PrincessCardModifier()); } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach (Player attacked in attackedPlayers) { this.DoAttack(gameModel.CurrentPlayer, attacked); } }
public MatchManager(GameModel gameModel, TimerQueue timedQ, EventBus eventBus, EventFactory eventFactory, List<string> levelPaths) { _pointsPerCity = 100; _pointsPerRemainingShots = 10; _currentLevelIndex = 0; _userScore = 0; _timerQ = timedQ; _gameModel = gameModel; _levels = new List<Level>(); _eventFactory = eventFactory; _eventBus = eventBus; foreach (string path in levelPaths) { try { _levels.Add(new Level(path)); } catch (Exception e) { Console.WriteLine("ERROR caught exception loading level from path: "+path+e.Message+e.StackTrace); } } //initiaize the first level _loadLevel(_levels[0]); }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach(Player player in attackedPlayers) { player.HasMinusOneCoinToken = true; } }
void Awake() { text = transform.FindChild("Text").gameObject; text.GetComponent<MeshRenderer>().sortingOrder = GetComponent<SpriteRenderer>().sortingOrder + 1; model = GameModel.GetInstance(); }
public override void Play(GameModel gameModel) { List<CardModel> drawnCards = new List<CardModel>(); CardModel drawnCard = gameModel.CurrentPlayer.DrawCard(); while (drawnCard != null && !drawnCard.Is(CardType.Treasure)) { drawnCards.Add(drawnCard); drawnCard = gameModel.CurrentPlayer.DrawCard(); } if (drawnCard != null) { gameModel.TextLog.WriteLine(gameModel.CurrentPlayer.Name + " reveals " + drawnCard.Name); int choice = gameModel.CurrentPlayer.Chooser.ChooseOneEffect(EffectChoiceType.TrashForLoan, drawnCard, "Trash it?", choices, choices); if (choice == 0) { gameModel.CurrentPlayer.Trash(drawnCard); } else { gameModel.CurrentPlayer.DiscardCard(drawnCard); } } foreach (CardModel card in drawnCards) { gameModel.CurrentPlayer.DiscardCard(card); } }
public GameRoom(Dictionary<IClientHolder, string> inputClients) { gameModel = new GameModel(logger); foreach(var client in inputClients) { client.Key.OnGetMessageFromClient += OnGetMessageFromClient; clients.Add(client.Key); clientNames.Add(client.Value); } gameContext.StartKyoku += StartKyoku; gameContext.Tsumo += Tsumo; gameContext.Dahai += Dahai; gameContext.Chi += Chi; gameContext.Pon += Pon; gameContext.Kakan += Kakan; gameContext.Daiminkan += Daiminkan; gameContext.Ankan += Ankan; gameContext.OpenDora += OpenDora; gameContext.Rinshan += Rinshan; gameContext.Reach += Reach; gameContext.ReachDahai += ReachDahai; gameContext.ReachAccept += ReachAccept; gameContext.Hora += Hora; gameContext.Ryukyoku += Ryukyoku; gameContext.Endkyoku += EndKyoku; gameContext.EndGame += EndGame; gameContext.CheckIsRyuKyoku += CheckIsRyukyoku; gameContext.CheckIsEndGame += CheckIsEndGame; }
protected void Awake() { model = GameModel.GetInstance(); display = GetComponent<ZombieSpriteDisplay>(); state = GetComponent<AbnormalState>(); Invoke("Groan", Random.Range(5f, 10f)); }
public override void Play(GameModel gameModel) { CardModel namedCard = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.NameACardForJourneyman, "Name a card", ChoiceSource.None, gameModel.AllCardsInGame); List<CardModel> match = new List<CardModel>(); List<CardModel> nonMatch = new List<CardModel>(); CardModel card = gameModel.CurrentPlayer.DrawCard(); while (card != null) { if (card.Name == namedCard.Name) { match.Add(card); } else { nonMatch.Add(card); if(nonMatch.Count == 3) { break; } } card = gameModel.CurrentPlayer.DrawCard(); } foreach (CardModel nonMatched in nonMatch) { gameModel.CurrentPlayer.PutInHand(nonMatched); } foreach (CardModel matched in match) { gameModel.CurrentPlayer.DiscardCard(matched); } }
public override void Play(GameModel gameModel) { if (!gameModel.CardModifiers.OfType<HighwayCardModifier>().Any(m => m.Source == this)) { gameModel.AddCardModifier(new HighwayCardModifier(this)); } }
public override void BeforePlay(GameModel gameModel) { if (this.mimic == null) { CardModel target = null; if (this.forceMimic != null) { target = this.forceMimic; } else { Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.BandOfMisfits, "Play Band of Misfits as...", gameModel.SupplyPiles.Where(p => p.GetCost() < gameModel.GetCost(this) && !p.CostsPotion && p.Count > 0 && p.Card.Is(CardType.Action))); if (pile != null) { target = (CardModel)Activator.CreateInstance(pile.TopCard.GetType()); } } if (target != null) { this.mimic = target; if (this.lockCount > 0) { this.forceMimic = target; } this.SetMimic(); } } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach (Player player in attackedPlayers) { player.GainCard(typeof(Curse)); } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { foreach (Player player in attackedPlayers) { player.DiscardTo(4); } }
public override void Play(GameModel gameModel) { List<CardModel> drawn = new List<CardModel>(); List<CardModel> setAside = new List<CardModel>(); do { CardModel card = gameModel.CurrentPlayer.DrawCard(); if (card == null) { break; } if (card.Is(CardType.Treasure)) { drawn.Add(card); } else { setAside.Add(card); } } while (drawn.Count < 2); foreach(CardModel card in drawn) { gameModel.CurrentPlayer.PutInHand(card); } foreach (CardModel card in setAside) { gameModel.CurrentPlayer.DiscardCard(card); } }
public List<GameModel> AllGames() { List<GameModel> ret = new List<GameModel>(); using (ADayInTheLifeEntities db = new ADayInTheLifeEntities()) { try { List<Game> games = db.Games.ToList(); foreach(Game g in games) { GameModel gm = new GameModel() { GameId = g.GameId, Players = g.Players, WinCondition1 = g.WinCondition1, WinCondition2 = g.WinCondition2, WinCondition3 = g.WinCondition3, WinCondition4 = g.WinCondition4 }; ret.Add(gm); } } catch (Exception e) { //TODOL: Log This } } return ret; }
public void DeleteGame(GameModel game) { GameContext.Remove(game); GameContext.SaveChanges(); }
public void AddGame(GameModel game) { GameContext.Add(game); GameContext.SaveChanges(); }
// set Start Auto Hp/Mp/Exp/Shutdown public static void AutoBuff(AccountModel Account, GameModel GameM) { Function Funcs = Account.Func; int TimeAutoHP = 0, hp = 0, mp = 0, exp = 0; try { while (MAPN.ProcessExists(Account.Pid) && Account.IsAuto) { try { TimeAutoHP = Account.AutoInput; if (Account.IsHp) { hp = Account.HpInput; if (Funcs.ReadHp() <= hp) { Funcs.SendKeyQ(); Thread.Sleep(10); } } if (Account.IsMp) { mp = Account.MpInput; if (Funcs.ReadMp() <= mp) { Funcs.SendKeyW(); Thread.Sleep(10); } } if (Account.IsExP) { exp = Account.ExpInput; if (Funcs.ReadExp() >= exp) { Account.IsAuto = false; GameM.Clients--; Console.Beep(); MessageBox.Show(Language.FullExp, Language.Set(Language.NotificationT, Account.Name)); } } if (Account.IsShutdown && Account.IsAutoTrain) { if (Funcs.ReadHp() <= Account.HpShutDown) { Account.IsAuto = false; Console.Beep(); Console.Beep(); Process.GetProcessById(Account.Pid).Kill(); } } Thread.Sleep(TimeAutoHP + 10); } catch (ThreadAbortException) { Account.IsAuto = false; break; } } } catch (ThreadAbortException) { Account.IsAuto = false; } }
public ControlAnt(IGameController gameController, PlayerModel playerModel, GameModel gameModel) { GameController = gameController; PlayerModel = playerModel; GameModel = gameModel; }
void UpdateModel() { gameModel = gameFightController.GetModel(); }
public void RegisterPlayer() { GameModel.RegisterPlayer(Playername.text, Password.text); HidePanels(); MainGame.SetActive(true); }
public override void EndTurn(GameModel model) { }
protected void Awake() { animator = GetComponentInChildren <Animator>(); model = GameModel.GetInstance(); grow = GetComponent <PlantGrow>(); }
private void CreateWorld(GameState state) { _model = new GameModel(state.Size.Item1, state.Size.Item2); _players = new ObservableCollection <Player>(state.Players); PlayerList.ItemsSource = _players; _gameGrid = new Grid(); _lineButtons = new List <Button>(); _squareGrids = new List <Grid>(); SetRowDefinitions(); SetColumnsDefinitions(); var lst = _model.GetAllElements().ToList(); foreach (var piece in lst) { var element = GetElementForPiece(piece); element.SetValue(Grid.RowProperty, piece.Row); element.SetValue(Grid.ColumnProperty, piece.Column); element.Tag = piece; _gameGrid.Children.Add(element); if (element is Button) { _lineButtons.Add(element as Button); } if (piece is Square) { var square = piece as Square; square.Completed += SquareCompleted; _squareGrids.Add(element as Grid); } } Board.Children.Clear(); Board.Children.Add(_gameGrid); foreach (var button in _lineButtons) { SetPieceColor(button); } foreach (var occupied in state.OccupiedLines) { var line = _model.GetElementAt(occupied.Row, occupied.Column) as Line; if (line != null) { line.Occupy(occupied.PlayerId); } var button = FindButton(occupied.Row, occupied.Column); SetPieceColor(button); var player = GetPlayer(occupied.PlayerId); if (player != null) { player.Score++; } } }
public GameController(GameDifficulty difficulty, PlayerType enemyType) { gm = new GameModel(new Player(PlayerType.Human, "X"), new Player(enemyType, "O"), difficulty); currentPlayer = gm.CurrentPlayer; }
public LevelSelectionState(GameModel gameModel) : base(gameModel) { _font = _content.Load <SpriteFont>("Fonts/Font"); _player = new Player(_content.Load <Texture2D>("Player/boy")) { Layer = 1.0f, Position = new Vector2(50, 500), }; var levelModel1 = new LevelModel() { Name = "Mountains", ScrollingBackgrounds = new List <ScrollingBackground>() { new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Trees"), _player, 60f) { Layer = 0.99f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Floor"), _player, 60f) { Layer = 0.9f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Hills_Front"), _player, 40f) { Layer = 0.8f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Hills_Middle"), _player, 30f) { Layer = 0.79f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Clouds_Fast"), _player, 25f, true) { Layer = 0.78f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Hills_Back"), _player, 0f) { Layer = 0.77f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Clouds_Slow"), _player, 10f, true) { Layer = 0.7f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Sky"), _player, 0f) { Layer = 0.1f, }, }, }; var levelModel2 = new LevelModel() { Name = "Snowy Mountains", ScrollingBackgrounds = new List <ScrollingBackground>() { new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Trees"), _player, 60f) { Layer = 0.99f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Floor"), _player, 60f) { Layer = 0.9f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Hills_Front"), _player, 40f) { Layer = 0.8f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Hills_Middle"), _player, 30f) { Layer = 0.79f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Clouds_Fast"), _player, 25f, true) { Layer = 0.78f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Hills_Back"), _player, 0f) { Layer = 0.77f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Clouds_Slow"), _player, 10f, true) { Layer = 0.7f, }, new ScrollingBackground(_content.Load <Texture2D>("ScrollingBackgrounds/Sky"), _player, 0f) { Layer = 0.1f, }, }, }; _components = new List <LevelSelector>() { new LevelSelector(_player, levelModel1) { Scale = 0.25f, Position = new Vector2(50, 50), }, new LevelSelector(_player, levelModel2) { Scale = 0.25f, Position = new Vector2(420, 50), }, }; }
public void GameStart(GameModel game, PlayerModel firstPlayer, PlayerModel secondPlayer, List <UserCardGroupDetailModel> firstCardGroup, List <UserCardGroupDetailModel> secondCardGroup, string firstUserProfession, string secondUserProfession) { #region 加载玩家卡组 UserContext firstUser = new UserContext { UserCode = firstPlayer.UserCode, Player = firstPlayer, IsActivation = true, IsFirst = true, AllCards = new List <Card>() }; List <Card> lstCardLib = _gameCache.GetAllCard(); int cardInGameIndex = 0; foreach (var cg in firstCardGroup) { Card libCard = lstCardLib.First(c => c.CardCode == cg.CardCode); var card = Activator.CreateInstance(libCard.GetType()) as Card; card.CardInGameCode = cardInGameIndex.ToString(); card.IsFirstPlayerCard = true; firstUser.AllCards.Add(card); cardInGameIndex++; } UserContext secondUser = new UserContext { UserCode = secondPlayer.UserCode, Player = secondPlayer, IsActivation = true, IsFirst = false, AllCards = new List <Card>() }; secondCardGroup.ForEach(delegate(UserCardGroupDetailModel detail) { Card libCard = lstCardLib.First(c => c.CardCode == detail.CardCode); var card = Activator.CreateInstance(libCard.GetType()) as Card; card.CardInGameCode = cardInGameIndex.ToString(); card.IsFirstPlayerCard = false; secondUser.AllCards.Add(card); cardInGameIndex++; }); //secondUser.StockCards = secondUser.AllCards; GameContext = new GameContext { Players = new List <UserContext>(), DeskCards = null, GameCode = game.GameCode, CurrentTurnCode = game.CurrentTurnCode, NextTurnCode = game.NextTurnCode, GameStatus = GameStatus.进行中, GameCache = _gameCache }; GameContext.Players.Add(firstUser); GameContext.Players.Add(secondUser); #endregion #region 初始化开场选牌 int firstPickUpCount = 4; List <int> lstRndIndex = RandomUtil.CreateRandomInt(0, GameContext.Players.First(c => c.IsFirst).AllCards.Count - 1, firstPickUpCount); for (int i = 0; i < lstRndIndex.Count; i++) { if (i < lstRndIndex.Count - 1) { //lstFirstPickUpCard.Add(GameContext.Players.First(c => c.IsFirst).AllCards[lstRndIndex[i]]); GameContext.Players.First(c => c.IsFirst).AllCards[lstRndIndex[i]].CardLocation = CardLocation.InitCard; } //lstSecondPickUpCard.Add(GameContext.Players.First(c => c.IsFirst == false).AllCards[lstRndIndex[i]]); GameContext.Players.First(c => c.IsFirst == false).AllCards[lstRndIndex[i]].CardLocation = CardLocation.InitCard; } BaseHero firstHero = null, secondHero = null; switch (firstUserProfession) { case "Druid": firstHero = new Druid(); break; case "Hunter": firstHero = new Hunter(); break; case "Mage": firstHero = new Mage(); break; case "Paladin": firstHero = new Paladin(); break; case "Priest": firstHero = new Priest(); break; case "Rogue": firstHero = new Rogue(); break; case "Shaman": firstHero = new Shaman(); break; case "Warlock": firstHero = new Warlock(); break; case "Warrior": firstHero = new Warrior(); break; } switch (secondUserProfession) { case "Druid": secondHero = new Druid(); break; case "Hunter": secondHero = new Hunter(); break; case "Mage": secondHero = new Mage(); break; case "Paladin": secondHero = new Paladin(); break; case "Priest": secondHero = new Priest(); break; case "Rogue": secondHero = new Rogue(); break; case "Shaman": secondHero = new Shaman(); break; case "Warlock": secondHero = new Warlock(); break; case "Warrior": secondHero = new Warrior(); break; } cardInGameIndex++; firstHero.CardLocation = CardLocation.场上; firstHero.CardInGameCode = cardInGameIndex.ToString(); firstHero.DeskIndex = 0; firstHero.IsFirstPlayerCard = true; firstUser.AllCards.Add(firstHero); cardInGameIndex++; secondHero.CardLocation = CardLocation.场上; secondHero.CardInGameCode = cardInGameIndex.ToString(); secondHero.DeskIndex = 8; secondHero.IsFirstPlayerCard = false; secondUser.AllCards.Add(secondHero); GameContext.DeskCards = new DeskBoard() { firstHero, null, null, null, null, null, null, null, secondHero, null, null, null, null, null, null, null }; #endregion GameContext.Settlement(); _gameCache.SetContext(GameContext); }
public void SubScore() { GameModel.GetGameModel().SubScore(); }
public int GetScore() { return(GameModel.GetGameModel().Score); }
void Awake() { _model = GameModel.GetInstance(); Time.timeScale = 1; }
public void AddScore() { GameModel.GetGameModel().AddScore(); }
public void setGameModel(GameModel model) { gameModel = model; }
public virtual void OnAdd(GameModel mod, int bx, int by) { owner = mod; blockPos.Set(bx, by); }
public PackmanController(GameModel gameModel) { this.gameModel = gameModel; }
public void Init(GameModel model) { _model = model; }
void Init(GameModel model) { CollsionArea.enabled = false; _model = model; }
void Start() { GameModel.LoadInventoryItems(); }
/// <summary> /// Called when a new GameModel is created, aka when things like Monkey Knowledge are applied to towers /// <br/> /// Equivalent to a HarmonyPostFix on GameModel_CreatedModded /// </summary> public virtual void OnNewGameModel(GameModel result, List <ModModel> mods) { }
/// <summary> /// Called when Game.instance.model is not null /// </summary> public virtual void OnGameModelLoaded(GameModel model) { }
public GameDetailMainViewModel(GameModel model) { GameModel = model; }
/// <summary> /// Called when a new GameModel is created, aka when things like Monkey Knowledge are applied to towers /// <br/> /// Equivalent to a HarmonyPostFix on GameModel_CreatedModded /// </summary> public virtual void OnNewGameModel(GameModel result) { }
public void Init() { _universeConfig = GameConfig.Get <UniverseConfig>(); GameModel.HandleGet <PlanetModel>(OnPlanetModel); }
void Start() { model = GameModel.Instance; }
void Awake() { text = transform.Find("Text").gameObject; text.GetComponent <MeshRenderer>().sortingOrder = 10001; model = GameModel.GetInstance(); }
public static void StartAuto(GameModel GameM, AccountModel iAccount, LoginModel LoginM) { try { if (!LoginM.Login) { iAccount.IsAuto = false; MessageBox.Show(Language.KichAccount, Language.Notification, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch { return; } try { if (iAccount.IsAuto) { GameM.Clients = GetNumberClient(GameM) - 1; if (LoginM.RegClient <= 0) { iAccount.IsAuto = false; MessageBox.Show(Language.ZeroClients, Language.Notification, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (GameM.Clients < LoginM.RegClient) { if (iAccount.Name == Language.NA) { MessageBox.Show(Language.NullChar, Language.Notification, MessageBoxButtons.OK, MessageBoxIcon.Stop); iAccount.IsAuto = false; return; } GameM.Clients++; if (iAccount.IsAutoBuff) { BuffSkill(iAccount, false); } iAccount.TAuto = new Thread(delegate() { AutoBuff(iAccount, GameM); }) { IsBackground = true }; iAccount.TAuto.Start(); iAccount.TAutoTrain = new Thread(delegate() { StartAll(iAccount); }) { IsBackground = true }; iAccount.TAutoTrain.Start(); } else { ReturnAll(iAccount, GameM); MessageBox.Show(Language.UserClients, Language.Notification); return; } } else { ReturnAll(iAccount, GameM); } } catch { iAccount.IsAuto = false; } }