Пример #1
0
    void DoEvent(SkillEventTriggerType triggerType, int param1 = -1, int param2 = -1)
    {
        if (mEvents == null)
        {
            return;
        }
        for (int i = 0; i < mEvents.Count; ++i)
        {
            excel_skill_event eventInfo = mEvents[i];
            if (!IsServerEvent(eventInfo))
            {
                continue;
            }
            if ((ushort)triggerType != eventInfo.triggerType)
            {
                continue;
            }
            if (param1 != -1 && param1 != eventInfo.triggerParam1)
            {
                continue;
            }
            if (param2 != -1 && param2 != eventInfo.triggerParam2)
            {
                continue;
            }

            SkillEventRegister.SkillEventMethod e = null;
            SkillEventType type = (SkillEventType)eventInfo.eventType;
            if (!SkillEventRegister.events.TryGetValue(type, out e))
            {
                continue;
            }
            e(null, this, mContext, eventInfo);
        }
    }
Пример #2
0
    public static void DoEvent(SkillStage stage, SkillEventTriggerType triggerType, int param1 = -1, int param2 = -1)
    {
        excel_skill_stage stageInfo = stage.mStageInfo;

        if (stageInfo.events == null)
        {
            return;
        }
        for (int i = 0; i < stageInfo.events.Length; ++i)
        {
            int eventID = stageInfo.events[i];
            excel_skill_event eventInfo = excel_skill_event.Find(eventID);
            if ((int)triggerType != eventInfo.triggerType)
            {
                continue;
            }
            if (!IsEventTrait(SkillEventTrait.Server, eventInfo))
            {
                continue;
            }
            if (param1 != -1 && param1 != eventInfo.triggerParam1)
            {
                continue;
            }
            if (param2 != -1 && param2 != eventInfo.triggerParam2)
            {
                continue;
            }

            SkillEventRegister.SkillEventMethod e = null;
            SkillEventType type = (SkillEventType)eventInfo.eventType;
            if (!SkillEventRegister.events.TryGetValue(type, out e))
            {
                continue;
            }
            e(stage.Owner, null, stage.mSkillContext, eventInfo);
        }
    }