示例#1
0
        internal SliderUINode(
            string helpLabel,
            string str,
            int width,
            int gaugeMin,
            int gaugeMax,
            int gaugeWidth)
            : base(helpLabel, str, width)
        {
            GaugeMin = gaugeMin;
            GaugeMax = gaugeMax;

            Text = new TextSprite();
            Text.SetFont(Tactile.Config.UI_FONT, Global.Content, "White");
            Text.text = str;

            Bar           = new Stat_Bar();
            Bar.offset    = new Vector2(-120 - 2, -8);
            Bar.bar_width = gaugeWidth;

            Value             = new RightAdjustedText();
            Value.draw_offset = new Vector2(120 + gaugeWidth + 8 + 24, 0);
            Value.SetFont(Tactile.Config.UI_FONT, Global.Content, "White");
            set_value(-1);

            Size = new Vector2(width, 16);
        }
示例#2
0
        internal StatusPrimaryStatUINode(
            string helpLabel,
            string label,
            Func <Game_Unit, PrimaryStatState> statFormula,
            Func <Game_Unit, Color> labelHueFormula,
            int textOffset = 48)
            : base(helpLabel, label, null, textOffset)
        {
            StatFormula     = statFormula;
            LabelHueFormula = labelHueFormula;

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

            Bonus             = new TextSprite();
            Bonus.draw_offset = new Vector2(textOffset + 0, 0);
            Bonus.SetFont(Config.UI_FONT + "Bonus", Config.UI_FONT);

            Bar             = new Stat_Bar();
            Bar.draw_offset = new Vector2(16, 8);
            Bar.offset      = new Vector2(-2, 0);

            PenaltyArrow             = new Weapon_Triangle_Arrow();
            PenaltyArrow.draw_offset = new Vector2(16, 0) + new Vector2(-12, 1);

            Size = new Vector2(textOffset + 24, 16);
        }
示例#3
0
        private void refresh_ranking_bar(Stat_Bar bar, int score)
        {
            int bar_length = score * RANKING_BAR_LENGTH / 150;

            // 100% yellow bar with green bonus
            if (bar_length > RANKING_BAR_LENGTH * 2 / 3)
            {
                bar.SetFillWidth(RANKING_BAR_LENGTH * 2 / 3);
                bar.bonus_width = bar_length - bar.fill_width;
            }
            // Short yellow bar with red penalty
            else
            {
                bar.SetFillWidth(bar_length);
                bar.bonus_width = bar.fill_width - RANKING_BAR_LENGTH * 2 / 3;
            }
        }
示例#4
0
        internal SettingGaugeUINode(string label,
                                    int gaugeWidth, int gaugeMin, int gaugeMax, int textOffset)
        {
            FormatString = label;
            GaugeMin     = gaugeMin;
            GaugeMax     = gaugeMax;

            Bar           = new Stat_Bar();
            Bar.offset    = new Vector2(-2, -8);
            Bar.bar_width = gaugeWidth;

            Label = new RightAdjustedText(
                Config.UI_FONT, Global.Content, "Grey",
                new Vector2(textOffset, 0),
                "");

            Size = new Vector2(Math.Max(gaugeWidth, textOffset), 16);
        }
示例#5
0
        private void initialize_sprites()
        {
            // Black Screen
            Black_Screen           = new Sprite();
            Black_Screen.texture   = Global.Content.Load <Texture2D>(@"Graphics/White_Square");
            Black_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
            Black_Screen.tint      = new Color(0, 0, 0, 255);
            // Banner
            Banner = new TextSprite();
            string str = Global.data_chapters[Global.game_state.chapter_id].FullName;

            Banner.loc = new Vector2(Config.WINDOW_WIDTH, 32) / 2 - new Vector2(Font_Data.text_width(str, Config.CHAPTER_FONT) / 2, 8);
            Banner.SetFont(Config.CHAPTER_FONT, Global.Content, "Data");
            Banner.text         = str;
            Banner.stereoscopic = Config.DATA_BANNER_DEPTH;

            int alpha = 7 * 16;

            BannerBg              = new Sprite();
            BannerBg.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            BannerBg.loc          = new Vector2(64, 0);
            BannerBg.src_rect     = new Rectangle(0, 176, 192, 32);
            BannerBg.tint         = new Color(alpha, alpha, alpha, 256 - alpha);
            BannerBg.stereoscopic = Config.DATA_BANNER_DEPTH;
            // Unit Bg
            UnitBg              = new Sprite();
            UnitBg.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            UnitBg.loc          = new Vector2(132, 120);
            UnitBg.src_rect     = new Rectangle(0, 272, 128, 72);
            UnitBg.tint         = new Color(alpha, alpha, alpha, 256 - alpha);
            UnitBg.stereoscopic = Config.DATA_LEADER_DEPTH;
            // File Bg
            FileBg              = new Sprite();
            FileBg.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            FileBg.loc          = new Vector2(260, 128);
            FileBg.src_rect     = new Rectangle(0, 208, 56, 64);
            FileBg.tint         = new Color(alpha, alpha, alpha, 256 - alpha);
            FileBg.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Background
            Background         = new Menu_Background();
            Background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Status_Background");
            (Background as Menu_Background).vel  = new Vector2(-0.25f, 0);
            (Background as Menu_Background).tile = new Vector2(3, 2);
            Background.stereoscopic = Config.MAPMENU_BG_DEPTH;
            // Cursor
            Cursor = new Data_Team_Cursor();
            Cursor.stereoscopic = Config.DATA_TEAMS_DEPTH;
            // Objective Window
            Objective_Window              = new Sprite();
            Objective_Window.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Objective_Window.loc          = new Vector2(132, 32);
            Objective_Window.src_rect     = new Rectangle(32, 0, 184, 96);
            Objective_Window.stereoscopic = Config.DATA_WINDOW_DEPTH;
            // Game Data Window
            Game_Data_Window              = new Sprite();
            Game_Data_Window.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Game_Data_Window.loc          = new Vector2(324, 120);
            Game_Data_Window.src_rect     = new Rectangle(104, 96, 112, 72);
            Game_Data_Window.stereoscopic = Config.DATA_DATA_DEPTH;
            // Team Windows/Text
            int y = 0;

            for (int i = 1; i <= Constants.Team.NUM_TEAMS; i++)
            {
                if (Global.game_map.teams[i].Count > 0)
                {
                    List <int>            groups      = new List <int>();
                    Dictionary <int, int> group_sizes = new Dictionary <int, int>();
                    foreach (int id in Global.game_map.teams[i])
                    {
                        if (!groups.Contains(Global.game_map.units[id].group))
                        {
                            groups.Add(Global.game_map.units[id].group);
                            group_sizes.Add(Global.game_map.units[id].group, 0);
                        }
                        group_sizes[Global.game_map.units[id].group]++;
                    }
                    Groups.Add(new KeyValuePair <int, int>(i, groups.Count));
                    Team_Windows.Add(new Data_Team_Window(i, group_sizes.Count));
                    Team_Windows[Team_Windows.Count - 1].loc          = TEAM_WINDOW_LOC + new Vector2(0, 0 + y);
                    Team_Windows[Team_Windows.Count - 1].stereoscopic = Config.DATA_TEAMS_DEPTH;
                    groups.Sort();
                    for (int j = 0; j < groups.Count; j++)
                    {
                        Group_Names.Add(new TextSprite());
                        Group_Names[Group_Names.Count - 1].loc = TEAM_WINDOW_LOC + new Vector2(4, y + 12 + j * 16);
                        Group_Names[Group_Names.Count - 1].SetFont(Config.UI_FONT, Global.Content, "White");
                        Group_Names[Group_Names.Count - 1].text         = Global.game_map.group_name(i, groups[j]);
                        Group_Names[Group_Names.Count - 1].stereoscopic = Config.DATA_TEAMS_DEPTH;
                        Group_Counts.Add(new RightAdjustedText());
                        Group_Counts[Group_Names.Count - 1].loc = TEAM_WINDOW_LOC + new Vector2(112, y + 12 + j * 16);
                        Group_Counts[Group_Names.Count - 1].SetFont(Config.UI_FONT, Global.Content, "Blue");
                        Group_Counts[Group_Names.Count - 1].text         = group_sizes[groups[j]].ToString();
                        Group_Counts[Group_Names.Count - 1].stereoscopic = Config.DATA_TEAMS_DEPTH;
                    }
                    y += (group_sizes.Count + 1) * 16;
                }
            }
            // Game Data Window
            RankingWindow              = new Data_Ranking_Window();
            RankingWindow.loc          = new Vector2(320, 32);
            RankingWindow.width        = 120;
            RankingWindow.height       = 80;
            RankingWindow.stereoscopic = Config.DATA_TEAMS_DEPTH;
            // Counter
            Counter              = new Play_Time_Counter();
            Counter.loc          = Game_Data_Window.loc + new Vector2(12, 48);
            Counter.stereoscopic = Config.DATA_DATA_DEPTH;
            // Labels
            Objective_Label              = new Sprite();
            Objective_Label.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Objective_Label.loc          = Objective_Window.loc + new Vector2(16 - 2, 12 - 2);
            Objective_Label.src_rect     = new Rectangle(0, 96, 56, 16);
            Objective_Label.stereoscopic = Config.DATA_WINDOW_DEPTH;
            Defeat_Label              = new Sprite();
            Defeat_Label.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Defeat_Label.loc          = Objective_Window.loc + new Vector2(16 - 2, 44 - 2);
            Defeat_Label.src_rect     = new Rectangle(56, 96, 40, 16);
            Defeat_Label.stereoscopic = Config.DATA_WINDOW_DEPTH;

            Turn_Label               = new Sprite();
            Turn_Label.texture       = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Turn_Label.loc           = Game_Data_Window.loc + new Vector2(8, 8);
            Turn_Label.src_rect      = new Rectangle(0, 112, 32, 16);
            Turn_Label.stereoscopic  = Config.DATA_DATA_DEPTH;
            Funds_Label              = new Sprite();
            Funds_Label.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Funds_Label.loc          = Game_Data_Window.loc + new Vector2(8, 24);
            Funds_Label.src_rect     = new Rectangle(0, 128, 32, 16);
            Funds_Label.stereoscopic = Config.DATA_DATA_DEPTH;
            Gold_G              = new Sprite();
            Gold_G.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Gold_G.loc          = Game_Data_Window.loc + new Vector2(88 + 5, 24);
            Gold_G.src_rect     = new Rectangle(0, 160, 16, 16);
            Gold_G.stereoscopic = Config.DATA_DATA_DEPTH;

            Lv_Label              = new Sprite();
            Lv_Label.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Lv_Label.loc          = UnitBg.loc + new Vector2(8, 40 + 0 - 2);
            Lv_Label.src_rect     = new Rectangle(32, 112, 16, 16);
            Lv_Label.stereoscopic = Config.DATA_LEADER_DEPTH;
            Hp_Label              = new Sprite();
            Hp_Label.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            Hp_Label.loc          = UnitBg.loc + new Vector2(8, 40 + 12 - 2);
            Hp_Label.src_rect     = new Rectangle(48, 112, 24, 16);
            Hp_Label.stereoscopic = Config.DATA_LEADER_DEPTH;
            TextSprite hp_slash = new TextSprite(); // why is this done so //@Yeti

            hp_slash.loc = UnitBg.loc + new Vector2(44, 40 + 12);
            hp_slash.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            hp_slash.text            = "/";
            Hp_Slash                 = hp_slash;
            Hp_Slash.stereoscopic    = Config.DATA_LEADER_DEPTH;
            RatingLabel              = new Sprite();
            RatingLabel.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Data_Screen");
            RatingLabel.loc          = UnitBg.loc + new Vector2(72, 40 + 12 - 2);
            RatingLabel.src_rect     = new Rectangle(72, 112, 24, 16);
            RatingLabel.stereoscopic = Config.DATA_LEADER_DEPTH;

            RankingLabel     = new TextSprite();
            RankingLabel.loc = RankingWindow.loc + new Vector2(24, 8);
            RankingLabel.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            RankingLabel.text         = "Progress";
            RankingLabel.stereoscopic = Config.DATA_TEAMS_DEPTH;
            TurnsRankLabel            = new TextSprite();
            TurnsRankLabel.loc        = RankingWindow.loc + new Vector2(8, 24);
            TurnsRankLabel.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            TurnsRankLabel.text         = "Turns";
            TurnsRankLabel.stereoscopic = Config.DATA_TEAMS_DEPTH;
            CombatRankLabel             = new TextSprite();
            CombatRankLabel.loc         = RankingWindow.loc + new Vector2(8, 40);
            CombatRankLabel.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            CombatRankLabel.text         = "Combat";
            CombatRankLabel.stereoscopic = Config.DATA_TEAMS_DEPTH;
            ExpRankLabel     = new TextSprite();
            ExpRankLabel.loc = RankingWindow.loc + new Vector2(8, 56);
            ExpRankLabel.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            ExpRankLabel.text         = "Exp";
            ExpRankLabel.stereoscopic = Config.DATA_TEAMS_DEPTH;

            FileLabel     = new TextSprite();
            FileLabel.loc = FileBg.loc + new Vector2(8, 40);
            FileLabel.SetFont(Config.UI_FONT, Global.Content, "Yellow");
            FileLabel.text         = "File";
            FileLabel.stereoscopic = Config.DATA_LEADER_DEPTH;

            // Victory Text
            Victory_Text     = new TextSprite();
            Victory_Text.loc = Objective_Window.loc + new Vector2(68, 12);
            Victory_Text.SetFont(Config.UI_FONT, Global.Content, "White");
            Victory_Text.text         = Global.game_system.Victory_Text;
            Victory_Text.stereoscopic = Config.DATA_WINDOW_DEPTH;
            // Loss Text
            Loss_Text     = new TextSprite();
            Loss_Text.loc = Objective_Window.loc + new Vector2(68, 44);
            Loss_Text.SetFont(Config.UI_FONT, Global.Content, "White");
            Loss_Text.text         = Global.game_system.Loss_Text;
            Loss_Text.stereoscopic = Config.DATA_WINDOW_DEPTH;

            // Turn Text
            Turn     = new RightAdjustedText();
            Turn.loc = Game_Data_Window.loc + new Vector2(100, 8);
            Turn.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Turn.text         = Global.game_system.chapter_turn.ToString();
            Turn.stereoscopic = Config.DATA_DATA_DEPTH;
            // Funds Text
            Funds     = new RightAdjustedText();
            Funds.loc = Game_Data_Window.loc + new Vector2(92, 24);
            Funds.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Funds.text         = Global.battalion.gold.ToString();
            Funds.stereoscopic = Config.DATA_DATA_DEPTH;

            // Leader Name
            Leader_Name     = new TextSprite();
            Leader_Name.loc = UnitBg.loc + new Vector2(32 + 24, 12);
            Leader_Name.SetFont(Config.UI_FONT, Global.Content, "White");
            Leader_Name.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Level
            Lvl     = new RightAdjustedText();
            Lvl.loc = UnitBg.loc + new Vector2(68, 40 + 0);
            Lvl.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Lvl.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Hp
            Hp     = new RightAdjustedText();
            Hp.loc = UnitBg.loc + new Vector2(44, 40 + 12);
            Hp.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Hp.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Hp Max
            Hp_Max     = new RightAdjustedText();
            Hp_Max.loc = UnitBg.loc + new Vector2(68, 40 + 12);
            Hp_Max.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Hp_Max.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Rating
            Rating     = new RightAdjustedText();
            Rating.loc = UnitBg.loc + new Vector2(120, 40 + 12);
            Rating.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Rating.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Map Sprite
            Map_Sprite = new Character_Sprite();
            Map_Sprite.facing_count = 3;
            Map_Sprite.frame_count  = 3;
            Map_Sprite.loc          = UnitBg.loc + new Vector2(20, 24);
            Map_Sprite.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Miniface
            Face              = new Miniface();
            Face.loc          = UnitBg.loc + new Vector2(104, 8);
            Face.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Weapon
            LeaderWeapon              = new Item_Display();
            LeaderWeapon.loc          = UnitBg.loc + new Vector2(8, 28);
            LeaderWeapon.stereoscopic = Config.DATA_LEADER_DEPTH;

            // File number
            FileNumber     = new RightAdjustedText();
            FileNumber.loc = FileBg.loc + new Vector2(40, 40);
            FileNumber.SetFont(Config.UI_FONT, Global.Content, "Blue");
            FileNumber.text         = Global.current_save_id.ToString();
            FileNumber.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Style
            StyleText     = new TextSprite();
            StyleText.loc = FileBg.loc + new Vector2(8, 8);
            StyleText.SetFont(Config.UI_FONT, Global.Content, "Blue");
            StyleText.text         = Global.game_system.Style.ToString();
            StyleText.stereoscopic = Config.DATA_LEADER_DEPTH;
            // Difficulty
            DifficultyText     = new TextSprite();
            DifficultyText.loc = FileBg.loc + new Vector2(8, 24);
            DifficultyText.SetFont(Config.UI_FONT, Global.Content, "Blue");
            DifficultyText.text         = Global.game_system.Difficulty_Mode.ToString();
            DifficultyText.stereoscopic = Config.DATA_LEADER_DEPTH;

            // Rank Letters
            TotalRankLetter     = new TextSprite();
            TotalRankLetter.loc = RankingWindow.loc + new Vector2(88, 8);
            TotalRankLetter.SetFont(Config.UI_FONT + "L", Global.Content, "Blue", Config.UI_FONT);
            TotalRankLetter.stereoscopic = Config.DATA_TEAMS_DEPTH;
            TurnsRankLetter     = new TextSprite();
            TurnsRankLetter.loc = RankingWindow.loc + new Vector2(104, 24);
            TurnsRankLetter.SetFont(Config.UI_FONT + "L", Global.Content, "Blue", Config.UI_FONT);
            TurnsRankLetter.stereoscopic = Config.DATA_TEAMS_DEPTH;
            CombatRankLetter             = new TextSprite();
            CombatRankLetter.loc         = RankingWindow.loc + new Vector2(104, 40);
            CombatRankLetter.SetFont(Config.UI_FONT + "L", Global.Content, "Blue", Config.UI_FONT);
            CombatRankLetter.stereoscopic = Config.DATA_TEAMS_DEPTH;
            ExpRankLetter     = new TextSprite();
            ExpRankLetter.loc = RankingWindow.loc + new Vector2(104, 56);
            ExpRankLetter.SetFont(Config.UI_FONT + "L", Global.Content, "Blue", Config.UI_FONT);
            ExpRankLetter.stereoscopic = Config.DATA_TEAMS_DEPTH;
            // Rank Gauges
            TurnsBar               = new Stat_Bar();
            TurnsBar.loc           = RankingWindow.loc + new Vector2(40, 32);
            TurnsBar.offset        = new Vector2(-2, 0);
            TurnsBar.bar_width     = RANKING_BAR_LENGTH;
            TurnsBar.stereoscopic  = Config.DATA_TEAMS_DEPTH;
            CombatBar              = new Stat_Bar();
            CombatBar.loc          = RankingWindow.loc + new Vector2(40, 48);
            CombatBar.offset       = new Vector2(-2, 0);
            CombatBar.bar_width    = RANKING_BAR_LENGTH;
            CombatBar.stereoscopic = Config.DATA_TEAMS_DEPTH;
            ExpBar              = new Stat_Bar();
            ExpBar.loc          = RankingWindow.loc + new Vector2(40, 64);
            ExpBar.offset       = new Vector2(-2, 0);
            ExpBar.bar_width    = RANKING_BAR_LENGTH;
            ExpBar.stereoscopic = Config.DATA_TEAMS_DEPTH;

            // Page Arrows
            Left_Page_Arrow               = new Page_Arrow();
            Left_Page_Arrow.loc           = new Vector2(4, 72);
            Left_Page_Arrow.stereoscopic  = Config.DATA_BANNER_DEPTH;
            Right_Page_Arrow              = new Page_Arrow();
            Right_Page_Arrow.loc          = new Vector2(Config.WINDOW_WIDTH - 4, 72);
            Right_Page_Arrow.mirrored     = true;
            Right_Page_Arrow.stereoscopic = Config.DATA_BANNER_DEPTH;

            refresh_rank();
            set_images();
        }