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); }
bool Contained(TimelineNode node, TimelineNode parent) { if (node.Start > parent.Start && node.Stop < parent.Stop) { return true; } else if (node.Start > parent.Start && node.Stop > parent.Stop) { return (node.Stop - parent.Stop) < node.Duration * MAX_DIFF; } else if (node.Start < parent.Start && node.Stop < parent.Stop) { return (parent.Start - node.Start) < node.Duration * MAX_DIFF; } else { return false; } }
private void EmitUnitSelected(GameUnit gameUnit, TimelineNode unit) { if (UnitSelected != null) UnitSelected(gameUnit, unit); }
private void EmitUnitChanged(GameUnit gameUnit, TimelineNode unit, Time time) { if (UnitChanged != null) UnitChanged(gameUnit, unit, time); }
private void StopGameUnit(GameUnit gameUnit) { TimelineNode timeInfo; Time start, stop; if (!gameUnitsStarted.ContainsKey(gameUnit)) { Log.Warning("Tryed to stop a game unit that was not started: " + gameUnit); return; } start = gameUnitsStarted[gameUnit]; stop = new Time{MSeconds=(int)player.CurrentTime}; timeInfo = new TimelineNode {Name=gameUnit.Name, Fps=fps, Start=start, Stop=stop}; gameUnit.Add(timeInfo); gameUnitsStarted.Remove(gameUnit); Log.Debug(String.Format("Added new unit:{0} to {1} ", timeInfo, gameUnit)); }
void HandleUnitSelected(GameUnit gameUnit, TimelineNode unit) { unit.Selected = true; player.SetStartStop(unit.Start.MSeconds, unit.Stop.MSeconds); }
void HandleUnitChanged(GameUnit gameUnit, TimelineNode unit, Time time) { player.CloseActualSegment(); player.Pause(); player.SeekTo(time.MSeconds, true); }
void HandleUnitAdded(GameUnit gameUnit, int frame) { var unit = new TimelineNode {Name=gameUnit.Name, Fps=openedProject.Description.File.Fps}; unit.StartFrame = (uint)(frame-50); unit.StopFrame = (uint)(frame+50); gameUnit.Add(unit); }