//根据当前倍数和谁赢了算出应该扣的豆子 public static void GameResult(this JoyLdsRoom joyLdsRoom, int winSeatIndex) { bool isWinLandlord = winSeatIndex == joyLdsRoom.LandlordSeatIndex;//是不是地主赢了 List <bool> winningValue = new List <bool> { !isWinLandlord, !isWinLandlord, !isWinLandlord //如果是地主赢了 就模认全是为输钱 (赢钱) }; winningValue[joyLdsRoom.LandlordSeatIndex] = isWinLandlord; //然后把地主设为赢钱 (输钱) Actor_JoyLds_GameResult actorJoyLdsGameResult = new Actor_JoyLds_GameResult(); actorJoyLdsGameResult.WinSeatIndex = winSeatIndex; for (int i = 0; i < winningValue.Count; i++) { JoyLds_PlayerResult joyLdsPlayerResult = new JoyLds_PlayerResult(); joyLdsPlayerResult.SeatIndex = i; if (winningValue[i]) { if (isWinLandlord) { joyLdsPlayerResult.GetBeabs = (int)(joyLdsRoom.CurrMultiple * 2 * JoyLdsRoom.MultipleWinBeans);//自己赢了 地主赢了 自己就是地主 } else { joyLdsPlayerResult.GetBeabs = (int)(joyLdsRoom.CurrMultiple * JoyLdsRoom.MultipleWinBeans);//自己赢了 地主输了 自己就是农民 } } else { if (isWinLandlord) { joyLdsPlayerResult.GetBeabs = (int)(joyLdsRoom.CurrMultiple * -1 * JoyLdsRoom.MultipleWinBeans);//自己输了 地主赢了 自己就是农民 } else { joyLdsPlayerResult.GetBeabs = (int)(joyLdsRoom.CurrMultiple * -2 * JoyLdsRoom.MultipleWinBeans);//自己输了 地主输了 自己就是地主 } } actorJoyLdsGameResult.PlayerResults.Add(joyLdsPlayerResult); } joyLdsRoom.GameResultBroadcast(actorJoyLdsGameResult);//广播输赢消息 }
//广播结算消息 public static void GameResultBroadcast(this JoyLdsRoom joyLdsRoom, Actor_JoyLds_GameResult actorJoyLdsGameResult) { joyLdsRoom.BroadcastMssagePlayers(actorJoyLdsGameResult);//广播游戏结算的消息 }