MUDServer.Player.ThinkTask C# (CSharp) Метод

ThinkTask() защищенный Метод

protected ThinkTask ( ) : IEnumerator
Результат IEnumerator
        protected override IEnumerator<object> ThinkTask()
        {
            string line = null;

            while (Name == null) {
                Client.SendText("Greetings, traveller. What might your name be?\r\n");

                yield return Client.ReadLineText().Bind(() => line);

                string tempName;
                try {
                    tempName = line.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0];
                } catch {
                    continue;
                }

                if (World.Players.ContainsKey(tempName.ToLower())) {
                    Client.SendText("A player with that name is already logged in.\r\n");
                    continue;
                }
                Name = tempName;
            }

            Console.WriteLine("{0} has entered the world", Name);
            World.Players[Name.ToLower()] = this;

            while (!_Disposed) {
                yield return Client.ReadLineText().Bind(() => line);

                if (line != null) {
                    yield return ProcessInput(line);
                }
            }
        }