You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
50 lines
1.4 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
|
|
public static class WebQuery
|
|
{
|
|
public static void SetInit(MonoBehaviour behaviour, ulong id, string avatarId, string roomId, RequestDelegate action)
|
|
{
|
|
var user = new UserAvatarAndRoom()
|
|
{
|
|
id = id.ToString(),
|
|
avatarId = avatarId,
|
|
roomId = roomId
|
|
};
|
|
|
|
WebRequest.Post(behaviour, "Init", JsonUtility.ToJson(user), (UnityWebRequest request, string data) =>
|
|
{
|
|
action(request, data);
|
|
});
|
|
}
|
|
|
|
public static void SetAvatar(MonoBehaviour behaviour, ulong id, string avatarId, RequestDelegate action)
|
|
{
|
|
var user = new UserAvatar()
|
|
{
|
|
id = id.ToString(),
|
|
avatarId = avatarId,
|
|
};
|
|
|
|
WebRequest.Post(behaviour, "SetAvatar", JsonUtility.ToJson(user), (UnityWebRequest request, string data) =>
|
|
{
|
|
action(request, data);
|
|
});
|
|
}
|
|
|
|
public static void SetRoom(MonoBehaviour behaviour, ulong id, string roomId, RequestDelegate action)
|
|
{
|
|
var user = new UserRoom
|
|
{
|
|
id = id.ToString(),
|
|
roomId = roomId,
|
|
};
|
|
|
|
WebRequest.Post(behaviour, "SetRoom", JsonUtility.ToJson(user), (UnityWebRequest request, string data) =>
|
|
{
|
|
action(request, data);
|
|
});
|
|
}
|
|
}
|
|
|