Compare commits
10 Commits
d8afd31019
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
47c5ac4ab9
|
|||
|
5d4e239656
|
|||
|
649c6f41c8
|
|||
|
6b89020954
|
|||
|
7af8fe131c
|
|||
|
873e59ad2f
|
|||
|
edbb5559bf
|
|||
|
c1a22051c2
|
|||
|
e07306a26f
|
|||
|
47ace1b389
|
3
.vscode/settings.json
vendored
@@ -67,5 +67,6 @@
|
||||
"*.sln": "*.csproj",
|
||||
"*.slnx": "*.csproj"
|
||||
},
|
||||
"dotnet.defaultSolution": "Triangles.slnx"
|
||||
"dotnet.defaultSolution": "Triangles.slnx",
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
|
Before Width: | Height: | Size: 422 B After Width: | Height: | Size: 422 B |
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 388 B |
@@ -37,7 +37,7 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
@@ -46,7 +46,7 @@ TextureImporter:
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 2
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
@@ -75,7 +75,7 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
@@ -151,7 +151,7 @@ TextureImporter:
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
BIN
Assets/Resources/ActionBar/SmallArrow.png
Normal file
|
After Width: | Height: | Size: 188 B |
|
Before Width: | Height: | Size: 409 B |
4002
Assets/Scenes/CreatedLevelsMenu.unity
Normal file
7
Assets/Scenes/CreatedLevelsMenu.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1c97d15c17e24766aac3161ceb96a6a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1975
Assets/Scenes/CreatorLayerMenu.unity
Normal file
7
Assets/Scenes/CreatorLayerMenu.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de910bfbb91ce4d87b70bb986a5f3005
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13332
Assets/Scenes/EditorMenu.unity
Normal file
7
Assets/Scenes/EditorMenu.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 330d690073c8b4043a8374b53c58a659
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -605,6 +605,7 @@ GameObject:
|
||||
- component: {fileID: 322869784}
|
||||
- component: {fileID: 322869783}
|
||||
- component: {fileID: 322869782}
|
||||
- component: {fileID: 322869785}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
@@ -654,9 +655,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -714,6 +715,18 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 322869780}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &322869785
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 322869780}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 77dc06bcc97db4033b6cd70f52cf499a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::BouncyButton
|
||||
--- !u!1 &615943123
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -925,9 +938,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -985,6 +998,50 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 689023070}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &725212258
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 725212260}
|
||||
- component: {fileID: 725212259}
|
||||
m_Layer: 0
|
||||
m_Name: BazookaManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &725212259
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 725212258}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0716218eb05c948ebb11f5d96d9131ac, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::BazookaManager
|
||||
--- !u!4 &725212260
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 725212258}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &725466654
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1214,9 +1271,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -1886,9 +1943,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -1958,6 +2015,7 @@ GameObject:
|
||||
- component: {fileID: 1659033560}
|
||||
- component: {fileID: 1659033559}
|
||||
- component: {fileID: 1659033558}
|
||||
- component: {fileID: 1659033561}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
@@ -2007,9 +2065,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -2067,6 +2125,18 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1659033556}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1659033561
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1659033556}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 77dc06bcc97db4033b6cd70f52cf499a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::BouncyButton
|
||||
--- !u!1 &1667457743
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2307,6 +2377,7 @@ GameObject:
|
||||
- component: {fileID: 1894490108}
|
||||
- component: {fileID: 1894490107}
|
||||
- component: {fileID: 1894490106}
|
||||
- component: {fileID: 1894490110}
|
||||
- component: {fileID: 1894490109}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
@@ -2357,9 +2428,9 @@ MonoBehaviour:
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
@@ -2430,6 +2501,18 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::ButtonToScene
|
||||
sceneName: CreatorLayerMenu
|
||||
--- !u!114 &1894490110
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1894490104}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 77dc06bcc97db4033b6cd70f52cf499a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::BouncyButton
|
||||
--- !u!1 &2007924358
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2528,3 +2611,4 @@ SceneRoots:
|
||||
- {fileID: 1667457746}
|
||||
- {fileID: 291373823}
|
||||
- {fileID: 275857914}
|
||||
- {fileID: 725212260}
|
||||
|
||||
114
Assets/Scripts/BazookaManager.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class BazookaManager : MonoBehaviour
|
||||
{
|
||||
public static BazookaManager Instance;
|
||||
private bool firstLoadDone = false;
|
||||
public JObject saveFile = new()
|
||||
{
|
||||
["version"] = "0"
|
||||
};
|
||||
|
||||
public JObject tempData = new();
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
if (!firstLoadDone)
|
||||
{
|
||||
firstLoadDone = true;
|
||||
saveFile = Load("savefile.json");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
Save("savefile.json", saveFile);
|
||||
}
|
||||
|
||||
void OnApplicationPause(bool pause)
|
||||
{
|
||||
if (pause)
|
||||
{
|
||||
Save("savefile.json", saveFile);
|
||||
}
|
||||
}
|
||||
|
||||
public JObject Load(string pathSuffix)
|
||||
{
|
||||
string path = Path.Combine(Application.persistentDataPath, pathSuffix);
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.WriteAllText(path, "{\"version\":\"0\"}");
|
||||
return new()
|
||||
{
|
||||
["version"] = "0"
|
||||
};
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return JObject.Parse(File.ReadAllText(path));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
return new()
|
||||
{
|
||||
["version"] = "0"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void Save(string pathSuffix, JObject data)
|
||||
{
|
||||
string path = Path.Join(Application.persistentDataPath, pathSuffix);
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
|
||||
using var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
var encoded = Encoding.UTF8.GetBytes(data.ToString(Newtonsoft.Json.Formatting.None));
|
||||
fileStream.Write(encoded, 0, encoded.Length);
|
||||
fileStream.Flush(true);
|
||||
}
|
||||
|
||||
public void DeleteSave(string pathSuffix)
|
||||
{
|
||||
string path = Path.Join(Application.persistentDataPath, pathSuffix);
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
if (File.Exists(path)) File.Delete(path);
|
||||
}
|
||||
|
||||
//levels
|
||||
|
||||
public void SetCreatedLevels(JArray value)
|
||||
{
|
||||
if (saveFile["levels"] == null) saveFile["levels"] = new JObject();
|
||||
saveFile["levels"]["createdLevels"] = value;
|
||||
}
|
||||
|
||||
public JArray GetCreatedLevels()
|
||||
{
|
||||
if (saveFile["levels"] == null) return new JArray();
|
||||
if (saveFile["levels"]["createdLevels"] == null) return new JArray();
|
||||
return JArray.Parse(saveFile["levels"]["createdLevels"].ToString());
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/BazookaManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0716218eb05c948ebb11f5d96d9131ac
|
||||
98
Assets/Scripts/ColorChangeManager.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ColorChangeManager : MonoBehaviour
|
||||
{
|
||||
public static ColorChangeManager Instance;
|
||||
public TMP_InputField fadeInputField;
|
||||
public Slider fadeSlider;
|
||||
public TMP_InputField RInputBox;
|
||||
public TMP_InputField GInputBox;
|
||||
public TMP_InputField BInputBox;
|
||||
public Slider RSlider;
|
||||
public Slider GSlider;
|
||||
public Slider BSlider;
|
||||
public Image previewImage;
|
||||
private bool changedWithCode = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
fadeInputField.onValueChanged.AddListener(newValue =>
|
||||
{
|
||||
if (changedWithCode) return;
|
||||
changedWithCode = true;
|
||||
try
|
||||
{
|
||||
float floatValue = float.Parse(newValue);
|
||||
fadeSlider.value = Math.Clamp(floatValue, 0, 10);
|
||||
}
|
||||
catch
|
||||
{
|
||||
fadeInputField.text = "0";
|
||||
fadeSlider.value = 0;
|
||||
}
|
||||
changedWithCode = false;
|
||||
});
|
||||
fadeSlider.onValueChanged.AddListener(newValue =>
|
||||
{
|
||||
if (changedWithCode) return;
|
||||
changedWithCode = true;
|
||||
fadeInputField.text = MathF.Round(newValue, 2).ToString();
|
||||
changedWithCode = false;
|
||||
});
|
||||
RInputBox.onValueChanged.AddListener(newValue => UpdateBackgroundColorPreview(0));
|
||||
GInputBox.onValueChanged.AddListener(newValue => UpdateBackgroundColorPreview(0));
|
||||
BInputBox.onValueChanged.AddListener(newValue => UpdateBackgroundColorPreview(0));
|
||||
RSlider.onValueChanged.AddListener(newValue => UpdateBackgroundColorPreview(1));
|
||||
RSlider.onValueChanged.AddListener(newValue => UpdateBackgroundColorPreview(1));
|
||||
RSlider.onValueChanged.AddListener(newValue => UpdateBackgroundColorPreview(1));
|
||||
}
|
||||
|
||||
void UpdateBackgroundColorPreview(int mode)
|
||||
{
|
||||
if (changedWithCode) return;
|
||||
changedWithCode = true;
|
||||
int r_value;
|
||||
try
|
||||
{
|
||||
r_value = mode == 0 ? Math.Clamp(int.Parse(RInputBox.text), 0, 255) : (int)RSlider.value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
r_value = 0;
|
||||
}
|
||||
RInputBox.text = r_value.ToString();
|
||||
RSlider.value = r_value;
|
||||
int g_value;
|
||||
try
|
||||
{
|
||||
g_value = mode == 0 ? Math.Clamp(int.Parse(GInputBox.text), 0, 255) : (int)GSlider.value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
g_value = 0;
|
||||
}
|
||||
RInputBox.text = g_value.ToString();
|
||||
GSlider.value = g_value;
|
||||
int b_value;
|
||||
try
|
||||
{
|
||||
b_value = mode == 0 ? Math.Clamp(int.Parse(BInputBox.text), 0, 255) : (int)BSlider.value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
b_value = 0;
|
||||
}
|
||||
BInputBox.text = b_value.ToString();
|
||||
BSlider.value = b_value;
|
||||
previewImage.color = new Color(r_value / 255f, g_value / 255f, b_value / 255f);
|
||||
changedWithCode = false;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/ColorChangeManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3342d61de87b4c4da54f90f72a122cc
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01be0812e54b0499995ee27e04803c57
|
||||
guid: 6af43956258a74b8ebf6518fb1d09031
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
8
Assets/Scripts/Data/SongKeys.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
public record SongKeys
|
||||
{
|
||||
public const string SONG_1 = "TriWave";
|
||||
public const string SONG_2 = "Hex Signal";
|
||||
public const string SONG_3 = "Berry Rhythm";
|
||||
public const string SONG_4 = "Winner";
|
||||
public const string SONG_5 = "90bits";
|
||||
}
|
||||
2
Assets/Scripts/Data/SongKeys.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05f94908707e649b8a360a9f12c0b5e9
|
||||
8
Assets/Scripts/MenuScripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 913b692713cd64fce8f9ff0ba43b39cb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
171
Assets/Scripts/MenuScripts/CreatedLevelsMenu.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CreatedLevelsMenu : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button backButton;
|
||||
|
||||
[SerializeField] private GameObject defaultLayer;
|
||||
[SerializeField] private Button defaultCreateButton;
|
||||
[SerializeField] private GameObject defaultScrollContent;
|
||||
[SerializeField] private GameObject defaultSampleLevel;
|
||||
|
||||
[SerializeField] private GameObject levelLayer;
|
||||
[SerializeField] private Button levelDeleteButton;
|
||||
[SerializeField] private TMP_InputField levelNameInput;
|
||||
[SerializeField] private TMP_InputField levelDescriptionInput;
|
||||
[SerializeField] private Button levelEditLevelButton;
|
||||
[SerializeField] private Button levelPlaytestButton;
|
||||
[SerializeField] private Button levelShareButton;
|
||||
private string levelUuid;
|
||||
|
||||
void Start()
|
||||
{
|
||||
ResetLevelView();
|
||||
levelDescriptionInput.textComponent.textWrappingMode = TextWrappingModes.Normal;
|
||||
backButton.onClick.AddListener(async () =>
|
||||
{
|
||||
if (defaultLayer.activeSelf)
|
||||
{
|
||||
await SceneManager.LoadSceneAsync("CreatorLayer");
|
||||
}
|
||||
else
|
||||
{
|
||||
LeaveLevel();
|
||||
}
|
||||
});
|
||||
defaultCreateButton.onClick.AddListener(() =>
|
||||
{
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
Level newLevel = new(Guid.NewGuid().ToString(), $"Unnamed {currentLevels.Count + 1}", "", false, false, -1, new JArray(0, 0), 35f);
|
||||
currentLevels.Add(JObject.FromObject(newLevel));
|
||||
BazookaManager.Instance.SetCreatedLevels(currentLevels);
|
||||
LoadLevel(newLevel.UUID, currentLevels);
|
||||
});
|
||||
levelNameInput.onValueChanged.AddListener(newValue => TitleChangeEvent(newValue));
|
||||
levelDescriptionInput.onValueChanged.AddListener(newValue => DescriptionChangeEvent(newValue));
|
||||
levelEditLevelButton.onClick.AddListener(LaunchEditor);
|
||||
levelDeleteButton.onClick.AddListener(() =>
|
||||
{
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
var item = currentLevels.FirstOrDefault(x => x["uuid"]?.ToString() == levelUuid);
|
||||
item?.Remove();
|
||||
BazookaManager.Instance.SetCreatedLevels(currentLevels);
|
||||
BazookaManager.Instance.DeleteSave($"levels/{levelUuid}.json");
|
||||
LeaveLevel();
|
||||
});
|
||||
// if (LevelDataManager.Instance.targetSelectionUuid != null)
|
||||
// {
|
||||
// LoadLevel(LevelDataManager.Instance.targetSelectionUuid);
|
||||
// LevelDataManager.Instance.targetSelectionUuid = null;
|
||||
// }
|
||||
}
|
||||
|
||||
void LoadLevel(string targetUuid, JArray currentLevels)
|
||||
{
|
||||
List<Level> currentLevelsList = currentLevels.ToObject<List<Level>>();
|
||||
foreach (var level in currentLevelsList)
|
||||
{
|
||||
if (level.UUID == targetUuid)
|
||||
{
|
||||
levelUuid = targetUuid;
|
||||
if (level.Name != null)
|
||||
{
|
||||
levelNameInput.text = level.Name.Trim()[..Math.Min(16, level.Name.Trim().Length)];
|
||||
}
|
||||
if (level.Description != null)
|
||||
{
|
||||
levelDescriptionInput.text = level.Description.Trim()[..Math.Min(192, level.Description.Trim().Length)];
|
||||
}
|
||||
levelNameInput.interactable = !level.Uploaded;
|
||||
defaultLayer.SetActive(false);
|
||||
levelLayer.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadLevel(string targetUuid)
|
||||
{
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
LoadLevel(targetUuid, currentLevels);
|
||||
}
|
||||
|
||||
void LeaveLevel()
|
||||
{
|
||||
levelUuid = null;
|
||||
ResetLevelView();
|
||||
defaultCreateButton.transform.localScale = UnityEngine.Vector3.one;
|
||||
defaultLayer.SetActive(true);
|
||||
levelLayer.SetActive(false);
|
||||
levelNameInput.text = "";
|
||||
levelDescriptionInput.text = "";
|
||||
levelNameInput.interactable = true;
|
||||
}
|
||||
|
||||
void LaunchEditor()
|
||||
{
|
||||
BazookaManager.Instance.tempData["targetEditorUuid"] = levelUuid;
|
||||
SceneManager.LoadScene("EditorMenu");
|
||||
}
|
||||
|
||||
void TitleChangeEvent(string newValue)
|
||||
{
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
List<Level> currentLevelsList = currentLevels.ToObject<List<Level>>();
|
||||
foreach (var level in currentLevelsList)
|
||||
{
|
||||
if (level.UUID == levelUuid)
|
||||
{
|
||||
if (newValue.Trim() != "")
|
||||
{
|
||||
level.Name = newValue.Trim()[..Math.Min(16, newValue.Trim().Length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
BazookaManager.Instance.SetCreatedLevels(JArray.FromObject(currentLevelsList));
|
||||
}
|
||||
|
||||
void DescriptionChangeEvent(string newValue)
|
||||
{
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
List<Level> currentLevelsList = currentLevels.ToObject<List<Level>>();
|
||||
foreach (var level in currentLevelsList)
|
||||
{
|
||||
if (level.UUID == levelUuid)
|
||||
{
|
||||
level.Description = newValue.Trim()[..Math.Min(192, newValue.Trim().Length)];
|
||||
}
|
||||
}
|
||||
BazookaManager.Instance.SetCreatedLevels(JArray.FromObject(currentLevelsList));
|
||||
}
|
||||
|
||||
void ResetLevelView()
|
||||
{
|
||||
foreach (Transform child in defaultScrollContent.transform)
|
||||
{
|
||||
GameObject gameObject = child.gameObject;
|
||||
if (gameObject.activeSelf)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
defaultScrollContent.transform.localPosition = new(defaultScrollContent.transform.localPosition.x, 0, defaultScrollContent.transform.localPosition.z);
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
List<Level> currentLevelsList = currentLevels.ToObject<List<Level>>();
|
||||
foreach (var level in currentLevelsList)
|
||||
{
|
||||
var newObj = Instantiate(defaultSampleLevel, defaultSampleLevel.transform.parent, false);
|
||||
TMP_Text child0 = newObj.transform.GetChild(0).GetComponent<TMP_Text>();
|
||||
child0.text = level.Name.Trim()[..Math.Min(16, level.Name.Trim().Length)];
|
||||
newObj.transform.GetChild(1).GetComponent<TMP_Text>().text = level.Verified ? "Verified" : "Unverified";
|
||||
newObj.transform.GetChild(2).GetComponent<Button>().onClick.AddListener(() => LoadLevel(level.UUID));
|
||||
newObj.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/MenuScripts/CreatedLevelsMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7017553b1b7a945e1b40b48d54594ddb
|
||||
834
Assets/Scripts/MenuScripts/EditorMenu.cs
Normal file
@@ -0,0 +1,834 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.SceneManagement;
|
||||
using TMPro;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class EditorMenu : MonoBehaviour
|
||||
{
|
||||
public GameObject buildTab;
|
||||
public GameObject sampleObject;
|
||||
public int gameObjects;
|
||||
private readonly Dictionary<GameObject, int> objectMap = new();
|
||||
private GameObject selectedObj = null;
|
||||
private int selectedId = -1;
|
||||
private Vector2 pos1 = new(-5, -5);
|
||||
private Vector2 pos2 = new(2495, 495);
|
||||
private readonly HashSet<Vector2> placedPositions = new();
|
||||
public new Camera camera;
|
||||
public GameObject actionPanel;
|
||||
private const int gridSize = 10;
|
||||
bool isDragging = false;
|
||||
Vector2 pointerDownPos;
|
||||
bool pointerDown = false;
|
||||
bool dragDuringHold = false;
|
||||
bool pointerReleased = false;
|
||||
private float zoomLevel = 35f;
|
||||
private const float cameraSpeed = 0.2f;
|
||||
public GameObject editTab;
|
||||
public Button normalUpButton;
|
||||
public Button normalDownButton;
|
||||
public Button normalLeftButton;
|
||||
public Button normalRightButton;
|
||||
public Button doubleUpButton;
|
||||
public Button doubleDownButton;
|
||||
public Button doubleLeftButton;
|
||||
public Button doubleRightButton;
|
||||
private SpriteRenderer selectedObject;
|
||||
public Button deleteButton;
|
||||
public Button quickDeleteButton;
|
||||
public GameObject pausePanel;
|
||||
public Button pauseButton;
|
||||
public Button pauseResumeButton;
|
||||
public Button saveAndPlayResumeButton;
|
||||
public Button saveAndExitResumeButton;
|
||||
public Button saveResumeButton;
|
||||
public Button exitResumeButton;
|
||||
public GameObject objectContainer;
|
||||
private float prevPinchDistance = -1;
|
||||
public TMP_Text objectsText;
|
||||
public Button zoomInButton;
|
||||
public Button zoomOutButton;
|
||||
private readonly int maxObjects = 4000;
|
||||
private string levelUuid;
|
||||
private JArray backgroundColor = new(40, 125, 255);
|
||||
private JArray groundColor = new(0, 102, 255);
|
||||
private int selectedSong = 1;
|
||||
public Button editObjectButton;
|
||||
public GameObject editObjectPanel;
|
||||
public Button editObjectCloseButton;
|
||||
public ColorChangeManager editColorPanel;
|
||||
private ColorChangeManager editColorPanelClone;
|
||||
private int colorEditMode = -1;
|
||||
public GameObject levelSettingsPanel;
|
||||
public Button levelSettingsButton;
|
||||
public Button levelSettingsPanelBackgroundButton;
|
||||
public Button levelSettingsPanelGroundButton;
|
||||
public Slider levelSettingsPanelSongSlider;
|
||||
public TMP_Text levelSettingsPanelSongSliderText;
|
||||
|
||||
async void Start()
|
||||
{
|
||||
if (BazookaManager.Instance.tempData["targetEditorUuid"] == null)
|
||||
{
|
||||
await SceneManager.LoadSceneAsync("CreatedLevelsMenu");
|
||||
return;
|
||||
}
|
||||
GenerateGridLines();
|
||||
|
||||
for (int i = 0; i < gameObjects; i++)
|
||||
{
|
||||
GameObject obj = Instantiate(sampleObject, buildTab.transform);
|
||||
obj.name = i.ToString();
|
||||
obj.transform.GetChild(0).GetComponent<Image>().sprite = Resources.Load<Sprite>($"Objects/{i + 1}");
|
||||
obj.SetActive(true);
|
||||
objectMap[obj] = i;
|
||||
|
||||
if (!obj.TryGetComponent<Button>(out var btn)) btn = obj.AddComponent<Button>();
|
||||
GameObject current = obj;
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
if (selectedId == objectMap[current])
|
||||
{
|
||||
selectedId = -1;
|
||||
selectedObj = null;
|
||||
UpdateSelectionVisuals();
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedId = objectMap[current];
|
||||
selectedObj = current;
|
||||
UpdateSelectionVisuals();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
normalUpButton.onClick.AddListener(() => MoveSelectedY(1));
|
||||
normalDownButton.onClick.AddListener(() => MoveSelectedY(-1));
|
||||
normalLeftButton.onClick.AddListener(() => MoveSelectedX(-1));
|
||||
normalRightButton.onClick.AddListener(() => MoveSelectedX(1));
|
||||
doubleUpButton.onClick.AddListener(() => MoveSelectedY(10));
|
||||
doubleDownButton.onClick.AddListener(() => MoveSelectedY(-10));
|
||||
doubleLeftButton.onClick.AddListener(() => MoveSelectedX(-10));
|
||||
doubleRightButton.onClick.AddListener(() => MoveSelectedX(10));
|
||||
deleteButton.onClick.AddListener(DeleteSelectedObject);
|
||||
quickDeleteButton.onClick.AddListener(DeleteSelectedObject);
|
||||
pauseButton.onClick.AddListener(() =>
|
||||
{
|
||||
objectsText.text = $"Objects: {GetTotalObjects()}/{maxObjects}";
|
||||
pausePanel.SetActive(true);
|
||||
});
|
||||
pauseResumeButton.onClick.AddListener(() =>
|
||||
{
|
||||
pausePanel.SetActive(false);
|
||||
});
|
||||
saveAndPlayResumeButton.onClick.AddListener(async () =>
|
||||
{
|
||||
if (SaveLevel())
|
||||
{
|
||||
BazookaManager.Instance.tempData["targetEditorUuid"] = levelUuid;
|
||||
await SceneManager.LoadSceneAsync("GamePlayer");
|
||||
}
|
||||
});
|
||||
saveAndExitResumeButton.onClick.AddListener(async () =>
|
||||
{
|
||||
if (SaveLevel())
|
||||
{
|
||||
BazookaManager.Instance.tempData["targetEditorUuid"] = levelUuid;
|
||||
await SceneManager.LoadSceneAsync("CreatedLevelsMenu");
|
||||
}
|
||||
});
|
||||
saveResumeButton.onClick.AddListener(() =>
|
||||
{
|
||||
StartCoroutine(SaveButton());
|
||||
});
|
||||
exitResumeButton.onClick.AddListener(async () =>
|
||||
{
|
||||
BazookaManager.Instance.tempData["targetEditorUuid"] = levelUuid;
|
||||
await SceneManager.LoadSceneAsync("CreatedLevelsMenu");
|
||||
});
|
||||
zoomInButton.onClick.AddListener(ZoomIn);
|
||||
zoomOutButton.onClick.AddListener(ZoomOut);
|
||||
editObjectButton.onClick.AddListener(EditButtonPress);
|
||||
editObjectCloseButton.onClick.AddListener(EditCloseButtonPress);
|
||||
levelSettingsPanelSongSlider.onValueChanged.AddListener(value =>
|
||||
{
|
||||
levelSettingsPanelSongSliderText.text = value switch
|
||||
{
|
||||
1 => "1: " + SongKeys.SONG_1,
|
||||
2 => "2: " + SongKeys.SONG_2,
|
||||
3 => "3: " + SongKeys.SONG_3,
|
||||
4 => "4: " + SongKeys.SONG_4,
|
||||
5 => "5: " + SongKeys.SONG_5,
|
||||
_ => "N/A",
|
||||
};
|
||||
});
|
||||
levelSettingsButton.onClick.AddListener(() =>
|
||||
{
|
||||
levelSettingsPanelSongSlider.value = selectedSong;
|
||||
levelSettingsPanel.SetActive(true);
|
||||
editObjectPanel.SetActive(true);
|
||||
});
|
||||
levelSettingsPanelBackgroundButton.onClick.AddListener(() =>
|
||||
{
|
||||
var editColorPanelTempClone = Instantiate(editColorPanel.gameObject, editColorPanel.transform.parent);
|
||||
editColorPanelTempClone.SetActive(true);
|
||||
levelSettingsPanel.SetActive(false);
|
||||
editColorPanelClone = editColorPanelTempClone.GetComponent<ColorChangeManager>();
|
||||
colorEditMode = 0;
|
||||
editColorPanelClone.fadeInputField.transform.parent.gameObject.SetActive(false);
|
||||
editColorPanelClone.RSlider.value = int.Parse(backgroundColor[0].ToString());
|
||||
editColorPanelClone.GSlider.value = int.Parse(backgroundColor[1].ToString());
|
||||
editColorPanelClone.BSlider.value = int.Parse(backgroundColor[2].ToString());
|
||||
editColorPanelClone.previewImage.color = new Color(editColorPanelClone.RSlider.value / 255f, editColorPanelClone.GSlider.value / 255f, editColorPanelClone.BSlider.value / 255f);
|
||||
});
|
||||
levelSettingsPanelGroundButton.onClick.AddListener(() =>
|
||||
{
|
||||
var editColorPanelTempClone = Instantiate(editColorPanel.gameObject, editColorPanel.transform.parent);
|
||||
editColorPanelTempClone.SetActive(true);
|
||||
levelSettingsPanel.SetActive(false);
|
||||
editColorPanelClone = editColorPanelTempClone.GetComponent<ColorChangeManager>();
|
||||
colorEditMode = 0;
|
||||
editColorPanelClone.fadeInputField.transform.parent.gameObject.SetActive(false);
|
||||
editColorPanelClone.RSlider.value = int.Parse(groundColor[0].ToString());
|
||||
editColorPanelClone.GSlider.value = int.Parse(groundColor[1].ToString());
|
||||
editColorPanelClone.BSlider.value = int.Parse(groundColor[2].ToString());
|
||||
editColorPanelClone.previewImage.color = new Color(editColorPanelClone.RSlider.value / 255f, editColorPanelClone.GSlider.value / 255f, editColorPanelClone.BSlider.value / 255f);
|
||||
});
|
||||
|
||||
levelUuid = BazookaManager.Instance.tempData["targetEditorUuid"].ToString();
|
||||
BazookaManager.Instance.tempData.Remove("targetEditorUuid");
|
||||
JObject data = BazookaManager.Instance.Load($"levels/{levelUuid}.json");
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
List<Level> currentLevelsList = currentLevels.ToObject<List<Level>>();
|
||||
foreach (var level in currentLevelsList)
|
||||
{
|
||||
if (level.UUID == levelUuid)
|
||||
{
|
||||
if (level.EditorCameraPos != null)
|
||||
{
|
||||
camera.transform.position = new Vector3(
|
||||
float.Parse(level.EditorCameraPos[0].ToString()),
|
||||
float.Parse(level.EditorCameraPos[1].ToString()),
|
||||
-10
|
||||
);
|
||||
}
|
||||
zoomLevel = level.EditorCameraZoom;
|
||||
}
|
||||
}
|
||||
camera.orthographicSize = zoomLevel;
|
||||
|
||||
if (data["songId"] != null)
|
||||
{
|
||||
selectedSong = int.Parse(data["songId"].ToString());
|
||||
}
|
||||
if (data["backgroundColor"] != null)
|
||||
{
|
||||
backgroundColor = JArray.Parse(data["backgroundColor"].ToString());
|
||||
Camera.main.backgroundColor = new Color(
|
||||
int.Parse(backgroundColor[0].ToString()) / 255f,
|
||||
int.Parse(backgroundColor[1].ToString()) / 255f,
|
||||
int.Parse(backgroundColor[2].ToString()) / 255f
|
||||
);
|
||||
}
|
||||
if (data["groundColor"] as JArray != null)
|
||||
{
|
||||
groundColor = JArray.Parse(data["groundColor"].ToString());
|
||||
}
|
||||
if (data["data"] != null)
|
||||
{
|
||||
foreach (var objectInfo in JArray.Parse(data["data"].ToString()))
|
||||
{
|
||||
var sr = PlaceObject(
|
||||
float.Parse(objectInfo["position"][0].ToString()),
|
||||
float.Parse(objectInfo["position"][1].ToString()),
|
||||
float.Parse(objectInfo["position"][2].ToString()),
|
||||
float.Parse(objectInfo["rotation"].ToString()),
|
||||
int.Parse(objectInfo["id"].ToString())
|
||||
);
|
||||
if (objectInfo["id"].ToString() == "13" || objectInfo["id"].ToString() == "14")
|
||||
{
|
||||
if (objectInfo["colorData"] != null)
|
||||
{
|
||||
int r = int.Parse(objectInfo["colorData"][0].ToString());
|
||||
int g = int.Parse(objectInfo["colorData"][1].ToString());
|
||||
int b = int.Parse(objectInfo["colorData"][2].ToString());
|
||||
float duration = float.Parse(objectInfo["colorData"][3].ToString());
|
||||
sr.gameObject.name = $"{objectInfo["id"]}({r},{g},{b},{duration})";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSelectionVisuals()
|
||||
{
|
||||
foreach (var pair in objectMap)
|
||||
{
|
||||
Image objectImg = pair.Key.transform.GetChild(0).GetComponent<Image>();
|
||||
Image buttonImg = pair.Key.transform.GetComponent<Image>();
|
||||
objectImg.color = pair.Key == selectedObj ? new Color(1f, 1f, 1f, 0.75f) : Color.white;
|
||||
buttonImg.color = pair.Key == selectedObj ? new Color(1f, 1f, 1f, 0.75f) : Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
void UnSetSelectedObject()
|
||||
{
|
||||
if (selectedObject != null)
|
||||
{
|
||||
selectedObject.color = Color.white;
|
||||
}
|
||||
selectedObject = null;
|
||||
quickDeleteButton.interactable = false;
|
||||
editObjectButton.interactable = false;
|
||||
}
|
||||
|
||||
void SetSelectedObject(SpriteRenderer sr)
|
||||
{
|
||||
if (selectedObject != null)
|
||||
{
|
||||
selectedObject.color = Color.white;
|
||||
}
|
||||
selectedObject = sr;
|
||||
sr.color = Color.green;
|
||||
quickDeleteButton.interactable = true;
|
||||
|
||||
if (selectedObject == null) return;
|
||||
var selectedName = selectedObject.name;
|
||||
if (selectedName.StartsWith("13") || selectedName.StartsWith("14"))
|
||||
{
|
||||
editObjectButton.interactable = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteSelectedObject()
|
||||
{
|
||||
if (selectedObject == null) return;
|
||||
Destroy(selectedObject.gameObject);
|
||||
selectedObject = null;
|
||||
quickDeleteButton.interactable = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (pausePanel.activeSelf || editObjectPanel.activeSelf) return;
|
||||
HandleCameraMovement();
|
||||
HandleZoom();
|
||||
|
||||
if (buildTab.activeSelf && selectedId != -1 && !EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
Vector2 inputPos = Vector2.zero;
|
||||
bool pressed = false;
|
||||
bool held = false;
|
||||
bool released = false;
|
||||
|
||||
if (Application.isMobilePlatform && Touchscreen.current != null)
|
||||
{
|
||||
var touch = Touchscreen.current.primaryTouch;
|
||||
inputPos = touch.position.ReadValue();
|
||||
pressed = touch.press.wasPressedThisFrame;
|
||||
held = touch.press.isPressed;
|
||||
released = touch.press.wasReleasedThisFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
var mouse = Mouse.current;
|
||||
inputPos = mouse.position.ReadValue();
|
||||
pressed = mouse.leftButton.wasPressedThisFrame;
|
||||
held = mouse.leftButton.isPressed;
|
||||
released = mouse.leftButton.wasReleasedThisFrame;
|
||||
}
|
||||
|
||||
if (pressed)
|
||||
{
|
||||
pointerDown = true;
|
||||
pointerDownPos = inputPos;
|
||||
dragDuringHold = false;
|
||||
}
|
||||
|
||||
if (pointerDown && !dragDuringHold && held)
|
||||
{
|
||||
if (Vector2.Distance(pointerDownPos, inputPos) > 100f)
|
||||
dragDuringHold = true;
|
||||
}
|
||||
|
||||
if (released)
|
||||
{
|
||||
pointerReleased = true;
|
||||
pointerDown = false;
|
||||
}
|
||||
|
||||
if (pointerReleased)
|
||||
{
|
||||
pointerReleased = false;
|
||||
if (!dragDuringHold)
|
||||
{
|
||||
Vector2 mouseWorldPos = Camera.main.ScreenToWorldPoint(inputPos);
|
||||
if (mouseWorldPos.x >= pos1.x && mouseWorldPos.x <= pos2.x && mouseWorldPos.y >= pos1.y && mouseWorldPos.y <= pos2.y && Vector2.Distance(pointerDownPos, inputPos) <= 100f)
|
||||
{
|
||||
float snappedX = Mathf.Round(mouseWorldPos.x / 10f) * 10f;
|
||||
float snappedY = Mathf.Round(mouseWorldPos.y / 10f) * 10f;
|
||||
Vector2 gridPos = new(snappedX, snappedY);
|
||||
if (!placedPositions.Contains(gridPos) && GetTotalObjects() < maxObjects)
|
||||
{
|
||||
var sr = PlaceObject(snappedX, snappedY, 0, 0, selectedId + 1);
|
||||
SetSelectedObject(sr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (editTab.activeSelf && Mouse.current.leftButton.wasPressedThisFrame && !EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
Vector2 mouseWorldPos = Camera.main.ScreenToWorldPoint(Mouse.current.position.ReadValue());
|
||||
float threshold = 5f;
|
||||
|
||||
SpriteRenderer closest = null;
|
||||
float closestDist = Mathf.Infinity;
|
||||
|
||||
foreach (var obj in FindObjectsByType<SpriteRenderer>(FindObjectsSortMode.None))
|
||||
{
|
||||
if (obj.transform.parent != objectContainer.transform) continue;
|
||||
float dist = Vector2.Distance(mouseWorldPos, obj.transform.position);
|
||||
if (dist < threshold && dist < closestDist)
|
||||
{
|
||||
closestDist = dist;
|
||||
closest = obj;
|
||||
}
|
||||
}
|
||||
|
||||
if (closest != null) SetSelectedObject(closest);
|
||||
}
|
||||
if (selectedObject != null && !Application.isMobilePlatform)
|
||||
{
|
||||
if (Keyboard.current.wKey.wasPressedThisFrame)
|
||||
{
|
||||
if (Keyboard.current.leftShiftKey.isPressed)
|
||||
{
|
||||
MoveSelectedY(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveSelectedY(10);
|
||||
}
|
||||
}
|
||||
else if (Keyboard.current.aKey.wasPressedThisFrame)
|
||||
{
|
||||
if (Keyboard.current.leftShiftKey.isPressed)
|
||||
{
|
||||
MoveSelectedX(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveSelectedX(-10);
|
||||
}
|
||||
}
|
||||
else if (Keyboard.current.sKey.wasPressedThisFrame)
|
||||
{
|
||||
if (Keyboard.current.leftShiftKey.isPressed)
|
||||
{
|
||||
MoveSelectedY(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveSelectedY(-10);
|
||||
}
|
||||
}
|
||||
else if (Keyboard.current.dKey.wasPressedThisFrame)
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
var clone = Instantiate(selectedObject.gameObject, objectContainer.transform, false);
|
||||
clone.transform.position = selectedObject.gameObject.transform.position;
|
||||
var sr = clone.GetComponent<SpriteRenderer>();
|
||||
clone.name = selectedObject.gameObject.name;
|
||||
SetSelectedObject(sr);
|
||||
}
|
||||
else if (Keyboard.current.leftAltKey.isPressed)
|
||||
{
|
||||
UnSetSelectedObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Keyboard.current.leftShiftKey.isPressed)
|
||||
{
|
||||
MoveSelectedX(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveSelectedX(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Keyboard.current.eKey.wasPressedThisFrame)
|
||||
{
|
||||
var rotation = selectedObject.gameObject.transform.rotation.eulerAngles;
|
||||
rotation.z = rotation.z == 0 ? 270 : rotation.z == 270 ? 180 : rotation.z == 180 ? 90 : 0;
|
||||
selectedObject.gameObject.transform.rotation = Quaternion.Euler(rotation);
|
||||
}
|
||||
else if (Keyboard.current.qKey.wasPressedThisFrame)
|
||||
{
|
||||
var rotation = selectedObject.gameObject.transform.rotation.eulerAngles;
|
||||
rotation.z = rotation.z == 0 ? 90 : rotation.z == 90 ? 180 : rotation.z == 180 ? 270 : 0;
|
||||
selectedObject.gameObject.transform.rotation = Quaternion.Euler(rotation);
|
||||
}
|
||||
else if (Keyboard.current.deleteKey.wasPressedThisFrame)
|
||||
{
|
||||
Destroy(selectedObject.gameObject);
|
||||
UnSetSelectedObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpriteRenderer PlaceObject(float x, float y, float z, float rotation, int placeObject)
|
||||
{
|
||||
placedPositions.Add(new(x, y));
|
||||
GameObject obj = new(placeObject.ToString());
|
||||
obj.transform.parent = objectContainer.transform;
|
||||
obj.transform.position = new Vector3(x, y, z);
|
||||
obj.transform.localEulerAngles = new Vector3(0, 0, rotation);
|
||||
var sr = obj.AddComponent<SpriteRenderer>();
|
||||
sr.sprite = Resources.Load<Sprite>($"Objects/{placeObject}");
|
||||
sr.drawMode = SpriteDrawMode.Simple;
|
||||
obj.transform.localScale = new Vector3(10f / sr.sprite.bounds.size.x, 10f / sr.sprite.bounds.size.y, 1f);
|
||||
return sr;
|
||||
}
|
||||
|
||||
void HandleCameraMovement()
|
||||
{
|
||||
Vector2 inputPos = Vector2.zero;
|
||||
bool dragging = false;
|
||||
|
||||
if (Application.isMobilePlatform && Touchscreen.current != null)
|
||||
{
|
||||
if (Touchscreen.current.primaryTouch.press.isPressed)
|
||||
{
|
||||
inputPos = Touchscreen.current.primaryTouch.position.ReadValue();
|
||||
dragging = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Mouse.current.leftButton.isPressed)
|
||||
{
|
||||
inputPos = Mouse.current.position.ReadValue();
|
||||
dragging = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dragging)
|
||||
{
|
||||
var rectTransform = actionPanel.GetComponent<RectTransform>();
|
||||
Vector2 localPos = rectTransform.InverseTransformPoint(inputPos);
|
||||
if (rectTransform.rect.Contains(localPos)) return;
|
||||
|
||||
if (!pointerDown)
|
||||
{
|
||||
pointerDown = true;
|
||||
pointerDownPos = inputPos;
|
||||
dragDuringHold = false;
|
||||
}
|
||||
|
||||
if (!isDragging)
|
||||
{
|
||||
if (Vector2.Distance(inputPos, pointerDownPos) < 100) return;
|
||||
isDragging = true;
|
||||
dragDuringHold = true;
|
||||
pointerDownPos = inputPos;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 delta = inputPos - pointerDownPos;
|
||||
camera.transform.position -= (Vector3)delta * cameraSpeed;
|
||||
pointerDownPos = inputPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pointerDown)
|
||||
{
|
||||
pointerDown = false;
|
||||
isDragging = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleZoom()
|
||||
{
|
||||
if (Application.isMobilePlatform && Touchscreen.current != null)
|
||||
{
|
||||
var touches = Touchscreen.current.touches;
|
||||
if (touches.Count >= 2)
|
||||
{
|
||||
Vector2 pos1 = touches[0].position.ReadValue();
|
||||
Vector2 pos2 = touches[1].position.ReadValue();
|
||||
|
||||
if (touches[0].press.isPressed && touches[1].press.isPressed)
|
||||
{
|
||||
float currentDist = Vector2.Distance(pos1, pos2);
|
||||
if (prevPinchDistance > 0)
|
||||
{
|
||||
float diff = currentDist - prevPinchDistance;
|
||||
zoomLevel -= diff * 0.1f;
|
||||
zoomLevel = Mathf.Clamp(zoomLevel, 15f, 250f);
|
||||
camera.orthographicSize = zoomLevel;
|
||||
}
|
||||
prevPinchDistance = currentDist;
|
||||
return;
|
||||
}
|
||||
}
|
||||
prevPinchDistance = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
float scroll = Mouse.current.scroll.ReadValue().y;
|
||||
if (scroll != 0)
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
zoomLevel -= scroll * 5f;
|
||||
zoomLevel = Mathf.Clamp(zoomLevel, 15f, 250f);
|
||||
camera.orthographicSize = zoomLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
var pos = camera.transform.position;
|
||||
pos.y += scroll * 5f;
|
||||
camera.transform.position = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoomIn()
|
||||
{
|
||||
zoomLevel -= 10f;
|
||||
zoomLevel = Mathf.Clamp(zoomLevel, 15f, 250f);
|
||||
camera.orthographicSize = zoomLevel;
|
||||
}
|
||||
|
||||
void ZoomOut()
|
||||
{
|
||||
zoomLevel += 10f;
|
||||
zoomLevel = Mathf.Clamp(zoomLevel, 15f, 250f);
|
||||
camera.orthographicSize = zoomLevel;
|
||||
}
|
||||
|
||||
void GenerateGridLines()
|
||||
{
|
||||
float adjustedGridSize = gridSize;
|
||||
for (float x = pos1.x; x <= pos2.x; x += adjustedGridSize)
|
||||
DrawGridLine(new Vector3(x, pos1.y, 0), new Vector3(x, pos2.y, 0));
|
||||
for (float y = pos1.y; y <= pos2.y; y += adjustedGridSize)
|
||||
DrawGridLine(new Vector3(pos1.x, y, 0), new Vector3(pos2.x, y, 0));
|
||||
}
|
||||
|
||||
void DrawGridLine(Vector3 start, Vector3 end)
|
||||
{
|
||||
GameObject line = new("GridLine");
|
||||
LineRenderer lineRenderer = line.AddComponent<LineRenderer>();
|
||||
lineRenderer.startWidth = 0.25f;
|
||||
lineRenderer.endWidth = 0.25f;
|
||||
lineRenderer.positionCount = 2;
|
||||
lineRenderer.SetPosition(0, start);
|
||||
lineRenderer.SetPosition(1, end);
|
||||
lineRenderer.sortingOrder = -1000;
|
||||
lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
|
||||
lineRenderer.startColor = new Color(0f, 0f, 0f, 1f);
|
||||
lineRenderer.endColor = new Color(0f, 0f, 0f, 1f);
|
||||
line.transform.position = new Vector3(line.transform.position.x, line.transform.position.y, -10f);
|
||||
}
|
||||
|
||||
void MoveSelectedX(int amount)
|
||||
{
|
||||
if (selectedObject == null) return;
|
||||
var pos = selectedObject.gameObject.transform.position;
|
||||
pos.x += amount;
|
||||
selectedObject.gameObject.transform.position = ClampToBounds(pos);
|
||||
}
|
||||
|
||||
void MoveSelectedY(int amount)
|
||||
{
|
||||
if (selectedObject == null) return;
|
||||
var pos = selectedObject.gameObject.transform.position;
|
||||
pos.y += amount;
|
||||
selectedObject.gameObject.transform.position = ClampToBounds(pos);
|
||||
}
|
||||
|
||||
Vector3 ClampToBounds(Vector3 pos)
|
||||
{
|
||||
pos.x = Mathf.Clamp(pos.x, pos1.x, pos2.x);
|
||||
pos.y = Mathf.Clamp(pos.y, pos1.y, pos2.y);
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool SaveLevel()
|
||||
{
|
||||
List<GameObject> objs = new();
|
||||
foreach (Transform child in objectContainer.transform)
|
||||
{
|
||||
objs.Add(child.gameObject);
|
||||
}
|
||||
|
||||
JObject levelData = new();
|
||||
List<JObject> levelObjectsData = new();
|
||||
|
||||
foreach (GameObject obj in objs)
|
||||
{
|
||||
var id = int.Parse(obj.name.Split("(")[0]);
|
||||
var pos = obj.transform.position;
|
||||
var rot = obj.transform.rotation.eulerAngles;
|
||||
|
||||
JObject tempData = new();
|
||||
tempData["id"] = id;
|
||||
tempData["position"] = new JArray(pos.x, pos.y, pos.z);
|
||||
tempData["rotation"] = rot.z;
|
||||
if (id.ToString() == "13" || id.ToString() == "14")
|
||||
{
|
||||
tempData["colorData"] = new JArray(255, 255, 255, 0.5f);
|
||||
var match = System.Text.RegularExpressions.Regex.Match(obj.name, id.ToString() + @"\((\d+),(\d+),(\d+),([0-9.]+)\)");
|
||||
if (match.Success)
|
||||
{
|
||||
int r = int.Parse(match.Groups[1].Value);
|
||||
int g = int.Parse(match.Groups[2].Value);
|
||||
int b = int.Parse(match.Groups[3].Value);
|
||||
float duration = float.Parse(match.Groups[4].Value);
|
||||
tempData["colorData"] = new JArray(r, g, b, duration);
|
||||
}
|
||||
}
|
||||
|
||||
levelObjectsData.Add(JObject.FromObject(tempData));
|
||||
}
|
||||
|
||||
levelData["version"] = 0;
|
||||
levelData["backgroundColor"] = backgroundColor;
|
||||
levelData["groundColor"] = groundColor;
|
||||
levelData["songMode"] = 0;
|
||||
levelData["songId"] = selectedSong;
|
||||
levelData["data"] = JArray.FromObject(levelObjectsData);
|
||||
|
||||
BazookaManager.Instance.Save($"levels/{levelUuid}.json", levelData);
|
||||
|
||||
JArray currentLevels = BazookaManager.Instance.GetCreatedLevels();
|
||||
List<Level> currentLevelsList = currentLevels.ToObject<List<Level>>();
|
||||
foreach (var level in currentLevelsList)
|
||||
{
|
||||
if (level.UUID == levelUuid)
|
||||
{
|
||||
level.Verified = false;
|
||||
level.EditorCameraPos = new JArray(
|
||||
camera.transform.position.x,
|
||||
camera.transform.position.y
|
||||
);
|
||||
level.EditorCameraZoom = camera.orthographicSize;
|
||||
}
|
||||
}
|
||||
BazookaManager.Instance.SetCreatedLevels(JArray.FromObject(currentLevelsList));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int GetTotalObjects()
|
||||
{
|
||||
return objectContainer.transform.childCount;
|
||||
}
|
||||
|
||||
void EditButtonPress()
|
||||
{
|
||||
if (selectedObject == null) return;
|
||||
var selectedName = selectedObject.name;
|
||||
if (selectedName.StartsWith("13"))
|
||||
{
|
||||
var colorChangerPanel = Instantiate(editColorPanel.gameObject, editColorPanel.transform.parent).GetComponent<ColorChangeManager>();
|
||||
editColorPanelClone = colorChangerPanel;
|
||||
colorEditMode = 2;
|
||||
colorChangerPanel.gameObject.SetActive(true);
|
||||
editObjectPanel.SetActive(true);
|
||||
var match = Regex.Match(selectedName, @"13\((\d+),(\d+),(\d+),([0-9.]+)\)");
|
||||
if (match.Success)
|
||||
{
|
||||
int r = int.Parse(match.Groups[1].Value);
|
||||
int g = int.Parse(match.Groups[2].Value);
|
||||
int b = int.Parse(match.Groups[3].Value);
|
||||
float duration = float.Parse(match.Groups[4].Value);
|
||||
colorChangerPanel.RInputBox.text = r.ToString();
|
||||
colorChangerPanel.GInputBox.text = g.ToString();
|
||||
colorChangerPanel.BInputBox.text = b.ToString();
|
||||
colorChangerPanel.fadeInputField.text = duration.ToString();
|
||||
}
|
||||
}
|
||||
else if (selectedName.StartsWith("14"))
|
||||
{
|
||||
var colorChangerPanel = Instantiate(editColorPanel.gameObject, editColorPanel.transform.parent).GetComponent<ColorChangeManager>();
|
||||
editColorPanelClone = colorChangerPanel;
|
||||
colorEditMode = 3;
|
||||
colorChangerPanel.gameObject.SetActive(true);
|
||||
editObjectPanel.SetActive(true);
|
||||
var match = Regex.Match(selectedName, @"14\((\d+),(\d+),(\d+),([0-9.]+)\)");
|
||||
if (match.Success)
|
||||
{
|
||||
int r = int.Parse(match.Groups[1].Value);
|
||||
int g = int.Parse(match.Groups[2].Value);
|
||||
int b = int.Parse(match.Groups[3].Value);
|
||||
float duration = float.Parse(match.Groups[4].Value);
|
||||
colorChangerPanel.RInputBox.text = r.ToString();
|
||||
colorChangerPanel.GInputBox.text = g.ToString();
|
||||
colorChangerPanel.BInputBox.text = b.ToString();
|
||||
colorChangerPanel.fadeInputField.text = duration.ToString();
|
||||
}
|
||||
editObjectPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
void EditCloseButtonPress()
|
||||
{
|
||||
if (levelSettingsPanel.activeSelf)
|
||||
{
|
||||
editObjectPanel.SetActive(false);
|
||||
levelSettingsPanel.SetActive(false);
|
||||
selectedSong = int.Parse(levelSettingsPanelSongSlider.value.ToString());
|
||||
}
|
||||
else if (colorEditMode == 0 || colorEditMode == 1)
|
||||
{
|
||||
float r = editColorPanelClone.RSlider.value;
|
||||
float g = editColorPanelClone.GSlider.value;
|
||||
float b = editColorPanelClone.BSlider.value;
|
||||
Destroy(editColorPanelClone.gameObject);
|
||||
if (colorEditMode == 0)
|
||||
{
|
||||
backgroundColor = new(r, g, b);
|
||||
Camera.main.backgroundColor = new Color(r / 255f, g / 255f, b / 255f);
|
||||
}
|
||||
else
|
||||
{
|
||||
groundColor = new(r, g, b);
|
||||
}
|
||||
colorEditMode = -1;
|
||||
levelSettingsPanel.SetActive(true);
|
||||
}
|
||||
else if (colorEditMode == 2 || colorEditMode == 3)
|
||||
{
|
||||
if (selectedObject == null) return;
|
||||
float r = editColorPanelClone.RSlider.value;
|
||||
float g = editColorPanelClone.GSlider.value;
|
||||
float b = editColorPanelClone.BSlider.value;
|
||||
float duration = float.Parse(editColorPanelClone.fadeInputField.text);
|
||||
editObjectPanel.SetActive(false);
|
||||
Destroy(editColorPanelClone.gameObject);
|
||||
colorEditMode = -1;
|
||||
selectedObject.name = $"{selectedObject.name.Split("(")[0]}({r},{g},{b},{duration})";
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator SaveButton()
|
||||
{
|
||||
saveResumeButton.interactable = false;
|
||||
yield return new WaitForSeconds(5);
|
||||
saveResumeButton.interactable = true;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/MenuScripts/EditorMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 316e88d45dfe0400db525f48f80d4401
|
||||
8
Assets/Scripts/Types.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7419c100995e4ec98c12958d9baa25b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Assets/Scripts/Types/Level.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
public class Level
|
||||
{
|
||||
[JsonProperty("uuid")]
|
||||
public string UUID { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonProperty("verified")]
|
||||
public bool Verified { get; set; }
|
||||
|
||||
[JsonProperty("uploaded")]
|
||||
public bool Uploaded { get; set; }
|
||||
|
||||
[JsonProperty("uploadedId")]
|
||||
public BigInteger UploadedID { get; set; }
|
||||
|
||||
[JsonProperty("editorCameraPos")]
|
||||
public JArray EditorCameraPos { get; set; }
|
||||
|
||||
[JsonProperty("editorCameraZoom")]
|
||||
public float EditorCameraZoom { get; set; }
|
||||
|
||||
public Level(string uuid, string name, string description, bool verified, bool uploaded, BigInteger uploadedId, JArray editorCameraPos, float editorCameraZoom)
|
||||
{
|
||||
UUID = uuid;
|
||||
Name = name;
|
||||
Description = description;
|
||||
Verified = verified;
|
||||
Uploaded = uploaded;
|
||||
UploadedID = uploadedId;
|
||||
EditorCameraPos = editorCameraPos;
|
||||
EditorCameraZoom = editorCameraZoom;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Types/Level.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 203847ff3940241819e3f0b0cdf114f3
|
||||
@@ -13,9 +13,10 @@
|
||||
"com.unity.ide.visualstudio": "2.0.25",
|
||||
"com.unity.inputsystem": "1.17.0",
|
||||
"com.unity.multiplayer.center": "1.0.1",
|
||||
"com.unity.nuget.newtonsoft-json": "3.2.2",
|
||||
"com.unity.render-pipelines.universal": "17.3.0",
|
||||
"com.unity.test-framework": "1.6.0",
|
||||
"com.unity.timeline": "1.8.9",
|
||||
"com.unity.timeline": "1.8.10",
|
||||
"com.unity.ugui": "2.0.0",
|
||||
"com.unity.visualscripting": "1.9.9",
|
||||
"com.unity.modules.accessibility": "1.0.0",
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.burst": {
|
||||
"version": "1.8.26",
|
||||
"version": "1.8.27",
|
||||
"depth": 2,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@@ -184,6 +184,13 @@
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.nuget.newtonsoft-json": {
|
||||
"version": "3.2.2",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.render-pipelines.core": {
|
||||
"version": "17.3.0",
|
||||
"depth": 1,
|
||||
@@ -253,7 +260,7 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.timeline": {
|
||||
"version": "1.8.9",
|
||||
"version": "1.8.10",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
||||
@@ -8,6 +8,15 @@ EditorBuildSettings:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/MainMenu.unity
|
||||
guid: 6a7f2f0c3edcd4cdc93ce2d9910b1401
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/CreatedLevelsMenu.unity
|
||||
guid: f1c97d15c17e24766aac3161ceb96a6a
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/CreatorLayerMenu.unity
|
||||
guid: de910bfbb91ce4d87b70bb986a5f3005
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/EditorMenu.unity
|
||||
guid: 330d690073c8b4043a8374b53c58a659
|
||||
m_configObjects:
|
||||
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 2bcd2660ca9b64942af0de543d8d7100, type: 3}
|
||||
m_UseUCBPForAssetBundles: 0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 6000.3.1f1
|
||||
m_EditorVersionWithRevision: 6000.3.1f1 (37142da19a94)
|
||||
m_EditorVersion: 6000.3.3f1
|
||||
m_EditorVersionWithRevision: 6000.3.3f1 (ef04196de0d6)
|
||||
|
||||