Exemplo n.º 1
0
 public void Refresh()
 {
     foreach (var item in Game.EventLog.GetNewEvents(Auth))
     {
         EventsDict.Add(new EventVM(item, _gameVM.CurrentFaction, _gameVM));
     }
 }
Exemplo n.º 2
0
 public void removeTimeEventsWithSelectedKeys()
 {
     foreach (float key in KeysToRemove)
     {
         if (EventsDict.ContainsKey(key))
         {
             EventsDict.Remove(key);
         }
     }
     KeysToRemove.Clear();
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
    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();
    }