public virtual void Initialize(PlayerTimersGroup parentGroup, string player, TimerDefinition definition) { //derived must call this base before their own inits! TimerDefinition = definition; Name = definition.ToString(); ShortName = definition.ToString(); playerTimersGroup = parentGroup; Player = player; View = new TimerDisplayView(this); CDNotify = new CooldownHandler(Logger, SoundManager, TrayPopups) { DurationMillis = PopupDurationMillis, Title = Player, Message = Name + " cooldown finished", SoundEnabled = SoundNotify, PopupEnabled = PopupNotify, PersistentPopup = PersistentPopup, SoundId = SoundId }; if (PopupOnWaLaunch) { CDNotify.ResetShownAndPlayed(); } WurmCharacter = WurmApi.Characters.Get(new CharacterName(player)); WurmCharacter.LogInOrCurrentServerPotentiallyChanged += _handleServerChange; telemetry.TrackEvent($"Timers: initialized timer {Name}"); }
public void AddTimerDefinitionIfNotExists([NotNull] TimerDefinition timerDefinition) { if (!timerDefinitions.ContainsKey(timerDefinition.Id)) { AddTimerDefinition(timerDefinition); } FlagAsChanged(); }
public void AddTimerDefinition([NotNull] TimerDefinition timerDefinition) { if (timerDefinition == null) { throw new ArgumentNullException("timerDefinition"); } if (timerDefinitions.ContainsKey(timerDefinition.Id)) { throw new ApplicationException(string.Format((string)"Timer with id {0} already registered.", timerDefinition.Id)); } timerDefinitions[timerDefinition.Id] = timerDefinition; FlagAsChanged(); }
public WurmTimer AddNewTimer(TimerDefinition definition) { WurmTimer newTimer = timerInstances.CreateTimer(definition.Id); newTimer.Initialize(this, CharacterName, definition); activeTimerDefinitions.Add(new ActiveTimer() { DefinitionId = definition.Id, TimerId = newTimer.Id }); layoutControl.RegisterNewTimerDisplay(newTimer.View); timers.Add(newTimer); FlagAsChanged(); return(newTimer); }
void OverwriteDefaultDefinition(TimerDefinition timerDefinition) { timerDefinitions[timerDefinition.Id] = timerDefinition; }