public AnnouncementViewer(DwarfGUI gui, GUIComponent parent, AnnouncementManager manager) :
            base(gui, parent)
        {
            SpeechBubble = new Panel(gui, this)
            {
                Mode      = Panel.PanelMode.SpeechBubble,
                DrawOrder = -2
            };
            SpeechBubble.IsVisible = false;
            Manager = manager;

            Manager.OnAdded   += Manager_OnAdded;
            Manager.OnRemoved += Manager_OnRemoved;

            IsMaximized = false;

            AnnouncementViews = new List <AnnouncementView>();
            MaxViews          = 4;
            WaitTimer         = new Timer(5, true);
            Talker            = new AnimatedImagePanel(GUI, this, animation)
            {
                LocalBounds = new Rectangle(-128, -64, 128, 128)
            };
            animation.Play();
            animation.Loops   = true;
            animation.FrameHZ = 2.0f;
        }
        public AnnouncementViewer(DwarfGUI gui, GUIComponent parent, AnnouncementManager manager)
            : base(gui, parent)
        {
            TweenTimer = new Timer(0.5f, true);
            TweenOutTimer = new Timer(0.5f, true);
            SpeechBubble = new Panel(gui, this)
            {
                Mode = Panel.PanelMode.SpeechBubble,
                DrawOrder = -2
            };
            SpeechBubble.IsVisible = false;
            Manager = manager;

            Manager.OnAdded += Manager_OnAdded;
            Manager.OnRemoved += Manager_OnRemoved;

            IsMaximized = false;

            AnnouncementViews = new List<AnnouncementView>();
            MaxViews = 4;
            WaitTimer = new Timer(5, true);
            Talker = new AnimatedImagePanel(GUI, this, animation);
            animation.Play();
            animation.Loops = true;
            animation.FrameHZ = 2.0f;
        }
Exemple #3
0
        public SpeakerComponent(DwarfGUI gui, GUIComponent parent, Animation animation) :
            base(gui, parent)
        {
            SayTimer  = new Timer(5.0f, false, Timer.TimerMode.Real);
            ActorSize = 256;

            ActorPanel = new Panel(GUI, this)
            {
                DrawOrder = -2,
                Mode      = Panel.PanelMode.Simple
            };

            ScrollingAnimation anim = new ScrollingAnimation(GUI, ActorPanel)
            {
                Image       = new NamedImageFrame(ContentPaths.GUI.background),
                ScrollSpeed = new Vector2(10, 0),
                Tint        = Color.White,
                DrawOrder   = -2,
                LocalBounds = new Rectangle(0, 0, ActorSize, ActorSize)
            };

            Actor = new AnimatedImagePanel(GUI, this, animation)
            {
                KeepAspectRatio = true
            };

            animation.Loops = true;
            SpeechBubble    = new Panel(GUI, this)
            {
                Mode = Panel.PanelMode.SpeechBubble
            };

            SpeechLabel = new Label(GUI, SpeechBubble, "", GUI.DefaultFont)
            {
                Alignment = Drawer2D.Alignment.Center,
                WordWrap  = true
            };
        }
Exemple #4
0
        public void InitializePanel()
        {
            StatLabels = new Dictionary<string, Label>();
            StatusBars = new Dictionary<string, MiniBar>();
            GridLayout layout = new GridLayout(GUI, this, 10, 8);

            CreateStatsLabel("Dexterity", "DEX:", layout);
            CreateStatsLabel("Strength", "STR:", layout);
            CreateStatsLabel("Wisdom", "WIS:", layout);
            CreateStatsLabel("Constitution", "CON:", layout);
            CreateStatsLabel("Intelligence", "INT:", layout);
            CreateStatsLabel("Size", "SIZ:", layout);

            int i = 0;
            int nx = 3;
            int ny = 2;
            foreach(KeyValuePair<string, Label> label in StatLabels)
            {
                layout.SetComponentPosition(label.Value, (i % nx), (((i - i % nx) / nx) % ny), 1, 1);
                i++;
            }

            CreateStatusBar("Hunger", layout);
            CreateStatusBar("Energy", layout);
            CreateStatusBar("Happiness", layout);
            CreateStatusBar("Health", layout);

            i = 0;
            nx = 2;
            ny = 3;
            foreach (KeyValuePair<string, MiniBar> label in StatusBars)
            {
                layout.SetComponentPosition(label.Value, (i % nx) * 2, (((i - i % nx) / nx) % ny) * 2 + 2, 2, 2);
                i++;
            }

            Portrait = new AnimatedImagePanel(GUI, layout, new ImageFrame())
            {
                KeepAspectRatio = true
            };

            layout.SetComponentPosition(Portrait, 5, 0, 4, 4);

            ClassLabel = new Label(GUI, layout, "Level", GUI.DefaultFont)
            {
                WordWrap = true
            };

            layout.SetComponentPosition(ClassLabel, 5, 4, 4, 2);

            XpLabel = new Label(GUI, layout, "XP", GUI.SmallFont)
            {
                WordWrap = true
            };

            layout.SetComponentPosition(XpLabel, 5, 7, 2, 1);

            PayLabel = new Label(GUI, layout, "Pay", GUI.SmallFont);
            layout.SetComponentPosition(PayLabel, 5, 8, 2, 1);

            LevelUpButton = new Button(GUI, layout, "Promote", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowUp));
            layout.SetComponentPosition(LevelUpButton, 5, 9, 2, 1);
            LevelUpButton.OnClicked += LevelUpButton_OnClicked;

            FireButton = new Button(GUI, layout, "Fire", GUI.DefaultFont, Button.ButtonMode.ToolButton,
                GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomOut))
            {
                ToolTip = "Let this employee go."
            };

            layout.SetComponentPosition(FireButton, 0, 9, 2, 1);

            FireButton.OnClicked +=FireButton_OnClicked;
        }
Exemple #5
0
        public void InitializePanel()
        {
            StatLabels = new Dictionary <string, Label>();
            StatusBars = new Dictionary <string, MiniBar>();
            GridLayout layout = new GridLayout(GUI, this, 10, 8);

            CreateStatsLabel("Dexterity", "DEX:", layout);
            CreateStatsLabel("Strength", "STR:", layout);
            CreateStatsLabel("Wisdom", "WIS:", layout);
            CreateStatsLabel("Constitution", "CON:", layout);
            CreateStatsLabel("Intelligence", "INT:", layout);
            CreateStatsLabel("Size", "SIZ:", layout);

            int i  = 0;
            int nx = 3;
            int ny = 2;

            foreach (KeyValuePair <string, Label> label in StatLabels)
            {
                layout.SetComponentPosition(label.Value, (i % nx), (((i - i % nx) / nx) % ny), 1, 1);
                i++;
            }


            CreateStatusBar("Hunger", layout);
            CreateStatusBar("Energy", layout);
            CreateStatusBar("Happiness", layout);
            CreateStatusBar("Health", layout);

            i  = 0;
            nx = 2;
            ny = 3;
            foreach (KeyValuePair <string, MiniBar> label in StatusBars)
            {
                layout.SetComponentPosition(label.Value, (i % nx) * 2, (((i - i % nx) / nx) % ny) * 2 + 2, 2, 2);
                i++;
            }

            Portrait = new AnimatedImagePanel(GUI, layout, new ImageFrame())
            {
                KeepAspectRatio = true
            };

            layout.SetComponentPosition(Portrait, 5, 0, 4, 4);

            ClassLabel = new Label(GUI, layout, "Level", GUI.DefaultFont)
            {
                WordWrap = true
            };

            layout.SetComponentPosition(ClassLabel, 5, 4, 4, 2);

            XpLabel = new Label(GUI, layout, "XP", GUI.SmallFont)
            {
                WordWrap = true
            };

            layout.SetComponentPosition(XpLabel, 5, 7, 2, 1);


            PayLabel = new Label(GUI, layout, "Pay", GUI.SmallFont);
            layout.SetComponentPosition(PayLabel, 5, 8, 2, 1);

            LevelUpButton = new Button(GUI, layout, "Promote", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowUp));
            layout.SetComponentPosition(LevelUpButton, 5, 9, 2, 1);
            LevelUpButton.OnClicked += LevelUpButton_OnClicked;

            FireButton = new Button(GUI, layout, "Fire", GUI.DefaultFont, Button.ButtonMode.ToolButton,
                                    GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomOut))
            {
                ToolTip = "Let this employee go."
            };

            layout.SetComponentPosition(FireButton, 0, 9, 2, 1);

            FireButton.OnClicked += FireButton_OnClicked;
        }
        public SpeakerComponent(DwarfGUI gui, GUIComponent parent, Animation animation)
            : base(gui, parent)
        {
            ActorSize = 256;
            Actor = new AnimatedImagePanel(GUI, this, animation)
            {
                KeepAspectRatio = true
            };

            SpeechBubble = new Panel(GUI, this)
            {
                Mode = Panel.PanelMode.SpeechBubble
            };

            SpeechLabel = new Label(GUI, SpeechBubble, "", GUI.DefaultFont)
            {
                Alignment = Drawer2D.Alignment.Center,
                WordWrap = true
            };
        }