internal override void Display() { if (IsActive) { if (ImGui.Begin("New Game Setup", ref IsActive, _flags)) { ImGui.InputText("Game Name", nameInputBuffer, (uint)nameInputBuffer.Length); ImGui.InputText("Faction Name", factionNameInputBuffer, 16); ImGui.InputText("Password", passInputBuffer, 16); if (ImGui.RadioButton("Host Network Game", ref gameTypeButtonGrp, 1)) { selectedGameType = gameType.Nethost; } if (ImGui.RadioButton("Start Standalone Game", ref gameTypeButtonGrp, 0)) { selectedGameType = gameType.Standalone; } if (selectedGameType == gameType.Nethost) { ImGui.InputText("Network Port", netPortInputBuffer, 8); } if (ImGui.Button("Create New Game!")) { CreateNewGame(System.Text.Encoding.UTF8.GetString(nameInputBuffer)); } } else { MainMenuItems.GetInstance().IsActive = true; } ImGui.End(); } }
public void setGrid(gameType type, Difficulty level) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { dataGridView1.Rows[i].Cells[j].Value = ""; } } if (modoDeJuego != null || type == gameType.Standard) { if (modoDeJuego == null) { modoDeJuego = new ModoDeJuego(level); sudoku = modoDeJuego; } for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (modoDeJuego.mask[i, j] != 0) { dataGridView1.Rows[i].Cells[j].Value = modoDeJuego.mask[i, j]; } ColorMap[i, j] = Color.White; } } //this.Text += " - Standard " + (standard.diff == Difficulty.Easy ? "(easy) " : (standard.diff == Difficulty.Medium ? "(medium)" : "(hard)")); } LockCellMap(); }
/// <summary> /// It fills the highScorePanel with the highScore lists according to the input parameters. /// </summary> /// <param name="type"></param> /// <param name="diff"></param> public void setHighScoresPanel(gameType type, Difficulty diff) { lblScoresType.Text = type == gameType.Standard ? "Standard" : "Squiggly"; lblScoresDiff.Text = diff == Difficulty.Easy ? "Easy" : (diff == Difficulty.Medium ? "Medium" : "Hard"); int d = diff == Difficulty.Easy ? 0 : (diff == Difficulty.Medium ? 1 : 2); List <Label> visibleNames = new List <Label>(); visibleNames.Add(label2); visibleNames.Add(label5); visibleNames.Add(label7); visibleNames.Add(label9); visibleNames.Add(label11); List <Label> visibleTimes = new List <Label>(); visibleTimes.Add(label3); visibleTimes.Add(label4); visibleTimes.Add(label6); visibleTimes.Add(label8); visibleTimes.Add(label10); HighScores toBeShown = HS.HS[type][d]; for (int i = 0; i < toBeShown.highScores.Count; i++) { visibleNames[i].Text = toBeShown.highScores[i].player; visibleTimes[i].Text = (new TimeSpan(toBeShown.highScores[i].time * 10000000)).ToString(); } for (int i = toBeShown.highScores.Count; i < 5; i++) { visibleNames[i].Text = ""; visibleTimes[i].Text = ""; } }
public exampleMiniMaxBoard(gameType newType) : base(newType) { // This engine supports only 'normal' chess. if (newType != gameType.normal) throw new NotImplementedException(); }
/// <summary> /// This is used to generate a new HighScoreItem object, that needs to be added to the highScores lists. /// </summary> /// <param name="name"></param> /// <param name="ticks"></param> /// <param name="type"></param> /// <param name="diff"></param> public void submitHighScore(string name, int ticks, gameType type, Difficulty diff) { HighScoreItem item = new HighScoreItem(); item.player = name; item.time = ticks; HS.add(item, type, diff); }
public static DoktorChessAIBoard makeFromFEN(string FENString, gameType newType, boardSearchConfig searchConfig) { DoktorChessAIBoard newBoard = new DoktorChessAIBoard(newType, searchConfig); newBoard.makeFromFEN(FENString); return newBoard; }
public Form2(Form1 parent,int ticks,gameType type, Difficulty diff) { this.parent = parent; this.ticks = ticks; this.type = type; this.diff = diff; InitializeComponent(); name.Focus(); }
public Form2(Form1 parent, int ticks, gameType type, Difficulty diff) { this.parent = parent; this.ticks = ticks; this.type = type; this.diff = diff; InitializeComponent(); name.Focus(); }
public void changeToFFA() { for (int i = 0; i < playergo.Capacity; i++) { PlayerManager player_manager = players[i].GetComponent <PlayerManager>(); player_manager.Team = teams[i]; player_manager.gameObject.layer = LayerMask.NameToLayer("Player"); } Mode = GameManager.gameType.FFA; }
/// <summary> /// Create a new empty board using the supplied rule set. /// </summary> /// <param name="newType">gameType to make</param> protected baseBoard(gameType newType) { // Set the game type _type = newType; // Spawn all our squares for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) _squares[x, y] = new square(new squarePos(x, y)); } }
void Awake() { Instance = this; players = new List <PlayerManager>(); teams = new List <TeamType>(); Mode = startType; string OperatingSystem = SystemInfo.operatingSystem; if (OperatingSystem.StartsWith("Windows")) { Controls.SetMicrosoftMappings(); } Debug.Log(SystemInfo.operatingSystem); }
public DoktorChessAIBoard(gameType newType, boardSearchConfig newSearchConfig) : base(newType) { // Note that kings are captured, since none exist. _blackKingCaptured = true; _whiteKingCaptured = true; if (newSearchConfig.useThreatMap) coverLevel = new threatMap(this); else coverLevel = new disabledThreatMap(); coverLevel.checkStuff = newSearchConfig.checkThreatMapLots; _searchConfig = newSearchConfig; }
public void changeToOvT(PlayerManager input) { foreach (PlayerManager pm in players) { if (pm == input) { pm.Team = GameManager.TeamType.A; pm.gameObject.layer = LayerMask.NameToLayer("TeamAPlayer"); } else { pm.Team = GameManager.TeamType.B; pm.gameObject.layer = LayerMask.NameToLayer("TeamBPlayer"); } } Mode = GameManager.gameType.OvT; }
internal override void Display() { if (IsActive) { if (ImGui.Begin("New Game Setup", ref IsActive, _flags)) { ImGui.InputText("Game Name", _nameInputBuffer, 16); ImGui.InputText("SM Pass", _smPassInputbuffer, 16); ImGui.InputText("Faction Name", _factionInputBuffer, 16); ImGui.InputText("Password", _passInputBuffer, 16); ImGui.InputInt("Max Systems", ref _maxSystems); ImGui.InputInt("Master Seed:", ref _masterSeed); if (ImGui.RadioButton("Host Network Game", ref _gameTypeButtonGrp, 1)) { _selectedGameType = gameType.Nethost; } if (ImGui.RadioButton("Start Standalone Game", ref _gameTypeButtonGrp, 0)) { _selectedGameType = gameType.Standalone; } if (_selectedGameType == gameType.Nethost) { ImGui.InputText("Network Port", _netPortInputBuffer, 8); } if (ImGui.Button("Create New Game!") || _uiState.debugnewgame) { _uiState.debugnewgame = false; CreateNewGame(); } ImGui.End(); } else { MainMenuItems.GetInstance().SetActive(); } } }
// initializes lots of variables public Speed(Card[] deckOfCards, Drawable background, Texture2D selector, SpriteFont font, Player bottom, Player top, List<Texture2D> particles, gameType gameType, SoundEffect shuffling, SoundEffect playingcard, SoundEffectInstance shuffinstance, bool isSoundOn, bool isPowerUpOn, bool isVibrateOn, PowerUp powerup) : base(background) { myType = gameType; cardcounter = new int[52]; random = new Random(); _font = font; shuffle = shuffling; playcard = playingcard; shuffleinstance = shuffinstance; isHalted = false; isShaking = false; textures = particles; soundOn = isSoundOn; powerUpOn = isPowerUpOn; vibrateOn = isVibrateOn; ableToReBegin = true; ableToReBegin2 = true; freeze = powerup; freeze.isSeeable = false; base.Add(freeze); freeze.WhenPlayed(delegate(Player player) { player.Freeze(); Timer timer = new Timer(1); base.Add(timer); timer.SetTimer(0, 4, delegate() { player.UnFreeze(); }); freeze.Fade(4); if (player.isPlayer1) freeze.Move(Actions.ExpoMove, yourSelector.attributes.position, 1); else freeze.Move(Actions.ExpoMove, oppSelector.attributes.position, 1); }); you = bottom; opp = top; you.SelectedCardLeft += delegate(){ PlayCard(you, you.selector, lGameStack);}; you.SelectedCardRight += delegate() { PlayCard(you, you.selector, rGameStack); }; opp.SelectedCardLeft += delegate() { PlayCard(opp, opp.selector, lGameStack); }; opp.SelectedCardRight += delegate() { PlayCard(opp, opp.selector, rGameStack); }; you.score = 0; opp.score = 0; deck = new Card[deckOfCards.Length]; cards = new Card[deckOfCards.Length]; for (int i = 0; i < deckOfCards.Length; i++) { deck[i] = deckOfCards[i]; cards[i] = deckOfCards[i]; } for (int i = 0; i < cards.Length; i++) { cards[i].attributes.position = new Vector2(-100, 100); cards[i].isFaceUp = false; cards[i].isSeeable = true; cards[i].attributes.color = Color.White; cards[i].attributes.rotation = 0; cards[i].ClearTweeners(); cards[i].attributes.height = 180; cards[i].attributes.width = 130; deck[i].attributes.position = new Vector2(-100, 100); deck[i].isFaceUp = false; deck[i].isSeeable = true; deck[i].attributes.color = Color.White; deck[i].attributes.rotation = 0; deck[i].ClearTweeners(); deck[i].attributes.height = 180; deck[i].attributes.width = 130; } yourStack = new Pile(new Vector2(897, 675)); opponentStack = new Pile(new Vector2(127, 125)); lSpitStack = new Pile(new Vector2(217, 400)); rSpitStack = new Pile(new Vector2(807, 400)); lGameStack = new Pile(new Vector2(413, 400)); rGameStack = new Pile(new Vector2(610, 400)); yourCards = new Pile[5]; opponentCards = new Pile[5]; for (int i = 0; i < yourCards.Length; i++) { opponentCards[i] = new Pile(new Vector2(opponentStack.position.X + (i + 1) * 154, opponentStack.position.Y)); yourCards[i] = new Pile(new Vector2(yourStack.position.X - (i + 1) * 154, yourStack.position.Y)); } yourName = new Text(you.playerName + " - ", _font); yourName.height = 100; yourName.attributes.position = new Vector2((yourCards[3].position.X + yourCards[4].position.X)/2 - 20, (yourCards[3].position.Y + lGameStack.position.Y) / 2); yourName.isSeeable = true; yourName.attributes.color = Color.LightSkyBlue; yourName.attributes.depth = .02f; yourName.scale = new Vector2(.15f, .15f); oppName = new Text(" - " + opp.playerName, _font); oppName.height = 100; oppName.attributes.position = new Vector2((opponentCards[3].position.X + opponentCards[4].position.X)/2 + 20, (opponentCards[3].position.Y + lGameStack.position.Y) / 2); oppName.isSeeable = true; oppName.attributes.color = Color.Red; oppName.attributes.depth = .02f; oppName.scale = new Vector2(.15f, .15f); yourScore = new Text(you.score.ToString(), _font); yourScore.height = 100; yourScore.attributes.position = new Vector2(yourName.attributes.position.X + yourName.width/2 + 10, yourName.attributes.position.Y); yourScore.isSeeable = true; yourScore.attributes.color = Color.LightSkyBlue; yourScore.attributes.depth = .02f; yourScore.scale = new Vector2(.15f, .15f); oppScore = new Text(opp.score.ToString(), _font); oppScore.height = 100; oppScore.attributes.position = new Vector2(oppName.attributes.position.X - oppName.width/2 - 10, oppName.attributes.position.Y); oppScore.isSeeable = true; oppScore.attributes.color = Color.Red; oppScore.attributes.depth = .02f; oppScore.scale = new Vector2(.15f, .15f); for (int i = 0; i < cards.Length; i++) { base.Add(cards[i]); } oppSelector = new Drawable() { attributes = new Attributes() { texture = selector, position = new Vector2(-100, -100), color = Color.Red, height = 190, width = 140, depth = .11f, rotation = 0 } }; yourSelector = new Drawable() { attributes = new Attributes() { texture = selector, position = new Vector2(-100, -100), color = Color.LightSkyBlue, height = 190, width = 140, depth = .11f, rotation = 0 } }; base.Add(oppSelector); base.Add(yourSelector); if (myType == gameType.Marathon) { winningscore = 30; } //if (myType == gameType.Timed) //{ gameLength = 120; delayTimer = new Timer(1); delayTimer.SetTimer(0, 4, delegate() { if (speedState == gameState.GamePlay && lSpitStack.Count() != 0) { speedState = gameState.ReBeginning; Text delay = new Text("Delay", font) { attributes = new Attributes() { color = Color.Yellow, position = new Vector2(512, 400), depth = .001f, }, height = 400, }; base.Add(delay); delay.Fade(2); delay.WhenDoneFading(delegate() { BeginGame(); }); } }); //} }
public exampleRandom(gameType newType) : base(newType) { }
//Initializing the players, random or 1v1v1v1 void InitiatePlayers(gameType gmtype) { if (gmtype == gameType.FFA) { for (int i = 0; i < playergo.Capacity; i++) { GameObject go = Instantiate(playergo[i]); go.transform.position = startPosition[i]; PlayerManager team = go.GetComponent <PlayerManager>(); team.Team = teams[i]; team.StartPosition = startPosition[i]; team.player_id = i; //Debug.Log (team.Team); players.Add(team); playeringame.Add(go); } } else if (gmtype == gameType.TvT) { int teamA = 0; int teamB = 0; for (int i = 0; i < playergo.Capacity; i++) { GameObject go = Instantiate(playergo[i]); go.transform.position = startPosition[i]; PlayerManager team = go.GetComponent <PlayerManager>(); team.StartPosition = startPosition[i]; team.player_id = i; if (teamA == 2) { team.Team = TeamType.B; teamB++; } else if (teamB == 2) { team.Team = TeamType.A; teamA++; } else { int teamX = Mathf.RoundToInt(Random.Range(0f, 1f)); if (teamX == 0) { team.Team = TeamType.A; teamA++; } else { team.Team = TeamType.B; teamB++; } } players.Add(team); playeringame.Add(go); } } else if (gmtype == gameType.OvT) { int teamA = 0; int teamB = 0; for (int i = 0; i < playergo.Capacity; i++) { GameObject go = Instantiate(playergo[i]); go.transform.position = startPosition[i]; PlayerManager team = go.GetComponent <PlayerManager>(); team.StartPosition = startPosition[i]; team.player_id = i; if (teamA == 1) { team.Team = TeamType.B; teamB++; } else if (teamB == 3) { team.Team = TeamType.A; } else { int teamX = Mathf.RoundToInt(Random.Range(0f, 1f)); if (teamX == 0) { team.Team = TeamType.A; teamA++; } else { team.Team = TeamType.B; teamB++; } } players.Add(team); playeringame.Add(go); } } }
public void setGrid(gameType type, Difficulty level) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { dataGridView1.Rows[i].Cells[j].Value = ""; } } if (type == gameType.Standard) { squigglyGrid = null; PuzzleGenerator gen = new PuzzleGenerator(level); PuzzleGrid grid = gen.InitGrid(); standardSolver = new PuzzleSolver(); standardSolver.SolutionGrid = gen.SolutionGrid; standardGrid = new PuzzleGrid(); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (grid.Grid[i, j] != 0) { dataGridView1.Rows[i].Cells[j].Value = -grid.Grid[i, j]; } standardGrid.Grid[i, j] = -grid.Grid[i, j]; ColorMap[i, j] = Color.White; } } } else { standardGrid = null; schemeBuilder(); Random r = new Random(); int[,] scheme = Schemes[r.Next(6)]; bool Completed = false; CustomSquiggly squigglyGrid = null; squigglySolver = new SquigglySolver(scheme); while (squigglyGrid == null && !Completed) { squigglyGrid = Limex(() => new CustomSquiggly(scheme, level), 4000, out Completed); } for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (squigglyGrid.Grid[i, j] != 0) { dataGridView1.Rows[i].Cells[j].Value = -squigglyGrid.Grid[i, j]; } dataGridView1.Rows[i].Cells[j].Style.BackColor = colors[scheme[i, j]]; ColorMap[i, j] = colors[scheme[i, j]]; } } string rez = "$$$$$$ try\n"; for (int ii = 0; ii < 9; ii++) { for (int jj = 0; jj < 9; jj++) { rez += CustomSquiggly.solution[ii, jj] + " "; } rez += "\n"; } MessageBox.Show(rez); } LockCellMap(); }
/// <summary> /// Adds an entry to the map, according to the gameType and Difficulty parameters /// </summary> /// <param name="item">HighScoreItem to be added.</param> /// <param name="type">Standard or Squiggly</param> /// <param name="diff">Easy, Medium or Hard</param> /// <returns></returns> public bool add(HighScoreItem item, gameType type, Difficulty diff) { int d = diff == Difficulty.Easy ? 0 : (diff == Difficulty.Medium ? 1 : 2); return HS[type][d].add(item); }
/// <summary> /// Adds an entry to the map, according to the gameType and Difficulty parameters /// </summary> /// <param name="item">HighScoreItem to be added.</param> /// <param name="type">Standard or Squiggly</param> /// <param name="diff">Easy, Medium or Hard</param> /// <returns></returns> public bool add(HighScoreItem item, gameType type, Difficulty diff) { int d = diff == Difficulty.Easy ? 0 : (diff == Difficulty.Medium ? 1 : 2); return(HS[type][d].add(item)); }
/// <summary> /// Takes action according to the keyboard button pressed. /// - If it is a number from numpad or from the main keyboard, /// it writes it down or overwrites the current number in that field. /// - If it is up/down/left/right/tab/enter, /// it selects the respective cell. /// - If it is escape/backspace or delete, /// it deletes the value in the cell. /// - Else, it doesn't do anything. /// - It checks if the grid has been solved, /// and prompts a window according to the result. /// - If the grid is full but it isn't a valid solution to the game, /// it doesn't do anything. /// - If the grid is solved but the time does not make it in the top 5, /// it prompts a MessageBox /// - If the grid is solved AND the time makes it in the top 5, /// it prompts a new form, that asks for the player's name /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView_KeyDown(object sender, KeyEventArgs e) { if (standard == null && squiggly == null) { System.Media.SystemSounds.Asterisk.Play(); return; } if (dataGridView.SelectedCells.Count > 0) { var selected = dataGridView.SelectedCells[0]; int sel_i = selected.RowIndex; int sel_j = selected.ColumnIndex; if (CellMap[sel_i, sel_j] == LOCKED) { if (!(e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right)) { System.Media.SystemSounds.Asterisk.Play(); } return; } if (!(e.KeyValue >= 49 && e.KeyValue <= 57 || e.KeyValue >= 97 && e.KeyValue <= 105)) { if (e.KeyValue == 27 || e.KeyValue == 8 || e.KeyValue == 46) // Same as e.KeyCode == Keys.Enter etc. { selected.Value = ""; if (standard != null) { standard.userGrid[selected.RowIndex, selected.ColumnIndex] = 0; } else { squiggly.userGrid[selected.RowIndex, selected.ColumnIndex] = 0; } } else if (!(e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right)) { System.Media.SystemSounds.Asterisk.Play(); } } else { int value = -1; if (e.KeyValue >= 49 && e.KeyValue <= 57) { selected.Value = e.KeyValue - 48; value = e.KeyValue - 48; } else { selected.Value = e.KeyValue - 96; value = e.KeyValue - 96; } if (standard != null) { standard.userGrid[sel_i, sel_j] = value; } else if (squiggly != null) { squiggly.userGrid[sel_i, sel_j] = value; } highlightSelectedNumber(); } } if ((standard != null && Sudoku.isSolved(standard.userGrid, Standard.scheme)) || (squiggly != null && Sudoku.isSolved(squiggly.userGrid, squiggly.scheme))) { long time = ticks; timer.Stop(); DarkenGrid(); //MessageBox.Show("Congratulations!!!"); System.Media.SoundPlayer finishSoundPlayer = new System.Media.SoundPlayer(@"C:\Windows\Media\tada.wav"); System.Media.SoundPlayer finish_no_high_SoundPlayer = new System.Media.SoundPlayer(@"C:\Windows\Media\chimes.wav"); gameType type = standard == null ? gameType.Squiggly : gameType.Standard; Difficulty level = standard == null ? squiggly.diff : standard.diff; int d = level == Difficulty.Easy ? 0 : (level == Difficulty.Medium ? 1 : 2); SaveScoreHasAppeared = true; if (HS.HS[type][d].highScores.Count == 5 && ticks > HS.HS[type][d].highScores[4].time) { finish_no_high_SoundPlayer.Play(); MessageBox.Show("\t\tCongratulations!!! \n I'm sorry but you didn't make it in the top 5."); } else { finishSoundPlayer.Play(); Form2 form2 = new Form2(this, ticks, type, level); form2.Show(); form2.name.Focus(); } standard = null; squiggly = null; sudoku = null; } }
/// <summary> /// This is used to create a new game object, according to the given parameters, /// to fill the dataGridView with the starting values, /// and to update the text shown on the form. /// </summary> /// <param name="type"></param> /// <param name="level"></param> public void setGrid(gameType type, Difficulty level) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { dataGridView.Rows[i].Cells[j].Value = ""; } } if (standard != null || type == gameType.Standard) { if (standard == null) { squiggly = null; standard = new Standard(level); sudoku = standard; } for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (standard.mask[i, j] != 0) { dataGridView.Rows[i].Cells[j].Value = standard.mask[i, j]; } ColorMap[i, j] = Color.White; } } this.Text += " - Standard " + (standard.diff == Difficulty.Easy ? "(easy) " : (standard.diff == Difficulty.Medium ? "(medium)" : "(hard)")); } else { if (squiggly == null) { standard = null; schemeBuilder(); Random random = new Random(); squiggly = null; bool Completed = false; while (squiggly == null && !Completed) { squiggly = Limex(() => new Squiggly(level, Schemes[random.Next(0, Schemes.Count)]), 4000, out Completed); sudoku = squiggly; } } for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (squiggly.mask[i, j] != 0) { dataGridView.Rows[i].Cells[j].Value = squiggly.mask[i, j]; } dataGridView.Rows[i].Cells[j].Style.BackColor = colors[squiggly.scheme[i, j]]; ColorMap[i, j] = colors[squiggly.scheme[i, j]]; } } this.Text += " - Squiggly " + (squiggly.diff == Difficulty.Easy ? "(easy) " : (squiggly.diff == Difficulty.Medium ? "(medium)" : "(hard)")); } LockCellMap(); }
// initializes lots of variables public Speed(Card[] deckOfCards, Drawable background, Texture2D selector, SpriteFont font, Player bottom, Player top, List <Texture2D> particles, gameType gameType, SoundEffect shuffling, SoundEffect playingcard, SoundEffectInstance shuffinstance, bool isSoundOn, bool isPowerUpOn, bool isVibrateOn, PowerUp powerup) : base(background) { myType = gameType; cardcounter = new int[52]; random = new Random(); _font = font; shuffle = shuffling; playcard = playingcard; shuffleinstance = shuffinstance; isHalted = false; isShaking = false; textures = particles; soundOn = isSoundOn; powerUpOn = isPowerUpOn; vibrateOn = isVibrateOn; ableToReBegin = true; ableToReBegin2 = true; freeze = powerup; freeze.isSeeable = false; base.Add(freeze); freeze.WhenPlayed(delegate(Player player) { player.Freeze(); Timer timer = new Timer(1); base.Add(timer); timer.SetTimer(0, 4, delegate() { player.UnFreeze(); }); freeze.Fade(4); if (player.isPlayer1) { freeze.Move(Actions.ExpoMove, yourSelector.attributes.position, 1); } else { freeze.Move(Actions.ExpoMove, oppSelector.attributes.position, 1); } }); you = bottom; opp = top; you.SelectedCardLeft += delegate(){ PlayCard(you, you.selector, lGameStack); }; you.SelectedCardRight += delegate() { PlayCard(you, you.selector, rGameStack); }; opp.SelectedCardLeft += delegate() { PlayCard(opp, opp.selector, lGameStack); }; opp.SelectedCardRight += delegate() { PlayCard(opp, opp.selector, rGameStack); }; you.score = 0; opp.score = 0; deck = new Card[deckOfCards.Length]; cards = new Card[deckOfCards.Length]; for (int i = 0; i < deckOfCards.Length; i++) { deck[i] = deckOfCards[i]; cards[i] = deckOfCards[i]; } for (int i = 0; i < cards.Length; i++) { cards[i].attributes.position = new Vector2(-100, 100); cards[i].isFaceUp = false; cards[i].isSeeable = true; cards[i].attributes.color = Color.White; cards[i].attributes.rotation = 0; cards[i].ClearTweeners(); cards[i].attributes.height = 180; cards[i].attributes.width = 130; deck[i].attributes.position = new Vector2(-100, 100); deck[i].isFaceUp = false; deck[i].isSeeable = true; deck[i].attributes.color = Color.White; deck[i].attributes.rotation = 0; deck[i].ClearTweeners(); deck[i].attributes.height = 180; deck[i].attributes.width = 130; } yourStack = new Pile(new Vector2(897, 675)); opponentStack = new Pile(new Vector2(127, 125)); lSpitStack = new Pile(new Vector2(217, 400)); rSpitStack = new Pile(new Vector2(807, 400)); lGameStack = new Pile(new Vector2(413, 400)); rGameStack = new Pile(new Vector2(610, 400)); yourCards = new Pile[5]; opponentCards = new Pile[5]; for (int i = 0; i < yourCards.Length; i++) { opponentCards[i] = new Pile(new Vector2(opponentStack.position.X + (i + 1) * 154, opponentStack.position.Y)); yourCards[i] = new Pile(new Vector2(yourStack.position.X - (i + 1) * 154, yourStack.position.Y)); } yourName = new Text(you.playerName + " - ", _font); yourName.height = 100; yourName.attributes.position = new Vector2((yourCards[3].position.X + yourCards[4].position.X) / 2 - 20, (yourCards[3].position.Y + lGameStack.position.Y) / 2); yourName.isSeeable = true; yourName.attributes.color = Color.LightSkyBlue; yourName.attributes.depth = .02f; yourName.scale = new Vector2(.15f, .15f); oppName = new Text(" - " + opp.playerName, _font); oppName.height = 100; oppName.attributes.position = new Vector2((opponentCards[3].position.X + opponentCards[4].position.X) / 2 + 20, (opponentCards[3].position.Y + lGameStack.position.Y) / 2); oppName.isSeeable = true; oppName.attributes.color = Color.Red; oppName.attributes.depth = .02f; oppName.scale = new Vector2(.15f, .15f); yourScore = new Text(you.score.ToString(), _font); yourScore.height = 100; yourScore.attributes.position = new Vector2(yourName.attributes.position.X + yourName.width / 2 + 10, yourName.attributes.position.Y); yourScore.isSeeable = true; yourScore.attributes.color = Color.LightSkyBlue; yourScore.attributes.depth = .02f; yourScore.scale = new Vector2(.15f, .15f); oppScore = new Text(opp.score.ToString(), _font); oppScore.height = 100; oppScore.attributes.position = new Vector2(oppName.attributes.position.X - oppName.width / 2 - 10, oppName.attributes.position.Y); oppScore.isSeeable = true; oppScore.attributes.color = Color.Red; oppScore.attributes.depth = .02f; oppScore.scale = new Vector2(.15f, .15f); for (int i = 0; i < cards.Length; i++) { base.Add(cards[i]); } oppSelector = new Drawable() { attributes = new Attributes() { texture = selector, position = new Vector2(-100, -100), color = Color.Red, height = 190, width = 140, depth = .11f, rotation = 0 } }; yourSelector = new Drawable() { attributes = new Attributes() { texture = selector, position = new Vector2(-100, -100), color = Color.LightSkyBlue, height = 190, width = 140, depth = .11f, rotation = 0 } }; base.Add(oppSelector); base.Add(yourSelector); if (myType == gameType.Marathon) { winningscore = 30; } //if (myType == gameType.Timed) //{ gameLength = 120; delayTimer = new Timer(1); delayTimer.SetTimer(0, 4, delegate() { if (speedState == gameState.GamePlay && lSpitStack.Count() != 0) { speedState = gameState.ReBeginning; Text delay = new Text("Delay", font) { attributes = new Attributes() { color = Color.Yellow, position = new Vector2(512, 400), depth = .001f, }, height = 400, }; base.Add(delay); delay.Fade(2); delay.WhenDoneFading(delegate() { BeginGame(); }); } }); //} }
public void setGameType(gameType aGameType) { p_gameType = aGameType; }