private void ResetCurSection() { if (m_CurSection >= 0 && m_CurSection < m_Sections.Count) { SkillSection section = m_Sections[m_CurSection]; section.Reset(); } }
static public int Prepare(IntPtr l) { try { SkillSystem.SkillSection self = (SkillSystem.SkillSection)checkSelf(l); self.Prepare(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_IsFinished(IntPtr l) { try { SkillSystem.SkillSection self = (SkillSystem.SkillSection)checkSelf(l); pushValue(l, true); pushValue(l, self.IsFinished); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { SkillSystem.SkillSection o; o = new SkillSystem.SkillSection(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
public void ChangeToSection(int index) { if (index >= 0 && index < m_Sections.Count) { SkillSection section = m_Sections[index]; m_CurSection = index; m_CurSectionDuration = section.Duration * 1000; m_CurSectionTime = 0; section.Prepare(); //LogSystem.Debug("ChangeToSection:{0} duration:{1}", index, m_CurDuration); } }
static public int VisitProperties(IntPtr l) { try { SkillSystem.SkillSection self = (SkillSystem.SkillSection)checkSelf(l); SkillSystem.VisitPropertyDelegation a1; LuaDelegation.checkDelegate(l, 2, out a1); self.VisitProperties(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_Duration(IntPtr l) { try { SkillSystem.SkillSection self = (SkillSystem.SkillSection)checkSelf(l); System.Int64 v; checkType(l, 2, out v); self.Duration = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int Load(IntPtr l) { try { SkillSystem.SkillSection self = (SkillSystem.SkillSection)checkSelf(l); Dsl.FunctionData a1; checkType(l, 2, out a1); SkillSystem.SkillInstance a2; checkType(l, 3, out a2); self.Load(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public SkillSection Clone() { SkillSection section = new SkillSection(); for (int i = 0; i < m_LoadedTrigers.Count; i++) { section.m_LoadedTrigers.Add(m_LoadedTrigers[i].Clone()); } /* * foreach (ISkillTriger triger in m_LoadedTrigers) { * section.m_LoadedTrigers.Add(triger.Clone()); * }*/ section.m_Duration = m_Duration; return(section); }
static public int Tick(IntPtr l) { try { SkillSystem.SkillSection self = (SkillSystem.SkillSection)checkSelf(l); System.Object a1; checkType(l, 2, out a1); SkillSystem.SkillInstance a2; checkType(l, 3, out a2); System.Int64 a3; checkType(l, 4, out a3); self.Tick(a1, a2, a3); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private bool IsSectionDone(int sectionnum) { if (sectionnum >= 0 && sectionnum < m_Sections.Count) { SkillSection section = m_Sections[sectionnum]; if (section.IsFinished) { return(true); } else { return(false); } } else { return(true); } }
public void Reset() { m_IsInterrupted = false; m_IsFinished = false; m_IsCurveMoveEnable = true; m_IsRotateEnable = true; m_IsDamageEnable = true; m_IsStopCurSection = false; m_TimeScale = 1; m_CurSection = -1; m_GoToSectionId = -1; int ct = m_Sections.Count; for (int i = ct - 1; i >= 0; --i) { SkillSection section = m_Sections[i]; section.Reset(); } m_CustomDatas.Clear(); m_MessageQueue.Clear(); }
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()); throw new Exception(err); #else LogSystem.Error("Skill {0} DSL, emitskill id duplicate !", m_DslSkillId); #endif } } else { #if DEBUG string err = string.Format("Skill {0} DSL, emitskill 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() == "hitskill") { Dsl.FunctionData sectionData = skill.Statements[i] as Dsl.FunctionData; if (null != sectionData) { PrepareInnerHitSkillInstances(); 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 = GenInnerHitSkillId(innerId); inst.m_OuterDslSkillId = m_DslSkillId; inst.m_DslSkillId = m_DslSkillId; if (!m_HitSkillInstances.ContainsKey(inst.InnerDslSkillId)) { m_HitSkillInstances.Add(inst.InnerDslSkillId, inst); } else { #if DEBUG string err = string.Format("Skill {0} DSL, hitskill id duplicate ! line:{1} onmessage:{2}", m_DslSkillId, skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString()); throw new Exception(err); #else LogSystem.Error("Skill {0} DSL, hitskill id duplicate !", m_DslSkillId); #endif } } else { #if DEBUG string err = string.Format("Skill {0} DSL, hitskill 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 DEBUG string err = string.Format("SkillInstance::Init, Skill {0} unknown part {1}, line:{2} section:{3}", m_DslSkillId, skill.Statements[i].GetId(), skill.Statements[i].GetLine(), skill.Statements[i].ToScriptString()); throw new Exception(err); #else LogSystem.Error("SkillInstance::Init, Skill {0} unknown part {1}", m_DslSkillId, skill.Statements[i].GetId()); #endif } } } else { #if DEBUG string err = string.Format("SkillInstance::Init, isn't skill DSL, line:{0} skill:{1}", skill.GetLine(), skill.ToScriptString()); throw new Exception(err); #else LogSystem.Error("SkillInstance::Init, isn't skill DSL"); #endif } BuildImpactAndDamageInfo(); LogSystem.Debug("SkillInstance.Init section num:{0} {1} skill {2}", m_Sections.Count, ret, m_DslSkillId); return ret; }
//---------------------------------------------- public SkillSection Clone() { SkillSection section = new SkillSection(); for (int i = 0; i < m_InitTrigers.Count; ++i) { section.m_InitTrigers.Add(m_InitTrigers[i].Clone()); } for (int i = 0; i < m_LoadedTrigers.Count; i++) { section.m_LoadedTrigers.Add(m_LoadedTrigers[i].Clone()); } section.m_Duration = m_Duration; return section; }
public bool Init(ScriptableData.ScriptableDataInfo config) { bool ret = false; ScriptableData.FunctionData skill = config.First; if (null != skill && skill.GetId() == "skill") { ret = true; ScriptableData.CallData callData = skill.Call; if (null != callData && callData.HaveParam()) { m_SkillId = int.Parse(callData.GetParamId(0)); } for (int i = 0; i < skill.Statements.Count; i++) { if (skill.Statements[i].GetId() == "section") { ScriptableData.FunctionData sectionData = skill.Statements[i] as ScriptableData.FunctionData; if (null != sectionData) { SkillSection section = new SkillSection(); section.Load(sectionData, m_SkillId); m_Sections.Add(section); } else { LogSystem.Error("Skill {0} DSL, section must be a function !", m_SkillId); } } else if (skill.Statements[i].GetId() == "onmessage") { ScriptableData.FunctionData sectionData = skill.Statements[i] as ScriptableData.FunctionData; if (null != sectionData) { SkillMessageHandler handler = new SkillMessageHandler(); handler.Load(sectionData, m_SkillId); m_MessageHandlers.Add(handler); } else { LogSystem.Error("Skill {0} DSL, onmessage must be a function !", m_SkillId); } } else if (skill.Statements[i].GetId() == "onstop") { ScriptableData.FunctionData sectionData = skill.Statements[i] as ScriptableData.FunctionData; if (null != sectionData) { m_StopSection = new SkillMessageHandler(); m_StopSection.Load(sectionData, m_SkillId); } else { LogSystem.Error("Skill {0} DSL, onstop must be a function !", m_SkillId); } } else if (skill.Statements[i].GetId() == "oninterrupt") { ScriptableData.FunctionData sectionData = skill.Statements[i] as ScriptableData.FunctionData; if (null != sectionData) { m_InterruptSection = new SkillMessageHandler(); m_InterruptSection.Load(sectionData, m_SkillId); } else { LogSystem.Error("Skill {0} DSL, oninterrupt must be a function !", m_SkillId); } } else { LogSystem.Error("SkillInstance::Init, unknown part {0}", skill.Statements[i].GetId()); } } /* * foreach (ScriptableData.ISyntaxComponent info in skill.Statements) { * if (info.GetId() == "section") { * ScriptableData.FunctionData sectionData = info as ScriptableData.FunctionData; * if (null != sectionData) { * SkillSection section = new SkillSection(); * section.Load(sectionData, m_SkillId); * m_Sections.Add(section); * } else { * LogSystem.Error("Skill {0} DSL, section must be a function !", m_SkillId); * } * } else if (info.GetId() == "onmessage") { * ScriptableData.FunctionData sectionData = info as ScriptableData.FunctionData; * if (null != sectionData) { * SkillMessageHandler handler = new SkillMessageHandler(); * handler.Load(sectionData, m_SkillId); * m_MessageHandlers.Add(handler); * } else { * LogSystem.Error("Skill {0} DSL, onmessage must be a function !", m_SkillId); * } * } else if (info.GetId() == "onstop") { * ScriptableData.FunctionData sectionData = info as ScriptableData.FunctionData; * if (null != sectionData) { * m_StopSection = new SkillMessageHandler(); * m_StopSection.Load(sectionData, m_SkillId); * } else { * LogSystem.Error("Skill {0} DSL, onstop must be a function !", m_SkillId); * } * } else if (info.GetId() == "oninterrupt") { * ScriptableData.FunctionData sectionData = info as ScriptableData.FunctionData; * if (null != sectionData) { * m_InterruptSection = new SkillMessageHandler(); * m_InterruptSection.Load(sectionData, m_SkillId); * } else { * LogSystem.Error("Skill {0} DSL, oninterrupt must be a function !", m_SkillId); * } * } else { * LogSystem.Error("SkillInstance::Init, unknown part {0}", info.GetId()); * } * }*/ } else { LogSystem.Error("SkillInstance::Init, isn't skill DSL"); } //LogSystem.Debug("SkillInstance.Init section num:{0} {1}", m_Sections.Count, ret); return(ret); }