This commit is contained in:
高国正 2023-08-25 18:16:20 +08:00
parent 65d0e03887
commit 65b040ad4e
9 changed files with 301 additions and 41 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,134 @@
fileFormatVersion: 2
guid: dd0c61f425d71ad4c9c9c185ca27a124
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -111,6 +111,12 @@ public class GameManager : MonoBehaviour
[Header("----------弹窗--------------")]
public List<GameObject> pop_ups;
/// <summary>
/// 场景方大状态
/// </summary>
[Header("----------场景方大状态--------------")]
public bool magnifyState=false;
private void Awake()
{
if (_inst != null && _inst != this)
@ -509,10 +515,12 @@ public class GameManager : MonoBehaviour
var collider = item.transform.Find("U位/" + U).GetComponent<Collider>();
go.transform.position = new Vector3(anchorPos.transform.position.x, anchorPos.transform.position.y + collider.bounds.size.y / 2, anchorPos.transform.position.z);
//go.transform.rotation = item.transform.Find("U位/" + U).rotation;
go.name = Racks[i].deviceName;
go.name = Racks[i].id;
if (!go.GetComponent<ClickEvent>())
go.AddComponent<ClickEvent>();
go.GetComponent<DragTest>().isplace = true;
go.transform.SetParent(item.transform.Find("U位/" + U));
go.GetComponent<DragTest>().isplace = true;
break;
}
catch (Exception e)
@ -639,7 +647,7 @@ public class GameManager : MonoBehaviour
{
DestroyImmediate(TmsCards_go[i]);
}
Cabinets.Clear();
Racks_go.Clear();

View File

@ -15,7 +15,7 @@ using static GameManager;
public class AddDevice : MonoBehaviour
{
public Root URlreturn;
public Body mybody;
public Body mybody=new Body();
public Button save_bt;
/// <summary>

View File

@ -5,6 +5,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
using static GameManager;
@ -14,7 +15,7 @@ using static GameManager;
public class AddPort : MonoBehaviour
{
public Root URlreturn;
public Body mybody;
public Body mybody = new Body();
public Button save_bt;
@ -62,7 +63,12 @@ public class AddPort : MonoBehaviour
break;
}
}
mybody = mapper.Map<AddPort.Body>(portlist);
if (portlist != null)
mybody = mapper.Map<AddPort.Body>(portlist);
else
{
mybody = mapper.Map<AddPort.Body>(GameManager.Inst.nowDevice.GetComponent<PortQuery.PortList>());
}
}
}
catch (Exception e)
@ -75,6 +81,7 @@ public class AddPort : MonoBehaviour
{
//deviceId.options.Clear();
List<string> deviceId_ops = new List<string>();
deviceId_ops.Add("");
//for (int i = 0; i < GameManager.Inst.Racks_go.Count; i++)
//{
// var n = GameManager.Inst.Racks_go[i].GetComponent<DeviceQuery>().deviceList.id;
@ -122,19 +129,19 @@ public class AddPort : MonoBehaviour
yield return StartCoroutine(saveJson());
if (URlreturn.message == "操作成功")
{
yield return StartCoroutine(GameManager.Inst.LoadAddress((ct) =>
{
if (ct != null)
{
GameManager.Inst.Jk_URL = new webURL(ct);
StartCoroutine(GameManager.Inst.Initialize());
}
else
{
Debug.Log("获取穿透错误!");
}
}));
{
yield return StartCoroutine(GameManager.Inst.LoadAddress((ct) =>
{
if (ct != null)
{
GameManager.Inst.Jk_URL = new webURL(ct);
StartCoroutine(GameManager.Inst.Initialize());
}
else
{
Debug.Log("获取穿透错误!");
}
}));
Array.ForEach(GameManager.Inst.pop_ups.ToArray(), (itme) =>
{
@ -207,7 +214,7 @@ public class AddPort : MonoBehaviour
gameObject.SetActive(false);
yield break;
}
var newData = JsonConvert.SerializeObject(mybody);

View File

@ -24,6 +24,8 @@ public class DeviceQuery : MonoBehaviour
if (!ParentGo)
return;
deviceList.rackId = ParentGo.GetComponent<DeviceQuery>().deviceList.id;
if(!string.IsNullOrEmpty(deviceList.id))
gameObject.name = deviceList.id;
}
else if (deviceList.type == "2" &&
@ -38,6 +40,8 @@ public class DeviceQuery : MonoBehaviour
deviceList.shelfId = transform.parent.GetComponent<DeviceQuery>().deviceList.id;
}
}
if (!string.IsNullOrEmpty(deviceList.id))
gameObject.name = deviceList.id;
}
}
@ -86,7 +90,23 @@ public class DeviceQuery : MonoBehaviour
}
}
public void setTag()
{
//Transform
//try
//{
//}
//catch
//{
// xuhao = transform.parent;
// U = xuhao.parent;
// cabinet = U.parent;
//}
//var xuhao = transform.parent;
//var U = xuhao.parent;
//var cabinet = U.parent;
}

View File

@ -19,6 +19,12 @@ public class PortQuery : MonoBehaviour
}
private void OnEnable()
{
if (string.IsNullOrEmpty(portList.id))
gameObject.name = portList.id;
}
private void Start()
{
portList.deviceId = transform.parent.GetComponent<DeviceQuery>().deviceList.id;

View File

@ -18,7 +18,7 @@ public class ClickEvent : MonoBehaviour
/// <summary>
/// 放大状态
/// </summary>
public bool magnifyState = false;
public bool My_magnifyState = false;
private List<MeshRenderer> meshRenderers;
/// <summary>
@ -99,19 +99,20 @@ public class ClickEvent : MonoBehaviour
//{
// PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
//}
//点击模型(配置)
if (Physics.Raycast(ray, out hit, 100, 1 << 8))
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && GameManager.Inst.magnifyState)
{
if (hit.collider.gameObject == gameObject)
if (Physics.Raycast(ray, out hit, 100, 1 << 8))
{
Debug.Log("点击到配置" + gameObject.name);
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口新增").gameObject.SetActive(false);
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu)
if (hit.collider.gameObject == gameObject)
{
Debug.Log("点击到配置" + gameObject.name);
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口新增").gameObject.SetActive(false);
GameManager.Inst.search_box.SetActive(false);
var d = gameObject.GetComponent<DeviceQuery>();
if (d)
@ -132,8 +133,20 @@ public class ClickEvent : MonoBehaviour
}
}
}
else if (Menu.M_数字孪生_线缆连接_配置 == CabinetUIManager.Instance.current_menu)
}
}
else if (Menu.M_数字孪生_线缆连接_配置 == CabinetUIManager.Instance.current_menu && GameManager.Inst.magnifyState)
{
if (Physics.Raycast(ray, out hit, 100, 1 << 8))
{
if (hit.collider.gameObject == gameObject)
{
Debug.Log("点击到配置" + gameObject.name);
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口新增").gameObject.SetActive(false);
var p = gameObject.GetComponent<PortQuery>();
if (p)
{
@ -153,23 +166,81 @@ public class ClickEvent : MonoBehaviour
}
}
}
else
{
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
}
}
}
#region MyRegion
////点击模型(配置)
//if (Physics.Raycast(ray, out hit, 100, 1 << 8))
//{
// if (hit.collider.gameObject == gameObject)
// {
// if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu)
// {
// GameManager.Inst.search_box.SetActive(false);
// var d = gameObject.GetComponent<DeviceQuery>();
// if (d)
// {
// if (string.IsNullOrEmpty(d.deviceList.id))
// {
// GameManager.Inst.nowDevice = gameObject;
// PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(true);//√
// }
// else
// {
// GameManager.Inst.nowDeviceID = d.deviceList.id;
// GameManager.Inst.nowDevice = gameObject;
// PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(true);//√
// }
// }
// }
// else if (Menu.M_数字孪生_线缆连接_配置 == CabinetUIManager.Instance.current_menu)
// {
// var p = gameObject.GetComponent<PortQuery>();
// if (p)
// {
// if (string.IsNullOrEmpty(p.portList.id))
// {
// GameManager.Inst.nowDevice = gameObject;
// PatternChoose.Inst.transform.Find("端口类/端口新增").gameObject.SetActive(true);//√
// }
// else
// {
// GameManager.Inst.nowDeviceID = p.portList.id;
// GameManager.Inst.nowDevice = gameObject;
// PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(true);//√
// }
// }
// }
// else
// {
// PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
// PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
// }
// }
//}
#endregion
//不虚化
else if (Physics.Raycast(ray, out hit, 100, 1 << 6))
{
//放大
if (hit.collider.gameObject == gameObject && !magnifyState)
if (hit.collider.gameObject == gameObject && !My_magnifyState)
{
GameManager.Inst.nowDeviceID = hit.collider.gameObject.GetComponent<DeviceQuery>().deviceList.id;
ExtendedFlycam.Inst.init_mainCamera_rot();
// 物体被点击
Debug.Log("放大点击到" + gameObject.name);
GameManager.Inst.nowDevice = gameObject;
GameManager.Inst.nowDeviceID = GetComponent<DeviceQuery>().deviceList.id; ;
Renderer renderer = null;
try
{
@ -183,9 +254,10 @@ public class ClickEvent : MonoBehaviour
}
Array.ForEach(GameObject.FindObjectsOfType<ClickEvent>(), itme =>
{
itme.magnifyState = false;
itme.My_magnifyState = false;
});
magnifyState = true;
My_magnifyState = true;
GameManager.Inst.magnifyState = true;
TransparentGlowManage.Inst.is_magnify = true;
Vector3 center = renderer.bounds.center;
Vector3 targetPosition = new Vector3(center.x + yiDong_pos.x, center.y + yiDong_pos.y, center.z + yiDong_pos.z);
@ -198,10 +270,11 @@ public class ClickEvent : MonoBehaviour
});
}
//缩小
else if (hit.collider.gameObject == gameObject && magnifyState)
else if (hit.collider.gameObject == gameObject && My_magnifyState)
{
GameManager.Inst.nowDeviceID = null;
magnifyState = false;
My_magnifyState = false;
GameManager.Inst.magnifyState = false;
TransparentGlowManage.Inst.is_magnify = false;
ExtendedFlycam.Inst.init_mainCamera_rot();
// 物体被点击
@ -309,6 +382,7 @@ public class ClickEvent : MonoBehaviour
}
}
}
}
private void OnMouseEnter()

View File

@ -152,7 +152,8 @@ public class ExtendedFlycam : MonoBehaviour
BoolMonitor.Value = ismove();
if (!isvalid)
{
{
init_mainCamera_rot();
return;
}
//initialRotationEulerAngles = transform.localEulerAngles;
@ -231,6 +232,16 @@ public class ExtendedFlycam : MonoBehaviour
public void vvvv()
{
{
Array.ForEach(GameObject.FindObjectsOfType<ClickEvent>(), itme =>
{
itme.My_magnifyState = false;
});
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("端口类/端口新增").gameObject.SetActive(false);
GameManager.Inst.magnifyState = false;
Inst.init_mainCamera_rot();
Inst.transform.DOLocalMove(new Vector3(4.73694f, 20.1847f, -4.738012f), 1);
Inst.transform.DORotateQuaternion(Quaternion.Euler(Inst.ClampAngle(67.072f, -179.714f, -0.025f, Vector3.zero)), 1f).OnComplete(() =>