2024-12-26 15:44:04 +08:00
|
|
|
|
using Microsoft.SqlServer.Server;
|
2024-12-20 10:31:29 +08:00
|
|
|
|
using QFramework;
|
2025-02-07 17:06:19 +08:00
|
|
|
|
using QFramework.Example;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
using System.Collections.Generic;
|
2025-02-08 16:22:00 +08:00
|
|
|
|
using System.Drawing;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Xml.Linq;
|
2025-02-08 16:22:00 +08:00
|
|
|
|
using UnityEditor.ShaderGraph.Internal;
|
2025-01-13 14:05:32 +08:00
|
|
|
|
using UnityEngine;
|
2025-02-07 17:06:19 +08:00
|
|
|
|
using static QFramework.Example.UIInputData;
|
|
|
|
|
|
using static UnityEditor.Progress;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
namespace XMLTool
|
|
|
|
|
|
{
|
|
|
|
|
|
public class AppData
|
|
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
public PreLoad preLoad;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public List<Module> Modules { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
public class PreLoad
|
|
|
|
|
|
{
|
|
|
|
|
|
public Action action;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public class Module
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public string type { get; set; }
|
|
|
|
|
|
public string Scene { get; set; }
|
|
|
|
|
|
public string ModuleName { get; set; }
|
2025-01-09 17:08:20 +08:00
|
|
|
|
public string Descript { get; set; }
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public List<Operation> Operations { get; set; }
|
|
|
|
|
|
public List<Device> Devices { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, FSM> FSM = new Dictionary<string, FSM>();
|
|
|
|
|
|
public Dictionary<string, Action> ActionDict { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Score score;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Device
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public string Icon { get; set; }
|
|
|
|
|
|
public string HighColor { get; set; }
|
|
|
|
|
|
public string Path { get; set; }
|
|
|
|
|
|
public string Tip { get; set; }
|
|
|
|
|
|
public string BoxColliderSize { get; set; }
|
|
|
|
|
|
public string BoxColliderCenter { get; set; }
|
|
|
|
|
|
public bool MeshCollider { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-19 11:20:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public class Score
|
|
|
|
|
|
{
|
|
|
|
|
|
public List<ScoreStep> scores;
|
|
|
|
|
|
}
|
|
|
|
|
|
public class ScoreStep
|
|
|
|
|
|
{
|
|
|
|
|
|
public string step;
|
|
|
|
|
|
public string name;
|
|
|
|
|
|
public string sum;
|
|
|
|
|
|
public string bind;
|
|
|
|
|
|
public float value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ActionItem
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public string Type { get; set; }
|
|
|
|
|
|
public string Value { get; set; }
|
|
|
|
|
|
public List<ActionItem> SubActions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Action : ActionItem
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-13 14:05:32 +08:00
|
|
|
|
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;
|
2025-01-19 19:47:16 +08:00
|
|
|
|
public int order = 1;
|
2025-01-13 14:05:32 +08:00
|
|
|
|
public string clickEvent;
|
|
|
|
|
|
}
|
|
|
|
|
|
public List<Data> datas = new List<Data>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-07 17:06:19 +08:00
|
|
|
|
|
|
|
|
|
|
public class InputAction : Action
|
|
|
|
|
|
{
|
|
|
|
|
|
public UIInputData data;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-08 16:22:00 +08:00
|
|
|
|
public class Show3DAction : Action
|
|
|
|
|
|
{
|
|
|
|
|
|
public UI3DObjShowData data;
|
|
|
|
|
|
}
|
2025-02-07 17:06:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public class Condition : ActionItem
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FSM
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public List<Transision> Transisions { get; set; }
|
|
|
|
|
|
public Dictionary<string, State> StateDict { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public class State
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public StatePart Enter { get; set; }
|
|
|
|
|
|
public StatePart Exit { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public class StatePart
|
|
|
|
|
|
{
|
|
|
|
|
|
public Action Action { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Transision
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public string From { get; set; }
|
|
|
|
|
|
public string To { get; set; }
|
|
|
|
|
|
public Condition Action { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Operation
|
|
|
|
|
|
{
|
2025-02-08 17:27:06 +08:00
|
|
|
|
public string name;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public string moduleType { get; set; }
|
2024-12-20 10:31:29 +08:00
|
|
|
|
public bool freeStep { get; set; }
|
2024-12-14 18:27:59 +08:00
|
|
|
|
public List<Step> Steps { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
public class Step
|
|
|
|
|
|
{
|
|
|
|
|
|
public Step Parent { get; set; }
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public Action Reset { get; set; }
|
|
|
|
|
|
public Action Start { get; set; }
|
|
|
|
|
|
public Action Finished { get; set; }
|
|
|
|
|
|
public bool isFinished = false;
|
|
|
|
|
|
public List<Step> SubSteps { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class XmlParser
|
|
|
|
|
|
{
|
|
|
|
|
|
public static AppData ParseXml(string xmlString)
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>XML
|
|
|
|
|
|
XDocument doc = XDocument.Parse(xmlString);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1>Ԫ<EFBFBD><D4AA>
|
|
|
|
|
|
XElement appDataElement = doc.Root;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ʼ<EFBFBD><CABC>AppData<74><61><EFBFBD><EFBFBD>
|
|
|
|
|
|
AppData appData = new AppData
|
|
|
|
|
|
{
|
|
|
|
|
|
Modules = new List<Module>(),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>
|
|
|
|
|
|
var preLoadElement = appDataElement.Element("PreLoad");
|
2024-12-20 10:31:29 +08:00
|
|
|
|
if (preLoadElement != null)
|
2024-12-18 16:20:06 +08:00
|
|
|
|
{
|
2024-12-19 11:52:56 +08:00
|
|
|
|
appData.preLoad = new PreLoad();
|
2024-12-19 11:01:50 +08:00
|
|
|
|
foreach (XElement actionElement in preLoadElement.Elements("Action"))
|
|
|
|
|
|
{
|
|
|
|
|
|
var action = ParseAction(actionElement);
|
|
|
|
|
|
appData.preLoad.action = action;
|
|
|
|
|
|
}
|
2024-12-18 16:20:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-19 11:01:50 +08:00
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
LoadModules(appDataElement, appData);
|
|
|
|
|
|
|
|
|
|
|
|
return appData;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void LoadModules(XElement appDataElement, AppData appData)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
foreach (XElement moduleElement in appDataElement.Elements("Module"))
|
|
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
LoadModule(moduleElement, appData);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void LoadModule(XElement moduleElement, AppData appData)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (moduleElement != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Module module = new Module()
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Devices = new List<Device>(),
|
|
|
|
|
|
ActionDict = new Dictionary<string, Action>(),
|
|
|
|
|
|
Operations = new List<Operation>(),
|
|
|
|
|
|
};
|
|
|
|
|
|
appData.Modules.Add(module);
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
module.type = moduleElement.Element("Type")?.Value;
|
|
|
|
|
|
module.ModuleName = moduleElement.Element("Name")?.Value;
|
2025-01-09 17:08:20 +08:00
|
|
|
|
module.Descript = moduleElement.Element("Descript")?.Value;
|
2024-12-18 16:20:06 +08:00
|
|
|
|
module.Scene = moduleElement.Element("Scene")?.Value;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>豸
|
|
|
|
|
|
foreach (XElement deviceElement in moduleElement.Elements("Device"))
|
|
|
|
|
|
{
|
|
|
|
|
|
Device device = new Device
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Name = deviceElement.Element("Name")?.Value,
|
|
|
|
|
|
Icon = deviceElement.Element("Icon")?.Value,
|
|
|
|
|
|
HighColor = deviceElement.Element("HighLight")?.Attribute("color")?.Value,
|
|
|
|
|
|
Path = deviceElement.Element("Path")?.Value,
|
|
|
|
|
|
Tip = deviceElement.Element("Tip")?.Value,
|
|
|
|
|
|
MeshCollider = deviceElement.Element("MeshCollider") != null,
|
|
|
|
|
|
BoxColliderCenter = deviceElement.Element("BoxCollider")?.Attribute("center")?.Value,
|
|
|
|
|
|
BoxColliderSize = deviceElement.Element("BoxCollider")?.Attribute("size")?.Value,
|
2024-12-14 18:27:59 +08:00
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
module.Devices.Add(device);
|
|
|
|
|
|
}
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
foreach (XElement actionElement in moduleElement.Elements("Action"))
|
|
|
|
|
|
{
|
|
|
|
|
|
var action = ParseAction(actionElement);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-18 16:20:06 +08:00
|
|
|
|
module.ActionDict.Add(action.Name, action);
|
|
|
|
|
|
}
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>
|
|
|
|
|
|
foreach (XElement fsmElement in moduleElement.Elements("FSM"))
|
|
|
|
|
|
{
|
|
|
|
|
|
FSM fsm = new FSM()
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Name = fsmElement.Attribute("name")?.Value,
|
|
|
|
|
|
StateDict = new Dictionary<string, State>(),
|
|
|
|
|
|
Transisions = new List<Transision>(),
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>״̬
|
|
|
|
|
|
foreach (var stateNode in fsmElement.Elements("State"))
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
State state = new State()
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Name = stateNode.Attribute("name")?.Value,
|
2024-12-14 18:27:59 +08:00
|
|
|
|
};
|
2024-12-18 16:20:06 +08:00
|
|
|
|
fsm.StateDict.Add(state.Name, state);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
XElement enterElement = stateNode.Element("Enter");
|
|
|
|
|
|
XElement exitElement = stateNode.Element("Exit");
|
|
|
|
|
|
if (enterElement != null)
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
state.Enter = new StatePart();
|
|
|
|
|
|
state.Enter.Action = ParseAction(enterElement.Element("Action"));
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
2024-12-18 16:20:06 +08:00
|
|
|
|
if (exitElement != null)
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
state.Exit = new StatePart();
|
|
|
|
|
|
state.Exit.Action = ParseAction(exitElement.Element("Action"));
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>״̬ת<CCAC><D7AA>
|
|
|
|
|
|
foreach (var transNode in fsmElement.Elements("Transision"))
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Transision trans = new Transision()
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Name = transNode.Attribute("name")?.Value,
|
|
|
|
|
|
From = transNode.Attribute("from")?.Value,
|
|
|
|
|
|
To = transNode.Attribute("to")?.Value,
|
2024-12-14 18:27:59 +08:00
|
|
|
|
};
|
2024-12-18 16:20:06 +08:00
|
|
|
|
trans.Action = ParseCondition(transNode.Element("Condition"));
|
|
|
|
|
|
fsm.Transisions.Add(trans);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
2024-12-18 16:20:06 +08:00
|
|
|
|
module.FSM.Add(fsm.Name, fsm);
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
foreach (var operationNode in moduleElement.Elements("Operation"))
|
|
|
|
|
|
{
|
|
|
|
|
|
//module.Operations
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-14 18:27:59 +08:00
|
|
|
|
|
2024-12-18 16:20:06 +08:00
|
|
|
|
var op = new Operation()
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-18 16:20:06 +08:00
|
|
|
|
Steps = new List<Step>(),
|
|
|
|
|
|
};
|
2025-02-08 17:27:06 +08:00
|
|
|
|
op.name = operationNode.Attribute("name")?.Value;
|
2024-12-18 16:20:06 +08:00
|
|
|
|
op.moduleType = operationNode.Attribute("moduleType")?.Value;
|
2024-12-20 10:31:29 +08:00
|
|
|
|
var free = operationNode.Attribute("freeStep");
|
|
|
|
|
|
bool isFree = true;
|
|
|
|
|
|
if (free != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool.TryParse(free.Value, out isFree);
|
|
|
|
|
|
}
|
|
|
|
|
|
op.freeStep = isFree;
|
2024-12-18 16:20:06 +08:00
|
|
|
|
foreach (XElement stepNode in operationNode.Elements("Step"))
|
|
|
|
|
|
{
|
|
|
|
|
|
op.Steps.Add(ParserStep(stepNode, null));
|
|
|
|
|
|
}
|
|
|
|
|
|
module.Operations.Add(op);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XElement scoreNode = moduleElement.Element("Score");
|
|
|
|
|
|
if (scoreNode != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
module.score = new Score()
|
|
|
|
|
|
{
|
|
|
|
|
|
scores = new List<ScoreStep>()
|
|
|
|
|
|
};
|
|
|
|
|
|
foreach (var item in scoreNode.Elements("Item"))
|
|
|
|
|
|
{
|
|
|
|
|
|
module.score.scores.Add(
|
|
|
|
|
|
new ScoreStep()
|
|
|
|
|
|
{
|
|
|
|
|
|
step = item.Attribute("step")?.Value,
|
|
|
|
|
|
name = item.Attribute("name")?.Value,
|
|
|
|
|
|
sum = item.Attribute("sum")?.Value,
|
|
|
|
|
|
bind = item.Attribute("bind")?.Value,
|
|
|
|
|
|
});
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Step ParserStep(XElement stepNode, Step parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
Step step = new Step();
|
|
|
|
|
|
step.Name = stepNode.Attribute("name")?.Value;
|
|
|
|
|
|
step.Reset = ParseAction(stepNode.Element("Reset")?.Element("Action"));
|
|
|
|
|
|
step.Start = ParseAction(stepNode.Element("Start")?.Element("Action"));
|
|
|
|
|
|
step.Finished = ParseAction(stepNode.Element("Finished")?.Element("Action"));
|
|
|
|
|
|
step.SubSteps = ParserSteps(stepNode, step);
|
|
|
|
|
|
step.Parent = parent;
|
|
|
|
|
|
return step;
|
|
|
|
|
|
}
|
|
|
|
|
|
public static List<Step> ParserSteps(XElement step, Step parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<Step> steps = new List<Step>();
|
|
|
|
|
|
if (step.Elements("Step").Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in step.Elements("Step"))
|
|
|
|
|
|
{
|
|
|
|
|
|
steps.Add(ParserStep(item, parent));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return steps;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Action ParseAction(XElement action)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (action == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string type = action.Attribute("type").Value;
|
|
|
|
|
|
|
|
|
|
|
|
Action newAction = null;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չAction<6F><6E><EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case "Move":
|
|
|
|
|
|
case "Rotate":
|
2024-12-18 14:26:20 +08:00
|
|
|
|
case "Scale":
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
|
|
|
|
|
var act = new MoveOrAction();
|
|
|
|
|
|
act.to = Utility.GetVector3FromStrArray(action.Attribute("to").Value);
|
|
|
|
|
|
act.time = float.Parse(action.Attribute("time").Value);
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Anim":
|
|
|
|
|
|
{
|
2024-12-30 10:29:48 +08:00
|
|
|
|
var act = new DictionaryAction();
|
2024-12-18 11:17:08 +08:00
|
|
|
|
var animName = action.Attribute("animName");
|
|
|
|
|
|
if (animName != null)
|
|
|
|
|
|
{
|
2025-01-08 17:05:35 +08:00
|
|
|
|
act.args.Add("animName", animName.Value);
|
2024-12-18 11:17:08 +08:00
|
|
|
|
}
|
2024-12-30 10:29:48 +08:00
|
|
|
|
var frame = action.Attribute("frame");
|
|
|
|
|
|
if (frame != null)
|
2024-12-18 11:17:08 +08:00
|
|
|
|
{
|
2024-12-30 10:29:48 +08:00
|
|
|
|
act.args.Add("frame", frame.Value);
|
2024-12-18 11:17:08 +08:00
|
|
|
|
}
|
2024-12-30 10:29:48 +08:00
|
|
|
|
var speed = action.Attribute("speed");
|
|
|
|
|
|
if (speed != null)
|
2024-12-18 11:17:08 +08:00
|
|
|
|
{
|
2024-12-30 10:29:48 +08:00
|
|
|
|
act.args.Add("speed", speed.Value);
|
2024-12-18 11:17:08 +08:00
|
|
|
|
}
|
2025-01-02 14:19:47 +08:00
|
|
|
|
var deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "UITools":
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
act.args.Add("devices", action.Attribute("devices").Value);
|
|
|
|
|
|
act.args.Add("answers", action.Attribute("answers").Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
var setActive = action.Attribute("setActive");
|
|
|
|
|
|
if (setActive != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("setActive", setActive.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
var rightLabel = action.Attribute("rightLabel");
|
|
|
|
|
|
if (rightLabel != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("rightLabel", rightLabel.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
var wrongLabel = action.Attribute("wrongLabel");
|
|
|
|
|
|
if (wrongLabel != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("wrongLabel", wrongLabel.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
var rightEvent = action.Attribute("rightEvent");
|
|
|
|
|
|
if (rightEvent != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("rightEvent", rightEvent.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
var wrongEvent = action.Attribute("wrongEvent");
|
|
|
|
|
|
if (wrongEvent != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("wrongEvent", wrongEvent.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
var rightScore = action.Attribute("rightScore");
|
|
|
|
|
|
if (rightScore != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("rightScore", rightScore.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
var wrongScore = action.Attribute("wrongScore");
|
|
|
|
|
|
if (wrongScore != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("wrongScore", wrongScore.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
2025-01-19 11:20:01 +08:00
|
|
|
|
var totalScore = action.Attribute("totalScore");
|
|
|
|
|
|
if (totalScore != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("totalScore", totalScore.Value);
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
var scoreStepName = action.Attribute("scoreStepName");
|
|
|
|
|
|
if (scoreStepName != null)
|
|
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("scoreStepName", scoreStepName.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
2025-01-14 18:16:35 +08:00
|
|
|
|
var autoHide = action.Attribute("autoHide");
|
|
|
|
|
|
if (autoHide != null)
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2025-01-14 18:16:35 +08:00
|
|
|
|
act.args.Add("autoHide", autoHide.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "TextQuestion":
|
|
|
|
|
|
{
|
2024-12-26 15:44:04 +08:00
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute title = action.Attribute("title");
|
|
|
|
|
|
if (title != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("title", title.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute options = action.Attribute("options");
|
|
|
|
|
|
if (options != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("options", options.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute answers = action.Attribute("answers");
|
|
|
|
|
|
if (answers != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("answers", answers.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute btns = action.Attribute("btns");
|
|
|
|
|
|
if (btns != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("btns", btns.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute wait = action.Attribute("wait");
|
|
|
|
|
|
if (wait != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("wait", wait.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute showAnswer = action.Attribute("showAnswer");
|
|
|
|
|
|
if (showAnswer != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("showAnswer", showAnswer.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute rightScore = action.Attribute("rightScore");
|
|
|
|
|
|
if (rightScore != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("rightScore", rightScore.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute errorScore = action.Attribute("wrongScore");
|
|
|
|
|
|
if (errorScore != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("errorScore", errorScore.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute scoreName = action.Attribute("scoreName");
|
|
|
|
|
|
if (scoreName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("scoreName", scoreName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute absolutely = action.Attribute("absolutely");
|
|
|
|
|
|
if (absolutely != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("absolutely", absolutely.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
XAttribute format = action.Attribute("format");
|
|
|
|
|
|
if (format != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("format", format.Value);
|
|
|
|
|
|
}
|
2025-01-06 10:49:36 +08:00
|
|
|
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
|
|
|
|
|
if (finishedEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("finishedEvent", finishedEvent.Value);
|
|
|
|
|
|
}
|
2025-01-14 18:48:46 +08:00
|
|
|
|
XAttribute optionType = action.Attribute("optionType");
|
|
|
|
|
|
if (optionType != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("optionType", optionType.Value);
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "UIShow":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute isShow = action.Attribute("isShow");
|
|
|
|
|
|
if (isShow == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("true");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(isShow.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Hint":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute time = action.Attribute("time");
|
|
|
|
|
|
if (time != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(time.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("-1");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute icon = action.Attribute("icon");
|
|
|
|
|
|
if (icon != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(icon.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("true");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute audio = action.Attribute("audio");
|
|
|
|
|
|
if (audio != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(audio.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Show":
|
|
|
|
|
|
{
|
2025-01-02 14:19:47 +08:00
|
|
|
|
var act = new DictionaryAction();
|
2024-12-14 18:27:59 +08:00
|
|
|
|
XAttribute isShow = action.Attribute("isShow");
|
|
|
|
|
|
if (isShow != null)
|
|
|
|
|
|
{
|
2025-01-08 17:05:35 +08:00
|
|
|
|
act.args.Add("isShow", isShow.Value);
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
2024-12-23 11:30:18 +08:00
|
|
|
|
|
|
|
|
|
|
XAttribute isDevice = action.Attribute("isDevice");
|
|
|
|
|
|
if (isDevice != null)
|
|
|
|
|
|
{
|
2025-01-02 14:19:47 +08:00
|
|
|
|
act.args.Add("isDevice", isDevice.Value);
|
2024-12-23 11:30:18 +08:00
|
|
|
|
}
|
2025-01-02 14:19:47 +08:00
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
2024-12-23 11:30:18 +08:00
|
|
|
|
{
|
2025-01-02 14:19:47 +08:00
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
2024-12-23 11:30:18 +08:00
|
|
|
|
}
|
2025-01-04 15:20:16 +08:00
|
|
|
|
XAttribute isRoot = action.Attribute("isRoot");
|
|
|
|
|
|
if (isRoot != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isRoot", isRoot.Value);
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-16 15:45:19 +08:00
|
|
|
|
case "CameraSwitch":
|
|
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute nearDevice = action.Attribute("nearDevice");
|
|
|
|
|
|
if (nearDevice != null)
|
2024-12-16 15:45:19 +08:00
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
act.args.Add("nearDevice", nearDevice.Value);
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
XAttribute nearPos = action.Attribute("nearPos");
|
|
|
|
|
|
if (nearPos != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("nearPos", nearPos.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute nearRot = action.Attribute("nearRot");
|
|
|
|
|
|
if (nearRot != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("nearRot", nearRot.Value);
|
|
|
|
|
|
}
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
2024-12-23 11:30:18 +08:00
|
|
|
|
|
|
|
|
|
|
XAttribute normalDevice = action.Attribute("normalDevice");
|
|
|
|
|
|
if (normalDevice != null)
|
2024-12-16 15:45:19 +08:00
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
act.args.Add("normalDevice", normalDevice.Value);
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
XAttribute normalPos = action.Attribute("normalPos");
|
|
|
|
|
|
if (normalPos != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("normalPos", normalPos.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute normalRot = action.Attribute("normalRot");
|
|
|
|
|
|
if (normalRot != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("normalRot", normalRot.Value);
|
|
|
|
|
|
}
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
2024-12-23 11:30:18 +08:00
|
|
|
|
|
2024-12-16 15:45:19 +08:00
|
|
|
|
XAttribute nearTime = action.Attribute("nearTime");
|
|
|
|
|
|
if (nearTime != null)
|
|
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
act.args.Add("nearTime", nearTime.Value);
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-12-26 15:44:04 +08:00
|
|
|
|
act.args.Add("nearTime", "0");
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
2024-12-23 11:30:18 +08:00
|
|
|
|
|
2024-12-24 17:49:45 +08:00
|
|
|
|
XAttribute normalTime = action.Attribute("normalTime");
|
2024-12-23 11:30:18 +08:00
|
|
|
|
if (normalTime != null)
|
2024-12-16 15:45:19 +08:00
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
act.args.Add("normalTime", normalTime.Value);
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-12-26 15:44:04 +08:00
|
|
|
|
act.args.Add("normalTime", "0");
|
2024-12-16 15:45:19 +08:00
|
|
|
|
}
|
2025-01-09 14:10:59 +08:00
|
|
|
|
XAttribute isOn = action.Attribute("isOn");
|
|
|
|
|
|
if (isOn != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isOn", isOn.Value);
|
|
|
|
|
|
}
|
2024-12-16 15:45:19 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-19 16:38:42 +08:00
|
|
|
|
case "CameraLock":
|
|
|
|
|
|
{
|
2025-01-09 15:06:14 +08:00
|
|
|
|
var act = new DictionaryAction();
|
2024-12-19 16:38:42 +08:00
|
|
|
|
XAttribute isMove = action.Attribute("isMove");
|
|
|
|
|
|
if (isMove != null)
|
|
|
|
|
|
{
|
2025-01-09 15:06:14 +08:00
|
|
|
|
act.args.Add("isMove", isMove.Value);
|
2024-12-19 16:38:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
XAttribute isRotate = action.Attribute("isRotate");
|
|
|
|
|
|
if (isRotate != null)
|
|
|
|
|
|
{
|
2025-01-09 15:06:14 +08:00
|
|
|
|
act.args.Add("isRotate", isRotate.Value);
|
2024-12-19 16:38:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-08 16:02:57 +08:00
|
|
|
|
case "TipWindow":
|
2024-12-17 09:39:38 +08:00
|
|
|
|
case "TextTip":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
2024-12-17 09:49:59 +08:00
|
|
|
|
XAttribute audio = action.Attribute("audio");
|
|
|
|
|
|
if (audio != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(audio.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
2024-12-17 09:39:38 +08:00
|
|
|
|
XAttribute btns = action.Attribute("btns");
|
|
|
|
|
|
if (btns != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(btns.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-17 18:07:20 +08:00
|
|
|
|
case "Video":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute size = action.Attribute("size");
|
|
|
|
|
|
if (size != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(size.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("792,458");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute offset = action.Attribute("offset");
|
|
|
|
|
|
if (offset != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(offset.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("0,0");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
|
|
|
|
|
if (finishedEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(finishedEvent.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute closeEvent = action.Attribute("closeEvent");
|
|
|
|
|
|
if (closeEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(closeEvent.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-18 13:16:36 +08:00
|
|
|
|
case "HighLight":
|
|
|
|
|
|
{
|
2024-12-27 14:08:27 +08:00
|
|
|
|
var act = new DictionaryAction();
|
2024-12-18 13:16:36 +08:00
|
|
|
|
XAttribute isHigh = action.Attribute("isHigh");
|
|
|
|
|
|
if (isHigh != null)
|
|
|
|
|
|
{
|
2024-12-27 14:08:27 +08:00
|
|
|
|
act.args.Add("isHigh", isHigh.Value);
|
2024-12-18 13:16:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
XAttribute color = action.Attribute("color");
|
|
|
|
|
|
if (color != null)
|
|
|
|
|
|
{
|
2024-12-27 14:08:27 +08:00
|
|
|
|
act.args.Add("color", color.Value);
|
2024-12-18 13:16:36 +08:00
|
|
|
|
}
|
2024-12-27 14:08:27 +08:00
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
2024-12-18 13:16:36 +08:00
|
|
|
|
{
|
2024-12-27 14:08:27 +08:00
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
2024-12-18 13:16:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
2025-01-16 11:42:11 +08:00
|
|
|
|
XAttribute isIndependent = action.Attribute("isIndependent");
|
|
|
|
|
|
if (isIndependent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isIndependent", isIndependent.Value);
|
|
|
|
|
|
}
|
2025-02-07 13:07:29 +08:00
|
|
|
|
XAttribute visibility = action.Attribute("visibility");
|
|
|
|
|
|
if (visibility != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("visibility", visibility.Value);
|
|
|
|
|
|
}
|
2025-01-16 11:42:11 +08:00
|
|
|
|
newAction = act;
|
2024-12-18 13:16:36 +08:00
|
|
|
|
}
|
2025-02-06 16:26:44 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
2025-02-07 13:07:29 +08:00
|
|
|
|
XAttribute visibility = action.Attribute("visibility");
|
|
|
|
|
|
if (visibility != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("visibility", visibility.Value);
|
|
|
|
|
|
}
|
2025-02-06 16:26:44 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
2024-12-18 13:16:36 +08:00
|
|
|
|
break;
|
2024-12-18 16:20:06 +08:00
|
|
|
|
case "LoadRes":
|
|
|
|
|
|
{
|
2025-01-08 17:05:35 +08:00
|
|
|
|
var act = new DictionaryAction();
|
2024-12-18 16:20:06 +08:00
|
|
|
|
XAttribute resType = action.Attribute("resType");
|
|
|
|
|
|
if (resType != null)
|
|
|
|
|
|
{
|
2025-01-08 17:05:35 +08:00
|
|
|
|
act.args.Add("resType", resType.Value);
|
2024-12-18 16:20:06 +08:00
|
|
|
|
}
|
2025-01-08 17:05:35 +08:00
|
|
|
|
XAttribute index = action.Attribute("index");
|
|
|
|
|
|
if (index != null)
|
2024-12-18 16:20:06 +08:00
|
|
|
|
{
|
2025-01-08 17:05:35 +08:00
|
|
|
|
act.args.Add("index", index.Value);
|
2024-12-18 16:20:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-19 09:47:07 +08:00
|
|
|
|
case "Audio":
|
|
|
|
|
|
{
|
|
|
|
|
|
//string path, string audioType, string loop, string finishedEvent, string volume,
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute audioType = action.Attribute("audioType");
|
|
|
|
|
|
if (audioType != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(audioType.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("Sound");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute loop = action.Attribute("loop");
|
|
|
|
|
|
if (loop != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(loop.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("false");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute waitFinished = action.Attribute("waitFinished");
|
|
|
|
|
|
if (waitFinished != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(waitFinished.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute volume = action.Attribute("volume");
|
|
|
|
|
|
if (volume != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(volume.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute isPlay = action.Attribute("isPlay");
|
|
|
|
|
|
if (isPlay != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(isPlay.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("true");
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-19 15:25:22 +08:00
|
|
|
|
case "Line":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute color = action.Attribute("color");
|
|
|
|
|
|
if (color != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(color.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
2024-12-19 16:38:42 +08:00
|
|
|
|
XAttribute width = action.Attribute("width");
|
|
|
|
|
|
if (width != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(width.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("0.1");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute lineScale = action.Attribute("lineScale");
|
|
|
|
|
|
if (lineScale != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(lineScale.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("1,1");
|
|
|
|
|
|
}
|
2024-12-19 15:25:22 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-19 17:43:29 +08:00
|
|
|
|
case "ResultTip":
|
|
|
|
|
|
{
|
2025-01-16 18:57:42 +08:00
|
|
|
|
var act = new DictionaryAction();
|
2024-12-19 17:43:29 +08:00
|
|
|
|
XAttribute isRight = action.Attribute("isRight");
|
|
|
|
|
|
if (isRight != null)
|
|
|
|
|
|
{
|
2025-01-16 18:57:42 +08:00
|
|
|
|
act.args.Add("isRight", isRight.Value);
|
2024-12-19 17:43:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
|
|
|
|
|
if (finishedEvent != null)
|
|
|
|
|
|
{
|
2025-01-16 18:57:42 +08:00
|
|
|
|
act.args.Add("finishedEvent", finishedEvent.Value);
|
2024-12-19 17:43:29 +08:00
|
|
|
|
}
|
2025-01-16 18:57:42 +08:00
|
|
|
|
XAttribute autoHide = action.Attribute("autoHide");
|
|
|
|
|
|
if (autoHide != null)
|
2024-12-19 17:43:29 +08:00
|
|
|
|
{
|
2025-01-16 18:57:42 +08:00
|
|
|
|
act.args.Add("autoHide", autoHide.Value);
|
2024-12-19 17:43:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-20 15:33:37 +08:00
|
|
|
|
case "Led":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute number = action.Attribute("number");
|
|
|
|
|
|
if (number != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(number.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute color = action.Attribute("color");
|
|
|
|
|
|
if (color != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(color.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("255,255,255,255");
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-20 17:05:19 +08:00
|
|
|
|
case "Script":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
|
|
|
|
|
if (finishedEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(finishedEvent.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-25 11:24:47 +08:00
|
|
|
|
case "Collider":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new StringListAction();
|
|
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(deviceName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute colliderType = action.Attribute("colliderType");
|
|
|
|
|
|
if (colliderType != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(colliderType.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("<22><>");
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute arg = action.Attribute("args");
|
|
|
|
|
|
if (arg != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add(arg.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-25 16:33:45 +08:00
|
|
|
|
case "TimeTip":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute time = action.Attribute("time");
|
|
|
|
|
|
if (time != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("time", time.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("time", "0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
XAttribute values = action.Attribute("values");
|
|
|
|
|
|
if (values != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("values", values.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute format = action.Attribute("format");
|
|
|
|
|
|
if (format != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("format", format.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
|
|
|
|
|
if (finishedEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("finishedEvent", finishedEvent.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
XAttribute needClick = action.Attribute("needClick");
|
|
|
|
|
|
if (needClick != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("needClick", needClick.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute reverse = action.Attribute("reverse");
|
|
|
|
|
|
if (reverse != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("reverse", reverse.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-02 14:11:02 +08:00
|
|
|
|
case "SkinnedBake":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-06 19:29:04 +08:00
|
|
|
|
case "TimeLine":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute isShow = action.Attribute("isShow");
|
|
|
|
|
|
if (isShow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isShow", isShow.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute finishedEvent = action.Attribute("finishedEvent");
|
|
|
|
|
|
if (finishedEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("finishedEvent", finishedEvent.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute isWait = action.Attribute("isWait");
|
|
|
|
|
|
if (isWait != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isWait", isWait.Value);
|
|
|
|
|
|
}
|
2025-01-07 11:22:06 +08:00
|
|
|
|
XAttribute frame = action.Attribute("frame");
|
|
|
|
|
|
if (frame != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("frame", frame.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute endFrame = action.Attribute("endFrame");
|
|
|
|
|
|
if (endFrame != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("endFrame", endFrame.Value);
|
|
|
|
|
|
}
|
2025-01-06 19:29:04 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-13 14:05:32 +08:00
|
|
|
|
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;
|
2025-01-13 15:14:02 +08:00
|
|
|
|
XAttribute atr = item.Attribute("deviceName");
|
2025-01-14 18:16:35 +08:00
|
|
|
|
if (atr != null)
|
2025-01-13 15:14:02 +08:00
|
|
|
|
{
|
|
|
|
|
|
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);
|
2025-01-19 19:47:16 +08:00
|
|
|
|
var order = item.Attribute("order");
|
|
|
|
|
|
if (order != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
int.TryParse(order.Value, out data.order);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-13 14:05:32 +08:00
|
|
|
|
data.clickEvent = item.Attribute("clickEvent")?.Value;
|
|
|
|
|
|
act.datas.Add(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-01-16 11:42:11 +08:00
|
|
|
|
case "Mat":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute value = action.Attribute("value");
|
|
|
|
|
|
if (value != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("value", value.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute matName = action.Attribute("matName");
|
|
|
|
|
|
if (matName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("matName", matName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute index = action.Attribute("index");
|
|
|
|
|
|
if (index != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("index", index.Value);
|
|
|
|
|
|
}
|
2025-01-19 17:13:40 +08:00
|
|
|
|
XAttribute mainTexture = action.Attribute("mainTexture");
|
|
|
|
|
|
if (mainTexture != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("mainTexture", mainTexture.Value);
|
|
|
|
|
|
}
|
2025-01-16 11:42:11 +08:00
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-02-07 17:06:19 +08:00
|
|
|
|
case "Input":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new InputAction();
|
|
|
|
|
|
act.data = new UIInputData();
|
|
|
|
|
|
act.data.title = action.Attribute("title")?.Value;
|
|
|
|
|
|
act.data.finishedEvent = action.Attribute("finishedEvent")?.Value;
|
|
|
|
|
|
foreach (var item in action.Elements("Input"))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIInputData.InputData inputData = new UIInputData.InputData();
|
|
|
|
|
|
inputData.answer = item.Attribute("answer")?.Value;
|
|
|
|
|
|
inputData.var = item.Attribute("var")?.Value;
|
|
|
|
|
|
inputData.name = item.Attribute("name")?.Value;
|
|
|
|
|
|
act.data.inputs.Add(inputData);
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var item in action.Elements("Btn"))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIInputData.BtnData btnData = new UIInputData.BtnData();
|
|
|
|
|
|
btnData.name = item.Attribute("name")?.Value;
|
|
|
|
|
|
btnData.clickEvent = item.Attribute("clickEvent")?.Value;
|
|
|
|
|
|
XAttribute checkAnswer = item.Attribute("checkAnswer");
|
|
|
|
|
|
if (checkAnswer != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool.TryParse(checkAnswer.Value, out btnData.checkAnswer);
|
|
|
|
|
|
}
|
|
|
|
|
|
btnData.wrongLabel = item.Attribute("wrongLabel")?.Value;
|
|
|
|
|
|
btnData.wrongEvent = item.Attribute("wrongEvent")?.Value;
|
|
|
|
|
|
XAttribute wrongCount = item.Attribute("wrongCount");
|
|
|
|
|
|
if (wrongCount != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
int.TryParse(wrongCount.Value, out btnData.wrongCount);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute autoHide = item.Attribute("autoHide");
|
|
|
|
|
|
if (autoHide != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(autoHide.Value, out btnData.autoHide);
|
|
|
|
|
|
}
|
|
|
|
|
|
btnData.scoreStepName = item.Attribute("scoreStepName")?.Value;
|
|
|
|
|
|
XAttribute rightScore = item.Attribute("rightScore");
|
|
|
|
|
|
if (rightScore != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(rightScore.Value, out btnData.rightScore);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute wrongScore = item.Attribute("wrongScore");
|
|
|
|
|
|
if (wrongScore != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(wrongScore.Value, out btnData.wrongScore);
|
|
|
|
|
|
}
|
|
|
|
|
|
act.data.btns.Add(btnData);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-02-08 10:59:20 +08:00
|
|
|
|
case "ImageTip":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute path = action.Attribute("path");
|
|
|
|
|
|
if (path != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("path", path.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute size = action.Attribute("size");
|
|
|
|
|
|
if (size != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("size", size.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute isDrag = action.Attribute("isDrag");
|
|
|
|
|
|
if (isDrag != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isDrag", isDrag.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute position = action.Attribute("position");
|
|
|
|
|
|
if (position != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("position", position.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-02-08 16:22:00 +08:00
|
|
|
|
case "3DObjShow":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new Show3DAction();
|
|
|
|
|
|
act.data = new UI3DObjShowData();
|
|
|
|
|
|
act.data.datas = new List<UI3DObjShowData.ObjData>();
|
|
|
|
|
|
foreach (var item in action.Elements("Object"))
|
|
|
|
|
|
{
|
|
|
|
|
|
UI3DObjShowData.ObjData objData = new UI3DObjShowData.ObjData();
|
|
|
|
|
|
objData.deviceName = item.Attribute("deviceName")?.Value;
|
|
|
|
|
|
|
|
|
|
|
|
XAttribute position = item.Attribute("position");
|
|
|
|
|
|
if (position != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
objData.position = Utility.GetVector3FromStrArray(position.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute rotate = item.Attribute("rotate");
|
|
|
|
|
|
if (rotate != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
objData.rotate = Utility.GetVector3FromStrArray(rotate.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute scale = item.Attribute("scale");
|
|
|
|
|
|
if (scale != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
objData.scale = Utility.GetVector3FromStrArray(scale.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute rotateSpeed = item.Attribute("rotateSpeed");
|
|
|
|
|
|
if (rotateSpeed != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(rotateSpeed.Value, out objData.rotateSpeed);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute moveSpeed = item.Attribute("moveSpeed");
|
|
|
|
|
|
if (moveSpeed != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(moveSpeed.Value, out objData.moveSpeed);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute distance = item.Attribute("distance");
|
|
|
|
|
|
if (distance != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(distance.Value, out objData.distance);
|
|
|
|
|
|
}
|
2025-02-10 10:54:47 +08:00
|
|
|
|
XAttribute distanceMin = item.Attribute("distanceMin");
|
|
|
|
|
|
if (distanceMin != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(distanceMin.Value, out objData.distanceMin);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute distanceMax = item.Attribute("distanceMax");
|
|
|
|
|
|
if (distanceMax != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(distanceMax.Value, out objData.distanceMax);
|
|
|
|
|
|
}
|
2025-02-08 16:22:00 +08:00
|
|
|
|
XAttribute pitchMin = item.Attribute("pitchMin");
|
|
|
|
|
|
if (pitchMin != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(pitchMin.Value, out objData.pitchMin);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute pitchMax = item.Attribute("pitchMax");
|
|
|
|
|
|
if (pitchMax != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float.TryParse(pitchMax.Value, out objData.pitchMax);
|
|
|
|
|
|
}
|
|
|
|
|
|
act.data.datas.Add(objData);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2025-02-08 17:27:06 +08:00
|
|
|
|
case "OperationChange":
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = new DictionaryAction();
|
|
|
|
|
|
XAttribute name = action.Attribute("name");
|
|
|
|
|
|
if (name != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("name", name.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
default:
|
|
|
|
|
|
newAction = new Action();
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2024-12-20 17:05:19 +08:00
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
newAction.Type = action.Attribute("type")?.Value;
|
|
|
|
|
|
newAction.Name = action.Attribute("name")?.Value;
|
|
|
|
|
|
newAction.Value = action.Attribute("value")?.Value;
|
|
|
|
|
|
newAction.SubActions = ParseActions(action);
|
|
|
|
|
|
return newAction;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Condition ParseCondition(XElement action)
|
|
|
|
|
|
{
|
2025-01-19 19:47:16 +08:00
|
|
|
|
if (action == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-12-26 19:35:31 +08:00
|
|
|
|
Condition newAction = null;
|
|
|
|
|
|
string type = action.Attribute("type")?.Value;
|
|
|
|
|
|
switch (type)
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
2024-12-26 19:35:31 +08:00
|
|
|
|
case "ObjClick":
|
|
|
|
|
|
{
|
2025-02-06 15:17:08 +08:00
|
|
|
|
var act = new DictionaryCondition();
|
|
|
|
|
|
|
|
|
|
|
|
XAttribute deviceName = action.Attribute("deviceName");
|
|
|
|
|
|
if (deviceName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("deviceName", deviceName.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
XAttribute isRight = action.Attribute("isRight");
|
|
|
|
|
|
if (isRight != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
act.args.Add("isRight", isRight.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction = act;
|
2024-12-26 19:35:31 +08:00
|
|
|
|
}
|
2025-02-06 15:17:08 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case "ObjClickLong":
|
2025-01-02 14:45:55 +08:00
|
|
|
|
{
|
2025-02-06 15:17:08 +08:00
|
|
|
|
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;
|
2025-01-02 14:45:55 +08:00
|
|
|
|
}
|
2024-12-26 19:35:31 +08:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
newAction = new Condition();
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
newAction.Type = type;
|
|
|
|
|
|
newAction.Name = action.Attribute("name")?.Value;
|
|
|
|
|
|
newAction.Value = action.Attribute("value")?.Value;
|
|
|
|
|
|
newAction.SubActions = ParseActions(action);
|
|
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
return newAction;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public static ActionItem ParserActionItem(XElement element)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ActionItem actItem = null;
|
|
|
|
|
|
switch (element.Name.LocalName)
|
|
|
|
|
|
{
|
|
|
|
|
|
case "Action":
|
|
|
|
|
|
actItem = ParseAction(element);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "Condition":
|
|
|
|
|
|
actItem = ParseCondition(element);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return actItem;
|
|
|
|
|
|
}
|
|
|
|
|
|
private static List<ActionItem> ParseActions(XElement actionElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ActionItem> actions = new List<ActionItem>();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (XElement action in actionElement.Elements())
|
|
|
|
|
|
{
|
|
|
|
|
|
actions.Add(ParserActionItem(action));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return actions;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|