private List <TypeStats> count(IList <Record> records)
        {
            var dict  = new Dictionary <string, int>();
            var total = 0;

            foreach (var record in records)
            {
                total += record.MinutesTotal;
                if (dict.ContainsKey(record.Type))
                {
                    dict[record.Type] += record.MinutesTotal;
                }
                else
                {
                    dict.Add(record.Type, record.MinutesTotal);
                }
            }
            var stats = new List <TypeStats>();

            foreach (var typeStats in dict)
            {
                var stat = new TypeStats();
                stat.Type    = typeStats.Key;
                stat.Minutes = typeStats.Value;
                stat.Percent = total > 0
                                        ? typeStats.Value / (double)total * 100
                                        : 0.0;
                stats.Add(stat);
            }
            return(stats);
        }
Beispiel #2
0
        /// <summary>
        /// Analyze simulation Grid for typing statistics
        /// </summary>
        /// <returns>The list of all TypeStats, sorted by incidence amount</returns>
        public List <TypeStats> AnalyzeGrid()
        {
            //Setup lookup dictionnary
            Dictionary <TypePair, TypeStats> data = new Dictionary <TypePair, TypeStats>();

            //Loop through all Micromons in the simulation
            foreach (Micromon m in this.attackList)
            {
                //Get or create TypeStats dictionary value
                TypeStats stats;
                if (!data.TryGetValue(m.Pair, out stats))
                {
                    stats = new TypeStats(m.Pair);
                    data.Add(m.Pair, stats);
                }

                //Increment incidence
                stats.Increment();
            }

            //Keep only TypeStats values, sort them, then return them
            List <TypeStats> results = new List <TypeStats>(data.Values);

            results.Sort();
            return(results);
        }
        private void addRow(TypeStats typeStat)
        {
            var texts = new string[] { typeStat.Type, new TimeSpanVM(typeStat.Minutes).ToString(), typeStat.Percent.ToString("n2") };
            var item  = new ListViewItem(texts);

            statisticsTypesLv.Items.Add(item);
        }
Beispiel #4
0
        public uint getTotalValueOfStatsForAllStuff(TypeStats typeStats)
        {
            uint total = 0;

            foreach (KeyValuePair<SlotStuff, Item> item in this._items) {
                total += item.Value.getTotalStats(typeStats);
            }

            return total;
        }
Beispiel #5
0
        public uint getTotalStats(TypeStats typeStats)
        {
            uint total = 0;

            foreach (Stats stats in this._stats) {
                if (stats.typeStats == typeStats) {
                    total += stats.value;
                }
            }

            return total;
        }
 void Start()
 {
     playerType = PlayerType.Titan;
     stats      = new TypeStats(playerType);
     StartCoroutine("ILoadMultipliers");
 }
Beispiel #7
0
        public List<SlotStuff> getSlotByStats(TypeStats stats)
        {
            List<SlotStuff> hitItems = new List<SlotStuff>();
            var slots = Enum.GetValues(typeof(SlotStuff));

            foreach(SlotStuff slot in slots) {
                if (0 != this._stuff.getTotalValueOfStatsForOnePiece(stats, slot)) {
                    hitItems.Add(slot);
                }
            }

            return hitItems;
        }
Beispiel #8
0
 public Stats(uint value, TypeStats typeStats)
 {
     this._value = value;
     this._typeStats = typeStats;
 }
Beispiel #9
0
 public uint getTotalValueOfStatsForOnePiece(TypeStats typeStats, SlotStuff slotStuff)
 {
     return (this.hasItem(slotStuff)) ?
         this._items[slotStuff].getTotalStats(typeStats) : 0;
 }