Example #1
0
        ////////////////////////////////////////////////////////////////////////////
        public TaskCredits(Manager manager) : base(manager)
        {
            Height        = 400;
            Width         = 400;
            MinimumHeight = 100;
            MinimumWidth  = 100;
            Text          = "Credits";
            Center();
            BottomPanel.Visible = false;
            Resizable           = false;
            TopPanel.Visible    = true;
            Caption.Text        = "";

            Description.Text  = "The people and services that made this game possible!";
            Caption.TextColor = Description.TextColor = new Color(96, 96, 96);

            Image = new ImageBox(manager);
            Image.Init();
            Image.Left   = (ClientWidth / 2) - (Image.Width / 2);
            Image.Top    = 2;
            Image.Image  = ContentPack.Textures["gui\\credits"];
            Image.Width  = Image.Image.Width;
            Image.Height = Image.Image.Height;
            TopPanel.Add(Image);

            Description.Alignment = Alignment.BottomCenter;
            Description.Anchor    = Anchors.Left | Anchors.Bottom | Anchors.Right;
            Description.Top       = Image.Top + Image.Height;
            TopPanel.Height       = (Image.Top * 2) + Image.Height + Description.Height + 8;
            // ClientWidth = (Image.btnLeft * 2) + Image.Width;

            staff.Add("Cyral", "[color:Gold]Lead Developer[/color]");
            staff.Add("Pugmatt", "[color:Gold]Developer[/color]");
            staff.Add("Fer22f", "[color:LightSeaGreen]Contributing Dev[/color]");
            staff.Add("Kentiya", "[color:Cyan]Contributing Artist[/color]");
            int i = 0;

            foreach (KeyValuePair <string, string> kv in staff)
            {
                Label l2 = new Label(manager);
                l2.Init();
                l2.Text      = kv.Key;
                l2.Font      = FontSize.Default14;
                l2.Width     = 128;
                l2.Alignment = Alignment.MiddleCenter;
                l2.Top       = TopPanel.Height;
                l2.Height    = 24;
                l2.Left      = i * l2.Width;
                Label l = new Label(manager);
                l.Init();
                l.Text      = kv.Value;
                l.Width     = 128;
                l.Alignment = Alignment.MiddleCenter;
                l.Top       = l2.Top + l2.Height;
                l.Left      = i * l.Width;


                Add(l2);
                Add(l);
                i++;
            }

            Width      = staff.Count * 128 + 16;
            Image.Left = (ClientWidth / 2) - (Image.Width / 2);
            lblExtra   = new Label(manager);
            lblExtra.Init();
            lblExtra.Text  = "Other Resources:";
            lblExtra.Width = (int)Manager.Skin.Fonts[0].Resource.MeasureString(lblExtra.Text).X;
            // lblExtra.Alignment = Alignment.MiddleCenter;
            // lblExtra.Anchor = Anchors.btnLeft | Anchors.btnRight;
            lblExtra.Top  = TopPanel.Height + 58;
            lblExtra.Left = (ClientWidth / 2) - (lblExtra.Width / 2);
            Add(lblExtra);
            extras.Add("SmittyW - Former Graphics Artist.", "");
            extras.Add("\"Erdie\" - Thunder Audio. (Remixed, under CC by 3.0 license)", "http://freesound.org/people/Erdie/sounds/23222/");
            extras.Add("Everyone who has supported and contributed to Zarknorth through it's development!", "");
            i = 0;
            foreach (KeyValuePair <string, string> kv in extras)
            {
                extraLabels.Add(new Label(manager));
                extraLabels[extraLabels.Count - 1].Init();
                extraLabels[extraLabels.Count - 1].Text  = kv.Key;
                extraLabels[extraLabels.Count - 1].Width = (int)Manager.Skin.Fonts[0].Resource.MeasureString(extraLabels[extraLabels.Count - 1].Text).X;
                // extraLabels[extraLabels.Count - 1].Alignment = Alignment.BottomCenter;
                //extraLabels[extraLabels.Count - 1].Anchor = Anchors.btnLeft | Anchors.btnRight | Anchors.Bottom;
                extraLabels[extraLabels.Count - 1].Left = (ClientWidth / 2) - (extraLabels[extraLabels.Count - 1].Width / 2);
                extraLabels[extraLabels.Count - 1].Top  = lblExtra.Top + (12 * (i + 1));
                if (kv.Value != string.Empty)
                {
                    extraLabels[extraLabels.Count - 1].Click       += l_Click;
                    extraLabels[extraLabels.Count - 1].MouseOver   += TaskCredits_MouseOver;
                    extraLabels[extraLabels.Count - 1].MouseOut    += TaskCredits_MouseOut;
                    extraLabels[extraLabels.Count - 1].Passive      = false;
                    extraLabels[extraLabels.Count - 1].TextColor    = Color.SkyBlue;
                    extraLabels[extraLabels.Count - 1].ToolTip.Text = kv.Value;
                }
                else
                {
                    extraLabels[extraLabels.Count - 1].TextColor = Color.Gray;
                }
                Add(extraLabels[extraLabels.Count - 1]);

                i++;
            }
            ClientHeight = extraLabels[extraLabels.Count - 1].Top + 12 + 16;
            Center();
        }
Example #2
0
        public TaskDeath(Manager manager, string DeathMessage)
            : base(manager)
        {
            tb = new GradientPanel(manager);
            tb.Init();
            tb.Width  = Game.MainWindow.ClientWidth;
            tb.Height = Game.MainWindow.ClientHeight;
            tb.Left   = Game.MainWindow.ClientLeft;
            tb.Top    = Game.MainWindow.ClientTop;
            tb.Color  = Color.Red;
            tb.Alpha  = 0;
            manager.Add(tb);
            this.manager = manager;

            Height         = 400;
            Width          = 400;
            MinimumHeight  = 100;
            MinimumWidth   = 100;
            Text           = "You died!";
            CaptionVisible = false;
            Caption.Text   = Description.Text = string.Empty;
            Center();
            Movable          = false;
            TopPanel.Visible = true;

            deathImage = new ImageBox(manager);
            deathImage.Init();
            deathImage.Left   = 8;
            deathImage.Top    = 8;
            deathImage.Image  = ContentPack.Textures["gui\\death"];
            deathImage.Width  = deathImage.Image.Width;
            deathImage.Height = deathImage.Image.Height;
            ClientWidth       = (deathImage.Left * 2) + deathImage.Width;
            deathMessage      = new Label(manager);
            deathMessage.Init();
            deathMessage.Left  = 8;
            deathMessage.Top   = TopPanel.Height + 24;
            deathMessage.Text  = DeathMessage;
            deathMessage.Width = (int)manager.Skin.Fonts["Default14"].Resource.MeasureRichString(deathMessage.Text, manager, true).X;
            deathMessage.Font  = FontSize.Default14;
            deathMessage.Left  = ((ClientWidth / 2) - (deathMessage.Width / 2));

            deathMessageBG = new Label(manager);
            deathMessageBG.Init();
            deathMessageBG.Left    = 8;
            deathMessageBG.Top     = TopPanel.Height + 23;
            deathMessageBG.Text    = DeathMessage;
            deathMessage.Text      = deathMessage.Text.Replace(":Red]", ":DarkRed]");
            deathMessage.TextColor = Color.DimGray;
            deathMessageBG.Width   = (int)manager.Skin.Fonts["Default14"].Resource.MeasureRichString(deathMessage.Text, manager, true).X;
            deathMessageBG.Font    = FontSize.Default14;
            deathMessageBG.Left    = ((ClientWidth / 2) - (deathMessage.Width / 2)) - 1;
            deathMessageBG.Height  = deathMessage.Height = 24;

            Respawn = new Button(manager);
            Respawn.Init();
            Respawn.Text   = "Respawn";
            Respawn.Left   = ((ClientWidth / 2) - (Respawn.Width)) - 4;
            Respawn.Top    = 8;
            Respawn.Click += Respawn_Click;
            BottomPanel.Add(Respawn);

            Quit = new Button(manager);
            Quit.Init();
            Quit.Text   = "Quit";
            Quit.Left   = (ClientWidth / 2) + 4;
            Quit.Top    = 8;
            Quit.Click += Quit_Click;
            BottomPanel.Add(Quit);


            TopPanel.Add(deathImage);
            Add(deathMessage);
            Add(deathMessageBG);
            TopPanel.Height = (deathImage.Top * 2) + deathImage.Height;
            Height          = TopPanel.Height + BottomPanel.Height + deathMessage.Height + 24;

            StayOnTop  = true;
            FocusLost += TaskDeath_FocusLost;
            CanFocus   = true;
            Focused    = true;

            Closed += TaskDeath_Closed;
        }