fCraft.CommandReader.NextInt C# (CSharp) Method

NextInt() private method

private NextInt ( int &number ) : bool
number int
return bool
        public bool NextInt( out int number ) {
            string nextVal = Next();
            if( nextVal == null ) {
                number = 0;
                return false;
            } else {
                return Int32.TryParse( nextVal, out number );
            }
        }

Usage Example

Exemplo n.º 1
0
        static void MarkHandler([NotNull] Player player, [NotNull] CommandReader cmd)
        {
            Map      map = player.WorldMap;
            int      x, y, z;
            Vector3I coords;

            if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z))
            {
                if (cmd.HasNext)
                {
                    CdMark.PrintUsage(player);
                    return;
                }
                coords = new Vector3I(x, y, z);
            }
            else
            {
                coords = player.Position.ToBlockCoords();
            }
            coords.X = Math.Min(map.Width - 1, Math.Max(0, coords.X));
            coords.Y = Math.Min(map.Length - 1, Math.Max(0, coords.Y));
            coords.Z = Math.Min(map.Height - 1, Math.Max(0, coords.Z));

            if (player.SelectionMarksExpected > 0)
            {
                player.SelectionAddMark(coords, true, true);
            }
            else
            {
                player.MessageNow("Cannot mark - no selection in progress.");
            }
        }
All Usage Examples Of fCraft.CommandReader::NextInt