コード例 #1
0
        public DirectionalTexture(IModHelper helper, NamePairings info, string relativePath, Direction direction = Direction.down)
        {
            this.leftTexture  = new Texture2DExtended(helper, Path.Combine(relativePath, $"{info.leftString}.png"));
            this.rightTexture = new Texture2DExtended(helper, Path.Combine(relativePath, $"{info.rightString}.png"));
            this.upTexture    = new Texture2DExtended(helper, Path.Combine(relativePath, $"{info.upString}.png"));
            this.downTexture  = new Texture2DExtended(helper, Path.Combine(relativePath, $"{info.downString}.png"));

            switch (direction)
            {
            case Direction.left:
                this.currentTexture = this.leftTexture;
                break;

            case Direction.right:
                this.currentTexture = this.rightTexture;
                break;

            case Direction.up:
                this.currentTexture = this.upTexture;
                break;

            case Direction.down:
                this.currentTexture = this.downTexture;
                break;
            }
        }
コード例 #2
0
 /// <summary>Construct an instance.</summary>
 /// <param name="name">The name of the asset. This is the name that will be referenced in any asset manager or asset pool.</param>
 /// <param name="standingAssetPaths">The name of the files to be used for the standing animation.</param>
 /// <param name="movingAssetPaths">The name of the files to be used for the moving animation.</param>
 /// <param name="swimmingAssetPaths">The name of the files to be used for the swimming animation.</param>
 /// <param name="sittingAssetPaths">The name of the files to be used for the sitting animation.</param>
 /// <param name="assetSize">The size of the asset. Width and height of the texture.</param>
 /// <param name="randomizeOnLoad">Legacy, not really used anymore.</param>
 /// <param name="gender">The type of gender this asset will be associated with.</param>
 /// <param name="season">The type of season this asset will be associated with.</param>
 /// <param name="type">The part type to be used for this asset such as hair, eyes, etc.</param>
 public ExtendedAssetInfo(string name, NamePairings standingAssetPaths, NamePairings movingAssetPaths, NamePairings swimmingAssetPaths, NamePairings sittingAssetPaths, Vector2 assetSize, bool randomizeOnLoad, Genders gender, List <Seasons> season, PartType type)
     : base(name, standingAssetPaths, movingAssetPaths, swimmingAssetPaths, sittingAssetPaths, assetSize, randomizeOnLoad)
 {
     this.gender  = gender;
     this.seasons = season ?? new List <Seasons>();
     this.type    = type;
 }
コード例 #3
0
        public DirectionalTexture(IModHelper helper, NamePairings info, string path, Direction direction = Direction.down)
        {
            new Texture2DExtended(helper, path);

            string leftString  = Class1.getShortenedDirectory(Path.Combine(path, info.leftString + ".png")).Remove(0, 1);
            string rightString = Class1.getShortenedDirectory(Path.Combine(path, info.rightString + ".png")).Remove(0, 1);
            string upString    = Class1.getShortenedDirectory(Path.Combine(path, info.upString + ".png")).Remove(0, 1);
            string downString  = Class1.getShortenedDirectory(Path.Combine(path, info.downString + ".png")).Remove(0, 1);


            this.leftTexture  = new Texture2DExtended(helper, leftString);
            this.rightTexture = new Texture2DExtended(helper, rightString);
            this.upTexture    = new Texture2DExtended(helper, upString);
            this.downTexture  = new Texture2DExtended(helper, downString);

            if (direction == Direction.left)
            {
                this.currentTexture = leftTexture;
            }
            if (direction == Direction.right)
            {
                this.currentTexture = rightTexture;
            }
            if (direction == Direction.up)
            {
                this.currentTexture = upTexture;
            }
            if (direction == Direction.down)
            {
                this.currentTexture = downTexture;
            }
        }
コード例 #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="assetSize"></param>
 /// <param name="randomizeOnLoad"></param>
 /// <param name="Gender">The type of gender this asset will be associated with.</param>
 /// <param name="Season">The type of season this asset will be associated with.</param>
 public ExtendedAssetInfo(string name, NamePairings StandingAssetPaths, NamePairings MovingAssetPaths, NamePairings SwimmingAssetPaths, NamePairings SittingAssetPaths, Vector2 assetSize, bool randomizeOnLoad, Genders Gender, List <Seasons> Season, PartType Type) : base(name, StandingAssetPaths, MovingAssetPaths, SwimmingAssetPaths, SittingAssetPaths, assetSize, randomizeOnLoad)
 {
     this.gender  = Gender;
     this.seasons = Season;
     if (this.seasons == null)
     {
         this.seasons = new List <Seasons>();
     }
     this.type = Type;
 }
コード例 #5
0
 /// <summary>Construct an instance.</summary>
 /// <param name="assetName">The name of the asset. This is the name that will be referenced in any asset manager or asset pool.</param>
 /// <param name="standingAssetPaths">The name of the files to be used for the standing animation.</param>
 /// <param name="movingAssetPaths">The name of the files to be used for the moving animation.</param>
 /// <param name="swimmingAssetPaths">The name of the files to be used for the swimming animation.</param>
 /// <param name="sittingAssetPaths">The name of the files to be used for the sitting animation.</param>
 /// <param name="assetSize">The size of the asset. Width and height of the texture.</param>
 /// <param name="randomizeUponLoad">Legacy, not really used anymore.</param>
 public AssetInfo(string assetName, NamePairings standingAssetPaths, NamePairings movingAssetPaths, NamePairings swimmingAssetPaths, NamePairings sittingAssetPaths, Vector2 assetSize, bool randomizeUponLoad)
 {
     this.assetName          = assetName;
     this.sittingAssetPaths  = sittingAssetPaths;
     this.standingAssetPaths = standingAssetPaths;
     this.movingAssetPaths   = movingAssetPaths;
     this.swimmingAssetPaths = swimmingAssetPaths;
     this.assetSize          = assetSize;
     this.randomizeUponLoad  = randomizeUponLoad;
 }
コード例 #6
0
        /// <summary>
        /// Get a collection of sprites to generate a collective animated sprite.
        /// </summary>
        /// <param name="BodySprites">The collection of sprites to be used for the boyd of the npc.</param>
        /// <param name="EyeSprites">The collection of sprites to be used for the eye of the npc.</param>
        /// <param name="HairSprites">The collection of sprites to be used for the hair of the npc.</param>
        /// <param name="ShirtsSprites">The collection of sprites to be used for the shirts of the npc.</param>
        /// <param name="PantsSprites">The collection of sprites to be used for the pants of the npc.</param>
        /// <param name="ShoesSprites">The collection of sprites to be used for the shoes of the npc.</param>
        /// <param name="AccessoriesSprites">The collection of sprites to be used for the accessories of the npc.</param>
        /// <param name="DrawColors">The collection of collors to be used for chaing the color of an individual asset.</param>
        /// <returns></returns>
        public StandardCharacterAnimation GetStandardCharacterAnimation(NamePairings BodySprites, NamePairings EyeSprites, NamePairings HairSprites, NamePairings ShirtsSprites, NamePairings PantsSprites, NamePairings ShoesSprites, List <NamePairings> AccessoriesSprites, StandardColorCollection DrawColors = null)
        {
            var body   = getAnimatedSpriteCollectionFromAssets(BodySprites);
            var eyes   = getAnimatedSpriteCollectionFromAssets(EyeSprites);
            var hair   = getAnimatedSpriteCollectionFromAssets(HairSprites);
            var shirts = getAnimatedSpriteCollectionFromAssets(ShirtsSprites);
            var pants  = getAnimatedSpriteCollectionFromAssets(PantsSprites);
            var shoes  = getAnimatedSpriteCollectionFromAssets(ShoesSprites);
            List <AnimatedSpriteCollection> accessories = new List <AnimatedSpriteCollection>();

            foreach (var v in AccessoriesSprites)
            {
                accessories.Add(getAnimatedSpriteCollectionFromAssets(v));
            }
            if (DrawColors == null)
            {
                DrawColors = new StandardColorCollection();
            }
            return(new StandardCharacterAnimation(body, eyes, hair, shirts, pants, shoes, accessories, DrawColors));
        }
コード例 #7
0
 /// <summary>Get an AnimatedSpriteCollection from a name pairing.</summary>
 /// <param name="pair">A collection of strings that hold information on directional textures.</param>
 /// <param name="startingDirection">The direction in which the sprite should face.</param>
 public AnimatedSpriteCollection getAnimatedSpriteCollectionFromAssets(NamePairings pair, Direction startingDirection = Direction.down)
 {
     return(this.getAnimatedSpriteCollectionFromAssets(pair.leftString, pair.rightString, pair.upString, pair.downString));
 }