Code refactor

This commit is contained in:
AbstractConcept 2022-10-31 00:44:53 -05:00
parent 5ca7e486f8
commit e14a12f2ab
310 changed files with 4875 additions and 4102 deletions

View file

@ -14,6 +14,10 @@ namespace RimWorldAnimationStudio
public SingleGraphic eastGraphic = new SingleGraphic();
public SingleGraphic southGraphic = new SingleGraphic();
public bool ShouldSerializenorthGraphic() { return string.IsNullOrEmpty(northGraphic.path) == false; }
public bool ShouldSerializeeastGraphic() { return string.IsNullOrEmpty(eastGraphic.path) == false; }
public bool ShouldSerializesouthGraphic() { return string.IsNullOrEmpty(southGraphic.path) == false; }
public MultiDirectionalGraphic() { }
public MultiDirectionalGraphic(string bodyType)

View file

@ -10,7 +10,7 @@ namespace RimWorldAnimationStudio
[Serializable]
public class SingleGraphic
{
public string path = "Invalid file path";
public string path;
[XmlIgnore] public Sprite sprite = null;
public void SetPath(string path)
@ -43,7 +43,9 @@ namespace RimWorldAnimationStudio
Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(pngBytes);
Sprite sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 85.0f);
float scale = Mathf.Min(texture.width, texture.height) / 128f;
Sprite sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 85.0f * scale);
return sprite;
}