private void OnRoomsInRangeOccured(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        //Debug.Log("OnRoomsInRange: " + _IsSuccess + " " + eventObj.getRoomsData());
        if (_IsSuccess)
        {
            rooms = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("Getting Live info on room " + roomData.getId());
                Debug.Log("Room Owner " + roomData.getRoomOwner());
                rooms.Add(roomData.getId());
            }

            index = 0;
            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(username, username, 2, data, 100);
            }
        }
        else
        {
            Debug.Log("OnRoomsInRangeOccured: connection failed!");
        }
    }
Ejemplo n.º 2
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     Log("onGetMatchedRooms: ", eventObj.getResult());
     if (eventObj.getResult() == 0)
     {
         RoomData[] rooms = eventObj.getRoomsData();
         ;
         foreach (RoomData room in rooms)
         {
             if (room.getName() == Master.getInstance().roomName)
             {
                 AppWarp.roomID = room.getId();
                 break;
             }
         }
         if (AppWarp.roomID != null)
         {
             WarpClient.GetInstance().JoinRoom(AppWarp.roomID);
             Log(AppWarp.roomID);
         }
         else
         {
             WarpClient.GetInstance().CreateRoom(Master.getInstance().roomName, Master.getInstance().username, 2, null);
         }
     }
 }
Ejemplo n.º 3
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     Log("onGetMatchedRooms: ", eventObj.getResult());
     if ((ResultCode)eventObj.getResult() == ResultCode.SUCCESS)
     {
         string     matchedRoomID = null;
         RoomData[] rooms         = eventObj.getRoomsData();
         foreach (RoomData room in rooms)
         {
             Log(room.getName() + " vs. " + roomNameFilter);
             if (room.getName() == (roomNameFilter))
             {
                 Log("Found appropriate room");
                 matchedRoomID = room.getId();
                 break;
             }
         }
         if (string.IsNullOrEmpty(matchedRoomID))
         {
             Log("No appropriate room found");
             if (roomFoundEvent != null)
             {
                 roomFoundEvent(null);
             }
         }
         else
         {
             currentRoom_ID = matchedRoomID;
             WarpClient.GetInstance().GetLiveRoomInfo(matchedRoomID);
         }
     }
 }
Ejemplo n.º 4
0
    public void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        if (_IsSuccess)
        {
            List <string> rooms = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("Getting Live info on room " + roomData.getId());
                Debug.Log("Room Owner " + roomData.getRoomOwner());
                Debug.Log("Room Name" + roomData.getName());
                if (roomData.getName().Contains(RoomLevel.roomLevel))
                {
                    Debug.Log("Found room for my level" + RoomLevel.roomLevel);
                    rooms.Add(roomData.getId());
                }
            }

            int index = 0;
            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 " + RoomLevel.roomLevel);
                isOwner = true;
                myTurn  = true;
                WarpClient.GetInstance().CreateTurnRoom("Room " + DateTime.UtcNow.ToString() + " " + RoomLevel.roomLevel, SC_Multyplayer_Globals.userName, 2, null, 60);
            }
        }
    }
Ejemplo n.º 5
0
 public static void FireRoomsAvailable(MatchedRoomsEvent matchedRoomsEvent)
 {
     if (onRoomListFetched != null)
     {
         onRoomListFetched(matchedRoomsEvent);
     }
 }
Ejemplo n.º 6
0
    public void InstantiateRoom(MatchedRoomsEvent matchedRooms)
    {
        foreach (JoinRoomRow t in item)
        {
//			if (!t.roomid.Equals (matchedRooms.getRoomsData () [item.IndexOf (t)].getId()))
            Destroy(t.gameObject);
        }
        item = new List <JoinRoomRow> ();

        roomListToggleGroup.allowSwitchOff = true;
        for (int i = 0; i < matchedRooms.getRoomsData().Length; i++)
        {
            if (IsRoomCreatedOfID(matchedRooms.getRoomsData() [i].getId()))
            {
                continue;
            }

            GameObject g = Instantiate(itemPrefab) as GameObject;
            g.transform.SetParent(transform);
            g.transform.localScale    = Vector3.one;
            g.transform.localPosition = Vector3.zero;

            JoinRoomRow row = g.GetComponent <JoinRoomRow>();
            row.roomid            = matchedRooms.getRoomsData()[i].getId();
            row.roomNameText.text = matchedRooms.getRoomsData() [i].getName();

            item.Add(row);
            g.SetActive(true);

            g.GetComponent <Toggle> ().isOn = false;
        }

        roomListToggleGroup.allowSwitchOff = false;
    }
Ejemplo n.º 7
0
    private void HandleOnRoomListFetched(MatchedRoomsEvent matchedRoom)
    {
        Debug.LogError("HandleOnRoomListFetched");

        if (matchedRoom.getRoomsData() != null)
        {
            if (matchedRoom.getRoomsData().Length == 0)
            {
                if (roomSearchCounter < maxTimerForRoomSearch)
                {
                    roomSearchCounter++;

                    StartCoroutine(GetRooms());
                }
                else
                {
                    roomSearchCounter = 0;
                    NetworkManager.Instance.CreateRoomWithName(loginDetails.game_id + "_" + loginDetails.TableNumber, int.Parse(loginDetails.max_player));
                }
            }
            else
            {
                Constants.GameID = matchedRoom.getRoomsData() [0].getName();
                NetworkManager.Instance.SubscribeRoom(matchedRoom.getRoomsData() [0].getId());
            }
        }
    }
Ejemplo n.º 8
0
    private void HandleOnRoomListReceived(MatchedRoomsEvent matchedRoom)
    {
        roomFound = false;
        if (matchedRoom.getRoomsData() == null)
        {
            txtMessage.color = Color.red;
            txtMessage.text  = Constants.MESSAGE_NO_TABLE;
            CancelInvoke("OnRefreshButtonTap");
            Invoke("OnRefreshButtonTap", 5f);
            return;
        }
        else if (matchedRoom.getRoomsData().Length < 1)
        {
            txtMessage.color = Color.red;
            txtMessage.text  = Constants.MESSAGE_NO_TABLE;
            CancelInvoke("OnRefreshButtonTap");
            Invoke("OnRefreshButtonTap", 5f);
            return;
        }

        roomFound        = true;
        txtMessage.color = Color.green;
        txtMessage.text  = Constants.MESSAGE_SELECT_TABLE;
        scrollList.InstantiateRoom(matchedRoom);
    }
Ejemplo n.º 9
0
 private static void OnRoomsInRangeBroadcast(bool isSuccess, MatchedRoomsEvent eventObj)
 {
     //Debug.Log("SharedDataHandler: OnRoomsInRangeBroadcast called");
     if (OnRoomsInRange != null)
     {
         OnRoomsInRange(isSuccess, eventObj);
     }
 }
Ejemplo n.º 10
0
 /// Invoked when a response from GetRoomWithNUser and GetRoomWithProperties
 /// <param name="matchedRoomsEvent"></param>
 public void onGetMatchedRoomsDone(MatchedRoomsEvent matchedRoomsEvent)
 {
     if (matchedRoomsEvent.getResult() == WarpResponseResultCode.SUCCESS)
     {
         /* Deployment.Current.Dispatcher.BeginInvoke(() =>
          * {
          *   MessageBox.Show(matchedRoomsEvent.getRoomsData);
          * });*/
     }
 }
Ejemplo n.º 11
0
 /// Invoked when a response from GetRoomWithNUser and GetRoomWithProperties 
 /// <param name="matchedRoomsEvent"></param>
 public void onGetMatchedRoomsDone(MatchedRoomsEvent matchedRoomsEvent)
 {
     if (matchedRoomsEvent.getResult() == WarpResponseResultCode.SUCCESS)
     {
         /* Deployment.Current.Dispatcher.BeginInvoke(() =>
          {
              MessageBox.Show(matchedRoomsEvent.getRoomsData);
          });*/
     }
 }
Ejemplo n.º 12
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     //Twist.AppController.showToast ("onGetMatchedRoomsDone");
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         foreach (var roomData in eventObj.getRoomsData())
         {
         }
     }
 }
Ejemplo n.º 13
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Log("GetMatchedRooms event received with success status");
         foreach (var roomData in eventObj.getRoomsData())
         {
             Log("Room ID:" + roomData.getId());
         }
     }
 }
Ejemplo n.º 14
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS && OnRoomsInRange != null)
     {
         OnRoomsInRange(true, eventObj);
     }
     else if (OnRoomsInRange != null)
     {
         OnRoomsInRange(false, null);
     }
 }
Ejemplo n.º 15
0
    public void OnRoomsInRange(bool isSuccess, MatchedRoomsEvent eventObj)
    {
        if (isSuccess)
        {
            Debug.Log("Parsing rooms..");
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("Room Id: " + roomData.getId());
                Debug.Log("Room Owner: " + roomData.getRoomOwner());
                SharedDataHandler.enemyUsername = roomData.getRoomOwner();
                model.Rooms.Add(roomData.getId());
            }

            roomIndex = 0;
            SearchRoom(roomIndex);
        }
    }
Ejemplo n.º 16
0
    public void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        Debug.Log("OnRoomsInRange: " + _IsSuccess + " " + eventObj.getRoomsData());
        if (_IsSuccess)
        {
            SC_MultiPlayer_Globals.rooms = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("Getting Live info on room " + roomData.getId());
                Debug.Log("Room Owner " + roomData.getRoomOwner());
                SC_MultiPlayer_Globals.rooms.Add(roomData.getId());
            }

            SC_MultiPlayer_Globals.index = 0;
            if (SC_MultiPlayer_Globals.index < SC_MultiPlayer_Globals.rooms.Count)
            {
                Debug.Log("Getting Live Info on room: " + SC_MultiPlayer_Globals.rooms[SC_MultiPlayer_Globals.index]);
                WarpClient.GetInstance().GetLiveRoomInfo(SC_MultiPlayer_Globals.rooms[SC_MultiPlayer_Globals.index]);
                SC_MultiPlayer_View.Instance.CurrentTurnText.gameObject.SetActive(true);
                SC_MultiPlayer_View.Instance.WhosTurnSprite.SetActive(true);
            }
            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);
            }
            //this bool responsible to aware us if there is a room that Match the bet.

            //if (!roomMatch)
            //{
            //    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);
            //}
        }
        else
        {
            GameObject.Find("Btn_Play").GetComponent <Button>().interactable = true;
        }
    }
Ejemplo n.º 17
0
    private void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        Debug.Log("OnRoomsInRange: " + eventObj.getRoomsData().Length + " Rooms.");
        if (_IsSuccess)
        {
            roomIds = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("RoomId: " + roomData.getId());
                Debug.Log("Room Owner: " + roomData.getRoomOwner());
                roomIds.Add(roomData.getId());
            }

            roomIdx = 0;
            DoRoomSearchLogic();
        }
        else
        {
            Debug.Log("OnRoomsInRange: Failed to load rooms.");
        }
    }
Ejemplo n.º 18
0
    public void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        if (_IsSuccess)
        {
            UpdateStatus("Searching for available rooms..");
            rooms = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                //Debug.Log("Room Id: " + roomData.getId());
                //Debug.Log("Room Owner: " + roomData.getRoomOwner());
                rooms.Add(roomData.getId());
            }

            roomIndex = 0;
            DoRoomSearchLogic();
        }
        else
        {
            UpdateError("Can't find rooms. \n Please try again later.");
        }
    }
Ejemplo n.º 19
0
    private void HandleOnRoomListFetched(MatchedRoomsEvent matchedRoom)
    {
        if (matchedRoom.getRoomsData() != null)
        {
            if (matchedRoom.getRoomsData().Length == 0)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict.Add("ROOM_NAME", Constants.GameID + "_" + breakingTableNumber);
                dict.Add("room_name", "room_name");
                if (LoginScript.loginDetails != null)
                {
                    dict.Add(Constants.ROOM_PROP_ROOM_NAME, LoginScript.loginDetails.game_id);
                    dict.Add(Constants.ROOM_PROP_GAME_ROOM_ID, LoginScript.loginDetails.game_id);
                }
                else
                {
                    dict.Add(Constants.ROOM_PROP_ROOM_NAME, Constants.GameID);
                    dict.Add(Constants.ROOM_PROP_GAME_ROOM_ID, Constants.GameID);
                }
                dict.Add(Constants.ROOM_PROP_TABLE_NUMBER, breakingTableNumber);

                if (UIManager.Instance.gameType == POKER_GAME_TYPE.TABLE)
                {
                    NetworkManager.Instance.CreateRoom(Constants.GameID, Constants.TABLE_GAME_MAX_PLAYERS, dict);
                }
                else if (UIManager.Instance.gameType == POKER_GAME_TYPE.TEXAS)
                {
                    NetworkManager.Instance.CreateRoom(Constants.GameID, Constants.TEXASS_GAME_MAX_PLAYERS, dict);
                }
                else if (UIManager.Instance.gameType == POKER_GAME_TYPE.WHOOPASS)
                {
                    NetworkManager.Instance.CreateRoom(Constants.GameID, Constants.WHOOPASS_GAME_MAX_PLAYERS, dict);
                }
            }
            else
            {
                NetworkManager.Instance.SubscribeRoom(matchedRoom.getRoomsData()[0].getId());
            }
        }
    }
Ejemplo n.º 20
0
    public void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        if (_IsSuccess)
        {
            UpdateStatus("Parsing rooms..");
            rooms = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("Room Id: " + roomData.getId());
                Debug.Log("Room Owner: " + roomData.getRoomOwner());
                rooms.Add(roomData.getId());
            }

            index = 0;
            DoRoomSearchLogic();
        }
        else
        {
            UpdateStatus("Error finding room..");
            changeScreens(screen.Menu_Multi);
        }
    }
Ejemplo n.º 21
0
    private void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent eventObj)
    {
        Debug.Log(_IsSuccess + " " + "" + eventObj.getRoomsData().Length);
        if (_IsSuccess)
        {
            UpdateStatus("Parsing Rooms");
            roomIds = new List <string>();
            foreach (var roomData in eventObj.getRoomsData())
            {
                Debug.Log("RoomId " + roomData.getId());
                Debug.Log("Room Owner " + roomData.getRoomOwner());
                roomIds.Add(roomData.getId());
            }

            roomIdx = 0;
            DoRoomSearchLogic();
        }
        else
        {
            UpdateStatus("Error Fetching Rooms in Range");
        }
    }
Ejemplo n.º 22
0
    private void OnRoomsInRange(bool _IsSuccess, MatchedRoomsEvent evetObj)
    {
        // Debug.Log(_IsSuccess + " " + evetObj.getRoomsData().Length);
        if (_IsSuccess)
        {
            UpdateStatus("Parsing Rooms.");
            roomIds = new List <string>();
            foreach (var roomData in evetObj.getRoomsData())
            {
                Debug.Log("Room Id " + roomData.getId());
                Debug.Log("Room Owner " + roomData.getRoomOwner());
                roomIds.Add(roomData.getId());
            }

            roomIdx = 0;
            DoRoomSearchLogic();
        }
        else
        {
            UpdateStatus("Error fetching room data");
            unityObjects["Btn_Play"].GetComponent <Button>().interactable = true;
        }
    }
Ejemplo n.º 23
0
    public void OnGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
    {
        Debug.Log("OnGetMatchedRoomsDone : " + eventObj.getResult());
        rooms = new List<string>();
        foreach (var roomData in eventObj.getRoomsData())
        {
            rooms.Add(roomData.getId()); // add to the list of rooms id
        }

        Debug.Log("Number of rooms found: " + rooms.Count);

        if (rooms.Count > 0)
        {
            roomId = rooms[0];
            //false = created room
            //true  = joined room
            created_or_joined = true;
            SC_AppWarpKit.JoinToRoom(rooms[0]); //rooms[0] is the last created room in the list
        }
        else
        {
            Debug.Log("no room exists - need to create");
            SC_AppWarpKit.CreateTurnBaseRoom("BattleShips" + UnityEngine.Random.Range(0, 1000), userName, 2, null, 60);
        }
    }
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Log ("GetMatchedRooms event received with success status");
         foreach (var roomData in eventObj.getRoomsData())
         {
             Log("Room ID:" + roomData.getId());
         }
     }
 }
    public void OnGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
    {
        Debug.Log("OnGetMatchedRoomsDone : " + eventObj.getResult());
        if (isUserConnected) {
            rooms = new List<string> ();

            foreach (var roomData in eventObj.getRoomsData()) {
                Debug.Log ("Room ID:" + roomData.getId () + ", " + roomData.getRoomOwner ());
                rooms.Add (roomData.getId ()); // add to the list of rooms id
            }

            index = 0;
            if (index < rooms.Count) {
                SC_AppWarpKit.GetLiveRoomInfo (rooms [index]);
            } else {
                Debug.Log ("No Rooms");
                SC_AppWarpKit.CreateTurnBaseRoom ("ROOM" + Time.time, userName, 2, null, turnTime);
            }
        }
    }
Ejemplo n.º 26
0
        public void onGetMatchedRoomsDone(MatchedRoomsEvent matchedRoomsEvent)
        {
            Player p = Listener as Player;

            p.GetRoomWithProperties(matchedRoomsEvent);
        }
 //invoke when GetRoomInRange is called
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     if (OnMatchedRooms != null)
         OnMatchedRooms(eventObj);
 }
 public void onGetMatchedRoomsDone(MatchedRoomsEvent matchedRoomsEvent)
 {
     throw new System.NotImplementedException ();
 }
Ejemplo n.º 29
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
 }
Ejemplo n.º 30
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent matchedRoomsEvent)
 {
     Debug.Log ("onGetMatchedRoomsDone : " + matchedRoomsEvent.getResult());
     appWarpResponse+="onGetMatchedRoomsDone : " + matchedRoomsEvent.getResult()+"\n";
 }
Ejemplo n.º 31
0
    public void OnGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
    {
        Debug.Log("OnGetMatchedRoomsDone : " + eventObj.getResult());
        rooms = new List<string>();
        foreach (var roomData in eventObj.getRoomsData())
        {
            Debug.Log("Room ID:" + roomData.getId() + ", " + roomData.getRoomOwner());
            guiText.text += "Room ID:" + roomData.getId() + ", " + roomData.getRoomOwner() + System.Environment.NewLine;
            rooms.Add(roomData.getId()); // add to the list of rooms id
        }

        Debug.Log("Rooms Amount: " + rooms.Count);
        if(rooms.Count > 0)
        {
            roomId = rooms[0];
            SC_AppWarpKit.JoinToRoom (rooms[0]);
        }
    }
Ejemplo n.º 32
0
 internal void GetRoomWithProperties(MatchedRoomsEvent matchedRoomsEvent)
 {
     Console.WriteLine("Rooms getted");
 }