示例#1
0
        public static void Broadcast(string message, bool autoClose, bool animate)
        {
            VitaNexCore.TryCatch(
                () =>
            {
                var type = WorldGumpSubTypes[WorldGumpSubIndex++];

                if (type == null)
                {
                    return;
                }

                message = String.Format("[{0}]:\n{1}", DateTime.Now.ToSimpleString("t@h:m@"), message);

                NetState.Instances.AsParallel()
                .Where(ns => ns != null && ns.Mobile != null && !ns.Mobile.Deleted && ns.Mobile is PlayerMobile && !CentralGump.EnsureProfile(ns.Mobile as PlayerMobile).IgnoreNotifies)
                .Select(ns => type.CreateInstanceSafe <WorldNotifyGump>((PlayerMobile)ns.Mobile, message, autoClose))
                .Where(g => g != null)
                .ForEach(
                    g =>
                {
                    if (!animate)
                    {
                        g.AnimDuration = TimeSpan.Zero;
                    }

                    g.Send();
                });
            });

            if (WorldGumpSubIndex >= WorldGumpSubTypes.Length)
            {
                WorldGumpSubIndex = 0;
            }
        }
示例#2
0
        protected override void OnBattlePreparing(DateTime when)
        {
            base.OnBattlePreparing(when);

            foreach (GlobalJoinGump g in
                     NetState.Instances.Select(s => s.Mobile)
                     .OfType <PlayerMobile>()
                     .Not(m => IsQueued(m) || IsParticipant(m) || ActionCams.IsCamera(m) || CentralGump.EnsureProfile(m).IgnoreBattles)
                     .Select(CreateJoinGump)
                     .Where(g => g != null))
            {
                g.Send();
            }
        }