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 override void Query(ISFSObject obj, DVoidSfsObject sendCall, EventData evn) { currMahjong = (MahjongIcon)evn.data1; if (currMahjong == null) { return; } //向服务器发出请求 if (MahjongIcon.Flag.Ting == currMahjong.CurrFlag) { if (!_huqueryCacheList.ContainsKey(currMahjong.MahjongItem.Value)) { //听的牌,通过服务器查询 obj.PutInt(RequestKey.KeyType, MjRequestData.MJRequestTypeGetHuCards); obj.PutInt(_keyCard, currMahjong.MahjongItem.Value); sendCall(obj); } else { SetMahHuListInfo(currMahjong.MahjongItem.Value); } } /* currMahjong = (MahjongIcon)evn.data1; * if (currMahjong == null) return; * * //向服务器发出请求 * if (MahjongIcon.Flag.Ting == currMahjong.CurrFlag && !mahjongQueryCache.ContainsKey(currMahjong.MahjongItem.Value)) * { * //听的牌,通过服务器查询 * obj.PutInt(RequestKey.KeyType, MjRequestData.MJRequestTypeGetHuCards); * obj.PutInt("card", currMahjong.MahjongItem.Value); * sendCall(obj); * } * else * { * /* //不向服务器发出请求 * QueryHulistData hulistData = new QueryHulistData((int)currMahjong.CurrFlag, currMahjong.MahjongItem.Value, currMahjong.MahjongItem.MahjongIndex, laizi); * * switch (currMahjong.CurrFlag) * { * case MahjongIcon.Flag.Ting: * hulistData.Cards = mahjongQueryCache[currMahjong.MahjongItem.Value]; * //任意牌 * if (hulistData.Cards.Exists((a) => { return a == 0; })) * hulistData.LeaveMahjongCnt = leaveMahjongCnt; * EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); * break; * case MahjongIcon.Flag.Youjin: * hulistData.LeaveMahjongCnt = leaveMahjongCnt; * EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); * break; * }#1# * * //if() * * }*/ }
/// <summary> /// 发送聊天消息 /// </summary> /// <param name="data">数据</param> /// <param name="type">类型,0:文本消息(包括常用语) 1:常用语 </param> private void SendUserTalk(ISFSObject data, int type) { if (Manager && Manager.SelfPlayer.UserInfo != null) { data.PutInt(RequestKey.KeyType, type); data.PutInt(RequestKey.KeySeat, Manager.SelfPlayer.UserSeat); SendFrameRequest(RequestCmd.UserTalk, data); } }
public ISFSObject GetSfsObject() { ISFSObject obj = SFSObject.NewInstance(); obj.PutUtfString("Name", UserInfo.NickM); obj.PutInt("Sex", UserInfo.SexI); obj.PutUtfString("Head", UserInfo.AvatarX); obj.PutInt("Status", (int)Status); return(obj); }
/// <summary> /// 发送聊天消息 /// </summary> /// <param name="data">数据</param> /// <param name="type">类型,0:文本消息(包括常用语) 1:常用语 2.后台状态(临时处理)</param> private void SendUserTalk(ISFSObject data, int type) { if (!App.GetGameData <GangwuGameData>().IsGameInfo) { return; } data.PutInt(RequestKey.KeyType, type); data.PutInt(RequestKey.KeySeat, App.GameData.SelfSeat); SendFrameRequest(RequestCmd.UserTalk, 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); }
/// <summary> /// 发送聊天消息 /// </summary> /// <param name="data">数据</param> /// <param name="type">类型,0:文本消息(包括常用语) 1:常用语 2.后台状态(临时处理)</param> private void SendUserTalk(ISFSObject data, int type) { if (!Manager.IsInitInfo) { return; } data.PutInt(RequestKey.KeyType, type); data.PutInt(RequestKey.KeySeat, App.GetGameManager <Lyzz2DGameManager>().SelfPlayer.UserSeat); SendFrameRequest(RequestCmd.UserTalk, data); NguiLabelAdapter ADA; }
public override void GetGangData(ISFSObject obj, DVoidSfsObject sendCall) { List <FindGangData> findList = FindCanGang(); //如果不能杠财神,则移除可能是财神的牌 if (_cargs2.ContainsKey(Gangcaishen) && _cargs2.GetUtfString(Gangcaishen) == "0") { foreach (var findGangData in findList) { if (findGangData.cards[0] == Laizi) { findList.Remove(findGangData); break; } } } DVoidInt sendCallArray = index => { YxDebug.Log("发送服务器 杠 " + findList[index].cards); if (findList[index].type != UtilDef.DefInt) { obj.PutInt(RequestKey.KeyType, findList[index].type); } if (findList[index].ttype != UtilDef.DefInt) { obj.PutInt(RequestKeyOther.KeyTType, findList[index].ttype); } if (findList[index].cards != null && findList[index].ttype != MjRequestData.CPG_ZhuaGang) { obj.PutIntArray(RequestKey.KeyCards, findList[index].cards); } else if (findList[index].cards != null && findList[index].ttype == MjRequestData.CPG_ZhuaGang) { obj.PutInt(RequestKey.KeyOpCard, findList[index].cards[0]); } sendCall(obj); }; //如果找到的杠 大于1 if (findList.Count > 1) { YxDebug.Log("通知UI 提示杠选择 " + findList.Count); var lisiCard = findList.Select(t => t.cards).ToList(); //通知UI提示选择 EventDispatch.Dispatch((int)UIEventId.CgChoose, new EventData(lisiCard, sendCallArray, _outPutMahjong)); } else { sendCallArray(0); } }
/// <summary> /// 发送聊天消息 /// </summary> /// <param name="data">数据</param> /// <param name="type">类型,0:文本消息(包括常用语) 1:常用语 2.后台状态(临时处理)</param> private void SendUserTalk(ISFSObject data, int type) { var gdata = App.GetGameData <FillpitGameData>(); if (!HasGetGameInfo) { return; } data.PutInt(RequestKey.KeyType, type); data.PutInt(RequestKey.KeySeat, gdata.SelfSeat); SendFrameRequest(RequestCmd.UserTalk, data); }
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 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)); }
private void UpdateServerFactoryCount() { ISFSObject productUpdateObj = CreateProductUpdateMessageWithID(); productUpdateObj.PutInt("nf", NumFactories); // num factories CommunicationManager.SendObjectMsg(productUpdateObj); }
private void UpdateServerPLC() { ISFSObject productUpdateObj = CreateProductUpdateMessageWithID(); productUpdateObj.PutInt("plc", productLifeCycle); // product life cycle CommunicationManager.SendObjectMsg(productUpdateObj); }
/// <summary> /// 抢地主时 /// </summary> /// <param name="args"></param> private void OnTypeGrab(DdzbaseEventArgs args) { var data = args.IsfObjData; var score = data.GetInt(RequestKey.KeyScore); //如果有人叫分小于等于之前叫分,忽略之 if (_beishu > score) { return; } _beishu = score; _gameInfoTemp.PutInt(RequestKey.KeyScore, score); BeiShuLabel.text = _beishu.ToString(CultureInfo.InvariantCulture); }
/// <summary> /// 当轮到某人要准备要叫分时 /// </summary> protected void OnTypeGrabSpeaker(object obj, DdzbaseEventArgs args) { var data = args.IsfObjData; if (!DDzUtil.IsServDataContainAllKey( new[] { RequestKey.KeySeat, NewRequestKey.KeyTttype }, data)) { return; } if (App.GetGameData <GlobalData>().GetSelfSeat != data.GetInt(RequestKey.KeySeat)) { SetAllBtnsActive(false); return; } if (ServDataTemp == null) { ServDataTemp = new SFSObject(); } ServDataTemp = data; //把与"qt"相同引用值的 "ttype" 的值赋值过来 ServDataTemp.PutInt(NewRequestKey.KeyQt, data.GetInt(NewRequestKey.KeyTttype)); RefreshUiInfo(); }
protected override void OnAllocateCds(object sender, DdzbaseEventArgs args) { //发牌后重置开关 _isRpLeftOne = false; _isRpLeftOneFirst = false; //base.OnAllocateCds(sender,args);---------- var data = args.IsfObjData; var seat = data.GetInt(GlobalConstKey.C_Sit); if (App.GetGameData <GlobalData>().GetSelfSeat != seat || !data.ContainsKey(GlobalConstKey.C_Cards)) { return; } var cards = data.GetIntArray(GlobalConstKey.C_Cards); ResetHdCds(cards); //------------------------end------------------------------------------------------------------------ //判断发牌后是否是自己先行动出牌 if (data.ContainsKey(GlobalConstKey.C_Bkp) && data.GetInt(GlobalConstKey.C_Bkp) == App.GetGameData <GlobalData>().GetSelfSeat) { DisableAllBtns(); if (_lastOutData == null) { _lastOutData = new SFSObject(); } _lastOutData.PutInt(RequestKey.KeySeat, App.GetGameData <GlobalData>().GetSelfSeat); _lastOutData.PutIntArray(RequestKey.KeyCards, new int[] { }); if (HdCdctrlInstance != null) { HdCdctrlInstance.ReSetHandCds(HdCdsListTemp.ToArray(), true); } } else { if (HdCdctrlInstance != null) { HdCdctrlInstance.ReSetHandCds(HdCdsListTemp.ToArray(), true, true); } } }
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)); }
public void OnGameInfo(ISFSObject data) { if (data.ContainsKey("tptime")) { HupTime = data.GetInt("tptime"); } string hupInfo; if (data.ContainsKey("hup")) { hupInfo = data.GetUtfString("hup"); } else { return; } //接收重连解散信息 if (!string.IsNullOrEmpty(hupInfo)) { IsNotFirstTime = true; StartTime = data.ContainsKey("hupstart") ? data.GetLong("hupstart") : 0; string[] ids = hupInfo.Split(','); for (int i = 0; i < ids.Length; i++) { for (int j = 0, max = UserHupUp.Count; j < max; j++) { var id = int.Parse(ids[i]); if (id.Equals(int.Parse(UserHupUp[j].UserInfo.UserId))) { //2发起投票 3同意 -1拒绝 UserHupUp[j].Status = i == 0 ? HupType.Start : HupType.TongYi; if (id.Equals(int.Parse(SelfID))) { SelfChoose = true; } } } } ISFSObject sendObj = SFSObject.NewInstance(); ISFSArray arr = SFSArray.NewInstance(); foreach (HupUp hupUp in UserHupUp) { arr.AddSFSObject(hupUp.GetSfsObject()); } sendObj.PutSFSArray("Users", arr); sendObj.PutInt("HupTime", HupTime); sendObj.PutLong("StartTime", StartTime); sendObj.PutBool("SelfChoose", SelfChoose); //发送投票view EventObj.SendEvent("HupUpViewEvent", "HupUp", sendObj); } }
public void PutInt(ISFSObject data, string key, int item) { if (sendEncrypted) { data.PutByteArray(key, provider.EncryptInt(item)); } else { data.PutInt(key, item); } }
private void PostData(ISFSObject data, int coin) { var sKey = _secureKey + _seq + "_" + coin; var key = GlobalUtils.Md5String(sKey); //adq //YxDebug.Log("发送金币同步【PostData】:" + coin + " 签名:" + sKey +" "+ _seq); data.PutUtfString("sign", key); data.PutInt("cynccoin", coin); SendGameRequest(data); _seq++; }
private void OnRoomJoin(BaseEvent evt) { Room room = (Room)evt.Params["room"]; // Clear chat (uless this is the first time a Room is joined - or the initial system message would be deleted) //if (!firstJoin) //chatText.text = ""; firstJoin = false; // Show system message Debug.Log("\nYou joined room '" + room.Name + "'\n"); // Enable chat controls //chatControls.interactable = true; // Populate users list //populateUserList(room.UserList); ISFSObject parameters = SFSObject.NewInstance(); parameters.PutInt("0", 1); // sit id parameters.PutLong("1", 1000000); // money on sit sfs.Send(new ExtensionRequest("sc", parameters)); sitting = true; Debug.Log("SENDING Sit"); ISFSObject parameters2 = SFSObject.NewInstance(); parameters.PutLong("0", 100); // bet amount parameters.PutInt("1", 10); // number of lines parameters.PutInt("2", 0); // seat number parameters.PutLong("3", 1000); // user money parameters.PutLong("4", 100); // user experiance sfs.Send(new ExtensionRequest("sss", parameters2)); }
protected void OnHupUpResponse(object data) { ISFSObject obj = (ISFSObject)data; int id = obj.GetInt(RequestKey.KeyId); int starus = obj.GetInt(RequestKey.KeyType); if (starus == 2) { SelfChoose = false; foreach (HupUp hupUp in UserHupUp) { hupUp.Status = 0; } } foreach (HupUp hupUp in UserHupUp) { if (hupUp.UserInfo.UserId.Equals(id.ToString())) { hupUp.Status = (HupType)starus; } } if (id.Equals(int.Parse(SelfID))) { SelfChoose = true; } ISFSObject sendObj = SFSObject.NewInstance(); if (!IsNotFirstTime) { StartTime = JhFunc.GetTimeStamp(); IsNotFirstTime = true; sendObj.PutInt("HupTime", HupTime); sendObj.PutLong("StartTime", StartTime); } ISFSArray arr = SFSArray.NewInstance(); foreach (HupUp hupUp in UserHupUp) { arr.AddSFSObject(hupUp.GetSfsObject()); } sendObj.PutSFSArray("Users", arr); sendObj.PutBool("SelfChoose", SelfChoose); //发送投票view EventObj.SendEvent("HupUpViewEvent", "HupUp", sendObj); if (starus == -1) { CloseHup(); Reset(); } }
public ISFSObject GetResultSfsObject() { ISFSObject obj = SFSObject.NewInstance(); if (!IsWinner) { if (IsFail) { obj.PutInt("ResultType", 2); } else if (IsGiveUp) { obj.PutInt("ResultType", 1); } else { obj.PutInt("ResultType", 3); } } else { obj.PutInt("ResultType", 0); obj.PutInt("WinGold", WinGold); } if (Cards != null) { obj.PutIntArray("Cards", Cards); } obj.PutInt("AddGold", AddGold); obj.PutUtfString("Name", NickM); return(obj); }
public virtual void Query(ISFSObject obj, DVoidSfsObject sendCall, EventData evn) { currMahjong = (MahjongIcon)evn.data1; if (currMahjong == null) { return; } //向服务器发出请求 if (MahjongIcon.Flag.Ting == currMahjong.CurrFlag && !mahjongQueryCache.ContainsKey(currMahjong.MahjongItem.Value)) { //听的牌,通过服务器查询 obj.PutInt(RequestKey.KeyType, MjRequestData.MJRequestTypeGetHuCards); obj.PutInt("card", currMahjong.MahjongItem.Value); sendCall(obj); } else { //不向服务器发出请求 QueryHulistData hulistData = new QueryHulistData((int)currMahjong.CurrFlag, currMahjong.MahjongItem.Value, currMahjong.MahjongItem.MahjongIndex, laizi); switch (currMahjong.CurrFlag) { case MahjongIcon.Flag.Ting: hulistData.Cards = mahjongQueryCache[currMahjong.MahjongItem.Value]; //任意牌 if (hulistData.Cards.Exists((a) => { return(a == 0); })) { hulistData.LeaveMahjongCnt = leaveMahjongCnt; } EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); break; case MahjongIcon.Flag.Youjin: hulistData.LeaveMahjongCnt = leaveMahjongCnt; EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); break; } } }
public override void UserOut(int localSeat, ISFSObject responseData) { if (_onUserOutEvt == null) { return; } ISFSObject data = responseData; data.PutInt(RequestKey.KeySeat, data.GetInt(RequestKey.KeySeat)); var eventArgs = new DdzbaseEventArgs(data); _onUserOutEvt(this, eventArgs); }
public override void UserIdle(int localSeat, ISFSObject responseData) { if (_onUserIdle == null) { return; } ISFSObject data = responseData; data.PutInt(RequestKey.KeySeat, data.GetInt(RequestKey.KeySeat)); data.PutBool(NewRequestKey.KeyUserIdle, true); var eventArgs = new DdzbaseEventArgs(data); _onUserIdle(this, eventArgs); }
private void OnExtensionResponse(BaseEvent evt) { Debug.Log("EXTENSION CALL RECIVED"); if (sitting) { ISFSObject parameters = SFSObject.NewInstance(); parameters.PutLong("0", 100); // bet amount parameters.PutInt("1", 10); // number of lines parameters.PutInt("2", 0); // seat number parameters.PutLong("3", 1000); // user money parameters.PutLong("4", 100); // user experiance sfs.Send(new ExtensionRequest("sss", parameters, sfs.LastJoinedRoom)); } else { string cmd = (string)evt.Params["cmd"]; SFSObject dataObject = (SFSObject)evt.Params["params"]; Debug.Log(evt); } }
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 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)); }
/// <summary> /// 当用户进入房间时,刷新用户数据 /// </summary> /// <param name="userData"></param> protected void UpdateUserdata(ISFSObject userData) { //存储牌数 var cdnumTemp = 0; if (UserDataTemp != null && UserDataTemp.ContainsKey(NewRequestKey.KeyCardNum)) { cdnumTemp = UserDataTemp.GetInt(NewRequestKey.KeyCardNum); } UserDataTemp = userData; //如果是用户重练进来可能不含有NewRequestKey.KeyCardNum参数,这时候需要重置牌数 if (!UserDataTemp.ContainsKey(NewRequestKey.KeyCardNum)) { UserDataTemp.PutInt(NewRequestKey.KeyCardNum, cdnumTemp); } }