Skip to content

Commit 09ef668

Browse files
committed
cleanup
1 parent cc5f52d commit 09ef668

File tree

5 files changed

+578
-616
lines changed

5 files changed

+578
-616
lines changed

CubeMosaicGenerator.cs.meta

Lines changed: 0 additions & 14 deletions
This file was deleted.

Geometrize.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ public class Geometrize : MonoBehaviour
1616
{
1717
private static readonly HttpClient client = new HttpClient();
1818
[HideInInspector]
19-
public string versionString = "2.20.0"; // Current version of the software
19+
public string versionString = "2.2"; // Current version of the software
2020

2121
public async Task<bool> newVersionAvailable()
2222
{
2323
try
2424
{
25-
string url = "https://api.github.com/repos/certbot/certbot/tags";
25+
string url = "https://api.github.com/repos/AlexInABox/mer-mosaic-generator/tags";
2626
if (!client.DefaultRequestHeaders.Contains("User-Agent"))
2727
{
2828
client.DefaultRequestHeaders.Add("User-Agent", "C# console program");
@@ -35,8 +35,6 @@ public async Task<bool> newVersionAvailable()
3535
var tags = JsonConvert.DeserializeObject<List<Tag>>(jsonResponse);
3636
string latestTag = tags[0].Name;
3737

38-
Debug.Log($"Latest version from GitHub: {latestTag}");
39-
4038
return CompareVersions(latestTag, versionString);
4139
}
4240
catch (Exception ex)
@@ -60,6 +58,7 @@ private bool CompareVersions(string fetchedVersion, string currentVersion)
6058
Debug.LogError("Failed to parse versions for comparison.");
6159
return false;
6260
}
61+
6362
// Input json file
6463
[Header("Input")]
6564
public TextAsset jsonFile;

Misc/Scripts/CubeMosaicGeneratorEditor.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 73 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,73 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
3-
using UnityEngine;
4-
using UnityEditor;
5-
6-
[CustomEditor(typeof(CubeMosaicGenerator))]
7-
8-
public class CubeMosaicGeneratorEditor : Editor
9-
{
10-
public override void OnInspectorGUI()
11-
{
12-
CubeMosaicGenerator cmg = (CubeMosaicGenerator)target;
13-
14-
//Version info in BOLD and blue text
15-
GUIStyle style = new GUIStyle();
16-
style.richText = true;
17-
style.fontStyle = FontStyle.Bold;
18-
style.normal.textColor = Color.yellow;
19-
GUILayout.Label("<size=20><b>Cube Mosaic Generator - v" + cmg.versionString + "</b></size>", style);
20-
21-
//If a new version is available, show a button to open the download page
22-
if (cmg.newVersionAvailable)
23-
{
24-
if (GUILayout.Button("Download new version"))
25-
{
26-
Application.OpenURL("https://github.com/AlexInABox/mer-mosaic-generator/releases/latest");
27-
}
28-
}
29-
30-
DrawDefaultInspector();
31-
32-
//if the quality value is greater than 0.8 show a warning
33-
if (cmg.quality >= 0.1f)
34-
{
35-
EditorGUILayout.HelpBox("A quality value of 0.1 or higher is not recommended. This will result in a very high amount of primitives. Also Unity might crash or stall!", MessageType.Warning);
36-
}
37-
38-
39-
if (GUILayout.Button("Generate Mosaic"))
40-
{
41-
cmg.GenerateMosaic();
42-
}
43-
44-
if (GUILayout.Button("Clear Mosaic"))
45-
{
46-
cmg.removeExistingCubes();
47-
}
48-
49-
//Text that shows the amount of children in the parent object
50-
if (cmg.transform.childCount > 0)
51-
{
52-
if (cmg.useLightsources)
53-
{
54-
GUILayout.Label("Current amount of lightsources: " + cmg.transform.GetChild(0).childCount);
55-
}
56-
else
57-
{
58-
GUILayout.Label("Current amount of primitives: " + cmg.transform.childCount);
59-
}
60-
}
61-
62-
//Foldout for the advanced settings
63-
cmg.showAdvancedSettings = EditorGUILayout.Foldout(cmg.showAdvancedSettings, "Advanced Settings");
64-
65-
if (cmg.showAdvancedSettings)
66-
{
67-
EditorGUI.indentLevel++;
68-
//Show the advanced settings if the foldout is open
69-
cmg.cubePrefab = (GameObject)EditorGUILayout.ObjectField("Cube Prefab", cmg.cubePrefab, typeof(GameObject), true);
70-
cmg.useLightsources = EditorGUILayout.Toggle("Use Lightsources", cmg.useLightsources);
71-
72-
cmg.sameColorMargin = EditorGUILayout.Slider("Same Color Margin", cmg.sameColorMargin, 0.01f, 1f);
73-
74-
EditorGUI.indentLevel--;
75-
}
76-
77-
if (cmg.useLightsources)
78-
{
79-
EditorGUILayout.HelpBox("Lightsources are still experimental and therefore might not work properly in-game!", MessageType.Error);
80-
}
81-
}
82-
}
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
6+
[CustomEditor(typeof(PixelArt))]
7+
8+
public class PixelArtEditor : Editor
9+
{
10+
public override void OnInspectorGUI()
11+
{
12+
PixelArt cmg = (PixelArt)target;
13+
14+
//Version info in BOLD and blue text
15+
GUIStyle style = new GUIStyle();
16+
style.richText = true;
17+
style.fontStyle = FontStyle.Bold;
18+
style.normal.textColor = new Color(0.9f, 0f, 0.2f, 1f);
19+
GUILayout.Label("<size=20><b>PixelArt - (v" + cmg.versionString + ")</b></size>", style);
20+
21+
DrawDefaultInspector();
22+
23+
//if the quality value is greater than 0.8 show a warning
24+
if (cmg.quality >= 0.1f)
25+
{
26+
EditorGUILayout.HelpBox("A quality value of 0.1 or higher is not recommended. This will result in a very high amount of primitives. Also Unity might crash or stall!", MessageType.Warning);
27+
}
28+
29+
30+
if (GUILayout.Button("Generate Mosaic"))
31+
{
32+
cmg.GenerateMosaic();
33+
}
34+
35+
if (GUILayout.Button("Clear Mosaic"))
36+
{
37+
cmg.removeExistingCubes();
38+
}
39+
40+
//Text that shows the amount of children in the parent object
41+
if (cmg.transform.childCount > 0)
42+
{
43+
if (cmg.useLightsources)
44+
{
45+
GUILayout.Label("Current amount of lightsources: " + cmg.transform.GetChild(0).childCount);
46+
}
47+
else
48+
{
49+
GUILayout.Label("Current amount of primitives: " + cmg.transform.childCount);
50+
}
51+
}
52+
53+
//Foldout for the advanced settings
54+
cmg.showAdvancedSettings = EditorGUILayout.Foldout(cmg.showAdvancedSettings, "Advanced Settings");
55+
56+
if (cmg.showAdvancedSettings)
57+
{
58+
EditorGUI.indentLevel++;
59+
//Show the advanced settings if the foldout is open
60+
cmg.cubePrefab = (GameObject)EditorGUILayout.ObjectField("Cube Prefab", cmg.cubePrefab, typeof(GameObject), true);
61+
cmg.useLightsources = EditorGUILayout.Toggle("Use Lightsources", cmg.useLightsources);
62+
63+
cmg.sameColorMargin = EditorGUILayout.Slider("Same Color Margin", cmg.sameColorMargin, 0.01f, 1f);
64+
65+
EditorGUI.indentLevel--;
66+
}
67+
68+
if (cmg.useLightsources)
69+
{
70+
EditorGUILayout.HelpBox("Lightsources are still experimental and therefore might not work properly in-game!", MessageType.Error);
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)