Ejemplo n.º 1
0
        public virtual void set_text(string text, Vector2 offset = new Vector2())
        {
            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        = "";
            Help_Text.draw_offset = offset;
            Help_String           = Regex.Replace(text, @"LVL_CAP", Global.ActorConfig.LvlCap.ToString());
            int width = 32;

            string[] text_ary = Help_String.Split('\n'); //text.Split('\n'); //Debug
            foreach (string str in text_ary)
            {
                width = Math.Max(Font_Data.text_width(str, Config.CONVO_FONT), width);
            }
            width = width + (width % 8 == 0 ? 0 : (8 - width % 8)) + 16;
            //size = new Vector2(width, (Math.Max(1, text.Split('\n').Length) + 1) * 16); //Debug
            size = new Vector2(width, (Math.Max(1, Help_String.Split('\n').Length) + 1) * 16);
        }
Ejemplo n.º 2
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);
        }