fCraft.Command.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

示例#1
0
        void Roll(Player player, Command cmd)
        {
            Random rand = new Random();
            int    min = 1, max = 100, num, t1, t2;

            if (cmd.NextInt(out t1))
            {
                if (cmd.NextInt(out t2))
                {
                    if (t2 >= t1)
                    {
                        min = t1;
                        max = t2;
                    }
                }
                else if (t1 >= 1)
                {
                    max = t1;
                }
            }
            num = rand.Next(min, max + 1);
            string msg = Color.Silver + player.name + " rolled " + num + " (" + min + "..." + max + ")";

            world.log.LogConsole(msg);
            world.SendToAll(PacketWriter.MakeMessage(msg), null);
        }
All Usage Examples Of fCraft.Command::NextInt