Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
    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 onUpdatePropertyDone(LiveRoomInfoEvent lifeLiveRoomInfoEvent)
 {
     if (lifeLiveRoomInfoEvent.getResult() == WarpResponseResultCode.SUCCESS)
     {
         GlobalContext.tableProperties = lifeLiveRoomInfoEvent.getProperties();
     }
 }
 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));
     }
 }
Exemplo n.º 6
0
    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;
        }
    }
Exemplo n.º 7
0
 public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj)
 {
     if (ActivePage == 1)
     {
         //  ROOM SELECTION
         if (eventObj.getResult() == 0)
         {
             RoomSelectionMenu.AddRoom(eventObj);
         }
         else
         {
             RoomSelectionMenu.RoomCount--;
         }
     }
     else if (ActivePage == 2)
     {
         if (eventObj.getResult() == 0)
         {
             //  JOIN ROOM
             LobbyPlayerStats.BindRoomData(eventObj.getData(), eventObj.getProperties());
             JoinRoomResultScreen.Hide();
             LobbyPlayerStats.Show();
         }
     }
     Log("onGetLiveRoomInfoDone : " + eventObj.getResult());
 }
    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);
            //			}
        }
    }
Exemplo n.º 9
0
 public void onUpdatePropertyDone(LiveRoomInfoEvent lifeLiveRoomInfoEvent)
 {
     if (lifeLiveRoomInfoEvent.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Dictionary <string, object> d = lifeLiveRoomInfoEvent.getProperties();
         System.Diagnostics.Debug.WriteLine("property successfully updated by you");
     }
 }
Exemplo n.º 10
0
 public void onGetLiveRoomInfoDone(LiveRoomInfoEvent eventObj)
 {
     Log("onGetLiveRoomInfoDone : ", eventObj.getResult());
     if ((ResultCode)eventObj.getResult() == ResultCode.SUCCESS)
     {
         if (roomFoundEvent != null)
         {
             roomFoundEvent(eventObj.getProperties());
         }
     }
 }
Exemplo n.º 11
0
    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();
    }
Exemplo n.º 12
0
    public void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj)
    {
        Dictionary <string, object> _parms = eventObj.getProperties();

        //Debug.Log(_parms["Password"]);
        if (_parms["Password"].ToString() == matchRoomData["Password"].ToString())
        {
            roomId = eventObj.getData().getId();
            JoinAndSubscribeRoom(roomId);
        }
        else
        {
            roomIndex++;
            DoRoomSearchLogic();
        }
    }
Exemplo n.º 13
0
    private void OnGetLiveRoomInfo(LiveRoomInfoEvent _EventObj)
    {
        Dictionary <string, object> _params = _EventObj.getProperties();

        if (_params.ContainsKey("Password") == true && _params["Password"].ToString() == matchRoomData["Password"].ToString())
        {
            roomId = _EventObj.getData().getId();
            WarpClient.GetInstance().JoinRoom(roomId);
            WarpClient.GetInstance().SubscribeRoom(roomId);
        }
        else
        {
            roomIdx++;
            DoRoomSearchLogic();
        }
    }
Exemplo n.º 14
0
    public void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj)
    {
        //todo: move this logic to model code:
        Dictionary <string, object> properties = eventObj.getProperties();

        Debug.Log(properties[SC_MenuModel.ROOM_GRP_PASSWORD_KEY]);;
        if (properties[SC_MenuModel.ROOM_GRP_PASSWORD_KEY].ToString() == model.MatchRoomData[SC_MenuModel.ROOM_GRP_PASSWORD_KEY].ToString())
        {
            roomId = eventObj.getData().getId();
            SharedDataHandler.client.JoinRoom(roomId);
            SharedDataHandler.client.SubscribeRoom(roomId);
        }
        else
        {
            roomIndex++;
            model.SearchRoom(roomIndex);
        }
    }
Exemplo n.º 15
0
    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();
        }
    }
Exemplo n.º 16
0
    private void OnGetLiveRoomInfo(LiveRoomInfoEvent _EventObj)
    {
        Dictionary <string, object> _params = _EventObj.getProperties();
        string _number = unityObjects["Text_RandomNumber"].GetComponent <Text>().text;

        Debug.Log("Text_RandomNumber: " + _params.ContainsKey(_number));
        Debug.Log("RandomNumber: " + _number);
        if (_params.ContainsKey(_number) && matchRoomData.ContainsKey(_number) &&
            _params[_number].ToString() == matchRoomData[_number].ToString())
        {
            roomId = _EventObj.getData().getId();
            WarpClient.GetInstance().JoinRoom(roomId);
            WarpClient.GetInstance().SubscribeRoom(roomId);
        }
        else
        {
            roomIdx++; DoRoomSearchLogic();
        }
    }
 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(); });
         }
     }
 }
Exemplo n.º 19
0
    private void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj)
    {
        Dictionary <string, object> _prams = eventObj.getProperties();

        if (_prams != null && _prams.ContainsKey("Level"))
        {
            int _value = int.Parse(_prams["Level"].ToString());
            if (_value == int.Parse(matchRoomData["Level"].ToString()))
            {
                currRoomId = eventObj.getData().getId();
                Debug.Log("Joining Room " + currRoomId);
                WarpClient.GetInstance().JoinRoom(currRoomId);
                WarpClient.GetInstance().SubscribeRoom(currRoomId);
            }
            else
            {
                roomIdx++;
                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);
            }
        }
    }
Exemplo n.º 21
0
    private void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj)
    {
        Dictionary <string, object> _prams = eventObj.getProperties();

        if (_prams != null && _prams.ContainsKey("Password"))
        {
            string _pass = _prams["Password"].ToString();
            if (_pass == matchRoomData["Password"].ToString())
            {
                curRoomId = eventObj.getData().getId();
                UpdateStatus("Joining Room " + curRoomId);
                WarpClient.GetInstance().JoinRoom(curRoomId);
                WarpClient.GetInstance().SubscribeRoom(curRoomId);
            }
            else
            {
                roomIdx++;
                DoRoomSearchLogic();
                unityObjects["Btn_Play"].SetActive(true);
            }
        }
    }
Exemplo n.º 22
0
    private void OnGetLiveRoomInfo(LiveRoomInfoEvent eventObj)
    {
        Dictionary <string, object> _prams = eventObj.getProperties();

        if (_prams != null && _prams.ContainsKey("Password"))
        {
            string _pass = _prams["Password"].ToString();
            Debug.Log("_pass - " + _pass);
            Debug.Log("_password - " + _password);
            Debug.Log("_passs - " + matchRoomData["Password"].ToString());

            if (_pass == matchRoomData["Password"].ToString())
            {
                curRoomId = eventObj.getData().getId();
                UpdateStatus("Joining Room " + curRoomId);
                if (_prams.ContainsKey("PlayerOneColor"))
                {
                    GameManager.Instance.PlayerTwoColor = GameManager.Instance.PlayerOneColor;
                    GameManager.Instance.PlayerOneColor = (Character.CharacterColors)Enum.Parse(typeof(Character.CharacterColors), _prams["PlayerOneColor"].ToString());
                    GameManager.Instance._playersDictionary.Add(eventObj.getData().getRoomOwner(), GameManager.Instance.PlayerOneColor);
                    var _maxX = GameManager.Instance.GetBoard.GetWidth - 1;
                    var _maxY = GameManager.Instance.GetBoard.GetHeight - 1;
                    Cursor.cursorInstance.MoveCursor(_maxX, _maxY);
                }

                Debug.Log("Player one color - " + GameManager.Instance.PlayerOneColor);
                WarpClient.GetInstance().JoinRoom(curRoomId);
                WarpClient.GetInstance().SubscribeRoom(curRoomId);
            }
            else
            {
                UpdateStatus("Password Incorrect");
                Debug.Log("Password Incorrect");
                roomIdx++;
                DoRoomSearchLogic();
            }
        }
    }
Exemplo n.º 23
0
    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 onUpdatePropertyDone(LiveRoomInfoEvent liveRoomInfoEvent)
 {
     Log ("Result :" + liveRoomInfoEvent.getResult () + "Count :" + liveRoomInfoEvent.getProperties ().Count);
 }
Exemplo n.º 25
0
        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();
            }
        }
Exemplo n.º 26
0
 public void onUpdatePropertyDone(LiveRoomInfoEvent lifeLiveRoomInfoEvent)
 {
     if (lifeLiveRoomInfoEvent.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Dictionary<string, object> d = lifeLiveRoomInfoEvent.getProperties();
         System.Diagnostics.Debug.WriteLine("property successfully updated by you");
     
         
     }
 }
Exemplo n.º 27
0
    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 onUpdatePropertyDone(LiveRoomInfoEvent lifeLiveRoomInfoEvent)
 {
     if (lifeLiveRoomInfoEvent.getResult() == WarpResponseResultCode.SUCCESS)
     {
         GlobalContext.tableProperties = lifeLiveRoomInfoEvent.getProperties();
     }
 }