コード例 #1
0
        public static void RefreshGumps(PlayerMobile pm)
        {
            if (!CMOptions.ModuleEnabled || pm == null)
            {
                return;
            }

            if (CMOptions.UseCategories)
            {
                foreach (var g in SuperGump.GetInstances <ConquestStatesGump>(pm, true).Where(g => !g.IsDisposed && g.IsOpen))
                {
                    g.Refresh(true);
                }
            }
            else
            {
                foreach (var g in SuperGump.GetInstances <ConquestStateListGump>(pm, true).Where(g => !g.IsDisposed && g.IsOpen))
                {
                    g.Refresh(true);
                }
            }

            foreach (var g in SuperGump.GetInstances <ConquestStateGump>(pm, true).Where(g => !g.IsDisposed && g.IsOpen))
            {
                g.Refresh(true);
            }
        }
コード例 #2
0
 public static void CloseCentralGump(this PlayerMobile user)
 {
     foreach (CentralGumpUI g in SuperGump.GetInstances <CentralGumpUI>(user))
     {
         g.Close(true);
     }
 }
コード例 #3
0
        public static void RefreshUI(PlayerMobile cam)
        {
            if (cam == null)
            {
                return;
            }

            if (!IsCamera(cam))
            {
                CloseUI(cam);
                return;
            }

            bool refreshed = false;

            foreach (ActionCamUI g in SuperGump.GetInstances <ActionCamUI>(cam, true).Where(g => !g.IsDisposed))
            {
                g.Refresh(true);
                refreshed = true;
            }

            if (!refreshed)
            {
                new ActionCamUI(cam).Send();
            }
        }
コード例 #4
0
 public static void CloseUI(PlayerMobile cam)
 {
     foreach (ActionCamUI g in SuperGump.GetInstances <ActionCamUI>(cam, true))
     {
         g.Close(true);
     }
 }
コード例 #5
0
        public virtual void SendInvites()
        {
            foreach (PlayerMobile pm in Queue.Keys)
            {
                var invites = SuperGump.GetInstances <PvPInviteGump>(pm);

                if (CanSendInvite(pm))
                {
                    bool sendNew = invites.All(invite => !invite.IsOpen || invite.Battle != this);

                    if (sendNew)
                    {
                        OnSendInvite(pm, new PvPInviteGump(pm, this));
                    }
                }
                else
                {
                    invites.Where(invite => invite.IsOpen && invite.Battle == this).ForEach(i => i.Close());
                }
            }
        }
コード例 #6
0
        public void EntryPoint()
        {
            CommandSystem.Register(
                "DigitalTest1",
                AccessLevel.GameMaster,
                e => Sandbox.SafeInvoke(
                    () =>
            {
                var split = e.ArgString.Trim().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);

                var numbers = new int[split.Length];

                if (numbers.Length == 0)
                {
                    numbers = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
                }
                else
                {
                    for (int i = 0; i < split.Length; i++)
                    {
                        numbers[i] = Math.Max(0, Math.Min(9, Int32.Parse(split[i])));
                    }
                }

                SuperGump.Send(new DigitalNumericDisplayGump(e.Mobile as PlayerMobile, numbers: numbers));
            },
                    this));

            CommandSystem.Register(
                "DigitalTest2",
                AccessLevel.GameMaster,
                e => Sandbox.SafeInvoke(
                    () =>
            {
                var pm = e.Mobile as PlayerMobile;

                if (pm == null)
                {
                    return;
                }

                if (Tests.ContainsKey(pm))
                {
                    if (Tests[pm] != null)
                    {
                        Tests[pm].Stop();
                    }
                }
                else
                {
                    Tests.Add(pm, null);
                }

                int i          = 0;
                const int iMax = 100;

                Tests[pm] = PollTimer.CreateInstance(
                    TimeSpan.FromMilliseconds(100.0),
                    () =>
                {
                    string numStr = i.ToString(CultureInfo.InvariantCulture);
                    var numbers   = new int[numStr.Length];

                    for (int j = 0; j < numbers.Length; j++)
                    {
                        numbers[j] = Math.Max(0, Math.Min(9, Int32.Parse(numStr[j].ToString(CultureInfo.InvariantCulture))));
                    }

                    var instances = SuperGump.GetInstances <DigitalNumericDisplayGump>(pm);

                    if (instances.Length != 0)
                    {
                        DigitalNumericDisplayGump g = instances[0];

                        g.NumericWidth  += 1;
                        g.NumericHeight += 2;

                        g.Numerics = numbers;
                        g.Refresh();
                    }
                    else
                    {
                        var g = new DigitalNumericDisplayGump(e.Mobile as PlayerMobile, numbers: numbers);
                        g.Send();
                    }

                    i++;

                    if (i < iMax || !Tests.ContainsKey(pm))
                    {
                        return;
                    }

                    Tests[pm].Stop();
                    Tests.Remove(pm);
                },
                    () => i <= iMax);
            },
                    this));

            CommandSystem.Register(
                "DigitalTest3",
                AccessLevel.GameMaster,
                e => Sandbox.SafeInvoke(
                    () =>
            {
                var pm = e.Mobile as PlayerMobile;

                if (pm == null)
                {
                    return;
                }

                if (Tests.ContainsKey(pm))
                {
                    if (Tests[pm] != null)
                    {
                        Tests[pm].Stop();
                    }
                }
                else
                {
                    Tests.Add(pm, null);
                }

                int i          = 60;
                const int iMin = 0;

                Tests[pm] = PollTimer.CreateInstance(
                    TimeSpan.FromSeconds(1.0),
                    () =>
                {
                    string numStr = i.ToString(CultureInfo.InvariantCulture);
                    var numbers   = new int[numStr.Length];

                    for (int j = 0; j < numbers.Length; j++)
                    {
                        numbers[j] = Math.Max(0, Math.Min(9, Int32.Parse(numStr[j].ToString(CultureInfo.InvariantCulture))));
                    }

                    var instances = SuperGump.GetInstances <DigitalNumericDisplayGump>(pm);

                    if (instances.Length != 0)
                    {
                        DigitalNumericDisplayGump g = instances[0];

                        g.NumericWidth  -= 1;
                        g.NumericHeight -= 2;

                        g.Numerics = numbers;
                        g.Refresh();
                    }
                    else
                    {
                        var g = new DigitalNumericDisplayGump(
                            e.Mobile as PlayerMobile, numericWidth: 60, numericHeight: 120, numbers: numbers);
                        g.Send();
                    }

                    i--;

                    if (i > 0 || !Tests.ContainsKey(pm))
                    {
                        return;
                    }

                    Tests[pm].Stop();
                    Tests.Remove(pm);
                },
                    () => i >= iMin);
            },
                    this));
        }