Beispiel #1
0
    public void createRoomFromInput()
    {
        SessionInfo sessionInfo = SessionInfo.GetInstance();

        if (sessionInfo.IsGuest())
        {
            LobbyErrorText.SetErrorCode(SessionInfo.GUESTCREATE);
            return;
        }
        if (sessionInfo.CanPlayGame())
        {
            string roomName  = roomNameInput.text;
            int    maxPlayer = 0;
            if (Int32.TryParse(maxPlayerInput.text, out maxPlayer))
            {
                Debug.Log("Max player input is " + maxPlayer);
                PhotonNetwork.CreateRoom(roomName, new RoomOptions()
                {
                    MaxPlayers = (byte)maxPlayer
                }, TypedLobby.Default);
            }
            else
            {
                LobbyErrorText.SetErrorCode(SessionInfo.MAXNOTINT);
            }
        }
        else
        {
            LobbyErrorText.SetErrorCode(SessionInfo.NOTOKENS);
        }
    }
Beispiel #2
0
 //On start up
 void Awake()
 {
     animator              = transform.Find("Sprite").GetComponent <Animator> ();
     rb2d                  = GetComponent <Rigidbody2D> ();
     shotSpawn             = GetComponentInChildren <ShotSpawn> ();
     shotSpawn.player      = gameObject;
     isoSorting            = transform.Find("Sprite").GetComponent <IsoDynamicObject> ();
     sprite                = transform.Find("Sprite").GetComponent <SpriteRenderer> ();
     playerName            = SessionInfo.GetInstance().GetSessionOwner();
     attackTrigger.enabled = false;
 }
Beispiel #3
0
 public void Toggle()
 {
     if (toggle.isOn)
     {
         SessionInfo.GetInstance().IncTokenNumber();
     }
     else
     {
         toDoList.RemoveToDo(this);
     }
     //print (toDoList.Size ());
 }
Beispiel #4
0
 void Start()
 {
     sessionInfo = SessionInfo.GetInstance();
 }
Beispiel #5
0
 public override void OnJoinedLobby()
 {
     Debug.Log("Joined Lobby");
     Invoke("refreshRooms", 0.1f);
     PhotonNetwork.player.NickName = SessionInfo.GetInstance().GetSessionOwner();
 }
Beispiel #6
0
 public void startGame()
 {
     // PhotonNetwork.LoadLevel ("Main");
     SessionInfo.GetInstance().DecTokenNumber();
     SceneManager.LoadSceneAsync("Tutorial", LoadSceneMode.Single);
 }
Beispiel #7
0
 void Start()
 {
     sessionInfo = SessionInfo.GetInstance();
     text.text   = preText + sessionInfo.GetSessionOwner() + postText;
 }