Merge branch 'master' into LouDi_Quan
This commit is contained in:
commit
ee11b50eea
@ -465,8 +465,8 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 131.91986, y: 0}
|
m_AnchoredPosition: {x: 216.55383, y: 0}
|
||||||
m_SizeDelta: {x: 263.8398, y: -752.1277}
|
m_SizeDelta: {x: 433.1077, y: -752.1277}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &9008854919363526693
|
--- !u!222 &9008854919363526693
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@ -725,7 +725,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 0
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
@ -1274,7 +1274,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 0
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
|
|||||||
@ -173,6 +173,11 @@ public class ActionHelper
|
|||||||
var strAction = (XMLTool.DictionaryAction)act;
|
var strAction = (XMLTool.DictionaryAction)act;
|
||||||
return HighLightAction.Allocate(act.Value, strAction.args);
|
return HighLightAction.Allocate(act.Value, strAction.args);
|
||||||
}
|
}
|
||||||
|
case "HighLightFlash":
|
||||||
|
{
|
||||||
|
var strAction = (XMLTool.DictionaryAction)act;
|
||||||
|
return HighLightFlashAction.Allocate(act.Value, strAction.args);
|
||||||
|
}
|
||||||
case "LoadRes":
|
case "LoadRes":
|
||||||
{
|
{
|
||||||
var dictAction = (XMLTool.DictionaryAction)act;
|
var dictAction = (XMLTool.DictionaryAction)act;
|
||||||
@ -254,7 +259,7 @@ public class ActionHelper
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ICondition GetCondition(XMLTool.ActionItem condition)
|
public static ICondition GetCondition(XMLTool.ActionItem condition)
|
||||||
{
|
{
|
||||||
if (condition!=null)
|
if (condition != null)
|
||||||
{
|
{
|
||||||
switch (condition.Type)
|
switch (condition.Type)
|
||||||
{
|
{
|
||||||
@ -269,8 +274,15 @@ public class ActionHelper
|
|||||||
case "UIClick":
|
case "UIClick":
|
||||||
return UIClickCondition.Allocate(condition.Value);
|
return UIClickCondition.Allocate(condition.Value);
|
||||||
case "ObjClick":
|
case "ObjClick":
|
||||||
var dict = (XMLTool.DictionaryCondition)condition;
|
{
|
||||||
return ObjClickCondition.Allocate(dict.Value, dict.args);
|
var dict = (XMLTool.DictionaryCondition)condition;
|
||||||
|
return ObjClickCondition.Allocate(dict.Value, dict.args);
|
||||||
|
}
|
||||||
|
case "ObjClickLong":
|
||||||
|
{
|
||||||
|
var dict = (XMLTool.DictionaryCondition)condition;
|
||||||
|
return ObjClickLongCondition.Allocate(dict.Value, dict.args);
|
||||||
|
}
|
||||||
case "Input":
|
case "Input":
|
||||||
return InputCondition.Allocate(condition.Value);
|
return InputCondition.Allocate(condition.Value);
|
||||||
case "Var":
|
case "Var":
|
||||||
|
|||||||
@ -25,6 +25,7 @@ namespace QFramework
|
|||||||
bool isHigh = true;
|
bool isHigh = true;
|
||||||
string deviceName = string.Empty;
|
string deviceName = string.Empty;
|
||||||
string isIndependent;
|
string isIndependent;
|
||||||
|
string visibility;
|
||||||
public static HighLightAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
|
public static HighLightAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
|
||||||
{
|
{
|
||||||
var retNode = mPool.Allocate();
|
var retNode = mPool.Allocate();
|
||||||
@ -45,6 +46,7 @@ namespace QFramework
|
|||||||
}
|
}
|
||||||
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
|
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
|
||||||
retNode.isIndependent = datas.ContainsKey("isIndependent") ? datas["isIndependent"] : string.Empty;
|
retNode.isIndependent = datas.ContainsKey("isIndependent") ? datas["isIndependent"] : string.Empty;
|
||||||
|
retNode.visibility = datas.ContainsKey("visibility") ? datas["visibility"] : string.Empty;
|
||||||
retNode.OnFinished = OnFinished;
|
retNode.OnFinished = OnFinished;
|
||||||
return retNode;
|
return retNode;
|
||||||
}
|
}
|
||||||
@ -72,6 +74,9 @@ namespace QFramework
|
|||||||
var effect = obj.GetOrAddComponent<HighlightEffect>();
|
var effect = obj.GetOrAddComponent<HighlightEffect>();
|
||||||
effect.outlineColor = color;
|
effect.outlineColor = color;
|
||||||
effect.highlighted = true;
|
effect.highlighted = true;
|
||||||
|
Visibility visibility = Visibility.Normal;
|
||||||
|
Enum.TryParse(this.visibility, out visibility);
|
||||||
|
effect.outlineVisibility = visibility;
|
||||||
obj.GetOrAddComponent<HighLightOnStepChanged>();
|
obj.GetOrAddComponent<HighLightOnStepChanged>();
|
||||||
if (string.IsNullOrEmpty(isIndependent) == false)
|
if (string.IsNullOrEmpty(isIndependent) == false)
|
||||||
{
|
{
|
||||||
@ -93,6 +98,11 @@ namespace QFramework
|
|||||||
{
|
{
|
||||||
effect.highlighted = false;
|
effect.highlighted = false;
|
||||||
}
|
}
|
||||||
|
var flash = obj.GetComponent<HighLightFlashItem>();
|
||||||
|
if (flash)
|
||||||
|
{
|
||||||
|
flash.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
154
Assets/Scripts/Actions/HighLightFlashAction.cs
Normal file
154
Assets/Scripts/Actions/HighLightFlashAction.cs
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
using HighlightPlus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace QFramework
|
||||||
|
{
|
||||||
|
internal class HighLightFlashAction : IAction
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public System.Action OnFinished { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
private HighLightFlashAction()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly SimpleObjectPool<HighLightFlashAction> mPool =
|
||||||
|
new SimpleObjectPool<HighLightFlashAction>(() => new HighLightFlashAction(), null, 10);
|
||||||
|
|
||||||
|
string path;
|
||||||
|
Color color = Color.green;
|
||||||
|
bool isHigh = true;
|
||||||
|
string deviceName = string.Empty;
|
||||||
|
string isIndependent;
|
||||||
|
string count;
|
||||||
|
string time;
|
||||||
|
string finishedEvent;
|
||||||
|
string visibility;
|
||||||
|
public static HighLightFlashAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
|
||||||
|
{
|
||||||
|
var retNode = mPool.Allocate();
|
||||||
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||||||
|
retNode.Deinited = false;
|
||||||
|
retNode.Reset();
|
||||||
|
retNode.path = path;
|
||||||
|
|
||||||
|
if (datas.ContainsKey("color"))
|
||||||
|
{
|
||||||
|
|
||||||
|
retNode.color = Utility.ToColor(datas["color"]);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (datas.ContainsKey("isHigh"))
|
||||||
|
{
|
||||||
|
bool.TryParse(datas["isHigh"], out retNode.isHigh);
|
||||||
|
}
|
||||||
|
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
|
||||||
|
retNode.isIndependent = datas.ContainsKey("isIndependent") ? datas["isIndependent"] : string.Empty;
|
||||||
|
retNode.count = datas.ContainsKey("count") ? datas["count"] : string.Empty;
|
||||||
|
retNode.time = datas.ContainsKey("time") ? datas["time"] : string.Empty;
|
||||||
|
retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : string.Empty;
|
||||||
|
retNode.visibility = datas.ContainsKey("visibility") ? datas["visibility"] : string.Empty;
|
||||||
|
retNode.OnFinished = OnFinished;
|
||||||
|
return retNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ulong ActionID { get; set; }
|
||||||
|
public ActionStatus Status { get; set; }
|
||||||
|
|
||||||
|
public void OnStart()
|
||||||
|
{
|
||||||
|
GameObject obj = null;
|
||||||
|
if (string.IsNullOrEmpty(deviceName) == false)
|
||||||
|
{
|
||||||
|
obj = DeviceController.Instance.GetDeviceObj(deviceName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj = Utility.FindObj(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
var flash = obj.GetOrAddComponent<HighLightFlashItem>();
|
||||||
|
if (isHigh)
|
||||||
|
{
|
||||||
|
var effect = obj.GetOrAddComponent<HighlightEffect>();
|
||||||
|
effect.outlineColor = color;
|
||||||
|
effect.highlighted = true;
|
||||||
|
Visibility visibility = Visibility.Normal;
|
||||||
|
Enum.TryParse(this.visibility, out visibility);
|
||||||
|
effect.outlineVisibility = visibility;
|
||||||
|
obj.GetOrAddComponent<HighLightOnStepChanged>();
|
||||||
|
if (string.IsNullOrEmpty(isIndependent) == false)
|
||||||
|
{
|
||||||
|
switch (isIndependent)
|
||||||
|
{
|
||||||
|
case "true":
|
||||||
|
effect.outlineIndependent = true;
|
||||||
|
break;
|
||||||
|
case "false":
|
||||||
|
effect.outlineIndependent = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float time = 1;
|
||||||
|
int count = -1;
|
||||||
|
float.TryParse(this.time, out time);
|
||||||
|
int.TryParse(this.count, out count);
|
||||||
|
flash.Init(time, count, finishedEvent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var effect = obj.GetComponent<HighlightEffect>();
|
||||||
|
if (effect)
|
||||||
|
{
|
||||||
|
effect.highlighted = false;
|
||||||
|
}
|
||||||
|
if (flash)
|
||||||
|
{
|
||||||
|
flash.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnExecute(float dt)
|
||||||
|
{
|
||||||
|
this.Finish();
|
||||||
|
OnFinished?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
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/HighLightFlashAction.cs.meta
Normal file
11
Assets/Scripts/Actions/HighLightFlashAction.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 96e63ca598764cf4abec4ed34f827731
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -58,7 +58,6 @@ namespace QFramework
|
|||||||
var mat = obj.GetComponent<MeshRenderer>().material;
|
var mat = obj.GetComponent<MeshRenderer>().material;
|
||||||
//"99.99"
|
//"99.99"
|
||||||
char item = number[i];
|
char item = number[i];
|
||||||
Debug.LogError(item);
|
|
||||||
if (item == '.')
|
if (item == '.')
|
||||||
{
|
{
|
||||||
isPoint = true;
|
isPoint = true;
|
||||||
@ -90,6 +89,8 @@ namespace QFramework
|
|||||||
mat.mainTexture = Resources.Load($"Number/Mask").As<Texture2D>();
|
mat.mainTexture = Resources.Load($"Number/Mask").As<Texture2D>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnExecute(float dt)
|
public void OnExecute(float dt)
|
||||||
|
|||||||
@ -47,19 +47,37 @@ public class UIShowAction : IAction
|
|||||||
|
|
||||||
public void OnStart()
|
public void OnStart()
|
||||||
{
|
{
|
||||||
if (isShow)
|
Type type = null;
|
||||||
|
if (ActionHelper.typeDict.ContainsKey(uiName))
|
||||||
{
|
{
|
||||||
UIKit.OpenPanelAsync(ActionHelper.typeDict[uiName], assetBundleName: uiName).ToAction().StartGlobal(() => this.Finish());
|
type = ActionHelper.typeDict[uiName];
|
||||||
|
}
|
||||||
|
else if (CustomUIMap.typeDict.ContainsKey(uiName))
|
||||||
|
{
|
||||||
|
type = CustomUIMap.typeDict[uiName];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{uiName} ÀàÐÍûÓÐÕÒµ½");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (UIKit.GetPanel(ActionHelper.typeDict[uiName]) != null)
|
if (isShow)
|
||||||
{
|
{
|
||||||
UIKit.HidePanel(ActionHelper.typeDict[uiName]);
|
UIKit.OpenPanelAsync(type, assetBundleName: uiName).ToAction().StartGlobal(() => this.Finish());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (UIKit.GetPanel(type) != null)
|
||||||
|
{
|
||||||
|
UIKit.HidePanel(type);
|
||||||
|
}
|
||||||
|
|
||||||
this.Finish();
|
this.Finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
|
|||||||
146
Assets/Scripts/Conditions/ObjClickLongCondition.cs
Normal file
146
Assets/Scripts/Conditions/ObjClickLongCondition.cs
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
|
namespace QFramework
|
||||||
|
{
|
||||||
|
public class ObjClickLongCondition : ICondition
|
||||||
|
{
|
||||||
|
|
||||||
|
private static SimpleObjectPool<ObjClickLongCondition> mSimpleObjectPool =
|
||||||
|
new SimpleObjectPool<ObjClickLongCondition>(() => new ObjClickLongCondition(), null, 10);
|
||||||
|
|
||||||
|
private ObjClickLongCondition() { }
|
||||||
|
public GameObject obj = null;
|
||||||
|
string path;
|
||||||
|
string deviceName;
|
||||||
|
float time;
|
||||||
|
float curTime;
|
||||||
|
bool isDown = false;
|
||||||
|
public static ObjClickLongCondition Allocate(string path, Dictionary<string, string> datas)
|
||||||
|
{
|
||||||
|
var conditionAction = mSimpleObjectPool.Allocate();
|
||||||
|
conditionAction.ActionID = ActionKit.ID_GENERATOR++;
|
||||||
|
conditionAction.Deinited = false;
|
||||||
|
conditionAction.Reset();
|
||||||
|
conditionAction.path = path;
|
||||||
|
conditionAction.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : null;
|
||||||
|
if (datas.ContainsKey("time"))
|
||||||
|
{
|
||||||
|
float.TryParse(datas["time"], out conditionAction.time);
|
||||||
|
}
|
||||||
|
return conditionAction;
|
||||||
|
}
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(deviceName))
|
||||||
|
{
|
||||||
|
obj = Utility.FindObj(path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj = DeviceController.Instance.GetDeviceObj(deviceName);
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
Debug.LogError($"没有找到 path:{path} deviceName:{deviceName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测鼠标左键按下
|
||||||
|
if (Input.GetMouseButtonDown(0))
|
||||||
|
{
|
||||||
|
OnMouseDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测鼠标左键松开
|
||||||
|
if (Input.GetMouseButtonUp(0))
|
||||||
|
{
|
||||||
|
OnMouseUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDown && EventSystem.current.IsPointerOverGameObject() == false)
|
||||||
|
{
|
||||||
|
Vector3 mousePos = Input.mousePosition;
|
||||||
|
Ray ray = Camera.main.ScreenPointToRay(mousePos);
|
||||||
|
RaycastHit hit;
|
||||||
|
if (Physics.Raycast(ray, out hit))
|
||||||
|
{
|
||||||
|
if (obj == hit.collider.gameObject)
|
||||||
|
{
|
||||||
|
curTime -= Time.deltaTime;
|
||||||
|
if (curTime <= 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnMouseDown()
|
||||||
|
{
|
||||||
|
curTime = this.time;
|
||||||
|
isDown = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnMouseUp()
|
||||||
|
{
|
||||||
|
isDown = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool Paused { get; set; }
|
||||||
|
public bool Deinited { get; set; }
|
||||||
|
public ulong ActionID { get; set; }
|
||||||
|
public ActionStatus Status { get; set; }
|
||||||
|
public void OnStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnExecute(float dt)
|
||||||
|
{
|
||||||
|
if (Check())
|
||||||
|
{
|
||||||
|
this.Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnFinish()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Deinit()
|
||||||
|
{
|
||||||
|
if (!Deinited)
|
||||||
|
{
|
||||||
|
Deinited = true;
|
||||||
|
obj = null;
|
||||||
|
path = null;
|
||||||
|
mSimpleObjectPool.Recycle(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
curTime = 0;
|
||||||
|
Paused = false;
|
||||||
|
Status = ActionStatus.NotStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//public static class ObjClickLongConditionExtension
|
||||||
|
//{
|
||||||
|
// public static ISequence ObjClickLongCondition(this ISequence self, string uipath)
|
||||||
|
// {
|
||||||
|
// return self.Append(QFramework.ObjClickLongCondition.Allocate(uipath));
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Conditions/ObjClickLongCondition.cs.meta
Normal file
3
Assets/Scripts/Conditions/ObjClickLongCondition.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 297e67e3bc7868a4cae6623426c359b9
|
||||||
|
timeCreated: 1647673104
|
||||||
8
Assets/Scripts/Custom.meta
Normal file
8
Assets/Scripts/Custom.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4af85a692b427464ebde5004dd992d5e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Scripts/Custom/UIMap.meta
Normal file
8
Assets/Scripts/Custom/UIMap.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bb813d5416f284549bb272f36e3423e5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Scripts/Custom/UIMap/CustomUIMap.cs
Normal file
18
Assets/Scripts/Custom/UIMap/CustomUIMap.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using QFramework.Example;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class CustomUIMap : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
// 注意:此处专门给支线用的 主线的UI类型映射填写到 ActionHelper.cs的typeDict中
|
||||||
|
public static readonly Dictionary<string, Type> typeDict = new Dictionary<string, Type>()
|
||||||
|
{
|
||||||
|
//{ "UIOperationList", typeof(UIOperationList) },
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/Custom/UIMap/CustomUIMap.cs.meta
Normal file
11
Assets/Scripts/Custom/UIMap/CustomUIMap.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 399446e5e27181e439731e9cbd025286
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
41
Assets/Scripts/Item/HighLightFlashItem.cs
Normal file
41
Assets/Scripts/Item/HighLightFlashItem.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using DG.Tweening;
|
||||||
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
using HighlightPlus;
|
||||||
|
using QFramework;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class HighLightFlashItem : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
HighlightEffect high;
|
||||||
|
TweenerCore<float, float, FloatOptions> dotw;
|
||||||
|
|
||||||
|
public void Init(float time, int count = -1, string finishedEvent = null)
|
||||||
|
{
|
||||||
|
high = GetComponent<HighlightEffect>();
|
||||||
|
high.outline = 0.01f;
|
||||||
|
dotw = DOTween.To(() => high.outline, (v) => high.outline = v, 1, time).SetEase(Ease.OutFlash).SetLoops(count, LoopType.Yoyo).OnComplete(() =>
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(finishedEvent)==false)
|
||||||
|
{
|
||||||
|
StringEventSystem.Global.Send(finishedEvent);
|
||||||
|
}
|
||||||
|
this.Stop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (dotw != null)
|
||||||
|
{
|
||||||
|
dotw.Kill();
|
||||||
|
dotw = null;
|
||||||
|
}
|
||||||
|
high.highlighted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/Item/HighLightFlashItem.cs.meta
Normal file
11
Assets/Scripts/Item/HighLightFlashItem.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a2f23e7e41ba93044ab80cdc6be2e101
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -7,6 +7,7 @@ using TMPro;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using static OperationController;
|
using static OperationController;
|
||||||
using System;
|
using System;
|
||||||
|
using UnityEditor.Hardware;
|
||||||
namespace QFramework.Example
|
namespace QFramework.Example
|
||||||
{
|
{
|
||||||
public class UIOperationListData : UIPanelData
|
public class UIOperationListData : UIPanelData
|
||||||
@ -20,7 +21,7 @@ namespace QFramework.Example
|
|||||||
protected override void OnInit(IUIData uiData = null)
|
protected override void OnInit(IUIData uiData = null)
|
||||||
{
|
{
|
||||||
mData = uiData as UIOperationListData ?? new UIOperationListData();
|
mData = uiData as UIOperationListData ?? new UIOperationListData();
|
||||||
TypeEventSystem.Global.Register<OnModuleQuit>((arg)=>Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
|
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStepChanged(StepStatusOnChange change)
|
private void OnStepChanged(StepStatusOnChange change)
|
||||||
@ -88,54 +89,60 @@ namespace QFramework.Example
|
|||||||
StepContent.RemoveAllChildren();
|
StepContent.RemoveAllChildren();
|
||||||
foreach (var item in op.Steps)
|
foreach (var item in op.Steps)
|
||||||
{
|
{
|
||||||
GameObject obj = GameObject.Instantiate(Step.gameObject, StepContent);
|
|
||||||
Transform title = obj.transform.Find("Title");
|
|
||||||
var name = title.Find("Name").GetComponent<TextMeshProUGUI>();
|
|
||||||
name.text = item.Name;
|
|
||||||
var arrow = title.Find("Arrow").transform;
|
|
||||||
Image highIcon = title.Find("HighIcon").GetComponent<Image>();
|
|
||||||
Color highColor = new Color(25f / 255f, 224f / 255f, 224f / 255f);
|
|
||||||
GameObject subContent = obj.transform.Find("SubContent").gameObject;
|
|
||||||
Button btn = title.GetComponent<Button>();
|
|
||||||
subContent.gameObject.SetActive(false);
|
|
||||||
btn.name = btns.Count.ToString();
|
|
||||||
btns.Add(btn);
|
|
||||||
btn.onClick.AddListener(() =>
|
|
||||||
{
|
|
||||||
subContent.SetActive(!subContent.activeSelf);
|
|
||||||
if (op.freeStep)
|
|
||||||
{
|
|
||||||
if (highIcon.color != highColor)
|
|
||||||
{
|
|
||||||
|
|
||||||
TypeEventSystem.Global.Send<StepExecute>(new StepExecute() { index = int.Parse(btn.name) });
|
if (item.SubSteps != null && item.SubSteps.Count > 0)
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (item.SubSteps != null)
|
|
||||||
{
|
{
|
||||||
|
GameObject obj = GameObject.Instantiate(Step.gameObject, StepContent);
|
||||||
|
Transform title = obj.transform.Find("Title");
|
||||||
|
var name = title.Find("Name").GetComponent<TextMeshProUGUI>();
|
||||||
|
name.text = item.Name;
|
||||||
|
Image highIcon = title.Find("HighIcon").GetComponent<Image>();
|
||||||
|
Color highColor = new Color(25f / 255f, 224f / 255f, 224f / 255f);
|
||||||
|
GameObject subContent = obj.transform.Find("SubContent").gameObject;
|
||||||
|
Button btn = title.GetComponent<Button>();
|
||||||
|
subContent.gameObject.SetActive(false);
|
||||||
|
btn.name = btns.Count.ToString();
|
||||||
|
btns.Add(btn);
|
||||||
|
btn.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
subContent.SetActive(!subContent.activeSelf);
|
||||||
|
if (op.freeStep)
|
||||||
|
{
|
||||||
|
if (highIcon.color != highColor)
|
||||||
|
{
|
||||||
|
TypeEventSystem.Global.Send<StepExecute>(new StepExecute() { index = int.Parse(btn.name) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
foreach (var sub in item.SubSteps)
|
foreach (var sub in item.SubSteps)
|
||||||
{
|
{
|
||||||
GameObject subObj = GameObject.Instantiate(SubStep.gameObject, subContent.transform);
|
StepItemFactory(subContent.transform, sub.Name);
|
||||||
var stepLabel = subObj.transform.Find("StepLabel").GetComponent<TextMeshProUGUI>();
|
|
||||||
stepLabel.text = sub.Name;
|
|
||||||
Button subBtn = subObj.GetComponent<Button>();
|
|
||||||
subBtn.name = btns.Count.ToString();
|
|
||||||
btns.Add(subBtn);
|
|
||||||
subBtn.onClick.AddListener(() =>
|
|
||||||
{
|
|
||||||
if (op.freeStep)
|
|
||||||
{
|
|
||||||
subBtn.transform.parent.gameObject.SetActive(true);
|
|
||||||
TypeEventSystem.Global.Send<StepExecute>(new StepExecute() { index = int.Parse(subBtn.name) });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StepItemFactory(StepContent, item.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StepItemFactory(Transform content, string txt)
|
||||||
|
{
|
||||||
|
GameObject subObj = GameObject.Instantiate(SubStep.gameObject, content.transform);
|
||||||
|
var stepLabel = subObj.transform.Find("StepLabel").GetComponent<TextMeshProUGUI>();
|
||||||
|
stepLabel.text = txt;
|
||||||
|
Button subBtn = subObj.GetComponent<Button>();
|
||||||
|
subBtn.name = btns.Count.ToString();
|
||||||
|
btns.Add(subBtn);
|
||||||
|
subBtn.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
if (op.freeStep)
|
||||||
|
{
|
||||||
|
subBtn.transform.parent.gameObject.SetActive(true);
|
||||||
|
TypeEventSystem.Global.Send<StepExecute>(new StepExecute() { index = int.Parse(subBtn.name) });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnShow()
|
protected override void OnShow()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -787,9 +787,60 @@ namespace XMLTool
|
|||||||
{
|
{
|
||||||
act.args.Add("isIndependent", isIndependent.Value);
|
act.args.Add("isIndependent", isIndependent.Value);
|
||||||
}
|
}
|
||||||
|
XAttribute visibility = action.Attribute("visibility");
|
||||||
|
if (visibility != null)
|
||||||
|
{
|
||||||
|
act.args.Add("visibility", visibility.Value);
|
||||||
|
}
|
||||||
|
newAction = act;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "HighLightFlash":
|
||||||
|
{
|
||||||
|
var act = new DictionaryAction();
|
||||||
|
XAttribute isHigh = action.Attribute("isHigh");
|
||||||
|
if (isHigh != null)
|
||||||
|
{
|
||||||
|
act.args.Add("isHigh", isHigh.Value);
|
||||||
|
}
|
||||||
|
XAttribute color = action.Attribute("color");
|
||||||
|
if (color != null)
|
||||||
|
{
|
||||||
|
act.args.Add("color", color.Value);
|
||||||
|
}
|
||||||
|
XAttribute deviceName = action.Attribute("deviceName");
|
||||||
|
if (deviceName != null)
|
||||||
|
{
|
||||||
|
act.args.Add("deviceName", deviceName.Value);
|
||||||
|
}
|
||||||
|
newAction = act;
|
||||||
|
XAttribute isIndependent = action.Attribute("isIndependent");
|
||||||
|
if (isIndependent != null)
|
||||||
|
{
|
||||||
|
act.args.Add("isIndependent", isIndependent.Value);
|
||||||
|
}
|
||||||
|
XAttribute time = action.Attribute("time");
|
||||||
|
if (time != null)
|
||||||
|
{
|
||||||
|
act.args.Add("time", time.Value);
|
||||||
|
}
|
||||||
|
XAttribute count = action.Attribute("count");
|
||||||
|
if (count != null)
|
||||||
|
{
|
||||||
|
act.args.Add("count", count.Value);
|
||||||
|
}
|
||||||
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
||||||
|
if (finishedEvent != null)
|
||||||
|
{
|
||||||
|
act.args.Add("finishedEvent", finishedEvent.Value);
|
||||||
|
}
|
||||||
|
XAttribute visibility = action.Attribute("visibility");
|
||||||
|
if (visibility != null)
|
||||||
|
{
|
||||||
|
act.args.Add("visibility", visibility.Value);
|
||||||
|
}
|
||||||
newAction = act;
|
newAction = act;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "LoadRes":
|
case "LoadRes":
|
||||||
{
|
{
|
||||||
@ -1163,19 +1214,37 @@ namespace XMLTool
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "ObjClick":
|
case "ObjClick":
|
||||||
var act = new DictionaryCondition();
|
{
|
||||||
|
var act = new DictionaryCondition();
|
||||||
|
|
||||||
XAttribute deviceName = action.Attribute("deviceName");
|
XAttribute deviceName = action.Attribute("deviceName");
|
||||||
if (deviceName != null)
|
if (deviceName != null)
|
||||||
{
|
{
|
||||||
act.args.Add("deviceName", deviceName.Value);
|
act.args.Add("deviceName", deviceName.Value);
|
||||||
|
}
|
||||||
|
XAttribute isRight = action.Attribute("isRight");
|
||||||
|
if (isRight != null)
|
||||||
|
{
|
||||||
|
act.args.Add("isRight", isRight.Value);
|
||||||
|
}
|
||||||
|
newAction = act;
|
||||||
}
|
}
|
||||||
XAttribute isRight = action.Attribute("isRight");
|
break;
|
||||||
if (isRight != null)
|
case "ObjClickLong":
|
||||||
{
|
{
|
||||||
act.args.Add("isRight", isRight.Value);
|
var act = new DictionaryCondition();
|
||||||
|
XAttribute deviceName = action.Attribute("deviceName");
|
||||||
|
if (deviceName != null)
|
||||||
|
{
|
||||||
|
act.args.Add("deviceName", deviceName.Value);
|
||||||
|
}
|
||||||
|
XAttribute time = action.Attribute("time");
|
||||||
|
if (time != null)
|
||||||
|
{
|
||||||
|
act.args.Add("time", time.Value);
|
||||||
|
}
|
||||||
|
newAction = act;
|
||||||
}
|
}
|
||||||
newAction = act;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
newAction = new Condition();
|
newAction = new Condition();
|
||||||
|
|||||||
@ -89,8 +89,17 @@
|
|||||||
如果deviceName存在 则不用isDevice
|
如果deviceName存在 则不用isDevice
|
||||||
-->
|
-->
|
||||||
<Action type="Show" value="SM_QvanChangJing/sence/pPlane1" deviceName="设备名字" isShow="false" isDevice="false"></Action>
|
<Action type="Show" value="SM_QvanChangJing/sence/pPlane1" deviceName="设备名字" isShow="false" isDevice="false"></Action>
|
||||||
<!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡-->
|
<!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡
|
||||||
<Action type="HighLight" deviceName="设备名字" value="路径" isHigh="true" color="0,255,0,255" isIndependent="true"></Action>
|
visibility: 有三种形式 Normal, AlwaysOnTop,OnlyWhenOccluded
|
||||||
|
-->
|
||||||
|
<Action type="HighLight" deviceName="设备名字" value="路径" isHigh="true" color="0,255,0,255" isIndependent="true" visibility="Normal"></Action>
|
||||||
|
<!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡
|
||||||
|
time是从不显示到完全显示的时间
|
||||||
|
count是循环 -1为无限循环需要主动关闭
|
||||||
|
当count不为-1时 可以使用finishedEvent配合strEvent做闪烁结束的监听
|
||||||
|
visibility: 有三种形式 Normal, AlwaysOnTop,OnlyWhenOccluded
|
||||||
|
-->
|
||||||
|
<Action type="HighLightFlash" deviceName="测试" isHigh="true" color="0,255,0,255" time="1" count="-1" finishedEvent="等待" visibility="Normal"></Action>
|
||||||
<!--延迟 value是秒-->
|
<!--延迟 value是秒-->
|
||||||
<Action type="Delay" value="2"></Action>
|
<Action type="Delay" value="2"></Action>
|
||||||
<!--
|
<!--
|
||||||
@ -104,9 +113,12 @@
|
|||||||
|
|
||||||
<!--判断UI点击-->
|
<!--判断UI点击-->
|
||||||
<Condition type="UIClick" value="UI路径 可以使用快捷键Ctrl+Q获取"></Condition>
|
<Condition type="UIClick" value="UI路径 可以使用快捷键Ctrl+Q获取"></Condition>
|
||||||
<!--判断物体点击 isRight = true 则点击到目标物体 才算满足 false 则点击了其他物体就满足 常用于错误的点击-->
|
<!--判断物体点击 支持deviceName isRight = true 则点击到目标物体 才算满足 false 则点击了其他物体就满足 常用于错误的点击-->
|
||||||
<Condition type="ObjClick" value="物体路径 可以使用快捷键Ctrl+Q获取" isRight="true"></Condition>
|
<Condition type="ObjClick" deviceName="设备名" value="物体路径 可以使用快捷键Ctrl+Q获取" isRight="true"></Condition>
|
||||||
<!--判断键盘输入-->
|
<!--判断物体点击(长按) time为长按时间(秒)-->
|
||||||
|
<Condition type="ObjClickLong" deviceName="设备名" value="物体路径 可以使用快捷键Ctrl+Q获取" time="3"></Condition>
|
||||||
|
|
||||||
|
<!--判断键盘输入 这里的value对应的是KeyCode枚举-->
|
||||||
<Condition type="Input" value="A"></Condition>
|
<Condition type="Input" value="A"></Condition>
|
||||||
<!--判断变量名i是否等于1-->
|
<!--判断变量名i是否等于1-->
|
||||||
<Condition type="Var" name="变量名" value="1"></Condition>
|
<Condition type="Var" name="变量名" value="1"></Condition>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user