扩展timeline
新增point3D
This commit is contained in:
parent
593fe9e0bf
commit
a36a2c16af
8
Assets/Resources/PointQuestion.meta
Normal file
8
Assets/Resources/PointQuestion.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3acec8ac3afd414fa0a2be823f49a24
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
108
Assets/Resources/PointQuestion/Point3D.prefab
Normal file
108
Assets/Resources/PointQuestion/Point3D.prefab
Normal file
@ -0,0 +1,108 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1284784233713093028
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8501359242958135856}
|
||||
- component: {fileID: 5342714518506889861}
|
||||
- component: {fileID: 1233232777813664732}
|
||||
m_Layer: 0
|
||||
m_Name: Point3D
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8501359242958135856
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1284784233713093028}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &5342714518506889861
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1284784233713093028}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 700820383005de14fba6008141269066, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.74, y: 0.74}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!65 &1233232777813664732
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1284784233713093028}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.74, y: 0.74, z: 0.01}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
7
Assets/Resources/PointQuestion/Point3D.prefab.meta
Normal file
7
Assets/Resources/PointQuestion/Point3D.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb7ff50a33ffd164e86af9f12182291b
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -117,9 +117,10 @@ public class ActionHelper
|
||||
}
|
||||
case "PointQuestion":
|
||||
return PointQuestionAction.Allocate(act.Value);
|
||||
case "Point3DQuestion":
|
||||
return Point3DQuestionAction.Allocate(act.Value);
|
||||
case "TextQuestion":
|
||||
{
|
||||
|
||||
var strAction = (XMLTool.DictionaryAction)act;
|
||||
return TextQuestionAction.Allocate(strAction.args);
|
||||
}
|
||||
|
||||
77
Assets/Scripts/Actions/Point3DQuestionAction.cs
Normal file
77
Assets/Scripts/Actions/Point3DQuestionAction.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using QFramework.Example;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XMLTool;
|
||||
|
||||
namespace QFramework
|
||||
{
|
||||
internal class Point3DQuestionAction : IAction
|
||||
{
|
||||
public System.Action OnFinished { get; set; }
|
||||
|
||||
|
||||
private Point3DQuestionAction()
|
||||
{
|
||||
}
|
||||
|
||||
private static readonly SimpleObjectPool<Point3DQuestionAction> mPool =
|
||||
new SimpleObjectPool<Point3DQuestionAction>(() => new Point3DQuestionAction(), null, 10);
|
||||
List<Point3DQuestion.Data> datas;
|
||||
public static Point3DQuestionAction Allocate(List<Point3DQuestion.Data> datas, System.Action OnFinished = null)
|
||||
{
|
||||
var retNode = mPool.Allocate();
|
||||
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||||
retNode.Deinited = false;
|
||||
retNode.Reset();
|
||||
retNode.OnFinished = OnFinished;
|
||||
retNode.datas = datas;
|
||||
return retNode;
|
||||
}
|
||||
|
||||
|
||||
public ulong ActionID { get; set; }
|
||||
public ActionStatus Status { get; set; }
|
||||
|
||||
public void OnStart()
|
||||
{
|
||||
|
||||
foreach (var item in datas)
|
||||
{
|
||||
GameObject obj = GameObject.Instantiate(Resources.Load("PointQuestion/Point3D")) as GameObject;
|
||||
obj.GetOrAddComponent<Point3DItem>().Init(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnExecute(float dt)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Status = ActionStatus.NotStart;
|
||||
Paused = false;
|
||||
}
|
||||
|
||||
public bool Paused { get; set; }
|
||||
|
||||
public void Deinit()
|
||||
{
|
||||
if (!Deinited)
|
||||
{
|
||||
OnFinished = null;
|
||||
Deinited = true;
|
||||
mPool.Recycle(this);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Deinited { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Actions/Point3DQuestionAction.cs.meta
Normal file
11
Assets/Scripts/Actions/Point3DQuestionAction.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5244807ebb490c644b600c03c490c8a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -49,6 +49,8 @@ public class TimeLineAction : IAction
|
||||
{
|
||||
if (!Deinited)
|
||||
{
|
||||
play?.Stop();
|
||||
play = null;
|
||||
Deinited = true;
|
||||
mPool.Recycle(this);
|
||||
}
|
||||
|
||||
@ -33,3 +33,8 @@ public struct OnLoadingHide
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public struct OnPoint3DQuestionDestroy
|
||||
{
|
||||
|
||||
}
|
||||
54
Assets/Scripts/Item/Point3DItem.cs
Normal file
54
Assets/Scripts/Item/Point3DItem.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using QFramework;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XMLTool;
|
||||
using static UnityEditor.Progress;
|
||||
|
||||
public class Point3DItem : MonoBehaviour
|
||||
{
|
||||
Point3DQuestion.Data data;
|
||||
|
||||
[SerializeField]
|
||||
private float rotSpeed = 180.0f;
|
||||
public void Init(Point3DQuestion.Data data)
|
||||
{
|
||||
this.data = data;
|
||||
if (string.IsNullOrEmpty(data.deviceName))
|
||||
{
|
||||
gameObject.transform.position = data.pos;
|
||||
gameObject.transform.eulerAngles = data.rotate;
|
||||
gameObject.transform.localScale = data.scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject device = DeviceController.Instance.GetDeviceObj(data.deviceName);
|
||||
gameObject.transform.parent = device.transform;
|
||||
}
|
||||
rotSpeed = data.rotateSpeed;
|
||||
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject);
|
||||
|
||||
}
|
||||
|
||||
private void OnObjDestroy(OnPoint3DQuestionDestroy destroy)
|
||||
{
|
||||
GameObject.Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void OnMouseUpAsButton()
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.clickEvent) == false)
|
||||
{
|
||||
StringEventSystem.Global.Send(data.clickEvent);
|
||||
}
|
||||
TypeEventSystem.Global.Send<OnPoint3DQuestionDestroy>();
|
||||
}
|
||||
|
||||
private void OnMouseOver()
|
||||
{
|
||||
transform.Rotate(Vector3.forward * Time.deltaTime * rotSpeed);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Item/Point3DItem.cs.meta
Normal file
11
Assets/Scripts/Item/Point3DItem.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41e7cf2ae7cf2f442b55807a5d42ee94
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -3,6 +3,7 @@ using QFramework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
namespace XMLTool
|
||||
{
|
||||
public class AppData
|
||||
@ -74,6 +75,21 @@ namespace XMLTool
|
||||
{
|
||||
}
|
||||
|
||||
public class Point3DQuestion : Action
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
public string name;
|
||||
public string deviceName;
|
||||
public Vector3 pos;
|
||||
public Vector3 rotate;
|
||||
public Vector3 scale;
|
||||
public float rotateSpeed;
|
||||
public string clickEvent;
|
||||
}
|
||||
public List<Data> datas = new List<Data>();
|
||||
}
|
||||
|
||||
public class Condition : ActionItem
|
||||
{
|
||||
}
|
||||
@ -1068,6 +1084,23 @@ namespace XMLTool
|
||||
newAction = act;
|
||||
}
|
||||
break;
|
||||
case "Point3DQuestion":
|
||||
{
|
||||
var act = new Point3DQuestion();
|
||||
var datas = action.Elements("Data");
|
||||
foreach (var item in datas)
|
||||
{
|
||||
Point3DQuestion.Data data = new Point3DQuestion.Data();
|
||||
data.name = item.Attribute("name")?.Value;
|
||||
data.pos = Utility.GetVector3FromStrArray(item.Attribute("position")?.Value);
|
||||
data.rotate = Utility.GetVector3FromStrArray(item.Attribute("rotate")?.Value);
|
||||
data.scale = Utility.GetVector3FromStrArray(item.Attribute("scale")?.Value);
|
||||
data.clickEvent = item.Attribute("clickEvent")?.Value;
|
||||
act.datas.Add(data);
|
||||
}
|
||||
newAction = act;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
newAction = new Action();
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user