public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { Dictionary <string, object> dict = new Dictionary <string, object>(); System.Diagnostics.Debug.WriteLine("getliveinfodone"); if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && (eventObj.getJoinedUsers() != null)) { System.Diagnostics.Debug.WriteLine("found room .. reading properties"); for (int i = 0; i < 5; i++) { if (eventObj.getProperties().ContainsKey("q" + (i + 1))) { Global.ques[i] = eventObj.getProperties()["q" + (i + 1)].ToString(); } } if (eventObj.getJoinedUsers().Length == 1) { System.Diagnostics.Debug.WriteLine("is player 1"); Global.PlayerIsFirst = true; Global.warpClient.UpdateRoomProperties(Global.DynRoomId, new Dictionary <string, object>() { { "availUsers", 1 } }, null); System.Diagnostics.Debug.WriteLine("AVAIL = 1"); } else { System.Diagnostics.Debug.WriteLine("is player 2\n AVAIL = 2"); // Global.warpClient.UpdateRoomProperties(eventObj.getData().getId()); Global.PlayerIsFirst = false; Global.warpClient.UpdateRoomProperties(Global.DynRoomId, new Dictionary <string, object>() { { "availUsers", 2 } }, null); } if (flag) { for (int zz = 0; zz < 5; zz++) { _page.sel[zz] = Convert.ToInt16(Global.ques[zz]); } System.Diagnostics.Debug.WriteLine("retrieved all questions - sent to sel - going to g and f"); _page.g(); _page.f(); flag = false; } // navigate to game play screen // _page.moveToPlayScreen(); } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { _page.showResult("LiveRoominfo" + eventObj.getJoinedUsers().Length); GamePage.masItem = eventObj.getJoinedUsers().Length - 1; //Maxusers = int.Parse(eventObj.getData().getMaxUsers().ToString()); GamePage.maxUsers = int.Parse(eventObj.getData().getMaxUsers().ToString()); //RoomData d = new RoomData("1995630518","1","s", 3); //Balls.cPos = new Microsoft.Xna.Framework.Vector2[eventObj.getData().getMaxUsers()]; //Balls.sPos = new Microsoft.Xna.Framework.Vector2[eventObj.getData().getMaxUsers()]; //_page.showResult("Max" + eventObj.getData().getMaxUsers().ToString()); }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { _page.showResult("LiveRoominfo" + eventObj.getJoinedUsers().Length); GamePage.masItem = eventObj.getJoinedUsers().Length - 1; //Maxusers = int.Parse(eventObj.getData().getMaxUsers().ToString()); GamePage.maxUsers = int.Parse(eventObj.getData().getMaxUsers().ToString()); //RoomData d = new RoomData("1995630518","1","s", 3); //Balls.cPos = new Microsoft.Xna.Framework.Vector2[eventObj.getData().getMaxUsers()]; //Balls.sPos = new Microsoft.Xna.Framework.Vector2[eventObj.getData().getMaxUsers()]; //_page.showResult("Max" + eventObj.getData().getMaxUsers().ToString()); }
public void loadAvailableRoomsOnZone(LiveRoomInfoEvent liveRoomInfoEvent) { appwarp.currentRoomId = liveRoomInfoEvent.getData().getId(); TABLE table = new TABLE(); Dictionary <string, object> rumData = liveRoomInfoEvent.getProperties(); if (rumData.ContainsKey("ROOM_NAME")) { table.roomName = rumData ["ROOM_NAME"].ToString(); } if (rumData.ContainsKey("MINCHIPS")) { table.minChips = rumData ["MINCHIPS"].ToString(); } if (liveRoomInfoEvent.getJoinedUsers() != null) { table.totalUsers = liveRoomInfoEvent.getJoinedUsers().Length; } table.maxUsers = 9; Debug.Log(">>> " + liveRoomInfoEvent.getJoinedUsers() + "... " + liveRoomInfoEvent.getData().getId()); table.roomId = liveRoomInfoEvent.getData().getId(); //tablesList.Add (table); GameObject.FindGameObjectWithTag("RoomListPanel").GetComponentInChildren <ScrollList> ().Init(table); // Dictionary<string, object> data = eventObj.getProperties(); // tabl = new TABLE(); // if(data.ContainsKey("MINCHIPS")) // { // tabl.minChips = data["MINCHIPS"].ToString(); // // } // if(data.ContainsKey("ROOMNAME")) // { // tabl.roomName = data["ROOMNAME"].ToString(); // } // tabl.roomId = eventObj.getData().getId(); // rumManager.tables.Add(tabl); // if(txtAllRooms.text.Contains("Loading")){ // txtAllRooms.text = ""; // } // appwarp.currentRoomId = liveRoomInfoEvent.getData ().getId (); // txtSelectedRoom.text = "Selected Room : "+liveRoomInfoEvent.getData ().getName (); // // txtAllRooms.text= txtAllRooms.text + "\n"+liveRoomInfoEvent.getData().getName(); }
public void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj) { Debug.Log("OnGetLiveRoomInfo " + eventObj.getData().getId() + " " + eventObj.getResult() + " " + eventObj.getJoinedUsers().Length); Dictionary <string, object> _temp = eventObj.getProperties(); print("bet = " + SC_DefiendVariables.bet); Debug.Log(_temp.Count + " " + _temp["bet"] + " " + SC_DefiendVariables.bet["bet"].ToString()); if (eventObj.getResult() == 0 && eventObj.getJoinedUsers().Length == 1 && _temp["bet"].ToString() == SC_DefiendVariables.bet["bet"].ToString()) { print("entering the room!"); currentTurn = SC_DefiendVariables.Turn.RedTurn; print("Enemy start the game!"); WarpClient.GetInstance().JoinRoom(eventObj.getData().getId()); WarpClient.GetInstance().SubscribeRoom(eventObj.getData().getId()); } else { currentTurn = SC_DefiendVariables.Turn.blueTurn; print("I start the game!"); isMyTurn = true; Debug.Log("No rooms were availible, create a room"); WarpClient.GetInstance().CreateTurnRoom("Room Name", SC_MultiPlayer_Globals.userName, 2, SC_DefiendVariables.bet, 60); } if (_temp["bet"].ToString() == SC_DefiendVariables.bet["bet"].ToString()) { roomMatch = true; } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { if (eventObj.getResult() == 0) { if (GameControllerTeenPatti.PrivateGameType.Equals(TagsTeenpatti.JOIN_PRIVATE_TABLE)) { Dictionary <string, object> dic = eventObj.getProperties(); string boolAmount = "" + dic[TagsTeenpatti.MAX_BET_AMOUNT]; Debug.Log("boolAmount " + boolAmount); PlayerPrefs.SetString("InHand", boolAmount); appwrapTeenpatti.gameRequest(); } try { int playersName = eventObj.getJoinedUsers().Length; Debug.Log("onGetLiveRoomInfoDone " + playersName); GameDelegateTeenPatti.ShowTotalGameUser(playersName); } catch (System.Exception ex) { Debug.Log("Working new"); } // foreach (String n in playersName) { // print ("player name is " + n); // GameController.newPlayer (n); // } } }
public void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj) { Debug.Log("OnGetLiveRoomInfo " + eventObj.getData().getId() + " " + eventObj.getResult() + " " + eventObj.getJoinedUsers().Length); Dictionary <string, object> _temp = eventObj.getProperties(); print("bet = " + SC_DefiendVariables.bet); Debug.Log(_temp.Count + " " + _temp["bet"] + " " + SC_DefiendVariables.bet["bet"].ToString()); if (eventObj.getResult() == 0 && eventObj.getJoinedUsers().Length == 1 && _temp["bet"].ToString() == SC_DefiendVariables.bet["bet"].ToString()) { print("entering the room!"); currentTurn = SC_DefiendVariables.Turn.RedTurn; print("Enemy start the game!"); isMyTurn = false; //added now currentTurn = SC_DefiendVariables.Turn.RedTurn; //added now WarpClient.GetInstance().JoinRoom(eventObj.getData().getId()); WarpClient.GetInstance().SubscribeRoom(eventObj.getData().getId()); } if (_temp["bet"].ToString() == SC_DefiendVariables.bet["bet"].ToString()) { roomMatch = true; } }
public void onGetLiveLobbyInfoDone(LiveRoomInfoEvent eventObj) { String[] users = eventObj.getJoinedUsers(); if (users != null && users.Length > 0) { for (int i = 0; i < users.Length; i++ ) _page.showResult(users[i]); } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && (eventObj.getJoinedUsers() != null)) { if (eventObj.getJoinedUsers().Length == 1) { GlobalContext.PlayerIsFirst = true; } else { GlobalContext.PlayerIsFirst = false; } // navigate to game play screen _page.moveToPlayScreen(); } }
public void onGetLiveLobbyInfoDone(LiveRoomInfoEvent eventObj) { String[] users = eventObj.getJoinedUsers(); if (users != null && users.Length > 0) { for (int i = 0; i < users.Length; i++) { _page.showResult(users[i]); } } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent liveRoomInfoObj) { if (liveRoomInfoObj.getData() != null) { GlobalContext.tableProperties = liveRoomInfoObj.getProperties(); if ((liveRoomInfoObj.getJoinedUsers().Length == 2)) { if (liveRoomInfoObj.getJoinedUsers()[0].Equals(GlobalContext.localUsername)) { GlobalContext.opponentName = liveRoomInfoObj.getJoinedUsers()[1]; } else { GlobalContext.opponentName = liveRoomInfoObj.getJoinedUsers()[0]; } Debug.WriteLine("get Live RoomInfo"); Deployment.Current.Dispatcher.BeginInvoke(delegate() { App.g_HomePageListener.StartQuiz(); }); } } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent liveRoomInfoObj) { if (liveRoomInfoObj.getData() != null) { GlobalContext.tableProperties = liveRoomInfoObj.getProperties(); if ((liveRoomInfoObj.getJoinedUsers().Length == 2)) { if (liveRoomInfoObj.getJoinedUsers()[0].Equals(GlobalContext.localUsername)) { GlobalContext.opponentName = liveRoomInfoObj.getJoinedUsers()[1]; } else { GlobalContext.opponentName = liveRoomInfoObj.getJoinedUsers()[0]; } Debug.WriteLine("get Live RoomInfo"); Deployment.Current.Dispatcher.BeginInvoke(delegate() { App.g_HomePageListener.StartQuiz(); }); } } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && (eventObj.getJoinedUsers() != null)) { if (GlobalContext.localUsername.Equals(eventObj.getJoinedUsers()[0])) { // user who created the room is the first player GlobalContext.PlayerIsFirstOnAppWarp = true; } else { // user who joined later is second player GlobalContext.PlayerIsFirstOnAppWarp = false; } GlobalContext.tableProperties = eventObj.getProperties(); for (int i = 0; i < eventObj.getJoinedUsers().Length; i++) { if (!GlobalContext.localUsername.Equals(eventObj.getJoinedUsers()[i])) { GlobalContext.opponentName = eventObj.getJoinedUsers()[i]; break; } } GlobalContext.joinedUsers = eventObj.getJoinedUsers(); Deployment.Current.Dispatcher.BeginInvoke(new MoveToPlayCallback(mMoveToPlay)); } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && (eventObj.getJoinedUsers() != null)) { if (GlobalContext.localUsername.Equals(eventObj.getJoinedUsers()[0])) { // user who created the room is the first player GlobalContext.PlayerIsFirstOnAppWarp = true; GlobalContext.IsMyTurn = true; } else { // user who joined later is second player GlobalContext.PlayerIsFirstOnAppWarp = false; GlobalContext.IsMyTurn = false; } GlobalContext.tableProperties = eventObj.getProperties(); for (int i = 0; i < eventObj.getJoinedUsers().Length; i++) { if (!GlobalContext.localUsername.Equals(eventObj.getJoinedUsers()[i])) { GlobalContext.opponentName = eventObj.getJoinedUsers()[i]; break; } } GlobalContext.joinedUsers = eventObj.getJoinedUsers(); Deployment.Current.Dispatcher.BeginInvoke(new MoveToPlayCallback(mMoveToPlay)); } }
private void HandleOnRoomInfoReceived(LiveRoomInfoEvent roomInfo) { if (roomid != roomInfo.getData().getId()) { return; } roomid = roomInfo.getData().getId(); Dictionary <string, object> rumData = roomInfo.getProperties(); string sbChips = rumData [Constants.ROOM_PROP_MIN_CHIPS].ToString(); string bbChips = ""; string userMinChips = ""; string userMaxChips = ""; if (sbChips != null) { bbChips = (int.Parse(sbChips) * 2).ToString(); userMinChips = (int.Parse(sbChips) * 20).ToString(); userMaxChips = (int.Parse(userMinChips) * 20).ToString(); blindText.text = sbChips + " / " + bbChips; chipsText.text = userMinChips + " / " + userMaxChips; } if (roomInfo.getJoinedUsers() == null) { totalPlayersText.text = "0 / " + roomInfo.getData().getMaxUsers(); } else { totalPlayersText.text = roomInfo.getJoinedUsers().Length + " / " + roomInfo.getData().getMaxUsers(); } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { Log ("onGetLiveRoomInfoDone : " + eventObj.getResult()); if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && (eventObj.getJoinedUsers() != null)) { AppWarp.InitializeNotification (); if (eventObj.getJoinedUsers().Length == 1) { AppWarp.isFirstPlayer = true; // Decide what string is for first player and what is for second player } else { AppWarp.isFirstPlayer = false; // Tell both players in room to load gameplay scene AppWarp.warpClient.SendUpdatePeers(OnlineMessage.BuildBytes_NewMatch()); } AppWarp.interval = 8.0f; } }
public void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj) { Dictionary <string, object> _parms = eventObj.getProperties(); List <string> UserList = new List <string> (eventObj.getJoinedUsers()); if (_parms["Password"].ToString() == matchRoomData["Password"].ToString() && int.Parse(_parms["PlayerCount"].ToString()) == MainGame.GetComponent <SC_Logics>().PlayerCount) { roomId = eventObj.getData().getId(); WarpClient.GetInstance().JoinRoom(roomId); WarpClient.GetInstance().SubscribeRoom(roomId); MainGame.GetComponent <SC_Logics>().Myturn = UserList.Count + 1; } else { index++; DoRoomSearchLogic(); } }
private void OnGetLiveRoomInfoOccured(LiveRoomInfoEvent eventObj) { Debug.Log("OnGetLiveRoomInfo " + eventObj.getData().getId() + " " + eventObj.getResult() + " " + eventObj.getJoinedUsers().Length); GameView.SetText("StatusTxt", "Room Information: " + eventObj.getData().getId() + " " + eventObj.getJoinedUsers().Length); Dictionary <string, object> _temp = eventObj.getProperties(); Debug.Log(_temp.Count + " " + _temp["Password"] + " " + data["Password"].ToString()); if (eventObj.getResult() == 0 && eventObj.getJoinedUsers().Length == 1 && _temp["Password"].ToString() == data["Password"].ToString()) { WarpClient.GetInstance().JoinRoom(eventObj.getData().getId()); WarpClient.GetInstance().SubscribeRoom(eventObj.getData().getId()); data["AwayPlayer"] = MiniJSON.Json.Serialize(GetLocalSoldiers().ToArray()); WarpClient.GetInstance().UpdateRoomProperties(eventObj.getData().getId(), data, null); GameView.SetText("StatusTxt", "Joining Room..."); } else { index++; if (index < rooms.Count) { Debug.Log("Getting Live Info on room: " + rooms[index]); WarpClient.GetInstance().GetLiveRoomInfo(rooms[index]); } else { Debug.Log("No rooms were availible, create a room"); WarpClient.GetInstance().CreateTurnRoom("Room Name", username, 2, null, 30); data["HomePlayer" + username] = MiniJSON.Json.Serialize(GetLocalSoldiers().ToArray()); WarpClient.GetInstance().UpdateRoomProperties(rooms[index], data, null); } } }
public void onGetLiveLobbyInfoDone(LiveRoomInfoEvent eventObj) { string result = ""; if (eventObj.getResult () == WarpResponseResultCode.SUCCESS) { string[] users = eventObj.getJoinedUsers(); for (int i = 0; i < users.Length; i++) { result += " " + users [i]; } } appWarpResponse+="onJoinLobbyDone : " + eventObj.getResult() + ", Name : " + eventObj.getData().getName() + ", Id : " + eventObj.getData().getId()+" Users "+result+"\n"; Debug.Log ("onGetLiveLobbyInfoDone : " + eventObj.getResult() + ", RoomName : " + eventObj.getData().getName() + ", RoomID : " + eventObj.getData().getId()); }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { Dictionary<string, object> dict = new Dictionary<string, object>(); System.Diagnostics.Debug.WriteLine("getliveinfodone"); if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && (eventObj.getJoinedUsers() != null)) { System.Diagnostics.Debug.WriteLine("found room .. reading properties"); for (int i = 0; i < 5; i++) { if (eventObj.getProperties().ContainsKey("q" + (i + 1))) Global.ques[i] = eventObj.getProperties()["q" + (i + 1)].ToString(); } if (eventObj.getJoinedUsers().Length == 1) { System.Diagnostics.Debug.WriteLine("is player 1"); Global.PlayerIsFirst = true; Global.warpClient.UpdateRoomProperties(Global.DynRoomId, new Dictionary<string, object>() { { "availUsers", 1 } }, null); System.Diagnostics.Debug.WriteLine("AVAIL = 1"); } else { System.Diagnostics.Debug.WriteLine("is player 2\n AVAIL = 2"); // Global.warpClient.UpdateRoomProperties(eventObj.getData().getId()); Global.PlayerIsFirst = false; Global.warpClient.UpdateRoomProperties(Global.DynRoomId, new Dictionary<string, object>() { { "availUsers", 2 } }, null); } if(flag) { for (int zz = 0; zz < 5; zz++) { _page.sel[zz] = Convert.ToInt16(Global.ques[zz]); } System.Diagnostics.Debug.WriteLine("retrieved all questions - sent to sel - going to g and f"); _page.g(); _page.f(); flag = false; } // navigate to game play screen // _page.moveToPlayScreen(); } }
void OnGUI() { GUI.depth = 0; GUI.skin = RoomSelectionGUISkin; GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), Background); if (GUI.Button(new Rect(Screen.width / 25, Screen.height / 25, Properties.BackButtonSize, Properties.BackButtonSize), Properties.BackButton)) { Hide(); WarpClient.GetInstance().Disconnect(); LoginScreen.Show(); } scrollPosition = GUI.BeginScrollView(scrollViewPosition, scrollPosition, scrollViewInnerPosition); float offsetX = roomBoxPosition.x; float offsetY = roomBoxPosition.y; for (int i = 0; i < ActiveRooms.Count; i++) { LiveRoomInfoEvent currentRoom = ActiveRooms[i]; string[] joinedUsers = currentRoom.getJoinedUsers(); string roomId = currentRoom.getData().getId(); object type = string.Empty; object goal = string.Empty; object pw = string.Empty; selectedRoomProperties = currentRoom.getProperties(); selectedRoomProperties.TryGetValue("PW", out pw); if (selectedRoomProperties.TryGetValue("TYPE", out type) && selectedRoomProperties.TryGetValue("GOAL", out goal)) { string playersText = string.Empty; for (int j = 0; j < 4; j++) { if (j == 0 && joinedUsers != null) { playersText = joinedUsers[j]; } else if (j == 0) { playersText = "-"; } else if (joinedUsers != null && j < joinedUsers.Length) { playersText += "\n" + joinedUsers[j]; } else { playersText += "\n-"; } } if (selectedRoomId == roomId) { GUI.DrawTexture(new Rect(offsetX, offsetY, roomBoxPosition.width, roomBoxPosition.height), SelectedRoomBoxBackground); } else if (GUI.Button(new Rect(offsetX, offsetY, roomBoxPosition.width, roomBoxPosition.height), "")) { selectedRoomId = roomId; selectedRoomPw = pw == null ? null : pw.ToString(); } GUI.BeginGroup(new Rect(offsetX, offsetY, roomBoxPosition.width, roomBoxPosition.height)); DrawRoomBox(currentRoom.getData().getName(), type.ToString(), goal.ToString(), playersText, joinedUsers == null ? 0 : joinedUsers.Length, pw == null? null : pw.ToString()); GUI.EndGroup(); offsetX += offsetWidth / 2 + roomBoxPosition.width; if (i % 2 == 1) { offsetY += offsetHeight + roomBoxPosition.height; offsetX = roomBoxPosition.x; } } } GUI.EndScrollView(); if (GUI.Button(createRoomButtonPos, LanguageManager.getString("CRTROOM"))) { Hide(); CreateRoomMenu.Show(); } if (!string.IsNullOrEmpty(selectedRoomId) && GUI.Button(joinRoomButtonPos, LanguageManager.getString("JOINROOM"))) { if (selectedRoomPw != null && !string.IsNullOrEmpty(selectedRoomPw.ToString())) { PasswordEnterMenu.Show(selectedRoomPw.ToString(), selectedRoomId); Hide(); } else { StartCoroutine(JoinRoom(selectedRoomId)); } } if (GUI.Button(renewButtonPos, LanguageManager.getString("RENEW"))) { Renew(); } }
public void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj) { if (isUserConnected) { Debug.Log ("OnGetLiveRoomInfo " + eventObj.getResult () + " " + eventObj.getData ().getId () + " " + eventObj.getJoinedUsers ().Length); if (eventObj.getResult () == 0 && eventObj.getJoinedUsers ().Length == 1) { Debug.Log("Joined room " + eventObj.getData ().getId ()); roomId = eventObj.getData ().getId (); SC_AppWarpKit.JoinToRoom (eventObj.getData ().getId ()); SC_AppWarpKit.RegisterToRoom (eventObj.getData ().getId ()); } else { Debug.Log("Still Looking"); index++; if (index < rooms.Count) SC_AppWarpKit.GetLiveRoomInfo (rooms [index]); else { Debug.Log ("No More Rooms"); SC_AppWarpKit.CreateTurnBaseRoom ("ROOM" + Time.time, userName, 2, null, turnTime); } } } }
public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj) { string[] users; users = eventObj.getJoinedUsers (); if (users.Length == 2) { WarpClient.GetInstance ().startGame(); Debug.Log("Start Game"); } Log ("onGetLiveRoomInfoDone : " + eventObj.getResult()); }