public void OnCompare(ISFSObject response) { int winner = response.GetInt("winner"); int loster = response.GetInt("loster"); int seat = response.GetInt(RequestKey.KeySeat); int gold = response.GetInt("gold"); JhUserInfo losterInfo = GetPlayerInfo <JhUserInfo>(loster, true); JhUserInfo seatInfo = GetPlayerInfo <JhUserInfo>(seat, true); seatInfo.CoinA -= gold; seatInfo.AllBeat += gold; TotalBet += gold; losterInfo.IsFail = true; EventObj.SendEvent("TableViewEvent", "Bet", TotalBet); ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("Winner", GetLocalSeat(winner)); sendObj.PutInt("Loster", GetLocalSeat(loster)); sendObj.PutInt("Chair", GetLocalSeat(seat)); sendObj.PutInt("Gold", gold); sendObj.PutInt("AllBeat", seatInfo.AllBeat); SetSfsObjChips(seatInfo, sendObj, gold, BiPaiBeiShu); EventObj.SendEvent("PlayersViewEvent", "Compare", sendObj); EventObj.SendEvent("SoundEvent", "PersonSound", new JhSound.SoundData(JhSound.EnAudio.Compare, seatInfo.SexI)); }
public void On20Compare(ISFSObject response) { RStatus = RoomStatus.BiPai; int winner = response.GetInt("winseat"); string msg = response.GetUtfString("msg"); List <int> lostList = new List <int>(); foreach (var userInfo in UserInfoDict) { JhUserInfo jhUser = (JhUserInfo)userInfo.Value; if (jhUser.Seat != winner) { jhUser.IsFail = true; lostList.Add(userInfo.Key); } } ISFSObject sendObj = new SFSObject(); sendObj.PutUtfString("msg", msg); sendObj.PutIntArray("lostChair", lostList.ToArray()); EventObj.SendEvent("PlayersViewEvent", "AllBiPai", sendObj); EventObj.SendEvent("SoundEvent", "PlayerEffect", new JhSound.SoundData(JhSound.EnAudio.CompareAnimate)); }
protected override YxBaseGameUserInfo OnInitUser(ISFSObject userData) { var userInfo = new JhUserInfo(); userInfo.Parse(userData); return(userInfo); }
public void OnResult(ISFSObject response) { RStatus = RoomStatus.Over; int[] cards = response.GetIntArray("cards"); JhUserInfo self = GetPlayerInfo <JhUserInfo>(); self.Cards = cards; ISFSArray users = response.GetSFSArray("users"); for (int i = 0; i < users.Count; i++) { ISFSObject itemData = users.GetSFSObject(i); int seat = itemData.GetInt("seat"); JhUserInfo user = GetPlayerInfo <JhUserInfo>(seat, true); user.SetResult(itemData); } if (response.ContainsKey("compare")) { ISFSArray arr = response.GetSFSArray("compare"); for (int i = 0; i < arr.Size(); i++) { ISFSObject obj = arr.GetSFSObject(i); int seat = obj.GetInt("seat"); JhUserInfo uInfo = GetPlayerInfo <JhUserInfo>(seat, true); uInfo.Cards = obj.GetIntArray("cards"); int[] cards1 = obj.GetIntArray("cards"); Debug.LogError(" result cards " + uInfo.NickM + " " + cards1[0] + " " + cards1[1] + " " + cards1[2]); } } bool isWinner = false; ResultSfs = SFSArray.NewInstance(); foreach (var useinfo in UserInfoDict) { if (useinfo.Value.IsPlayingGame) { JhUserInfo jhUserInfo = ((JhUserInfo)useinfo.Value); ISFSObject obj = jhUserInfo.GetResultSfsObject(); obj.PutInt("Chair", useinfo.Key); if (useinfo.Key == 0 && jhUserInfo.IsWinner) { isWinner = true; } obj.PutBool("IsWinner", isWinner); ResultSfs.AddSFSObject(obj); } } EventObj.SendEvent("PlayersViewEvent", "Result", ResultSfs); ResultDelay = StartCoroutine(SendToResultView(ResultSfs)); EventObj.SendEvent("SoundEvent", "PlayerEffect", new JhSound.SoundData(isWinner ? JhSound.EnAudio.Win : JhSound.EnAudio.Lost)); }
protected void SetCurrenPlayerBeatMinAndMax(JhUserInfo userInfo, ISFSObject sendObj) { JhSendObjAdd.GetBeatMinAndMix data = new JhSendObjAdd.GetBeatMinAndMix(); data.UserInfo = userInfo; data.SignleBet = SingleBet; data.PlayerGold = IsCreatRoom ? JhFunc.MaxInt : userInfo.CoinA; data.SendObj = sendObj; EventObj.SendEvent("SendObjAddEvent", "GetBeatMinAndMax", data); }
protected void SetSfsObjChips(JhUserInfo userInfo, ISFSObject sendObj, int gold, int baseCnt = 1) { JhSendObjAdd.GetChipData data = new JhSendObjAdd.GetChipData(); data.Gold = gold; data.SendObj = sendObj; data.UserInfo = userInfo; data.AnteRate = AnteRate; EventObj.SendEvent("SendObjAddEvent", "GetChip", data); }
protected void SendGameStatusToTableView() { ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("SingleBet", SingleBet); JhUserInfo user = GetPlayerInfo <JhUserInfo>(); if (RStatus <= RoomStatus.CanStart) { if (user.IsReady == false) { sendObj.PutInt("ShowReady", 1); } #if UNITY_IPHONE || UNITY_ANDROID if (IsCreatRoom && CreateRoomInfo.CurRound <= 0) { sendObj.PutInt("ShowWx", 1); } #endif } else { sendObj.PutInt("TotalBeat", TotalBet); } sendObj.PutBool("IsFangKa", IsCreatRoom); if (IsCreatRoom) { if (BankerSeat == SelfSeat) { if (RStatus != RoomStatus.CanStart) { sendObj.PutBool("ShowStart", false); } else { sendObj.PutBool("ShowStart", true); } } sendObj.PutInt("RoomId", CreateRoomInfo.RoomId); sendObj.PutInt("MaxJu", CreateRoomInfo.MaxRound); sendObj.PutInt("CurJu", CreateRoomInfo.CurRound); sendObj.PutInt("Ante", AnteRate[0]); } sendObj.PutInt("MaxLun", maxRound); sendObj.PutInt("CurLun", CurRound); if (RStatus > RoomStatus.CanStart) { sendObj.PutBool("HideReadyTip", true); } EventObj.SendEvent("TableViewEvent", "Status", sendObj); }
public void OnCurPlayer(ISFSObject response) { LastTime = JhFunc.GetTimeStamp(false); CurrenPlayer = response.GetInt("p"); CurRound = response.GetInt("round"); CdTime = response.GetInt("cd"); SingleBet = response.GetInt("minGold"); if (response.ContainsKey("look")) { IsCanLook = response.GetBool("look"); } if (response.ContainsKey("compare")) { IsCanCompare = response.GetBool("compare"); } if (response.ContainsKey("giveup")) { IsCanGiveUp = response.GetBool("giveup"); } JhUserInfo curUser = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true); if (response.ContainsKey("gzyz")) { curUser.IsGzyz = response.GetBool("gzyz"); } ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("Chair", GetLocalSeat(CurrenPlayer)); SetSfsUserContrl(sendObj); sendObj.PutDouble("CdTime", CdTime); sendObj.PutInt("SingleBet", SingleBet); if (CurrenPlayer == SelfSeat) { if (!curUser.IsGzyz && IsAutoFollow) { sendObj.PutDouble("CdTime", 2.0f); } } SetCurrenPlayerBeatMinAndMax(curUser, sendObj); EventObj.SendEvent("PlayersViewEvent", "CurrPlayer", sendObj); sendObj.PutInt("MaxLun", maxRound); sendObj.PutInt("CurLun", CurRound); EventObj.SendEvent("TableViewEvent", "CurrPlayer", sendObj); }
public void OnReady(int localSaet, ISFSObject data) { JhUserInfo uInfo = GetPlayerInfo <JhUserInfo>(localSaet); uInfo.IsReady = true; if (localSaet == 0) { EventObj.SendEvent("TableViewEvent", "Ready", null); } EventObj.SendEvent("PlayersViewEvent", "Ready", localSaet); EventObj.SendEvent("SoundEvent", "PersonSound", new JhSound.SoundData(JhSound.EnAudio.Ready, uInfo.SexI)); }
public void OnQiPai(ISFSObject response) { int qpSeat = response.GetInt("seat"); JhUserInfo uinfo = GetPlayerInfo <JhUserInfo>(qpSeat, true); uinfo.IsGiveUp = true; EventObj.SendEvent("PlayersViewEvent", "GiveUp", GetLocalSeat(qpSeat)); Random rd = new Random(); var index = rd.Next(1, 3); EventObj.SendEvent("SoundEvent", "PersonSound", new JhSound.SoundData(JhSound.EnAudio.GiveUp, uinfo.SexI, index)); }
public void OnGenZhu(ISFSObject response) { int genSeat = response.GetInt(JhRequestConstKey.KeySeat); int gold = response.GetInt("gold"); JhUserInfo uinfo = GetPlayerInfo <JhUserInfo>(genSeat, true); uinfo.CoinA -= gold; TotalBet += gold; uinfo.AllBeat += gold; EventObj.SendEvent("TableViewEvent", "Bet", TotalBet); bool isAdd = false; if (uinfo.IsLook) { if (gold / 2 != SingleBet) { isAdd = true; } } else { if (gold != SingleBet) { isAdd = true; } } if (!isAdd) { uinfo.AddCnt++; } ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("Chair", GetLocalSeat(genSeat)); SetSfsObjChips(uinfo, sendObj, gold); sendObj.PutInt("Gold", gold); sendObj.PutInt("AllBeat", uinfo.AllBeat); EventObj.SendEvent("PlayersViewEvent", "Bet", sendObj); EventObj.SendEvent("SoundEvent", "PersonSound", new JhSound.SoundData(isAdd ? JhSound.EnAudio.Add : JhSound.EnAudio.Follow, uinfo.SexI, uinfo.AddCnt > 3?3:uinfo.AddCnt)); EventObj.SendEvent("SoundEvent", "PlayerEffect", new JhSound.SoundData(JhSound.EnAudio.Chip)); }
/**** * 公共 sfs 组合 */ protected void SetSfsUserContrl(ISFSObject sendObj) { JhUserInfo userInfo = GetPlayerInfo <JhUserInfo>(); sendObj.PutBool("IsCanLook", IsCanLook && !userInfo.IsLook); sendObj.PutBool("IsCanGiveup", IsCanGiveUp && (!userInfo.IsGiveUp || userInfo.IsFail)); //如果是开发 不用在意金币 bool compare = IsCanCompare && (IsCreatRoom || (userInfo.IsLook ? SingleBet * 2 * BiPaiBeiShu : SingleBet * BiPaiBeiShu) < userInfo.CoinA); sendObj.PutBool("IsCanCompare", compare); sendObj.PutBool("IsUserPlaying", userInfo.IsPlaying()); sendObj.PutBool("ShowCard", userInfo.ShowCards()); sendObj.PutBool("IsGzyz", userInfo.IsGzyz); sendObj.PutBool("IsAutoFollow", IsAutoFollow); }
private void OnCompareClick(object data) { List <int> chair = new List <int>(); foreach (var info in UserInfoDict) { JhUserInfo userInfo = info.Value as JhUserInfo; if (userInfo != null && userInfo.IsPlaying() && userInfo.Seat != SelfSeat) { chair.Add(GetLocalSeat(userInfo.Seat)); } } EventObj.SendEvent("PlayersViewEvent", "CompareUsers", chair); }
public void OnShowCard(ISFSObject response) { int seat = response.GetInt(JhRequestConstKey.KeySeat); JhUserInfo player = GetPlayerInfo <JhUserInfo>(seat, true); player.IsShowCards = true; player.Cards = response.GetIntArray("cards"); ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("Chair", GetLocalSeat(seat)); sendObj.PutIntArray("Cards", player.Cards); SetSfsUserContrl(sendObj); EventObj.SendEvent("PlayersViewEvent", "LiangPai", sendObj); }
public override void ResetData() { base.ResetData(); foreach (var userInfo in UserInfoDict) { JhUserInfo use = (JhUserInfo)userInfo.Value; use.ResetUserStatus(); } SingleBet = 0; TotalBet = 0; IsCanLook = false; IsCanGiveUp = false; LastTime = 0; CdTime = 0; IsCanCompare = false; IsAutoFollow = false; CurRound = 0; }
public void OnLookCards(ISFSObject response) { LastTime = JhFunc.GetTimeStamp(false); int seat = response.GetInt("seat"); JhUserInfo uinfo = GetPlayerInfo <JhUserInfo>(seat, true); uinfo.IsLook = true; if (SelfSeat == seat) { uinfo.Cards = response.GetIntArray("cards"); } if (response.ContainsKey("gzyz")) { uinfo.IsGzyz = response.GetBool("gzyz"); } ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("LookChair", GetLocalSeat(seat)); if (SelfSeat == seat) { sendObj.PutIntArray("Cards", uinfo.Cards); } if (SelfSeat == seat && SelfSeat == CurrenPlayer) { sendObj.PutBool("IsCurPlayer", true); SetSfsUserContrl(sendObj); } EventObj.SendEvent("PlayersViewEvent", "Look", sendObj); EventObj.SendEvent("SoundEvent", "PersonSound", new JhSound.SoundData(JhSound.EnAudio.Look, uinfo.SexI)); }
public void OnFapai(ISFSObject data) { RStatus = RoomStatus.FaPai; SingleBet = AnteRate[0]; LastTime = JhFunc.GetTimeStamp(false); BankerSeat = data.GetInt(JhRequestConstKey.KeyBanker); int[] playing = data.GetIntArray(JhRequestConstKey.KeyPlayings); int[] playingChair = new int[playing.Length]; for (int i = 0; i < playing.Length; i++) { playingChair[i] = GetLocalSeat(playing[i]); JhUserInfo uInfo = GetPlayerInfo <JhUserInfo>(playing[i], true); uInfo.IsPlayingGame = true; uInfo.CoinA -= SingleBet; TotalBet += SingleBet; uInfo.AllBeat += SingleBet; } ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("Banker", GetLocalSeat(BankerSeat)); sendObj.PutIntArray("Playing", playingChair); sendObj.PutInt("ChipValue", SingleBet); sendObj.PutInt("ChipIndex", AnteRate.IndexOf(SingleBet)); sendObj.PutInt("SingleBet", SingleBet); EventObj.SendEvent("PlayersViewEvent", "Fapai", sendObj); SendGameStatusToTableView(); EventObj.SendEvent("SoundEvent", "PlayerEffect", new JhSound.SoundData(JhSound.EnAudio.Card)); }
public void OnGuZhuYiZhi(ISFSObject response) { int gold = response.GetInt("goldinc"); bool isWin = response.GetBool("result"); JhUserInfo biUser = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true); biUser.CoinA -= gold; TotalBet += gold; biUser.IsGzyz = false; List <int> lostList = new List <int>(); if (isWin) { foreach (var userInfo in UserInfoDict) { JhUserInfo jhUser = (JhUserInfo)userInfo.Value; if (jhUser != biUser) { jhUser.IsFail = true; lostList.Add(GetLocalSeat(jhUser.Seat)); } } } else { biUser.IsFail = true; lostList.Add(GetLocalSeat(CurrenPlayer)); } if (response.ContainsKey("fancha")) { ISFSArray arr = response.GetSFSArray("fancha"); for (int i = 0; i < arr.Count; i++) { ISFSObject obj = arr.GetSFSObject(i); int seat = obj.GetInt("seat"); int fancha = obj.GetInt("gold"); JhUserInfo fanUser = GetPlayerInfo <JhUserInfo>(seat, true); fanUser.CoinA += fancha; } } ISFSObject sendObj = SFSObject.NewInstance(); sendObj.PutInt("Chair", GetLocalSeat(CurrenPlayer)); sendObj.PutInt("Gold", gold); sendObj.PutBool("isWin", isWin); sendObj.PutUtfString("Name", biUser.Name); sendObj.PutIntArray("LostList", lostList.ToArray()); //如果存在 反差值的情况 刷新金币 if (response.ContainsKey("fancha")) { //刷新金币 ISFSArray arr = SFSArray.NewInstance(); foreach (var info in UserInfoDict) { JhUserInfo jhInfo = (JhUserInfo)info.Value; if (jhInfo.IsPlaying()) { ISFSObject obj = SFSObject.NewInstance(); obj.PutInt("Chair", GetLocalSeat(jhInfo.Seat)); obj.PutLong("Gold", jhInfo.CoinA); arr.AddSFSObject(obj); } } sendObj.PutSFSArray("FanCha", arr); } EventObj.SendEvent("PlayersViewEvent", "GZYZ", sendObj); EventObj.SendEvent("SoundEvent", "PlayerEffect", new JhSound.SoundData(JhSound.EnAudio.CompareAnimate)); EventObj.SendEvent("TableViewEvent", "Bet", TotalBet); }
protected void SendGameStatusToPlayerView() { ISFSObject sendObj = SFSObject.NewInstance(); ISFSArray sendArray = SFSArray.NewInstance(); foreach (var info in UserInfoDict) { JhUserInfo userInfo = (JhUserInfo)info.Value; if (userInfo != null) { ISFSObject obj = userInfo.GetSfsObject(RStatus); obj.PutInt("Chair", GetLocalSeat(userInfo.Seat)); sendArray.AddSFSObject(obj); } } sendObj.PutBool("isShowTimeTip", CoustemTime > 0); if (RStatus > RoomStatus.CanStart) { sendObj.PutInt("CurChair", GetLocalSeat(CurrenPlayer)); sendObj.PutDouble("CdTime", CdTime); sendObj.PutLong("LastTime", LastTime); if (CurrenPlayer == SelfSeat) { JhUserInfo curUser = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true); if (!curUser.IsGzyz && IsAutoFollow) { sendObj.PutDouble("CdTime", 2.0f); } } JhUserInfo currP = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true); SetCurrenPlayerBeatMinAndMax(currP, sendObj); sendObj.PutInt("Banker", GetLocalSeat(BankerSeat)); if (TotalBet != 0) { ISFSArray betArray = SFSArray.NewInstance(); int ttBet = TotalBet; for (int i = AnteRate.Count - 1; i >= 0; i--) { if (ttBet >= AnteRate[i]) { ISFSObject arrO = SFSObject.NewInstance(); arrO.PutInt("ChipValue", AnteRate[i]); arrO.PutInt("ChipIndex", i); arrO.PutInt("ChipCnt", ttBet / AnteRate[i]); betArray.AddSFSObject(arrO); ttBet = ttBet % AnteRate[i]; } } sendObj.PutSFSArray("ChipList", betArray); } } sendObj.PutSFSArray("Players", sendArray); sendObj.PutIntArray("Antes", AnteRate.ToArray()); sendObj.PutInt("SingleBet", SingleBet); sendObj.PutBool("IsPlaying", RStatus > RoomStatus.CanStart && RStatus != RoomStatus.Over); SetSfsUserContrl(sendObj); EventObj.SendEvent("PlayersViewEvent", "Status", sendObj); }