Pārlūkot izejas kodu

leverage the new getMethodSigsNS, getFieldCountNS, and getFieldNS
functions to look up methods and (hardcoded) variables from the classrep rather than creating an instance
this did cost us dynamic variable listing, but that's runtime assignment as-is and can likely be referenced another route in the end

AzaezelX 1 gadu atpakaļ
vecāks
revīzija
ca31e4c2c9

+ 0 - 7
Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.gui

@@ -110,13 +110,6 @@ $guiContent = new GuiControl(classPrototyping) {
          profile = "ToolsGuiCheckBoxProfile";
          tooltipProfile = "GuiToolTipProfile";
       };
-      new GuiCheckBoxCtrl(ReportDynamicVariables) {
-         text = "Report Dynamic Variables";
-         position = "300 420";
-         extent = "150 30";
-         profile = "ToolsGuiCheckBoxProfile";
-         tooltipProfile = "GuiToolTipProfile";
-      };
    };
 };
 //--- OBJECT WRITE END ---

+ 7 - 24
Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.tscript

@@ -60,21 +60,14 @@ function classPrototyping::fillClasslist(%this, %classInstance)
 function classPrototyping::SetNamespaceUsed(%this, %nameSpaceUsed)
 {
     ClassMethodListCtrl.deleteAllObjects();
-    if (%nameSpaceUsed $= %this.instanceName)
-    {
-        %this.tempClass = %this.inst;
-        %this.fillMethodlist(%this.inst);
-        return;
-    }
-    eval("classPrototyping.tempClass = new "@ %nameSpaceUsed @"(){};");
-    %this.fillMethodlist(%this.tempClass);    
+    %this.fillMethodlist(%nameSpaceUsed);
 }
 
-function classPrototyping::fillMethodlist(%this, %classInstance)
+function classPrototyping::fillMethodlist(%this, %nameSpaceUsed)
 {
     ClassMethodListCtrl.deleteAllObjects();
-
-    %this.methodArray = %classInstance.getMethodSigs();
+    %this.nameSpaceUsed = %nameSpaceUsed;
+    %this.methodArray = getMethodSigsNS(%nameSpaceUsed);
     %this.methodCount = %this.methodArray.count();
     
     for (%i=0; %i<%this.methodCount; %i++)
@@ -113,7 +106,7 @@ function classPrototyping::writeResults(%this)
     
     if (ReportCommands.isStateOn())
     {
-        %this.commandArray = %this.tempClass.getMethodSigs(true);
+        %this.commandArray = getMethodSigsNS(%this.nameSpaceUsed,true);
         %this.commandCount = %this.commandArray.count();
         echo("/* Available Commands:");
         for (%i=0; %i< %this.commandCount; %i++)
@@ -126,19 +119,9 @@ function classPrototyping::writeResults(%this)
     if (ReportVariables.isStateOn())
     {
         echo("/* HardCoded Variables");
-        for (%i=0; %i< %this.tempClass.getFieldCount(); %i++)
-        {
-            echo(%this.tempClass.getField(%i));
-        }
-        echo("*/");
-    }
-    
-    if (ReportDynamicVariables.isStateOn())
-    {
-        echo("/* Dynamic Variables");
-        for (%i=0; %i< %this.tempClass.getDynamicFieldCount(); %i++)
+        for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++)
         {
-            echo(getword(%this.tempClass.getDynamicField(%i),0));
+            echo(getFieldNS(%this.nameSpaceUsed,%i));
         }
         echo("*/");
     }