根据反馈修改
This commit is contained in:
parent
17ae9098bf
commit
b24ab39576
@ -213,6 +213,12 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
{
|
||||
Parser(item.Value);
|
||||
}
|
||||
|
||||
if (body.isLineModeItem)
|
||||
{
|
||||
GameObject obj = Utility.FindObj(body.Path);
|
||||
obj.GetOrAddComponent<LineModeItem>().Init(body);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,6 +227,7 @@ public class Body3DController : MonoSingleton<Body3DController>
|
||||
//if (obj != null) { Debug.Log("????" + body.Path + "????"); };
|
||||
var bodyObjItem = obj.GetOrAddComponent<Body3DObjItem>();
|
||||
bodyObjItem.Init(body);
|
||||
var lineModeItem = obj.GetOrAddComponent<LineModeItem>().Init(body);
|
||||
objs.Add(obj, bodyObjItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ public class Body3DObjItem : MonoBehaviour
|
||||
private float lastClickTime;
|
||||
// 双击的时间间隔阈值
|
||||
private const float doubleClickTimeThreshold = 0.3f;
|
||||
Shader shader;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -74,29 +73,11 @@ public class Body3DObjItem : MonoBehaviour
|
||||
}
|
||||
}
|
||||
#endif
|
||||
private void OnChangeMatEvent(OnChangeMat t)
|
||||
{
|
||||
if (t.shader != null)
|
||||
{
|
||||
GetComponent<Renderer>().material.shader = t.shader;
|
||||
if (body.lineModeWidth != 0)
|
||||
{
|
||||
GetComponent<Renderer>().material.SetFloat("_OutlineWidth", body.lineModeWidth);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GetComponent<Renderer>().material.shader = this.shader;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Init(Body3D.Body body)
|
||||
{
|
||||
this.body = body;
|
||||
shader = GetComponent<Renderer>()?.material.shader;
|
||||
TypeEventSystem.Global.Register<OnChangeMat>(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this);
|
||||
if (body.subBody == null || body.subBody.Count == 0)
|
||||
{
|
||||
if (body.toggle != null)
|
||||
|
||||
38
Assets/Scripts/Item/LineModeItem.cs
Normal file
38
Assets/Scripts/Item/LineModeItem.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using QFramework;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XMLTool;
|
||||
|
||||
public class LineModeItem : MonoBehaviour
|
||||
{
|
||||
Shader shader;
|
||||
public Body3D.Body body;
|
||||
public LineModeItem Init(Body3D.Body body)
|
||||
{
|
||||
this.body = body;
|
||||
shader = GetComponent<Renderer>()?.material.shader;
|
||||
TypeEventSystem.Global.Register<OnChangeMat>(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private void OnChangeMatEvent(OnChangeMat t)
|
||||
{
|
||||
if (t.shader != null)
|
||||
{
|
||||
GetComponent<Renderer>().material.shader = t.shader;
|
||||
if (body.lineModeWidth != 0)
|
||||
{
|
||||
GetComponent<Renderer>().material.SetFloat("_OutlineWidth", body.lineModeWidth);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GetComponent<Renderer>().material.shader = this.shader;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Item/LineModeItem.cs.meta
Normal file
11
Assets/Scripts/Item/LineModeItem.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c29f8a68d4de741499c43ccf8a9d6bf0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -187,6 +187,7 @@ namespace XMLTool
|
||||
|
||||
public Body parent;
|
||||
public float lineModeWidth = 0;
|
||||
public bool isLineModeItem = false;
|
||||
//public Dictionary<string, Body> bodyList { get; set; } = new Dictionary<string, Body>();
|
||||
}
|
||||
|
||||
@ -447,6 +448,14 @@ namespace XMLTool
|
||||
{
|
||||
float.TryParse(lineModeWidth.Value, out body.lineModeWidth);
|
||||
}
|
||||
|
||||
|
||||
var isLineModeItem = bodyElement.Attribute("isLineModeItem");
|
||||
if (isLineModeItem != null)
|
||||
{
|
||||
bool.TryParse(isLineModeItem.Value, out body.isLineModeItem);
|
||||
}
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
@ -11432,7 +11432,7 @@
|
||||
<Body name="下呼吸道" tip="" path="Ren_NEW/SM_QiGuan/Respiratory_system/Lower_respiratory_tract">
|
||||
|
||||
|
||||
<Body name="气管" tip="" path="Ren_NEW/SM_QiGuan/Respiratory_system/Lower_respiratory_tract/Trachea">
|
||||
<Body name="气管" tip="" path="Ren_NEW/SM_QiGuan/Respiratory_system/Lower_respiratory_tract/Trachea" isLineModeItem="true">
|
||||
|
||||
<Body name="气管软骨环" englishName="Cartilaginous rings of trachea" tip="范围:喉以下部分,包括气管、支气管及肺内分支。
|
||||
功能:气体交换通道,纤毛清除异物。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user