本文整理汇总了C#中fCraft.World类的典型用法代码示例。如果您正苦于以下问题:C# World类的具体用法?C# World怎么用?C# World使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
World类属于fCraft命名空间,在下文中一共展示了World类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FeedData
public FeedData( Block _textType, Vector3I _pos, Bitmap Image, World world, Direction direction_, Player player_ )
{
direction = direction_;
Blocks = new ConcurrentDictionary<string, Vector3I>();
Init( Image, world );
Pos = _pos;
textType = ( byte )_textType;
bgType = ( byte )Block.Air;
FeedData.AddMessages();
MessageCount = 0;
Sentence = FeedData.Messages[MessageCount];
Id = System.Threading.Interlocked.Increment( ref feedCounter );
player = player_;
NormalBrush brush = new NormalBrush( Block.Wood );
DrawOperation Operation = new CuboidWireframeDrawOperation( player );
Operation.AnnounceCompletion = false;
Operation.Brush = brush;
Operation.Context = BlockChangeContext.Drawn;
if ( !Operation.Prepare( new Vector3I[] { StartPos, FinishPos } ) ) {
throw new Exception( "Unable to cubw frame." );
}
Operation.Begin();
AddFeedToList( this, world );
Start();
}
示例2: PlayerProximityTracker
private World _world = null; //to be able to remove players left the game
#endregion Fields
#region Constructors
public PlayerProximityTracker( int xSize, int ySize, World world )
{
_players = new List<Player>[xSize, ySize];
foreach ( Player p in world.Players ) {
AddPlayer( p, p.Position.ToBlockCoords() );
}
}
示例3: StartUp
void StartUp( object sender, EventArgs a ) {
world = new World( "" );
world.OnLog += Log;
world.OnURLChange += SetURL;
world.OnPlayerListChange += UpdatePlayerList;
if( world.Init() ) {
Text = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString( "ServerName" );
UpdaterResult update = Updater.CheckForUpdates( world );
if( update.UpdateAvailable ) {
if( world.config.GetString( "AutomaticUpdates" ) == "Notify" ) {
Log( String.Format( Environment.NewLine +
"*** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. ***"+
Environment.NewLine,
Decimal.Divide( update.NewVersionNumber, 1000 ),
DateTime.Now.Subtract( update.ReleaseDate ).TotalDays ), LogType.ConsoleOutput );
StartServer();
} else {
UpdateWindow updateWindow = new UpdateWindow( update, this, world.config.GetString( "AutomaticUpdates" ) == "Auto" );
updateWindow.StartPosition = FormStartPosition.CenterParent;
updateWindow.ShowDialog();
}
} else {
StartServer();
}
} else {
world.log.Log( "---- Could Not Initialize World ----", LogType.FatalError );
world = null;
}
}
示例4: MakeNormalFoliage
public static void MakeNormalFoliage( World w, Vector3I Pos, int Height )
{
int topy = Pos.Z + Height - 1;
int start = topy - 2;
int end = topy + 2;
for ( int y = start; y < end; y++ ) {
int rad;
if ( y > start + 1 ) {
rad = 1;
} else {
rad = 2;
}
for ( int xoff = -rad; xoff < rad + 1; xoff++ ) {
for ( int zoff = -rad; zoff < rad + 1; zoff++ ) {
if ( w.Map != null && w.IsLoaded ) {
if ( Rand.NextDouble() > .618 &&
Math.Abs( xoff ) == Math.Abs( zoff ) &&
Math.Abs( xoff ) == rad ) {
continue;
}
w.Map.QueueUpdate( new
BlockUpdate( null, ( short )( Pos.X + xoff ), ( short )( Pos.Y + zoff ), ( short )y, Block.Leaves ) );
}
}
}
}
}
示例5: Session
public Session( World _world, TcpClient _client ) {
world = _world;
loginTime = DateTime.Now;
canReceive = true;
canQueue = true;
canSend = false;
canDispose = false;
outputQueue = new Queue<Packet>();
priorityOutputQueue = new Queue<Packet>();
queueLock = new object();
priorityQueueLock = new object();
client = _client;
client.SendTimeout = 10000;
client.ReceiveTimeout = 10000;
reader = new BinaryReader( client.GetStream() );
writer = new PacketWriter( new BinaryWriter( client.GetStream() ) );
world.log.Log( "Session: {0}", LogType.Debug, ToString() );
ioThread = new Thread( IoLoop );
ioThread.IsBackground = true;
ioThread.Start();
}
示例6: BlockFloat
public BlockFloat(World world, Vector3I position, Block Type)
: base(world)
{
_pos = position;
_nextPos = position.Z + 1;
type = Type;
}
示例7: FireworkParticle
public FireworkParticle(World world, Vector3I pos, Block block)
: base(world)
{
_startingPos = pos;
_nextZ = pos.Z - 1;
_block = block;
}
示例8: Player
// This constructor is used to create dummy players (such as Console and /dummy)
// It will soon be replaced by a generic Entity class
internal Player( World world, string name ) {
if( name == null ) throw new ArgumentNullException( "name" );
World = world;
Info = new PlayerInfo( name, RankManager.HighestRank, true, RankChangeType.AutoPromoted );
spamBlockLog = new Queue<DateTime>( Info.Rank.AntiGriefBlocks );
ResetAllBinds();
}
示例9: SandTask
public SandTask(World world, Vector3I position, Block Type)
: base(world)
{
_pos = position;
_nextPos = position.Z - 1;
_type = Type;
}
示例10: PlayerInfo
// generate info for a new player
public PlayerInfo( World world, Player player ) {
name = player.name;
lastIP = player.session.GetIP();
playerClass = world.classes.defaultClass;
classChangeDate = DateTime.MinValue;
classChangedBy = "-";
banned = false;
banDate = DateTime.MinValue;
bannedBy = "-";
unbanDate = DateTime.MinValue;
unbannedBy = "-";
banReason = "-";
unbanReason = "-";
lastFailedLoginDate = DateTime.MinValue;
lastFailedLoginIP = IPAddress.None;
failedLoginCount = 0;
firstLoginDate = DateTime.Now;
lastLoginDate = firstLoginDate;
totalTimeOnServer = new TimeSpan( 0 );
blocksBuilt = 0;
blocksDeleted = 0;
timesVisited = 1;
linesWritten = 0;
thanksReceived = 0;
warningsReceived = 0;
}
示例11: Player
// This constructor is used to create dummy players (such as Console and /dummy)
// It will soon be replaced by a generic Entity class
internal Player( World _world, string _name )
{
world = _world;
name = _name;
nick = name;
info = new PlayerInfo( _name, ClassList.highestClass );
}
示例12: Commands
internal Commands( World _world ) {
world = _world;
mapCommands = new MapCommands( world, this );
blockCommands = new BlockCommands( world, this );
infoCommands = new InfoCommands( world, this );
standardCommands = new StandardCommands( world, this );
drawCommands = new DrawCommands( world, this );
}
示例13: Player
// Normal constructor
internal Player( World _world, string _name, Session _session, Position _pos ) {
world = _world;
name = _name;
nick = name;
session = _session;
pos = _pos;
info = world.db.FindPlayerInfo( this );
}
示例14: GameAdder
public static void GameAdder(World world)
{
world.Games.Add(pinkPlatform);
world.Games.Add(shootBlack);
world.Games.Add(math1);
world.Games.Add(math2);
world.Games.Add(getOffGrass);
}
示例15: BlockCommands
// Register help commands
internal BlockCommands( World _world, Commands commands ) {
world = _world;
commands.AddCommand( "grass", Grass, false );
commands.AddCommand( "water", Water, false );
commands.AddCommand( "lava", Lava, false );
commands.AddCommand( "solid", Solid, false );
commands.AddCommand( "s", Solid, false );
commands.AddCommand( "paint", Paint, false );
//CommandUtils.AddCommand( "sand", Sand ); // TODO: after sand sim is done
}