예제 #1
0
        protected override void set_text(TactileLibrary.Data_Equipment item, bool battle_scene)
        {
            int x = 8;

            Got     = new TextSprite();
            Got.loc = new Vector2(x, 8);
            Got.SetFont(Config.UI_FONT, Global.Content,
                        battle_scene ? "CombatBlue" : "White");
            Got.text   = got_text();
            x         += Got.text_width;
            A_Name     = new TextSprite();
            A_Name.loc = new Vector2(x, 8);
            A_Name.SetFont(Config.UI_FONT, Global.Content,
                           battle_scene ? "CombatBlue" : "Blue");
            A_Name.text = aname_text(item.Name, item);
            x          += A_Name.text_width + 1;
            Icon.loc    = new Vector2(x, 8);
            x          += 17;
            Broke       = new TextSprite();
            Broke.loc   = new Vector2(x, 8);
            Broke.SetFont(Config.UI_FONT, Global.Content, "White");
            Broke.text = broke_text();
            x         += Broke.text_width;
            Width      = x + 8 + (x % 8 != 0 ? (8 - x % 8) : 0);
        }
예제 #2
0
        public BlueprintButton(string c1, string c1N, string c2, string c2N, string res, string resname,
                               IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Compo1     = c1;
            Compo1Name = c1N;

            Compo2     = c2;
            Compo2Name = c2N;

            Result     = res;
            ResultName = resname;

            _icon = _resourceManager.GetSprite("blueprint");

            Label = new TextSprite("blueprinttext", "", _resourceManager.GetFont("CALIBRI"))
            {
                Color        = new SFML.Graphics.Color(248, 248, 255),
                ShadowColor  = new SFML.Graphics.Color(105, 105, 105),
                ShadowOffset = new Vector2f(1, 1),
                Shadowed     = true
            };

            Update(0);
        }
예제 #3
0
        public CreditsMenu()
        {
            // Background
            Background         = new Menu_Background();
            Background.texture = Global.Content.Load <Texture2D>(
                @"Graphics\Pictures\Preparation_Background");
            (Background as Menu_Background).vel  = new Vector2(0, -1 / 4f);
            (Background as Menu_Background).tile = new Vector2(1, 2);
            Background.tint         = new Color(160, 160, 160, 255);
            Background.stereoscopic = Config.MAPMENU_BG_DEPTH;

            // Credits
            CreditsText = new List <TextSprite>();
            Vector2 loc = Vector2.Zero;

            foreach (var credit in Constants.Credits.CREDITS)
            {
                if (!string.IsNullOrEmpty(credit.Role) || credit.Names.Any())
                {
                    // Role
                    var role = new TextSprite(
                        Config.UI_FONT, Global.Content, "Yellow",
                        loc,
                        credit.Role);

                    CreditsText.Add(role);
                    loc += new Vector2(0, role.CharHeight * Lines(credit.Role));

                    // Names
                    foreach (string name in credit.Names)
                    {
                        var nameText = new TextSprite(
                            Config.UI_FONT, Global.Content, "White",
                            loc + new Vector2(16, 0),
                            name);

                        CreditsText.Add(nameText);
                        loc += new Vector2(0, nameText.CharHeight * Lines(name));
                    }
                }

                loc += new Vector2(0, 16);
            }

            DataHeight = (int)loc.Y - 16;

            // Scrollbar
            if (this.MaxScroll > 0)
            {
                int height = Config.WINDOW_HEIGHT - (int)(BASE_OFFSET.Y * 2);
                Scrollbar     = new Scroll_Bar(height - 16, DataHeight, height, 0);
                Scrollbar.loc = new Vector2(Config.WINDOW_WIDTH - BASE_OFFSET.X, BASE_OFFSET.Y + 8);
            }

            // Full Credits Button
            if (!string.IsNullOrEmpty(Constants.Credits.FULL_CREDITS_LINK))
            {
                CreateFullCreditsButton();
            }
        }
예제 #4
0
        public Support_Command_Components(int lines, int remaining, bool noRemainingPositive = false)
        {
            texture = Global.Content.Load <Texture2D>(FILENAME);
            Lines   = lines;

            string labelColor = "White";
            string valueColor = "Blue";

            if (remaining == 0)
            {
                if (noRemainingPositive)
                {
                    valueColor = "Green";
                }
                else
                {
                    labelColor = "Grey";
                    valueColor = "Grey";
                }
            }

            Remaining_Label     = new TextSprite();
            Remaining_Label.loc = new Vector2(24, 0);
            Remaining_Label.SetFont(Config.UI_FONT, Global.Content, labelColor);
            Remaining_Label.text = "Remaining";
            X_Label     = new TextSprite();
            X_Label.loc = new Vector2(72, 0);
            X_Label.SetFont(Config.UI_FONT, Global.Content, labelColor);
            X_Label.text        = "x";
            Remaining_Count     = new RightAdjustedText();
            Remaining_Count.loc = new Vector2(96, 0);
            Remaining_Count.SetFont(Config.UI_FONT, Global.Content, valueColor);
            Remaining_Count.text = remaining.ToString();
        }
예제 #5
0
 public TexturePrev(MultiSprite image, Tiles tileType, ContentManager content)
     : base(image)
 {
     this.tileType = tileType;
     text          = TextSprite.CreateSprite(content, Fnames.TEXT_FONT, new Vector2(image.Bounds.Left, image.Bounds.Bottom), tileType.ToString());
     text.Position = new Vector2(image.Bounds.Left + (image.Bounds.Width - text.Size.X) / 2, image.Bounds.Bottom);
 }
예제 #6
0
        public SelectLevelMenu(GraphicsDevice device)
            : base(device, (Game.Content.GetSizeInDpi(500) > device.Viewport.Width ? device.Viewport.Width : Game.Content.GetSizeInDpi(500)), device.Viewport.Height)
        {
            int spacing = Game.Content.GetSizeInDpi(20);

            float xCenter    = Canvas.View.Width / 2;
            float listHeight = device.Viewport.Height;

            this.m_caption = new TextSprite(Game.Content.Fonts.ButtonFont)
            {
                Text = "Level select", X = xCenter
            };
            this.m_caption.Y = spacing + this.m_caption.Height / 2;
            this.Canvas.Add(this.m_caption);
            listHeight -= spacing * 2 + this.m_caption.Height;

            this.BackButton = new TextButton(ButtonType.MainMenuButton)
            {
                Text = "Back", X = xCenter
            };
            this.BackButton.Y = Canvas.View.Height - spacing - this.BackButton.Height / 2;
            this.BackButton.AddToCanvas(this.Canvas);
            listHeight -= spacing * 2 + this.BackButton.Height;

            float listY = spacing * 2 + this.m_caption.Height + listHeight / 2;

            this.LevelsListView = new ListView <LevelListViewItem>(device, Canvas.View.Width, (int)listHeight, spacing)
            {
                IsProcessInput = true, X = xCenter, Y = listY
            };
            this.LevelsListView.AddToCanvas(this.Canvas);
        }
예제 #7
0
        public SupportViewerFooter()
        {
            this.texture = Global.Content.Load <Texture2D>(FILENAME);

            int supportProgress = Global.progress.SupportPercent;

            string labelColor = "White";
            string valueColor = "Blue";

            if (supportProgress == 100)
            {
                labelColor = "Green";
                valueColor = "Green";
            }

            SuccessLabel     = new TextSprite();
            SuccessLabel.loc = new Vector2(24, 0);
            SuccessLabel.SetFont(Config.UI_FONT, Global.Content, labelColor);
            SuccessLabel.text = "Success";
            SuccessCount      = new RightAdjustedText();
            SuccessCount.loc  = new Vector2(88, 0);
            SuccessCount.SetFont(Config.UI_FONT, Global.Content, valueColor);
            SuccessCount.text = supportProgress.ToString();
            PercentLabel      = new TextSprite();
            PercentLabel.loc  = new Vector2(88, 0);
            PercentLabel.SetFont(Config.UI_FONT, Global.Content, labelColor);
            PercentLabel.text = "%";
        }
예제 #8
0
파일: Game1.cs 프로젝트: BenVillalobos/BLib
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            debugSprite = new Sprite(Content.Load <Texture2D>("JeffCreepyFace"), Vector2.Zero, Color.White);
            debugText   = new TextSprite(Content.Load <SpriteFont>("DebugFont"), "Test", new Vector2(100, 100), Color.Purple);
        }
예제 #9
0
 public override void Dispose()
 {
     text = null;
     icon = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #10
0
        private void remove_lines(int count)
        {
            if (count > Index)
            {
                Index = -1;
                return;
            }

            // Move the oldest lines to the end
            TextSprite[] removed = new TextSprite[count];
            for (int i = 0; i < count; i++)
            {
                removed[i]      = Text[i];
                removed[i].text = "";
                removed[i].clear_text_colors();
            }
            for (int i = 0; i < (Text.Length - count); i++)
            {
                Text[i]       = Text[i + count];
                Text[i].loc.Y = LineY(i);
            }
            for (int i = 0; i < count; i++)
            {
                Text[Text.Length + i - count]       = removed[i];
                Text[Text.Length + i - count].loc.Y = LineY(Text.Length + i - count);
            }
            Index -= count;
        }
예제 #11
0
        private void buttonListAnimation_Click(object sender, EventArgs e)
        {
            AnimatedDecoration listAnimation = new AnimatedDecoration(this.olvSimple);
            Animation          animation     = listAnimation.Animation;

            //Sprite image = new ImageSprite(Resource1.largestar);
            //image.FixedLocation = Locators.SpriteAligned(Corner.MiddleCenter);
            //image.Add(0, 2000, Effects.Rotate(0, 360 * 2f));
            //image.Add(1000, 1000, Effects.Fade(1.0f, 0.0f));
            //animation.Add(0, image);

            Sprite image = new ImageSprite(Resource1.largestar);

            image.Add(0, 500, Effects.Move(Corner.BottomCenter, Corner.MiddleCenter));
            image.Add(0, 500, Effects.Rotate(0, 180));
            image.Add(500, 1500, Effects.Rotate(180, 360 * 2.5f));
            image.Add(500, 1000, Effects.Scale(1.0f, 3.0f));
            image.Add(500, 1000, Effects.Goto(Corner.MiddleCenter));
            image.Add(1000, 900, Effects.Fade(1.0f, 0.0f));
            animation.Add(0, image);

            Sprite text = new TextSprite("Animations!", new Font("Tahoma", 32), Color.Blue, Color.AliceBlue, Color.Red, 3.0f);

            text.Opacity       = 0.0f;
            text.FixedLocation = Locators.SpriteAligned(Corner.MiddleCenter);
            text.Add(900, 900, Effects.Fade(0.0f, 1.0f));
            text.Add(1000, 800, Effects.Rotate(180, 1440));
            text.Add(2000, 500, Effects.Scale(1.0f, 0.5f));
            text.Add(3500, 1000, Effects.Scale(0.5f, 3.0f));
            text.Add(3500, 1000, Effects.Fade(1.0f, 0.0f));
            animation.Add(0, text);

            animation.Start();
        }
예제 #12
0
        public void Go()
        {
            // Load the music and sounds.
            music["mason2"]   = new Music(Path.Combine(Path.Combine(filePath, fileDirectory), "mason2.mid"));
            music["fard-two"] = new Music(Path.Combine(Path.Combine(filePath, fileDirectory), "fard-two.ogg"));
            boing             = new Sound(Path.Combine(Path.Combine(filePath, fileDirectory), "boing.wav"));

            textDisplay = new TextSprite(" ", new SdlDotNet.Graphics.Font(Path.Combine(Path.Combine(filePath, fileDirectory), "FreeSans.ttf"), 20), Color.Red);

            // Start up SDL
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - AudioExample";
            screen = Video.SetVideoMode(width, height);

            // Play the music and setup the queues.
            music["mason2"].Play();
            //music["fard-two"].Play();

            // Set up the music queue and start it
            music["mason2"].QueuedMusic   = music["fard-two"];
            music["fard-two"].QueuedMusic = music["mason2"];
            MusicPlayer.EnableMusicFinishedCallback();

            // Begin the SDL ticker
            Events.Fps = 50;

            textDisplay.Text = SdlDotNetExamplesBrowser.StringManager.GetString(
                "AudioExampleDirections", CultureInfo.CurrentUICulture);
            textDisplay.TextWidth = 200;
            Events.Run();
        }
예제 #13
0
        internal DebugIntDisplay(intFunc update_function, string caption, int places,
                                 Maybe <int> caption_width = default(Maybe <int>))
        {
            UpdateFunction = update_function;
            Places         = places;

            int x = 0;

            //Caption
            CaptionText     = new TextSprite();
            CaptionText.loc = new Vector2(x + 4, 0);
            CaptionText.SetFont(Config.UI_FONT);
            CaptionText.text = caption;
            if (caption_width.IsNothing)
            {
                caption_width = CaptionText.text_width + 8;
                caption_width = ((caption_width + 7) / 8) * 8;
            }
            x += caption_width;
            // Counter
            Text     = new RightAdjustedText();
            Text.loc = new Vector2(x + Places * 8 + 4, 0);
            Text.SetFont(Config.UI_FONT);

            Width = caption_width + (Places + 1) * 8;
        }
예제 #14
0
 public Room_About()
     : base()
 {
     lineTextSprite = new TextSprite(new SdlDotNet.Graphics.Font(Program.VIDEO.fontPath, 10));
     lineTextSprite.BackgroundColor = Color.Black;
     Items.Add(new MenuItem_BackToMainMenu());
 }
예제 #15
0
        public MultiplayerScreen(SpriteBatch sb)
            : base(sb, Color.Chocolate * 0.9f)
        {
            ClearColor.A = 255;

            Name = "MultiPlayer";

            GLibXNASampleGame.Instance.SessionManagement.SessionsFound += new EventHandler <Glib.XNA.NetworkLib.NetworkSessionsFoundEventArgs>(SessionManagement_SessionsFound);
            GLibXNASampleGame.Instance.SessionManagement.SessionJoined += new EventHandler <Glib.XNA.NetworkLib.NetworkSessionJoinedEventArgs>(SessionManagement_SessionJoined);


            //See MainMenu for TextSprite sample comments
            title          = new TextSprite(sb, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Title"), "Networking Sample", Color.Gold);
            title.Position = new Vector2(title.GetCenterPosition(Graphics.Viewport).X, 15);
            AdditionalSprites.Add(title);

            hostSession             = new TextSprite(sb, new Vector2(0, title.Y + title.Height + 5), GLibXNASampleGame.Instance.Content.Load <SpriteFont>("MenuItem"), "Host Session", Color.MediumSpringGreen);
            hostSession.X           = hostSession.GetCenterPosition(Graphics.Viewport).X;
            hostSession.IsHoverable = true;
            hostSession.HoverColor  = Color.SpringGreen;
            hostSession.Pressed    += new EventHandler(hostSession_Pressed);
            AdditionalSprites.Add(hostSession);

            joinSession             = new TextSprite(sb, new Vector2(0, hostSession.Y + hostSession.Height + 5), GLibXNASampleGame.Instance.Content.Load <SpriteFont>("MenuItem"), "Join Session", Color.MediumSpringGreen);
            joinSession.X           = joinSession.GetCenterPosition(Graphics.Viewport).X;
            joinSession.IsHoverable = true;
            joinSession.HoverColor  = Color.SpringGreen;
            joinSession.Pressed    += new EventHandler(joinSession_Pressed);
            AdditionalSprites.Add(joinSession);
        }
예제 #16
0
        public DrawableTournamentHeaderText()
        {
            InternalChild = new TextSprite();

            Height           = 22;
            RelativeSizeAxes = Axes.X;
        }
예제 #17
0
        //private bool isEnd = false;

        public Healing(int value, Vector2D position, AutoDisposer autoDisposer)
        {
            this.SetupUpdateAndAutoDispose(autoDisposer);
            this.position = position;

            {
                var font = new Font(
                    Config.MainConfig.MainFontPath,
                    35,
                    new Color(1, 1, 1, 1),
                    new Font.FontFrame[] {
                    new Font.FontFrame(5, new Color(1, 1, 1, 1.0)),
                    new Font.FontFrame(5, new Color(1, 0.2, 0.5, 1.0))
                },
                    0);
                var x  = position.X;
                var y  = position.Y;
                var ts = new TextSprite(value.ToString(), font, new Vector2D(x, y));
                layer.Add(ts, 20);

                ts.Rect.Position.X -= ts.GetRect().Size.X / 2;

                textSprite = ts;
            }
        }
예제 #18
0
        public override void RefreshViewHP()
        {
            {
                var font = new Font(Config.MainConfig.MainFontPath, 12, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite($"{character.HP.Now}/{character.HP.Max}", font, new Vector2D(0, 0));
                //var ts = new TextSprite( $"{character.HP.Now}/{character.HP.Max}", "data/font/ -mgenplus-1cp-medium.ttf", 12, new Vector2D(0, 0), new Color(1, 1, 1, 1));
                layer.Add(ts, 20);

                if (mySprites.ViewStatus != null)
                {
                    layer.Del(mySprites.ViewStatus);
                }
                mySprites.ViewStatus = ts;
            }

            if (character.HP.Now == 0)
            {
                mySprites.face.Color = new Color(1.0, 0.5, 0.5, 0.5);
            }
            else
            {
                mySprites.face.Color = new Color(1.0, 1, 1, 1);
            }

            SetPosition(this.position);
        }
예제 #19
0
 public override void Dispose()
 {
     Text    = null;
     Clicked = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #20
0
        /// <summary>
        /// Creates and initializes the video player sample screen.
        /// </summary>
        /// <param name="spriteBatch">The <see cref="SpriteBatch"/> to render to.</param>
        public VideoPlayerScreen(SpriteBatch spriteBatch)
            : base(spriteBatch, Color.DarkGray)
        {
            Name = "VideoPlayer";

            //Reduces the ARGB values, then resets alpha to 255
            ClearColor  *= 1f / 6f;
            ClearColor.A = 255;

            //See MainMenu for TextSprite sample comments
            title          = new TextSprite(spriteBatch, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Title"), "VideoPlayer Sample", Color.PaleGoldenrod);
            title.Position = new Vector2(title.GetCenterPosition(spriteBatch.GraphicsDevice.Viewport).X, 15);
            AdditionalSprites.Add(title);

            escapeReturnDesc          = new TextSprite(spriteBatch, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Details"), "Press escape\nto return to\nthe main menu", Color.PaleGoldenrod);
            escapeReturnDesc.Position = new Vector2(3);
            AdditionalSprites.Add(escapeReturnDesc);

            //This event is fired when a key is pressed
            KeyboardManager.KeyDown += new SingleKeyEventHandler(KeyboardManager_KeyDown);

            creditTextSprite          = new TextSprite(spriteBatch, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Details"), "Video obtained from nps.gov/cany/planyourvisit/rivervideos.htm", Color.Goldenrod);
            creditTextSprite.Color.A  = 32;
            creditTextSprite.Position = new Vector2(creditTextSprite.GetCenterPosition(spriteBatch.GraphicsDevice.Viewport).X, spriteBatch.GraphicsDevice.Viewport.Height - creditTextSprite.Height - 5);
            AdditionalSprites.Add(creditTextSprite);

            //VideoSprite: Like a sprite, but displays a video
            video = new VideoSprite(GLibXNASampleGame.Instance.Content.Load <Video>("VideoSample"), Vector2.Zero, spriteBatch);
            video.Video.Stop();
            video.Position = video.GetCenterPosition(spriteBatch.GraphicsDevice.Viewport);
            Sprites.Add(video);
        }
예제 #21
0
 public Item_Display()
 {
     Icon      = new Icon_Sprite();
     Icon.size = new Vector2(Config.ITEM_ICON_SIZE, Config.ITEM_ICON_SIZE);
     Name      = new TextSprite();
     Name.SetFont(Config.UI_FONT);
 }
예제 #22
0
        public BlueprintButton(string c1, string c1N, string c2, string c2N, string res, string resname,
                               IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Compo1     = c1;
            Compo1Name = c1N;

            Compo2     = c2;
            Compo2Name = c2N;

            Result     = res;
            ResultName = resname;

            _icon = _resourceManager.GetSprite("blueprint");

            Label = new TextSprite("blueprinttext", "", _resourceManager.GetFont("CALIBRI"))
            {
                Color        = Color.GhostWhite,
                ShadowColor  = Color.DimGray,
                ShadowOffset = new Vector2D(1, 1),
                Shadowed     = true
            };

            Update(0);
        }
예제 #23
0
        internal StatusHpUINode(
            string helpLabel,
            string label,
            Func <Game_Unit, string> statFormula,
            Func <Game_Unit, string> maxStatFormula,
            Func <Game_Unit, Color> labelHueFormula)
            : base(helpLabel, label, statFormula, 32)
        {
            MaxStatFormula  = maxStatFormula;
            LabelHueFormula = labelHueFormula;

            if (LabelHueFormula != null)
            {
                Label.SetColor(Global.Content, "StatHueWhite");
            }

            SlashLabel             = new TextSprite();
            SlashLabel.draw_offset = new Vector2(32, 0);
            SlashLabel.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            SlashLabel.text = "/";

            MaxHpText             = new RightAdjustedText();
            MaxHpText.draw_offset = new Vector2(32 + 24, 0);
            MaxHpText.SetFont(Config.UI_FONT, Global.Content, "Blue");

            Size = new Vector2(32 + 24, 16);
        }
예제 #24
0
        public Listbox(int dropDownLength, int width, IResourceManager resourceManager,
                       List <string> initialOptions = null)
        {
            _resourceManager = resourceManager;

            _width        = width;
            _listboxLeft  = _resourceManager.GetSprite("button_left");
            _listboxMain  = _resourceManager.GetSprite("button_middle");
            _listboxRight = _resourceManager.GetSprite("button_right");

            _selectedLabel = new TextSprite("ListboxLabel", "", _resourceManager.GetFont("CALIBRI"))
            {
                Color = Color.Black
            };

            _dropDown = new ScrollableContainer("ListboxContents", new Size(width, dropDownLength), _resourceManager);
            _dropDown.SetVisible(false);

            if (initialOptions != null)
            {
                _contentStrings = initialOptions;
                RebuildList();
            }

            Update(0);
        }
예제 #25
0
        public HealthScannerWindow(Entity assignedEnt, Vector2D mousePos, UserInterfaceManager uiMgr,
                                   IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            assigned = assignedEnt;
            _uiMgr = uiMgr;

            _overallHealth = new TextSprite("hpscan" + assignedEnt.Uid.ToString(), "",
                                            _resourceManager.GetFont("CALIBRI"));
            _overallHealth.Color = Color.ForestGreen;

            _background = _resourceManager.GetSprite("healthscan_bg");

            _head = _resourceManager.GetSprite("healthscan_head");
            _chest = _resourceManager.GetSprite("healthscan_chest");
            _arml = _resourceManager.GetSprite("healthscan_arml");
            _armr = _resourceManager.GetSprite("healthscan_armr");
            _groin = _resourceManager.GetSprite("healthscan_groin");
            _legl = _resourceManager.GetSprite("healthscan_legl");
            _legr = _resourceManager.GetSprite("healthscan_legr");

            Position = new Point((int) mousePos.X, (int) mousePos.Y);

            Setup();
            Update(0);
        }
        public HealthScannerWindow(Entity assignedEnt, Vector2 mousePos, UserInterfaceManager uiMgr,
                                   IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            assigned         = assignedEnt;
            _uiMgr           = uiMgr;

            _overallHealth = new TextSprite("hpscan" + assignedEnt.Uid.ToString(), "",
                                            _resourceManager.GetFont("CALIBRI"));
            _overallHealth.Color = Color.ForestGreen;

            _background = _resourceManager.GetSprite("healthscan_bg");

            _head  = _resourceManager.GetSprite("healthscan_head");
            _chest = _resourceManager.GetSprite("healthscan_chest");
            _arml  = _resourceManager.GetSprite("healthscan_arml");
            _armr  = _resourceManager.GetSprite("healthscan_armr");
            _groin = _resourceManager.GetSprite("healthscan_groin");
            _legl  = _resourceManager.GetSprite("healthscan_legl");
            _legr  = _resourceManager.GetSprite("healthscan_legr");

            Position = new Point((int)mousePos.X, (int)mousePos.Y);

            Setup();
            Update(0);
        }
예제 #27
0
        internal Prep_Items_Help_Footer()
        {
            texture = Global.Content.Load <Texture2D>("Graphics/White_Square");
            tint    = new Color(0, 0, 0, 128);
            scale   = new Vector2(Config.WINDOW_WIDTH / (float)texture.Width,
                                  16f / texture.Height);

            Type_Icon     = new Weapon_Type_Icon();
            Type_Icon.loc = new Vector2(16, 0);

            for (int i = 0; i < 4; i++)
            {
                Stat_Labels.Add(new TextSprite());
                Stat_Labels[i].loc = new Vector2(56 + i * 56, 0);
                Stat_Labels[i].SetFont(Config.UI_FONT, Global.Content, "Yellow");
            }
            Stat_Labels[0].text = "Atk";
            Stat_Labels[1].text = "Crit";
            Stat_Labels[2].text = "Hit";
            Stat_Labels[3].text = "AS";

            Stats.Add(new TextSprite());
            Stats[0].loc = new Vector2(32, 0);
            Stats[0].SetFont(Config.UI_FONT + "L", Global.Content, "Blue", Config.UI_FONT);
            for (int i = 1; i < 5; i++)
            {
                Stats.Add(new RightAdjustedText());
                Stats[i].loc = new Vector2(40 + i * 56, 0);
                Stats[i].SetFont(Config.UI_FONT, Global.Content, "Blue");
            }

            QuickDescrip     = new TextSprite();
            QuickDescrip.loc = new Vector2(16, 0);
            QuickDescrip.SetFont(Config.UI_FONT, Global.Content, "White");
        }
예제 #28
0
 public Slider(Slider g)
     : base(g)
 {
     image_ = (Sprite)g.image_.Clone();
     value  = g.value;
     text   = (TextSprite)g.text.Clone();
 }
예제 #29
0
 protected void initialize_images()
 {
     // Window
     Window        = new SystemWindowHeadered();
     Window.width  = this.window_width;
     Window.height = 48;
     // Target Sprite
     Target_Sprite              = new Character_Sprite();
     Target_Sprite.draw_offset  = new Vector2(20, 24);
     Target_Sprite.facing_count = 3;
     Target_Sprite.frame_count  = 3;
     // Names
     Name = new TextSprite();
     Name.SetFont(Config.UI_FONT, Global.Content, "White");
     // Stat Labels
     Stat_Labels = new List <TextSprite>();
     for (int i = 0; i < 1; i++)
     {
         Stat_Labels.Add(new TextSprite());
         Stat_Labels[i].offset = new Vector2(-8, -(24 + (i * 16)));
         Stat_Labels[i].SetFont(Config.UI_FONT, Global.Content, "Yellow");
     }
     Stat_Labels[0].SetFont(Config.UI_FONT + "L", Config.UI_FONT);
     Stat_Labels[0].text = "HP";
     set_images();
 }
예제 #30
0
파일: Game1.cs 프로젝트: mohammedmjr/GLib
        void session_GamerJoined(object sender, GamerJoinedEventArgs e)
        {
            Screen    playerList    = allScreens["playerList"];
            Texture2D newGamerImage = new TextureFactory(GraphicsDevice).CreateSquare(64, Color.Red);

            try
            {
                newGamerImage = Texture2D.FromStream(GraphicsDevice, e.Gamer.GetProfile().GetGamerPicture());
            }
            catch { };
            Vector2 pos = new Vector2(100, 50);

            foreach (Sprite s in playerList.Sprites)
            {
                pos.Y += s.Height + 5;
            }
            Sprite gamerIcon = new Sprite(newGamerImage, pos, spriteBatch);

            playerList.Sprites.Add(gamerIcon);
            TextSprite gamerName = new TextSprite(spriteBatch, new Vector2(pos.X + gamerIcon.Width + 5, pos.Y), font, e.Gamer.Gamertag);

            allScreens["playerList"].AdditionalSprites.Add(gamerName);
            if (session.AllGamers.Count >= 2 && session.IsHost)
            {
                //TODO
                session.StartGame();
            }
        }
예제 #31
0
        public BlueprintButton(string c1, string c1N, string c2, string c2N, string res, string resname,
                               IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Compo1 = c1;
            Compo1Name = c1N;

            Compo2 = c2;
            Compo2Name = c2N;

            Result = res;
            ResultName = resname;

            _icon = _resourceManager.GetSprite("blueprint");

            Label = new TextSprite("blueprinttext", "", _resourceManager.GetFont("CALIBRI"))
                        {
                            Color = Color.GhostWhite,
                            ShadowColor = Color.DimGray,
                            ShadowOffset = new Vector2D(1, 1),
                            Shadowed = true
                        };

            Update(0);
        }
 protected virtual void initialize_label(string label)
 {
     Label             = new TextSprite();
     Label.draw_offset = new Vector2(0, 0);
     Label.SetFont(Config.UI_FONT, Global.Content, "Yellow");
     set_label(label);
 }
예제 #33
0
 public override void Dispose()
 {
     Label = null;
     _icon = null;
     Clicked = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #34
0
파일: Label.cs 프로젝트: Gartley/ss13remake
        public Label(string text, string font, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Text = new TextSprite("Label" + text, text, _resourceManager.GetFont(font)) {Color = Color.Black};

            Update(0);
        }
예제 #35
0
 public NetworkGrapher(IResourceManager resourceManager, INetworkManager networkManager)
 {
     _resourceManager = resourceManager;
     _networkManager = networkManager;
     _dataPoints = new List<NetworkStatisticsDataPoint>();
     _lastDataPointTime = DateTime.Now;
     _textSprite = new TextSprite("NetGraphText", "", _resourceManager.GetFont("base_font"));
 }
예제 #36
0
 public override void Dispose()
 {
     _descriptionTextSprite = null;
     _buttonSprite = null;
     _jobSprite = null;
     Clicked = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #37
0
 public override void Dispose()
 {
     Label = null;
     _buttonLeft = null;
     _buttonMain = null;
     _buttonRight = null;
     Clicked = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #38
0
        public void Startup()
        {
            UserInterfaceManager.DisposeAllComponents();

            NetworkManager.MessageArrived += NetworkManagerMessageArrived;

            _lobbyChat = new Chatbox(ResourceManager, UserInterfaceManager, KeyBindingManager);
            _lobbyChat.TextSubmitted += LobbyChatTextSubmitted;

            _lobbyChat.Update(0);

            UserInterfaceManager.AddComponent(_lobbyChat);

            _lobbyText = new TextSprite("lobbyText", "", ResourceManager.GetFont("CALIBRI"))
                             {
                                 Color = Color.Black,
                                 ShadowColor = Color.DimGray,
                                 Shadowed = true,
                                 ShadowOffset = new Vector2D(1, 1)
                             };

            NetOutgoingMessage message = NetworkManager.CreateMessage();
            message.Write((byte) NetMessage.WelcomeMessage); //Request Welcome msg.
            NetworkManager.SendMessage(message, NetDeliveryMethod.ReliableOrdered);

            NetworkManager.SendClientName(ConfigurationManager.GetPlayerName()); //Send name.

            NetOutgoingMessage playerListMsg = NetworkManager.CreateMessage();
            playerListMsg.Write((byte) NetMessage.PlayerList); //Request Playerlist.
            NetworkManager.SendMessage(playerListMsg, NetDeliveryMethod.ReliableOrdered);

            _playerListTime = DateTime.Now.AddSeconds(PlayerListRefreshDelaySec);

            NetOutgoingMessage jobListMsg = NetworkManager.CreateMessage();
            jobListMsg.Write((byte) NetMessage.JobList); //Request Joblist.
            NetworkManager.SendMessage(jobListMsg, NetDeliveryMethod.ReliableOrdered);

            var joinButton = new Button("Join Game", ResourceManager) {mouseOverColor = Color.LightSteelBlue};
            joinButton.Position = new Point(605 - joinButton.ClientArea.Width - 5,
                                            200 - joinButton.ClientArea.Height - 5);
            joinButton.Clicked += JoinButtonClicked;

            UserInterfaceManager.AddComponent(joinButton);

            _jobButtonContainer = new ScrollableContainer("LobbyJobCont", new Size(375, 400), ResourceManager)
                                      {
                                          Position = new Point(630, 10)
                                      };

            UserInterfaceManager.AddComponent(_jobButtonContainer);

            Gorgon.CurrentRenderTarget.Clear();
        }
예제 #39
0
        public Textbox(int width, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            _textboxLeft = _resourceManager.GetSprite("text_left");
            _textboxMain = _resourceManager.GetSprite("text_middle");
            _textboxRight = _resourceManager.GetSprite("text_right");

            Width = width;

            Label = new TextSprite("Textbox", "", _resourceManager.GetFont("CALIBRI")) {Color = Color.Black};

            Update(0);
        }
예제 #40
0
        public Progress_Bar(Size size, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            Text = new TextSprite("ProgressBarText", "", _resourceManager.GetFont("CALIBRI"));
            Text.Color = Color.Black;
            Text.ShadowColor = Color.DimGray;
            Text.ShadowOffset = new Vector2D(1, 1);
            Text.Shadowed = true;

            Size = size;

            Update(0);
        }
예제 #41
0
        public Button(string buttonText, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            _buttonLeft = _resourceManager.GetSprite("button_left");
            _buttonMain = _resourceManager.GetSprite("button_middle");
            _buttonRight = _resourceManager.GetSprite("button_right");

            Label = new TextSprite("ButtonLabel" + buttonText, buttonText, _resourceManager.GetFont("CALIBRI"))
                        {
                            Color = Color.Black
                        };

            Update(0);
        }
예제 #42
0
        public int size = 300; //Graphical length of the bar.

        public Scrollbar(bool horizontal, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            Horizontal = horizontal;
            if (Horizontal) scrollbarButton = _resourceManager.GetSprite("scrollbutton_h");
            else scrollbarButton = _resourceManager.GetSprite("scrollbutton_v");

            DEBUG = new TextSprite("DEBUGSLIDER", "Position:", _resourceManager.GetFont("CALIBRI"));
            DEBUG.Color = Color.OrangeRed;
            DEBUG.ShadowColor = Color.DarkBlue;
            DEBUG.Shadowed = true;
            DEBUG.ShadowOffset = new Vector2D(1, 1);
            Update(0);
        }
예제 #43
0
        public JobSelectButton(string text, string spriteName, string description, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            _buttonSprite = _resourceManager.GetSprite("job_button");
            _jobSprite = _resourceManager.GetSprite(spriteName);

            _descriptionTextSprite = new TextSprite("JobButtonDescLabel" + text, text + ":\n" + description,
                                                    _resourceManager.GetFont("CALIBRI"))
                                         {
                                             Color = Color.Black,
                                             ShadowColor = Color.DimGray,
                                             Shadowed = true,
                                             ShadowOffset = new Vector2D(1, 1)
                                         };

            Update(0);
        }
예제 #44
0
        public StatusEffectButton(StatusEffect _assigned, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            _buttonSprite = _resourceManager.GetSprite(_assigned.icon);
            assignedEffect = _assigned;
            Color = Color.White;

            timeLeft = new TextSprite("timeleft" + _assigned.uid.ToString() + _assigned.name, "",
                                      _resourceManager.GetFont("CALIBRI"));
            timeLeft.Color = Color.White;
            timeLeft.ShadowColor = Color.Gray;
            timeLeft.ShadowOffset = new Vector2D(1, 1);
            timeLeft.Shadowed = true;

            tooltip = new TextSprite("tooltip" + _assigned.uid.ToString() + _assigned.name, "",
                                     _resourceManager.GetFont("CALIBRI"));
            tooltip.Color = Color.Black;

            Update(0);
        }
예제 #45
0
        public PhoneApp(int type, SmartPhone phone, int consumeRate, Entity owner = null, string Title = "")
            : base(type, -1, owner)
        {
            this.ConsumeRate = consumeRate;
            this.phone = phone;
            this.ActiveEffects = new ItemEffect[0];
            this.PassiveEffects = new ItemEffect[0];

            //This container allows the TextSprite to be centred
            UIContainer PageTitleContainer = new UIContainer(Color.White, Color.White, Width: SmartPhone.SCREEN_RECT.Width, CursorType: CursorType.Cursor, MarginTop: 10, MarginBottom: 10, CentreHorizontal: true);

            TextSprite PageTitle = new TextSprite(Title, 2, Color.White, SmartPhone.SCREEN_RECT.Width, CursorType: CursorType.Cursor);

            PageTitleContainer.AddElement(PageTitle);
            HUD = new UIGrid(Width: SmartPhone.SCREEN_RECT.Width, Height: SmartPhone.SCREEN_RECT.Height, CursorType: CursorType.Cursor, GridColumns: 1, ColWidth: SmartPhone.SCREEN_RECT.Width);
            HUD.AddElement(PageTitleContainer);

            PageContent = new UIGrid(Width: SmartPhone.SCREEN_RECT.Width, Height: SmartPhone.SCREEN_RECT.Height - PageTitleContainer.Height, CursorType: CursorType.Cursor, GridColumns: 1, ColWidth: SmartPhone.SCREEN_RECT.Width);
            HUD.AddElement(PageContent);
        }
예제 #46
0
        public ArmorInfoLabel(DamageType resistance, IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;
            resAssigned = resistance;

            text = new TextSprite("StatInfoLabel" + resistance, "", _resourceManager.GetFont("CALIBRI"))
                       {Color = Color.White};

            switch (resistance)
            {
                case DamageType.Bludgeoning:
                    icon = resourceManager.GetSprite("res_blunt");
                    break;
                case DamageType.Burn:
                    icon = resourceManager.GetSprite("res_burn");
                    break;
                case DamageType.Freeze:
                    icon = resourceManager.GetSprite("res_freeze");
                    break;
                case DamageType.Piercing:
                    icon = resourceManager.GetSprite("res_pierce");
                    break;
                case DamageType.Shock:
                    icon = resourceManager.GetSprite("res_shock");
                    break;
                case DamageType.Slashing:
                    icon = resourceManager.GetSprite("res_slash");
                    break;
                case DamageType.Suffocation:
                    icon = resourceManager.GetSprite("statusbar_switch");
                    break;
                case DamageType.Toxin:
                    icon = resourceManager.GetSprite("res_tox");
                    break;
                case DamageType.Untyped:
                    icon = resourceManager.GetSprite("statusbar_switch");
                    break;
            }

            Update(0);
        }
예제 #47
0
        public PlayerActionButton(IPlayerAction _assigned, IResourceManager resourceManager)
        {
            UiMgr = IoCManager.Resolve<IUserInterfaceManager>();
            _resourceManager = resourceManager;

            _buttonSprite = _resourceManager.GetSprite(_assigned.Icon);
            assignedAction = _assigned;
            Color = Color.White;

            timeLeft = new TextSprite("cooldown" + _assigned.Uid.ToString() + _assigned.Name, "",
                                      _resourceManager.GetFont("CALIBRI"));
            timeLeft.Color = Color.NavajoWhite;
            timeLeft.ShadowColor = Color.Black;
            timeLeft.ShadowOffset = new Vector2D(1, 1);
            timeLeft.Shadowed = true;

            tooltip = new TextSprite("tooltipAct" + _assigned.Uid.ToString() + _assigned.Name, "",
                                     _resourceManager.GetFont("CALIBRI"));
            tooltip.Color = Color.Black;

            Update(0);
        }
예제 #48
0
        public SpeechBubble(string mobname)
        {
            _resourceManager = IoCManager.Resolve<IResourceManager>();
            _mobName = mobname;
            _buildTime = DateTime.Now;
            _textSprite = new TextSprite
                (
                "chatBubbleTextSprite_" + _mobName,
                String.Empty,
                _resourceManager.GetFont("CALIBRI")
                )
                              {
                                  Color = Color.Black,
                                  WordWrap = true
                              };

            _textSprite.SetPosition(5, 3);
            _stringBuilder = new StringBuilder();

            _bubbleRender = new RenderImage("ChatBubbleRenderImage_" + _mobName, 1, 1, ImageBufferFormats.BufferRGB888A8);
            _bubbleSprite = new Sprite("ChatBubbleRenderSprite_" + _mobName, _bubbleRender);
        }
예제 #49
0
        public EquipmentSlotUi(EquipmentSlot slot, IPlayerManager playerManager, IResourceManager resourceManager,
                               IUserInterfaceManager userInterfaceManager)
        {
            _playerManager = playerManager;
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;

            _color = Color.White;

            AssignedSlot = slot;
            _buttonSprite = _resourceManager.GetSprite("slot");
            _textSprite = new TextSprite(slot + "UIElementSlot", slot.ToString(),
                                         _resourceManager.GetFont("CALIBRI"))
                              {
                                  ShadowColor = Color.Black,
                                  ShadowOffset = new Vector2D(1, 1),
                                  Shadowed = true,
                                  Color = Color.White
                              };

            Update(0);
        }
예제 #50
0
        public EntitySpawnSelectButton(EntityTemplate entityTemplate, string templateName,
                                       IResourceManager resourceManager)
        {
            _resourceManager = resourceManager;

            var spriteNameParam = entityTemplate.GetBaseSpriteParamaters().FirstOrDefault();
            string SpriteName = "";
            if (spriteNameParam != null)
            {
                SpriteName = spriteNameParam.GetValue<string>();
            }
            string ObjectName = entityTemplate.Name;

            associatedTemplate = entityTemplate;
            associatedTemplateName = templateName;

            objectSprite = _resourceManager.GetSprite(SpriteName);

            font = _resourceManager.GetFont("CALIBRI");
            name = new TextSprite("Label" + SpriteName, "Name", font);
            name.Color = Color.Black;
            name.Text = ObjectName;
        }
예제 #51
0
        public Listbox(int dropDownLength, int width, IResourceManager resourceManager,
                       List<string> initialOptions = null)
        {
            _resourceManager = resourceManager;

            _width = width;
            _listboxLeft = _resourceManager.GetSprite("button_left");
            _listboxMain = _resourceManager.GetSprite("button_middle");
            _listboxRight = _resourceManager.GetSprite("button_right");

            _selectedLabel = new TextSprite("ListboxLabel", "", _resourceManager.GetFont("CALIBRI"))
                                 {Color = Color.Black};

            _dropDown = new ScrollableContainer("ListboxContents", new Size(width, dropDownLength), _resourceManager);
            _dropDown.SetVisible(false);

            if (initialOptions != null)
            {
                _contentStrings = initialOptions;
                RebuildList();
            }

            Update(0);
        }
예제 #52
0
 public override void Dispose()
 {
     _contentStrings.Clear();
     _dropDown.Dispose();
     _dropDown = null;
     _selectedLabel = null;
     _listboxLeft = null;
     _listboxMain = null;
     _listboxRight = null;
     ItemSelected = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
        private void Process(DrawContainer draw, int i, Pair item, int total)
        {
            int value = (int)item.Second;
            double angleplus = 360 * value * 1.0 / total;
            double popangle = this.angle + (angleplus / 2);
            System.Drawing.Color color = this.ColorFromHSL(this.start, 0.5, 0.5);
            int delta = 30;
            System.Drawing.Color bcolor = this.ColorFromHSL(this.start, 1, 0.5);
            int r = 200;
            double rad = Math.PI / 180;

            draw.Gradients.Add(new LinearGradient
            {
                Degrees = 90,
                GradientID = "Grd" + i,
                Stops = {
                    new GradientStop{Offset = 0, Color = System.Drawing.ColorTranslator.ToHtml(bcolor)},
                    new GradientStop{Offset = 100, Color = System.Drawing.ColorTranslator.ToHtml(color)}
                }
            });

            AbstractSprite sector = this.Sector(250, 250, r, this.angle, this.angle + angleplus);
            sector.FillStyle = "url(#Grd" + i + ")";
            sector.StrokeStyle = "#fff";
            sector.LineWidth = 3;

            draw.Items.Add(sector);

            TextSprite text = new TextSprite
            {
                SpriteID = "text" + i,
                X = Convert.ToInt32(350 + (r + delta + 55) * Math.Cos(-popangle * rad)),
                Y = Convert.ToInt32(350 + (r + delta + 25) * Math.Sin(-popangle * rad)),
                Text = item.First.ToString(),
                FillStyle = System.Drawing.ColorTranslator.ToHtml(bcolor),
                StrokeStyle = "none",
                GlobalAlpha = 0,
                FontSize = "20"
            };

            draw.Items.Add(text);

            //sector.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0});", i);
            //sector.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i);

            this.angle += angleplus;
            this.start += 0.1;
        }
예제 #54
0
        /// <summary>
        /// Create a sprite copy of the current state of this text object
        /// </summary>
        /// <returns>A new sprite</returns>
        public TextSprite CreateSprite()
        {
            if (Dirty)
            {
                ProcessText();
            }
            Vector2 screenPos = this.ScreenPosition;
            Vector2 pos = this.Game.PixelToPosition((int)screenPos.X, (int)screenPos.Y);
            float PixelScale = 200f / (float)this.Game.GraphicsDevice.Viewport.Height;
            TextSprite textSprite = new TextSprite
            {
                Costume = new Costume
                {
                    Name = "TextSprite",
                },
                Layer = this.Layer,
                Position = this.Position, // pos,
                Scale = PixelScale // 1f / (this.ScaleToDraw) //todo
            };
            var customTexture = new RenderTarget2D(this.Game.GraphicsDevice, (int)this.Size.X, (int)this.Size.Y);
            textSprite.Costume.Texture = customTexture;
            textSprite.Costume.XCenter = this.Alignment;
            switch (this.VerticalAlign)
            {
                case VerticalAlignments.Top:
                    textSprite.Costume.YCenter = VerticalAlignments.Top;
                    break;
                case VerticalAlignments.Center:
                    textSprite.Costume.YCenter = VerticalAlignments.Center;
                    break;
                case VerticalAlignments.Bottom:
                    textSprite.Costume.YCenter = VerticalAlignments.Bottom;
                    break;
            }

            // Set render target
            this.Game.GraphicsDevice.SetRenderTarget(customTexture);

            // Copy the current costume
            this.Game.spriteBatch.Begin();
            this.Game.GraphicsDevice.Clear(Color.Transparent);
            this.Game.spriteBatch.DrawString(
                Font,
                ValueToDraw,
                Vector2.Zero,
                Color,
                Rotation,
                Vector2.Zero,
                ScaleToDraw * FontScale,
                SpriteEffects.None,
                Depth
                );
            this.Game.spriteBatch.End();

            // Unset render target
            this.Game.GraphicsDevice.SetRenderTarget(null);

            return textSprite;
        }
예제 #55
0
 public override void Dispose()
 {
     text = null;
     icon = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #56
0
 public override void Dispose()
 {
     Label = null;
     _textboxLeft = null;
     _textboxMain = null;
     _textboxRight = null;
     OnSubmit = null;
     base.Dispose();
     GC.SuppressFinalize(this);
 }
예제 #57
0
		/// <summary>
		/// Handles the Load event of the MainForm control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		private void MainForm_Load(object sender, EventArgs e)
		{
			try
			{
				// Initialize the library.
				Gorgon.Initialize();

				// Display the logo and frame stats.
				Gorgon.LogoVisible = false;
				Gorgon.FrameStatsVisible = false;

				// Set the video mode to match the form client area.
				Gorgon.SetMode(this);

				// Assign rendering event handler.
				Gorgon.Idle += new FrameEventHandler(Screen_OnFrameBegin);

				// Set the clear color to something ugly.
				Gorgon.Screen.BackgroundColor = Color.FromArgb(250, 245, 220);

			    LoadFont();

                txtspr = new TextSprite("txtspr", "Test", font, Color.Black);

                txtspr.SetPosition(1.0f,1.0f);
			    TextStatus();

			    RunMeasureLineTests();
				// Begin execution.
				Gorgon.Go();
			}
			catch (Exception ex)
			{
				UI.ErrorBox(this, "An unhandled error occured during execution, the program will now close.", ex.Message + "\n\n" + ex.StackTrace);
				Application.Exit();
			}
		}
예제 #58
0
 private void RefreshText(string text)
 {
     GorgonLibrary.Graphics.Font font;
     if (string.IsNullOrEmpty(_font))
     {
         font = FontManager.GetDefaultFont();
     }
     else
     {
         font = FontManager.GetFont(_font);
     }
     _textSprite = new TextSprite("Arial", text, font, _color);
     if (!_outlineColor.IsEmpty)
     {
         _textSprite.ShadowColor = _outlineColor;
         _textSprite.ShadowDirection = FontShadowDirection.LowerRight;
         _textSprite.Shadowed = true;
     }
     SetAlignment(_isRightAligned);
     Text = text;
 }
예제 #59
0
        public bool Initialize(int xPos, int yPos, int width, int height, bool wrapText, bool allowScrollbar, string name, Random r, out string reason)
        {
            //If using scrollbar, then shrink the actual width by 16 to allow for scrollbar, even if it's not visible
            _x = xPos;
            _y = yPos;
            _maxWidth = width;
            Width = width;
            Height = height == 0 ? 1 : height;
            _wrapText = wrapText;
            _scrollbarVisible = false;
            _textScrollBar = new BBScrollBarNoArrows();
            _allowScrollbar = allowScrollbar;
            if (_allowScrollbar)
            {
                if (_wrapText)
                {
                    if (!_textScrollBar.Initialize(xPos + _maxWidth - 5, yPos, Height, Height, 1, false, false, r, out reason))
                    {
                        return false;
                    }
                    _wrapView = new Viewport(0, 0, _maxWidth - 5, Height);

                    _target = new RenderImage(name + "render", _maxWidth - 5, Height, ImageBufferFormats.BufferRGB888A8);
                }
                else
                {
                    if (!_textScrollBar.Initialize(xPos, yPos + Height - 5, _maxWidth, _maxWidth, 1, true, false, r, out reason))
                    {
                        return false;
                    }
                    _wrapView = new Viewport(0, 0, _maxWidth, Height - 5);

                    _target = new RenderImage(name + "render", _maxWidth, Height - 5, ImageBufferFormats.BufferRGB888A8);
                }
            }
            else
            {
                _wrapView = new Viewport(0, 0, _maxWidth, Height);

                _target = new RenderImage(name + "render", _maxWidth, Height, ImageBufferFormats.BufferRGB888A8);
            }
            _textSprite = new TextSprite(name, string.Empty, FontManager.GetDefaultFont());
            _textSprite.WordWrap = _wrapText;
            if (_allowScrollbar || _wrapText)
            {
                _textSprite.Bounds = _wrapView;
            }
            _target.BlendingMode = BlendingModes.Modulated;
            reason = null;
            return true;
        }
예제 #60
0
        public HumanComboGui(IPlayerManager playerManager, INetworkManager networkManager,
                             IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager)
        {
            _networkManager = networkManager;
            _playerManager = playerManager;
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;

            ComponentClass = GuiComponentType.ComboGui;

            #region Status UI

            _ResBlunt = new ArmorInfoLabel(DamageType.Bludgeoning, resourceManager);
            _ResBurn = new ArmorInfoLabel(DamageType.Burn, resourceManager);
            _ResFreeze = new ArmorInfoLabel(DamageType.Freeze, resourceManager);
            _ResPierce = new ArmorInfoLabel(DamageType.Piercing, resourceManager);
            _ResShock = new ArmorInfoLabel(DamageType.Shock, resourceManager);
            _ResSlash = new ArmorInfoLabel(DamageType.Slashing, resourceManager);
            _ResTox = new ArmorInfoLabel(DamageType.Toxin, resourceManager);

            #endregion

            _equipBg = _resourceManager.GetSprite("outline");

            _comboBg = _resourceManager.GetSprite("combo_bg");

            _comboClose = new ImageButton
                              {
                                  ImageNormal = "button_closecombo",
                              };

            _tabEquip = new ImageButton
                            {
                                ImageNormal = "tab_equip",
                            };
            _tabEquip.Clicked += TabClicked;

            _tabHealth = new ImageButton
                             {
                                 ImageNormal = "tab_health",
                             };
            _tabHealth.Clicked += TabClicked;

            _tabCraft = new ImageButton
                            {
                                ImageNormal = "tab_craft",
                            };
            _tabCraft.Clicked += TabClicked;

            _comboClose.Clicked += ComboCloseClicked;

            //Left Side - head, eyes, outer, hands, feet
            _slotHead = new EquipmentSlotUi(EquipmentSlot.Head, _playerManager, _resourceManager, _userInterfaceManager);
            _slotHead.Dropped += SlotDropped;

            _slotEyes = new EquipmentSlotUi(EquipmentSlot.Eyes, _playerManager, _resourceManager, _userInterfaceManager);
            _slotEyes.Dropped += SlotDropped;

            _slotOuter = new EquipmentSlotUi(EquipmentSlot.Outer, _playerManager, _resourceManager,
                                             _userInterfaceManager);
            _slotOuter.Dropped += SlotDropped;

            _slotHands = new EquipmentSlotUi(EquipmentSlot.Hands, _playerManager, _resourceManager,
                                             _userInterfaceManager);
            _slotHands.Dropped += SlotDropped;

            _slotFeet = new EquipmentSlotUi(EquipmentSlot.Feet, _playerManager, _resourceManager, _userInterfaceManager);
            _slotFeet.Dropped += SlotDropped;

            //Right Side - mask, ears, inner, belt, back
            _slotMask = new EquipmentSlotUi(EquipmentSlot.Mask, _playerManager, _resourceManager, _userInterfaceManager);
            _slotMask.Dropped += SlotDropped;

            _slotEars = new EquipmentSlotUi(EquipmentSlot.Ears, _playerManager, _resourceManager, _userInterfaceManager);
            _slotEars.Dropped += SlotDropped;

            _slotInner = new EquipmentSlotUi(EquipmentSlot.Inner, _playerManager, _resourceManager,
                                             _userInterfaceManager);
            _slotInner.Dropped += SlotDropped;

            _slotBelt = new EquipmentSlotUi(EquipmentSlot.Belt, _playerManager, _resourceManager, _userInterfaceManager);
            _slotBelt.Dropped += SlotDropped;

            _slotBack = new EquipmentSlotUi(EquipmentSlot.Back, _playerManager, _resourceManager, _userInterfaceManager);
            _slotBack.Dropped += SlotDropped;

            _txtDbg = new TextSprite("comboDlgDbg", "Combo Debug", _resourceManager.GetFont("CALIBRI"));

            _craftSlot1 = new CraftSlotUi(_resourceManager, _userInterfaceManager);
            _craftSlot2 = new CraftSlotUi(_resourceManager, _userInterfaceManager);

            _craftButton = new ImageButton
                               {
                                   ImageNormal = "wrenchbutt"
                               };
            _craftButton.Clicked += CraftButtonClicked;

            _craftStatus = new TextSprite("craftText", "Status", _resourceManager.GetFont("CALIBRI"))
                               {
                                   ShadowColor = Color.DimGray,
                                   ShadowOffset = new Vector2D(1, 1),
                                   Shadowed = true
                               };

            _blueprints = new ScrollableContainer("blueprintCont", new Size(210, 100), _resourceManager);
        }