Ejemplo n.º 1
0
        /// <summary>
        /// Adds the specified sprite object to the specified container, using the sprite's metadata from the specified piece art.
        /// </summary>
        /// <param name="girl">The <see cref="Girl"/> instance the sprite object will be added to (only used for alt. girl checking).</param>
        /// <param name="sprite">The sprite object to add.</param>
        /// <param name="pieceArt">The piece art with metadata for the sprite object.</param>
        /// <param name="container">The container to which to add the sprite object to.</param>
        /// <param name="removeChildren">Whether to remove and destroy all existing children in the container.</param>
        /// <remarks>
        /// An alternative way to add sprites to any container, making it possible to manually manage the <see cref="tk2dBaseSprite.Collection"/>
        /// and the option to keep any existing children in the container.
        /// </remarks>
        public static void AddSpriteObjectToContainer(this Girl girl, SpriteObject sprite, GirlPieceArt pieceArt, DisplayObject container, bool removeChildren = true)
        {
            if (sprite != null && pieceArt != null && container != null && !pieceArt.spriteName.IsNullOrWhiteSpace())
            {
                if (removeChildren && container.GetChildren().Length > 0)
                {
                    container.RemoveAllChildren(true);
                }

                container.AddChild(sprite);
                sprite.sprite.FlipX = girl.flip;
                var offsetX = girl.flip ? GameCamera.SCREEN_DEFAULT_WIDTH : 0;
                sprite.SetLocalPosition(Mathf.Abs(offsetX - pieceArt.x), -pieceArt.y);
            }
        }
Ejemplo n.º 2
0
        public static void RefreshBigPhotoPostfix(PhotoGallery __instance, ref int ____activeThumbnailIndex, ref tk2dSpriteCollectionData ____activeSpriteCollection, int __state)
        {
            ____activeThumbnailIndex = __state;
            __instance.bigPhoto.RemoveAllChildren();
            if (__state % 4 == 3)
            {
                SpriteObject spr = GameUtil.ImageFileToSprite(GirlNames[__state / 4] + ".png", GirlNames[__state / 4]);

                if (spr != null)
                {
                    __instance.bigPhoto.AddChild(spr);

                    SpriteObject updatedSprite = __instance.bigPhoto.GetChildren(true)[__instance.bigPhoto.GetChildren().Length - 1] as SpriteObject;
                    updatedSprite.SetLocalPosition(0, 0);
                    updatedSprite.SetOwnChildIndex(3);
                }
            }
        }
Ejemplo n.º 3
0
        public static void UpdateButton(LoadScreen __instance, ref SpriteObject ____creditsButton)
        {
            if (!BaseHunieModPlugin.newVersionAvailable)
            {
                return;
            }
            SpriteObject spr = GameUtil.ImageFileToSprite("update.png", "updatesprite");

            if (spr != null)
            {
                ____creditsButton.SetLightness(0f);
                ____creditsButton.AddChild(spr);

                updateSprite = ____creditsButton.GetChildren(true)[____creditsButton.GetChildren().Length - 1] as SpriteObject;
                updateSprite.SetLocalPosition(-83, 24);
                updateSprite.SetOwnChildIndex(3);
                updateSprite.spriteAlpha = 0f;
            }
        }