コード例 #1
0
        protected override void set_nodes(List <CommandUINode> nodes)
        {
            Items = new PartialRangeVisibleUINodeSet <CommandUINode>(nodes);
            Items.CursorMoveSound  = System_Sounds.Menu_Move1;
            Items.WrapVerticalMove = true;

            UICursor             = new UICursor <CommandUINode>(Items);
            UICursor.draw_offset = new Vector2(-16, 0);
            UICursor.ratio       = new int[] { 1, 1 };
        }
コード例 #2
0
        public void refresh_nodes()
        {
            int active_index = 0;

            if (UnitNodes != null)
            {
                active_index = UnitNodes.ActiveNodeIndex;
            }
            var old_cursor = UnitCursor;

            ActorList = GetActorList();
            List <PrepItemsUnitUINode> nodes = new List <PrepItemsUnitUINode>();

            // Units
            for (int index = 0; index < ActorList.Count; index++)
            {
                Vector2 loc = new Vector2(
                    (index % this.Columns) * unit_spacing() + 28,
                    (index / this.Columns) * this.RowSize + this.ScissorRectOffset.Y) + unit_offset();
                int id = ActorList[index];

                nodes.Add(unit_node(id));
                nodes[index].loc = loc + new Vector2(this.ScissorRectOffset.X - 8, 0);
            }

            UnitNodes = new PartialRangeVisibleUINodeSet <PrepItemsUnitUINode>(nodes);
            UnitNodes.CursorMoveSound = System_Sounds.Menu_Move1;
            for (int index = 0; index < ActorList.Count; index++)
            {
                refresh_map_sprite(index);
                refresh_font(index);
            }
            UnitCursor             = new UICursor <PrepItemsUnitUINode>(UnitNodes);
            UnitCursor.draw_offset = new Vector2(-12, 0);

            UnitNodes.set_active_node(UnitNodes[active_index]);
            UnitCursor.move_to_target_loc();
            if (old_cursor != null)
            {
                UnitCursor.loc = old_cursor.loc;
            }

            UnitNodes.Update(false);
        }
コード例 #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);
            // Banner
            Banner                   = new MenuScreenBanner();
            Banner.width             = 120;
            Banner.loc               = new Vector2(OPTIONS_OFFSET, 8);
            Banner.stereoscopic      = Config.OPTIONS_BANNER_DEPTH;
            Banner_Text              = new Sprite();
            Banner_Text.texture      = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Banner_Text");
            Banner_Text.src_rect     = new Rectangle(0, 0, 96, 16);
            Banner_Text.loc          = new Vector2(OPTIONS_OFFSET + 24 + 2, 8 + 8);
            Banner_Text.stereoscopic = Config.OPTIONS_BANNER_DEPTH;
            // Background
            Background         = new Menu_Background();
            Background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Option_Background");
            (Background as Menu_Background).vel  = new Vector2(-0.25f, 0);
            (Background as Menu_Background).tile = new Vector2(3, 1);
            Background.stereoscopic = Config.MAPMENU_BG_DEPTH;
            // Description Window
            Description_Window              = new System_Color_Window();
            Description_Window.loc          = new Vector2(60, 156);
            Description_Window.width        = 200;
            Description_Window.height       = 24;
            Description_Window.small        = true;
            Description_Window.stereoscopic = Config.OPTIONS_DESC_DEPTH;
            // Description
            Description     = new TextSprite();
            Description.loc = new Vector2(72, 160);
            Description.SetFont(Config.UI_FONT, Global.Content, "White");
            Description.stereoscopic = Config.OPTIONS_DESC_DEPTH;
            // Solo Anim Button Icon
            Solo_Icon     = new SoloAnim_Button();
            Solo_Icon.loc = new Vector2(
                CHOICES_OFFSET + 20 +
                OptionsConfig.OPTIONS_DATA[(int)Constants.Options.Animation_Mode]
                .Options[(int)Constants.Animation_Modes.Solo].Offset,
                16 * (int)Constants.Options.Animation_Mode) +
                            new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y);
            Solo_Icon.stereoscopic = Config.OPTIONS_OPTIONS_DEPTH;
            // Page Arrows
            Up_Page_Arrow                = new Page_Arrow();
            Up_Page_Arrow.loc            = new Vector2(CHOICES_OFFSET - 4, Data_Scissor_Rect.Y - 4);
            Up_Page_Arrow.angle          = MathHelper.PiOver2;
            Up_Page_Arrow.stereoscopic   = Config.OPTIONS_ARROWS_DEPTH;
            Down_Page_Arrow              = new Page_Arrow();
            Down_Page_Arrow.loc          = new Vector2(CHOICES_OFFSET - 4, Data_Scissor_Rect.Y + Data_Scissor_Rect.Height + 4);
            Down_Page_Arrow.mirrored     = true;
            Down_Page_Arrow.angle        = MathHelper.PiOver2;
            Down_Page_Arrow.stereoscopic = Config.OPTIONS_ARROWS_DEPTH;

            Up_Page_Arrow.ArrowClicked   += Up_Page_Arrow_ArrowClicked;
            Down_Page_Arrow.ArrowClicked += Down_Page_Arrow_ArrowClicked;

            // UI Nodes
            List <OptionsUINode> nodes = new List <OptionsUINode>();

            // Options
            for (int index = 0; index < OptionsConfig.OPTIONS_DATA.Length; index++)
            {
                Vector2 loc = new Vector2(OPTIONS_OFFSET + 16, index * 16) +
                              new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y);

                nodes.Add(new OptionsUINode(index));
                nodes[index].stereoscopic = Config.OPTIONS_OPTIONS_DEPTH;
                nodes[index].loc          = loc;
            }

            OptionsNodes = new PartialRangeVisibleUINodeSet <OptionsUINode>(nodes);
            OptionsNodes.CursorMoveSound = System_Sounds.Menu_Move1;

            OptionsCursor              = new UICursor <OptionsUINode>(OptionsNodes);
            OptionsCursor.draw_offset  = new Vector2(-(16 + 12), 0);
            OptionsCursor.stereoscopic = Config.OPTIONS_CURSOR_DEPTH;
            // Settings
            List <SettingUINode> settings_nodes = new List <SettingUINode>();

            SettingsGroups = new List <List <SettingUINode> >();
            foreach (var option_node in OptionsNodes)
            {
                int i              = (int)option_node.Option;
                var option         = OptionsConfig.OPTIONS_DATA[i];
                var settings_group = new List <SettingUINode>();

                if (option.Gauge)
                {
                    Vector2 loc = new Vector2(CHOICES_OFFSET, i * 16) +
                                  new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y);

                    var node = new SettingGaugeUINode(option.Options[0].Name,
                                                      option.GaugeWidth, option.GaugeMin, option.GaugeMax, option.gauge_offset);
                    node.stereoscopic = Config.OPTIONS_OPTIONS_DEPTH;
                    node.loc          = loc;
                    settings_nodes.Add(node);
                    settings_group.Add(node);
                }
                else
                {
                    for (int j = 0; j < option.Options.Length; j++)
                    {
                        Vector2 loc = new Vector2(CHOICES_OFFSET + option.Options[j].Offset, i * 16) +
                                      new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y);

                        var node = new SettingUINode(option.Options[j].Name);
                        node.stereoscopic = Config.OPTIONS_OPTIONS_DEPTH;
                        node.loc          = loc;
                        settings_nodes.Add(node);
                        settings_group.Add(node);
                    }
                }

                SettingsGroups.Add(settings_group);
            }

            SettingsNodes = new PartialRangeVisibleUINodeSet <SettingUINode>(settings_nodes);
            SettingsNodes.CursorMoveSound = System_Sounds.Menu_Move2;
            SettingsNodes.set_active_node(SettingsNodes[this.current_setting]);

            SettingsCursor                     = new UICursor <SettingUINode>(SettingsNodes);
            SettingsCursor.draw_offset         = new Vector2(-16, 0);
            SettingsCursor.min_distance_y      = 4;
            SettingsCursor.override_distance_y = 16;
            SettingsCursor.stereoscopic        = Config.OPTIONS_CURSOR_DEPTH;
            SettingsCursor.move_to_target_loc();

            // Scrollbar

            /* //Debug
             * Scrollbar = new Scroll_Bar(
             *  ROWS_AT_ONCE * 16 - 16, OptionsConfig.OPTIONS_DATA.Length, ROWS_AT_ONCE, 0);
             * Scrollbar.loc = new Vector2(Data_Scissor_Rect.Width - 12, Data_Scissor_Rect.Y + 8);
             *
             * Scrollbar.UpArrowClicked += Scrollbar_UpArrowClicked;
             * Scrollbar.DownArrowClicked += Scrollbar_DownArrowClicked;*/

            create_cancel_button();

            refresh_arrow_visibility();
            update_loc();
        }