This commit is contained in:
yulong 2024-03-20 08:47:41 +08:00
commit f41a25325d
3 changed files with 42 additions and 20 deletions

View File

@ -303,6 +303,7 @@ public class View_Panel2 : XUIPanel
GameObject.Destroy(place.GetChild(i).gameObject);
}
}
UIBootstrap.Instance.GetAllSceneRoots(roomdata);
UIBootstrap.Instance.SetRoomdata(roomdata);
UIBootstrap.Instance.CheckShowLoad(CreateRoom);
//CreateRoom();
@ -624,24 +625,24 @@ public class View_Panel2 : XUIPanel
currentRoomData = await AsyncWebReq.Get<RSData.RoomSubjectData>(url);
GameObject.Destroy(roomItem.gameObject);
});
string roomModelTemp = "";
Task task = Task.Run(async () =>
{
roomModelTemp= await UIBootstrap.Instance.GetSceneModelByRoomID(roomId);
});
Debug.LogError(roomModelTemp);
if (GlobalFlag.field_Char1 == "学校")
string roomMode = UIBootstrap.Instance.GetRoomModelByThinkingDataAndRoomID(roomItem.name);
Debug.Log(UIBootstrap.Instance.GetRoomModelByThinkingDataAndRoomID(roomItem.name));
if (roomMode == "学校")
{
roomItem.transform.Find("view_imag").GetComponent<Image>().sprite = xuexiao;
}
else if (GlobalFlag.field_Char1 == "山地")
else if (roomMode == "山地")
{
roomItem.transform.Find("view_imag").GetComponent<Image>().sprite = shandi;
}
}
private void ChanageImage(string roomModel)
{
Debug.LogError(roomModel);
}
public RSData.SubjectInfo currentSubjectInfo = new RSData.SubjectInfo();
public string currentDIPracticeID;
@ -896,8 +897,8 @@ public class View_Panel2 : XUIPanel
//创建房间
if (roomState.message == "success")
{
Debug.LogError(returnRoomId.data);
Debug.LogError(currentRoomName);
//Debug.LogError(returnRoomId.data);
//Debug.LogError(currentRoomName);
CreateRoomBase(returnRoomId.data, currentRoomName);
refresh_btn.onClick?.Invoke();
}

View File

@ -17,6 +17,7 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
private string sceneInfoUrl;
public Editinformation editinformation = new Editinformation();
public SceneRoot currentSceneInfo = new SceneRoot();
public List<SceneRoot> sceneRoots = new List<SceneRoot>();
public List<RSData.SubjectDataItem> subjectInfo = new List<RSData.SubjectDataItem>();
public List<Traininginformation> traininginformations = new List<Traininginformation>();
public AdamThinkDevicesData.DeviceData thinkDevicesData = new AdamThinkDevicesData.DeviceData();
@ -46,6 +47,8 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
public async void GetSceneData(string roomId)
{
string _url = sceneInfoUrl + roomId;
@ -55,13 +58,6 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
}
public async Task<string> GetSceneModelByRoomID(string roomId)
{
string _url = sceneInfoUrl + roomId;
//Debug.LogError(_url);
currentSceneInfo = await AsyncWebReq.Get<SceneRoot>(_url);
return currentSceneInfo.data.Field_Char1;
}
public void GetSubjectInfo(List<RSData.SubjectDataItem> sdi)
{
subjectInfo = sdi;
@ -98,6 +94,31 @@ public class UIBootstrap : MonoSingleton<UIBootstrap>
}
return 0;
}
public async void GetAllSceneRoots(RoomData roomId)
{
for (int i = 0; i < roomId.data.Count; i++)
{
SceneRoot s = new SceneRoot();
string _url = sceneInfoUrl + roomId.data[i].Id;
s = await AsyncWebReq.Get<SceneRoot>(_url);
if (!sceneRoots.Contains(s))
sceneRoots.Add(s);
}
}
/// <summary>
/// 通过 房间 ID 获取 该房间的想定信息,然后解析出所属地形
/// </summary>
public string GetRoomModelByThinkingDataAndRoomID(string roomID)
{
for (int i = 0; i < sceneRoots.Count; i++)
{
if (sceneRoots[i].data.Id == roomID)
{
return sceneRoots[i].data.Field_Char1;
}
}
return "";
}
public List<List_paraItem> GetListParaItemById(string deviceId)
{

View File

@ -73,7 +73,7 @@ public static class AsyncWebReq
yield return request.SendWebRequest();//发送请求
if (request.isNetworkError || request.isHttpError)
{
//Debug.Log("cannot get data:" + request.responseCode);
Debug.Log("cannot get data:" + request.responseCode);
action(null);
}
else