Beispiel #1
0
        public static List <JsonMechanics> GetJsonMechanicsList(List <MechanicEvent> mechanicLogs)
        {
            var mechanics = new List <JsonMechanics>();
            var dict      = new Dictionary <string, List <JsonMechanic> >();

            foreach (MechanicEvent ml in mechanicLogs)
            {
                var mech = new JsonMechanic(ml);
                if (dict.TryGetValue(ml.InGameName, out List <JsonMechanic> list))
                {
                    list.Add(mech);
                }
                else
                {
                    dict[ml.InGameName] = new List <JsonMechanic>()
                    {
                        mech
                    };
                }
            }
            foreach (KeyValuePair <string, List <JsonMechanic> > pair in dict)
            {
                mechanics.Add(new JsonMechanics(pair.Key, pair.Value));
            }
            return(mechanics);
        }
Beispiel #2
0
        private void SetMechanics(JsonLog log)
        {
            MechanicData mechanicData = _log.MechanicData;
            var          mechanicLogs = new List <MechanicLog>();

            foreach (var mLog in mechanicData.Values)
            {
                mechanicLogs.AddRange(mLog);
            }
            if (mechanicLogs.Any())
            {
                log.mechanics = new Dictionary <string, List <JsonMechanic> >();
                foreach (MechanicLog ml in mechanicLogs)
                {
                    JsonMechanic mech = new JsonMechanic
                    {
                        time  = ml.Time,
                        actor = ml.Actor.Character
                    };
                    if (log.mechanics.TryGetValue(ml.InGameName, out var list))
                    {
                        list.Add(mech);
                    }
                    else
                    {
                        log.mechanics[ml.InGameName] = new List <JsonMechanic>()
                        {
                            mech
                        };
                    }
                }
            }
        }
Beispiel #3
0
        public static List <JsonMechanics> GetJsonMechanicsList(List <MechanicEvent> mechanicLogs)
        {
            var mechanics = new List <JsonMechanics>();
            var dict      = new Dictionary <string, (string desc, List <JsonMechanic> data)>();

            foreach (MechanicEvent ml in mechanicLogs)
            {
                var mech = new JsonMechanic(ml);
                if (dict.TryGetValue(ml.ShortName, out (string _, List <JsonMechanic> data)jsonMechData))
                {
                    jsonMechData.data.Add(mech);
                }
                else
                {
                    dict[ml.ShortName] = (ml.Description, new List <JsonMechanic> {
                        mech
                    });
                }
            }
            foreach (KeyValuePair <string, (string desc, List <JsonMechanic> data)> pair in dict)
            {
                mechanics.Add(new JsonMechanics(pair.Key, pair.Value.desc, pair.Value.data));
            }
            return(mechanics);
        }
        public static JsonMechanic BuildJsonMechanic(MechanicEvent ml)
        {
            var jsMech = new JsonMechanic();

            jsMech.Time  = ml.Time;
            jsMech.Actor = ml.Actor.Character;
            return(jsMech);
        }
Beispiel #5
0
        private void SetMechanics(JsonLog log)
        {
            MechanicData mechanicData = _log.MechanicData;
            var          mechanicLogs = new List <MechanicLog>();

            foreach (var mLog in mechanicData.Values)
            {
                mechanicLogs.AddRange(mLog);
            }
            if (mechanicLogs.Any())
            {
                log.Mechanics = new List <JsonMechanics>();
                Dictionary <string, List <JsonMechanic> > dict = new Dictionary <string, List <JsonMechanic> >();
                foreach (MechanicLog ml in mechanicLogs)
                {
                    JsonMechanic mech = new JsonMechanic
                    {
                        Time  = ml.Time,
                        Actor = ml.Actor.Character
                    };
                    if (dict.TryGetValue(ml.InGameName, out var list))
                    {
                        list.Add(mech);
                    }
                    else
                    {
                        dict[ml.InGameName] = new List <JsonMechanic>()
                        {
                            mech
                        };
                    }
                }
                foreach (var pair in dict)
                {
                    log.Mechanics.Add(new JsonMechanics()
                    {
                        Name          = pair.Key,
                        MechanicsData = pair.Value
                    });
                }
            }
        }
        private void SetMechanics(JsonLog log)
        {
            MechanicData mechanicData = _log.MechanicData;
            var          mechanicLogs = new List <MechanicLog>();

            foreach (var mLog in mechanicData.Values)
            {
                mechanicLogs.AddRange(mLog);
            }
            if (mechanicLogs.Any())
            {
                log.Mechanics = new Dictionary <string, List <JsonMechanic> >();
                foreach (MechanicLog ml in mechanicLogs)
                {
                    JsonMechanic mech = new JsonMechanic
                    {
                        Time   = ml.Time,
                        Player = ml.Player.Character
                    };
                    if (_devMode)
                    {
                        if (!_mechanicData.ContainsKey(ml.ShortName))
                        {
                            _mechanicData[ml.ShortName] = new MechanicDesc()
                            {
                                PlotlySymbol = ml.PlotlySymbol,
                                PlotlyColor  = ml.PlotlyColor,
                                Description  = ml.Description,
                                PlotlyName   = ml.PlotlyName,
                                Enemy        = ml.Enemy ? 1 : 0
                            };
                        }
                        mech.ED = new JsonMechanic.JsonExtraMechanic()
                        {
                            SN = ml.ShortName,
                            S  = ml.Skill
                        };
                        if (ml.Enemy)
                        {
                            if (ml.Player.GetType() == typeof(Boss))
                            {
                                mech.ED.TI = -1;
                            }
                            else
                            {
                                mech.ED.TI = _log.FightData.Logic.Targets.IndexOf((Boss)ml.Player);
                            }
                        }
                        else
                        {
                            mech.ED.TI = _log.PlayerList.IndexOf((Player)ml.Player);
                        }
                    }
                    if (log.Mechanics.TryGetValue(ml.InGameName, out var list))
                    {
                        list.Add(mech);
                    }
                    else
                    {
                        log.Mechanics[ml.InGameName] = new List <JsonMechanic>()
                        {
                            mech
                        };
                    }
                }
            }
        }