Esempio n. 1
0
 public FpsScreen( Game game )
     : base(game)
 {
     font = new Font( "Arial", 13 );
     posFont = new Font( "Arial", 12, FontStyle.Italic );
     text = new StringBuffer( 96 );
 }
Esempio n. 2
0
 public MenuInputWidget( Game game, Font font, Font boldFont, Font hintFont )
     : base(game)
 {
     HorizontalAnchor = Anchor.LeftOrTop;
     VerticalAnchor = Anchor.BottomOrRight;
     this.font = font;
     this.boldFont = boldFont;
     this.hintFont = hintFont;
     chatInputText = new StringBuffer( 64 );
 }
Esempio n. 3
0
 public TextInputWidget( Game game, Font font, Font boldFont )
     : base(game)
 {
     HorizontalDocking = Docking.LeftOrTop;
     VerticalDocking = Docking.BottomOrRight;
     typingLogPos = game.Chat.InputLog.Count; // Index of newest entry + 1.
     this.font = font;
     this.boldFont = boldFont;
     chatInputText = new StringBuffer( 64 );
 }
Esempio n. 4
0
 public FpsScreen( Game game )
     : base(game)
 {
     font = new Font( "Arial", 13 );
     text = new StringBuffer( 96 );
 }
Esempio n. 5
0
 public FpsScreen( Game game )
     : base(game)
 {
     text = new StringBuffer( 96 );
 }
Esempio n. 6
0
        static void SplitUppercase( StringBuffer buffer, string value, ref int index )
        {
            for( int i = 0; i < value.Length; i++ ) {
                char c = value[i];
                bool upper = Char.IsUpper( c ) && i > 0;
                bool nextLower = i < value.Length - 1 && !Char.IsUpper( value[i + 1] );

                if( upper && nextLower ) {
                    buffer.Append( ref index, ' ' );
                    buffer.Append( ref index, Char.ToLower( c ) );
                } else {
                    buffer.Append( ref index, c );
                }
            }
        }
Esempio n. 7
0
        static void MakeNormalNames()
        {
            StringBuffer buffer = new StringBuffer( 64 );
            normalNames = new string[CpeCount];

            for( int i = 0; i < normalNames.Length; i++ ) {
                string origName = Enum.GetName( typeof(Block), (byte)i );
                buffer.Clear();
                int index = 0;
                SplitUppercase( buffer, origName, ref index );
                normalNames[i] = buffer.ToString();
            }
        }
Esempio n. 8
0
 public FpsScreen(Game game) : base(game)
 {
     text = new StringBuffer(128);
 }
        void TabKey()
        {
            int pos   = caretPos == -1 ? chatInputText.Length - 1 : caretPos;
            int start = pos;

            char[] value = chatInputText.value;

            while (start >= 0 && Char.IsLetterOrDigit(value[start]))
            {
                start--;
            }
            start++;
            if (pos < 0 || start > pos)
            {
                return;
            }

            string        part    = new String(value, start, pos + 1 - start);
            List <string> matches = new List <string>();

            game.Chat.Add(null, MessageType.ClientStatus5);

            bool extList = game.Network.UsingExtPlayerList;

            CpeListInfo[] info    = game.CpePlayersList;
            Player[]      players = game.Players.Players;
            for (int i = 0; i < EntityList.MaxCount; i++)
            {
                if (extList && info[i] == null)
                {
                    continue;
                }
                if (!extList && players[i] == null)
                {
                    continue;
                }

                string rawName = extList ? info[i].PlayerName : players[i].DisplayName;
                string name    = Utils.StripColours(rawName);
                if (name.StartsWith(part, StringComparison.OrdinalIgnoreCase))
                {
                    matches.Add(name);
                }
            }

            if (matches.Count == 1)
            {
                if (caretPos == -1)
                {
                    pos++;
                }
                int len = pos - start;
                for (int i = 0; i < len; i++)
                {
                    chatInputText.DeleteAt(start);
                }
                if (caretPos != -1)
                {
                    caretPos -= len;
                }
                AppendText(matches[0]);
            }
            else if (matches.Count > 1)
            {
                StringBuffer buffer = new StringBuffer(64);
                int          index  = 0;
                buffer.Append(ref index, "&e");
                buffer.AppendNum(ref index, matches.Count);
                buffer.Append(ref index, " matching names: ");

                foreach (string match in matches)
                {
                    if ((match.Length + 1 + buffer.Length) > 64)
                    {
                        break;
                    }
                    buffer.Append(ref index, match);
                    buffer.Append(ref index, ' ');
                }
                game.Chat.Add(buffer.ToString(), MessageType.ClientStatus5);
            }
        }