#Happy Turkey Day ๐Ÿฆƒ

1 messages ยท Page 1 of 1 (latest)

clever moss
#

using ExitGames.Client.Photon;
using UnityEngine;
using UnityEngine.UI;

public class ConnectToServer : Photon.MonoBehaviour
{
    [SerializeField] private InputField UsernameInput;
    public Button Boybutton;
    public Button Girlbutton;
    private bool isBoy = true;

    void Start()
    {
        Debug.Log("Calling ConnectUsingSetting");
        //Connect to game version v1
        bool connected = PhotonNetwork.ConnectUsingSettings("1");
        Debug.Log("Finished Calling ConnectUsingSetting: " + connected);
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnConnectedToServer()
    {
        Debug.Log("WE Connected to server! ");
    }

    public void OnConnectedToMaster()
    {
        Debug.Log("WE Connected to master!");
    }

    public void OnDisconnected()
    {
        Debug.Log("Ouch we disconnected!");
    }

    public void JoinGame()
    {
        Debug.Log("Trying To Join Game");
        PhotonNetwork.playerName = UsernameInput.text;
        Hashtable hash = new Hashtable();
        hash.Add("isBoy", isBoy);
        PhotonNetwork.player.SetCustomProperties(hash);
        RoomOptions roomOptions = new RoomOptions
        {
            MaxPlayers = 5
        };
        PhotonNetwork.JoinOrCreateRoom("MainWorld", roomOptions, TypedLobby.Default);
    }

    private void OnJoinedRoom()
    {
        Debug.Log("Trying to Load into room!");
        PhotonNetwork.LoadLevel("TNTTSimulatorOnline");
    }

    public void BoyClicked()
    {
        isBoy = true;
        Boybutton.Select();
    }

    public void GirlClicked()
    {
        isBoy = false;
        Girlbutton.Select();
    }
}
#

Current Error: (I waited a hot min too for a callback)

#

Note: using unsecured websockets

clever moss
#

Fixed!!!!

Updated to PUN 2 with secured web sockets