本文整理汇总了C#中Dsl.GetId方法的典型用法代码示例。如果您正苦于以下问题:C# Dsl.GetId方法的具体用法?C# Dsl.GetId怎么用?C# Dsl.GetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dsl
的用法示例。
在下文中一共展示了Dsl.GetId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
}
示例3: 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));
}
}
示例4: CalcVector2
public static Vector2 CalcVector2(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "vector2")
return Vector2.zero;
int num = callData.GetParamNum();
if (2 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
return new Vector2(x, y);
} else {
return Vector2.zero;
}
}
示例5: CalcVector3
internal static Vector3 CalcVector3(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "vector3")
return Vector3.Zero;
int num = callData.GetParamNum();
if (3 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
float z = float.Parse(callData.GetParamId(2));
return new Vector3(x, y, z);
} else {
return Vector3.Zero;
}
}
示例6: CalcEularRotation
internal static Quaternion CalcEularRotation(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "eular")
return Quaternion.Identity;
int num = callData.GetParamNum();
if (3 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
float z = float.Parse(callData.GetParamId(2));
return Quaternion.CreateFromYawPitchRoll(x, y, z);
} else {
return Quaternion.Identity;
}
}
示例7: CalcEularAngles
public static Vector3 CalcEularAngles(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "eular")
return Vector3.Zero;
int num = callData.GetParamNum();
if (3 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
float z = float.Parse(callData.GetParamId(2));
return new Vector3(x, y, z) * 59.29578f;
} else {
return Vector3.Zero;
}
}
示例8: CalcQuaternion
public static Quaternion CalcQuaternion(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "quaternion")
return Quaternion.identity;
int num = callData.GetParamNum();
if (4 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
float z = float.Parse(callData.GetParamId(2));
float w = float.Parse(callData.GetParamId(3));
return new Quaternion(x, y, z, w);
} else {
return Quaternion.identity;
}
}
示例9: CalcColor
public static Color CalcColor(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "color")
return Color.white;
int num = callData.GetParamNum();
if (4 == num) {
float r = float.Parse(callData.GetParamId(0));
float g = float.Parse(callData.GetParamId(1));
float b = float.Parse(callData.GetParamId(2));
float a = float.Parse(callData.GetParamId(3));
return new Color(r, g, b, a);
} else {
return Color.white;
}
}
示例10: CalcEularRotation
public static Quaternion CalcEularRotation(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "eular")
return Quaternion.identity;
int num = callData.GetParamNum();
if (3 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
float z = float.Parse(callData.GetParamId(2));
try {
return Quaternion.Euler(x, y, z);
} catch {
return Quaternion.identity;
}
} else {
return Quaternion.identity;
}
}
示例11: FinalParse
public static void FinalParse(Dsl.DslInfo dslInfo)
{
string id = dslInfo.GetId();
if (id == "command") {
if (dslInfo.Functions.Count == 2) {
Dsl.FunctionData first = dslInfo.First;
string name = first.Call.GetParamId(0);
IStoryCommandFactory factory = StoryCommandManager.Instance.FindFactory(name);
if (null != factory) {
StorySystem.CommonCommands.CompositeCommand cmd = factory.Create() as StorySystem.CommonCommands.CompositeCommand;
Dsl.FunctionData second = dslInfo.Second;
cmd.InitialCommands.Clear();
for (int ix = 0; ix < second.GetStatementNum(); ++ix) {
Dsl.ISyntaxComponent syntaxComp = second.GetStatement(ix);
IStoryCommand sub = StoryCommandManager.Instance.CreateCommand(syntaxComp);
cmd.InitialCommands.Add(sub);
}
} else {
LogSystem.Error("Can't find command factory '{0}'", name);
}
}
} else if (id == "value") {
if (dslInfo.Functions.Count == 3) {
Dsl.FunctionData first = dslInfo.First;
string name = first.Call.GetParamId(0);
IStoryValueFactory factory = StoryValueManager.Instance.FindFactory(name);
if (null != factory) {
StorySystem.CommonValues.CompositeValue val = factory.Build() as StorySystem.CommonValues.CompositeValue;
Dsl.FunctionData second = dslInfo.Second;
Dsl.FunctionData third = dslInfo.Functions[2];
val.InitialCommands.Clear();
for (int ix = 0; ix < third.GetStatementNum(); ++ix) {
Dsl.ISyntaxComponent syntaxComp = third.GetStatement(ix);
IStoryCommand sub = StoryCommandManager.Instance.CreateCommand(syntaxComp);
val.InitialCommands.Add(sub);
}
} else {
LogSystem.Error("Can't find value factory '{0}'", name);
}
}
}
}
示例12: CalcVector4
public static Vector4 CalcVector4(Dsl.CallData callData)
{
if (null == callData || callData.GetId() != "vector4")
return Vector4.zero;
int num = callData.GetParamNum();
if (4 == num) {
float x = float.Parse(callData.GetParamId(0));
float y = float.Parse(callData.GetParamId(1));
float z = float.Parse(callData.GetParamId(2));
float w = float.Parse(callData.GetParamId(3));
return new Vector4(x, y, z, w);
} else {
return Vector4.zero;
}
}
示例13: LoadUserId
private void LoadUserId(Dsl.CallData callData)
{
if (callData.GetId() == "touser" && callData.GetParamNum() == 1) {
m_UserId.InitFromDsl(callData.GetParam(0));
m_HaveUserId = true;
}
}
示例14: LoadVarName
private void LoadVarName(Dsl.CallData callData)
{
if (callData.GetId() == "objid" && callData.GetParamNum() == 1) {
m_ObjIdVarName.InitFromDsl(callData.GetParam(0));
m_HaveObjId = true;
}
}
示例15: 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());
//.........这里部分代码省略.........