Esempio n. 1
0
 public ObsoleteDataProvider(IPersistentObjectResolver persistentObjectResolver)
 {
     Tfo  = persistentObjectResolver.GetDefault <TriggersFeatureObj>();
     Tmos = Tfo.activeCharacterNames.ToDictionary(s => s, s => persistentObjectResolver.Get <TriggerManagerObj>(s));
     Atos = Tfo.activeCharacterNames.ToDictionary(s => s, s => persistentObjectResolver.Get <ActiveTriggersObj>(s));
     Cmo  = persistentObjectResolver.GetDefault <ConditionsManagerObj>();
 }
Esempio n. 2
0
 public TimerInstances([NotNull] IPersistentObjectResolver persistentObjectResolver,
                       [NotNull] TimerTypes timerTypes, [NotNull] TimerDefinitions timerDefinitions)
 {
     if (persistentObjectResolver == null)
     {
         throw new ArgumentNullException("persistentObjectResolver");
     }
     if (timerTypes == null)
     {
         throw new ArgumentNullException("timerTypes");
     }
     if (timerDefinitions == null)
     {
         throw new ArgumentNullException("timerDefinitions");
     }
     this.persistentObjectResolver = persistentObjectResolver;
     this.timerTypes       = timerTypes;
     this.timerDefinitions = timerDefinitions;
 }
Esempio n. 3
0
        public TimersFeature(
            [NotNull] ITimerFactory timerFactory,
            [NotNull] ILogger logger,
            [NotNull] IWurmApi wurmApi,
            [NotNull] ISoundManager soundManager,
            [NotNull] ITrayPopups trayPopups,
            [NotNull] TimerDefinitions timerDefinitions,
            [NotNull] IPersistentObjectResolver <PlayerTimersGroup> playerTimersGroupsResolver,
            [NotNull] TimerInstances timerInstances)
        {
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (soundManager == null)
            {
                throw new ArgumentNullException(nameof(soundManager));
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException(nameof(trayPopups));
            }
            if (timerDefinitions == null)
            {
                throw new ArgumentNullException(nameof(timerDefinitions));
            }
            if (playerTimersGroupsResolver == null)
            {
                throw new ArgumentNullException(nameof(playerTimersGroupsResolver));
            }
            if (timerInstances == null)
            {
                throw new ArgumentNullException(nameof(timerInstances));
            }
            this.logger                     = logger;
            this.wurmApi                    = wurmApi;
            this.soundManager               = soundManager;
            this.trayPopups                 = trayPopups;
            this.timerDefinitions           = timerDefinitions;
            this.playerTimersGroupsResolver = playerTimersGroupsResolver;
            this.timerInstances             = timerInstances;

            updateTimer = timerFactory.CreateUiThreadTimer();

            updateTimer.Interval = TimeSpan.FromMilliseconds(500);
            updateTimer.Tick    += (sender, args) =>
            {
                foreach (var timergroup in timerGroups)
                {
                    timergroup.Update();
                }
                ;
            };
        }