This commit is contained in:
高国正 2023-08-21 21:15:07 +08:00
parent e36413a9c3
commit 33878c6abc
31 changed files with 638 additions and 267 deletions

View File

@ -19724,8 +19724,8 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0.5214252, y: -0.0024925987, z: 0.0016777486, w: 0.85329175}
m_LocalPosition: {x: 0, y: 0, z: -18.3}
m_LocalRotation: {x: -0.0015559762, y: 0.8335369, z: -0.5524572, w: -0.0021966696}
m_LocalPosition: {x: 0, y: 0, z: -4.7380123}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -19734,7 +19734,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 62.856, y: -0.314, z: 0.033}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 4.7, y: 20.2}
m_AnchoredPosition: {x: 4.73694, y: 20.184704}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &963194229
@ -19756,7 +19756,7 @@ MonoBehaviour:
fastMoveFactor: 5
rotationX: 0
rotationY: 0
initialRotationEulerAngles: {x: 62.856, y: -0.314, z: 0.033}
initialRotationEulerAngles: {x: 67.072, y: -179.714, z: -0.025}
isvalid: 1
--- !u!114 &963194230
MonoBehaviour:
@ -36332,7 +36332,7 @@ MonoBehaviour:
gj_cx:
gzp_cx:
jxp_cx:
token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2OTI2MTczNDYsInVzZXJuYW1lIjoiMTgzMTIzNDU2NzgifQ.xQBFeuU53sve5zseS_bsrn2ttEnyVZLGTaZEzeHIztM
token:
Cabinet_quYu:
- {fileID: 2381155141431868192}
- {fileID: 2381155141869121962}
@ -36575,6 +36575,7 @@ MonoBehaviour:
isVideoPlay: 0
isWorkPlay: 0
gameManager: {fileID: 1815567663}
bt: {fileID: 3383533714626686148}
--- !u!114 &1821106924
MonoBehaviour:
m_ObjectHideFlags: 0
@ -56846,10 +56847,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -19, y: 68}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533714452761131
GameObject:
@ -60168,10 +60169,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -86, y: 338}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533714592581661
GameObject:
@ -60605,10 +60606,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 224, y: -101}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533714626686147
GameObject:
@ -61669,10 +61670,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -12, y: -78}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533714719848192
GameObject:
@ -63212,10 +63213,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 127, y: -24}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3383533714776427478
CanvasRenderer:
@ -64103,10 +64104,10 @@ RectTransform:
m_Father: {fileID: 3383533715305679527}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 210.2, y: -133.4}
m_SizeDelta: {x: 267, y: 246}
m_SizeDelta: {x: 167, y: 146}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3383533714835895775
MonoBehaviour:
@ -65449,10 +65450,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -158, y: 264}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533714936216935
GameObject:
@ -67404,10 +67405,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -10, y: 302}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533715055902851
GameObject:
@ -68373,10 +68374,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 127, y: -229}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &3383533715135521024
RectTransform:
@ -70744,10 +70745,10 @@ RectTransform:
m_Father: {fileID: 2010964437}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_SizeDelta: {x: -1820, y: -980}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3383533715307974658
MonoBehaviour:
@ -76231,10 +76232,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -2, y: -157}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533715632827823
GameObject:
@ -76440,10 +76441,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 127, y: 63}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533715655194345
GameObject:
@ -79657,10 +79658,10 @@ RectTransform:
m_Father: {fileID: 3383533715305679527}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1920, y: 1080}
m_SizeDelta: {x: 1820, y: 980}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3383533715857122802
MonoBehaviour:
@ -80280,10 +80281,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -231, y: 207}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3383533715899108102
CanvasRenderer:
@ -81355,10 +81356,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -82, y: 148}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3383533715976149144
CanvasRenderer:
@ -83834,10 +83835,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -17, y: 225}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3383533716123044142
CanvasRenderer:
@ -83919,10 +83920,10 @@ RectTransform:
m_Father: {fileID: 3383533715305679527}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 676, y: 768}
m_SizeDelta: {x: 576, y: 668}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3383533716138550544
MonoBehaviour:
@ -85430,10 +85431,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 90, y: 149}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533716201857871
GameObject:
@ -86843,10 +86844,10 @@ RectTransform:
m_Father: {fileID: 3383533715305679527}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3383533716280502047
MonoBehaviour:
@ -86934,10 +86935,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -162, y: 43}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3383533716291916465
GameObject:
@ -87227,10 +87228,10 @@ RectTransform:
m_Father: {fileID: 3383533716280502046}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -148, y: -117}
m_SizeDelta: {x: 94, y: 84}
m_SizeDelta: {x: -6, y: -16}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3383533716310673276
CanvasRenderer:

View File

@ -1 +1 @@
http://7k3r7b.natappfree.cc/
http://nv929i.natappfree.cc/

View File

@ -113,34 +113,23 @@ public class GameManager : MonoBehaviour
//StartCoroutine(LoadAddress());
}
public IEnumerator Init_StartCoroutine()
{
//yield return StartCoroutine(LoadJSON(Application.streamingAssetsPath + "/设备查询.json"));
yield return StartCoroutine(LoadAddress());
//#region 正式
//TransparentGlowManage.Inst.addScript();
//if (root_AllDevice.data == null) yield break;
//#region 加载场景
//Load_Device();
//Load_Port();
//Load_TmsAlarm();
//Load_ENV();
//#endregion
//#endregion
}
private void OnEnable()
{
StartCoroutine(Init_StartCoroutine());
return;
//#region 正式
StartCoroutine(LoadAddress((ct) =>
{
if (ct != null)
{
Jk_URL = new webURL(ct);
StartCoroutine(Initialize());
}
else
{
Debug.Log("获取穿透错误!");
}
}));
//return;
#region
//TransparentGlowManage.Inst.addScript();
//await init_Device();
//await init_Port();
@ -157,7 +146,7 @@ public class GameManager : MonoBehaviour
//#endregion
//#endregion
#endregion
}
@ -232,7 +221,7 @@ public class GameManager : MonoBehaviour
}
if (isFind) continue;
}
Debug.Log("环境加载完成");
}
/// <summary>
@ -283,6 +272,7 @@ public class GameManager : MonoBehaviour
}
}
Debug.Log("告警加载完成");
}
/// <summary>
@ -345,6 +335,8 @@ public class GameManager : MonoBehaviour
{
item.gameObject.AddComponent<ClickEvent>();
});
Debug.Log("端口加载完成");
}
/// <summary>
@ -598,6 +590,8 @@ public class GameManager : MonoBehaviour
}
}
}
Debug.Log("设备加载完成");
}
/// <summary>
@ -605,7 +599,7 @@ public class GameManager : MonoBehaviour
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public async Task<IEnumerator> init_Device()
public IEnumerator init_Device()
{
for (int i = 0; i < Racks_go.Count; i++)
{
@ -631,18 +625,42 @@ public class GameManager : MonoBehaviour
TmsCards_go.Clear();
TmsCards.Clear();
var jsonResult = await CombineJSON.GetJson_POST(Jk_URL.sb_cx, token);
//var jsonResult = await CombineJSON.GetJson_POST(Jk_URL.sb_cx, token);
root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
//root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
return null;
//StartCoroutine(
// CombineJSON.GetJson_POST(Jk_URL.sb_cx, token, (jsonResult) =>
// {
// root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
// Debug.Log("设备查询完成" + "URL:" + Jk_URL.sb_cx + "Token:" + token + "返回内容" + jsonResult);
// })
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.sb_cx, token, (jsonResult) =>
{
if (string.IsNullOrEmpty(jsonResult))
{
return;
}
try
{
root_AllDevice = JsonConvert.DeserializeObject<DeviceQuery.Root>(jsonResult);
Debug.Log("设备查询完成" + "URL:" + Jk_URL.sb_cx + "Token:" + token + "返回内容" + jsonResult);
}
catch (Exception e)
{
Debug.Log("序列化-设备查询错误:" + e.Message);
}
})
); ;
}
/// <summary>
/// 查询所有端口
/// </summary>
/// <returns></returns>
public async Task<IEnumerator> init_Port()
public IEnumerator init_Port()
{
for (int i = 0; i < TmsPorts_go.Count; i++)
{
@ -652,34 +670,83 @@ public class GameManager : MonoBehaviour
TmsPorts_go.Clear();
TmsPorts.Clear();
var jsonResult1 = await CombineJSON.GetJson_POST(Jk_URL.dk_cx, token);
//var jsonResult1 = await CombineJSON.GetJson_POST(Jk_URL.dk_cx, token);
root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
//root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
//StartCoroutine(
//CombineJSON.GetJson_POST(Jk_URL.dk_cx, token, (jsonResult1) =>
//{
// root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
// Debug.Log("端口查询完成" + "URL:" + Jk_URL.dk_cx + "Token:" + token + "返回内容" + jsonResult1);
//})
//);
return null;
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.dk_cx, token, (jsonResult1) =>
{
if (string.IsNullOrEmpty(jsonResult1))
{
return;
}
try
{
root_AllPort = JsonConvert.DeserializeObject<PortQuery.Root>(jsonResult1);
Debug.Log("端口查询完成" + "URL:" + Jk_URL.dk_cx + "Token:" + token + "返回内容" + jsonResult1);
}
catch (Exception e)
{
Debug.Log("序列化-端口查询错误:" + e.Message);
}
})
); ;
}
/// <summary>
/// 查询所有环境
/// </summary>
/// <returns></returns>
public async Task<IEnumerator> init_ENV()
public IEnumerator init_ENV()
{
ENVs.Clear();
var jsonResult2 = await CombineJSON.GetJson_POST(Jk_URL.hj_cx, token);
//var jsonResult2 = await CombineJSON.GetJson_POST(Jk_URL.hj_cx, token);
root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
//root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
//StartCoroutine(
//CombineJSON.GetJson_POST(Jk_URL.hj_cx, token, (jsonResult2) =>
//{
// root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
// Debug.Log("环境查询完成" + "URL:" + Jk_URL.hj_cx + "Token:" + token + "返回内容" + jsonResult2);
//})
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.hj_cx, token, (jsonResult2) =>
{
if (string.IsNullOrEmpty(jsonResult2))
{
return;
}
try
{
root_AllENV = JsonConvert.DeserializeObject<ENVQuery.Root>(jsonResult2);
Debug.Log("环境查询完成" + "URL:" + Jk_URL.hj_cx + "Token:" + token + "返回内容" + jsonResult2);
}
catch (Exception e)
{
Debug.Log("序列化-环境查询错误:" + e.Message);
}
return null;
})
); ;
}
/// <summary>
/// 查询所有告警
/// </summary>
/// <returns></returns>
public async Task<IEnumerator> init_TmsAlarm()
public IEnumerator init_TmsAlarm()
{
Array.ForEach(GameObject.FindObjectsOfType<TmsAlarmQuery>(), itme =>
{
@ -688,11 +755,35 @@ public class GameManager : MonoBehaviour
tmsAlarms.Clear();
var jsonResult3 = await CombineJSON.GetJson_POST(Jk_URL.gj_cx, token);
//var jsonResult3 = await CombineJSON.GetJson_POST(Jk_URL.gj_cx, token);
root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
return null;
//root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
//StartCoroutine(
//CombineJSON.GetJson_POST(Jk_URL.gj_cx, token, (jsonResult3) =>
//{
// root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
// Debug.Log("告警查询完成" + "URL:" + Jk_URL.gj_cx + "Token:" + token + "返回内容" + jsonResult3);
//})
//);
yield return StartCoroutine(
CombineJSON.GetJson_POST(Jk_URL.gj_cx, token, (jsonResult3) =>
{
if (string.IsNullOrEmpty(jsonResult3))
{
return;
}
try
{
root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
Debug.Log("告警查询完成" + "URL:" + Jk_URL.gj_cx + "Token:" + token + "返回内容" + jsonResult3);
}
catch (Exception e)
{
Debug.Log("序列化-告警查询错误:" + e.Message);
}
})
); ;
}
/// <summary>
@ -1214,9 +1305,13 @@ public class GameManager : MonoBehaviour
StopTimer();
}
private void Update()
private async void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
//StartCoroutine(Init_StartCoroutine());
}
}
[Header("--------------------------------")]
@ -1291,7 +1386,7 @@ public class GameManager : MonoBehaviour
}
// 读取地址
public IEnumerator LoadAddress()
public IEnumerator LoadAddress(Action<string> callback)
{
string filePath = Application.streamingAssetsPath + "/dz.txt";
@ -1301,44 +1396,36 @@ public class GameManager : MonoBehaviour
if (www.result == UnityWebRequest.Result.Success)
{
string fileContent = www.downloadHandler.text;
Debug.Log("获取穿透成功:" + fileContent);
Debug.Log("获取穿透成功:" + fileContent + "Token" + Inst.token);
if (string.IsNullOrEmpty(fileContent))
{
callback(null);
yield break;
Jk_URL = new webURL(fileContent);
//yield return StartCoroutine(Initialize());
bool initializeComplete = false;
StartCoroutine(Initialize(() => initializeComplete = true));
yield return new WaitUntil(() => initializeComplete);
if (root_AllDevice.data == null)
yield break;
LoadScene();
}
callback(fileContent);
}
else
{
callback(null);
Debug.LogError("Error: " + www.error);
}
}
// 获取接口信息
private IEnumerator Initialize(Action onInitialized)
public IEnumerator Initialize()
{
TransparentGlowManage.Inst.addScript();
TransparentGlowManage.Inst.addScript();
yield return init_Device();
yield return init_Port();
yield return init_TmsAlarm();
yield return init_ENV();
yield return new WaitForSeconds(1);
onInitialized.Invoke();
yield return StartCoroutine(init_Device());
yield return StartCoroutine(init_Port());
yield return StartCoroutine(init_TmsAlarm());
yield return StartCoroutine(init_ENV());
//yield return new WaitForSeconds(2);
LoadScene();
}
// 加载场景

View File

@ -1,10 +1,13 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine;
using UnityEngine.Networking;
/// <summary>
///整合JSON
@ -83,6 +86,7 @@ public static class CombineJSON
{
using (HttpClient httpClient = new HttpClient())
{
Debug.Log(apiUrl + "=aaaaaa=");
var client = new HttpClient();
var request = new HttpRequestMessage
{
@ -95,8 +99,11 @@ public static class CombineJSON
};
using (var response = await client.SendAsync(request))
{
Debug.Log(apiUrl + "=bbbbbbb=");
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Debug.Log(body);
return (body);
}
}
@ -128,4 +135,97 @@ public static class CombineJSON
}
}
}
#region
/// <summary>
/// POST获取数据的请求
/// </summary>
/// <param name="apiUrl"></param>
/// <param name="token"></param>
/// <param name="callback"></param>
/// <returns></returns>
public static IEnumerator GetJson_POST(string apiUrl, string token, Action<string> callback)
{
UnityWebRequest request = new UnityWebRequest(apiUrl, "POST");
request.SetRequestHeader("X-Token", token);
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
string responseText = request.downloadHandler.text;
Debug.Log(responseText);
callback(responseText);
}
else
{
Debug.Log("请求POST接口失败: " + request.error);
callback?.Invoke(null);
}
request.Dispose();
}
/// <summary>
/// POST修改数据的请求
/// </summary>
/// <param name="apiUrl"></param>
/// <param name="token"></param>
/// <param name="newData"></param>
/// <param name="onComplete"></param>
/// <returns></returns>
public static IEnumerator UpdateJson_POST(string apiUrl, string token, string newData, Action<string> callback)
{
using (UnityWebRequest request = UnityWebRequest.Post(apiUrl, newData))
{
request.SetRequestHeader("X-Token", token);
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
Debug.Log("请求POST接口失败: " + request.error);
callback?.Invoke(null);
}
else
{
string responseText = request.downloadHandler.text;
Debug.Log(responseText);
callback?.Invoke(responseText);
}
}
}
/// <summary>
/// 获取GET接口
/// </summary>
/// <param name="apiUrl"></param>
/// <returns></returns>
public static IEnumerator GetJson_GET(string apiUrl, Action<string> callback)
{
using (UnityWebRequest webRequest = UnityWebRequest.Get(apiUrl))
{
yield return webRequest.SendWebRequest();
if (webRequest.result == UnityWebRequest.Result.Success)
{
string jsonResult = webRequest.downloadHandler.text;
Debug.Log(jsonResult);
callback?.Invoke(jsonResult);
}
else
{
callback?.Invoke(null);
Debug.Log("请求GET接口失败: " + webRequest.error);
}
}
}
#endregion
}

View File

@ -1,10 +1,13 @@
using DG.Tweening;
using DG.Tweening.Core.Easing;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
public class WebInteraction : MonoBehaviour
{
@ -27,12 +30,19 @@ public class WebInteraction : MonoBehaviour
private void Awake()
{
Inst = this;
//StartCoroutine(QiangZhi());
}
private void Start()
{
Application.ExternalCall("OnSceneLoaded");
//三维场景加载时显示地图
//bt.onClick.AddListener(() =>
//{
// gameManager.token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2OTI2NDMyODksInVzZXJuYW1lIjoiMTgzMTIzNDU2NzgifQ.uMoC7I4SytLEgYTKHxyvOv7Lygeb9zDCmhLDYv1cJrA";
// gameManager.enabled = true;
//});
}
//前端调用Unity 方法逻辑
@ -50,8 +60,23 @@ public class WebInteraction : MonoBehaviour
gameManager.enabled = true;
}
public Button bt;
public IEnumerator QiangZhi()
{
string filePath = Application.streamingAssetsPath + "/tk.txt";
UnityWebRequest www = UnityWebRequest.Get(filePath);
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
string fileContent = www.downloadHandler.text;
if (string.IsNullOrEmpty(fileContent)) yield break;
gameManager.token = fileContent;
}
}
/// <summary>
@ -74,7 +99,7 @@ public class WebInteraction : MonoBehaviour
{
// 在此处处理关闭视频监控的逻辑
Debug.Log("Closing video number: " + videoNumber);
isVideoPlay= false;
isVideoPlay = false;
Application.ExternalCall("web_video_close", videoNumber);
}

View File

@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.VisualScripting.Antlr3.Runtime;
@ -86,20 +87,26 @@ public class AddDevice : MonoBehaviour
//shelfId.onValueChanged.AddListener(shelfId_fuc);//机框
//slotId.onValueChanged.AddListener(slotId_fuc);//基槽
save_bt.onClick.AddListener(async () =>
save_bt.onClick.AddListener(() =>
{
await saveJson();
if (URlreturn.message == "操作成功")
{
}
else
{
}
StartCoroutine(SaveJsonCoroutine());
});
}
private IEnumerator SaveJsonCoroutine()
{
yield return StartCoroutine(saveJson());
if (URlreturn.message == "操作成功")
{
}
else
{
}
}
private void slotId_fuc(int arg0)
{
//办卡
@ -156,13 +163,28 @@ public class AddDevice : MonoBehaviour
mybody.status = status.options[status.value].text;
}
public async Task saveJson()
public IEnumerator saveJson()
{
var newData = JsonConvert.SerializeObject(mybody);
var jsonResult = await CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.sb_xz, GameManager.Inst.token, newData);
//var jsonResult = await CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.sb_xz, GameManager.Inst.token, newData);
URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
//URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
yield return
StartCoroutine(
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.sb_xz, GameManager.Inst.token, newData, (jsonResult) =>
{
try
{
URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
}
catch (Exception e)
{
}
})
);
}
#region JSON

View File

@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -72,7 +73,7 @@ public class AddPort : MonoBehaviour
}
deviceId.AddOptions(deviceId_ops);
conDevice.options.Clear();
conDevice.options.Clear();
conDevice.AddOptions(deviceId_ops);
}
@ -80,20 +81,26 @@ public class AddPort : MonoBehaviour
{
//deviceId.onValueChanged.AddListener(deviceId_fuc);//所属设备
conDevice.onValueChanged.AddListener(conDevice_fuc);//对联设备
save_bt.onClick.AddListener(async () =>
save_bt.onClick.AddListener(() =>
{
await saveJson();
if (URlreturn.message == "操作成功")
{
}
else
{
}
StartCoroutine(SaveJsonCoroutine());
});
}
private IEnumerator SaveJsonCoroutine()
{
yield return StartCoroutine(saveJson());
if (URlreturn.message == "操作成功")
{
}
else
{
}
}
private void conDevice_fuc(int arg0)
{
List<string> conPort_ops = new List<string>();
@ -143,13 +150,27 @@ public class AddPort : MonoBehaviour
mybody.remark = remark.text;
}
public async Task saveJson()
public IEnumerator saveJson()
{
var newData = JsonConvert.SerializeObject(mybody);
var jsonResult = await CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_xz, GameManager.Inst.token, newData);
//var jsonResult = await CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_xz, GameManager.Inst.token, newData);
URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
//URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
yield return StartCoroutine(
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_xz, GameManager.Inst.token, newData, (jsonResult) =>
{
try
{
URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
}
catch (Exception)
{
}
})
);
}
#region JSON

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
@ -14,13 +15,27 @@ public class DeleteDevice : MonoBehaviour
public async Task saveJson()
public IEnumerator saveJson()
{
var newData = JsonConvert.SerializeObject(mybody);
var jsonResult = await CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.sb_sc, GameManager.Inst.token, newData);
//var jsonResult = await CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.sb_sc, GameManager.Inst.token, newData);
URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
//URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
yield return StartCoroutine(
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.sb_sc, GameManager.Inst.token, newData, (jsonResult) =>
{
try
{
URlreturn = JsonConvert.DeserializeObject<Root>(jsonResult);
}
catch (System.Exception)
{
}
})
);
}
#region JSON
@ -30,7 +45,7 @@ public class DeleteDevice : MonoBehaviour
/// <summary>
/// id
/// </summary>
public List<string> ids ;
public List<string> ids;
}
[System.Serializable]
public class Root

View File

@ -18,26 +18,26 @@ public class CabinetQuery : MonoBehaviour
}
private async void Start()
private void Start()
{
//await initAsync("");
}
public async Task initAsync(string token)
{
var jsonResult = await CombineJSON.GetJson_POST("http://wu4ifs.natappfree.cc/machineRoom/tmsRack/queryList", token);
//public async Task initAsync(string token)
//{
// var jsonResult = await CombineJSON.GetJson_POST("http://wu4ifs.natappfree.cc/machineRoom/tmsRack/queryList", token);
Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
// Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
foreach (var item in root.data)
{
if (item.rackId == cabinetList.rackId)
{
cabinetList = item;
break;
}
}
}
// foreach (var item in root.data)
// {
// if (item.rackId == cabinetList.rackId)
// {
// cabinetList = item;
// break;
// }
// }
//}
private void Update()
{

View File

@ -21,29 +21,26 @@ public class DeviceQuery : MonoBehaviour
}
private async void Start()
private void Start()
{
#region
//await initAsync("");
#endregion
}
public async Task initAsync()
{
var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.sb_cx, GameManager.Inst.token);
//public async Task initAsync()
//{
// var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.sb_cx, GameManager.Inst.token);
Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
// Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
foreach (var item in root.data)
{
if (item.id == deviceList.id)
{
deviceList = item;
break;
}
}
}
// foreach (var item in root.data)
// {
// if (item.id == deviceList.id)
// {
// deviceList = item;
// break;
// }
// }
//}
[ContextMenu("添加板卡、端口信息脚本")]
public void addscript()

View File

@ -22,27 +22,25 @@ public class PortQuery : MonoBehaviour
private void Start()
{
portList.deviceId = transform.parent.GetComponent<DeviceQuery>().deviceList.id;
#region
//await initAsync("");
#endregion
}
public async Task initAsync()
{
var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.dk_cx, GameManager.Inst.token);
//public async Task initAsync()
//{
// var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.dk_cx, GameManager.Inst.token);
Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
// Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
foreach (var item in root.data)
{
if (item.id == portList.id)
{
portList = item;
break;
}
}
}
// foreach (var item in root.data)
// {
// if (item.id == portList.id)
// {
// portList = item;
// break;
// }
// }
//}
/// <summary>

View File

@ -14,22 +14,19 @@ public class TmsAlarmQuery : MonoBehaviour
{
public List<TmsAlarmList> tmsAlarmLists;
private async void Start()
private void Start()
{
#region Õýʽ
//await initAsync("");
#endregion
}
public async Task initAsync()
{
var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.gj_cx, GameManager.Inst.token);
//public async Task initAsync()
//{
// var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.gj_cx, GameManager.Inst.token);
Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
// Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
tmsAlarmLists = root.data;
}
// tmsAlarmLists = root.data;
//}
void Update()
{

View File

@ -21,29 +21,26 @@ public class TmsCardQuery : MonoBehaviour
}
private async void Start()
private void Start()
{
#region
//await initAsync("");
#endregion
}
public async Task initAsync(string token)
{
var jsonResult = await CombineJSON.GetJson_POST("https://jsonplaceholder.typicode.com/posts", token);
//public async Task initAsync(string token)
//{
// var jsonResult = await CombineJSON.GetJson_POST("https://jsonplaceholder.typicode.com/posts", token);
Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
// Root root = JsonConvert.DeserializeObject<Root>(jsonResult);
foreach (var item in root.data)
{
if (item.cardId == tmsCardList.cardId)
{
tmsCardList = item;
break;
}
}
}
// foreach (var item in root.data)
// {
// if (item.cardId == tmsCardList.cardId)
// {
// tmsCardList = item;
// break;
// }
// }
//}
#region JSON

View File

@ -362,6 +362,8 @@ PlayerSettings:
m_EncodingQuality: 1
- m_BuildTarget: tvOS
m_EncodingQuality: 1
- m_BuildTarget: WebGL
m_EncodingQuality: 2
m_BuildTargetGroupLightmapSettings: []
m_BuildTargetNormalMapEncoding:
- m_BuildTarget: Android
@ -611,10 +613,10 @@ PlayerSettings:
webGLDebugSymbols: 0
webGLEmscriptenArgs:
webGLModulesDirectory:
webGLTemplate: APPLICATION:Minimal
webGLTemplate: APPLICATION:Default
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLCompressionFormat: 1
webGLCompressionFormat: 2
webGLWasmArithmeticExceptions: 0
webGLLinkerTarget: 1
webGLThreadsSupport: 0

File diff suppressed because one or more lines are too long

Binary file not shown.

BIN
build/Build/build.wasm Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
http://7k3r7b.natappfree.cc/
http://nv929i.natappfree.cc/

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

View File

@ -0,0 +1,16 @@
body { padding: 0; margin: 0 }
#unity-container { position: absolute }
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
#unity-container.unity-mobile { width: 100%; height: 100% }
#unity-canvas { background: #231F20 }
.unity-mobile #unity-canvas { width: 100%; height: 100% }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
#unity-footer { position: relative }
.unity-mobile #unity-footer { display: none }
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
#unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -4,30 +4,118 @@
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | GQ_TongXin</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
</head>
<body style="text-align: center">
<canvas id="unity-canvas" width=1920 height=1080 style="width: 1920px; height: 1080px; background: #231F20"></canvas>
<script src="Build/build.loader.js"></script>
<body>
<div id="unity-container" class="unity-desktop">
<canvas id="unity-canvas" width=1920 height=1080></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">GQ_TongXin</div>
</div>
</div>
<script>
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the
// user.
function unityShowBanner(msg, type) {
function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
}
createUnityInstance(document.querySelector("#unity-canvas"), {
dataUrl: "Build/build.data.gz",
frameworkUrl: "Build/build.framework.js.gz",
codeUrl: "Build/build.wasm.gz",
var buildUrl = "Build";
var loaderUrl = buildUrl + "/build.loader.js";
var config = {
dataUrl: buildUrl + "/build.data",
frameworkUrl: buildUrl + "/build.framework.js",
codeUrl: buildUrl + "/build.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "GQ_TongXin",
productVersion: "0.1",
// matchWebGLToCanvasSize: false, // Uncomment this to separately control WebGL canvas render size and DOM element size.
// devicePixelRatio: 1, // Uncomment this to override low DPI rendering on high DPI displays.
});
showBanner: unityShowBanner,
};
// By default Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
canvas.style.width = window.innerWidth + 'px';
canvas.style.height = window.innerHeight + 'px';
unityShowBanner('WebGL builds are not supported on mobile devices.');
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
canvas.style.width = "1920px";
canvas.style.height = "1080px";
}
loadingBar.style.display = "block";
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
loadingBar.style.display = "none";
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
</script>
</body>
</html>