当前位置: 首页>>代码示例>>C#>>正文


C# Dsl类代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:33,代码来源:CustomCommandValueParser.cs

示例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);
        }
开发者ID:kmeze,项目名称:Rhetos,代码行数:7,代码来源:DeactivateClaimsCodeGenerator.cs

示例3: Load

 protected override void Load(Dsl.CallData callData)
 {
     int num = callData.GetParamNum();
     if (num > 0) {
         m_Time.InitFromDsl(callData.GetParam(0));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:7,代码来源:Wait.cs

示例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;
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:27,代码来源:SkillTrigerManager.cs

示例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);
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:RotateTrigger.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:Wait.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:GameLogicCommands.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:GeneralCommands.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:GeneralCommands.cs

示例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;
            }
        }
开发者ID:genechiaramonte,项目名称:dsl,代码行数:57,代码来源:Generator.cs

示例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;
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:9,代码来源:DamageTrigger.cs

示例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);
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:9,代码来源:LocalMessage.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:10,代码来源:TransformTrigger.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:10,代码来源:GeneralTrigers.cs

示例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));
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:11,代码来源:AnimationTrigger.cs


注:本文中的Dsl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。