Ejemplo n.º 1
0
        public EmotesMenuButton(IModHelper helper, ModConfig modConfig, ModData modData)
        {
            this.helper    = helper;
            this.modConfig = modConfig;
            this.modData   = modData;

            Rectangle sourceRect = Sprites.MenuButton.SourceRectangle;
            Rectangle targetRect = new Rectangle(modData.MenuPosition.X, modData.MenuPosition.Y, sourceRect.Width * Game1.pixelZoom, sourceRect.Height * Game1.pixelZoom);

            this.xPositionOnScreen = targetRect.X;
            this.yPositionOnScreen = targetRect.Y;

            this.width  = targetRect.Width;
            this.height = targetRect.Height;

            this.EmotesTexture            = Sprites.Emotes.Texture;
            this.EmoteMenuButtonComponent = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height), Sprites.MenuButton.Texture, sourceRect, 4f, false);

            //Texture2D chatBoxTexture = helper.Content.Load<Texture2D>(Sprites.ChatBox.AssetName, ContentSource.GameContent);
            this.EmotesMenuBoxComponent = new EmotesMenuBox(helper, this, EmotesTexture);

            IsBeingDragged = false;

            animationTimer    = AnimationCooldownTime;
            AnimatedEmoteIcon = modConfig.AnimateEmoteButtonIcon;
            //AnimationOnHover = true; // Not in use
            AnimatedSpriteIcon = new TemporaryAnimatedSprite(Sprites.Emotes.AssetName, new Rectangle(0, 0, 16, 16), 250f, 4, 0, new Vector2(this.EmoteMenuButtonComponent.bounds.X + 15, this.EmoteMenuButtonComponent.bounds.Y + 15), false, false, 0.9f, 0f, Color.White, 2.0f, 0f, 0f, 0f, true);

            ShowTooltipOnHover = modConfig.ShowTooltipOnHover;

            initialize(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false);
            UpdatePosition();

            SubscribeEvents();
        }
Ejemplo n.º 2
0
        public EmotesMenuButton(IModHelper helper, ModConfig modConfig, ModData modData)
        {
            this.helper    = helper;
            this.modConfig = modConfig;
            this.modData   = modData;

            IsEmoteIconAnimated = modConfig.AnimateEmoteButtonIcon;
            ShowTooltipOnHover  = modConfig.ShowTooltipOnHover;

            Rectangle sourceRect = Sprites.MenuButton.SourceRectangle;
            Rectangle targetRect = new Rectangle {
                Location = modData.MenuPosition,
                Width    = sourceRect.Width * Game1.pixelZoom,
                Height   = sourceRect.Height * Game1.pixelZoom
            };

            this.xPositionOnScreen = targetRect.X;
            this.yPositionOnScreen = targetRect.Y;
            this.width             = targetRect.Width;
            this.height            = targetRect.Height;

            this.EmoteMenuButtonComponent = new ClickableTextureComponent(targetRect, Sprites.MenuButton.Texture, sourceRect, 4f, false);

            // Texture2D chatBoxTexture = helper.Content.Load<Texture2D>(Sprites.ChatBox.AssetName, ContentSource.GameContent);
            this.EmotesTexture          = Sprites.Emotes.Texture;
            this.EmotesMenuBoxComponent = new EmotesMenuBox(helper, this, EmotesTexture);

            IsBeingDragged = false;

            animationTimer = AnimationCooldownTime;
            // AnimationOnHover = true; // Not in use
            AnimatedSpriteIcon = new TemporaryAnimatedSprite(
                textureName: Sprites.Emotes.AssetName,
                sourceRect: Sprites.Emotes.SourceRectangle,
                animationInterval: 250f,
                animationLength: Sprites.Emotes.AnimationFrames,
                numberOfLoops: 0,
                position: new Vector2(this.EmoteMenuButtonComponent.bounds.X + 15, this.EmoteMenuButtonComponent.bounds.Y + 15),
                flicker: false,
                flipped: false,
                layerDepth: 0.9f,
                alphaFade: 0f,
                color: Color.White,
                scale: 2f,
                scaleChange: 0f,
                rotation: 0f,
                rotationChange: 0f,
                local: true
                );

            initialize(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false);
            UpdatePosition();

            SubscribeEvents();
        }