Exemplo n.º 1
0
 public Window_Command_Item_Supply(int actor_id, Vector2 loc, bool restocking)
 {
     Actor_Id   = actor_id;
     Restocking = restocking;
     //Unit_Id = unit_id;
     active = false;
     initialize(loc, WIDTH, new List <string>());
     Window_Img.set_lines(Global.ActorConfig.NumItems, (int)Size_Offset.Y);
 }
Exemplo n.º 2
0
 public void set_text(string text)
 {
     Window_Img.text_clear();
     Window_Img.text_color = Default_Text_Color;
     Text.Clear();
     foreach (string line in text.Split('\n'))
     {
         Text.Add(line);
     }
     Text_Loc = Vector2.Zero;
     Text_End = !(Text.Count > 0 && Text[0].Length > 0);
 }
Exemplo n.º 3
0
 protected override bool update_images()
 {
     if (Window_Img != null)
     {
         Window_Img.update();
     }
     if (Arrow != null)
     {
         Arrow.update();
     }
     return(false);
 }
Exemplo n.º 4
0
        protected override void set_items(List <string> strs)
        {
            Index_Redirect.Clear();

            add_commands(strs);
            Window_Img.set_lines(num_items(), (int)Size_Offset.Y);
            refresh_item_stats();

            //if (actor() != null) //Debug
            //    set_items(actor().items);

            refresh_equipped_tag();
        }
Exemplo n.º 5
0
        public Window_Command_Support(int actorId, Vector2 loc)
        {
            Rows = LINES;

            ActorId = actorId;
            Header  = new Support_Command_Components(LINES, this.SupportsRemaining);

            List <string> strs = GetNames();

            initialize(loc, WIDTH, strs);
            Bar_Offset = new Vector2(0, 0);
            Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8);
        }
        public override void draw(SpriteBatch sprite_batch)
        {
            if (is_onscreen_for_drawing)
            {
                sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                Window_Img.draw(sprite_batch, new Vector2(3, 3) - draw_vector());
                draw_hp(sprite_batch);
                Name.draw(sprite_batch, -NAME_LOC);
                sprite_batch.End();
                Face.draw(sprite_batch);

                sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                //Stats.draw(sprite_batch);
                sprite_batch.End();
            }
        }
        new protected virtual void draw_window(SpriteBatch sprite_batch)
        {
            if (Window_Img != null)
            {
                sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                // Window background
                Window_Img.draw(sprite_batch, -(loc + draw_vector()));
                sprite_batch.End();
            }

            Rectangle rect = scissor_rect();

            if (rect.Width > 0 && rect.Height > 0)
            {
                sprite_batch.GraphicsDevice.ScissorRectangle = rect;
                sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, Raster_State);
                draw_bar(sprite_batch);
                sprite_batch.End();
            }
        }
        public WindowCommandSupportViewerActor(int actorId, Vector2 loc)
        {
            Rows = LINES;

            ActorId = actorId;
            Header  = new Support_Command_Components(LINES, this.SupportsRemaining, true);
            Header.color_override = 0;

            List <string> strs = GetNames();

            initialize(loc, 8 + 16, strs);
            Window_Img.color_override = 0;
            Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8);

            int width = WIDTH - 16;

            this.text_offset = new Vector2(width - (this.ColumnCount + 1) * 8, 0);
            set_columns(this.ColumnCount);
            this.size_offset = new Vector2(width - this.text_area_width, Size_Offset.Y);
            Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8);

            initialize_scrollbar();
            if (Scrollbar != null)
            {
                Scrollbar.loc += new Vector2(4, 0);
            }

            // Bar
            Glow            = true;
            this.glow_width = 16;
            this.bar_offset = new Vector2(-4, 0);

            // Cursor
            UICursor.UpdateTargetLoc(ScrollOffset);
            UICursor.move_to_target_loc();
            PlayerCursor        = new Character_Sprite(Global.Content.Load <Texture2D>(@"Graphics/Characters/Cursor"));
            PlayerCursor.offset = new Vector2(4, 0 - 2);

            SetUnits();
        }
        protected override void draw_images(Game_Unit unit)
        {
            Window_Img.team = unit.team;
            var  selected_unit   = Global.game_map.get_selected_unit();
            var  player_unit     = selected_unit;
            bool player_selected = true;

            // Swap units if the selected unit is on an enemy team
            if (player_unit != null &&
                !player_unit.is_player_allied)
            {
                Game_Unit temp = unit;
                unit            = player_unit;
                player_unit     = temp;
                player_selected = false;
            }

            Item.flash       = false;
            TargetItem.flash = false;

            // Name
            set_name(unit);
            Name.offset = new Vector2(Name.text_width / 2, 0); //Debug

            Weapon_Triangle_Arrow.ResetWeaponTriangle(WTA1, WTA2);

            Item.texture = null;
            var unitWeapon = unit.actor.weapon;

            if (!player_selected && unit.is_on_siege())
            {
                unitWeapon = unit.items[Siege_Engine.SiegeInventoryIndex].to_weapon;
            }
            if (unitWeapon != null)
            {
                string filename = string.Format(@"Graphics/Icons/{0}", unitWeapon.Image_Name);
                if (Global.content_exists(filename))
                {
                    Item.texture = Global.Content.Load <Texture2D>(filename);
                }
                Item.index = unitWeapon.Image_Index;
            }

            var playerUnitWeapon = player_unit.actor.weapon;

            if (player_selected && player_unit.is_on_siege())
            {
                playerUnitWeapon = player_unit.items[Siege_Engine.SiegeInventoryIndex].to_weapon;
            }

            var selectedUnitWeapon = player_selected ? playerUnitWeapon : unitWeapon;

            // HP
            if (player_unit == null || player_unit == unit ||
                selectedUnitWeapon == null || selectedUnitWeapon.is_staff())
            {
                Window_Width = 56;
                Window_Img.set_width(Window_Width);
                target_info_visible(false);

                Hp_Gauge.set_val(unit.actor.hp, unit.actor.maxhp);
            }
            else
            {
                Window_Width = 56 + 72;
                Window_Img.set_width(Window_Width);
                target_info_visible(true);

                TargetName.text   = player_unit.actor.name;
                TargetName.offset = new Vector2(TargetName.text_width / 2, 0); //Debug
                //TargetName.offset = new Vector2(24, 0);

                TargetItem.texture = null;
                if (playerUnitWeapon != null)
                {
                    string filename = string.Format(@"Graphics/Icons/{0}", playerUnitWeapon.Image_Name);
                    if (Global.content_exists(filename))
                    {
                        TargetItem.texture = Global.Content.Load <Texture2D>(filename);
                    }
                    TargetItem.index = playerUnitWeapon.Image_Index;
                }

                // Player unit has no weapon
                if (playerUnitWeapon == null || playerUnitWeapon.is_staff())
                {
                    (Hp_Gauge as Unit_Info_Hp_Gauge_Damage).set_val(
                        unit.actor.hp, unit.actor.maxhp);
                }
                else
                {
                    int distance = playerUnitWeapon != null ?
                                   playerUnitWeapon.Min_Range : 1;
                    var stats = new CombatStats(player_unit.id, unit.id,
                                                itemIndex: player_selected && player_unit.is_on_siege() ?
                                                Siege_Engine.SiegeInventoryIndex : -1,
                                                distance: distance)
                    {
                        location_bonuses = CombatLocationBonuses.NoAttackerBonus
                    };
                    (Hp_Gauge as Unit_Info_Hp_Gauge_Damage).set_val(
                        unit.actor.hp, unit.actor.maxhp,
                        stats.inverse_rounds_to_kill());

                    Weapon_Triangle_Arrow.SetWeaponTriangle(
                        WTA2,
                        player_unit,
                        unit,
                        playerUnitWeapon,
                        unitWeapon,
                        distance);
                    if (playerUnitWeapon.effective_multiplier(player_unit, unit) > 1)
                    {
                        TargetItem.flash = true;
                    }
                }

                // Target has no weapon
                if (unitWeapon == null || unitWeapon.is_staff())
                {
                    TargetHpGauge.set_val(unit.actor.hp, unit.actor.maxhp);
                }
                else
                {
                    int distance = unitWeapon != null ?
                                   unitWeapon.Min_Range : 1;
                    var target_stats = new CombatStats(unit.id, player_unit.id,
                                                       itemIndex: !player_selected && unit.is_on_siege() ?
                                                       Siege_Engine.SiegeInventoryIndex : -1,
                                                       distance: distance)
                    {
                        location_bonuses = CombatLocationBonuses.NoDefenderBonus
                    };
                    TargetHpGauge.set_val(
                        player_unit.actor.hp, player_unit.actor.maxhp,
                        target_stats.inverse_rounds_to_kill());

                    Weapon_Triangle_Arrow.SetWeaponTriangle(
                        WTA1,
                        unit,
                        player_unit,
                        unitWeapon,
                        playerUnitWeapon,
                        distance);
                    if (unitWeapon.effective_multiplier(unit, player_unit) > 1)
                    {
                        Item.flash = true;
                    }
                }
            }
        }