protected override void InitGameData(ISFSObject gameInfo) { OwnerId = gameInfo.ContainsKey("ownerId") ? gameInfo.GetInt("ownerId") : -1; _rule = gameInfo.ContainsKey("rule") ? gameInfo.GetUtfString("rule") : ""; IsGameStart = gameInfo.ContainsKey(RequestKey.KeyPlaying) && gameInfo.GetBool(RequestKey.KeyPlaying); _rejoin = gameInfo.ContainsKey("rejoin") && gameInfo.GetBool("rejoin"); if (IsGameStart && _rejoin) { _color1 = gameInfo.GetIntArray("color1"); _color2 = gameInfo.GetIntArray("color2"); _color3 = gameInfo.GetIntArray("color3"); _color4 = gameInfo.GetIntArray("color4"); _curSpeaker = gameInfo.ContainsKey("curP") ? gameInfo.GetInt("curP") : -1; _cd = gameInfo.ContainsKey("cd") ? gameInfo.GetInt("cd") : -1; _st = gameInfo.ContainsKey("st") ? gameInfo.GetLong("st") : -1; _ct = gameInfo.ContainsKey("ct") ? gameInfo.GetLong("ct") : -1; _hup = gameInfo.ContainsKey("hup") ? gameInfo.GetUtfString("hup") : ""; _svt = gameInfo.ContainsKey("svt") ? gameInfo.GetLong("svt") : 0; _hupstart = gameInfo.ContainsKey("hupstart") ? gameInfo.GetLong("hupstart") : 0; _killDragon = gameInfo.ContainsKey("killDragon") ? gameInfo.GetBoolArray("killDragon") : null; _isDragon = gameInfo.ContainsKey("isDragon") ? gameInfo.GetBoolArray("isDragon") : null; } }
public void OnOutCard(ISFSObject data) { var seat = data.GetInt(RequestKey.KeySeat); var card = data.GetInt(JlGameRequestConstKey.KeyCard); var foldNum = data.ContainsKey(JlGameRequestConstKey.KeyFoldNum) ? data.GetInt(JlGameRequestConstKey.KeyFoldNum) : -1; var handNum = data.ContainsKey(JlGameRequestConstKey.KeyHandNum) ? data.GetInt(JlGameRequestConstKey.KeyHandNum) : -1; var activeCards = data.ContainsKey(JlGameRequestConstKey.KeyActiveCards) ? data.GetIntArray(JlGameRequestConstKey.KeyActiveCards) : null; // var killDragon = data.ContainsKey(JlGameRequestConstKey.KeyKillDragon) ? data.GetBoolArray(JlGameRequestConstKey.KeyKillDragon) : null; var isDragon = data.ContainsKey(JlGameRequestConstKey.KeyIsDragon) ? data.GetBoolArray(JlGameRequestConstKey.KeyIsDragon) : null; var sendObj = SFSObject.NewInstance(); sendObj.PutInt("card", card); sendObj.PutInt("seat", seat); sendObj.PutBoolArray("killDragon", killDragon); sendObj.PutBoolArray("isDragon", isDragon); EventObj.SendEvent("SoundEvent", "CardSound", new JlGameSound.SoundData(JlGameSound.EnAudio.None, GetPlayerInfo <JlGameUserInfo>(seat, true).SexI, card)); EventObj.SendEvent("TableViewEvent", "OutCard", sendObj); // YxDebug.LogArray(activeCards); if (activeCards != null && activeCards.Length != 0) { GetPlayer <JlGameSelfPlayer>(SelfSeat, true).FreshHandCard(activeCards, false); } GetPlayer <JlGamePlayer>(seat, true).FreshFoldCardShow(foldNum, handNum); GetPlayer <JlGamePlayer>(seat, true).HideCountDown(); YxClockManager.StopWaitPlayer(); }
private void OnExtensionResponse(BaseEvent evt) { string cmd = (string)(evt.Params["cmd"]); ISFSObject sfs = (SFSObject)(evt.Params["params"]); switch (cmd) { case "move": //true is empty if (OnEnemyMove != null) { OnEnemyMove(sfs.GetInt("x"), sfs.GetInt("y"), sfs.GetUtfString("text")); } if (sfs.GetInt("sender") == SmartFox.MySelf.Id) { if (OnSetBoardEnable != null) { OnSetBoardEnable(null); } } break; case "getSpotEmpty": if (OnSetBoardEnable != null) { OnSetBoardEnable(sfs.GetBoolArray("boardEmpty")); } break; case "start": var turn = sfs.GetInt("turn"); var idPlayer1 = sfs.GetInt("idPlayer1"); var idPlayer2 = sfs.GetInt("idPlayer2"); var namePlayer1 = sfs.GetUtfString("namePlayer1"); var namePlayer2 = sfs.GetUtfString("namePlayer2"); if (OnStartGame != null) { OnStartGame(turn, idPlayer1, idPlayer2, namePlayer1, namePlayer2); } break; case "tie": Debug.Log("two player is draw"); break; case "win": Debug.Log("winner: " + sfs.GetInt("winner")); break; case "register": if (sfs.GetBool("success")) { Debug.Log("Success, thanks for registering"); } else { Debug.Log("SignUp Error:" + sfs.GetUtfString("errorMessage")); SmartFox.Send(new ExtensionRequest("captcha", new SFSObject())); } break; case "test": Debug.Log(sfs.GetInt("test")); if (OnContentUpdate != null) { OnContentUpdate(sfs.GetInt("test").ToString()); } break; case "captcha": Debug.Log("captcha received: " + sfs.GetUtfString("captcha")); break; } }