Example #1
0
 static internal void PrintString()
 {
     if (Caption.Length > CheckWidth)
     {
         Caption = Caption.Substring(0, CheckWidth);
     }
     ShtrihType.InvokeMember("PrintString", BindingFlags.InvokeMethod, null, mShtrih, null);
 }
Example #2
0
        void InternalDraw(SizeF offset, float screenWidth, float screenHeight)
        {
            if (!Enabled)
            {
                return;
            }

            float x = (Position.X + offset.Width) / screenWidth;
            float y = (Position.Y + offset.Height) / screenHeight;
            float w = WrapWidth / screenWidth;

            if (Shadow)
            {
                Function.Call(Hash.SET_TEXT_DROP_SHADOW);
            }
            if (Outline)
            {
                Function.Call(Hash.SET_TEXT_OUTLINE);
            }

            Function.Call(Hash.SET_TEXT_FONT, Font);
            Function.Call(Hash.SET_TEXT_SCALE, Scale, Scale);
            Function.Call(Hash.SET_TEXT_COLOUR, Color.R, Color.G, Color.B, Color.A);
            Function.Call(Hash.SET_TEXT_JUSTIFICATION, Alignment);

            if (WrapWidth > 0.0f)
            {
                switch (Alignment)
                {
                case Alignment.Center:
                    Function.Call(Hash.SET_TEXT_WRAP, x - (w / 2), x + (w / 2));
                    break;

                case Alignment.Left:
                    Function.Call(Hash.SET_TEXT_WRAP, x, x + w);
                    break;

                case Alignment.Right:
                    Function.Call(Hash.SET_TEXT_WRAP, x - w, x);
                    break;
                }
            }
            else if (Alignment == Alignment.Right)
            {
                Function.Call(Hash.SET_TEXT_WRAP, 0.0f, x);
            }

            Function.Call(Hash._SET_TEXT_ENTRY, "CELL_EMAIL_BCON");

            const int maxStringLength = 99;

            for (int i = 0; i < Caption.Length; i += maxStringLength)
            {
                Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, Caption.Substring(i, System.Math.Min(maxStringLength, Caption.Length - i)));
            }

            Function.Call(Hash._DRAW_TEXT, x, y);
        }
Example #3
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     alpha += Speed * 0.01f;
     if (alpha >= 1)
     {
         alpha = 0f; cursor++; lastText = Text;
     }
     if (cursor >= Caption.Length)
     {
         cursor = Caption.Length;
     }
     Text = Caption.Substring(0, cursor);
 }
Example #4
0
        public override void Draw(SizeF offset)
        {
            CallCollection thisCol = new CallCollection();
            float          x       = (Position.X) / width;
            float          y       = (Position.Y) / height;

            thisCol.Call(Hash.SET_TEXT_FONT, (int)Font);
            thisCol.Call(Hash.SET_TEXT_SCALE, 1.10f, Scale);
            thisCol.Call(Hash.SET_TEXT_COLOUR, Color.R, Color.G, Color.B, Color.A);
            if (DropShadow)
            {
                thisCol.Call(Hash.SET_TEXT_DROP_SHADOW);
            }
            if (Outline)
            {
                thisCol.Call(Hash.SET_TEXT_OUTLINE);
            }
            switch (TextAlignment)
            {
            case Alignment.Centered:
                thisCol.Call(Hash.SET_TEXT_CENTRE, true);
                break;

            case Alignment.Right:
                thisCol.Call(Hash.SET_TEXT_RIGHT_JUSTIFY, true);
                thisCol.Call(Hash.SET_TEXT_WRAP, 0, x);
                break;
            }

            if (WordWrap != new Size(0, 0))
            {
                float xsize = (Position.X + WordWrap.Width) / width;
                thisCol.Call(Hash.SET_TEXT_WRAP, x, xsize);
            }

            thisCol.Call(Hash.BEGIN_TEXT_COMMAND_DISPLAY_TEXT, "jamyfafi");
            //AddLongString(Caption);

            const int maxStringLength = 99;
            int       count           = Caption.Length;

            for (int i = 0; i < count; i += maxStringLength)
            {
                thisCol.Call((Hash)0x6C188BE134E074AA, Caption.Substring(i, System.Math.Min(maxStringLength, Caption.Length - i)));
            }


            thisCol.Call(Hash.END_TEXT_COMMAND_DISPLAY_TEXT, x, y);
            thisCol.Execute();
        }
Example #5
0
 public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (DrawShadow)
     {
         GraphicsHelper.DrawShadowedString(spriteBatch, Game.GetFont(Font), Caption.Substring(0, cursor), Position,
                                           (IsMouseHold ? MouseHoldColor :
                                            (IsMouseHovered ? MouseHoverColor :
                                             ForeColor)),
                                           ShadowColor);
     }
     else
     {
         spriteBatch.DrawString(Game.GetFont(Font), Caption.Substring(0, cursor), Position, (IsMouseHold ? MouseHoldColor :
                                                                                             (IsMouseHovered ? MouseHoverColor :
                                                                                              ForeColor)));
     }
 }