本文整理汇总了C#中Dsl.GetLine方法的典型用法代码示例。如果您正苦于以下问题:C# Dsl.GetLine方法的具体用法?C# Dsl.GetLine怎么用?C# Dsl.GetLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dsl
的用法示例。
在下文中一共展示了Dsl.GetLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: CreateCommand
public IStoryCommand CreateCommand(Dsl.ISyntaxComponent commandConfig)
{
lock (m_Lock) {
Dsl.CallData callData = commandConfig as Dsl.CallData;
if (null != callData) {
if (callData.IsHighOrder) {
Dsl.CallData innerCall = callData.Call;
if (innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD ||
innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_BRACKET ||
innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE ||
innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET ||
innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_PARENTHESIS) {
if (callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS) {
//obj.member(a,b,...) or obj[member](a,b,...) or obj.(member)(a,b,...) or obj.[member](a,b,...) or obj.{member}(a,b,...) -> execinstance(obj,member,a,b,...)
Dsl.CallData newCall = new Dsl.CallData();
newCall.Name = new Dsl.ValueData("dotnetexec", Dsl.ValueData.ID_TOKEN);
newCall.SetParamClass((int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS);
if (innerCall.IsHighOrder) {
newCall.Params.Add(innerCall.Call);
newCall.Params.Add(innerCall.GetParam(0));
for (int i = 0; i < callData.GetParamNum(); ++i) {
Dsl.ISyntaxComponent p = callData.Params[i];
newCall.Params.Add(p);
}
} else {
newCall.Params.Add(innerCall.Name);
newCall.Params.Add(innerCall.GetParam(0));
for (int i = 0; i < callData.GetParamNum(); ++i) {
Dsl.ISyntaxComponent p = callData.Params[i];
newCall.Params.Add(p);
}
}
return CreateCommand(newCall);
}
}
} else if (callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_OPERATOR && callData.GetId() == "=") {
Dsl.CallData innerCall = callData.GetParam(0) as Dsl.CallData;
if (null != innerCall) {
//obj.property = val -> setinstance(obj,property,val)
Dsl.CallData newCall = new Dsl.CallData();
newCall.Name = new Dsl.ValueData("dotnetset", Dsl.ValueData.ID_TOKEN);
newCall.SetParamClass((int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS);
if (innerCall.IsHighOrder) {
newCall.Params.Add(innerCall.Call);
newCall.Params.Add(innerCall.GetParam(0));
newCall.Params.Add(callData.GetParam(1));
} else {
newCall.Params.Add(innerCall.Name);
newCall.Params.Add(innerCall.GetParam(0));
newCall.Params.Add(callData.GetParam(1));
}
return CreateCommand(newCall);
}
}
}
IStoryCommand command = null;
string type = commandConfig.GetId();
IStoryCommandFactory factory = GetFactory(type);
if (null != factory) {
try {
command = factory.Create();
command.Init(commandConfig);
} catch (Exception ex) {
GameFramework.LogSystem.Error("command:{0} line:{1} failed.", commandConfig.ToScriptString(), commandConfig.GetLine());
throw ex;
}
} else {
#if DEBUG
string err = string.Format("CreateCommand failed, line:{0} command:{1}", commandConfig.GetLine(), commandConfig.ToScriptString());
throw new Exception(err);
#else
GameFramework.LogSystem.Error("CreateCommand failed, type:{0} line:{1}", type, commandConfig.GetLine());
#endif
}
if (null != command) {
GameFramework.LogSystem.Debug("CreateCommand, type:{0} command:{1}", type, command.GetType().Name);
} else {
#if DEBUG
string err = string.Format("CreateCommand failed, line:{0} command:{1}", commandConfig.GetLine(), commandConfig.ToScriptString());
throw new Exception(err);
#else
GameFramework.LogSystem.Error("CreateCommand failed, type:{0} line:{1}", type, commandConfig.GetLine());
#endif
}
return command;
}
}
示例3: Init
private bool Init(Dsl.FunctionData skill)
{
bool ret = false;
m_UseImpactsForInit = new List<SkillSectionOrMessageTriggers>();
m_ImpactsForInit = new List<SkillSectionOrMessageTriggers>();
m_DamagesForInit = new List<SkillSectionOrMessageTriggers>();
if (null != skill && (skill.GetId() == "skill" || skill.GetId() == "emitskill" || skill.GetId() == "hitskill")) {
ret = true;
Dsl.CallData callData = skill.Call;
if (null != callData && callData.HaveParam()) {
m_OuterDslSkillId = int.Parse(callData.GetParamId(0));
m_DslSkillId = m_OuterDslSkillId;
}
for (int i = 0; i < skill.Statements.Count; i++) {
if (skill.Statements[i].GetId() == "section") {
m_UseImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.Section));
m_ImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.Section));
m_DamagesForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.Section));
Dsl.FunctionData sectionData = skill.Statements[i] as Dsl.FunctionData;
if (null != sectionData) {
SkillSection section = new SkillSection();
section.Load(sectionData, this);
m_Sections.Add(section);
} else {
#if DEBUG
string err = string.Format("Skill {0} DSL, section must be a function ! line:{1} section:{2}", m_DslSkillId, skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString());
throw new Exception(err);
#else
LogSystem.Error("Skill {0} DSL, section must be a function !", m_DslSkillId);
#endif
}
} else if (skill.Statements[i].GetId() == "onmessage") {
m_UseImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.Message));
m_ImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.Message));
m_DamagesForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.Message));
Dsl.FunctionData sectionData = skill.Statements[i] as Dsl.FunctionData;
if (null != sectionData) {
SkillMessageHandler handler = new SkillMessageHandler();
handler.Load(sectionData, this);
m_MessageHandlers.Add(handler);
} else {
#if DEBUG
string err = string.Format("Skill {0} DSL, onmessage must be a function ! line:{1} onmessage:{2}", m_DslSkillId, skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString());
throw new Exception(err);
#else
LogSystem.Error("Skill {0} DSL, onmessage must be a function !", m_DslSkillId);
#endif
}
} else if (skill.Statements[i].GetId() == "onstop") {
m_UseImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.OnStop));
m_ImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.OnStop));
m_DamagesForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.OnStop));
Dsl.FunctionData sectionData = skill.Statements[i] as Dsl.FunctionData;
if (null != sectionData) {
m_StopSection = new SkillMessageHandler();
m_StopSection.Load(sectionData, this);
} else {
#if DEBUG
string err = string.Format("Skill {0} DSL, onstop must be a function ! line:{1} onmessage:{2}", m_DslSkillId, skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString());
throw new Exception(err);
#else
LogSystem.Error("Skill {0} DSL, onstop must be a function !", m_DslSkillId);
#endif
}
} else if (skill.Statements[i].GetId() == "oninterrupt") {
m_UseImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.OnInterrupt));
m_ImpactsForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.OnInterrupt));
m_DamagesForInit.Add(new SkillSectionOrMessageTriggers(SectionOrMessageType.OnInterrupt));
Dsl.FunctionData sectionData = skill.Statements[i] as Dsl.FunctionData;
if (null != sectionData) {
m_InterruptSection = new SkillMessageHandler();
m_InterruptSection.Load(sectionData, this);
} else {
#if DEBUG
string err = string.Format("Skill {0} DSL, oninterrupt must be a function ! line:{1} onmessage:{2}", m_DslSkillId, skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString());
throw new Exception(err);
#else
LogSystem.Error("Skill {0} DSL, oninterrupt must be a function !", m_DslSkillId);
#endif
}
} else if (skill.Statements[i].GetId() == "emitskill") {
Dsl.FunctionData sectionData = skill.Statements[i] as Dsl.FunctionData;
if (null != sectionData) {
PrepareInnerEmitSkillInstances();
SkillInstance inst = new SkillInstance();
inst.Init(sectionData);
Dsl.CallData header = sectionData.Call;
int innerId = 0;
if (header.GetParamNum() > 0) {
innerId = int.Parse(header.GetParamId(0));
}
inst.m_InnerDslSkillId = GenInnerEmitSkillId(innerId);
inst.m_OuterDslSkillId = m_DslSkillId;
inst.m_DslSkillId = m_DslSkillId;
if (!m_EmitSkillInstances.ContainsKey(inst.InnerDslSkillId)) {
m_EmitSkillInstances.Add(inst.InnerDslSkillId, inst);
} else {
#if DEBUG
string err = string.Format("Skill {0} DSL, emitskill id duplicate ! line:{1} onmessage:{2}", m_DslSkillId, skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString());
//.........这里部分代码省略.........