static ReplicaReturnResult ConstructionCB(BitStream inBitStream, uint timestamp, NetworkID networkID, NetworkIDObject existingObject, SystemAddress senderId, ReplicaManagerExt caller, IntPtr userData) { StringBuilder output = new StringBuilder(255); if (isServer) return ReplicaReturnResult.REPLICA_PROCESSING_DONE; StringTable.Instance().DecodeString(output, output.Capacity, inBitStream); if (output.ToString() == "Player") { System.Diagnostics.Debug.Assert(player == null); player = new Player(); player.replica.SetNetworkIDManager(networkIDManager); player.replica.SetNetworkID(networkID); if (!isServer) { replicaManager.Construct(player.replica, true, senderId, false); replicaManager.SetScope(player.replica, true, senderId, false); } Console.Write("New player created\n"); } else if (output.ToString() == "Monster") { System.Diagnostics.Debug.Assert(monster == null); monster = new Monster(); monster.replica.SetNetworkIDManager(networkIDManager); monster.replica.SetNetworkID(networkID); if (!isServer) { replicaManager.Construct(monster.replica, true, senderId, false); replicaManager.SetScope(monster.replica, true, senderId, false); } Console.Write("New monster created\n"); } else { System.Diagnostics.Debug.Assert(false); } return ReplicaReturnResult.REPLICA_PROCESSING_DONE; }
static ReplicaReturnResult SendDownloadCompleteCB(BitStream inBitStream, uint timestamp, SystemAddress senderId, ReplicaManagerExt caller, IntPtr userData) { return ReplicaReturnResult.REPLICA_PROCESSING_DONE; }
static ReplicaReturnResult ReceiveDownloadCompleteCB(BitStream inBitStream, SystemAddress senderId, ReplicaManagerExt caller, IntPtr userData) { if (!isServer) Console.Write("Object downloads complete\n"); return ReplicaReturnResult.REPLICA_PROCESSING_DONE; }