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


C# SkillInstance.Init方法代码示例

本文整理汇总了C#中SkillSystem.SkillInstance.Init方法的典型用法代码示例。如果您正苦于以下问题:C# SkillInstance.Init方法的具体用法?C# SkillInstance.Init怎么用?C# SkillInstance.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SkillSystem.SkillInstance的用法示例。


在下文中一共展示了SkillInstance.Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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());
//.........这里部分代码省略.........
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:101,代码来源:SkillInstance.cs

示例2: Load

        private void Load(Dsl.DslFile dataFile)
        {
            lock (m_Lock) {
                for (int i = 0; i < dataFile.DslInfos.Count; i++) {
                    if (dataFile.DslInfos[i].GetId() == "skill") {
                        Dsl.FunctionData funcData = dataFile.DslInfos[i].First;
                        if (null != funcData) {
                            Dsl.CallData callData = funcData.Call;
                            if (null != callData && callData.HaveParam()) {
                                int id = int.Parse(callData.GetParamId(0));
                                if (!m_SkillInstances.ContainsKey(id)) {
                                    SkillInstance instance = new SkillInstance();
                                    instance.Init(dataFile.DslInfos[i]);
                                    m_SkillInstances.Add(id, instance);

                                    LogSystem.Debug("ParseSkill {0}", id);
                                }
                                //else
                                //{
                                //repeated skill config.
                                //}
                            }
                        }
                    }
                }
            }
        }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:27,代码来源:SkillConfigManager.cs


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