Skip to content

Commit 6936eba

Browse files
committed
Community feedback toggle
1 parent aad23a2 commit 6936eba

File tree

3 files changed

+68
-56
lines changed

3 files changed

+68
-56
lines changed

Editor/BuildManager/BuildPipeline/BuildManager.cs

+1-51
Original file line numberDiff line numberDiff line change
@@ -104,57 +104,7 @@ static void PostBuild(BuildSequence sequence) {
104104
bool isAnyReleaseBuild = false;
105105

106106
if (isNeedChangelogFile) {
107-
StringBuilder sb = new StringBuilder();
108-
109-
ChangelogData.ChangelogEntryType lastType;
110-
ChangelogData.ChangelogEntryScope lastScope;
111-
112-
113-
for (int i = usedChangelog.versions.Count - 1; i >= 0; --i) {
114-
lastType = (ChangelogData.ChangelogEntryType)255;
115-
lastScope = (ChangelogData.ChangelogEntryScope)255;
116-
ChangelogData.ChangelogVersionEntry version = usedChangelog.versions[i];
117-
118-
if(i != usedChangelog.versions.Count - 1) {
119-
sb.Append("---------- \n");
120-
121-
}
122-
sb.Append("# ");
123-
sb.Append(version.GetVersionHeader());
124-
sb.Append("\n");
125-
126-
sb.Append(version.descriptionText);
127-
sb.Append("\n\n");
128-
129-
for (int j = 0; j < version.notes.Count; ++j) {
130-
ChangelogData.ChangelogNoteEntry note = version.notes[j];
131-
132-
if(lastType != note.type) {
133-
if(lastType != (ChangelogData.ChangelogEntryType)255)
134-
sb.Append("\n");
135-
lastType = note.type;
136-
lastScope = (ChangelogData.ChangelogEntryScope)255;
137-
sb.Append("## ");
138-
sb.Append(note.type);
139-
sb.Append(": \n");
140-
}
141-
142-
if (lastScope != note.scope) {
143-
lastScope = note.scope;
144-
sb.Append("### ");
145-
sb.Append(note.scope);
146-
sb.Append(": \n");
147-
}
148-
149-
sb.Append(" * ");
150-
sb.Append(note.text);
151-
sb.Append("\n");
152-
}
153-
154-
sb.Append("\n");
155-
}
156-
157-
changelogContent = sb.ToString();
107+
changelogContent = usedChangelog.GetChangelogString();
158108
}
159109

160110
for (byte i = 0; i < sequence.builds.Count; ++i) {

Editor/Changelog/ChangelogData.cs

+60
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text;
23
using System.Collections;
34
using System.Collections.Generic;
45
using System.IO;
@@ -17,6 +18,64 @@ public ChangelogVersionEntry GetLastVersion() {
1718
return versions[versions.Count - 1];
1819
}
1920

21+
public string GetChangelogString() {
22+
StringBuilder sb = new StringBuilder();
23+
24+
ChangelogEntryType lastType;
25+
ChangelogEntryScope lastScope;
26+
27+
sb.Append("Note: 📢 indicates a change inspired by community feedback!\n");
28+
sb.Append("---------- \n");
29+
30+
for (int i = versions.Count - 1; i >= 0; --i) {
31+
lastType = (ChangelogEntryType)255;
32+
lastScope = (ChangelogEntryScope)255;
33+
ChangelogVersionEntry version = versions[i];
34+
35+
if (i != versions.Count - 1) {
36+
sb.Append("---------- \n");
37+
38+
}
39+
sb.Append("# ");
40+
sb.Append(version.GetVersionHeader());
41+
sb.Append("\n");
42+
43+
sb.Append(version.descriptionText);
44+
sb.Append("\n\n");
45+
46+
for (int j = 0; j < version.notes.Count; ++j) {
47+
ChangelogNoteEntry note = version.notes[j];
48+
49+
if (lastType != note.type) {
50+
if (lastType != (ChangelogEntryType)255)
51+
sb.Append("\n");
52+
lastType = note.type;
53+
lastScope = (ChangelogEntryScope)255;
54+
sb.Append("## ");
55+
sb.Append(note.type);
56+
sb.Append(": \n");
57+
}
58+
59+
if (lastScope != note.scope) {
60+
lastScope = note.scope;
61+
sb.Append("### ");
62+
sb.Append(note.scope);
63+
sb.Append(": \n");
64+
}
65+
66+
sb.Append(" * ");
67+
if(note.isCommunityFeedback)
68+
sb.Append("📢 ");
69+
sb.Append(note.text);
70+
sb.Append("\n");
71+
}
72+
73+
sb.Append("\n");
74+
}
75+
76+
return sb.ToString();
77+
}
78+
2079
#region Serialization
2180
const string SAVE_FILE_NOREZ = "ChangelogSettings";
2281
const string SAVE_FILE = "ChangelogSettings.json";
@@ -95,6 +154,7 @@ public string GetVersionHeader() {
95154

96155
[Serializable]
97156
public class ChangelogNoteEntry {
157+
public bool isCommunityFeedback = false;
98158
public ChangelogEntryType type;
99159
public ChangelogEntryScope scope;
100160
public string text;

Editor/Window/BuildManagerWindow.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,20 @@ void DrawChangelogInfo() {
186186

187187
++EditorGUI.indentLevel;
188188
EditorGUILayout.BeginHorizontal();
189-
EditorGUILayout.LabelField("Type", GUILayout.Width(200));
190-
EditorGUILayout.LabelField("Scope", GUILayout.Width(200));
189+
EditorGUILayout.LabelField("Type", GUILayout.Width(150));
190+
EditorGUILayout.LabelField("Scope", GUILayout.Width(125));
191+
EditorGUILayout.LabelField("Community", GUILayout.Width(100));
191192
EditorGUILayout.LabelField("Description");
192193
EditorGUILayout.EndHorizontal();
193194

194195
for (int j = 0; j < version.notes.Count; ++j) {
195196
ChangelogData.ChangelogNoteEntry note = version.notes[j];
196197
EditorGUILayout.BeginHorizontal();
197198

198-
ChangelogData.ChangelogEntryType newType = (ChangelogData.ChangelogEntryType)EditorGUILayout.EnumPopup("", note.type, GUILayout.Width(200));
199-
ChangelogData.ChangelogEntryScope newScope = (ChangelogData.ChangelogEntryScope)EditorGUILayout.EnumPopup("", note.scope, GUILayout.Width(200));
200-
note.text = EditorGUILayout.TextField("", note.text);
199+
ChangelogData.ChangelogEntryType newType = (ChangelogData.ChangelogEntryType)EditorGUILayout.EnumPopup(note.type, GUILayout.Width(150));
200+
ChangelogData.ChangelogEntryScope newScope = (ChangelogData.ChangelogEntryScope)EditorGUILayout.EnumPopup(note.scope, GUILayout.Width(150));
201+
note.isCommunityFeedback = EditorGUILayout.Toggle(note.isCommunityFeedback, GUILayout.Width(70));
202+
note.text = EditorGUILayout.TextField(note.text);
201203

202204
if (note.type != newType || note.scope != newScope) {
203205
note.type = newType;

0 commit comments

Comments
 (0)