Exemple #1
0
    public void OnJoinedLobby()
    {
        Debug.Log("ロビー接続");

        RoomSettings settings = new RoomSettings();

        settings.maxPlayers = 10;
        settings.isVisible  = true;
        settings.isOpen     = true;

        MonobitNetwork.JoinOrCreateRoom("room", settings, null);
    }
Exemple #2
0
    public void onClickMainBtn()     //mainボタン押下処理
    {
        switch (gameStatus)
        {
        case STS.PLAYER:
            if (inputF.text != "")
            {
                MonobitNetwork.playerName = inputF.text;
                MonobitNetwork.ConnectServer("NetworkSample_v1.0");
                setRoom();
            }
            break;

        case STS.ROOM:
            if (inputF.text != "")
            {
                string Rname = inputF.text;
                MonobitEngine.RoomSettings settings = new MonobitEngine.RoomSettings();
                settings.maxPlayers = 4;                        //max4人

                MonobitNetwork.JoinOrCreateRoom(Rname, settings, null);
                setRedy();
            }
            break;

        case STS.REDY:

            break;

        case STS.GAME:
            if (inputF.text != "")
            {
                chatWord = inputF.text;
                monobitView.RPC("RecvChat", MonobitTargets.All, MonobitNetwork.playerName, chatWord);
                inputF.text = "";
                chatWord    = "";
            }
            break;
        }
    }
        /**
         * ルーム作成設定.
         */
        private void OnGUI_CreateRoom()
        {
            // 表題
            GUILayout.Label("Create Room", new GUIStyle()
            {
                normal = new GUIStyleState()
                {
                    textColor = Color.white
                }, fontStyle = FontStyle.Bold
            });
            GUILayout.BeginHorizontal();
            GUILayout.Space(25);
            GUILayout.BeginVertical();

            // 自分の作成するルーム名を公開設定にするかどうかのフラグ
            this.isVisible = GUILayout.Toggle(this.isVisible, "Visible room");

            // 自分のルームに入室可能な収容人数の設定
            GUILayout.BeginHorizontal(new GUIStyle()
            {
                alignment = TextAnchor.MiddleLeft
            });
            GUILayout.Label("Max Players : ", GUILayout.Width(100));
            string tmpInput = GUILayout.TextField(this.maxPlayers.ToString(), GUILayout.Width(50));

            byte.TryParse(tmpInput, out this.maxPlayers);
            GUILayout.EndHorizontal();

            // 自身の名前をもとにして、ルームを作成する
            if (GUILayout.Button("Create Room", GUILayout.Width(150)))
            {
                MonobitNetwork.JoinOrCreateRoom(this.myName, new RoomSettings()
                {
                    isVisible = this.isVisible, isOpen = true, maxPlayers = this.maxPlayers
                }, null);
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
 // Update is called once per frame
 void Update()
 {
     // 未接続状態なら何もしない
     if (!MonobitNetwork.isConnect)
     {
         return;
     }
     // ルーム入室処理未実行であれば、ルームの作成or入室をする
     if (!isJoinOrCreateRoom)
     {
         MonobitNetwork.JoinOrCreateRoom("MonobitTest", new RoomSettings(), null);
         isJoinOrCreateRoom = true;
         return;
     }
     // ルーム入室済みでキャラクタ未生成であれば、キャラクタを生成する
     if (MonobitNetwork.inRoom && !isMakeMyPlayer)
     {
         MonobitNetwork.Instantiate("Player", Vector3.zero, Quaternion.identity, 0);
         isMakeMyPlayer = true;
         return;
     }
 }
Exemple #5
0
 public override void OnJoinedLobby()
 {
     Debug.Log("On join lobby.");
     MonobitNetwork.JoinOrCreateRoom("TCAvrOB", new RoomSettings(), LobbyInfo.Default);
 }
Exemple #6
0
 void OnJoinedLobby()
 {
     Debug.Log("OnJoinedLobby");
     MonobitNetwork.JoinOrCreateRoom(roomName, new RoomSettings(), LobbyInfo.Default);
 }
 void OnJoinedLobby()
 {
     bSelectMenu = false;
     Debug.Log("OnJoinedLobby");
     MonobitNetwork.JoinOrCreateRoom("AutoLoginRoom", new RoomSettings(), LobbyInfo.Default);
 }