public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();
            m_CBB = reader.ReadItem<BallotBoxAccount>();
            if (m_CBB != null)
                CBBCurrent = m_CBB;
        }
Esempio n. 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            m_CBB = reader.ReadItem <BallotBoxAccount>();
            if (m_CBB != null)
            {
                CBBCurrent = m_CBB;
            }
        }
 public BallotBoxAccountDummy()
     : base(0x9A8)
 {
     Name = "DragonKnights Shard Ballot Box";
     if (CBBCurrent != null && !CBBCurrent.Deleted)
     {
         m_CBB = CBBCurrent;
         if (m_CBB.Open)
             Name = "DragonKnights Shard Ballot Box (open)";
         else
             Name = "DragonKnights Shard Ballot Box (closed)";
     }
 }
Esempio n. 4
0
 public BallotBoxAccountDummy()
     : base(0x9A8)
 {
     Name = "DragonKnights Shard Ballot Box";
     if (CBBCurrent != null && !CBBCurrent.Deleted)
     {
         m_CBB = CBBCurrent;
         if (m_CBB.Open)
         {
             Name = "DragonKnights Shard Ballot Box (open)";
         }
         else
         {
             Name = "DragonKnights Shard Ballot Box (closed)";
         }
     }
 }
Esempio n. 5
0
 public BallotDaysPrompt(BallotBoxAccount box)
 {
     m_Box = box;
 }
Esempio n. 6
0
 public TopicPrompt(BallotBoxAccount box, bool isChoice)
 {
     m_Box      = box;
     m_IsChoice = isChoice;
 }
Esempio n. 7
0
            public InternalGump(BallotBoxAccount box, bool isOwner)
                : base(110, 70)
            {
                m_Box = box;

                int lineCount    = box.Topic.Length;
                int choicesCount = box.Choices.Length;

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

                if (isOwner)
                {
                    AddHtmlLocalized(0, 15, 400, 35, 1011000, false, false); // <center>Ballot Box Owner's Menu</center>
                }
                else
                {
                    AddHtml(0, 15, 400, 35, "<center>DragonKnights Ballot Box - 1 vote per account</center>", false, false);
                }
                //AddHtmlLocalized(0, 15, 400, 35, 1011001, false, false); // <center>Ballot Box -- Vote Here!</center>

                if (m_Box.Open)
                {
                    TimeSpan remaining = m_Box.RemainingTime;
                    AddHtml(0, 35, 400, 35, "<center>This poll is open for another " + remaining.Days + " days, " + remaining.Hours + " hours and " + remaining.Minutes + " minutes.", false, false);
                }
                else
                {
                    AddHtml(0, 35, 400, 35, "<center>This poll is closed.", false, false);
                }

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

                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);
                    }
                }

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

                for (int i = 0; i < choicesCount; i++)
                {
                    string choice = box.Choices[i];
                    int    votes  = 0;
                    foreach (int vote in box.Votes.Values)
                    {
                        if (vote == i)
                        {
                            votes++;
                        }
                    }
                    if (!String.IsNullOrEmpty(choice))
                    {
                        if (!isOwner && m_Box.Open)
                        {
                            AddButton(20, 240 + i * 25, 0xFA5, 0xFA7, 6 + i, GumpButtonType.Reply, 0);
                        }
                        AddLabel(85, 242 + i * 25, 0x3E3, choice);
                        AddLabel(55, 242 + i * 25, 0x0, String.Format("[{0}]", votes));
                    }
                }

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

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

                    AddButton(240, 330 + 75, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(275, 333 + 75, 300, 100, 1011007, false, false); // reset votes

                    AddButton(240, 305 + 75, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
                    AddHtml(275, 308 + 75, 100, 35, "change choices", false, false);

                    AddButton(120, 330 + 75, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
                    AddHtml(155, 333 + 75, 100, 35, "change days", false, false);

                    AddButton(45, 330 + 75, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
                    if (m_Box.Open)
                    {
                        AddHtml(80, 333 + 75, 100, 35, "close", false, false);
                    }
                    else
                    {
                        AddHtml(80, 333 + 75, 100, 35, "open", false, false);
                    }
                }
            }
 public BallotDaysPrompt(BallotBoxAccount box)
 {
     m_Box = box;
 }
 public TopicPrompt(BallotBoxAccount box, bool isChoice)
 {
     m_Box = box;
     m_IsChoice = isChoice;
 }
            public InternalGump(BallotBoxAccount box, bool isOwner)
                : base(110, 70)
            {
                m_Box = box;

                int lineCount = box.Topic.Length;
                int choicesCount = box.Choices.Length;

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

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

                if (m_Box.Open)
                {
                    TimeSpan remaining = m_Box.RemainingTime;
                    AddHtml(0, 35, 400, 35, "<center>This poll is open for another " + remaining.Days + " days, " + remaining.Hours + " hours and " + remaining.Minutes + " minutes.", false, false);
                }
                else
                    AddHtml(0, 35, 400, 35, "<center>This poll is closed.", false, false);

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

                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);
                }

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

                for (int i = 0; i < choicesCount; i++)
                {
                    string choice = box.Choices[i];
                    int votes = 0;
                    foreach(int vote in box.Votes.Values)
                    {
                        if (vote == i)
                            votes ++;
                    }
                    if (!String.IsNullOrEmpty(choice))
                    {
                        if (!isOwner && m_Box.Open)
                            AddButton(20, 240 + i* 25, 0xFA5, 0xFA7, 6 + i, GumpButtonType.Reply, 0);
                        AddLabel(85, 242 + i * 25, 0x3E3, choice);
                        AddLabel(55, 242 + i * 25, 0x0, String.Format("[{0}]", votes));
                    }
                }

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

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

                    AddButton(240, 330 + 75, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(275, 333 + 75, 300, 100, 1011007, false, false); // reset votes

                    AddButton(240, 305 + 75, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
                    AddHtml(275, 308 + 75, 100, 35, "change choices", false, false);

                    AddButton(120, 330 + 75, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
                    AddHtml(155, 333 + 75, 100, 35, "change days", false, false);

                    AddButton(45, 330 + 75, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
                    if (m_Box.Open)
                        AddHtml(80, 333 + 75, 100, 35, "close", false, false);
                    else
                        AddHtml(80, 333 + 75, 100, 35, "open", false, false);
                }
            }