コード例 #1
0
ファイル: BallotBox.cs プロジェクト: greeduomacro/last-wish
			public InternalGump( BallotBox box, bool isOwner ) : base( 110, 70 )
			{
				m_Box = box;

				AddBackground( 0, 0, 400, 350, 0xA28 );

				if ( isOwner )
					AddHtmlLocalized( 0, 15, 400, 35, 1011000, false, false ); // <center>Ballot Box Owner's Menu</center>
				else
					AddHtmlLocalized( 0, 15, 400, 35, 1011001, false, false ); // <center>Ballot Box -- Vote Here!</center>

				AddHtmlLocalized( 0, 50, 400, 35, 1011002, false, false ); // <center>Topic</center>

				int lineCount = box.Topic.Length;
				AddBackground( 25, 90, 350, Math.Max( 20 * lineCount, 20 ), 0x1400 );

				for ( int i = 0; i < lineCount; i++ )
				{
					string line = box.Topic[i];

					if ( !String.IsNullOrEmpty( line ) )
						AddLabelCropped( 30, 90 + i * 20, 340, 20, 0x3E3, line );
				}

				int yesCount = box.Yes.Count;
				int noCount = box.No.Count;
				int totalVotes = yesCount + noCount;

				AddHtmlLocalized( 0, 215, 400, 35, 1011003, false, false ); // <center>votes</center>

				if ( !isOwner )
					AddButton( 20, 240, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 55, 242, 25, 35, 1011004, false, false ); // aye:
				AddLabel( 78, 242, 0x0, String.Format( "[{0}]", yesCount ) );

				if ( !isOwner )
					AddButton( 20, 275, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 55, 277, 25, 35, 1011005, false, false ); // nay:
				AddLabel( 78, 277, 0x0, String.Format( "[{0}]", noCount ) );

				if ( totalVotes > 0 )
				{
					AddImageTiled( 130, 242, ( yesCount * 225 ) / totalVotes, 10, 0xD6 );
					AddImageTiled( 130, 277, ( noCount * 225 ) / totalVotes, 10, 0xD6 );
				}

				AddButton( 45, 305, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 80, 308, 40, 35, 1011008, false, false ); // done

				if ( isOwner )
				{
					AddButton( 120, 305, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
					AddHtmlLocalized( 155, 308, 100, 35, 1011006, false, false ); // change topic

					AddButton( 240, 305, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0 );
					AddHtmlLocalized( 275, 308, 300, 100, 1011007, false, false ); // reset votes
				}
			}
コード例 #2
0
ファイル: BallotBox.cs プロジェクト: greeduomacro/last-wish
			public TopicPrompt( BallotBox box )
			{
				m_Box = box;
			}
コード例 #3
0
ファイル: BallotBox.cs プロジェクト: coderxan/MetaPets
            public InternalGump(BallotBox box, bool isOwner)
                : base(110, 70)
            {
                m_Box = box;

                AddBackground(0, 0, 400, 350, 0xA28);

                if (isOwner)
                {
                    AddHtmlLocalized(0, 15, 400, 35, 1011000, false, false); // <center>Ballot Box Owner's Menu</center>
                }
                else
                {
                    AddHtmlLocalized(0, 15, 400, 35, 1011001, false, false); // <center>Ballot Box -- Vote Here!</center>
                }
                AddHtmlLocalized(0, 50, 400, 35, 1011002, false, false);     // <center>Topic</center>

                int lineCount = box.Topic.Length;

                AddBackground(25, 90, 350, Math.Max(20 * lineCount, 20), 0x1400);

                for (int i = 0; i < lineCount; i++)
                {
                    string line = box.Topic[i];

                    if (!String.IsNullOrEmpty(line))
                    {
                        AddLabelCropped(30, 90 + i * 20, 340, 20, 0x3E3, line);
                    }
                }

                int yesCount   = box.Yes.Count;
                int noCount    = box.No.Count;
                int totalVotes = yesCount + noCount;

                AddHtmlLocalized(0, 215, 400, 35, 1011003, false, false); // <center>votes</center>

                if (!isOwner)
                {
                    AddButton(20, 240, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(55, 242, 25, 35, 1011004, false, false); // aye:
                AddLabel(78, 242, 0x0, String.Format("[{0}]", yesCount));

                if (!isOwner)
                {
                    AddButton(20, 275, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(55, 277, 25, 35, 1011005, false, false); // nay:
                AddLabel(78, 277, 0x0, String.Format("[{0}]", noCount));

                if (totalVotes > 0)
                {
                    AddImageTiled(130, 242, (yesCount * 225) / totalVotes, 10, 0xD6);
                    AddImageTiled(130, 277, (noCount * 225) / totalVotes, 10, 0xD6);
                }

                AddButton(45, 305, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
                AddHtmlLocalized(80, 308, 40, 35, 1011008, false, false); // done

                if (isOwner)
                {
                    AddButton(120, 305, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(155, 308, 100, 35, 1011006, false, false); // change topic

                    AddButton(240, 305, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(275, 308, 300, 100, 1011007, false, false); // reset votes
                }
            }
コード例 #4
0
ファイル: BallotBox.cs プロジェクト: coderxan/MetaPets
 public TopicPrompt(BallotBox box)
 {
     m_Box = box;
 }
コード例 #5
0
 public TopicPrompt(BallotBox box, int cliloc)
     : base(box)
 {
     m_Box    = box;
     m_Cliloc = cliloc;
 }
コード例 #6
0
ファイル: BallotBox.cs プロジェクト: theinfamousrj/ModernUO
            public InternalGump(BallotBox box, bool isOwner) : base(110, 70)
            {
                m_Box = box;

                AddBackground(0, 0, 400, 350, 0xA28);

                if (isOwner)
                {
                    AddHtmlLocalized(0, 15, 400, 35, 1011000); // <center>Ballot Box Owner's Menu</center>
                }
                else
                {
                    AddHtmlLocalized(0, 15, 400, 35, 1011001); // <center>Ballot Box -- Vote Here!</center>
                }

                AddHtmlLocalized(0, 50, 400, 35, 1011002); // <center>Topic</center>

                var lineCount = box.Topic.Length;

                AddBackground(25, 90, 350, Math.Max(20 * lineCount, 20), 0x1400);

                for (var i = 0; i < lineCount; i++)
                {
                    var line = box.Topic[i];

                    if (!string.IsNullOrEmpty(line))
                    {
                        AddLabelCropped(30, 90 + i * 20, 340, 20, 0x3E3, line);
                    }
                }

                var yesCount   = box.Yes.Count;
                var noCount    = box.No.Count;
                var totalVotes = yesCount + noCount;

                AddHtmlLocalized(0, 215, 400, 35, 1011003); // <center>votes</center>

                if (!isOwner)
                {
                    AddButton(20, 240, 0xFA5, 0xFA7, 3);
                }

                AddHtmlLocalized(55, 242, 25, 35, 1011004); // aye:
                AddLabel(78, 242, 0x0, $"[{yesCount}]");

                if (!isOwner)
                {
                    AddButton(20, 275, 0xFA5, 0xFA7, 4);
                }

                AddHtmlLocalized(55, 277, 25, 35, 1011005); // nay:
                AddLabel(78, 277, 0x0, $"[{noCount}]");

                if (totalVotes > 0)
                {
                    AddImageTiled(130, 242, yesCount * 225 / totalVotes, 10, 0xD6);
                    AddImageTiled(130, 277, noCount * 225 / totalVotes, 10, 0xD6);
                }

                AddButton(45, 305, 0xFA5, 0xFA7, 0);
                AddHtmlLocalized(80, 308, 40, 35, 1011008); // done

                if (isOwner)
                {
                    AddButton(120, 305, 0xFA5, 0xFA7, 1);
                    AddHtmlLocalized(155, 308, 100, 35, 1011006); // change topic

                    AddButton(240, 305, 0xFA5, 0xFA7, 2);
                    AddHtmlLocalized(275, 308, 300, 100, 1011007); // reset votes
                }
            }
コード例 #7
0
 public TopicPrompt(BallotBox box, int cliloc)
 {
     this.m_Box = box;
     m_Cliloc = cliloc;
 }
コード例 #8
0
 public TopicPrompt(BallotBox box, int cliloc)
 {
     this.m_Box = box;
     m_Cliloc   = cliloc;
 }
コード例 #9
0
ファイル: CityStone.cs プロジェクト: Ravenwolfe/ServUO
        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (!CityLoyaltySystem.Enabled || City == null)
                return;

            if (!City.IsCitizen(from))
            {
                if (City.Herald != null)
                    City.Herald.SayTo(from, 1154061, City.Definition.Name); // Only citizens of ~1_CITY~ may use the City Stone!
                else
                    from.SendLocalizedMessage(1154061, City.Definition.Name); // Only citizens of ~1_CITY~ may use the City Stone!

                return;
            }

            list.Add(new SimpleContextMenuEntry(from, 1154018, m => // Grant Citizen Title
                {
                    if(City.IsGovernor(m))
                    {
                        m.SendLocalizedMessage(1154027); // Which Citizen do you wish to bestow a title?
                        m.BeginTarget(10, false, TargetFlags.None, (mob, targeted) =>
                            {
                                PlayerMobile pm = targeted as PlayerMobile;

                                if (pm != null)
                                {
                                    if (City.IsCitizen(pm))
                                    {
                                        mob.SendGump(new PlayerTitleGump(mob as PlayerMobile, pm, City));
                                    }
                                    else
                                        mob.SendLocalizedMessage(1154029); // You may only bestow a title on citizens of this city!
                                }
                                else
                                    mob.SendLocalizedMessage(1154028); // You can only bestow a title on a player!
                            });
                    }
                }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154031, m => // Open Trade Deal
            {
                if (City.IsGovernor(m))
                {
                    m.SendGump(new ChooseTradeDealGump(m as PlayerMobile, City));
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154277, m => // Open Inventory WTF is this?
            {
                if (City.IsGovernor(m))
                {
                    m.SendGump(new OpenInventoryGump(City));
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154278, m => // Place Ballot Box
            {
                if (City.IsGovernor(m))
                {
                    if (Boxes != null && Boxes.Count >= CityLoyaltySystem.MaxBallotBoxes)
                    {
                        m.SendMessage("You have reached the maximum amount of ballot boxes in your city.");
                        return;
                    }

                    m.SendMessage("Where would you like to place a ballot box?");
                    m.BeginTarget(3, true, TargetFlags.None, (mob, targeted) =>
                        {
                            if (targeted is IPoint3D)
                            {
                                IPoint3D p = targeted as IPoint3D;
                                Server.Spells.SpellHelper.GetSurfaceTop(ref p);
                                BallotBox box = new BallotBox();

                                if (CheckLocation(m, box, p))
                                {
                                    box.Owner = m;
                                    box.Movable = false;

                                    if (Boxes == null)
                                        Boxes = new List<BallotBox>();

                                    Boxes.Add(box);
                                    box.MoveToWorld(new Point3D(p), this.Map);

                                    m.SendMessage("{0} of {1} ballot boxes placed.", Boxes.Count.ToString(), CityLoyaltySystem.MaxBallotBoxes.ToString());
                                }
                                else
                                    box.Delete();
                            }
                        });
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154060, m => // Utilize Trade Deal
            {
                City.TryUtilizeTradeDeal(from);
            }, enabled: City.ActiveTradeDeal != TradeDeal.None));

            CityLoyaltyEntry entry = City.GetPlayerEntry<CityLoyaltyEntry>(from);

            list.Add(new SimpleContextMenuEntry(from, 1154019, m => // Remove City Title
            {
                if (entry != null && entry.CustomTitle != null)
                {
                    entry.CustomTitle = null;
                    m.SendMessage("City Title removed.");
                }
            }, enabled: entry != null && entry.CustomTitle != null));

            list.Add(new SimpleContextMenuEntry(from, 1154068, m => // Accept Office
            {
                if (m == City.GovernorElect && City.Governor == null)
                {
                    m.SendGump(new AcceptOfficeGump(m as PlayerMobile, City));
                }
            }, enabled: City.GovernorElect == from && City.Governor == null && City.GetLoyaltyRating(from) >= LoyaltyRating.Unknown));
        }
コード例 #10
0
ファイル: CityStone.cs プロジェクト: Ravenwolfe/ServUO
        public bool CheckLocation(Mobile m, BallotBox box, IPoint3D p)
        {
            Region r = Region.Find(new Point3D(p), this.Map);

            if (!r.IsPartOf(City.Definition.Region))
            {
                m.SendMessage("You can only place a ballot box within the {0} city limits!", City.Definition.Name);
                return false;
            }

            if (!box.DropToWorld(new Point3D(p), this.Map))
            {
                m.SendMessage("You cannot place a ballot box there!");
                return false;
            }

            return true;
        }
コード例 #11
0
ファイル: BallotBox.cs プロジェクト: Ravenwolfe/xrunuo
 public TopicPrompt( BallotBox box, int cliloc )
     : base(box)
 {
     m_Box = box;
     m_Cliloc = cliloc;
 }