public GameScreen(Map gameMap, APlayer a, BPlayer b, CPlayer c, DPlayer d, Form menuForm) { this.menuForm = menuForm; map = gameMap; aPlayer = a; bPlayer = b; cPlayer = c; dPlayer = d; goldImages = new Image[4]; hiddenGoldImages = new Image[4]; cordNumberGuide = (squareEdge * 3) / 4; goldImages[0] = global::AltınOyunuCSharp.Properties.Resources.coin5; goldImages[1] = global::AltınOyunuCSharp.Properties.Resources.coin10; goldImages[2] = global::AltınOyunuCSharp.Properties.Resources.coin15; goldImages[3] = global::AltınOyunuCSharp.Properties.Resources.coin20; hiddenGoldImages[0] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin5; hiddenGoldImages[1] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin10; hiddenGoldImages[2] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin15; hiddenGoldImages[3] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin20; aPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerA_front; bPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerB_front; cPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerC_front; dPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerD_front; InitializeComponent(); }
public Arbiter() { isPlaying = true; currentPlayer = player1; currentPlayer.setLight(true); currentPlayer.changeTurn.Invoke(this, board); }
public int input(int x, int y) { if ((isPlaying == false) || x > 18 || y > 18 || x < 0 || y < 0 || board[x, y] != Board.e_cell.Empty) { return(0); } if (checkDoubleThrees && isDoubleThree(x, y, currentPlayer.color) == true) { return(0); } int returnValue = move(x, y, currentPlayer.color); if (returnValue == -1) { isPlaying = false; if (textMesh != null) { textMesh.text = currentPlayer.name + " wins"; } } else { currentPlayer.capturedPawns += returnValue; if (currentPlayer.capturedPawns >= 10) { isPlaying = false; if (textMesh != null) { textMesh.text = currentPlayer.name + " wins by capture"; } } } for (int i = 0; i < 18; i++) { for (int j = 0; j < 18; j++) { if (board[i, j] == currentPlayer.color) { if (isWinningMove(i, j, currentPlayer.color)) { returnValue = -1; } } } } currentPlayer.setLight(false); if (isPlaying) { currentPlayer = currentPlayer == player1 ? player2 : player1; currentPlayer.setLight(true); currentPlayer.changeTurn.Invoke(this, board); } return(returnValue == -1 ? 2 : 1); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { aBall = new ABall(graphics, ActorTag.Ball); aPlayer1 = new APlayer(graphics, ActorTag.Player1, PlayerIndex.One, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight - 20)); aPlayer2 = new APlayer(graphics, ActorTag.Player2, PlayerIndex.Two, new Vector2(graphics.PreferredBackBufferWidth / 2, 20)); base.Initialize(); }
void Start() { this.trans = transform; APlayer player = gameObject.GetComponent <APlayer>(); //A CORRIGERthis.Initialize(player.Items.Inventory, trans, //A CORRIGER player.Attributes, //A CORRIGER player.Items.AttributeInitializer); }
protected Action MediaStop; //视频播放结束后执行动作 public ControllerBase(APlayer player) { this.MediaPlayer = player; this.MediaPlayer.MediaStoped += MediaPlayer_MediaStoped; string path = Application.StartupPath + @"\Videos"; VideoSources = VideoItemDAL.GetVideoSources(path); udp = new NetUdp(); udp.UdpProcess(MessageProcess); }
public ScoreBoard(APlayer aPlayer, BPlayer bPlayer, CPlayer cPlayer, DPlayer dPlayer, Map map, Form gameForm) { this.aPlayer = aPlayer; this.bPlayer = bPlayer; this.cPlayer = cPlayer; this.dPlayer = dPlayer; this.map = map; this.gameForm = gameForm; InitializeComponent(); }
/// <summary> /// Pushes all cards played in a round to the bottom of the winning players stack. /// </summary> /// <param name="player">index of the winner in the player list</param> /// <param name="tmpPards">all cards played this round</param> /// <returns>true if game is over</returns> private bool PushCardsToWinner(int player, List <Card> tmpPards) { active = players[player]; active.PushCardsToBottom(tmpPards); if (active.Points == cardsInTheGame) { return(false); } return(true); }
public PlayerChoice(GameObject obj, float x, float y, APlayer player) { this._obj = MonoBehaviour.Instantiate(obj, new Vector3(x, y, 0), new Quaternion()) as GameObject; this._obj.gameObject.transform.SetParent(GameObject.Find("MenuUI").transform); this.Player = player; foreach(Transform child in this._obj.transform) { Object[] args = new Object[1]; args[0] = child; System.Type thisType = this.GetType(); MethodInfo theMethod = thisType.GetMethod(child.name); if (theMethod != null) theMethod.Invoke(this, args); } this._button = this._obj.GetComponent<HasClicked>(); }
public static void CreateNecromancerWindowWithTitle(string title, Rect rect, APlayer player, ref Rect initPosition) { Font oldFont = GUI.skin.label.font; GUI.skin.label.font = player.ServiceLocator.FontManager.Get("Necromancer"); GUI.DrawTexture(MultiResolutions.Rectangle(0, 0, initPosition.width, initPosition.height), player.ServiceLocator.TextureManager.GetGUITexture("window")); GUIExtension.AddSpikes((int)((initPosition.width) * Screen.width), initPosition.height); GUIExtension.FancyTop((int)((/*this.initPosition.x + */ initPosition.width) * Screen.width)); GUILayout.BeginArea(MultiResolutions.Rectangle(ref rect)); GUILayout.Space(Screen.height * 0.1f); GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.Label("<b>" + player.LanguageManager.GetText(title) + "</b>"); GUILayout.Label("", "Divider"); GUILayout.EndArea(); GUI.skin.label.font = oldFont; }
public bool AddExpectedPlayer(APlayer player) { if (_expectedPlayers.ContainsKey(player.Id) || PlayerList.ContainsKey(player.Id) || (PlayerCount == MaxPlayer && !player.IsSpectator)) { return(false); } if (!player.IsSpectator) { PlayerCount += 1; } _expectedPlayers.Add(player.Id, player); if (PlayerCount == MaxPlayer) { Joinable = false; } return(true); }
private void StartGame_Click(object sender, EventArgs e) { this.Hide(); int cordX = Int32.Parse(CordXNum.Text); int cordY = Int32.Parse(CordYNum.Text); int costA = Int32.Parse(aCostNum.Text); int costB = Int32.Parse(bCostNum.Text); int costC = Int32.Parse(cCostNum.Text); int costD = Int32.Parse(dCostNum.Text); int targetCostA = Int32.Parse(aTargetCostNum.Text); int targetCostB = Int32.Parse(bTargetCostNum.Text); int targetCostC = Int32.Parse(cTargetCostNum.Text); int targetCostD = Int32.Parse(dTargetCostNum.Text); int moveLenght = Int32.Parse(MoveLenghtNum.Text); int goldRate = Int32.Parse(GoldNum.Text); int privateGoldRate = Int32.Parse(PrivateGoldNum.Text); int startGold = Int32.Parse(StartGoldNum.Text); int cGoldShow = Int32.Parse(cGoldShowNum.Text); //Map Oluşturma this.map = new Map(cordY, cordX); // Player Modelleri // this.aPlayer = new APlayer(startGold, "A", 0, 0, costA, moveLenght, targetCostA, cordY, cordX); this.bPlayer = new BPlayer(startGold, "B", 0, (cordX - 1), costB, moveLenght, targetCostB, cordY, cordX); this.cPlayer = new CPlayer(startGold, "C", (cordY - 1), 0, costC, moveLenght, cGoldShow, targetCostC, cordY, cordX); this.dPlayer = new DPlayer(startGold, "D", (cordY - 1), (cordX - 1), costD, moveLenght, targetCostD, cordY, cordX); // Map Player Yerleşimi this.map.AddPlayer(0, 0, "A"); //Player A this.map.AddPlayer(0, (cordX - 1), "B"); //Player B this.map.AddPlayer((cordY - 1), 0, "C"); //Player C this.map.AddPlayer((cordY - 1), (cordX - 1), "D"); //Player D //Map Altın Yerleşimi this.map.AddAllGold(goldRate, privateGoldRate); GameScreen game = new GameScreen(this.map, this.aPlayer, this.bPlayer, this.cPlayer, this.dPlayer, this); game.Show(); }
public MediaController(APlayer player) : base(player) { setting = SettingDAL.GetSetting(); lightcontrol = LightConrolDAL.GetLights(); }
public void Play(APlayer player, float betValue, int numOfBets, uint numOfDecks = 8) { if (numOfBets <= 0) { Console.WriteLine("The number of bets must be positive integer. It will be set to 1"); } ShufflingMachine shufMachine = new ShufflingMachine(numOfBets, numOfDecks * 13); Croupier croupier = new Croupier(); for (int i = 0; i < numOfBets; i++) { shufMachine.Shuffle(); player.ResetScore(); croupier.InitSetScore(shufMachine.GetBlackjackCardWeight()); croupier.IncreaseScore(shufMachine.GetBlackjackCardWeight()); if (croupier.IsBlackjack()) { player.Lose(betValue); continue; } player.IncreaseScore(shufMachine.GetBlackjackCardWeight()); player.IncreaseScore(shufMachine.GetBlackjackCardWeight()); if (player.IsBlackjack()) { player.WinBlackjack(betValue); continue; } while (player.DoesHit(croupier.VisibleCardWeight) && !player.IsBust()) { player.IncreaseScore(shufMachine.GetBlackjackCardWeight()); } if (player.IsBust()) { player.Lose(betValue); continue; } while (croupier.Score < 17) { croupier.IncreaseScore(shufMachine.GetBlackjackCardWeight()); } if (croupier.IsBust()) { player.WinCasual(betValue); continue; } if (croupier.Score > player.Score) { player.Lose(betValue); } else if (croupier.Score < player.Score) { player.WinCasual(betValue); } } }
/// <summary> /// Sets the active player for the first turn. /// </summary> private void SetActivePlayerForFirstTurn() { int fst = rand.Next(0, players.Count); active = players[fst]; }