Esempio n. 1
0
 public int CompareTo(TimedNotifier _this, TimedNotifier other)
 {
     if (_this.TargetTime < other.TargetTime)
     {
         return(-1);
     }
     if (_this.TargetTime == other.TargetTime)
     {
         return(0);
     }
     return(1);
 }
Esempio n. 2
0
 public static void NotifyDelete()
 {
     CurAvailableDealers.Delete(NextDelNotifier.Handle);
     if (CurAvailableDealers.Count > 0)
     {
         NextDelNotifier = CurAvailableDealers.FindMin();
         DeleteTrigger   = ActivityServerControl.Timer.CreateTrigger(NextDelNotifier.TargetTime, NotifyDelete);
     }
     else
     {
         DeleteTrigger = null;
     }
 }
Esempio n. 3
0
        public void AddToCurAvailableDealers(TimedNotifier notifier)
        {
            var records = notifier.Notifier.Config.Records;

            foreach (var record in records)
            {
                var tbSceneNpc = Table.GetSceneNpc(record.SceneNpc);
                var sceneId    = tbSceneNpc.SceneID;
                foreach (var s in SpeMonsterManager.ServerSceneMonsters)
                {
                    var serverId = s.Key;
                    if (IsServerSceneValid(serverId, sceneId))
                    {
                        var        sceneMonsters = s.Value;
                        List <int> monsters;
                        if (!sceneMonsters.TryGetValue(sceneId, out monsters))
                        {
                            monsters = new List <int>();
                            sceneMonsters.Add(sceneId, monsters);
                        }
                        monsters.Add(record.Id);
                    }
                }
            }

            var timed = new TimedNotifier();

            timed.TargetTime = notifier.TargetTime.AddSeconds(SpeMonsterUtil.AvailableSeconds);
            timed.Notifier   = notifier.Notifier;
            SpeMonsterManager.CurAvailableDealers.Add(ref timed.Handle, timed);
            if (SpeMonsterManager.DeleteTrigger == null)
            {
                SpeMonsterManager.NextDelNotifier = timed;
                SpeMonsterManager.DeleteTrigger   = ActivityServerControl.Timer.CreateTrigger(timed.TargetTime,
                                                                                              NotifyDelete);
            }
        }
Esempio n. 4
0
 public static void AddToCurAvailableDealers(TimedNotifier notifier)
 {
     mImpl.AddToCurAvailableDealers(notifier);
 }