Browse Source

feedback from az

scripts changed to reflect a better standard of loading offscreencanvas on client and not on the server
marauder2k7 2 months ago
parent
commit
26e18cdfe8

+ 15 - 0
Templates/BaseGame/game/data/Prototyping/Prototyping.tscript

@@ -42,6 +42,21 @@ function Prototyping::initClient(%this)
 //This is called when a client connects to a server
 function Prototyping::onCreateClientConnection(%this)
 {
+   if (!isObject(screen_Canvas))
+   {
+      new GuiOffscreenCanvas(screen_Canvas) {
+         targetName = "screen_Canvas";
+         targetSize = "1280 720";
+         dynamicTarget = false;
+         canInteract = true;
+         maxInteractDistance = "3";
+      };
+   }
+
+   if(isObject(OptionsMenu))
+   {
+      screen_Canvas.setContent(OptionsMenu);
+   }
 }
 
 //This is called when a client disconnects from a server

+ 1 - 0
Templates/BaseGame/game/data/Prototyping/gui_offscreen_test/monitor_base_mat.asset.taml

@@ -4,6 +4,7 @@
     <Material
         Name="monitor_base_mat"
         mapTo="monitor_base_mat"
+        doubleSided="true"
         originalAssetName="monitor_base_mat">
         <Material.Stages>
             <Stages_beginarray

+ 0 - 41
Templates/BaseGame/game/data/Prototyping/gui_offscreen_test/monitor_shape.tscript

@@ -17,45 +17,4 @@ function monitor_shapefbx::onLoad(%this)
    %this.addNode("ColBox-1", "Col-1", "0 0 0 1 0 0 0", "0", "Bounds");
    %this.addCollisionDetail("-1", "Box", "Bounds", "4", "10", "30", "32", "30", "30", "30", "Flood fill");
    %this.setBounds("-0.8 -0.244957 -0.0409516 0.8 0.244957 1.10231");
-   
-   if (!isObject(screen_Canvas))
-   {
-      new GuiOffscreenCanvas(screen_Canvas) {
-         targetName = "screen_Canvas";
-         targetSize = "1280 720";
-         dynamicTarget = false;
-         canInteract = true;
-         maxInteractDistance = "3";
-      };
-   }
-
-   if(isObject(OptionsMenu))
-   {
-      screen_Canvas.setContent(OptionsMenu);
-   }
-
-   %screen_Canvas_asset = "Prototyping:ScreenTarget";
-   if(!AssetDatabase.isDeclaredAsset(%screen_Canvas_asset))
-   {
-      %screen_asset = new ImageAsset()
-      {
-         assetName = "ScreenTarget";
-         versionId = 1;
-         imageFile = "#screen_Canvas";
-      };
-      TamlWrite(%screen_asset, expandPath("^Prototyping/gui_offscreen_test/" @ %screen_asset.AssetName @ ".asset.taml"));
-      %previewModule = ModuleDatabase.findModule("Prototyping",1);
-      AssetDatabase.addDeclaredAsset(%previewModule, expandPath("^Prototyping/gui_offscreen_test/" @ %screen_asset.AssetName @ ".asset.taml"));
-   }
-
-   %mat_asset = "Prototyping:monitor_screen_mat";
-   if(!AssetDatabase.isDeclaredAsset(%mat_asset))
-   {
-      echo("Material asset not found, this should exist");
-   }
-
-   %assetDef = AssetDatabase.acquireAsset(%mat_asset);
-   %material = %assetDef.materialDefinitionName;  
-   %material.DiffuseMapAsset = %screen_Canvas_asset;
-
 }