예제 #1
0
 public TopicPrompt(BallotBox box)
 {
     m_Box = box;
 }
예제 #2
0
            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
                }
            }