Browse Source

Removed the package download test from TestScene, as the example is already complex enough as it is.
Added progress prints to PackageTool.

Lasse Öörni 12 years ago
parent
commit
dbb0c17a75
2 changed files with 4 additions and 34 deletions
  1. 0 34
      Bin/Data/Scripts/TestScene.as
  2. 4 0
      Tools/PackageTool/PackageTool.cpp

+ 0 - 34
Bin/Data/Scripts/TestScene.as

@@ -8,8 +8,6 @@ float yaw = 0.0;
 float pitch = 0.0;
 float pitch = 0.0;
 int drawDebug = 0;
 int drawDebug = 0;
 
 
-Text@ downloadsText;
-
 void Start()
 void Start()
 {
 {
     if (!engine.headless)
     if (!engine.headless)
@@ -42,23 +40,9 @@ void Start()
 
 
         // Disable physics interpolation to ensure clients get sent physically correct transforms
         // Disable physics interpolation to ensure clients get sent physically correct transforms
         testScene.physicsWorld.interpolation = false;
         testScene.physicsWorld.interpolation = false;
-
-        // Test package download by adding all package files in the cache as requirements for the scene
-        Array<PackageFile@> packages = cache.packageFiles;
-        for (uint i = 0; i < packages.length; ++i)
-            testScene.AddRequiredPackageFile(packages[i]);
     }
     }
     if (runClient)
     if (runClient)
-    {
-        // Test package download. Remove existing Data.pak from resource cache so that it will be downloaded
-        // However, be sure to add the Data directory so that resource requests do not fail in the meanwhile
-        String packageName = fileSystem.programDir + "Data.pak";
-        cache.RemovePackageFile(packageName, false);
-        cache.AddResourceDir(fileSystem.programDir + "Data");
-
-        network.packageCacheDir = fileSystem.programDir;
         network.Connect(serverAddress, serverPort, testScene);
         network.Connect(serverAddress, serverPort, testScene);
-    }
 }
 }
 
 
 void InitConsole()
 void InitConsole()
@@ -83,11 +67,6 @@ void InitUI()
     ui.cursor = newCursor;
     ui.cursor = newCursor;
     if (GetPlatform() == "Android" || GetPlatform() == "iOS")
     if (GetPlatform() == "Android" || GetPlatform() == "iOS")
         ui.cursor.visible = false;
         ui.cursor.visible = false;
-
-    downloadsText = Text();
-    downloadsText.SetAlignment(HA_CENTER, VA_CENTER);
-    downloadsText.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 20);
-    ui.root.AddChild(downloadsText);
 }
 }
 
 
 void InitScene()
 void InitScene()
@@ -253,19 +232,6 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
         if (input.keyDown['D'])
         if (input.keyDown['D'])
             cameraNode.TranslateRelative(Vector3(10, 0, 0) * timeStep * speedMultiplier);
             cameraNode.TranslateRelative(Vector3(10, 0, 0) * timeStep * speedMultiplier);
     }
     }
-
-    // Update package download status
-    if (network.serverConnection !is null)
-    {
-        Connection@ connection = network.serverConnection;
-        if (connection.numDownloads > 0)
-        {
-            downloadsText.text = "Downloads: " + connection.numDownloads + " Current download: " +
-                connection.downloadName + " (" + int(connection.downloadProgress * 100.0) + "%)";
-        }
-        else if (!downloadsText.text.empty)
-            downloadsText.text = "";
-    }
 }
 }
 
 
 void HandleKeyDown(StringHash eventType, VariantMap& eventData)
 void HandleKeyDown(StringHash eventType, VariantMap& eventData)

+ 4 - 0
Tools/PackageTool/PackageTool.cpp

@@ -86,6 +86,8 @@ void Run(const Vector<String>& arguments)
     if (arguments.Size() > 2)
     if (arguments.Size() > 2)
         basePath_ = AddTrailingSlash(arguments[2]);
         basePath_ = AddTrailingSlash(arguments[2]);
     
     
+    PrintLine("Scanning directory " + dirName + " for files");
+    
    // Get the file list recursively
    // Get the file list recursively
     Vector<String> fileNames;
     Vector<String> fileNames;
     fileSystem_->ScanDir(fileNames, dirName, "*.*", SCAN_FILES, true);
     fileSystem_->ScanDir(fileNames, dirName, "*.*", SCAN_FILES, true);
@@ -154,6 +156,8 @@ void WritePackageFile(const String& fileName, const String& rootDir)
     // Write file data, calculate checksums & correct offsets
     // Write file data, calculate checksums & correct offsets
     for (unsigned i = 0; i < entries_.Size(); ++i)
     for (unsigned i = 0; i < entries_.Size(); ++i)
     {
     {
+        PrintLine("Writing file " + entries_[i].name_);
+        
         entries_[i].offset_ = dest.GetSize();
         entries_[i].offset_ = dest.GetSize();
         String fileFullPath = rootDir + "/" + entries_[i].name_;
         String fileFullPath = rootDir + "/" + entries_[i].name_;