Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexInABox committed Apr 22, 2024
1 parent cc5f52d commit 09ef668
Show file tree
Hide file tree
Showing 5 changed files with 578 additions and 616 deletions.
14 changes: 0 additions & 14 deletions CubeMosaicGenerator.cs.meta

This file was deleted.

7 changes: 3 additions & 4 deletions Geometrize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class Geometrize : MonoBehaviour
{
private static readonly HttpClient client = new HttpClient();
[HideInInspector]
public string versionString = "2.20.0"; // Current version of the software
public string versionString = "2.2"; // Current version of the software

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

Debug.Log($"Latest version from GitHub: {latestTag}");

return CompareVersions(latestTag, versionString);
}
catch (Exception ex)
Expand All @@ -60,6 +58,7 @@ private bool CompareVersions(string fetchedVersion, string currentVersion)
Debug.LogError("Failed to parse versions for comparison.");
return false;
}

// Input json file
[Header("Input")]
public TextAsset jsonFile;
Expand Down
11 changes: 0 additions & 11 deletions Misc/Scripts/CubeMosaicGeneratorEditor.cs.meta

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,82 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(CubeMosaicGenerator))]

public class CubeMosaicGeneratorEditor : Editor
{
public override void OnInspectorGUI()
{
CubeMosaicGenerator cmg = (CubeMosaicGenerator)target;

//Version info in BOLD and blue text
GUIStyle style = new GUIStyle();
style.richText = true;
style.fontStyle = FontStyle.Bold;
style.normal.textColor = Color.yellow;
GUILayout.Label("<size=20><b>Cube Mosaic Generator - v" + cmg.versionString + "</b></size>", style);

//If a new version is available, show a button to open the download page
if (cmg.newVersionAvailable)
{
if (GUILayout.Button("Download new version"))
{
Application.OpenURL("https://github.com/AlexInABox/mer-mosaic-generator/releases/latest");
}
}

DrawDefaultInspector();

//if the quality value is greater than 0.8 show a warning
if (cmg.quality >= 0.1f)
{
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);
}


if (GUILayout.Button("Generate Mosaic"))
{
cmg.GenerateMosaic();
}

if (GUILayout.Button("Clear Mosaic"))
{
cmg.removeExistingCubes();
}

//Text that shows the amount of children in the parent object
if (cmg.transform.childCount > 0)
{
if (cmg.useLightsources)
{
GUILayout.Label("Current amount of lightsources: " + cmg.transform.GetChild(0).childCount);
}
else
{
GUILayout.Label("Current amount of primitives: " + cmg.transform.childCount);
}
}

//Foldout for the advanced settings
cmg.showAdvancedSettings = EditorGUILayout.Foldout(cmg.showAdvancedSettings, "Advanced Settings");

if (cmg.showAdvancedSettings)
{
EditorGUI.indentLevel++;
//Show the advanced settings if the foldout is open
cmg.cubePrefab = (GameObject)EditorGUILayout.ObjectField("Cube Prefab", cmg.cubePrefab, typeof(GameObject), true);
cmg.useLightsources = EditorGUILayout.Toggle("Use Lightsources", cmg.useLightsources);

cmg.sameColorMargin = EditorGUILayout.Slider("Same Color Margin", cmg.sameColorMargin, 0.01f, 1f);

EditorGUI.indentLevel--;
}

if (cmg.useLightsources)
{
EditorGUILayout.HelpBox("Lightsources are still experimental and therefore might not work properly in-game!", MessageType.Error);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(PixelArt))]

public class PixelArtEditor : Editor
{
public override void OnInspectorGUI()
{
PixelArt cmg = (PixelArt)target;

//Version info in BOLD and blue text
GUIStyle style = new GUIStyle();
style.richText = true;
style.fontStyle = FontStyle.Bold;
style.normal.textColor = new Color(0.9f, 0f, 0.2f, 1f);
GUILayout.Label("<size=20><b>PixelArt - (v" + cmg.versionString + ")</b></size>", style);

DrawDefaultInspector();

//if the quality value is greater than 0.8 show a warning
if (cmg.quality >= 0.1f)
{
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);
}


if (GUILayout.Button("Generate Mosaic"))
{
cmg.GenerateMosaic();
}

if (GUILayout.Button("Clear Mosaic"))
{
cmg.removeExistingCubes();
}

//Text that shows the amount of children in the parent object
if (cmg.transform.childCount > 0)
{
if (cmg.useLightsources)
{
GUILayout.Label("Current amount of lightsources: " + cmg.transform.GetChild(0).childCount);
}
else
{
GUILayout.Label("Current amount of primitives: " + cmg.transform.childCount);
}
}

//Foldout for the advanced settings
cmg.showAdvancedSettings = EditorGUILayout.Foldout(cmg.showAdvancedSettings, "Advanced Settings");

if (cmg.showAdvancedSettings)
{
EditorGUI.indentLevel++;
//Show the advanced settings if the foldout is open
cmg.cubePrefab = (GameObject)EditorGUILayout.ObjectField("Cube Prefab", cmg.cubePrefab, typeof(GameObject), true);
cmg.useLightsources = EditorGUILayout.Toggle("Use Lightsources", cmg.useLightsources);

cmg.sameColorMargin = EditorGUILayout.Slider("Same Color Margin", cmg.sameColorMargin, 0.01f, 1f);

EditorGUI.indentLevel--;
}

if (cmg.useLightsources)
{
EditorGUILayout.HelpBox("Lightsources are still experimental and therefore might not work properly in-game!", MessageType.Error);
}
}
}
Loading

0 comments on commit 09ef668

Please sign in to comment.