Пример #1
0
        public Rectangle getRectangle(LinkColor color, int frame)
        {
            Rectangle retRectangle;

            retRectangle = new Rectangle(1, 11, 15, 15);
            return(retRectangle);
        }
Пример #2
0
 public Link(Texture2D spriteSheet, ContentManager contentManager)
 {
     stateMachine        = new LinkStateMachine();
     this.contentManager = contentManager;
     linkSpriteSheet     = spriteSheet;
     currentColor        = LinkColor.Green;
     damageFrameCount    = 0;
 }
Пример #3
0
        private bool ShouldSerializeLinkColor()
        {
            if (SystemInformation.HighContrast)
            {
                return(!LinkColor.Equals(SystemColors.HotTrack));
            }

            return(!LinkColor.Equals(LinkUtilities.IELinkColor));
        }
Пример #4
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected override void SetupControl()
    {
        if (StopProcessing)
        {
            // Do not process
        }
        else
        {
            StringBuilder sb = new StringBuilder();

            //Configure widget
            sb.Append("<a class=\"twitter-timeline\"  href=\"https://twitter.com/", HTMLHelper.EncodeForHtmlAttribute(URLHelper.URLEncode(Username)), "\"  data-widget-id=\"", HTMLHelper.EncodeForHtmlAttribute(WidgetID));

            //Chrome setup
            StringBuilder chromeString = new StringBuilder();
            chromeString.Append(Transparent ? "transparent " : "");
            chromeString.Append(!DisplayBorders ? "noborders " : "");
            chromeString.Append(!DisplayHeader ? "noheader " : "");
            chromeString.Append(!DisplayFooter ? "nofooter " : "");
            chromeString.Append(!Scrollbar ? "noscrollbar " : "");

            if (!String.IsNullOrEmpty(chromeString.ToString()))
            {
                sb.Append("\" data-chrome=\"", chromeString.ToString().Trim());
            }

            sb.Append("\" width=\"", Width, "\" height=\"", Height);

            if (NumberOfTweets > 0)
            {
                sb.Append("\" data-tweet-limit=\"", NumberOfTweets);
            }

            if (!String.IsNullOrEmpty(Theme))
            {
                sb.Append("\" data-theme=\"", Theme.ToLowerCSafe());
            }

            if (!String.IsNullOrEmpty(LinkColor))
            {
                sb.Append("\" data-link-color=\"", LinkColor.ToLowerCSafe());
            }

            if (!String.IsNullOrEmpty(BorderColor))
            {
                sb.Append("\" data-border-color=\"", BorderColor.ToLowerCSafe());
            }

            sb.Append("\">Tweets by @", HTMLHelper.HTMLEncode(Username), "</a>\n");

            //widhet generating script
            sb.Append("<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\"://platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script>");

            // Set plugin code
            ltlPluginCode.Text = sb.ToString();
        }
    }
Пример #5
0
        public void changeColor(LinkColor currentColor, LinkColor newColor)
        {
            Color[] data = new Color[linkSpriteSheet.Width * linkSpriteSheet.Height];
            linkSpriteSheet.GetData(data);
            Color colorTo;
            Color green = new Color(128, 208, 16, 255);
            Color red   = new Color(216, 40, 0, 255);
            Color white = new Color(196, 212, 252, 255);

            if (newColor == LinkColor.Green)
            {
                colorTo = green;
            }
            else if (newColor == LinkColor.Red)
            {
                colorTo = red;
            }
            else //LinkColor.White
            {
                colorTo = white;
            }

            if (currentColor == LinkColor.Green)
            {
                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i] == green)
                    {
                        data[i] = colorTo;
                    }
                }
            }
            else if (currentColor == LinkColor.Red)
            {
                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i] == red)
                    {
                        data[i] = colorTo;
                    }
                }
            }
            else //LinkColor.White
            {
                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i] == white)
                    {
                        data[i] = colorTo;
                    }
                }
            }

            linkSpriteSheet.SetData(data);
        }
        public Rectangle getRectangle(LinkColor color, int frame)
        {
            Rectangle retRectangle;

            if (frame == 0)
            {
                retRectangle = new Rectangle(18, 11, 15, 15);
            }
            else
            {
                retRectangle = new Rectangle(1, 11, 15, 15);
            }
            return(retRectangle);
        }
Пример #7
0
 public LinkStateMachine()
 {
     spriteFactory              = new LinkSpriteFactory();
     direction                  = Direction.MoveRight;
     color                      = LinkColor.Green;
     animation                  = Animation.Idle;
     xLoc                       = 100; //Original Position, probably needs to change
     yLoc                       = 100;
     isBusy                     = false;
     sizeFactor                 = 4;
     frame                      = 0;
     linkProjectileList         = new List <IProjectile>();
     linkProjectileToRemoveList = new List <IProjectile>();
 }
Пример #8
0
        public void Update()
        {
            source      = stateMachine.getSource();
            destination = stateMachine.getDestination();

            /*
             * if (currentColor != stateMachine.getColor())
             * {
             *  changeColor(currentColor, stateMachine.getColor());
             * }
             */
            if (stateMachine.getColor() == LinkColor.Damaged && damageFrameCount <= 24)
            {
                if (damageFrameCount % 4 == 0)
                {
                    linkSpriteSheet = contentManager.Load <Texture2D>("LinkSpriteSheetBlack");
                }
                else if (damageFrameCount % 4 == 3)
                {
                    linkSpriteSheet = contentManager.Load <Texture2D>("LinkSpriteSheetRed");
                }
                else if (damageFrameCount % 4 == 2)
                {
                    linkSpriteSheet = contentManager.Load <Texture2D>("LinkSpriteSheetBlue");
                }
                else //damageFrameCount %4 == 1
                {
                    linkSpriteSheet = contentManager.Load <Texture2D>("LinkSpriteSheet");
                }
                if (damageFrameCount == 24)
                {
                    stateMachine.setOriginalColor();
                }
                damageFrameCount++;
            }
            else
            {
                damageFrameCount = 0;
                linkSpriteSheet  = contentManager.Load <Texture2D>("LinkSpriteSheet");
            }
            currentColor = stateMachine.getColor();
            stateMachine.Update();
        }
Пример #9
0
        public Rectangle getRectangle(LinkColor color, int frame)
        {
            Rectangle retRectangle;

            if (frame == 0)
            {
                retRectangle = new Rectangle(1, 77, 16, 15);
            }
            else if (frame == 1)
            {
                retRectangle = new Rectangle(18, 77, 27, 15);
            }
            else if (frame == 2)
            {
                retRectangle = new Rectangle(46, 77, 23, 15);
            }
            else
            {
                retRectangle = new Rectangle(70, 77, 19, 15);
            }
            return(retRectangle);
        }
Пример #10
0
        public Rectangle getRectangle(LinkColor color, int frame)
        {
            Rectangle retRectangle;

            if (frame == 0)
            {
                retRectangle = new Rectangle(1, 94, 15, 30);
            }
            else if (frame == 1)
            {
                retRectangle = new Rectangle(18, 94, 15, 30);
            }
            else if (frame == 2)
            {
                retRectangle = new Rectangle(35, 94, 15, 30);
            }
            else
            {
                retRectangle = new Rectangle(52, 94, 15, 30);
            }
            return(retRectangle);
        }
Пример #11
0
        /// <summary>
        /// return a hash code
        /// </summary>
        /// <returns>hashcode as <see cref="int" /></returns>
        public override int GetHashCode()
        {
            var hashCode = -2087474320;

            hashCode = hashCode * -1521134295 + HeaderFullWidth.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderFullHeight.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderFocusWidth.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderFocusHeight.GetHashCode();
            hashCode = hashCode * -1521134295 + AvatarShape.GetHashCode();
#if NETSTANDARD2_0
            hashCode = hashCode * -1521134295 + BackgroundColor.GetHashCode();
#else
            hashCode = hashCode * -1521134295 + BackgroundColor.GetHashCode();
#endif
            hashCode = hashCode * -1521134295 + BodyFont.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderBounds.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderImage.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderImageFocused.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderImageScaled.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderStretch.GetHashCode();
#if NETSTANDARD2_0
            hashCode = hashCode * -1521134295 + LinkColor.GetHashCode();
#else
            hashCode = hashCode * -1521134295 + LinkColor.GetHashCode();
#endif
            hashCode = hashCode * -1521134295 + ShowAvatar.GetHashCode();
            hashCode = hashCode * -1521134295 + ShowDescription.GetHashCode();
            hashCode = hashCode * -1521134295 + ShowHeaderImage.GetHashCode();
            hashCode = hashCode * -1521134295 + ShowTitle.GetHashCode();
#if NETSTANDARD2_0
            hashCode = hashCode * -1521134295 + TitleColor.GetHashCode();
#else
            hashCode = hashCode * -1521134295 + TitleColor.GetHashCode();
#endif
            hashCode = hashCode * -1521134295 + TitleFont.GetHashCode();
            hashCode = hashCode * -1521134295 + TitleFontWeight.GetHashCode();
            return(hashCode);
        }
Пример #12
0
        /// <summary>
        /// compare this object with another
        /// </summary>
        /// <param name="obj">Object to be equals</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            return(obj is TrailTheme theme &&
                   HeaderFullWidth == theme.HeaderFullWidth &&
                   HeaderFullHeight == theme.HeaderFullHeight &&
                   HeaderFocusWidth == theme.HeaderFocusWidth &&
                   HeaderFocusHeight == theme.HeaderFocusHeight &&
                   AvatarShape == theme.AvatarShape &&
#if NETSTANDARD2_0
                   BackgroundColor.Equals(theme.BackgroundColor) &&
#else
                   BackgroundColor == theme.BackgroundColor &&
#endif
                   BodyFont == theme.BodyFont &&
                   HeaderBounds == theme.HeaderBounds &&
                   HeaderImage == theme.HeaderImage &&
                   HeaderImageFocused == theme.HeaderImageFocused &&
                   HeaderImageScaled == theme.HeaderImageScaled &&
                   HeaderStretch == theme.HeaderStretch &&
#if NETSTANDARD2_0
                   LinkColor.Equals(LinkColor) &&
#else
                   LinkColor == theme.LinkColor &&
#endif
                   ShowAvatar == theme.ShowAvatar &&
                   ShowDescription == theme.ShowDescription &&
                   ShowHeaderImage == theme.ShowHeaderImage &&
                   ShowTitle == theme.ShowTitle &&
#if NETSTANDARD2_0
                   TitleColor.Equals(TitleColor) &&
#else
                   TitleColor == theme.TitleColor &&
#endif
                   TitleFont == theme.TitleFont &&
                   TitleFontWeight == theme.TitleFontWeight);
        }
Пример #13
0
        public Rectangle getSourceRectangle(Direction direction, LinkColor color, Animation animation, int frame)
        {
            //Use params to get proper rectangle from sprite sheet and update height and width
            ILinkRectangle linkRectangle;
            Rectangle      retRectangle;

            if (direction == Direction.MoveUp)
            {
                if (animation == Animation.Idle)
                {
                    linkRectangle = new RectangleLinkMoveUpIdle();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Walk)
                {
                    linkRectangle = new RectangleLinkMoveUpWalk();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Attack)
                {
                    linkRectangle = new RectangleLinkMoveUpAttack();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 30;
                    linkWidth     = 15;
                }
                else //Animation.UsingItem
                {
                    linkRectangle = new RectangleLinkMoveUpItem();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
            }
            else if (direction == Direction.MoveDown)
            {
                if (animation == Animation.Idle)
                {
                    linkRectangle = new RectangleLinkMoveDownIdle();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Walk)
                {
                    linkRectangle = new RectangleLinkMoveDownWalk();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Attack)
                {
                    linkRectangle = new RectangleLinkMoveDownAttack();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 30;
                    linkWidth     = 15;
                }
                else //Animation.UsingItem
                {
                    linkRectangle = new RectangleLinkMoveDownItem();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
            }
            else if (direction == Direction.MoveLeft)
            {
                if (animation == Animation.Idle)
                {
                    linkRectangle = new RectangleLinkMoveRightIdle();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Walk)
                {
                    linkRectangle = new RectangleLinkMoveRightWalk();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Attack)
                {
                    linkRectangle = new RectangleLinkMoveRightAttack();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    if (frame == 0)
                    {
                        linkHeight = 15;
                        linkWidth  = 15;
                    }
                    else if (frame == 1)
                    {
                        linkHeight = 15;
                        linkWidth  = 26;
                    }
                    else if (frame == 2)
                    {
                        linkHeight = 15;
                        linkWidth  = 22;
                    }
                    else //frame == 3
                    {
                        linkHeight = 15;
                        linkWidth  = 18;
                    }
                }
                else //Animation.UsingItem
                {
                    linkRectangle = new RectangleLinkMoveRightItem();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
            }
            else //Direction.MoveRight
            {
                if (animation == Animation.Idle)
                {
                    linkRectangle = new RectangleLinkMoveRightIdle();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Walk)
                {
                    linkRectangle = new RectangleLinkMoveRightWalk();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
                else if (animation == Animation.Attack)
                {
                    linkRectangle = new RectangleLinkMoveRightAttack();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    if (frame == 0)
                    {
                        linkHeight = 15;
                        linkWidth  = 16;
                    }
                    else if (frame == 1)
                    {
                        linkHeight = 15;
                        linkWidth  = 27;
                    }
                    else if (frame == 2)
                    {
                        linkHeight = 15;
                        linkWidth  = 23;
                    }
                    else //frame == 3
                    {
                        linkHeight = 15;
                        linkWidth  = 19;
                    }
                }
                else //Animation.UsingItem
                {
                    linkRectangle = new RectangleLinkMoveRightItem();
                    retRectangle  = linkRectangle.getRectangle(color, frame);
                    linkHeight    = 15;
                    linkWidth     = 15;
                }
            }
            return(retRectangle);
        }
Пример #14
0
 public void setOriginalColor()
 {
     this.color = LinkColor.Green;
 }
Пример #15
0
 public void setDamaged()
 {
     this.color = LinkColor.Damaged;
 }