Пример #1
0
        /// <summary>
        /// Autocompletes player name
        /// </summary>
        public virtual void CompletePlayerName()
        {
            if (Field_50060_d)
            {
                Field_50064_a.Func_50021_a(-1);

                if (Field_50067_h >= Field_50068_i.Count)
                {
                    Field_50067_h = 0;
                }
            }
            else
            {
                int i = Field_50064_a.Func_50028_c(-1);

                if (Field_50064_a.Func_50035_h() - i < 1)
                {
                    return;
                }

                Field_50068_i.Clear();
                Field_50061_e = Field_50064_a.GetText().Substring(i);
                Field_50059_f = Field_50061_e.ToLower();
                IEnumerator <GuiPlayerInfo> iterator = ((EntityClientPlayerMP)Mc.ThePlayer).SendQueue.PlayerNames.GetEnumerator();

                do
                {
                    if (!iterator.MoveNext())
                    {
                        break;
                    }

                    GuiPlayerInfo guiplayerinfo = iterator.Current;

                    if (guiplayerinfo.NameStartsWith(Field_50059_f))
                    {
                        Field_50068_i.Add(guiplayerinfo);
                    }
                }while (true);

                if (Field_50068_i.Count == 0)
                {
                    return;
                }

                Field_50060_d = true;
                Field_50067_h = 0;
                Field_50064_a.Func_50020_b(i - Field_50064_a.Func_50035_h());
            }

            if (Field_50068_i.Count > 1)
            {
                StringBuilder stringbuilder = new StringBuilder();
                GuiPlayerInfo guiplayerinfo1;

                for (IEnumerator <GuiPlayerInfo> iterator1 = Field_50068_i.GetEnumerator(); iterator1.MoveNext(); stringbuilder.Append(guiplayerinfo1.Name))
                {
                    guiplayerinfo1 = iterator1.Current;

                    if (stringbuilder.Length > 0)
                    {
                        stringbuilder.Append(", ");
                    }
                }

                Mc.IngameGUI.AddChatMessage(stringbuilder.ToString());
            }

            Field_50064_a.Func_50031_b(Field_50068_i[Field_50067_h++].Name);
        }