Exemplo n.º 1
0
 public Ability()
 {
     abilityLine = Engine.Engine.GetTexture("UI/Abilities");
     abilitySprites = new Sprite[30];
     for (int i = 0; i < abilitySprites.Length; i++)
     {
         abilitySprites[i] = new Sprite(abilityLine, new IntVec(i, 0));
     }
 }
Exemplo n.º 2
0
        public static void LoadContent(ContentManager content)
        {
            //mainMenuTheme = content.Load<Song>("Audio/Stoneworld Battle");
            contentManager = content;

            notFound = new DynamicTexture(contentManager.Load<Texture2D>("error"), false);

            foreach (string path in subscribed)
            {
                try
                {
                    textureDictionary[path].texture = contentManager.Load<Texture2D>(path);
                }
                catch (ContentLoadException e)
                {
                    textureDictionary[path].texture = notFound.texture;
                    Engine.Log("Texture '" + path + "' could not be found.");
                    //Engine.Log(e.ToString());
                }
            }
            ContentLoaded(content);
        }
Exemplo n.º 3
0
        public static void LoadContent(ContentManager content)
        {
            //mainMenuTheme = content.Load<Song>("Audio/Stoneworld Battle");
            contentManager = content;


            notFound = new DynamicTexture(contentManager.Load <Texture2D>("error"), false);

            foreach (string path in subscribed)
            {
                try
                {
                    textureDictionary[path].texture = contentManager.Load <Texture2D>(path);
                }
                catch (ContentLoadException e)
                {
                    textureDictionary[path].texture = notFound.texture;
                    Engine.Log("Texture '" + path + "' could not be found.");
                    //Engine.Log(e.ToString());
                }
            }
            ContentLoaded(content);
        }
Exemplo n.º 4
0
        public static DynamicTexture GetTexture(string path)
        {
            textureDictionary = textureDictionary ?? new Dictionary <string, DynamicTexture>();
            subscribed        = subscribed ?? new List <string>();

            DynamicTexture result = null;

            if (!textureDictionary.TryGetValue(path, out result))
            {
                if (contentManager == null)
                {
                    result = new DynamicTexture();
                    textureDictionary.Add(path, result);
                    subscribed.Add(path);
                }
                else
                {
                    DynamicTexture newTex;
                    try
                    {
                        newTex = new DynamicTexture(contentManager.Load <Texture2D>(path));
                        textureDictionary.Add(path, newTex);
                    }
                    catch (ContentLoadException e)
                    {
                        textureDictionary.Add(path, notFound);
                        Engine.Log("Texture '" + path + "' could not be found.");
                        //Engine.Log(e.ToString());
                        newTex = notFound;
                    }

                    result = newTex;
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        public static DynamicTexture GetTexture(string path)
        {
            textureDictionary = textureDictionary ?? new Dictionary<string, DynamicTexture>();
            subscribed = subscribed ?? new List<string>();

            DynamicTexture result = null;

            if (!textureDictionary.TryGetValue(path, out result))
            {
                if (contentManager == null)
                {
                    result = new DynamicTexture();
                    textureDictionary.Add(path, result);
                    subscribed.Add(path);
                }
                else
                {
                    DynamicTexture newTex;
                    try
                    {
                        newTex = new DynamicTexture(contentManager.Load<Texture2D>(path));
                        textureDictionary.Add(path, newTex);
                    }
                    catch (ContentLoadException e)
                    {
                        textureDictionary.Add(path, notFound);
                        Engine.Log("Texture '" + path + "' could not be found.");
                        //Engine.Log(e.ToString());
                        newTex = notFound;
                    }

                    result = newTex;
                }
            }
            return result;
        }
Exemplo n.º 6
0
 public void update()
 {
     if (currentBackTex != null)
     {
         IntVec mpos = MouseController.MouseScreenPosition();
         bool isMouseOver = mpos.X > pos.X && mpos.X < pos.X + currentBackTex.texture.Width &&
             mpos.Y > pos.Y && mpos.Y < pos.Y + currentBackTex.texture.Height;
         doToolTip = isMouseOver;
         if (ability.type == Enums.AbilityTypes.Toggle)
         {
             currentBackTex = ((Abilities.Togglable.ToggleAbility)ability).isActive || ability.getCooldown() > 0? highlighted : standard;
         }
     }
 }
Exemplo n.º 7
0
 public static void AddGridSelections(IntVec[] gridSpaces, DynamicTexture tex)
 {
     foreach (IntVec iv in gridSpaces){
         gridSelection.Add(new GridSelection(iv, tex));
     }
 }
Exemplo n.º 8
0
 public static void AddVisualAttack(GameCharacter origin, GameCharacter target, DynamicTexture attackSprite, float startScale = 1, float endScale = 1, float scaleAmount = 0.05f)
 {
     IntVec gamePositionOrigin = currentLevel.CharacterEntities.FindPosition(origin) * CELLWIDTH;
     Vector2 originVector = Vector2.Transform(new Vector2(gamePositionOrigin.X, gamePositionOrigin.Y), worldToView);
     IntVec gamePositionDest = currentLevel.CharacterEntities.FindPosition(target) * CELLWIDTH;
     Vector2 destVector = Vector2.Transform(new Vector2(gamePositionDest.X, gamePositionDest.Y), worldToView);
     if (attackSprite != null)
     {
         vattacks.Add(new VisualAttack(originVector, destVector, 5, attackSprite, startScale, endScale, scaleAmount));
     }
     else
     {
         vattacks.Add(new VisualAttack(originVector, destVector, 5, "attackSprite"));
     }
 }
Exemplo n.º 9
0
 public VisualAttack(Vector2 screenPosition, Vector2 destination, float speed, string weaponDynTex, float startScale, float endScale, float scaleAmount)
 {
     this.screenPosition = screenPosition;
     this.speed = speed;
     this.scale = startScale;
     this.endScale = endScale;
     this.scaleRate = scaleAmount;
     tex = Engine.GetTexture(weaponDynTex);
     this.direction = new Vector2(destination.X, destination.Y) - screenPosition;
     distance = direction.Length();
     angle = (float)Math.Atan2(direction.X, -direction.Y);
     this.direction.Normalize();
 }
Exemplo n.º 10
0
 public VisualAttack(Vector2 screenPosition, string weaponDynTex, float startScale, float endScale, float scaleAmount)
 {
     this.screenPosition = screenPosition;
     this.scale = startScale;
     this.endScale = endScale;
     this.scaleRate = scaleAmount;
     tex = Engine.GetTexture(weaponDynTex);
 }
Exemplo n.º 11
0
        public VisualAttack(Vector2 screenPosition, Vector2 destination, float speed, string weaponSprite = "attackDefault")
        {
            this.screenPosition = screenPosition;
            this.speed = speed;
            this.scaleRate = 0;
            this.endScale = 1;

            tex = Engine.GetTexture(weaponSprite);
            this.direction = new Vector2(destination.X, destination.Y) - screenPosition;
            distance = direction.Length();
            angle = (float)Math.Atan2(direction.X, -direction.Y);
            this.direction.Normalize();
        }
Exemplo n.º 12
0
 public UIButton(Vector2 position, bool centered, string drawOverTexture, string caption)
 {
     pos = position;
     if (centered)
     {
         pos.X -= Engine.CELLWIDTH / 2;//standard.texture.Width / 2;
         pos.Y -= Engine.CELLWIDTH / 2;//standard.texture.Height / 2;
     }
     if (drawOverTexture != null)
     {
         drawOver = Engine.GetTexture(drawOverTexture);
         doDrawOver = true;
     }
     this.caption = caption;
     currentBackTex = standard.texture;
 }
Exemplo n.º 13
0
 public Splash(DynamicTexture t, Vector2 pos, float scaleMax, float scaleMod)
 {
     tex = t;
     scale = 0;
     this.scaleMax = scaleMax;
     this.scaleMod = scaleMod;
     position = pos;
 }
Exemplo n.º 14
0
 public GridSelection(IntVec iv, DynamicTexture t)
 {
     gridPos = iv;
     tex = t;
 }
Exemplo n.º 15
0
        public CharButton(Vector2 position, bool centered, string standardS, string highS)
        {
            standard = Engine.GetTexture(standardS);
            highlighted = Engine.GetTexture(highS);
            pos = position;
            if (centered)
            {
                pos.X -= standard.texture.Width / 2;//standard.texture.Width / 2;
                pos.Y -= standard.texture.Height / 2;//standard.texture.Height / 2;
            }

            currentBackTex = standard.texture;
        }