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
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using DepthsOfGreed.HandbookUI;
|
||||
public static class PreviewLayersValidation
|
||||
{
|
||||
static void Check(bool ok,string message){if(!ok)throw new Exception(message);}
|
||||
public static void Validate(){GameObject root=null,source=null;Texture2D texture=null;Sprite a=null,b=null;HandbookTowerEntry t=null;try{
|
||||
EditorSceneManager.OpenScene("Assets/Scenes/Tim_Test_UI.unity");
|
||||
root=new GameObject("TEMP_LayersTest");var preview=root.AddComponent<LayeredTowerPreview>();texture=new Texture2D(32,32);a=Sprite.Create(texture,new Rect(0,0,32,32),new Vector2(.25f,.75f),32);b=Sprite.Create(texture,new Rect(0,0,32,32),new Vector2(.8f,.1f),32);
|
||||
t=ScriptableObject.CreateInstance<HandbookTowerEntry>();t.id="layer-test";t.previewLayers=new[]{new PreviewSpriteLayer{sprite=a},new PreviewSpriteLayer{sprite=b,rotateWithAim=false}};preview.Show(t,a);
|
||||
var layers=root.GetComponentsInChildren<SpriteRenderer>();Check(layers.Length==2 && layers[0].sortingOrder>layers[1].sortingOrder,"Front-to-back order");Check(layers[0].transform.position==layers[1].transform.position,"Different sprite pivots share mouse anchor");Check(layers[0].transform.localScale==layers[1].transform.localScale,"Shared scale preserves proportions");
|
||||
t.baseShape=BaseShape.Rectangle;t.baseSize=new Vector2(3,1);t.previewLayers=new PreviewSpriteLayer[2];preview.Show(t,a);Check(Mathf.Abs(layers[0].transform.localScale.x/layers[0].transform.localScale.y-3)<.01f,"Rectangular fallback retains base proportions");t.baseShape=BaseShape.Circle;
|
||||
var gameplay=root.AddComponent<PrototypeHandbookGameplay>();gameplay.Initialize(root.transform,Vector3.zero,3,4,null);source=new GameObject("ActualGameplayPrefab",typeof(SpriteRenderer));source.transform.localScale=Vector3.one*1.2f;t.gameplayPrefab=source;t.baseRadius=.2f;
|
||||
Check(gameplay.ExecuteBuild(new BuildRequest(t,new Vector3(3.5f,0,0),30)).Allowed,"Prefab placement");Check(gameplay.BuiltObjects[0].instance.transform.localScale==source.transform.localScale,"Assigned prefab instantiated without rescaling");
|
||||
Check(Shader.Find("Handbook/ArenaRange"),"Arena clipping shader available");
|
||||
UnityEngine.Object.DestroyImmediate(root);UnityEngine.Object.DestroyImmediate(source);UnityEngine.Object.DestroyImmediate(t);UnityEngine.Object.DestroyImmediate(a);UnityEngine.Object.DestroyImmediate(b);UnityEngine.Object.DestroyImmediate(texture);Debug.Log("PREVIEW_LAYERS_VALIDATION_OK");EditorApplication.Exit(0);
|
||||
}catch(Exception e){Debug.LogException(e);EditorApplication.Exit(1);}}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user