Remove transparent property.

This commit is contained in:
2022-11-18 10:23:51 +08:00
parent bf942cbe45
commit 1be5cc77ca
5 changed files with 6 additions and 20 deletions

View File

@@ -105,7 +105,7 @@ namespace Cryville.Crtr.Components {
body.Load();
tail.Load();
mesh.Init(transform, transparent);
mesh.Init(transform);
List<Material> materials = new List<Material>();
if (head.FrameName != null) AddMat(materials, head.FrameName);

View File

@@ -5,7 +5,6 @@ namespace Cryville.Crtr.Components {
public abstract class SpriteBase : MeshBase {
public SpriteBase() {
SubmitProperty("bound", new op_set_bound(this));
SubmitProperty("transparent", new PropOp.Boolean(v => transparent = v));
SubmitProperty("pivot", new PropOp.Vector2(v => Pivot = v));
SubmitProperty("scale", new PropOp.Vector2(v => Scale = v));
SubmitProperty("ui", new PropOp.Boolean(v => UI = v));
@@ -91,10 +90,8 @@ namespace Cryville.Crtr.Components {
}
}
public bool transparent = false;
protected void InternalInit(string meshName = "quad") {
mesh.Init(transform, transparent);
mesh.Init(transform);
mesh.Mesh = GenericResources.Meshes[meshName];
UpdateScale();
UpdateZIndex();

View File

@@ -4,8 +4,6 @@ namespace Cryville.Crtr.Components {
public class SpriteRect : SpriteBase {
public SpriteRect() {
SubmitProperty("color", new PropOp.Color(v => Color = v));
transparent = true;
}
Color _color;

View File

@@ -86,7 +86,7 @@ namespace Cryville.Crtr.Components {
else if (frameHeight != f.Value.Rect.height) throw new Exception("Inconsistent frame height");
if (!meshes.ContainsKey(f.Value.Frame.Texture)) {
var m = new MeshWrapper();
m.Init(mesh.MeshTransform, transparent);
m.Init(mesh.MeshTransform);
m.Mesh = new Mesh();
m.Renderer.material.mainTexture = f.Value.Frame.Texture;
meshes.Add(f.Value.Frame.Texture, m);

View File

@@ -22,23 +22,16 @@ namespace Cryville.Crtr {
get;
private set;
}
public bool Transparent {
get;
private set;
}
public bool Initialized {
get;
private set;
}
public Material NewMaterial {
get {
return Material.Instantiate(GenericResources.Materials[
Transparent ? "-TransparentMat" : "-CutoutMat"
]);
return Material.Instantiate(GenericResources.Materials["-CutoutMat"]);
}
}
public void Init(Transform parent, bool transparent = false) {
Transparent = transparent;
public void Init(Transform parent) {
MeshObject = new GameObject("__mesh__");
MeshTransform = MeshObject.transform;
MeshTransform.SetParent(parent, false);
@@ -48,9 +41,7 @@ namespace Cryville.Crtr {
MeshObject.AddComponent<MeshRenderer>();
MeshFilter = MeshObject.GetComponent<MeshFilter>();
Renderer = MeshObject.GetComponent<Renderer>();
Renderer.material = GenericResources.Materials[
transparent ? "-TransparentMat" : "-CutoutMat"
]; // TODO
Renderer.material = GenericResources.Materials["-CutoutMat"];
Initialized = true;
}
public void Destroy() {