public virtual void set_image(Game_Actor actor, Item_Data item_data)
        {
            if (item_data.non_equipment)
            {
                Icon.texture = null;
                Name.text    = "";
                Uses.text    = "";
                Slash.text   = "";
                Use_Max.text = "";
            }
            else
            {
                Data_Equipment item = item_data.to_equipment;
                // Icon
                if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name))
                {
                    Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name));
                    Icon.columns = (int)(Icon.texture.Width / Icon.size.X);
                }
                Icon.index = item.Image_Index;
                // Name
                Name.text = item.Name;
                // Uses
                Uses.text    = item_data.Uses < 0 ? "--" : item_data.Uses.ToString();
                Slash.text   = "/";
                Use_Max.text = item.Uses < 0 ? "--" : item.Uses.ToString();

                set_text_color(actor, item);
            }
        }
 public override void refresh_info(Game_Actor actor, Data_Equipment item,
                                   int[] statValues, int[] baseStatValues)
 {
     // No item or weapon
     if (item == null || is_weapon_highlighted(item))
     {
         Item_Description.text = "";
     }
     // Item
     else
     {
         Item_Description.text = "";
         if (item.is_weapon)
         {
             Item_Description.SetColor(Global.Content, "Grey");
         }
         else
         {
             Item_Description.SetColor(Global.Content,
                                       Combat.can_use_item(actor, item.Id, false) ?
                                       "White" : "Grey");
         }
         string[] desc_ary = item.Quick_Desc.Split('|');
         for (int i = 0; i < desc_ary.Length; i++)
         {
             Item_Description.text += desc_ary[i] + "\n";
         }
     }
 }
        protected override void set_text_color(Game_Actor actor, Data_Equipment item)
        {
            base.set_text_color(actor, item);

            // Grey out if can't be discarded
            bool canDiscard = Global.battalion.convoy_ready_for_sending ||
                              actor.CanDiscard(item);
            string color = canDiscard ? "White" : "Grey";

            change_text_color(color);
        }
Exemple #4
0
        protected override void set_text_color(Game_Actor actor, Data_Equipment item)
        {
            bool useable;

            if (item.is_weapon)
            {
                useable = false;
            }
            else
            {
                useable = Combat.can_use_item(actor, item.Id, false);
            }

            set_text_color(useable);
        }
Exemple #5
0
        protected virtual void set_text_color(Game_Actor actor, Data_Equipment item, Item_Data item_data, int price)
        {
            bool useable;

            if (item.is_weapon && actor != null)
            {
                useable = actor.is_equippable(item as Data_Weapon);
            }
            else
            {
                useable = true;
            }

            set_text_color(useable, buyable_text(price, item_data));
        }
Exemple #6
0
        protected override void set_text_color(Game_Actor actor, Data_Equipment item)
        {
            bool useable;

            if (item.is_weapon)
            {
                useable = actor.is_equippable_as_siege(item as Data_Weapon);
            }
            else
            {
                useable = actor.prf_check(item) && ((item as Data_Item).Promotes.Count == 0) || Combat.can_use_item(actor, item.Id, false);
            }

            set_text_color(useable);
        }
        public void set_item(Data_Equipment item)
        {
            WTSet.Clear();

            if (item != null && item.is_weapon)
            {
                var weapon = item as Data_Weapon;

                int x = 0;

                add_wta(weapon.Reaver(), weapon.main_type(), ref x);
                if (weapon.Scnd_Type != 0)
                {
                    add_wta(weapon.Reaver(), weapon.scnd_type(), ref x);
                }
            }
        }
Exemple #8
0
 protected void add_icon(Item_Data item_data, int index, int numItems, bool drops_item)
 {
     if (item_data.Id > 0)
     {
         Data_Equipment item = item_data.to_equipment;
         Icons.Add(new Item_Icon_Sprite());
         if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name))
         {
             Icons[Icons.Count - 1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item.Image_Name);
         }
         Icons[Icons.Count - 1].index          = item.Image_Index;
         Icons[Icons.Count - 1].loc            = new Vector2((Icons.Count - 1) * 16, 0);
         Icons[Icons.Count - 1].flash_color    = new Color(72, 232, 32, 255);
         Icons[Icons.Count - 1].flash_time_max = 120;
         //Icons[Icons.Count - 1].flash = (unit.drops_item && i == unit.actor.num_items - 1); //Debug
         Icons[Icons.Count - 1].flash   = (drops_item && index == numItems - 1);
         Icons[Icons.Count - 1].scissor = scissor();
     }
 }
        public void set_image(Game_Actor actor, Item_Data item_data, int active_item)
        {
            base.set_image(actor, item_data);
            if (!item_data.non_equipment)
            {
                Data_Equipment item = item_data.to_equipment;

                bool useable = false;
                if (active_item >= 0)
                {
                    var  usedItem  = actor.items[active_item].to_item;
                    bool canTarget = usedItem.can_target_item(item_data);
                    useable = canTarget;

                    if (usedItem.can_repair)
                    {
                        if (canTarget)
                        {
                            Arrow       = new Weapon_Triangle_Arrow();
                            Arrow.value = WeaponTriangle.Advantage;

                            int    repairUses = item_data.RepairAmount(usedItem);
                            int    uses       = item_data.UsesAfterRepair(false, repairUses);
                            string color      = uses == item_data.max_uses ? "Green" : "Blue";

                            Uses.SetColor(Global.Content, color);

                            RepairUses = new TextSprite(
                                Config.UI_FONT, Global.Content, color,
                                Vector2.Zero,
                                uses < 0 ? "--" : uses.ToString());

                            Slash.loc   += new Vector2(24, 0);
                            Use_Max.loc += new Vector2(24, 0);
                        }
                    }
                }

                set_text_color(useable);
            }
        }
Exemple #10
0
        public virtual void set_image(Game_Actor actor, Item_Data item_data, int stock, int price)
        {
            Data_Equipment item = item_data.to_equipment;

            if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name))
            {
                Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name));
                Icon.columns = (int)(Icon.texture.Width / Icon.size.X);
            }
            Icon.index = item.Image_Index;
            // Name
            Name.text = item.Name;
            // Uses
            Uses.text    = item_data.Uses < 0 ? "--" : item_data.Uses.ToString();
            Slash.text   = price.ToString();
            Use_Max.text = stock < 0 ? "--" : stock.ToString();
            // Num owned in battalion
            Convoy.text = Global.battalion.item_count(item_data).ToString();

            set_text_color(actor, item, item_data, price);
        }
Exemple #11
0
        public void set_image(Game_Actor actor, Item_Data item_data, int count)
        {
            if (item_data.non_equipment)
            {
                Icon.texture = null;
                Name.text    = "";
                Uses.text    = "";
                Slash.text   = "";
                Use_Max.text = "";
            }
            else
            {
                Data_Equipment item = item_data.to_equipment;
                // Icon
                Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name));
                Icon.index   = item.Image_Index;
                // Name
                Name.text = item.Name;
                // Uses
                Uses.text = item_data.Uses < 0 ? "--" : item_data.Uses.ToString();
                if (count == 0)
                {
                    Uses.draw_offset = new Vector2(0, 0);
                    Slash.text       = "";
                    Use_Max.text     = "";
                }
                else
                {
                    Uses.draw_offset = new Vector2(0, 0);
                    Slash.text       = "x";
                    Use_Max.text     = count < 0 ? "--" : count.ToString();
                }

                Slash.visible       = Use_Max.text.Length <= 2;
                Use_Max.draw_offset = new Vector2(
                    Use_Max.text.Length <= 2 ? 8 : 0, 0);

                set_text_color(actor, item);
            }
        }
Exemple #12
0
        public virtual void set_image(Game_Actor actor, Data_Equipment item)
        {
            if (item == null)
            {
                Icon.texture = null;
                Name.text    = "-----";
            }
            else
            {
                // Icon
                if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name))
                {
                    Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name));
                }
                Icon.index   = item.Image_Index;
                Icon.columns = (int)(Icon.texture.Width / Icon.size.X);
                // Name
                Name.text = item.Name;

                set_text_color(actor, item);
            }
        }
Exemple #13
0
        public override void set_image(Game_Actor actor, Item_Data item_data)
        {
            base.set_image(actor, item_data);
            if (!item_data.non_equipment)
            {
                Data_Equipment item = item_data.to_equipment;

                bool can_restock = false;
                if (item_data.Uses != item.Uses)
                {
                    for (int i = 0; i < Global.game_battalions.active_convoy_data.Count; i++)
                    {
                        if (item_data.same_item(Global.game_battalions.active_convoy_data[i]))
                        {
                            can_restock = true;
                            break;
                        }
                    }
                }
                set_text_color(can_restock);
            }
        }
Exemple #14
0
        public virtual void refresh_info(Game_Actor actor, Data_Equipment item,
                                         int[] statValues, int[] baseStatValues)
        {
            // No item
            if (item == null)
            {
                Item_Description.text = "";
            }
            // Weapon
            else if (is_weapon_highlighted(item))
            {
                ShowingDescription = false;
                var type = (item as Data_Weapon).main_type();
                Stats[0].text = statValues[0].ToString();
                Stats[1].text = ((Data_Weapon)item).Crt < 0 ? "--" : statValues[1].ToString();
                Stats[2].text = statValues[2].ToString();
                Stats[3].text = statValues[3].ToString();
                for (int i = 0; i < 4; i++)
                {
                    Arrows[i].value = statValues[i] == baseStatValues[i] ?
                                      WeaponTriangle.Nothing : (statValues[i] > baseStatValues[i] ?
                                                                WeaponTriangle.Advantage : WeaponTriangle.Disadvantage);
                }
                Type_Icon.index = type.IconIndex;
            }
            // Item
            else
            {
                ShowingDescription    = true;
                Item_Description.text = "";
                string[] desc_ary = item.Quick_Desc.Split('|');
                for (int i = 0; i < desc_ary.Length; i++)
                {
                    Item_Description.text += desc_ary[i] + "\n";
                }
            }

            WTHelp.set_item(item);
        }
Exemple #15
0
        public void set_item(Item_Data item_data, Game_Actor actor)
        {
            Weapon_Data   = null;
            Help_Text     = new TextSprite();
            Help_Text.loc = new Vector2(8, 8);
            Help_Text.SetFont(Config.CONVO_FONT, Global.Content, "Black");
            Help_Text.text = "";

            Data_Equipment item = item_data.to_equipment;

            Help_String = item.Description.Replace("|", "\n");
            int width, rows;

            // If weapon
            if (item.is_weapon)
            {
                // If staff
                if (!(item as Data_Weapon).is_staff())
                {
                    //Help_Text.loc += new Vector2(0, 32); //Debug
                    width = 176; //160;
                    rows  = 2;
                }
                // Else
                else
                {
                    //Help_Text.loc += new Vector2(0, 16); //Debug
                    width = 160;
                    rows  = 1;
                }
                foreach (int bonus in (item as Data_Weapon).Effectiveness)
                {
                    if (bonus != 1)
                    {
                        rows++;
                        break;
                    }
                }
                Help_Text.loc += new Vector2(0, rows * 16);

                Weapon_Data     = new Help_Weapon_Data(item_data, actor);
                Weapon_Data.loc = new Vector2(8, 8);
                string[] text_ary = Help_String.Split('\n');
                foreach (string str in text_ary)
                {
                    width = Math.Max(Font_Data.text_width(str, Config.CONVO_FONT), width);
                }
                width = (width % 8 == 0 ? 0 : (8 - width % 8)) + width + 16;
            }
            else
            {
                width = 16;
                rows  = 0;
                string[] text_ary = Help_String.Split('\n');
                foreach (string str in text_ary)
                {
                    width = Math.Max(Font_Data.text_width(str, Config.CONVO_FONT), width);
                }
                width = (width % 8 == 0 ? 0 : (8 - width % 8)) + width + 16;
            }
            size = new Vector2(width, (Math.Max(0, Help_String.Length == 0 ? 0 : Help_String.Split('\n').Length) + rows + 1) * 16);
        }
Exemple #16
0
 protected virtual bool is_weapon_highlighted(Data_Equipment item)
 {
     return(item != null && item.is_weapon && !(item as Data_Weapon).is_staff());
 }
Exemple #17
0
        public override void set_image(Game_Actor actor, Data_Equipment item)
        {
#if DEBUG
            throw new NotImplementedException();
#endif
        }