完成3D点位功能
This commit is contained in:
parent
800562f494
commit
ce0ef2c158
@ -41,6 +41,7 @@ namespace QFramework
|
|||||||
GameObject obj = GameObject.Instantiate(Resources.Load("PointQuestion/Point3D")) as GameObject;
|
GameObject obj = GameObject.Instantiate(Resources.Load("PointQuestion/Point3D")) as GameObject;
|
||||||
obj.GetOrAddComponent<Point3DItem>().Init(item);
|
obj.GetOrAddComponent<Point3DItem>().Init(item);
|
||||||
}
|
}
|
||||||
|
this.Finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +65,8 @@ namespace QFramework
|
|||||||
{
|
{
|
||||||
if (!Deinited)
|
if (!Deinited)
|
||||||
{
|
{
|
||||||
|
datas.Clear();
|
||||||
|
datas = null;
|
||||||
OnFinished = null;
|
OnFinished = null;
|
||||||
Deinited = true;
|
Deinited = true;
|
||||||
mPool.Recycle(this);
|
mPool.Recycle(this);
|
||||||
|
|||||||
@ -15,6 +15,10 @@ public class Point3DItem : MonoBehaviour
|
|||||||
public void Init(Point3DQuestion.Data data)
|
public void Init(Point3DQuestion.Data data)
|
||||||
{
|
{
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
if (string.IsNullOrEmpty(data.name) == false)
|
||||||
|
{
|
||||||
|
gameObject.name = data.name;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(data.deviceName))
|
if (string.IsNullOrEmpty(data.deviceName))
|
||||||
{
|
{
|
||||||
gameObject.transform.position = data.pos;
|
gameObject.transform.position = data.pos;
|
||||||
@ -25,6 +29,11 @@ public class Point3DItem : MonoBehaviour
|
|||||||
{
|
{
|
||||||
GameObject device = DeviceController.Instance.GetDeviceObj(data.deviceName);
|
GameObject device = DeviceController.Instance.GetDeviceObj(data.deviceName);
|
||||||
gameObject.transform.parent = device.transform;
|
gameObject.transform.parent = device.transform;
|
||||||
|
gameObject.transform.localPosition = Vector3.zero;
|
||||||
|
gameObject.transform.localEulerAngles = Vector3.zero;
|
||||||
|
gameObject.transform.localScale = Vector3.one;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
rotSpeed = data.rotateSpeed;
|
rotSpeed = data.rotateSpeed;
|
||||||
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject);
|
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject);
|
||||||
|
|||||||
@ -1092,9 +1092,18 @@ namespace XMLTool
|
|||||||
{
|
{
|
||||||
Point3DQuestion.Data data = new Point3DQuestion.Data();
|
Point3DQuestion.Data data = new Point3DQuestion.Data();
|
||||||
data.name = item.Attribute("name")?.Value;
|
data.name = item.Attribute("name")?.Value;
|
||||||
data.pos = Utility.GetVector3FromStrArray(item.Attribute("position")?.Value);
|
XAttribute atr = item.Attribute("deviceName");
|
||||||
data.rotate = Utility.GetVector3FromStrArray(item.Attribute("rotate")?.Value);
|
if (atr!=null)
|
||||||
data.scale = Utility.GetVector3FromStrArray(item.Attribute("scale")?.Value);
|
{
|
||||||
|
data.deviceName = item.Attribute("deviceName").Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.pos = Utility.GetVector3FromStrArray(item.Attribute("position")?.Value);
|
||||||
|
data.rotate = Utility.GetVector3FromStrArray(item.Attribute("rotate")?.Value);
|
||||||
|
data.scale = Utility.GetVector3FromStrArray(item.Attribute("scale")?.Value);
|
||||||
|
}
|
||||||
|
float.TryParse(item.Attribute("rotateSpeed")?.Value, out data.rotateSpeed);
|
||||||
data.clickEvent = item.Attribute("clickEvent")?.Value;
|
data.clickEvent = item.Attribute("clickEvent")?.Value;
|
||||||
act.datas.Add(data);
|
act.datas.Add(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,23 @@
|
|||||||
|
|
||||||
<!--物体点位选择 物体的中心点-->
|
<!--物体点位选择 物体的中心点-->
|
||||||
<Action type="PointQuestion" value="路径1,路径2"></Action>
|
<Action type="PointQuestion" value="路径1,路径2"></Action>
|
||||||
|
<!--物体点位选择 3D版
|
||||||
|
position坐标
|
||||||
|
rotate 旋转角度
|
||||||
|
scale 缩放
|
||||||
|
如果deviceName存在 则不需要写坐标旋转和缩放,是参照把deviceName的物体作为父物体
|
||||||
|
rotateSpeed="180" 点图标旋转速度
|
||||||
|
clickEvent是点击后发送的字符串配合StrEvent
|
||||||
|
-->
|
||||||
|
<Action type="Point3DQuestion">
|
||||||
|
<Data deviceName="Point1" clickEvent="点1"></Data>
|
||||||
|
<Data position="0,0,0" rotate="0,0,0" scale="1,1,1" clickEvent="点1" rotateSpeed="360"></Data>
|
||||||
|
<Data deviceName="Point2" clickEvent="点2"></Data>
|
||||||
|
<Data deviceName="Point3" clickEvent="点3"></Data>
|
||||||
|
</Action>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--文字选择题 scoreName="分数名"
|
<!--文字选择题 scoreName="分数名"
|
||||||
rightScore="5" 可以是正确加分
|
rightScore="5" 可以是正确加分
|
||||||
wrongScore="-5" 也可以是错误减分
|
wrongScore="-5" 也可以是错误减分
|
||||||
@ -139,6 +156,8 @@
|
|||||||
<!--弹窗 btns可支持多个按钮-->
|
<!--弹窗 btns可支持多个按钮-->
|
||||||
<Action type="TipWindow" value="恭喜你完成当前模块" btns="确定,取消" audio=""></Action>
|
<Action type="TipWindow" value="恭喜你完成当前模块" btns="确定,取消" audio=""></Action>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--预加载模块 要在app.xml的Data标签内-->
|
<!--预加载模块 要在app.xml的Data标签内-->
|
||||||
<PreLoad>
|
<PreLoad>
|
||||||
<Action type="Parallel">
|
<Action type="Parallel">
|
||||||
@ -157,8 +176,8 @@
|
|||||||
<Name>模块1</Name>
|
<Name>模块1</Name>
|
||||||
|
|
||||||
<Descript>
|
<Descript>
|
||||||
这里是实训描述内容.....
|
这里是实训描述内容.....
|
||||||
巴拉巴拉....
|
巴拉巴拉....
|
||||||
</Descript>
|
</Descript>
|
||||||
<Device>
|
<Device>
|
||||||
<Name>组织钳</Name>
|
<Name>组织钳</Name>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user