Skip to content

Commit 384376d

Browse files
Initial Commit
1 parent 124e955 commit 384376d

24 files changed

Lines changed: 804 additions & 0 deletions

TutorialSystem/Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System.IO;
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
public class ButtonIDGenerator : EditorWindow
6+
{
7+
private ButtonIDScriptableObject buttonIDList; // Reference to the ScriptableObject
8+
9+
[MenuItem("Tools/ButtonID Enum Generator")]
10+
public static void ShowWindow()
11+
{
12+
GetWindow<ButtonIDGenerator>("ButtonID Generator");
13+
}
14+
15+
private void OnGUI()
16+
{
17+
GUILayout.Label("Generate ButtonID Enum", EditorStyles.boldLabel);
18+
19+
buttonIDList = (ButtonIDScriptableObject)EditorGUILayout.ObjectField("Button ID List", buttonIDList, typeof(ButtonIDScriptableObject), false);
20+
21+
if (buttonIDList == null)
22+
{
23+
EditorGUILayout.HelpBox("Assign a ButtonIDList ScriptableObject.", MessageType.Warning);
24+
return;
25+
}
26+
27+
EditorGUILayout.Space();
28+
EditorGUILayout.LabelField("File Path:", EditorStyles.boldLabel);
29+
buttonIDList.saveFilePath = EditorGUILayout.TextField(buttonIDList.saveFilePath);
30+
31+
if (GUILayout.Button("Generate Enum"))
32+
{
33+
GenerateButtonEnum();
34+
}
35+
}
36+
37+
private void GenerateButtonEnum()
38+
{
39+
if (buttonIDList == null)
40+
{
41+
Debug.LogError("No ButtonIDList assigned!");
42+
return;
43+
}
44+
45+
string filePath = buttonIDList.saveFilePath;
46+
47+
if (string.IsNullOrWhiteSpace(filePath))
48+
{
49+
Debug.LogError("File path is empty! Please specify a valid path.");
50+
return;
51+
}
52+
53+
string enumContent = "public enum ButtonID {\n None,\n";
54+
55+
foreach (string name in buttonIDList.buttonNames)
56+
{
57+
if (!string.IsNullOrWhiteSpace(name))
58+
{
59+
enumContent += $" {name},\n";
60+
}
61+
}
62+
63+
enumContent += "}";
64+
65+
// Write to file
66+
File.WriteAllText(filePath, enumContent);
67+
AssetDatabase.Refresh();
68+
69+
Debug.Log("ButtonID enum generated successfully at: " + filePath);
70+
}
71+
}

TutorialSystem/Editor/ButtonIDGenerator.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System.IO;
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
public class SequenceIDGenerator : EditorWindow
6+
{
7+
private SequenceIDScriptableObject sequenceIDList; // Reference to the ScriptableObject
8+
9+
[MenuItem("Tools/SequenceID Enum Generator")]
10+
public static void ShowWindow()
11+
{
12+
GetWindow<SequenceIDGenerator>("SequenceID Generator");
13+
}
14+
15+
private void OnGUI()
16+
{
17+
GUILayout.Label("Generate SequenceID Enum", EditorStyles.boldLabel);
18+
19+
sequenceIDList = (SequenceIDScriptableObject)EditorGUILayout.ObjectField("Sequence ID List", sequenceIDList, typeof(SequenceIDScriptableObject), false);
20+
21+
if (sequenceIDList == null)
22+
{
23+
EditorGUILayout.HelpBox("Assign a SequenceIDList ScriptableObject.", MessageType.Warning);
24+
return;
25+
}
26+
27+
EditorGUILayout.Space();
28+
EditorGUILayout.LabelField("File Path:", EditorStyles.boldLabel);
29+
sequenceIDList.saveFilePath = EditorGUILayout.TextField(sequenceIDList.saveFilePath);
30+
31+
if (GUILayout.Button("Generate Enum"))
32+
{
33+
GenerateButtonEnum();
34+
}
35+
}
36+
37+
private void GenerateButtonEnum()
38+
{
39+
if (sequenceIDList == null)
40+
{
41+
Debug.LogError("No SequenceIDList assigned!");
42+
return;
43+
}
44+
45+
string filePath = sequenceIDList.saveFilePath;
46+
47+
if (string.IsNullOrWhiteSpace(filePath))
48+
{
49+
Debug.LogError("File path is empty! Please specify a valid path.");
50+
return;
51+
}
52+
53+
string enumContent = "public enum SequenceID {\n None,\n";
54+
55+
foreach (string name in sequenceIDList.sequenceNames)
56+
{
57+
if (!string.IsNullOrWhiteSpace(name))
58+
{
59+
enumContent += $" {name},\n";
60+
}
61+
}
62+
63+
enumContent += "}";
64+
65+
// Write to file
66+
File.WriteAllText(filePath, enumContent);
67+
AssetDatabase.Refresh();
68+
69+
Debug.Log("SequenceID enum generated successfully at: " + filePath);
70+
}
71+
}

TutorialSystem/Editor/SequenceIDGenerator.cs.meta

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

TutorialSystem/Enum.meta

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

TutorialSystem/Enum/ButtonID.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public enum ButtonID {
2+
None,
3+
home,
4+
pvp,
5+
leaderboard,
6+
shop,
7+
museum,
8+
playBtn,
9+
modeLeft,
10+
modeRight,
11+
quest,
12+
missions,
13+
settings,
14+
upgrade,
15+
boost,
16+
skins,
17+
orbs,
18+
rings,
19+
artifacts,
20+
symbols,
21+
masks,
22+
profile,
23+
}

TutorialSystem/Enum/ButtonID.cs.meta

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

TutorialSystem/Enum/SequenceID.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public enum SequenceID {
2+
None,
3+
seq_shop,
4+
seq_skins,
5+
seq_boosts,
6+
seq_upgrades,
7+
seq_orbs,
8+
seq_rings,
9+
seq_artifacts,
10+
seq_museum,
11+
seq_pvp,
12+
seq_leaderboard,
13+
seq_playBtn,
14+
seq_missions,
15+
seq_profile,
16+
seq_quests,
17+
}

TutorialSystem/Enum/SequenceID.cs.meta

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

0 commit comments

Comments
 (0)