Exemplo n.º 1
0
    public void OnCreateClick()
    {
        errorText.text = "";

        if (!gameNameInputField.Equals ("")) {
            Gamedonia.Rt.Entities.RoomSettings rsettings = new Gamedonia.Rt.Entities.RoomSettings ();
            rsettings.name = gameNameInputField.text;
            rsettings.isGame = true;
            rsettings.maxUsers = 8;
            rsettings.maxSpectators = 16;
            rsettings.isHidden = hiddenToogle.isOn;

            if (!"".Equals(gamePasswordInputField.text)) rsettings.password = gamePasswordInputField.text;

            if (neverToogle.isOn) {
                rsettings.removePolicy = Room.REMOVE_POLICY_NEVER;
            }else if (emptyToogle.isOn) {
                rsettings.removePolicy = Room.REMOVE_POLICY_EMPTY;
            }else if (emptyWithTimeoutToogle.isOn) {
                rsettings.removePolicy = Room.REMOVE_POLICY_EMPTY_WITH_TIMEOUT;
            }else if (emptyCreatorDisconnectedToogle.isOn) {
                rsettings.removePolicy = Room.REMOVE_POLICY_EMPTY_AND_CREATOR_DISCONNECTED;
            }

            CreateRoomOperation crop = new CreateRoomOperation (rsettings);
            gdRt.SendOp (crop);

        } else {
            errorText.text = "Game name cannot be empty";
        }
    }
        private void CreateRoom(object sender, ExecutedRoutedEventArgs e)
        {
            var proj = (e.Parameter as Project) ?? ApplicationSettings.Instance.ActiveProject;
            var op   = new CreateRoomOperation(proj);

            proj.ExecuteOp(op);
            SetActiveProject(proj);
        }
Exemplo n.º 3
0
    void OnLoginSuccess(Gamedonia.Rt.Events.Event evt)
    {
        Debug.Log ("Logged in!!");

        //Creamos la room
        long gameRoomId = GamedoniaRT.SharedInstance().roomsManager.GetRoomIdByName("DefaultRoom");

        if (gameRoomId != -1) {
            //Room already exists
            //Join Room
            Application.LoadLevel ("ChooseGameGD");

            //JoinRoomOperation jrop = new JoinRoomOperation("GameRoom");
            //GamedoniaRT.SharedInstance().SendOp(jrop);

        } else {
            //We need to create the room

            Gamedonia.Rt.Entities.RoomSettings rsettings = new Gamedonia.Rt.Entities.RoomSettings();
            rsettings.name = "DefaultRoom";
            rsettings.isGame = true;
            rsettings.maxUsers = 8;
            rsettings.maxSpectators = 16;

            CreateRoomOperation crop = new CreateRoomOperation(rsettings);

            GamedoniaRT.SharedInstance().SendOp(crop);

        }
    }