コード例 #1
0
ファイル: ScrollList.cs プロジェクト: stevenpark88/PokerGame
    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;
    }
コード例 #2
0
ファイル: LoginScript.cs プロジェクト: stevenpark88/PokerGame
    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());
            }
        }
    }
コード例 #3
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);
    }
コード例 #4
0
    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!");
        }
    }
コード例 #5
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);
         }
     }
 }
コード例 #6
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);
         }
     }
 }
コード例 #7
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);
            }
        }
    }
コード例 #8
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;
        }
    }
コード例 #9
0
 public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj)
 {
     //Twist.AppController.showToast ("onGetMatchedRoomsDone");
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         foreach (var roomData in eventObj.getRoomsData())
         {
         }
     }
 }
コード例 #10
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());
         }
     }
 }
コード例 #11
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.");
        }
    }
コード例 #12
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());
            }
        }
    }
コード例 #13
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");
        }
    }
コード例 #14
0
    private void OnRoomsInRange(bool _IsSucces, MatchedRoomsEvent eventObj)
    {
        Debug.Log(_IsSucces + " " + eventObj.getRoomsData().Length);
        if (_IsSucces)
        {
            UpdateStatus("Parsing Rooms...");
            roomIds = new List <string>();
            foreach (var roomData in eventObj.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_Menu_Play"].GetComponent <Button>().interactable = true;
        }
    }
コード例 #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);
        }
    }
コード例 #16
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.");
        }
    }
コード例 #17
0
ファイル: UI_Manager.cs プロジェクト: guttman10/BackUp
    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);
        }
    }
コード例 #18
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());
         }
     }
 }
コード例 #19
0
ファイル: SC_Logic.cs プロジェクト: DFaiz/BattleShipGame
    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);
        }
    }
コード例 #20
0
    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);
            }
        }
    }
コード例 #21
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]);
        }
    }