Example #1
0
    public void JoinCustom()
    {
        /*
         *      There should be only number-inputs
         */

        if (ChannelInput.text != "")
        {
            LocalUserData.SetUserName(InputName.text);

            Dictionary <string, string> data = new Dictionary <string, string> ();

            data ["name"]       = InputName.text;
            data ["roomnumber"] = ChannelInput.text;

            /*
             * TODO: player position will be set from server-side
             */
            Vector3 position = new Vector3(0f, 0f, 0f);
            data ["position"] = position.x + "," + position.y + "," + position.z;

            SocketIOComp.Emit("SERVER:JOINCUSTOM", new JSONObject(data));

            HideChannelWindow();
            GlobalGameState.DialogueUI.Show(DialogueUIController.DialogueTypes.JoiningRoom);
        }
        else
        {
            ChannelInputPlaceHolder.text = "Channel number is necessary!";
        }
    }
Example #2
0
    public void OnClickJoinBtn()
    {
        if (InputName.text != "")
        {
            LocalUserData.SetUserName(InputName.text);

            Dictionary <string, string> data = new Dictionary <string, string> ();

            data ["name"] = InputName.text;

            /*
             *      TODO: player position will be set from server-side
             *      probably send spawn area from here?
             */
            Vector3 position = new Vector3(0f, 0f, 0f);
            data ["position"] = position.x + "," + position.y + "," + position.z;

            Vector3 rotation = new Vector3(0f, 0f, 0f);
            data ["rotation"] = rotation.x + "," + rotation.y + "," + rotation.z;

            SocketIOComp.Emit("SERVER:JOIN", new JSONObject(data));

            GlobalGameState.DialogueUI.Show(DialogueUIController.DialogueTypes.JoiningRoom);
        }
        else
        {
            InputNamePlaceHolder.text = "Nickname is necessary!";
        }
    }