예제 #1
0
        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}");
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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;
                    }
                }
            }
        }
예제 #4
0
        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;
                    }
                }
            }
        }
예제 #5
0
        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();
        }
예제 #6
0
 public PlayerLayoutView(PlayerTimersGroup playerTimersGroup)
     : this()
 {
     this.parentGroup = playerTimersGroup;
     this.label1.Text = parentGroup.CharacterName + " (conjuring, please wait)";
 }