コード例 #1
0
        protected void initialize()
        {
            // Background
            Background              = new Menu_Background();
            Background.texture      = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Status_Background");
            Background.vel          = new Vector2(-0.25f, 0);
            Background.tile         = new Vector2(3, 2);
            Background.stereoscopic = Config.MAPMENU_BG_DEPTH;

            MenuChoices.Add(new MainMenuChoicePanel("RESUME"));
            MenuChoices.Add(new MainMenuChoicePanel("START GAME"));

            MenuChoices.Add(new MainMenuChoicePanel("OPTIONS"));
#if DEBUG && !MONOGAME
            MenuChoices.Add(new MainMenuChoicePanel("TEST BATTLE"));
#endif

            MenuChoices.Add(new MainMenuChoicePanel("EXTRAS"));

            MenuChoices.Add(new MainMenuChoicePanel("QUIT"));

            initialize_game_update_banner(true);

            RefreshMenuChoices();
        }
コード例 #2
0
        protected override void initialize_images()
        {
            Item_Rect = new Rectangle(40, 88, 248, 16 * ROWS);

            // 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, 0);
            // Background
            Menu_Background background = new Menu_Background();

            background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Status_Background");
            background.vel     = new Vector2(-0.25f, 0);
            background.tile    = new Vector2(3, 2);
            Background         = background;
            // Darkened Bar
            Darkened_Bar           = new Sprite();
            Darkened_Bar.texture   = Global.Content.Load <Texture2D>(@"Graphics/White_Square");
            Darkened_Bar.dest_rect = new Rectangle(0, 8, Config.WINDOW_WIDTH, 48);
            Darkened_Bar.tint      = new Color(0, 0, 0, 128);

            // Data
            refresh_buy();
            // Portrait BG
            Portrait_Bg = new Sprite();
            if (Global.game_system.preparations && string.IsNullOrEmpty(Shop.face))
            {
                Portrait_Bg.texture  = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen");
                Portrait_Bg.src_rect = new Rectangle(136, 136, 48, 64);
                Portrait_Bg.loc      = new Vector2(16, 0);

                Portrait_Label     = new TextSprite();
                Portrait_Label.loc = Portrait_Bg.loc + new Vector2(8, 40);
                Portrait_Label.SetFont(Config.UI_FONT, Global.Content, "White");
                Portrait_Label.text = "Convoy";
            }
            else
            {
                Portrait_Bg.texture  = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Shop_Portrait_bg");
                Portrait_Bg.src_rect = new Rectangle(0, 0, 57, 57);
                Portrait_Bg.loc      = new Vector2(12, 4);
            }
            // Gold Window
            Gold_Window         = new Sprite();
            Gold_Window.texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Gold_Window");
            Gold_Window.loc     = new Vector2(212, 48);
            // Gold_Data
            Gold_Data     = new RightAdjustedText();
            Gold_Data.loc = new Vector2(216 + 48, 48);
            Gold_Data.SetFont(Config.UI_FONT, Global.Content, "Blue");
            redraw_gold();
            Gold_G     = new TextSprite();
            Gold_G.loc = new Vector2(216 + 48, 48);
            Gold_G.SetFont(Config.UI_FONT + "L", Global.Content, "Yellow", Config.UI_FONT);
            Gold_G.text = "G";
            // Text
            Message = new Message_Box(64, 8, 160, 2, false, "White");
            set_text(Shop_Messages.Intro);
            Message_Active = true;

            create_cancel_button();

            set_images();
        }
コード例 #3
0
        protected 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);
            // Background
            Background              = new Menu_Background();
            Background.texture      = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Status_Background");
            Background.vel          = new Vector2(-0.25f, 0);
            Background.tile         = new Vector2(3, 2);
            Background.stereoscopic = Config.MAPMENU_BG_DEPTH;

            // UI Nodes
            TopPanelNodes = new List <StatusUINode>();
            // Top Panel //
            // Top Panel
            Top_Panel = new Status_Top_Panel_Bg(new List <Texture2D> {
                Global.Content.Load <Texture2D>(@"Graphics/Pictures/Portrait_bg"),
                Global.Content.Load <Texture2D>(@"Graphics/Windowskins/WindowPanel")
            });
            Top_Panel.stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            // Face Bg
            Face_Bg              = new Menu_Background();// Sprite(); //Debug
            Face_Bg.texture      = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Portrait_bg");
            Face_Bg.loc          = new Vector2(4, 4);
            Face_Bg.src_rect     = new Rectangle(12, 4, 8, 8);
            Face_Bg.tile         = new Vector2(11, 9);
            Face_Bg.stereoscopic = Config.STATUS_FACE_BG_DEPTH;
            // Map Sprite
            Map_Sprite              = new Character_Sprite();
            Map_Sprite.draw_offset  = MAP_SPRITE_LOC + new Vector2(16, 16);
            Map_Sprite.facing_count = 3;
            Map_Sprite.frame_count  = 3;
            Map_Sprite.stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            // Map Sprite Platform
            Platform              = new Sprite();
            Platform.texture      = Global.Content.Load <Texture2D>(@"Graphics/Characters/StatusPlatform");
            Platform.loc          = MAP_SPRITE_LOC;
            Platform.stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            // Name
            TopPanelNodes.Add(new StatusTextUINode(
                                  "Name",
                                  (Game_Unit unit) => unit.name, true));
            TopPanelNodes.Last().loc          = new Vector2(112, 4);
            TopPanelNodes.Last().draw_offset  = new Vector2(34, 0);
            TopPanelNodes.Last().Size         = new Vector2(68, 16);
            TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;

            // Class Name
            TopPanelNodes.Add(new StatusTextUINode(
                                  "Class",
                                  (Game_Unit unit) => unit.actor.class_name));
            TopPanelNodes.Last().loc          = new Vector2(104, 24);
            TopPanelNodes.Last().Size         = new Vector2(72, 16);
            TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;

            // Lives
            TopPanelNodes.Add(new StatusLivesUINode("Lives"));
            TopPanelNodes.Last().loc          = new Vector2(180, 60);
            TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            // LV/HP/etc

            TopPanelNodes.Add(new StatusStatLargeLabelUINode(
                                  "Lvl", "LV", (Game_Unit unit) => unit.actor.level.ToString(), 32));
            TopPanelNodes.Last().loc          = new Vector2(104, 40);
            TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            Func <Game_Unit, DirectionFlags, bool> lvl_cheat = (unit, dir) =>
            {
                int lvl_gain = 0;
                if (dir.HasFlag(DirectionFlags.Right))
                {
                    lvl_gain = 1;
                }
                else if (dir.HasFlag(DirectionFlags.Left))
                {
                    lvl_gain = -1;
                }
                unit.actor.level += lvl_gain;
                unit.queue_move_range_update();
                return(lvl_gain != 0);
            };

#if DEBUG
            TopPanelNodes.Last().set_cheat(lvl_cheat);
#endif

            TopPanelNodes.Add(new StatusStatUINode(
                                  "Exp", "$", (Game_Unit unit) =>
                                  unit.actor.can_level() ? unit.actor.exp.ToString() : "--", 24));
            TopPanelNodes.Last().loc          = new Vector2(136, 40);
            TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            Func <Game_Unit, DirectionFlags, bool> exp_cheat = (unit, dir) =>
            {
                int exp_gain = 0;
                if (dir.HasFlag(DirectionFlags.Right))
                {
                    exp_gain = 1;
                }
                else if (dir.HasFlag(DirectionFlags.Left))
                {
                    exp_gain = -1;
                }
                unit.actor.exp = (int)MathHelper.Clamp(
                    unit.actor.exp + exp_gain,
                    0, Global.ActorConfig.ExpToLvl - 1);
                return(exp_gain != 0);
            };
#if DEBUG
            TopPanelNodes.Last().set_cheat(exp_cheat);
#endif

            Func <Game_Unit, Color> label_color = null;
            if (show_stat_colors(Stat_Labels.Hp))
            {
                label_color = (Game_Unit unit) =>
                {
                    if (unit.average_stat_hue_shown)
                    {
                        return(unit.actor.stat_color(Stat_Labels.Hp));
                    }

                    return(Color.White);
                };
            }
            TopPanelNodes.Add(new StatusHpUINode(
                                  "Hp",
                                  "HP",
                                  (Game_Unit unit) =>
            {
                if (unit.actor.hp >=
                    Math.Pow(10, Global.BattleSceneConfig.StatusHpCounterValues))
                {
                    return("--");
                }
                else
                {
                    return(unit.actor.hp.ToString());
                }
            },
                                  (Game_Unit unit) =>
            {
                if (unit.actor.maxhp >=
                    Math.Pow(10, Global.BattleSceneConfig.StatusHpCounterValues))
                {
                    return("--");
                }
                else
                {
                    return(unit.actor.maxhp.ToString());
                }
            },
                                  label_color));
            TopPanelNodes.Last().loc          = new Vector2(104, 56);
            TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
#if DEBUG
            TopPanelNodes.Last().set_cheat(
                Status_Page_1.stat_cheat(Stat_Labels.Hp));
#endif

            // Battle Stat Labels
            Battle_Stat_Labels = new List <TextSprite>();
            for (int i = 0; i < 1; i++)
            {
                Battle_Stat_Labels.Add(new TextSprite());
                Battle_Stat_Labels[i].loc = new Vector2(204 + (i / 4) * 56, 8 + (i % 4) * 16);
                Battle_Stat_Labels[i].SetFont(Config.UI_FONT, Global.Content, "Yellow");
                Battle_Stat_Labels[i].text         = "doop";
                Battle_Stat_Labels[i].stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            }
            Battle_Stat_Labels[0].SetColor(Global.Content, "White");
            Battle_Stat_Labels[0].text = "Battle Stats";
            // Battle Stats
            for (int i = 1; i < 8; i++)
            {
                string help_label;
                string label;
                Func <Game_Unit, string> stat_formula;
                switch (i)
                {
                // Atk
                case 1:
                default:
                    help_label   = "Atk";
                    label        = "Atk";
                    stat_formula = (Game_Unit unit) =>
                    {
                        var stats = new BattlerStats(unit.id);
                        if (!stats.has_non_staff_weapon)
                        {
                            return("--");
                        }
                        return(stats.dmg().ToString());
                    };
                    break;

                // Hit
                case 2:
                    help_label   = "Hit";
                    label        = "Hit";
                    stat_formula = (Game_Unit unit) =>
                    {
                        var stats = new BattlerStats(unit.id);
                        if (!stats.has_non_staff_weapon)
                        {
                            return("--");
                        }
                        return(stats.hit().ToString());
                    };
                    break;

                // Dodge
                case 7:
                    help_label   = "Dodge";
                    label        = "Dodge";
                    stat_formula = (Game_Unit unit) =>
                    {
                        var stats = new BattlerStats(unit.id);
                        return(stats.dodge().ToString());
                    };
                    break;

                // Range
                case 4:
                    help_label   = "Range";
                    label        = "Rng";
                    stat_formula = (Game_Unit unit) =>
                    {
                        if (unit.actor.weapon == null ||
                            unit.actor.weapon.is_staff())
                        {
                            return("--");
                        }

                        Data_Weapon weapon    = unit.actor.weapon;
                        int         min_range = unit.min_range();
                        int         max_range = unit.max_range();
                        if (min_range == max_range)
                        {
                            return(min_range.ToString());
                        }
                        else
                        {
                            return(string.Format("{0}-{1}", min_range, max_range));
                        }
                    };
                    break;

                // Crit
                case 3:
                    help_label   = "Crit";
                    label        = "Crit";
                    stat_formula = (Game_Unit unit) =>
                    {
                        var stats = new BattlerStats(unit.id);
                        if (!stats.has_non_staff_weapon || !stats.can_crit())
                        {
                            return("--");
                        }
                        return(stats.crt().ToString());
                    };
                    break;

                // Avoid
                case 6:
                    help_label   = "Avoid";
                    label        = "Avoid";
                    stat_formula = (Game_Unit unit) =>
                    {
                        var stats = new BattlerStats(unit.id);
                        return(stats.avo().ToString());
                    };
                    break;

                // AS
                case 5:
                    help_label   = "AS";
                    label        = "AS";
                    stat_formula = (Game_Unit unit) => unit.atk_spd().ToString();
                    break;
                }

                Vector2 loc = new Vector2(204 + (i / 4) * 56, 8 + (i % 4) * 16);

                TopPanelNodes.Add(new StatusStatUINode(help_label, label, stat_formula));
                TopPanelNodes.Last().loc          = loc;
                TopPanelNodes.Last().stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            }
            // Rescue Icon
            Rescue_Icon              = new Sprite();
            Rescue_Icon.texture      = Global.Content.Load <Texture2D>(@"Graphics/Characters/RescueIcon");
            Rescue_Icon.loc          = new Vector2(103, -5);
            Rescue_Icon.stereoscopic = Config.STATUS_TOP_PANEL_DEPTH;
            // Pages //
            Pages.Add(new Status_Page_1());
            Pages.Add(new Status_Page_2());
            Pages.Add(new Status_Page_3());
            // Page Arrows
            Left_Page_Arrow                = new Page_Arrow();
            Left_Page_Arrow.loc            = new Vector2(4, 84);
            Left_Page_Arrow.stereoscopic   = Config.STATUS_ARROW_DEPTH;
            Left_Page_Arrow.ArrowClicked  += Left_Page_Arrow_ArrowClicked;
            Right_Page_Arrow               = new Page_Arrow();
            Right_Page_Arrow.loc           = new Vector2(Config.WINDOW_WIDTH - 4, 84);
            Right_Page_Arrow.mirrored      = true;
            Right_Page_Arrow.stereoscopic  = Config.STATUS_ARROW_DEPTH;
            Right_Page_Arrow.ArrowClicked += Right_Page_Arrow_ArrowClicked;

            create_cancel_button();

            set_images();
        }
コード例 #4
0
        protected virtual 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);
            // Map Darken
            Map_Darken           = new Sprite();
            Map_Darken.texture   = Global.Content.Load <Texture2D>(@"Graphics/White_Square");
            Map_Darken.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
            Map_Darken.tint      = new Color(0, 0, 0, 128);
            // Banner
            Banner              = new Sprite();
            Banner.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen");
            Banner.loc          = new Vector2(0, 0);
            Banner.src_rect     = new Rectangle(0, 0, 320, 40);
            Banner.tint         = new Color(255, 255, 255, 128);
            Banner.stereoscopic = Config.PREPMAIN_BANNER_DEPTH;
            Goal     = new TextSprite();
            Goal.loc = new Vector2(Config.WINDOW_WIDTH - 144 / 2, 20);
            Goal.SetFont(Config.UI_FONT, Global.Content, "White");
            Goal.stereoscopic         = Config.PREPMAIN_BANNER_DEPTH;
            ChapterLabel              = new ChapterLabel();
            ChapterLabel.loc          = new Vector2(Config.WINDOW_WIDTH - 144, 4);
            ChapterLabel.stereoscopic = Config.PREPMAIN_BANNER_DEPTH;
            ChapterLabel.SetChapter(Global.data_chapters[Global.game_state.chapter_id]);
            // Background
            Background         = new Menu_Background();
            Background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Preparation_Background");
            (Background as Menu_Background).vel  = new Vector2(0, -1 / 3f);
            (Background as Menu_Background).tile = new Vector2(1, 2);
            Background.stereoscopic = Config.PREP_BG_DEPTH;
            // Command Window
            CommandWindow              = new Window_Command(command_window_loc, 80, command_window_string());
            CommandWindow.text_offset  = new Vector2(8, 0);
            CommandWindow.glow         = true;
            CommandWindow.bar_offset   = new Vector2(-8, 0);
            CommandWindow.stereoscopic = Config.PREPMAIN_WINDOW_DEPTH;
            // Info Window
            InfoWindow              = new Sprite();
            InfoWindow.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen");
            InfoWindow.loc          = new Vector2(8, 128);
            InfoWindow.src_rect     = new Rectangle(208, 40, 112, 64);
            InfoWindow.stereoscopic = Config.PREPMAIN_DATA_DEPTH;
            // Help Window
            CommandHelpWindow              = new Sprite();
            CommandHelpWindow.texture      = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen");
            CommandHelpWindow.loc          = new Vector2(160, 40);
            CommandHelpWindow.src_rect     = new Rectangle(184, 104, 136, 112);
            CommandHelpWindow.stereoscopic = Config.PREPMAIN_INFO_DEPTH;
            // Help Text
            HelpText     = new TextSprite();
            HelpText.loc = new Vector2(176, 48);
            HelpText.SetFont(Config.UI_FONT, Global.Content, "White");
            HelpText.text         = "";
            HelpText.stereoscopic = Config.PREPMAIN_INFO_DEPTH;
            // Info Label
            InfoLabel              = new Sprite();
            InfoLabel.texture      = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Preparation_Info_Text");
            InfoLabel.loc          = new Vector2(16, 136);
            InfoLabel.offset       = new Vector2(-5, -2);
            InfoLabel.src_rect     = new Rectangle(0, 0, InfoLabel.texture.Width, 28);
            InfoLabel.stereoscopic = Config.PREPMAIN_DATA_DEPTH;
            // Info
            AvgLvl     = new RightAdjustedText();
            AvgLvl.loc = new Vector2(108 - 32, 136);
            AvgLvl.SetFont(Config.UI_FONT, Global.Content, "Blue");
            AvgLvl.stereoscopic = Config.PREPMAIN_DATA_DEPTH;
            EnemyAvgLvl         = new RightAdjustedText();
            EnemyAvgLvl.loc     = new Vector2(108, 136);
            EnemyAvgLvl.SetFont(Config.UI_FONT, Global.Content, "Red");
            EnemyAvgLvl.stereoscopic = Config.PREPMAIN_DATA_DEPTH;
            Funds     = new RightAdjustedText();
            Funds.loc = new Vector2(100, 152);
            Funds.SetFont(Config.UI_FONT, Global.Content, "Blue");
            Funds.stereoscopic   = Config.PREPMAIN_DATA_DEPTH;
            Counter              = new Play_Time_Counter();
            Counter.loc          = new Vector2(20, 168);
            Counter.stereoscopic = Config.PREPMAIN_DATA_DEPTH;

            create_start_button();
        }