change window height and width

This commit is contained in:
EliyaFishman 2022-12-07 17:57:40 +02:00
parent 82ff7f3c95
commit b5bec07e27
2 changed files with 16 additions and 9 deletions

View file

@ -10,24 +10,30 @@ namespace Bread2Unity
{ {
public class Bread2UnityGUI : EditorWindow public class Bread2UnityGUI : EditorWindow
{ {
public const string EditorFolderName = "bread2unity"; private const string EditorFolderName = "bread2unity";
private const float Width = 657;
private const float Height = 442;
private GameObject _prefab; private GameObject _prefab;
private DataModel _animation; private DataModel _animation;
private List<PrefabData> _prefabDataList = new List<PrefabData>(); private List<PrefabData> _prefabDataList = new List<PrefabData>();
private List<string> _animationsIndexes; private List<string> _animationsIndexes = new List<string> ();
private bool shouldRotate = false; private bool _shouldRotate;
private Vector2 _scrollPosition; private Vector2 _scrollPosition;
[MenuItem("Tools/bread2unity")] [MenuItem("Tools/bread2unity")]
public static void ShowWindow() public static void ShowWindow()
{ {
GetWindow<Bread2UnityGUI>("bread2unity"); var window = GetWindow<Bread2UnityGUI>("bread2unity");
var x = Screen.currentResolution.width / 2f - Width;
var y = Screen.currentResolution.height / 2f - Height;
window.position = new Rect(x,y,Width,Height);
} }
public void CreateGUI() public void CreateGUI()
{ {
_animationsIndexes = new List<string>(); _animationsIndexes.Add("");
_prefabDataList.Add(new PrefabData("", 0));
} }
public void OnGUI() public void OnGUI()
@ -101,7 +107,7 @@ namespace Bread2Unity
GUILayout.Space(12f); GUILayout.Space(12f);
// Rotate check box // Rotate check box
shouldRotate = GUILayout.Toggle(shouldRotate, "Rotate Spritesheet"); _shouldRotate = GUILayout.Toggle(_shouldRotate, "Rotate Spritesheet");
GUILayout.Space(12f); GUILayout.Space(12f);
@ -117,7 +123,7 @@ namespace Bread2Unity
if (!string.IsNullOrEmpty(pngFilePath)) if (!string.IsNullOrEmpty(pngFilePath))
{ {
var bccad = BCCAD.Read(File.ReadAllBytes(bccadFilePath)); var bccad = BCCAD.Read(File.ReadAllBytes(bccadFilePath));
var spriteTexture = SpriteCreator.ComputeSprites(bccad, pngFilePath, _prefab.name, shouldRotate); var spriteTexture = SpriteCreator.ComputeSprites(bccad, pngFilePath, _prefab.name, _shouldRotate);
//Create prefab from prefab data //Create prefab from prefab data
for (int i = 0; i < _prefabDataList.Count; i++) for (int i = 0; i < _prefabDataList.Count; i++)
{ {

View file

@ -18,8 +18,9 @@ Rhythm Heaven animation to Unity animation converter
- [x] add translation from steps - [x] add translation from steps
- [X] remove bccad test - [X] remove bccad test
- [ ] add default line for bcaad data - [X] add default line for bcaad data
- [ ] change window height and width - [X] change window height and width
- [ ] change sprite order with sprite renderer.
- [ ] write a normal readme - [ ] write a normal readme