private void StateChange(object sender, Effect_STATEEventArgs e)
        {
            if (!e.Targets.Contains(m_ID))
            {
                return;
            }
            int index = -1;

            for (int i = 0; i < e.Targets.Count; i++)
            {
                if (e.Targets[i] == m_ID)
                {
                    if (e.TargetPlayerIDs[i] == m_playerID)
                    {
                        index = i;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            string eventInfo = GetMyString() + " enter/leave state:" + e.StateID;

            if (e.StateID == 1)
            {
                m_dead = true;
            }
            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo("State:" + e.StateID, Time.time));
        }
Beispiel #2
0
        public void Output()
        {
            UtilLog.Log("BattleReportTeam");
            UtilLog.Log("TeamBlue:");
            foreach (var team in TeamBlue)
            {
                UtilLog.Log(team.ToString());
            }
            UtilLog.Log("TeamRed:");
            foreach (var team in TeamRed)
            {
                UtilLog.Log(team.ToString());
            }

            UtilLog.Log();
            PassiveRound.Output();
            UtilLog.Log();

            PrepareRound.Output();
            UtilLog.Log();

            foreach (var battleItem in BattleRound)
            {
                battleItem.Output();
            }
        }
Beispiel #3
0
        private void ActiveSkill(object sender, ActiveSkillEventArgs e)
        {
            UtilLog.Log("UI ActiveSkill:" + e.ToString());
            //FlyingText.text = e.SkillID.ToString();

            //textFlying.StartFly();
        }
        private void BuffAuraDotValue(object sender, Effect_BuffAuraDotValueEventArgs e)
        {
            if (!e.Targets.Contains(m_ID))
            {
                return;
            }
            int index = -1;

            for (int i = 0; i < e.Targets.Count; i++)
            {
                if (e.Targets[i] == m_ID)
                {
                    if (e.TargetPlayerIDs[i] == m_playerID)
                    {
                        index = i;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            string eventInfo = string.Format("{0} got BuffAuraDotValue {1}({2}) EffectID:{3} EffectTypeID:{4} Skill:{5} eff:{6}", GetMyString(), e.ValueChange[index], e.ResultValue[index], e.EffectID, e.EffectTypeID, e.SkillID, e.effName);

            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo(e.effName + ":" + e.ValueChange[index] + "(" + e.ResultValue[index] + ")", Time.time));
        }
        private void BuffAuraDot(object sender, Effect_BuffAuraDotEventArgs e)
        {
            if (!e.Targets.Contains(m_ID))
            {
                return;
            }
            int index = -1;

            for (int i = 0; i < e.Targets.Count; i++)
            {
                if (e.Targets[i] == m_ID)
                {
                    if (e.TargetPlayerIDs[i] == m_playerID)
                    {
                        index = i;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            //string result = string.Format("{0} got {1}:{4} EffectID:{2} EffectTypeID:{3}", GetMyString(), e.eventType[index].ToString(), e.EffectID, e.EffectTypeID, e.BuffAuraDotID[index]);

            string eventInfo = (string.Format("{0} got {1}:{2} EffectID:{3} EffectTypeID:{4} Skill:{5} eff:{6}", GetMyString(), e.eventType[index].ToString(), e.BuffAuraDotID[index], e.EffectID, e.EffectTypeID, e.SkillID, e.effName));

            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo(e.effName + " " + e.BuffAuraDotID[index], Time.time));
        }
        private void HurtOrCure(object sender, Effect_DamageCureEventArgs e)
        {
            if (!e.Targets.Contains(m_ID))
            {
                return;
            }
            int index = -1;

            for (int i = 0; i < e.Targets.Count; i++)
            {
                if (e.Targets[i] == m_ID)
                {
                    if (e.TargetPlayerIDs[i] == m_playerID)
                    {
                        index = i;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            hp -= e.HPChange[index];

            if (hp != e.LeftHP[index])
            {
                UtilLog.Log("HP mismatch with server, something wrong localHP:" + hp + " server:" + e.LeftHP[index]);
            }
            string eventInfo = string.Format("{0} got cure/hurt: {1}:{2} EffectID:{3} EffectTypeID:{4} Skill:{5} eff:{6}", GetMyString(), e.HPChange[index], e.LeftHP[index], e.EffectID, e.EffectTypeID, e.SkillID, e.effName);

            UtilLog.Log(eventInfo);
            m_EventInfoQueue.Enqueue(new EventInfo(e.effName, Time.time));
        }
Beispiel #7
0
        //public override string ToString()
        //{
        //   UtilLog.Log("RoundType:"+RoundType);
        //    foreach ( var action in ActionList)
        //    {
        //       UtilLog.Log();
        //    }
        //    return "";
        //}

        public void Output()
        {
            UtilLog.Log("BattleRound RoundType:" + RoundType);
            foreach (var action in ActionList)
            {
                //Debug.Log(action.ToString());
                action.Output();
            }
        }
Beispiel #8
0
 public void Output(string prefix)
 {
     UtilLog.Log("\t" + prefix);
     if (Effects != null)
     {
         foreach (var eff in Effects)
         {
             UtilLog.Log("\t\t" + eff.ToString());
         }
     }
 }
        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));
        }
        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));
        }
Beispiel #11
0
        private void EnterRound(object sender, RoundEventArgs e)
        {
            if (baseTimer < 0)
            {
                baseTimer = Time.time;
            }
            UtilLog.Log("UI EnterRound:" + e.RoundInfo);

            if (e.RoundInfo.Equals("BattleRound"))
            {
                m_RoundCounter++;
                RoundInfo.text = e.RoundInfo + " " + m_RoundCounter;
            }
            else
            {
                RoundInfo.text = e.RoundInfo;
            }
        }
Beispiel #12
0
        void Start()
        {
            UtilLog.Log("ArenaWorld.Start");
            string battleReportPath = "";

#if UNITY_EDITOR
            //always got below excpetion, dont know why
            //FileNotFoundException: Could not find file "/work/EventSystemProto/Assets/Data/result.json".;
            battleReportPath = Application.streamingAssetsPath + "/../Data/result.json";
            //battleReportPath = "/work/EventSystemProto/Assets/Data/result.json";


            //battleReportPath = Application.streamingAssetsPath + "/Assets/Data/result.json";
#elif UNITY_ANDROID
            battleReportPath = Application.persistentDataPath + "/../Data/result.json";
            //判断路径内数据库是否存在
            if (!File.Exists(appDBPath))
            {
Beispiel #13
0
        public void Output(string skillPre)
        {
            if (!string.IsNullOrEmpty(Caster) && SkillID != 0)
            {
                UtilLog.Log("\t" + skillPre + " caster:" + Caster + " skill:" + SkillID);
            }
            else
            {
                UtilLog.Log("\t" + skillPre + " caster:" + Caster);
            }

            if (Effects != null)
            {
                foreach (var eff in Effects)
                {
                    UtilLog.Log("\t\t" + eff.ToString());
                }
            }
        }
Beispiel #14
0
 public void Output()
 {
     //Debug.Log("BattleRoundAction.Output");
     if (RoundBegin != null && RoundBegin.Effects != null)
     {
         RoundBegin.Output("RoundBegin");
     }
     if (BeforeAction != null)
     {
         //UtilLog.Log();
         BeforeAction.Output("BeforeAction");
     }
     if (DelayRound != null && DelayRound.Caster != null)
     {
         UtilLog.Log("\tdelayRound:" + DelayRound.ToString());
     }
     if (NormalRangeLess != null && NormalRangeLess.Caster != null)
     {
         UtilLog.Log("\tNormalRangeLess:" + NormalRangeLess.ToString());
     }
     if (ActiveSkill != null && ActiveSkill.Caster != null)
     {
         //System.Console.Write("\tActiveSkill ");
         ActiveSkill.Output("ActiveSkill");
     }
     if (NormalAttack != null && NormalAttack.Caster != null)
     {
         //System.Console.Write("NormalAttack ");
         NormalAttack.Output("NormalAttack");
     }
     if (RoundEnd != null && RoundEnd.Effects != null)
     {
         RoundEnd.Output("RoundEnd");
         //UtilLog.Log();
     }
 }
Beispiel #15
0
 private void EnterRound(object sender, RoundEventArgs e)
 {
     UtilLog.Log("Scene EnterRound:" + e.RoundInfo);
 }
Beispiel #16
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());
            }
        }