mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
5ca7e486f8
commit
e14a12f2ab
310 changed files with 4875 additions and 4102 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue