} // end of Callback_Ping() public void Callback_PutWorldData(AsyncResult result) { LevelMetadata uploadedLevel = result.Param as LevelMetadata; if (result.Success && uploadedLevel != null && uploadedLevel.LinkedToLevel != null) { LevelMetadata nextLevel = uploadedLevel.NextLink(); if (nextLevel != null) { string folderName = Utils.FolderNameFromFlags(nextLevel.Genres); string fullPath = BokuGame.Settings.MediaPath + folderName + nextLevel.WorldId.ToString() + @".Xml"; // Read it back from disk and start uploading it to the community. BokuShared.Wire.WorldPacket packet = XmlDataHelper.ReadWorldPacketFromDisk(fullPath); UploadWorldData(packet, nextLevel); return; } } if (result.Success) { ShowShareSuccessDialog(); } else { ShowShareErrorDialog("Share failed."); } } // end of Callback_PutWorldData()
public PutWorldData( BokuShared.Wire.WorldPacket world, SendOrPostCallback callback, object userState) : base(true, callback, userState) { //Compress world data before sending. world.Data.VirtualMapBytes = BokuShared.Compression.Compress(world.Data.VirtualMapBytes); world.Data.StuffXmlBytes = BokuShared.Compression.Compress(world.Data.StuffXmlBytes); world.Data.WorldXmlBytes = BokuShared.Compression.Compress(world.Data.WorldXmlBytes); this.world = world; }
/// <summary> /// Callback that results from testing whether or not the community server is active. /// </summary> /// <param name="resultObj"></param> public void Callback_Ping(AsyncResult resultObj) { AsyncResult result = (AsyncResult)resultObj; if (result.Success) { // Read it back from disk and start uploading it to the community. BokuShared.Wire.WorldPacket packet = XmlDataHelper.ReadWorldPacketFromDisk(result.Param as string); LevelMetadata level = XmlDataHelper.LoadMetadataByGenre(packet.Info.WorldId, (BokuShared.Genres)packet.Info.Genres); UploadWorldData(packet, level); } else { ShowShareErrorDialog("Login failed."); } } // end of Callback_Ping()
public CommunityShareMenu() { // signedInMessage { ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog) { // User chose "upload" //find the first link LevelMetadata level = CurWorld; level = level.FindFirstLink(); string folderName = Utils.FolderNameFromFlags(level.Genres); string fullPath = BokuGame.Settings.MediaPath + folderName + level.WorldId.ToString() + @".Xml"; // Read it back from disk and start uploading it to the community. BokuShared.Wire.WorldPacket packet = XmlDataHelper.ReadWorldPacketFromDisk(fullPath); UploadWorldData(packet, level); // Deactivate dialog. dialog.Deactivate(); Deactivate(); }; ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog) { // User chose "cancel" // Deactivate dialog. dialog.Deactivate(); Deactivate(); }; ModularMessageDialog.ButtonHandler handlerY = delegate(ModularMessageDialog dialog) { // Deactivate dialog. dialog.Deactivate(); Deactivate(); }; } // signedOutMessage { ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog) { // Deactivate dialog. dialog.Deactivate(); }; ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog) { // User chose "cancel" // Deactivate dialog. dialog.Deactivate(); Deactivate(); }; ModularMessageDialog.ButtonHandler handlerY = delegate(ModularMessageDialog dialog) { // User chose "upload anonymous" LevelMetadata level = CurWorld; //find the first link level = level.FindFirstLink(); string folderName = Utils.FolderNameFromFlags(level.Genres); string fullPath = BokuGame.Settings.MediaPath + folderName + level.WorldId.ToString() + @".Xml"; // Share. // Check to see if the community server is reachable before sharing level. if (!Web.Community.Async_Ping(Callback_Ping, fullPath)) { ShowNoCommunityDialog(); } // Deactivate dialog. dialog.Deactivate(); Deactivate(); }; } }