本文整理汇总了C#中Dsl类的典型用法代码示例。如果您正苦于以下问题:C# Dsl类的具体用法?C# Dsl怎么用?C# Dsl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dsl类属于命名空间,在下文中一共展示了Dsl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FirstParse
public static void FirstParse(Dsl.DslInfo dslInfo)
{
string id = dslInfo.GetId();
if (id == "command") {
if (dslInfo.Functions.Count == 2) {
StorySystem.CommonCommands.CompositeCommand cmd = new CommonCommands.CompositeCommand();
cmd.InitSharedData();
Dsl.FunctionData first = dslInfo.First;
cmd.Name = first.Call.GetParamId(0);
Dsl.FunctionData second = dslInfo.Second;
for (int ix = 0; ix < second.Call.GetParamNum(); ++ix) {
cmd.ArgNames.Add(second.Call.GetParamId(ix));
}
//注册
StoryCommandManager.Instance.RegisterCommandFactory(cmd.Name, new CommonCommands.CompositeCommandFactory(cmd), true);
}
} else if (id == "value") {
if (dslInfo.Functions.Count == 3) {
StorySystem.CommonValues.CompositeValue val = new CommonValues.CompositeValue();
val.InitSharedData();
Dsl.FunctionData first = dslInfo.First;
val.Name = first.Call.GetParamId(0);
Dsl.FunctionData second = dslInfo.Second;
for (int ix = 0; ix < second.Call.GetParamNum(); ++ix) {
val.ArgNames.Add(second.Call.GetParamId(ix));
}
Dsl.FunctionData third = dslInfo.Functions[2];
val.ReturnName = third.Call.GetParamId(0);
//注册
StoryValueManager.Instance.RegisterValueFactory(val.Name, new CommonValues.CompositeValueFactory(val), true);
}
}
}
示例2: GenerateCode
public void GenerateCode(Dsl.IConceptInfo conceptInfo, ICodeBuilder codeBuilder)
{
var info = (DataStructureInfo)conceptInfo;
if (info.Module.Name == "Common" && info.Name == "Claim")
codeBuilder.InsertCode(DeactivateInsteadOfDelete, ClaimRepositoryCodeGenerator.DeactivateInsteadOfDeleteTag, info);
}
示例3: Load
protected override void Load(Dsl.CallData callData)
{
int num = callData.GetParamNum();
if (num > 0) {
m_Time.InitFromDsl(callData.GetParam(0));
}
}
示例4: CreateTriger
public ISkillTriger CreateTriger(Dsl.ISyntaxComponent trigerConfig, SkillInstance instance)
{
ISkillTriger triger = null;
string type = trigerConfig.GetId();
ISkillTrigerFactory factory = GetFactory(type);
if (null != factory) {
try {
triger = factory.Create();
triger.Init(trigerConfig, instance);
} catch (Exception ex) {
GameFramework.LogSystem.Error("triger:{0} line:{1} failed.", trigerConfig.ToScriptString(), trigerConfig.GetLine());
throw ex;
}
} else {
#if !DEBUG
GameFramework.LogSystem.Error("CreateTriger failed, type:{0}", type);
#endif
}
if (null != triger) {
GameFramework.LogSystem.Debug("CreateTriger, type:{0} triger:{1}", type, triger.GetType().Name);
} else {
#if !DEBUG
GameFramework.LogSystem.Error("CreateTriger failed, type:{0}", type);
#endif
}
return triger;
}
示例5: Load
protected override void Load(Dsl.CallData callData, SkillInstance instance)
{
if (callData.GetParamNum() >= 3) {
StartTime = long.Parse(callData.GetParamId(0));
m_RemainTime = long.Parse(callData.GetParamId(1));
m_RotateSpeed = DslUtility.CalcVector3(callData.GetParam(2) as Dsl.CallData);
}
}
示例6: LoadCondition
private void LoadCondition(Dsl.CallData callData)
{
int num = callData.GetParamNum();
if (num > 0 && callData.GetId() == "if") {
m_HaveCondition = true;
m_Condition.InitFromDsl(callData.GetParam(0));
}
}
示例7: Load
protected override void Load(Dsl.CallData callData)
{
int num = callData.GetParamNum();
if (num > 1) {
m_Key.InitFromDsl(callData.GetParam(0));
m_Value.InitFromDsl(callData.GetParam(1));
}
}
示例8: Load
protected override void Load(Dsl.CallData callData)
{
int num = callData.GetParamNum();
if (num > 1) {
m_TargetSceneId.InitFromDsl(callData.GetParam(0));
m_ObjId.InitFromDsl(callData.GetParam(1));
}
}
示例9: Load
protected override void Load(Dsl.CallData callData)
{
int num = callData.GetParamNum();
if (num > 1) {
m_ObjPath.InitFromDsl(callData.GetParam(0));
m_ComponentType.InitFromDsl(callData.GetParam(1));
}
}
示例10: GenerateFile
public static IEnumerable<string> GenerateFile(string file)
{
var name = Path.GetFileNameWithoutExtension(file);
var directory = Path.GetDirectoryName(file);
File representation;
using (var stream = System.IO.File.OpenRead(file))
{
var lexer = new GrammarLexer(new AntlrInputStream(stream));
var tokenStream = new CommonTokenStream(lexer);
var context = new GrammarParser(tokenStream).program();
var dsl = new Dsl(name);
dsl.Visit(context);
representation = dsl.File;
}
var outputs = representation.GenerateSource();
if (outputs.HasMessageContent)
{
if (outputs.HasMarkers)
{
var path = Path.Combine(directory, $"{representation.Name}MarkerInterfaces.cs");
System.IO.File.WriteAllText(path, outputs.Markers);
yield return path;
}
if (outputs.HasMessages)
{
var path = Path.Combine(directory, $"{representation.Name}Messages.cs");
System.IO.File.WriteAllText(path, outputs.Messages);
yield return path;
}
if (outputs.HasEnumerations)
{
var path = Path.Combine(directory, $"{representation.Name}Enums.cs");
System.IO.File.WriteAllText(path, outputs.Enumerations);
yield return path;
}
}
if (outputs.HasStateDefinitions)
{
var path = Path.Combine(directory, $"{representation.Name}StateSubscriptions.cs");
System.IO.File.WriteAllText(path, outputs.StateDefinitions);
yield return path;
}
if (outputs.HasEntities)
{
var path = Path.Combine(directory, $"{representation.Name}Entities.cs");
System.IO.File.WriteAllText(path, outputs.Entities);
yield return path;
}
}
示例11: Load
protected override void Load(Dsl.CallData callData, SkillInstance instance)
{
int num = callData.GetParamNum();
if (num > 0) {
StartTime = long.Parse(callData.GetParamId(0));
} else {
StartTime = 0;
}
}
示例12: Load
protected override void Load(Dsl.CallData callData)
{
int num = callData.GetParamNum();
for (int i = 0; i < num; ++i) {
IStoryValue<string> val = new StoryValue<string>();
val.InitFromDsl(callData.GetParam(i));
m_MsgIds.Add(val);
}
}
示例13: Load
protected override void Load(Dsl.CallData callData, SkillInstance instance)
{
int num = callData.GetParamNum();
if (num >= 4) {
StartTime = long.Parse(callData.GetParamId(0));
m_RelativeOffset.X = float.Parse(callData.GetParamId(1));
m_RelativeOffset.Y = float.Parse(callData.GetParamId(2));
m_RelativeOffset.Z = float.Parse(callData.GetParamId(3));
}
}
示例14: Load
protected override void Load(Dsl.CallData callData, SkillInstance instance)
{
int num = callData.GetParamNum();
if (num >= 1) {
StartTime = long.Parse(callData.GetParamId(0));
}
if (num >= 2) {
m_RemainTime = long.Parse(callData.GetParamId(1));
}
}
示例15: Load
protected override void Load(Dsl.CallData callData, SkillInstance instance )
{
int num = callData.GetParamNum();
if (num >= 2) {
StartTime = long.Parse(callData.GetParamId(0));
m_Speed = float.Parse(callData.GetParamId(1));
}
if (num >= 3) {
m_IsEffectSkillTime = bool.Parse(callData.GetParamId(2));
}
}