public GameUnitsStats(GameUnitsList guList, int duration)
 {
     game = new TimelineNode{Start=new Time(0), Stop=new Time(duration)};
     gameNode = new GameUnitStatsNode(game);
     gameUnitNodes = new Dictionary<GameUnit, GameUnitStatsNode>();
     GroupGameStats(guList);
 }
Beispiel #2
0
 int FillStats(string name, GameUnitStatsNode guStats, int row)
 {
     ws.Cells[row, 1].Value = name;
     ws.Cells[row, 2].Value = guStats.Count;
     ws.Cells[row, 3].Value = guStats.PlayingTime / (float)1000;
     ws.Cells[row, 4].Value = guStats.PlayingTimeStdDeviation / 1000;
     ws.Cells[row, 5].Value = guStats.AveragePlayingTime / 1000;
     row++;
     return(row);
 }
 int FillStats(string name, GameUnitStatsNode guStats, int row)
 {
     ws.Cells[row, 1].Value = name;
     ws.Cells[row, 2].Value = guStats.Count;
     ws.Cells[row, 3].Value = guStats.AverageDuration / (float)1000;
     ws.Cells[row, 4].Value = guStats.DurationTimeStdDeviation / 1000;
     ws.Cells[row, 5].Value = guStats.AveragePlayingTime / (float)1000;
     ws.Cells[row, 6].Value = guStats.PlayingTimeStdDeviation / 1000;
     ws.Cells[row, 7].Value = guStats.AveragePausedTime / (float)1000;
     ws.Cells[row, 8].Value = guStats.PausedTimeStdDeviation / 1000;
     row ++;
     return row;
 }
        void GroupGameStats(GameUnitsList guList)
        {
            List<GameUnitStatsNode> parents = new List<GameUnitStatsNode>();
            parents.Add(gameNode);

            foreach (GameUnit gu in guList) {
                List<GameUnitStatsNode> nextParents = new List<GameUnitStatsNode>();
                foreach (TimelineNode tn in gu) {
                    GameUnitStatsNode node = new GameUnitStatsNode(tn);
                    nextParents.Add(node);
                    FindParent(node, parents);
                }
                gameUnitNodes.Add(gu, new GameUnitStatsNode(game, nextParents));
                parents = nextParents;
            }
        }
        void FindParent(GameUnitStatsNode node, List<GameUnitStatsNode> parents)
        {
            List <GameUnitStatsNode> candidates = parents.Where(p => Contained(node.Node, p.Node)).ToList();
            if (candidates.Count != 1) {
                Log.Warning(String.Format("Found {0} candidates for node {1}", candidates.Count, node));
            }

            foreach (GameUnitStatsNode parent in candidates)
                parent.Add(node);
        }