예제 #1
0
파일: Ability.cs 프로젝트: JonECG/Brogue
 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));
     }
 }
예제 #2
0
파일: JonEngine.cs 프로젝트: JonECG/Brogue
        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);
        }
예제 #3
0
파일: JonEngine.cs 프로젝트: JonECG/Brogue
        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);
        }
예제 #4
0
파일: JonEngine.cs 프로젝트: JonECG/Brogue
        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);
        }
예제 #5
0
파일: JonEngine.cs 프로젝트: JonECG/Brogue
        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;
        }
예제 #6
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 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;
         }
     }
 }
예제 #7
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 public static void AddGridSelections(IntVec[] gridSpaces, DynamicTexture tex)
 {
     foreach (IntVec iv in gridSpaces){
         gridSelection.Add(new GridSelection(iv, tex));
     }
 }
예제 #8
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 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"));
     }
 }
예제 #9
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 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();
 }
예제 #10
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 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);
 }
예제 #11
0
파일: Engine.cs 프로젝트: JonECG/Brogue
        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();
        }
예제 #12
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 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;
 }
예제 #13
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 public Splash(DynamicTexture t, Vector2 pos, float scaleMax, float scaleMod)
 {
     tex = t;
     scale = 0;
     this.scaleMax = scaleMax;
     this.scaleMod = scaleMod;
     position = pos;
 }
예제 #14
0
파일: Engine.cs 프로젝트: JonECG/Brogue
 public GridSelection(IntVec iv, DynamicTexture t)
 {
     gridPos = iv;
     tex = t;
 }
예제 #15
0
파일: Engine.cs 프로젝트: JonECG/Brogue
        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;
        }