Skip to content

Commit 9115296

Browse files
committed
fix: create tag component + start of view creator
1 parent 97cc611 commit 9115296

File tree

8 files changed

+829
-5
lines changed

8 files changed

+829
-5
lines changed

Editor/EngineCreatorEditor.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEditor;
4+
using UnityEngine;
5+
using BigasTools.InputSystem;
6+
7+
namespace BigasTools.Editor{
8+
public class EngineCreatorEditor : EditorWindow
9+
{
10+
[MenuItem("Bigas-Tools/Create Engine #b")]
11+
private static void ShowWindow() {
12+
var window = GetWindow<EngineCreatorEditor>();
13+
window.titleContent = new GUIContent("Create Engine");
14+
window.maxSize = new Vector2(400,80);
15+
window.Show();
16+
window.minSize = new Vector2(400,80);
17+
}
18+
19+
void OnGUI()
20+
{
21+
EditorGUILayout.LabelField("Welcome to Bigas Tools! With this Editor view you can launch the 'Engine' GameObject in the current scene, this object will contain everything necessary to run with the package.", EditorStyles.wordWrappedLabel);
22+
if (GUILayout.Button("Create Engine")) {
23+
var g = new GameObject();
24+
var audioController = new GameObject();
25+
var resourceController = new GameObject();
26+
var stateController = new GameObject();
27+
var bGameInput = new GameObject();
28+
audioController.transform.SetParent(g.transform);
29+
resourceController.transform.SetParent(g.transform);
30+
stateController.transform.SetParent(g.transform);
31+
bGameInput.transform.SetParent(g.transform);
32+
33+
g.name = "Engine";
34+
audioController.name = "Audio Controller";
35+
resourceController.name = "Resource Controller";
36+
stateController.name = "State Controller";
37+
bGameInput.name = "Input";
38+
39+
audioController.AddComponent<AudioController>();
40+
resourceController.AddComponent<ResourceController>();
41+
stateController.AddComponent<StateController>();
42+
bGameInput.AddComponent<BGameInput>();
43+
this.Close();
44+
};
45+
}
46+
}
47+
}

Editor/EngineCreatorEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/TagCreatorEditor.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
using BigasTools;
6+
7+
namespace BigasTools.Editor{
8+
public class TagCreatorEditor : EditorWindow {
9+
string tagName;
10+
static GameObject obj;
11+
static Tags tags;
12+
13+
/*[MenuItem("Bigas-Tools/Tag Creator #t")]
14+
private static void ShowWindow() {
15+
var window = GetWindow<TagCreatorEditor>();
16+
window.titleContent = new GUIContent("TagCreator");
17+
window.maxSize = new Vector2(400,120);
18+
window.Show();
19+
}
20+
21+
private void OnGUI() {
22+
23+
}*/
24+
[MenuItem("GameObject/Add Tag")]
25+
static void AddTag(MenuCommand menuCommand){
26+
var go = menuCommand.context as GameObject;
27+
if(go!=null)obj = go;
28+
var window = GetWindow<TagCreatorEditor>();
29+
window.titleContent = new GUIContent("TagCreator");
30+
window.maxSize = new Vector2(400,80);
31+
window.Show();
32+
}
33+
void OnGUI(){
34+
EditorGUILayout.LabelField("Select the tag type and write a name for it", EditorStyles.wordWrappedLabel);
35+
tags = (Tags)EditorGUILayout.EnumPopup("Tag Type", tags);
36+
tagName = EditorGUILayout.TextField("Tag Name", tagName);
37+
if(GUILayout.Button("Add Tag")){
38+
OnCreate();
39+
}
40+
}
41+
void OnCreate(){
42+
obj.AddComponent<Tag>().tagName = tagName;
43+
obj.GetComponent<Tag>().tagRef = tags;
44+
this.Close();
45+
}
46+
}
47+
}

Editor/TagCreatorEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/ViewCreatorEditor.cs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
using UnityEngine;
55

66

7-
namespace BigasTools{
7+
namespace BigasTools.Editor{
88
public class CreateViewEditor : EditorWindow
99
{
10-
[MenuItem("Window/BigasTools/Create View")]
10+
string viewName;
11+
bool hasModal;
12+
Object test;
13+
List<CreateViewObject> components = new List<CreateViewObject>();
14+
[MenuItem("Bigas-Tools/Create View &v")]
1115
private static void ShowWindow() {
1216
var window = GetWindow<CreateViewEditor>();
1317
window.titleContent = new GUIContent("View creator");
@@ -17,9 +21,34 @@ private static void ShowWindow() {
1721

1822
void OnGUI()
1923
{
20-
EditorGUILayout.LabelField("Test view", EditorStyles.wordWrappedLabel);
24+
EditorGUILayout.LabelField("Welcome to the view creator! Here you can create a perfect UI for your case", EditorStyles.wordWrappedLabel);
2125
GUILayout.Space(70);
22-
if (GUILayout.Button("View tester")) this.Close();
26+
viewName = EditorGUILayout.TextField("View name", viewName);
27+
hasModal = EditorGUILayout.Toggle("Has modal", hasModal);
28+
if(GUILayout.Button("Add a child")){
29+
OnComponentAdd();
30+
}
31+
foreach (var item in components)
32+
{
33+
string name = "";
34+
bool isModal = false;
35+
Object sprite = null;
36+
37+
name = EditorGUILayout.TextField("Child Name", name);
38+
isModal = EditorGUILayout.Toggle("Is Modal Object", isModal);
39+
sprite = EditorGUILayout.ObjectField("Sprite", sprite, typeof(Sprite), true);
40+
if(GUILayout.Button("Remove component")){
41+
components.Remove(item);
42+
}
43+
}
2344
}
45+
void OnComponentAdd(){
46+
var c = new CreateViewObject();
47+
components.Add(c);
48+
}
49+
}
50+
[System.Serializable]
51+
public class CreateViewObject{
52+
2453
}
2554
}

Runtime/Controllers/ResourceController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ public static ResourceController Instance{
1212
return instance;
1313
}
1414
}
15-
[SerializeField] ResourceReference[] refs;
15+
[SerializeField] ResourceReference[] refs = new ResourceReference[1]{
16+
new ResourceReference("Default", "Prefabs")
17+
};
1618
ResourceReference GetRef(string name){
1719
try
1820
{

0 commit comments

Comments
 (0)