public void Refresh() { foreach (var item in Game.EventLog.GetNewEvents(Auth)) { EventsDict.Add(new EventVM(item, _gameVM.CurrentFaction, _gameVM)); } }
public void removeTimeEventsWithSelectedKeys() { foreach (float key in KeysToRemove) { if (EventsDict.ContainsKey(key)) { EventsDict.Remove(key); } } KeysToRemove.Clear(); }
public LogViewerVM(GameVM gameVM) { _gameVM = gameVM; if (Game != null && Auth != null) { foreach (var item in Game.EventLog.GetAllEvents(Auth)) { EventsDict.Add(new EventVM(item, _gameVM.CurrentFaction, _gameVM)); } } foreach (var kvp in gameVM.CurrentPlayer.HaltsOnEvent) { EventTypes.Add(new EventTypeBoolPair(gameVM.CurrentPlayer, kvp.Key)); } _gameVM.Game.GameLoop.GameGlobalDateChangedEvent += GameLoop_GameGlobalDateChangedEvent; }
public override string ToString() { var output = new StringBuilder(); output.Append(Math.Abs(Day)); if (Day < 0) { output.Append(" BC"); } ; if (EventsDict.ContainsKey(Day)) { output.AppendLine().Append(EventsDict[Day]); // StepTimeout = 2000 / Terrarium.Organisms.Count; wordt setstep() } else { // StepTimeout = 1000 / Terrarium.Organisms.Count; wordt setstep() }; return(output.ToString()); }
public void CheckTheCollectionForEventsToRise() { foreach (float timeKey in EventsDict.Keys) { TimeEvent currentEvent; EventsDict.TryGetValue(timeKey, out currentEvent); if (currentEvent.onUpdate != null) { currentEvent.onUpdate(currentEvent); } if (currentEvent.timeToRise > realTime) { continue; } else { // delete the timeEvent from the connection KeysToRemove.Add(timeKey); if (currentEvent.onFinish != null) { ActionsToPerform.Add(currentEvent); } } } if (ActionsToPerform.Count > 0) { foreach (TimeEvent action in ActionsToPerform) { action.onFinish(action); } ActionsToPerform.Clear(); } removeTimeEventsWithSelectedKeys(); }