Angepasste Garage, verbessertes Icon Asset system, range der türme vorschau beim ziehen
This commit is contained in:
1 parent
5486444dde
commit
5af8655c97
59 files changed
+12079
-457
No files matched your search
@@ -31,7 +31,7 @@ public static class SupplyBasementValidation
|
||||
{
|
||||
c=UnityEngine.Object.FindFirstObjectByType<SupplyBasementController>();
|
||||
Assert(c && c.connectionButtons.Length==8 && c.priorityButtons.Length==3,"Authored references");
|
||||
Assert(!c.basementView.activeSelf && c.handbookRoot.activeSelf,"Starts on tower floor");
|
||||
Assert((c.roomView ? !c.roomView.IsVisible && c.basementView.activeSelf : !c.basementView.activeSelf) && c.handbookRoot.activeSelf,"Starts on tower floor; room remains active");
|
||||
count=Count(c);bookScale=c.handbook.transform.Find("OpenBook").localScale;
|
||||
var catalog=AssetDatabase.LoadAssetAtPath<HandbookTowerCatalog>("Assets/HandbookData/TestTurmkatalog.asset");
|
||||
var result=c.placement.Backend.ExecuteBuild(new BuildRequest(catalog.towers.First(t=>t.id=="ammo_0"),new Vector3(3.5f,0,0)));
|
||||
@@ -73,17 +73,19 @@ public static class SupplyBasementValidation
|
||||
catch(Exception e){EditorApplication.update-=run;Debug.LogException(e);EditorApplication.Exit(1);}
|
||||
};EditorApplication.update+=run;
|
||||
}
|
||||
static int Count(SupplyBasementController c)=>c.GetComponentInParent<Canvas>().GetComponentsInChildren<RectTransform>(true).Count(t=>!t.name.StartsWith("TMP"));
|
||||
static int Count(SupplyBasementController c)=>c.GetComponentInParent<Canvas>().GetComponentsInChildren<RectTransform>(true).Concat(c.basementView.GetComponentsInChildren<RectTransform>(true)).Distinct().Count(t=>!t.name.StartsWith("TMP"));
|
||||
static void Assert(bool condition,string message){if(!condition)throw new Exception(message);}
|
||||
static void Capture(SupplyBasementController c)
|
||||
{
|
||||
var camera=Camera.main;var canvas=c.GetComponentInParent<Canvas>();
|
||||
var camera=c.roomView?c.roomView.roomCamera:Camera.main;var canvas=c.GetComponentInParent<Canvas>();
|
||||
var rt=new RenderTexture(1920,1080,24);rt.Create();camera.targetTexture=rt;camera.aspect=1920f/1080;
|
||||
canvas.renderMode=RenderMode.ScreenSpaceCamera;canvas.worldCamera=camera;canvas.planeDistance=1;canvas.sortingOrder=200;
|
||||
Canvas.ForceUpdateCanvases();RenderPipeline.SubmitRenderRequest(camera,new UniversalRenderPipeline.SingleCameraRequest{destination=rt});
|
||||
var previous=RenderTexture.active;RenderTexture.active=rt;var tex=new Texture2D(1920,1080,TextureFormat.RGB24,false);tex.ReadPixels(new Rect(0,0,1920,1080),0,0);tex.Apply();RenderTexture.active=previous;
|
||||
var folder=Path.Combine(Path.GetDirectoryName(Application.dataPath),"Temp","HandbookValidation");
|
||||
var folder=Path.Combine(Path.GetDirectoryName(Application.dataPath),"Logs","HandbookValidation");
|
||||
Directory.CreateDirectory(folder);File.WriteAllBytes(Path.Combine(folder,"basement-preview.png"),tex.EncodeToPNG());
|
||||
UnityEngine.Object.DestroyImmediate(tex);camera.targetTexture=null;rt.Release();UnityEngine.Object.DestroyImmediate(rt);canvas.renderMode=RenderMode.ScreenSpaceOverlay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user