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}"); }
internal void RestoreGroup(Guid groupId) { var group = new PlayerTimersGroup(groupId.ToString(), this, wurmApi, logger, soundManager, trayPopups, timerDefinitions, timerInstances); playerTimersGroupsResolver.LoadAndStartTracking(group); try { group.Initialize(); } finally { if (!timerGroups.Contains(group)) { timerGroups.Add(group); } currentGroupsIds.Add(groupId); FlagAsChanged(); } }
public void ReduceSortingOrder(PlayerTimersGroup selectedGroup) { var list = timerGroups.OrderBy(@group => @group.SortingOrder).ToList(); var index = list.IndexOf(selectedGroup); if (index >= 0) { var nextIndex = index + 1; if (nextIndex <= list.Count - 1) { var nextItem = list[nextIndex]; list[nextIndex] = list[index]; list[index] = nextItem; for (int i = 0; i < list.Count; i++) { list[i].SortingOrder = i; } } } }
public void IncreaseSortingOrder(PlayerTimersGroup selectedGroup) { var list = timerGroups.OrderBy(@group => @group.SortingOrder).ToList(); var index = list.IndexOf(selectedGroup); if (index >= 0) { var prevIndex = index - 1; if (prevIndex >= 0) { var prevItem = list[prevIndex]; list[prevIndex] = list[index]; list[index] = prevItem; for (int i = 0; i < list.Count; i++) { list[i].SortingOrder = i; } } } }
internal void CreateGroup(Guid groupId, string characterName, string serverGroupId) { var group = new PlayerTimersGroup(groupId.ToString(), this, wurmApi, logger, soundManager, trayPopups, timerDefinitions, timerInstances); playerTimersGroupsResolver.LoadAndStartTracking(group); group.CharacterName = characterName; group.ServerGroupId = serverGroupId; group.Initialize(); timerGroups.Add(group); currentGroupsIds.Add(groupId); FlagAsChanged(); }
public PlayerLayoutView(PlayerTimersGroup playerTimersGroup) : this() { this.parentGroup = playerTimersGroup; this.label1.Text = parentGroup.CharacterName + " (conjuring, please wait)"; }