61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using Newtonsoft.Json;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class UIBootstrap : MonoSingleton<UIBootstrap>
|
|
{
|
|
public string url;
|
|
public Editinformation editinformation = new Editinformation();
|
|
public List<Traininginformation> traininginformations = new List<Traininginformation>();
|
|
|
|
// Start is called before the first frame update
|
|
private async void Start()
|
|
{
|
|
editinformation = await AsyncWebReq.Post<Editinformation>(url, null);
|
|
for (int i = 0; i < editinformation.data.Count; i++)
|
|
{
|
|
Traininginformation t = new Traininginformation();
|
|
t = Jsonanalyze.FromJson<Traininginformation>(editinformation.data[i].VirtualPath);
|
|
traininginformations.Add(t);
|
|
}
|
|
AdamSync.SyncCreateRoom.getRoomsRequset += OnGetRooms;
|
|
AdamSync.SyncCreateRoom.getroomusersRequset += OnGetRoomsUsers;
|
|
AdamSync.SyncCreateRoom.onlineRequset += OnGetRoomsInfo;
|
|
}
|
|
public void OnGetRooms(string msg)
|
|
{
|
|
Debug.Log("OnGetRooms====" + msg);
|
|
}
|
|
public void OnGetRoomsUsers(string msg)
|
|
{
|
|
Debug.Log("OnGetRooms====" + msg);
|
|
}
|
|
public void OnGetRoomsInfo(string msg)
|
|
{
|
|
Debug.Log("OnGetRooms====" + msg);
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown("o"))
|
|
{
|
|
string info = "getrooms ";
|
|
Debug.Log(info);
|
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(info);
|
|
}
|
|
if (Input.GetKeyDown("g"))
|
|
{
|
|
string info = "getroomusers ";
|
|
Debug.Log(info);
|
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(info);
|
|
}
|
|
if (Input.GetKeyDown("i"))
|
|
{
|
|
string info = "send2room "+"进入房间";
|
|
Debug.Log(info);
|
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(info);
|
|
}
|
|
}
|
|
}
|