コード例 #1
0
    void ProcessRoomData(Message <Oculus.Platform.Models.Room> msg)
    {
        if (msg.Data.OwnerOptional.ID == PlatformManager.MyID)
        {
            amIServer = true;
        }
        else
        {
            amIServer = false;
        }

        // if the caller left while I was in the process of joining, just use that as our new room
        if (msg.Data.UsersOptional.Count == 1)
        {
            PlatformManager.TransitionToState(PlatformManager.State.WAITING_IN_A_ROOM);
        }
        else
        {
            PlatformManager.TransitionToState(PlatformManager.State.CONNECTED_IN_A_ROOM);
        }

        // Look for users that left
        PlatformManager.MarkAllRemoteUsersAsNotInRoom();

        foreach (User user in msg.Data.UsersOptional)
        {
            if (user.ID != PlatformManager.MyID)
            {
                if (!PlatformManager.IsUserInRoom(user.ID))
                {
                    PlatformManager.AddRemoteUser(user.ID);
                }
                else
                {
                    PlatformManager.MarkRemoteUserInRoom(user.ID);
                }
            }
        }

        PlatformManager.ForgetRemoteUsersNotInRoom();
        PlatformManager.SetFloorColorForState(amIServer);
    }