Пример #1
0
        /// <summary>
        /// Called by the layer to update the score layer for the present game state.
        /// </summary>
        public void update_layer()
        {
            ((ScoreLayer)this.layer).layers.Clear();
            if (this.Game.Players.Count <= 1)
            {
                this.update_layer_1p();
            }
            else
            {
                this.update_layer_4p();
            }

            // Common: add the ball X ... FREE PLAY footer
            TextLayer common = new TextLayer(128 / 2, 32 - 6, this.font_common, FontJustify.Center);

            if (this.Game.ball == 0)
            {
                common.set_text("FREE PLAY");
            }
            else
            {
                common.set_text(String.Format("BALL {0}            FREE PLAY", this.Game.ball));
            }

            ((ScoreLayer)this.layer).layers.Add(common);
        }
Пример #2
0
        public void update_layer_1p()
        {
            long score;

            if (this.Game.current_player() == null)
            {
                score = 0; // Small hack to make something show up on startup
            }
            else
            {
                score = this.Game.current_player().score;
            }

            TextLayer layer = new TextLayer(128 / 2, 5, this.font_for_score_single(score), FontJustify.Center);

            layer.set_text(this.format_score(score));
            ((ScoreLayer)this.layer).layers.Add(layer);
        }
Пример #3
0
        public void update_layer_4p()
        {
            long            score;
            bool            is_active_player;
            Font            font;
            Pair <int, int> pos;
            FontJustify     justify;
            TextLayer       layer;

            for (int i = 0; i < Game.Players.Count; i++)
            {
                score            = Game.Players[i].score;
                is_active_player = (this.Game.ball > 0) && (i == this.Game.current_player_index);
                font             = this.font_for_score(score, is_active_player);
                pos     = this.pos_for_player(i, is_active_player);
                justify = this.justify_for_player(i);
                layer   = new TextLayer(pos.First, pos.Second, font, justify);
                layer.set_text(this.format_score(score));
                ((ScoreLayer)this.layer).layers.Add(layer);
            }
        }
Пример #4
0
        public override void mode_started()
        {
            // Lamp show
            change_lampshow();

            Game.score_display.layer.enabled = false;

            Animation anim = new Animation().load(@"animations\williams_animated.dmd");

            this.williams_logo = new AnimatedLayer(false, true, false, 1, anim.frames.ToArray());

            anim           = new Animation().load(@"animations\ballcross.dmd");
            this.ballcross = new AnimatedLayer(false, true, false, 1, anim.frames.ToArray());

            anim         = new Animation().load(@"animations\dm_logo.dmd");
            this.dm_logo = new AnimatedLayer(false, true, false, 1, anim.frames.ToArray());

            anim          = new Animation().load(@"animations\pcc_logo.dmd");
            this.pcc_logo = new AnimatedLayer(false, true, false, 1, anim.frames.ToArray());

            anim             = new Animation().load(@"animations\github_fork.dmd");
            this.github_logo = new AnimatedLayer(false, true, false, 1, anim.frames.ToArray());

            presents_layer = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font09Bx7.dmd"), FontJustify.Center, true);
            presents_layer.set_text("PRESENTS");
            //testfontlayer_04B37 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("04B-03-7px.dmd"), FontJustify.Center, true);
            //testfontlayer_07x4 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font07x4.dmd"), FontJustify.Center, true);
            //testfontlayer_07x5 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font07x5.dmd"), FontJustify.Center, true);
            //testfontlayer_09Bx7 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font09Bx7.dmd"), FontJustify.Center, true);
            //testfontlayer_09x5 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font09x5.dmd"), FontJustify.Center, true);
            //testfontlayer_09x6 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font09x6.dmd"), FontJustify.Center, true);
            //testfontlayer_09x7 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font09x7.dmd"), FontJustify.Center, true);
            //testfontlayer_14x10 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font14x10.dmd"), FontJustify.Center, true);
            //testfontlayer_14x8 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font14x8.dmd"), FontJustify.Center, true);
            //testfontlayer_14x9 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font14x9.dmd"), FontJustify.Center, true);
            //testfontlayer_18x10 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font18x10.dmd"), FontJustify.Center, true);
            //testfontlayer_18x11 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font18x11.dmd"), FontJustify.Center, true);
            //testfontlayer_18x12 = new TextLayer(128 / 2, 0, FontManager.instance.font_named("Font18x12.dmd"), FontJustify.Center, true);
            //testfontlayer_eurostile = new TextLayer(128 / 2, 0, FontManager.instance.font_named("eurostile.dmd"), FontJustify.Center, true);

            //testfontlayer_04B37.set_text("FONT04B037");
            //testfontlayer_07x4.set_text("FONT07x4");
            //testfontlayer_07x5.set_text("FONT07x5");
            //testfontlayer_09Bx7.set_text("FONT09Bx7");
            //testfontlayer_09x5.set_text("FONT09x5");
            //testfontlayer_09x6.set_text("FONT09x6");
            //testfontlayer_09x7.set_text("FONT09x7");
            //testfontlayer_14x10.set_text("FONT14x10");
            //testfontlayer_14x8.set_text("FONT14x8");
            //testfontlayer_14x9.set_text("FONT14x9");
            //testfontlayer_18x10.set_text("FONT18x10");
            //testfontlayer_18x11.set_text("FONT18x11");
            //testfontlayer_18x12.set_text("FONT18x12");
            //testfontlayer_eurostile.set_text("Eurostile 123");

            MarkupGenerator gen = new MarkupGenerator();

            gen.font_plain = FontManager.instance.font_named("Font09x7.dmd");
            gen.font_bold  = FontManager.instance.font_named("Font09Bx7.dmd");

            Frame credits_frame = gen.frame_for_markup(@"

[CREDITS]

[Game Rules and Coding]
[Jimmy Lipham]

[Special Thanks]
[Gerry Stellenberg]
[Adam Preble]");

            this.credits_layer = new PanningLayer(128, 32, credits_frame, new Pair <int, int>(0, 0),
                                                  new Pair <int, int>(0, 1), false);
            this.credits_layer.composite_op = DMDBlendMode.DMDBlendModeCopy;

            List <Pair <int, Layer> > script = new List <Pair <int, Layer> >();

            script.Add(new Pair <int, Layer>(7, williams_logo));
            script.Add(new Pair <int, Layer>(4, presents_layer));
            script.Add(new Pair <int, Layer>(10, dm_logo));
            script.Add(new Pair <int, Layer>(1, ballcross));
            script.Add(new Pair <int, Layer>(5, pcc_logo));
            script.Add(new Pair <int, Layer>(5, github_logo));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_eurostile));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_04B37));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_07x4));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_07x5));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_09Bx7));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_09x5));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_09x6));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_09x7));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_14x10));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_14x8));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_14x9));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_18x10));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_18x11));
            //script.Add(new Pair<int, Layer>(5, testfontlayer_18x12));
            //script.Add(new Pair<int,Layer>(30, credits_layer));

            this.layer = new ScriptedLayer(128, 32, script);

            // Blinky start button
            Game.Lamps["startButton"].Schedule(0x00ff00ff, 0, false);
        }