Example #1
0
        void DrawProgressBar(byte remainingBluePieces, byte remainingRedPieces)
        {
            // remove old image
            if (ProgressBarBlue != null)
            {
                Remove(ProgressBarBlue);
            }
            if (ProgressBarRed != null)
            {
                Remove(ProgressBarRed);
            }

            // calculate new blue draw width based on ratio of number of remaining blue pieces to the total nubmer of remaining pieces
            var   totalPieces           = remainingBluePieces + remainingRedPieces;
            float blueRatio             = (0F + remainingBluePieces) / totalPieces;
            int   thisRoundBlueProgress = (int)(blueRatio * BlueProgressImage.Width);

            // draw blue bar
            ProgressBarBlue = new UISlotsImage(BlueProgressImage);
            ProgressBarBlue.SetBounds(0, 0, thisRoundBlueProgress, BlueProgressImage.Height);
            ProgressBarBlue.X = ProgressBeginningX;

            // draw red bar based on remaining draw space
            ProgressBarRed = new UISlotsImage(RedProgressImage);
            ProgressBarRed.SetBounds(thisRoundBlueProgress, 0, RedProgressImage.Width - thisRoundBlueProgress, RedProgressImage.Height);
            ProgressBarRed.X = ProgressBeginningX + thisRoundBlueProgress;

            ProgressBarBlue.Y = ProgressBarRed.Y = ProgressY;
            Add(ProgressBarBlue);
            Add(ProgressBarRed);
        }
Example #2
0
        private void BuildUI()
        {
            var script = this.RenderScript("wargameeod.uis");

            Script = script;

            // add backgrounds
            MoveSelectionBkgnd = script.Create <UIImage>("MoveSelectionBkgnd");
            AddAt(0, MoveSelectionBkgnd);
            ResultsBkgnd = script.Create <UIImage>("ResultsBkgnd");
            AddAt(1, ResultsBkgnd);

            // add and make invisible the victory and defeat images
            ResultVictoryImg = script.Create <UIImage>("ResultVictoryImg");
            AddAt(2, ResultVictoryImg);
            ResultVictoryImg.Visible = false;
            ResultDefeatImg          = script.Create <UIImage>("ResultDefeatImg");
            AddAt(3, ResultDefeatImg);
            ResultDefeatImg.Visible = false;

            // set player choice image
            MoveIconBlue   = new UISlotsImage(MoveIconImage);
            MoveIconBlue.X = 215;
            MoveIconBlue.SetBounds(((byte)UIWarGameEODMoveChoices.Unknown * MOVE_ICON_WIDTH_HEIGHT), 0,
                                   MOVE_ICON_WIDTH_HEIGHT, MOVE_ICON_WIDTH_HEIGHT);
            MoveIconRed   = new UISlotsImage(MoveIconImage);
            MoveIconRed.X = 285;
            MoveIconRed.SetBounds(((byte)UIWarGameEODMoveChoices.Unknown * MOVE_ICON_WIDTH_HEIGHT), 0,
                                  MOVE_ICON_WIDTH_HEIGHT, MOVE_ICON_WIDTH_HEIGHT);
            MoveIconBlue.Y = MoveIconRed.Y = 124;
            Add(MoveIconBlue);
            Add(MoveIconRed);

            // remove the initial buttons, they needed to be added in InitHandler
            try
            {
                Remove(ArtilleryButton);
                Remove(CavalryButton);
                Remove(CommandButton);
                Remove(InfantryButton);
                Remove(IntelButton);
            }
            catch (Exception) { }

            // add borders for player images
            BlueMoveBorder = script.Create <UIImage>("BlueMoveBorder");
            Add(BlueMoveBorder);
            RedMoveBorder = script.Create <UIImage>("RedMoveBorder");
            Add(RedMoveBorder);

            // add player images
            BluePlayerPos = script.Create <UIImage>("BluePlayerPos");
            RedPlayerPos  = script.Create <UIImage>("RedPlayerPos");

            // get beginning progressbar.X and its Y
            ProgPosition1      = script.Create <UIImage>("ProgPosition1");
            ProgressBeginningX = (int)ProgPosition1.X;
            ProgressY          = (int)ProgPosition1.Y;
        }
Example #3
0
 private void DrawWheelStops(bool wheelOneAlreadyDone, bool wheelTwoAlreadyDone, bool wheelThreeAlreadyDone)
 {
     if (wheelOneAlreadyDone == false)  // do not redraw if wheel hasn't moved
     {
         Remove(Wheel1);
         Wheel1 = new UISlotsImage(ActiveWheelTexture).DoubleTextureDraw(0, WheelListOne.Next.MyStartingY +
                                                                         (WHEEL_TEXTURE_WIDTH_AND_HEIGHT - WheelListOne.OffsetY), WHEEL_TEXTURE_WIDTH_AND_HEIGHT, WheelListOne.OffsetY,
                                                                         0, WheelListOne.Current.MyStartingY, WHEEL_TEXTURE_WIDTH_AND_HEIGHT, (WHEEL_TEXTURE_WIDTH_AND_HEIGHT - WheelListOne.OffsetY),
                                                                         false, true);
         Wheel1.X = 167;
         Wheel1.Y = 265;
         AddBefore(Wheel1, WinningLine);
     }
     if (wheelTwoAlreadyDone == false) // do not redraw if wheel hasn't moved
     {
         Remove(Wheel2);
         Wheel2 = new UISlotsImage(ActiveWheelTexture).DoubleTextureDraw(0, WheelListTwo.Next.MyStartingY +
                                                                         (WHEEL_TEXTURE_WIDTH_AND_HEIGHT - WheelListTwo.OffsetY), WHEEL_TEXTURE_WIDTH_AND_HEIGHT, WheelListTwo.OffsetY,
                                                                         0, WheelListTwo.Current.MyStartingY, WHEEL_TEXTURE_WIDTH_AND_HEIGHT, (WHEEL_TEXTURE_WIDTH_AND_HEIGHT - WheelListTwo.OffsetY),
                                                                         false, true);
         Wheel2.X = 236;
         Wheel2.Y = 265;
         AddBefore(Wheel2, WinningLine);
     }
     if (wheelThreeAlreadyDone == false) // do not redraw if wheel hasn't moved
     {
         Remove(Wheel3);
         Wheel3 = new UISlotsImage(ActiveWheelTexture).DoubleTextureDraw(0, WheelListThree.Next.MyStartingY +
                                                                         (WHEEL_TEXTURE_WIDTH_AND_HEIGHT - WheelListThree.OffsetY), WHEEL_TEXTURE_WIDTH_AND_HEIGHT, WheelListThree.OffsetY,
                                                                         0, WheelListThree.Current.MyStartingY, WHEEL_TEXTURE_WIDTH_AND_HEIGHT, (WHEEL_TEXTURE_WIDTH_AND_HEIGHT - WheelListThree.OffsetY),
                                                                         false, true);
         Wheel3.X = 305;
         Wheel3.Y = 265;
         AddBefore(Wheel3, WinningLine);
     }
 }
Example #4
0
        private void PlayerInitHandler(string evt, byte[] args)
        {
            Controller.ShowEODMode(new EODLiveModeOpt
            {
                Buttons    = 1,
                Height     = EODHeight.TallTall,
                Length     = EODLength.Full,
                Tips       = EODTextTips.Short,
                Timer      = EODTimer.None,
                Expandable = true,
                Expanded   = true
            });

            SetTip(GameFacade.Strings["UIText", "259", "6"]);

            // hide owner UI elements
            Loading.Visible       = false;
            OddsSlider.Visible    = false;
            OnOffButton.Visible   = false;
            CashOutButton.Visible = false;
            Odds.Visible          = false;
            House.Visible         = false;
            Player.Visible        = false;
            OnOff.Visible         = false;
            CashText.Visible      = false;

            // create player UI iamges
            Wheelsback = Script.Create <UIImage>("WheelsBack");
            AddAt(0, Wheelsback);
            LightsFrame1 = Script.Create <UIImage>("LightsFrame1");
            AddAt(1, LightsFrame1);
            LightsFrame2 = Script.Create <UIImage>("LightsFrame2");
            AddAt(2, LightsFrame2);
            BetIndents = Script.Create <UIImage>("BetIndents");
            AddAt(3, BetIndents);
            Chips   = new UISlotsImage(MoneyChipsImage);
            Chips.X = 110;
            Chips.Y = 285;
            Add(Chips);

            // Customize and place payout table
            PayoutTableColumn1Row1   = new UISlotsImage(Wheel1LegendImage).TripleTextureDraw(0, 0, 15, 21, 0, 0, 15, 21, 0, 0, 15, 21, true, false);
            PayoutTableColumn1Row1.X = 125;
            PayoutTableColumn1Row1.Y = 120;
            Add(PayoutTableColumn1Row1);
            PayoutTableColumn1Row2    = new UISlotsImage(Wheel1LegendImage).TripleTextureDraw(15, 0, 15, 21, 15, 0, 15, 21, 15, 0, 15, 21, true, false);
            PayoutTableColumn1Row2.X  = 125;
            PayoutTableColumn1Row2.Y  = 120;
            PayoutTableColumn1Row2.Y += 21;
            Add(PayoutTableColumn1Row2);
            PayoutTableColumn1Row3    = new UISlotsImage(Wheel1LegendImage).TripleTextureDraw(30, 0, 15, 21, 30, 0, 15, 21, 30, 0, 15, 21, true, false);
            PayoutTableColumn1Row3.X  = 125;
            PayoutTableColumn1Row3.Y  = 120;
            PayoutTableColumn1Row3.Y += 42;
            Add(PayoutTableColumn1Row3);
            PayoutTableColumn1Row4    = new UISlotsImage(Wheel1LegendImage).TripleTextureDraw(45, 0, 15, 21, 45, 0, 15, 21, 45, 0, 15, 21, true, false);
            PayoutTableColumn1Row4.X  = 125;
            PayoutTableColumn1Row4.Y  = 120;
            PayoutTableColumn1Row4.Y += 63;
            Add(PayoutTableColumn1Row4);
            PayoutTableColumn2Row1   = new UISlotsImage(Wheel1LegendImage).TripleTextureDraw(60, 0, 15, 21, 60, 0, 15, 21, 60, 0, 15, 21, true, false);
            PayoutTableColumn2Row1.X = 275;
            PayoutTableColumn2Row1.Y = 120;
            Add(PayoutTableColumn2Row1);
            PayoutTableColumn2Row2    = new UISlotsImage(Wheel1LegendImage).TripleTextureDraw(45, 0, 15, 21, 60, 0, 15, 21, 75, 0, 15, 21, true, false);
            PayoutTableColumn2Row2.X  = 275;
            PayoutTableColumn2Row2.Y  = 120;
            PayoutTableColumn2Row2.Y += 21;
            Add(PayoutTableColumn2Row2);
            PayoutTableColumn2Row3    = new UISlotsImage(Wheel1LegendImage).DoubleTextureDraw(75, 0, 15, 21, 75, 0, 15, 21, true, false);
            PayoutTableColumn2Row3.X  = 275;
            PayoutTableColumn2Row3.Y  = 120;
            PayoutTableColumn2Row3.Y += 42;
            Add(PayoutTableColumn2Row3);
            PayoutTableColumn2Row4   = new UISlotsImage(Wheel1LegendImage);
            PayoutTableColumn2Row4.X = 275;
            PayoutTableColumn2Row4.Y = 120;
            PayoutTableColumn2Row4.SetBounds(75, 0, 15, 21);
            PayoutTableColumn2Row4.Y += 63;
            Add(PayoutTableColumn2Row4);

            // initialize payout textfields, which are currently ubiquitous across all slot machines
            PayoutText1.Y           = PayoutTableColumn1Row1.Y - 1;
            PayoutText1.X           = PayoutTableColumn1Row1.X + 55;
            PayoutText1.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText1.CurrentText = PayoutText1.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.SIX_SIX_SIX_PAYOUT_MULTIPLIER);
            PayoutText1.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText1);

            PayoutText2.Y           = PayoutTableColumn1Row2.Y - 1;
            PayoutText2.X           = PayoutTableColumn1Row2.X + 55;
            PayoutText2.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText2.CurrentText = PayoutText2.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.FIVE_FIVE_FIVE_PAYOUT_MULTIPLIER);
            PayoutText2.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText2);

            PayoutText3.Y           = PayoutTableColumn1Row3.Y - 1;
            PayoutText3.X           = PayoutTableColumn1Row3.X + 55;
            PayoutText3.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText3.CurrentText = PayoutText3.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.FOUR_FOUR_FOUR_PAYOUT_MULTIPLIER);
            PayoutText3.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText3);

            PayoutText4.Y           = PayoutTableColumn1Row4.Y - 1;
            PayoutText4.X           = PayoutTableColumn1Row4.X + 55;
            PayoutText4.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText4.CurrentText = PayoutText4.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.THREE_THREE_THREE_PAYOUT_MULTIPLIER);
            PayoutText4.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText4);

            PayoutText5.Y           = PayoutTableColumn2Row1.Y - 1;
            PayoutText5.X           = PayoutTableColumn2Row1.X + 55;
            PayoutText5.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText5.CurrentText = PayoutText5.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.TWO_TWO_TWO_PAYOUT_MULTIPLIER);
            PayoutText5.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText5);

            PayoutText6.Y           = PayoutTableColumn2Row2.Y - 1;
            PayoutText6.X           = PayoutTableColumn2Row2.X + 55;
            PayoutText6.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText6.CurrentText = PayoutText6.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.THREE_TWO_ONE_PAYOUT_MULTIPLIER);
            PayoutText6.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText6);

            PayoutText7.Y           = PayoutTableColumn2Row3.Y - 1;
            PayoutText7.X           = PayoutTableColumn2Row3.X + 55;
            PayoutText7.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText7.CurrentText = PayoutText7.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.ONE_ONE_ANY_PAYOUT_MULTIPLIER);
            PayoutText7.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText7);

            PayoutText8.Y           = PayoutTableColumn2Row4.Y - 1;
            PayoutText8.X           = PayoutTableColumn2Row4.X + 55;
            PayoutText8.CurrentText = GameFacade.Strings["UIText", "259", "36"];
            PayoutText8.CurrentText = PayoutText8.CurrentText.Replace("%i", "" + VMEODSlotsPlugin.ONE_ANY_ANY_PAYOUT_MULTIPLIER);
            PayoutText8.Mode        = UITextEditMode.ReadOnly;
            Add(PayoutText8);

            // create the wheel lists for the spinning
            WheelListOne   = new WheelStopsList();
            WheelListTwo   = new WheelStopsList();
            WheelListThree = new WheelStopsList();

            // the wheel textures are customised at a later time, but draw the initial pre-gameplay stops (sixth sixth sixth)
            Wheel1 = new UISlotsImage(Wheel1LegendImage).DoubleTextureDraw(0, WheelListOne.Current.MyStartingY, WHEEL_TEXTURE_WIDTH_AND_HEIGHT,
                                                                           WHEEL_TEXTURE_HALF_DRAW_HEIGHT, 0, WheelListOne.Current.MyStartingY + WHEEL_TEXTURE_HALF_DRAW_HEIGHT,
                                                                           WHEEL_TEXTURE_WIDTH_AND_HEIGHT, WHEEL_TEXTURE_HALF_DRAW_HEIGHT, false, true);
            Wheel1.X = 167;
            Wheel1.Y = 265;
            Wheel2   = new UISlotsImage(Wheel1LegendImage).DoubleTextureDraw(0, WheelListTwo.Current.MyStartingY, WHEEL_TEXTURE_WIDTH_AND_HEIGHT,
                                                                             WHEEL_TEXTURE_HALF_DRAW_HEIGHT, 0, WheelListTwo.Current.MyStartingY + WHEEL_TEXTURE_HALF_DRAW_HEIGHT,
                                                                             WHEEL_TEXTURE_WIDTH_AND_HEIGHT, WHEEL_TEXTURE_HALF_DRAW_HEIGHT, false, true);
            Wheel2.X = 236;
            Wheel2.Y = 265;
            Wheel3   = new UISlotsImage(Wheel1LegendImage).DoubleTextureDraw(0, WheelListThree.Current.MyStartingY, WHEEL_TEXTURE_WIDTH_AND_HEIGHT,
                                                                             WHEEL_TEXTURE_HALF_DRAW_HEIGHT, 0, WheelListThree.Current.MyStartingY + WHEEL_TEXTURE_HALF_DRAW_HEIGHT,
                                                                             WHEEL_TEXTURE_WIDTH_AND_HEIGHT, WHEEL_TEXTURE_HALF_DRAW_HEIGHT, false, true);
            Wheel3.X = 305;
            Wheel3.Y = 265;

            Add(Wheel1);
            Add(Wheel2);
            Add(Wheel3);
            WinningLine = Script.Create <UIImage>("WinningLine");
            Add(WinningLine);

            if ((args != null) && (args.Length > 1))
            {
                MachineTypeInit(args[1]);
            }
            else
            {
                MachineTypeInit(0);
            }

            // create a timer to animate the lights, milliseconds
            LightsTimer          = new Timer(666 + (2 / 3));
            LightsTimer.Elapsed += new ElapsedEventHandler(LightsHandler);

            // create a timer to change offline messages
            OfflineMessageTimer          = new Timer(3000);
            OfflineMessageTimer.Elapsed += new ElapsedEventHandler(OfflineMessageHandler);

            // create a timer to handle the spinning of the wheels
            WheelsSpinTimer          = new Timer(25);
            WheelsSpinTimer.Elapsed += new ElapsedEventHandler(AnimateWheelsHandler);
        }