コード例 #1
0
		public YahtzeeGump( Mobile from, int roll, int[] dice, bool[] holds, int[] scores, int[] totals, Yahtzee core, bool usedRoll )
			: base( 0, 0 )
		{
            m_From = from;
            m_currentRoll = roll;
            ar_Dice = dice;
            ar_Holds = holds;
            ar_Scores = scores;
            ar_Totals = totals;
            yahtzeeCore = core;
            hasUsedRoll = usedRoll;


			Closable=true;
			Disposable=true;
			Dragable=true;
			Resizable=false;
			AddPage(0);
			
            // background
            AddBackground(275, 50, 265, 500, 9270);
			AddImageTiled(285, 70, 245, 16, 3607);
            AddImageTiled(285, 60, 245, 20, 3004);
            AddLabel(385, 60, 31, @"Yahtzee");

            // dice
            int diceValue;
            int xOffset = 25;
            int xBase = 350;

            for (int diceDex = 0; diceDex <= 4; diceDex++)
            {
                diceValue = baseDiceValue;
                diceValue += ar_Dice[diceDex];
                AddImage((xBase + (diceDex * xOffset)), 110, diceValue);
            }
            /*
            this.AddImage(350, 110, diceValue);
			this.AddImage(375, 110, 11281);
			this.AddImage(400, 110, 11282);
			this.AddImage(425, 110, 11283);
			this.AddImage(450, 110, 11284);
            */

            AddLabel(295, 110, 1149, @"Roll");
            AddLabel(305, 130, 1149, m_currentRoll.ToString());
            if (m_currentRoll < 3)
            {
                AddButton(325, 112, 5601, 5605, (int)Buttons.bt_Roll, GumpButtonType.Reply, 0);
            }
			
			
			AddLabel(295, 165, 1149, @"Ones");
            AddLabel(295, 185, 1149, @"Twos");
            AddLabel(295, 205, 1149, @"Threes");
            AddLabel(295, 225, 1149, @"Fours");
            AddLabel(295, 245, 1149, @"Fives");
            AddLabel(295, 265, 1149, @"Sixes");
			
            AddLabel(340, 285, 1152, @"Upper Total:");
			AddLabel(375, 305, 1152, @"Bonus:");

            AddLabel(295, 345, 1149, @"Three of a kind");
            AddLabel(295, 365, 1149, @"Four of a kind");
            AddLabel(295, 385, 1149, @"Full House");
            AddLabel(295, 405, 1149, @"Short Straight");
            AddLabel(295, 425, 1149, @"Long Straight");
            AddLabel(295, 445, 1149, @"Yahtzee");
            AddLabel(295, 465, 1149, @"Chance");
            
            AddLabel(338, 485, 1152, @"Lower Total:");

            AddLabel(340, 505, 1152, @"Grand Total:");

            if (!(m_currentRoll == 3))
            {
                AddLabel(480, 135, 1149, @"Hold");
                AddCheck(351, 135, 2715, 2714, ar_Holds[0], (int)Buttons.chk_Hold1);
                AddCheck(376, 135, 2715, 2714, ar_Holds[1], (int)Buttons.chk_Hold2);
                AddCheck(401, 135, 2715, 2714, ar_Holds[2], (int)Buttons.chk_Hold3);
                AddCheck(426, 135, 2715, 2714, ar_Holds[3], (int)Buttons.chk_Hold4);
                AddCheck(451, 135, 2715, 2714, ar_Holds[4], (int)Buttons.chk_Hold5);
            }

            if (!(hasUsedRoll))
            {
                AddButton(400, 167, 5601, 5605, (int)Buttons.bt_Ones, GumpButtonType.Reply, 0);
                AddButton(400, 187, 5601, 5605, (int)Buttons.bt_Twos, GumpButtonType.Reply, 0);
                AddButton(400, 207, 5601, 5605, (int)Buttons.bt_Threes, GumpButtonType.Reply, 0);
                AddButton(400, 227, 5601, 5605, (int)Buttons.bt_Fours, GumpButtonType.Reply, 0);
                AddButton(400, 247, 5601, 5605, (int)Buttons.bt_Fives, GumpButtonType.Reply, 0);
                AddButton(400, 267, 5601, 5605, (int)Buttons.bt_Sixes, GumpButtonType.Reply, 0);

                AddButton(400, 348, 5601, 5605, (int)Buttons.bt_ThreeOfAKind, GumpButtonType.Reply, 0);
                AddButton(400, 368, 5601, 5605, (int)Buttons.bt_FourOfAKind, GumpButtonType.Reply, 0);
                AddButton(400, 388, 5601, 5605, (int)Buttons.bt_FullHouse, GumpButtonType.Reply, 0);
                AddButton(400, 408, 5601, 5605, (int)Buttons.bt_ShortStraight, GumpButtonType.Reply, 0);
                AddButton(400, 428, 5601, 5605, (int)Buttons.bt_LongStraight, GumpButtonType.Reply, 0);
                AddButton(400, 448, 5601, 5605, (int)Buttons.bt_Yahtzee, GumpButtonType.Reply, 0);
                AddButton(400, 468, 5601, 5605, (int)Buttons.bt_Chance, GumpButtonType.Reply, 0);
            }

            
            // upper

            int yOffset = 20;
            int yBase = 165;
            string scoreText;
            int currentScore;
            int scoreDex;

            for (scoreDex = 0; scoreDex < 6; scoreDex++)
            {
                scoreText = "-";
                currentScore = ar_Scores[scoreDex];
                if (currentScore > -1)
                    scoreText = currentScore.ToString();
                AddLabel(460, (yBase + (yOffset * scoreDex)), 1149, scoreText); 

            }
            /*
            this.AddLabel(460, 185, 0, @"-"); // ones 1
			this.AddLabel(460, 205, 0, @"-"); // twos 2
			this.AddLabel(460, 225, 0, @"-"); // threes 3
			this.AddLabel(460, 245, 0, @"-"); // fours 4
			this.AddLabel(460, 265, 0, @"-"); // fives 5
			this.AddLabel(460, 285, 0, @"-"); // sixes 6
            */


            // lower
            yBase = 345; // adjust y starting value
            
            for (; scoreDex < 13; scoreDex++)
            {
                scoreText = "-";
                currentScore = ar_Scores[scoreDex];
                if (currentScore > -1)
                    scoreText = currentScore.ToString();
                AddLabel(460, (yBase + (yOffset * (scoreDex - 6))), 1149, scoreText);

            }
            /*
            this.AddLabel(460, 345, 0, @"-"); // three of a kind 7
			this.AddLabel(460, 365, 0, @"-"); // four of a kind 8
			this.AddLabel(460, 385, 0, @"-"); // full house 9
			this.AddLabel(460, 405, 0, @"-"); // short straight 10
			this.AddLabel(460, 425, 0, @"-"); // long straight 11
			this.AddLabel(460, 445, 0, @"-"); // yahtzee 12
			this.AddLabel(460, 465, 0, @"-"); // chance 13
            */

            // totals
            AddLabel(460, 285, 1152, ar_Totals[0].ToString()); // upper total 1.1
            AddLabel(460, 305, 1152, ar_Totals[1].ToString()); // bonus 1.2
            AddLabel(460, 485, 1152, ar_Totals[2].ToString()); // lower total 1.3
            AddLabel(460, 505, 1152, ar_Totals[3].ToString()); // grand total 1.4

		}
コード例 #2
0
        public YahtzeeGump(Mobile from, int roll, int[] dice, bool[] holds, int[] scores, int[] totals, Yahtzee core, bool usedRoll)
            : base(0, 0)
        {
            m_From        = from;
            m_currentRoll = roll;
            ar_Dice       = dice;
            ar_Holds      = holds;
            ar_Scores     = scores;
            ar_Totals     = totals;
            yahtzeeCore   = core;
            hasUsedRoll   = usedRoll;


            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);

            // background
            AddBackground(275, 50, 265, 500, 9270);
            AddImageTiled(285, 70, 245, 16, 3607);
            AddImageTiled(285, 60, 245, 20, 3004);
            AddLabel(385, 60, 31, @"Yahtzee");

            // dice
            int diceValue;
            int xOffset = 25;
            int xBase   = 350;

            for (int diceDex = 0; diceDex <= 4; diceDex++)
            {
                diceValue  = baseDiceValue;
                diceValue += ar_Dice[diceDex];
                AddImage((xBase + (diceDex * xOffset)), 110, diceValue);
            }

            /*
             * this.AddImage(350, 110, diceValue);
             *          this.AddImage(375, 110, 11281);
             *          this.AddImage(400, 110, 11282);
             *          this.AddImage(425, 110, 11283);
             *          this.AddImage(450, 110, 11284);
             */

            AddLabel(295, 110, 1149, @"Roll");
            AddLabel(305, 130, 1149, m_currentRoll.ToString());
            if (m_currentRoll < 3)
            {
                AddButton(325, 112, 5601, 5605, (int)Buttons.bt_Roll, GumpButtonType.Reply, 0);
            }


            AddLabel(295, 165, 1149, @"Ones");
            AddLabel(295, 185, 1149, @"Twos");
            AddLabel(295, 205, 1149, @"Threes");
            AddLabel(295, 225, 1149, @"Fours");
            AddLabel(295, 245, 1149, @"Fives");
            AddLabel(295, 265, 1149, @"Sixes");

            AddLabel(340, 285, 1152, @"Upper Total:");
            AddLabel(375, 305, 1152, @"Bonus:");

            AddLabel(295, 345, 1149, @"Three of a kind");
            AddLabel(295, 365, 1149, @"Four of a kind");
            AddLabel(295, 385, 1149, @"Full House");
            AddLabel(295, 405, 1149, @"Short Straight");
            AddLabel(295, 425, 1149, @"Long Straight");
            AddLabel(295, 445, 1149, @"Yahtzee");
            AddLabel(295, 465, 1149, @"Chance");

            AddLabel(338, 485, 1152, @"Lower Total:");

            AddLabel(340, 505, 1152, @"Grand Total:");

            if (!(m_currentRoll == 3))
            {
                AddLabel(480, 135, 1149, @"Hold");
                AddCheck(351, 135, 2715, 2714, ar_Holds[0], (int)Buttons.chk_Hold1);
                AddCheck(376, 135, 2715, 2714, ar_Holds[1], (int)Buttons.chk_Hold2);
                AddCheck(401, 135, 2715, 2714, ar_Holds[2], (int)Buttons.chk_Hold3);
                AddCheck(426, 135, 2715, 2714, ar_Holds[3], (int)Buttons.chk_Hold4);
                AddCheck(451, 135, 2715, 2714, ar_Holds[4], (int)Buttons.chk_Hold5);
            }

            if (!(hasUsedRoll))
            {
                AddButton(400, 167, 5601, 5605, (int)Buttons.bt_Ones, GumpButtonType.Reply, 0);
                AddButton(400, 187, 5601, 5605, (int)Buttons.bt_Twos, GumpButtonType.Reply, 0);
                AddButton(400, 207, 5601, 5605, (int)Buttons.bt_Threes, GumpButtonType.Reply, 0);
                AddButton(400, 227, 5601, 5605, (int)Buttons.bt_Fours, GumpButtonType.Reply, 0);
                AddButton(400, 247, 5601, 5605, (int)Buttons.bt_Fives, GumpButtonType.Reply, 0);
                AddButton(400, 267, 5601, 5605, (int)Buttons.bt_Sixes, GumpButtonType.Reply, 0);

                AddButton(400, 348, 5601, 5605, (int)Buttons.bt_ThreeOfAKind, GumpButtonType.Reply, 0);
                AddButton(400, 368, 5601, 5605, (int)Buttons.bt_FourOfAKind, GumpButtonType.Reply, 0);
                AddButton(400, 388, 5601, 5605, (int)Buttons.bt_FullHouse, GumpButtonType.Reply, 0);
                AddButton(400, 408, 5601, 5605, (int)Buttons.bt_ShortStraight, GumpButtonType.Reply, 0);
                AddButton(400, 428, 5601, 5605, (int)Buttons.bt_LongStraight, GumpButtonType.Reply, 0);
                AddButton(400, 448, 5601, 5605, (int)Buttons.bt_Yahtzee, GumpButtonType.Reply, 0);
                AddButton(400, 468, 5601, 5605, (int)Buttons.bt_Chance, GumpButtonType.Reply, 0);
            }


            // upper

            int    yOffset = 20;
            int    yBase   = 165;
            string scoreText;
            int    currentScore;
            int    scoreDex;

            for (scoreDex = 0; scoreDex < 6; scoreDex++)
            {
                scoreText    = "-";
                currentScore = ar_Scores[scoreDex];
                if (currentScore > -1)
                {
                    scoreText = currentScore.ToString();
                }
                AddLabel(460, (yBase + (yOffset * scoreDex)), 1149, scoreText);
            }

            /*
             * this.AddLabel(460, 185, 0, @"-"); // ones 1
             *          this.AddLabel(460, 205, 0, @"-"); // twos 2
             *          this.AddLabel(460, 225, 0, @"-"); // threes 3
             *          this.AddLabel(460, 245, 0, @"-"); // fours 4
             *          this.AddLabel(460, 265, 0, @"-"); // fives 5
             *          this.AddLabel(460, 285, 0, @"-"); // sixes 6
             */


            // lower
            yBase = 345; // adjust y starting value

            for (; scoreDex < 13; scoreDex++)
            {
                scoreText    = "-";
                currentScore = ar_Scores[scoreDex];
                if (currentScore > -1)
                {
                    scoreText = currentScore.ToString();
                }
                AddLabel(460, (yBase + (yOffset * (scoreDex - 6))), 1149, scoreText);
            }

            /*
             * this.AddLabel(460, 345, 0, @"-"); // three of a kind 7
             *          this.AddLabel(460, 365, 0, @"-"); // four of a kind 8
             *          this.AddLabel(460, 385, 0, @"-"); // full house 9
             *          this.AddLabel(460, 405, 0, @"-"); // short straight 10
             *          this.AddLabel(460, 425, 0, @"-"); // long straight 11
             *          this.AddLabel(460, 445, 0, @"-"); // yahtzee 12
             *          this.AddLabel(460, 465, 0, @"-"); // chance 13
             */

            // totals
            AddLabel(460, 285, 1152, ar_Totals[0].ToString()); // upper total 1.1
            AddLabel(460, 305, 1152, ar_Totals[1].ToString()); // bonus 1.2
            AddLabel(460, 485, 1152, ar_Totals[2].ToString()); // lower total 1.3
            AddLabel(460, 505, 1152, ar_Totals[3].ToString()); // grand total 1.4
        }