コード例 #1
0
 protected virtual void OnNormalAttacklEventt(ActiveSkillEventArgs e)
 {
     if (NormalAttack != null)
     {
         NormalAttack(this, e);
     }
 }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: zdummy/EventSystemProto
        private void ActiveSkill(object sender, ActiveSkillEventArgs e)
        {
            UtilLog.Log("UI ActiveSkill:" + e.ToString());
            //FlyingText.text = e.SkillID.ToString();

            //textFlying.StartFly();
        }
コード例 #3
0
 protected virtual void OnActiveSkillEvent(ActiveSkillEventArgs e)
 {
     //EventHandler<ActiveSkillEventArgs> temp = Volatile.Read(ref ActiveSkill);
     if (ActiveSkill != null)
     {
         ActiveSkill(this, e);
     }
 }
コード例 #4
0
        private void ActiveSkill(object sender, ActiveSkillEventArgs e)
        {
            if (e.PlayerID != m_playerID || e.Caster != m_ID) //not me
            {
                return;
            }
            string eventInfo = GetMyString() + " cast ActiveSkill " + e.SkillID + " to " + e.GetTargetsString();

            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo("ActiveSkill:" + e.SkillID, Time.time));
        }
コード例 #5
0
        private void NormalAttack(object sender, ActiveSkillEventArgs e)
        {
            if (e.PlayerID != m_playerID || e.Caster != m_ID) //not me
            {
                return;
            }
            string eventInfo = GetMyString() + " NormalAttack to " + e.GetTargetsString();

            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo("NormalAttack" + e.effName, Time.time));
        }
コード例 #6
0
        //sometimes no skillID in effect data;
        protected void ProduceEvents(List <N2.BattleRoundAction_Effect> effects, int skillIDFromParent)
        {
            //UtilLog.Log("ProduceEvents BattleRoundActionEffect ");
            foreach (N2.BattleRoundAction_Effect eff in effects)
            {
                //UtilLog.Log("working on eff:"+eff.ToString());
                string effectStr        = "";
                int    eventInteralType = EVENT_Effect_BuffAuraDot;

                ActiveSkillEventArgs args = null;
                if (!string.IsNullOrEmpty(eff.TypeName))
                {
                    effectStr = eff.TypeName;

                    if (eff.AuraEffectType != null && eff.AuraEffectType.Count > 0 ||
                        eff.BuffEffectType != null && eff.BuffEffectType.Count > 0 ||
                        eff.DotEffectType != null && eff.DotEffectType.Count > 0 ||
                        eff.TypeName.Equals("ExitEffectType"))
                    {
                        args             = new Effect_BuffAuraDotEventArgs();
                        eventInteralType = EVENT_Effect_BuffAuraDot;
                    }
                    else if (eff.Damage != null && eff.Damage.Count > 0 ||
                             eff.Recover != null && eff.Recover.Count > 0)
                    {
                        args             = new Effect_DamageCureEventArgs();
                        eventInteralType = EVENT_Effect_DamageCure;
                    }
                    else if (eff.Value != null && eff.Value.Count > 0 ||
                             eff.ResultValue != null && eff.ResultValue.Count > 0)
                    {
                        //todo need more check on data
                        args             = new Effect_BuffAuraDotValueEventArgs();
                        eventInteralType = EVENT_Effect_BuffAuraDotValue;
                    }
                    else
                    {
                        UtilLog.Log("Effect neither damge/cure nor buffAuraDot");
                    }
                }
                else if (!string.IsNullOrEmpty(eff.StateName))
                {
                    effectStr        = eff.StateName;
                    args             = new Effect_STATEEventArgs();
                    eventInteralType = EVENT_Effect_State;
                }
                else
                {
                    UtilLog.Log("Effect neither typename, nore statename");
                }
                args.effName = effectStr;
                if (eff.Caster != null)
                {
                    args.Caster = int.Parse(eff.GetCasterID());
                }
                //sometimes no skillID in effect data;
                if (eff.SkillID == 0)
                {
                    args.SkillID = skillIDFromParent;
                }
                else
                {
                    args.SkillID = eff.SkillID;
                }

                args.EffectID     = eff.EffectID;
                args.EffectTypeID = eff.EffectTypeID;
                if (eventInteralType == EVENT_Effect_BuffAuraDot)
                {
                    Effect_BuffAuraDotEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotEventArgs;
                }
                else if (eventInteralType == EVENT_Effect_State)
                {
                    Effect_STATEEventArgs stateArgs = args as Effect_STATEEventArgs;
                    stateArgs.StateID = eff.StateID;
                }

                //pattern = reportFromationTable.GetEffectStatePattern(effectStr);
                if (eff.Targets != null && eff.Targets.Count > 0)
                {
                    for (int i = 0; i < eff.Targets.Count; i++)
                    {
                        if (eventInteralType == EVENT_Effect_DamageCure)
                        {
                            Effect_DamageCureEventArgs dmgCureArgs = args as Effect_DamageCureEventArgs;
                            if (eff.Damage != null)
                            {
                                dmgCureArgs.HPChange.Add(eff.Damage[i]);
                            }
                            else if (eff.Recover != null)
                            {
                                dmgCureArgs.HPChange.Add(eff.Recover[i]);
                            }
                            if (eff.LeftHP != null)
                            {
                                dmgCureArgs.LeftHP.Add(eff.LeftHP[i]);
                            }
                        }
                        else if (eventInteralType == EVENT_Effect_BuffAuraDot)
                        {
                            Effect_BuffAuraDotEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotEventArgs;
                            if (eff.AuraEffectType != null && eff.AuraEffectType.Count > 0)
                            {
                                //UtilLog.Log("auraEffect has size " + eff.AuraEffectType.Count +" ,we're index:" + i);
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Aura);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.AuraEffectType[i]);
                            }
                            else if (eff.BuffEffectType != null && eff.BuffEffectType.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Buff);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.BuffEffectType[i]);
                            }
                            else if (eff.DotEffectType != null && eff.DotEffectType.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Dot);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.DotEffectType[i]);
                            }
                            else if (eff.RemoveEffectTypeID != null && eff.RemoveEffectTypeID.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.RemoveEffect);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.RemoveEffectTypeID[i]);
                            }
                            else if (eff.TypeName.Equals("ExitEffectType"))
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.RemoveEffect);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.EffectTypeID);
                            }
                            //aura/dot/buff has no value
                        }
                        else if (eventInteralType == EVENT_Effect_BuffAuraDotValue)
                        {
                            Effect_BuffAuraDotValueEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotValueEventArgs;
                            if (eff.Value != null)
                            {
                                buffAuraDotArgs.ValueChange.Add(eff.Value[i]);
                            }
                            if (eff.ResultValue != null)
                            {
                                buffAuraDotArgs.ResultValue.Add(eff.ResultValue[i]);
                            }
                            if (eff.Result != null && eff.Result.Count > 0)
                            {
                                buffAuraDotArgs.bUsePercent = (eff.Result[0] == 0);
                            }
                        }
                        args.TargetPlayerIDs.Add(int.Parse(BattleReport.UnPackPlayerID(eff.Targets[i])));
                        args.Targets.Add(int.Parse(BattleReport.UnPackID(eff.Targets[i])));
                    }
                }
                m_eventQueue.Enqueue(new EventItem(m_timer.NextTimeStampEffect(), eventInteralType, args));
                //UtilLog.Log(m_eventQueue.Last().ToString());
            }
        }
コード例 #7
0
        protected void ProduceEvents(N2.BattleRoundAction_ActiveSkill skillEvent, string prefix = "")
        {
            //UtilLog.Log("ProduceEvents ActiveSkill "+prefix);
            if (!string.IsNullOrEmpty(skillEvent.Caster))
            {
                if (skillEvent.Effects.Count == 0 &&
                    skillEvent.Targets.Count == 0)
                {
                    return;
                }

                //UtilLog.Log("found caster " + skillEvent.Caster);
                ActiveSkillEventArgs args = new ActiveSkillEventArgs();
                //ev = new ReplayEvent(prefix, reportFromationTable.GetEffectStatePattern(prefix));
                args.PlayerID = int.Parse(skillEvent.GetPlayerID());
                args.Caster   = int.Parse(skillEvent.GetCasterID());
                args.SkillID  = skillEvent.SkillID;
                //todo ,could not get effect/effectType ID here right now
                //args.EffectID = skillEvent.
                //args.EffectTypeID = skillEvent.
                if (skillEvent.Targets != null && skillEvent.Targets.Count > 0)
                {
                    string targetStr = skillEvent.Targets[0];
                    args.Targets.Add(int.Parse(targetStr.Substring(targetStr.IndexOf("-") + 1)));
                    if (skillEvent.Targets.Count > 1)
                    {
                        for (int i = 1; i < skillEvent.Targets.Count; i++)
                        {
                            targetStr = skillEvent.Targets[i];
                            args.Targets.Add(int.Parse(targetStr.Substring(targetStr.IndexOf("-") + 1)));
                        }
                    }
                }

                int internalEventType = EVENT_ActiveSkill;
                if (prefix.Equals("CommandSkill"))
                {
                    internalEventType = EVENT_CommandSkill;
                }
                else if (prefix.Equals("PassiveSkill"))
                {
                    internalEventType = EVENT_PassiveSkill;
                }
                else if (prefix.Equals("NormalAttack"))
                {
                    internalEventType = EVENT_NormalAttack;
                }
                else if (prefix.Equals("BeforeAction"))
                {
                    internalEventType = EVENT_BeforeAction;
                }
                else if (prefix.Equals("RoundBegin"))
                {
                    internalEventType = EVENT_RoundBegin;
                }
                else if (prefix.Equals("RoundEnd"))
                {
                    internalEventType = EVENT_RoundEnd;
                }


                //UtilLog.Log("prefix:" + prefix + " eventType:"+ internalEventType+"/" + EventManager.GetEventType(internalEventType));
                m_eventQueue.Enqueue(new EventItem(m_timer.GetCurrent(), internalEventType, args));
                //UtilLog.Log(m_eventQueue.Last().ToString());
            }
            else
            {
                //UtilLog.Log("no caster " );
            }

            if (skillEvent.Effects != null)
            {
                ProduceEvents(skillEvent.Effects, skillEvent.SkillID);
            }
        }