添加web端通信逻辑

This commit is contained in:
YangHua 2024-06-23 23:35:35 +08:00
parent 11c2ada0f8
commit 70e6a6df55
23 changed files with 19751 additions and 83 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
/u3d-ShanDongVirtualPowerPlant/xndcc
/u3d-ShanDongVirtualPowerPlant/.vs
/u3d-ShanDongVirtualPowerPlant/obj
/u3d-ShanDongVirtualPowerPlant/*.rar

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5d3a43d4bf04d454f909983fe660997e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 区域信息
/// </summary>
public class AreaData
{
/// <summary>
/// 行政区域编码
/// </summary>
public string distCode;
/// <summary>
/// 淄川区
/// </summary>
public string disName;
/// <summary>
///
/// </summary>
public List<ItemsItem> items;
}
public class ItemsItem
{
/// <summary>
/// 聚合用户
/// </summary>
public string label;
/// <summary>
///
/// </summary>
public string value;
/// <summary>
/// 个
/// </summary>
public string unit;
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ee6ed9c51c38d694888c42db6ab5f4a8
guid: 8bcb94a444f388a4a96fd8f72711a6b5
MonoImporter:
externalObjects: {}
serializedVersion: 2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 212a2bd60037e0e48b3ebdde19fde791
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -2550,7 +2550,7 @@ PrefabInstance:
- target: {fileID: 919132149155446097, guid: 97f3a396ac8b2ca4286621a12e8c1e5a,
type: 3}
propertyPath: m_IsActive
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1098357463150158480, guid: 97f3a396ac8b2ca4286621a12e8c1e5a,
type: 3}
@ -6059,47 +6059,47 @@ PrefabInstance:
- target: {fileID: -8135142205728441984, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8012186572059712759, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -7515063161532950506, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -6674957004345625353, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -4720465257169799636, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -4151988495206005593, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -3493509664671274984, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -2626987921457855494, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -1092518748555341945, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
@ -6114,37 +6114,37 @@ PrefabInstance:
- target: {fileID: 1994113293585421534, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3586703915688625902, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3992641925819796629, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5114964521964791915, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5280565503802925455, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8248316793703217024, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9223299007724846743, guid: b16821147ecd671449621c2d8bfef6ef,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []

View File

@ -58,9 +58,10 @@ public class Bootstrap : MonoSingleton<Bootstrap>
private Dictionary<Transform, Tween> _fadeTweens = new Dictionary<Transform, Tween>();
public WebAdapter webAdapter;
void Start()
{
webAdapter = GetComponent<WebAdapter>();
landMarks = new List<string> { "网络负荷49.84 kw", "上网负荷49.84 kw", "削峰负荷49.84 kw", "填谷负荷49.84 kw", "发电负荷49.84 kw" };
landMarkAndInfoCotroller.gameObject.SetActive(false);
cameraRt.OnLimitScroll += SwitchLand;
@ -103,12 +104,13 @@ public class Bootstrap : MonoSingleton<Bootstrap>
public void SwitchLand(int _currentLevel)
{
if (currentLand == null) return;
webAdapter.LevelChange(_currentLevel.ToString());
landMarkAndInfoCotroller.gameObject.SetActive(false);
currentLevel = _currentLevel;
switch (currentLevel)
{
case 2:
Debug.Log("省会");
//Debug.Log("省会");
for (int i = 0; i < cityParents.childCount; i++)
{
cityParents.GetChild(i).gameObject.SetActive(false);
@ -117,7 +119,7 @@ public class Bootstrap : MonoSingleton<Bootstrap>
SwitchMatShow(provincialCapital);
break;
case 1:
Debug.Log("城市");
//Debug.Log("城市");
if (lastCity)
{
if (currentArea != null)
@ -147,7 +149,7 @@ public class Bootstrap : MonoSingleton<Bootstrap>
currentArea = child;
}
}
Debug.Log("区县");
//Debug.Log("区县");
break;
}
}

View File

@ -1,39 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FadeController : MonoBehaviour
{
public Material[] selfMaters;
public bool isFade = false;
public float speed = 2;
//public bool isGo = false;
//public float time = 0;
//void Update()
//{
// if (isFade)
// {
// if (selfMaters != null)
// {
// for (int i = 0; i < selfMaters.Length; i++)
// {
// float current_Opacity = selfMaters[i].GetFloat("_Opacity");
// float t = Mathf.Lerp(current_Opacity, 1, Time.deltaTime * speed);
// if (t > 0.9f)
// {
// t = 1;
// }
// selfMaters[i].SetFloat("_Opacity", t);
// }
// }
// }
//}
public void OnFadeUnFade(bool _isFade)
{
isFade = _isFade;
selfMaters = GetComponent<MeshRenderer>().materials;
}
}

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Events;
public class WebAdapter : MonoBehaviour
{
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
private static extern void OnLevelChange(string level);
#else
private static void OnLevelChange(string level)
{
Debug.Log(level);
}
#endif
public UnityEvent<string> onStation;
public void LevelChange(string level)
{
OnLevelChange(level);
}
public void OnStation(string station)
{
onStation?.Invoke(station);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe0713e21695e5c44862ca7fa6d3c6a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -135,7 +135,7 @@ Material:
- _ZWrite: 1
- _offsetSpeed: 0.4
m_Colors:
- _BaseCol: {r: 0, g: 2.4497502, b: 8.47419, a: 0}
- _BaseCol: {r: 0, g: 13.545837, b: 22.627417, a: 0}
- _BaseCol_1: {r: 4, g: 2.453593, b: 0, a: 0}
- _BaseColor: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 1}
- _Color: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 1}

View File

@ -136,7 +136,7 @@ Material:
- _ZWrite: 1
- _offsetSpeed: 0.4
m_Colors:
- _BaseCol: {r: 0, g: 2.4497502, b: 8.47419, a: 0}
- _BaseCol: {r: 0, g: 13.545837, b: 22.627417, a: 0}
- _BaseCol_1: {r: 4, g: 2.453593, b: 0, a: 0}
- _BaseColor: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 1}
- _Color: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 1}

View File

@ -39,7 +39,7 @@ Material:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: a48da8f3a726fa449a51ff879969ec55, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
@ -59,11 +59,11 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 2800000, guid: a48da8f3a726fa449a51ff879969ec55, type: 3}
m_Texture: {fileID: 2800000, guid: 044a02910b7367c49b5af59b6330e468, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: a48da8f3a726fa449a51ff879969ec55, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
@ -119,7 +119,7 @@ Material:
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.14142135
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
@ -129,8 +129,8 @@ Material:
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 1}
- _Color: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 1}
- _EmissionColor: {r: 0.16981131, g: 0.16981131, b: 0.16981131, a: 1}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.5233631, g: 0.96036446, b: 1.5627179, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -42,7 +42,7 @@ Material:
m_Scale: {x: 10, y: 10}
m_Offset: {x: 0, y: 0}
- _BaseTex:
m_Texture: {fileID: 2800000, guid: a48da8f3a726fa449a51ff879969ec55, type: 3}
m_Texture: {fileID: 2800000, guid: 044a02910b7367c49b5af59b6330e468, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
@ -143,7 +143,7 @@ Material:
- _BaseCol: {r: 0, g: 0.1134291, b: 4, a: 0}
- _BaseColor: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 0}
- _Color: {r: 0.79058963, g: 0.79058963, b: 0.79058963, a: 0}
- _EmiCol: {r: 0.16862746, g: 0.16862746, b: 0.16862746, a: 1}
- _EmiCol: {r: 0.5233631, g: 0.96036446, b: 1.5627179, a: 1}
- _EmissionColor: {r: 0.16981131, g: 0.16981131, b: 0.16981131, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -40,7 +40,7 @@ Material:
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 10, y: 10}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
@ -59,12 +59,12 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 2800000, guid: a48da8f3a726fa449a51ff879969ec55, type: 3}
m_Texture: {fileID: 2800000, guid: 044a02910b7367c49b5af59b6330e468, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 10, y: 10}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}

View File

@ -121,7 +121,7 @@ Material:
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _MaskInt: 0.5
- _MaskInt: 0.61
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
@ -137,10 +137,10 @@ Material:
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseCol: {r: 0.034382306, g: 0.034382306, b: 0.04150939, a: 0}
- _BaseCol: {r: 0.06593806, g: 0.080317564, b: 0.10188681, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmiCol: {r: 0.54901963, g: 0.6351243, b: 0.6666667, a: 0}
- _EmiCol: {r: 0.6886805, g: 0.9620378, b: 1.3468661, a: 0}
- _EmissionColor: {r: 0.5245282, g: 0.5245282, b: 0.5245282, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,5 @@
mergeInto(LibraryManager.library, {
OnLevelChange: function (level) {
_OnLevelChange(Pointer_stringify(level))
}
});

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: ff73f99e1c44b6343b9263813d2918fb
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,6 +6,6 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Adam/Scenes/LargePLT 1.unity
guid: 592e3a98bbaea264997dc0239ce4b48f
path: Assets/Adam/Scenes/Main.unity
guid: 212a2bd60037e0e48b3ebdde19fde791
m_configObjects: {}

View File

@ -44,8 +44,8 @@ PlayerSettings:
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024
defaultScreenHeight: 768
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
defaultScreenWidthWeb: 1920
defaultScreenHeightWeb: 1080
m_StereoRenderingPath: 0
m_ActiveColorSpace: 1
unsupportedMSAAFallback: 0
@ -79,7 +79,7 @@ PlayerSettings:
androidAutoRotationBehavior: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 0
runInBackground: 1
captureSingleScreen: 0
muteOtherAudioSources: 0
Prepare IOS For Recording: 0