コード例 #1
0
 public Sprite(ImageTag inTag, SpriteEffects inEffect, Color inColor, SpriteName inName)
 {
     _image = ImageManager.getInstance().find(inTag);
     Effect = inEffect;
     color  = inColor;
     Name   = inName;
 }
コード例 #2
0
ファイル: Tool.cs プロジェクト: filmobile/MainRoad
        public override bool Apply(ROI roi)
        {
            var list = new List <Point>();

            foreach (var point in roi.Where(t => Map.Cells[t.X, t.Y].Type == CellType.Flat))
            {
                if (!point.IsBorder())
                {
                    list.Add(point);
                }
            }

            for (int i = 0; i < Count; i++)
            {
                var p = list[Rnd.Next(list.Count)];


                if (SpriteName.Contains("_part_1"))
                {
                    // 2 x 2 tile
                    if (Map.Cells[p.X + 1, p.Y].Type == CellType.Flat &&
                        Map.Cells[p.X + 1, p.Y + 1].Type == CellType.Flat &&
                        Map.Cells[p.X, p.Y + 1].Type == CellType.Flat)
                    {
                        Map.Cells[p.X, p.Y] = new Cell {
                            SpriteName = SpriteName, Type = CellType.InsideElement
                        };
                        Map.Cells[p.X + 1, p.Y] = new Cell {
                            SpriteName = SpriteName.Replace("_part_1", "_part_2"), Type = CellType.InsideElement
                        };
                        Map.Cells[p.X, p.Y + 1] = new Cell {
                            SpriteName = SpriteName.Replace("_part_1", "_part_3"), Type = CellType.InsideElement
                        };
                        Map.Cells[p.X + 1, p.Y + 1] = new Cell {
                            SpriteName = SpriteName.Replace("_part_1", "_part_4"), Type = CellType.InsideElement
                        };
                    }
                    continue;
                }

                var cx = Rnd.Next(3);
                var cy = Rnd.Next(3);
                for (int x = 0; x < cx; x++)
                {
                    for (int y = 0; y < cy; y++)
                    {
                        if (Map.Cells[p.X + x, p.Y + y].Type == CellType.Flat)
                        {
                            Map.Cells[p.X + x, p.Y + y] = new Cell {
                                SpriteName = SpriteName, Type = CellType.InsideElement
                            }
                        }
                    }
                }
                ;
            }

            return(true);
        }
コード例 #3
0
        private static string GetCryFileName(PKM pk)
        {
            // don't grab sprite of pkm, no gender specific cries
            var res = SpriteName.GetResourceStringSprite(pk.Species, pk.AltForm, 0, pk.Format);

            return(res.Replace('_', '-') // people like - instead of _ file names ;)
                   .Substring(1));       // skip leading underscore
        }
コード例 #4
0
ファイル: WindowHeaderSpec.cs プロジェクト: thurn/sagan
 private static CompositeSpec Image(SpriteName imageName) =>
 new CompositeSpec(
     name: "WindowHeaderImage",
     transform: new RectTransformSpec(
         size: new Vector2(x: 500f, y: 150f)),
     children: List(
         new ImageSpec(
             sourceImage: imageName,
             imageType: new SimpleImageType())));
コード例 #5
0
 public ColObj(Rectangle inRect, ColObjName inCName, SpriteName inSName)
 {
     Name       = inCName;
     rect       = inRect;
     _ColSprite = new ColSprite(Rectangle.Empty, new Vector2(1, 1), 0.0f, 1.0f, inSName);
     if (_ColSprite != null)
     {
         SpriteBatchManager.getInstance().Find(SpriteBatchName.Collisions).Add(_ColSprite);
     }
 }
コード例 #6
0
        public Alien CreateAliens(Rectangle inRect, SpriteName inSName, NodeName inColGrName, int score)
        {
            TextureSprite Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, inSName);
            ColObj        _colobj = new ColObj(inRect, ColObjName.Crab, SpriteName.BBox);
            Alien         Obj     = new Alien(GameObjName.Alien, _colobj, new Vector2(inRect.X, inRect.Y), Text, score);

            ColObjManager.getInstance().Add(_colobj);
            SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);

            return(Obj);
        }
コード例 #7
0
 public Rectangle GetTextureRegion(SpriteName name, int step)
 {
     if (!textureRegions.ContainsKey(name))
     {
         throw new ArgumentException();
     }
     if (textureRegions[name].Length < step || step < 0)
     {
         throw new ArgumentException();
     }
     return(textureRegions[name][step]);
 }
コード例 #8
0
ファイル: CryPlayer.cs プロジェクト: rv2900/PKHeX
        private static string GetCryFileName(PKM pk)
        {
            if (pk.Species == (int)Species.Urshifu && pk.AltForm == 1) // same sprite for both forms, but different cries
            {
                return("892-1");
            }

            // don't grab sprite of pkm, no gender specific cries
            var res = SpriteName.GetResourceStringSprite(pk.Species, pk.AltForm, 0, 0, pk.Format);

            return(res.Replace('_', '-') // people like - instead of _ file names ;)
                   .Substring(1));       // skip leading underscore
        }
コード例 #9
0
        public SkinnableSprite()
            : base(new SpriteComponent(string.Empty), ConfineMode.NoScaling)
        {
            RelativeSizeAxes = Axes.None;
            AutoSizeAxes     = Axes.Both;

            SpriteName.BindValueChanged(name =>
            {
                ((SpriteComponent)Component).LookupName = name.NewValue ?? string.Empty;
                if (IsLoaded)
                {
                    SkinChanged(CurrentSkin);
                }
            });
        }
コード例 #10
0
        // Clear the object

        public void wash()
        {
            this.spriteName  = SpriteName.Uninitilized;
            this.spriteImage = ImageManager.find(Image.ImageName.Uninitilized);

            Debug.Assert(spriteImage != null);

            this.x     = 0.0f;
            this.y     = 0.0f;
            this.sx    = 1.0f;
            this.sy    = 1.0f;
            this.angle = 0.0f;

            this.azulSprite.Swap(spriteImage.getAzulTexture(), spriteImage.imageRect, cDefScreenRect, cDefColor);
            this.spriteColor = cDefColor;
            this.screenRect.Set(cDefScreenRect);
        }
コード例 #11
0
        // parameterized constructor

        public Sprite(SpriteName spriteName, Image spriteImage, Azul.Rect screenRect, Azul.Color mColor)
        {
            //setAll(spriteName,spriteImage,screenRect,mColor);
            Debug.Assert(spriteImage != null);
            Debug.Assert(screenRect != null);
            Debug.Assert(mColor != null);

            this.spriteImage = spriteImage;
            this.spriteName  = spriteName;
            this.screenRect.Set(screenRect);
            this.spriteColor.Set(mColor);

            this.x     = azulSprite.x;
            this.y     = azulSprite.y;
            this.sx    = azulSprite.sx;
            this.sy    = azulSprite.sy;
            this.angle = azulSprite.angle;
        }
コード例 #12
0
        public Sprite find(SpriteName inName)
        {
            int index = 0;

            Sprite Obj = (Sprite)List.getDatabyIndex(index);

            while (Obj != null)
            {
                if (Obj.getName() == inName)
                {
                    return(Obj);
                }

                index++;
                Obj = (Sprite)List.getDatabyIndex(index);
            }

            return(null);
        }
コード例 #13
0
        public AGameObject(Rectangle region, SpriteName spriteName, GameMatrix parent, AGameObject left = null, AGameObject right = null, AGameObject top = null, AGameObject bottom = null)
        {
            Region = region;

            this.Parent = parent;

            NewPosition = new Point(region.X, region.Y);

            SpriteName = spriteName;

            Left   = left;
            Right  = right;
            Top    = top;
            Bottom = bottom;

            Visible = true;

            if (Left != null)
            {
                Left.Right = this;
            }
            if (Right != null)
            {
                Right.Left = this;
            }
            if (Top != null)
            {
                Top.Bottom = this;
            }
            if (Bottom != null)
            {
                Bottom.Top = this;
            }

            AnimationState      = SpriteAnimationState.SHOW;
            SpriteAnimationStep = 8;

            gFactory = GameObjectFactory.GetInstance();
            gc       = GameConfigs.GetInstance();
        }
コード例 #14
0
        //default constructor

        public Sprite() : base()
        {
            this.spriteName = Sprite.SpriteName.Uninitilized;

            this.spriteImage = ImageManager.find(Image.ImageName.NullObject);
            Debug.Assert(this.spriteImage != null);

            this.spriteColor = new Azul.Color();
            Debug.Assert(this.spriteColor != null);

            this.screenRect = new Azul.Rect(cDefScreenRect);
            Debug.Assert(screenRect != null);

            this.azulSprite = new Azul.Sprite(spriteImage.getAzulTexture(), spriteImage.imageRect, cDefScreenRect, this.spriteColor);
            Debug.Assert(this.azulSprite != null);

            this.x     = azulSprite.x;
            this.y     = azulSprite.y;
            this.sx    = azulSprite.sx;
            this.sy    = azulSprite.sy;
            this.angle = azulSprite.angle;
        }
コード例 #15
0
        public void setAll(SpriteName spriteName, Image spriteImage, float x, float y, float width, float height, Azul.Color mColor)
        {
            Debug.Assert(spriteImage != null);

            this.spriteImage = spriteImage;
            this.spriteName  = spriteName;

            //    this.spriteColor.Set(cDefColor.red,cDefColor.green,cDefColor.blue);
            this.spriteColor.Set(mColor);

            this.screenRect.Set(x, y, width, height);

            this.azulSprite.Swap(spriteImage.imageTexture.azulTexture, spriteImage.imageRect, screenRect, spriteColor);

            Debug.Assert(this.azulSprite != null);

            this.x     = azulSprite.x;
            this.y     = azulSprite.y;
            this.sx    = azulSprite.sx;
            this.sy    = azulSprite.sy;
            this.angle = azulSprite.angle;
        }
コード例 #16
0
ファイル: Res.cs プロジェクト: thurn/sagan
        public Sprite GetSprite(SpriteName spriteName)
        {
            switch (spriteName)
            {
            case SpriteName.ExampleImage:
                return(ExampleImage);

            case SpriteName.ImageBoxBackground:
                return(ImageBoxBackground);

            case SpriteName.WindowBackground:
                return(WindowBackground);

            case SpriteName.WindowHeader:
                return(WindowHeader);

            case SpriteName.TextFieldNormal:
                return(TextFieldNormal);

            default:
                throw Errors.UnknownEnumValue(spriteName);
            }
        }
コード例 #17
0
ファイル: ImageBoxSpec.cs プロジェクト: thurn/sagan
 public ImageBoxSpec(
     string name,
     Vector2 size,
     SpriteName image) : base(
         name: name + "ImageBoxBackground",
         transform: new RectTransformSpec(
             size: size),
         children: List(
             new ImageSpec(
                 sourceImage: SpriteName.ImageBoxBackground),
             new LayoutElementSpec(
                 preferredWidth: size.x,
                 preferredHeight: size.y),
             new CompositeSpec(
                 name: name + "ImageBox",
                 transform: new RectTransformSpec(
                     size: new Vector2(x: -10f, y: -10f),
                     horizontalAnchor: HorizontalAnchor.Stretch,
                     verticalAnchor: VerticalAnchor.Stretch),
                 children: List(
                     new ImageSpec(
                         sourceImage: image)))))
 {
 }
コード例 #18
0
 public static Sprite GetSprite(SpriteName spriteName)
 {
     #if FULL_DEBUG
     SpriteInfo spriteInfo;
     if (!sprite_info_table.TryGetValue(spriteName, out spriteInfo))
     {
         Debug.LogError("No image found for " + spriteName);
         return null;
     }
     else
     {
         return spriteInfo.sprite;
     }
     #else
     return sprite_info_table[spriteName].sprite;
     #endif
 }
コード例 #19
0
    /// <summary>
    /// Изменяет язык спрайта.
    /// </summary>
    /// <param name="spriteName">Название спрайта, язык которого будет изменён.</param>
    /// <returns></returns>
    public static Sprite ChangeLanguage(SpriteName spriteName)
    {
        switch (Vault.currentLanguage)
        {
        case SystemLanguage.Russian:

            if (spriteName == SpriteName.EvasionMode)
            {
                return(Vault.instance.spriteEvasionModeRus);
            }
            if (spriteName == SpriteName.Excellent)
            {
                return(Vault.instance.spriteExcellentRus);
            }
            if (spriteName == SpriteName.Fiasco)
            {
                return(Vault.instance.spriteFiascoRus);
            }
            if (spriteName == SpriteName.Pause)
            {
                return(Vault.instance.spritePauseRus);
            }
            if (spriteName == SpriteName.ThrowPower)
            {
                return(Vault.instance.spriteThrowPowerRus);
            }
            break;

        case SystemLanguage.English:

            if (spriteName == SpriteName.EvasionMode)
            {
                return(Vault.instance.spriteEvasionModeEng);
            }
            if (spriteName == SpriteName.Excellent)
            {
                return(Vault.instance.spriteExcellentEng);
            }
            if (spriteName == SpriteName.Fiasco)
            {
                return(Vault.instance.spriteFiascoEng);
            }
            if (spriteName == SpriteName.Pause)
            {
                return(Vault.instance.spritePauseEng);
            }
            if (spriteName == SpriteName.ThrowPower)
            {
                return(Vault.instance.spriteThrowPowerEng);
            }
            break;

        case SystemLanguage.Japanese:

            if (spriteName == SpriteName.EvasionMode)
            {
                return(Vault.instance.spriteEvasionModeJap);
            }
            if (spriteName == SpriteName.Excellent)
            {
                return(Vault.instance.spriteExcellentJap);
            }
            if (spriteName == SpriteName.Fiasco)
            {
                return(Vault.instance.spriteFiascoJap);
            }
            if (spriteName == SpriteName.Pause)
            {
                return(Vault.instance.spritePauseJap);
            }
            if (spriteName == SpriteName.ThrowPower)
            {
                return(Vault.instance.spriteThrowPowerJap);
            }
            break;
        }
        return(null);
    }
コード例 #20
0
 //Individual setters
 public void setSpriteName(SpriteName spriteName)
 {
     this.spriteName = spriteName;
 }
コード例 #21
0
 public AGameObject(AGameObject item, SpriteName sprite) : this(item.Region, sprite, item.Parent, item.Left, item.Right, item.Top, item.Bottom)
 {
 }
コード例 #22
0
 private void SetButtonSpecificProperties(UIButton button, String name, String tooltip, SpriteName normalSprite, SpriteName hoveredSprite)
 {
     button.name            = name;
     button.tooltip         = tooltip;
     button.normalFgSprite  = button.disabledFgSprite = button.hoveredFgSprite = normalSprite.ToString();
     button.pressedFgSprite = button.focusedFgSprite = hoveredSprite.ToString();
 }
コード例 #23
0
        public void Create(ImageTag inTag, SpriteEffects inSpEffect, Color inColor, SpriteName inName)
        {
            Sprite inSprite = new Sprite(inTag, inSpEffect, inColor, inName);

            this.Add(inSprite);
        }
コード例 #24
0
 protected override string GetSpriteAllSecondary(int species, int form, int gender, uint formarg, bool shiny, int generation) => 'c' + SpriteName.GetResourceStringSprite(species, form, gender, formarg, generation, shiny);
コード例 #25
0
 private void SetButtonSpecificProperties(UIButton button, String name, String tooltip, SpriteName normalSprite, SpriteName hoveredSprite)
 {
     button.name = name;
     button.tooltip = tooltip;
     button.normalFgSprite = button.disabledFgSprite = button.hoveredFgSprite = normalSprite.ToString();
     button.pressedFgSprite = button.focusedFgSprite = hoveredSprite.ToString();
 }
コード例 #26
0
        public FontSprite(Rectangle inRect, Vector2 inScale, float inRot, float indepth, SpriteName inName, String inText)
        {
            Rect     = inRect;
            Scale    = inScale;
            Rotation = inRot;
            Text     = inText;
            _sprite  = SpriteManager.getInstance().find(inName);
            Depth    = indepth;

            type = Texture.type.Text_Font;
        }
コード例 #27
0
 protected override string GetSpriteAll(int species, int form, int gender, bool shiny, int generation) => 'b' + SpriteName.GetResourceStringSprite(species, form, gender, generation, shiny);
コード例 #28
0
 public void FlipSprite(SpriteName inImage)
 {
     sprite.FlipSprite(inImage);
 }
コード例 #29
0
 public Frame(SpriteName inSprName, int inOrder)
 {
     SprName = inSprName;
     Order   = inOrder;
 }
コード例 #30
0
 public SimpleGameObject(Rectangle region, SpriteName spriteName, GameMatrix parent, AGameObject left = null, AGameObject right = null, AGameObject top = null, AGameObject bottom = null)
     : base(region, spriteName, parent, left, right, top, bottom)
 {
 }
コード例 #31
0
        public void RunDestroyAnimation(bool hitPlayer)
        {
            if (!IsDying && !IsDemented)
            {
                CurrentSpeed  = 0f;
                AccelerationX = 0f;
                AccelerationY = 0f;
                IsDying       = true;
                string spriteName;
                switch (spriteName = SpriteName)
                {
                case "ArrowProjectile_Sprite":
                case "SpellClose_Sprite":
                case "SpellDagger_Sprite":
                    if (hitPlayer)
                    {
                        Tween.By(this, 0.3f, Linear.EaseNone, "Rotation", "270");
                        var num2 = CDGMath.RandomInt(-50, 50);
                        var num3 = CDGMath.RandomInt(-100, -50);
                        Tween.By(this, 0.3f, Linear.EaseNone, "X", num2.ToString(), "Y", num3.ToString());
                        Tween.To(this, 0.3f, Linear.EaseNone, "Opacity", "0");
                        Tween.AddEndHandlerToLastTween(this, "KillProjectile");
                        return;
                    }
                    IsWeighted   = false;
                    IsCollidable = false;
                    Tween.To(this, 0.3f, Linear.EaseNone, "delay", "0.3", "Opacity", "0");
                    Tween.AddEndHandlerToLastTween(this, "KillProjectile");
                    return;

                case "ShurikenProjectile1_Sprite":
                case "BoneProjectile_Sprite":
                case "SpellBounce_Sprite":
                case "LastBossSwordVerticalProjectile_Sprite":
                {
                    Tween.StopAllContaining(this, false);
                    IsCollidable = false;
                    var num4 = CDGMath.RandomInt(-50, 50);
                    var num5 = CDGMath.RandomInt(-100, 100);
                    Tween.By(this, 0.3f, Linear.EaseNone, "X", num4.ToString(), "Y", num5.ToString());
                    Tween.To(this, 0.3f, Linear.EaseNone, "Opacity", "0");
                    Tween.AddEndHandlerToLastTween(this, "KillProjectile");
                    return;
                }

                case "HomingProjectile_Sprite":
                {
                    var proceduralLevelScreen =
                        Game.ScreenManager.CurrentScreen as ProceduralLevelScreen;
                    if (proceduralLevelScreen != null)
                    {
                        proceduralLevelScreen.ImpactEffectPool.DisplayExplosionEffect(Position);
                    }
                    SoundManager.Play3DSound(this, Game.ScreenManager.Player, "MissileExplosion_01",
                                             "MissileExplosion_02");
                    KillProjectile();
                    return;
                }

                case "SpellAxe_Sprite":
                case "SpellDualBlades_Sprite":
                    IsCollidable  = false;
                    AccelerationX = 0f;
                    AccelerationY = 0f;
                    Tween.To(this, 0.3f, Tween.EaseNone, "Opacity", "0");
                    Tween.AddEndHandlerToLastTween(this, "KillProjectile");
                    return;

                case "SpellDamageShield_Sprite":
                case "SpellDisplacer_Sprite":
                    Tween.To(this, 0.2f, Tween.EaseNone, "Opacity", "0");
                    Tween.AddEndHandlerToLastTween(this, "KillProjectile");
                    return;

                case "LastBossSwordProjectile_Sprite":
                {
                    IsCollidable = false;
                    Tween.StopAllContaining(this, false);
                    Tween.By(this, 0.3f, Linear.EaseNone, "Rotation", "270");
                    var num6 = CDGMath.RandomInt(-100, -50);
                    Tween.By(this, 0.3f, Linear.EaseNone, "Y", num6.ToString());
                    Tween.To(this, 0.3f, Linear.EaseNone, "Opacity", "0");
                    Tween.AddEndHandlerToLastTween(this, "KillProjectile");
                    return;
                }

                case "SpellNuke_Sprite":
                {
                    var proceduralLevelScreen2 =
                        Game.ScreenManager.CurrentScreen as ProceduralLevelScreen;
                    if (proceduralLevelScreen2 != null)
                    {
                        proceduralLevelScreen2.ImpactEffectPool.CrowDestructionEffect(Position);
                    }
                    KillProjectile();
                    return;
                }

                case "EnemyFlailKnightBall_Sprite":
                case "WizardIceSpell_Sprite":
                case "WizardEarthSpell_Sprite":
                case "SpellTimeBomb_Sprite":
                case "SpellLaser_Sprite":
                case "SpellBoomerang_Sprite":
                    KillProjectile();
                    return;
                }
                if (SpriteName == "WizardIceProjectile_Sprite")
                {
                    SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Ice_Wizard_Break_01",
                                             "Ice_Wizard_Break_02", "Ice_Wizard_Break_03");
                }
                var text = SpriteName.Replace("_", "Explosion_");
                ChangeSprite(text);
                AnimationDelay = 0.0333333351f;
                PlayAnimation(false);
                IsWeighted   = false;
                IsCollidable = false;
                if (text != "EnemySpearKnightWaveExplosion_Sprite" && text != "WizardIceProjectileExplosion_Sprite")
                {
                    Rotation = 0f;
                }
                Tween.RunFunction(0.5f, this, "KillProjectile");
            }
        }
コード例 #32
0
        public TextureSprite(Rectangle inRect, Vector2 inScale, float inRot, float indepth, SpriteName inName)
        {
            Rect     = inRect;
            Scale    = inScale;
            Rotation = inRot;
            Depth    = indepth;

            _sprite = SpriteManager.getInstance().find(inName);

            type = Texture.type.Text_Sprite;
        }