// Use this for initialization
    void Start()
    {
        roomName.text = ChooseGameUI.selectedRoom;

        gdRt = GamedoniaRT.SharedInstance ();
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_JOIN_ROOM_SUCCESS, OnJoinRoomSuccess);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_JOIN_ROOM_ERROR, OnJoinRoomError);
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        gdRt = GamedoniaRT.SharedInstance ();

        reset ();

        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_CREATE_ROOM_SUCCESS,OnCreateRoomSuccess);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_CREATE_ROOM_ERROR,OnCreateRoomError);

        errorText.text = "";
    }
예제 #3
0
 void Start()
 {
     reset ();
     gdRt = GamedoniaRT.SharedInstance ();
 }
예제 #4
0
    //----------------------------------------------------------
    // Unity calback methods
    //----------------------------------------------------------
    void Start()
    {
        gameUI = GameObject.Find("UI").GetComponent<GameUI>();

        gdRt = GamedoniaRT.SharedInstance ();

        reset ();

        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_CONNECTION_LOST, OnConnectionLost);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_USER_JOINED_ROOM, OnUserJoinedRoom);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_SET_USER_VARIABLES_SUCCESS, OnSetUserVariablesSuccess);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_USER_LEFT_ROOM, OnUserLeftRoom);
        gdRt.AddEventListener (GamedoniaEvents.ON_LEAVE_ROOM_SUCCESS, OnLeaveRoomSuccess);
        gdRt.AddEventListener (GamedoniaEvents.ON_LEAVE_ROOM_ERROR, OnLeaveRoomError);
        gdRt.AddEventListener (GamedoniaEvents.ON_SEND_PUBLIC_MESSAGE_SUCCESS, OnPublicMessageSuccess);
        gdRt.AddEventListener (GamedoniaEvents.ON_PUBLIC_MESSAGES_RECEIVED, OnPublicMessagesReceived);

        isSpectator = gdRt.roomsManager.GetLastJoinedRoom ().IsSpectator (gdRt.me);

        if (!isSpectator) {
            // Random avatar and color
            int numModel = UnityEngine.Random.Range (0, playerModels.Length);
            int numMaterial = UnityEngine.Random.Range (0, playerMaterials.Length);
            SpawnLocalPlayer (numModel, numMaterial);

            GameUI ui = GameObject.Find ("UI").GetComponent ("GameUI") as GameUI;
            ui.SetAvatarSelection (numModel);
            ui.SetColorSelection (numMaterial);
        }

        //Cargamos en la ventana del chat los mensajes que tengamos almacenados en el Buffer hasta el momento
        Room room = gdRt.roomsManager.GetLastJoinedRoom ();

        foreach (Map message in room.GetPublicMessages()) {

            gameUI.chatContentText.text += "<b><color=darkblue>" + message.GetString("u") +"</color></b>: "+  message.GetString("m") + "\n";

        }

        //Serializamos a fichero un mensaje
        List<Gamedonia.Rt.Entities.UserVariable> userVariables = new List<Gamedonia.Rt.Entities.UserVariable>();
        userVariables.Add(new Gamedonia.Rt.Entities.UserVariable("x", 1.1));
        userVariables.Add(new Gamedonia.Rt.Entities.UserVariable("y", 1.653));
        userVariables.Add(new Gamedonia.Rt.Entities.UserVariable("z", 1.2332));
        userVariables.Add(new Gamedonia.Rt.Entities.UserVariable("rot", 0.68));
        SetUserVariablesOperation suvop = new SetUserVariablesOperation(userVariables,gdRt.me);
        suvop.WriteFile ();
    }
예제 #5
0
    // Use this for initialization
    void Start()
    {
        reset ();

        gdRt = GamedoniaRT.SharedInstance ();
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_JOIN_ROOM_SUCCESS, OnJoinRoomSuccess);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_JOIN_ROOM_ERROR, OnJoinRoomError);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_ROOM_ADDED_TO_GROUP, OnRoomAddedToGroup);
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_USERS_IN_ROOMS_CHANGED, OnRoomAddedToGroup); // Same callback, we just refresh
        gdRt.eventsDispatcher.AddEventListener (GamedoniaEvents.ON_ROOM_WAS_CLOSED, OnRoomAddedToGroup);

        PrintRoomsList ();
    }