open properties dialog if mapper hasn't opened it prior for this chart

fix memory copy bug when making new chart
This commit is contained in:
minenice55 2023-12-16 16:05:02 -05:00
parent e0c01488e4
commit b8dc68cbae
5 changed files with 116 additions and 71 deletions

View file

@ -551,9 +551,9 @@ RectTransform:
m_Father: {fileID: 574002313} m_Father: {fileID: 574002313}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: -21} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32} m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0, y: 0.5} m_Pivot: {x: 0, y: 0.5}
--- !u!114 &9435782 --- !u!114 &9435782
@ -4384,9 +4384,9 @@ RectTransform:
m_Father: {fileID: 539838476} m_Father: {fileID: 539838476}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 32, y: -21} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32} m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 1, y: 0.5} m_Pivot: {x: 1, y: 0.5}
--- !u!114 &121871281 --- !u!114 &121871281
@ -4608,9 +4608,9 @@ RectTransform:
m_Father: {fileID: 539838476} m_Father: {fileID: 539838476}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 72, y: -21} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32} m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 1, y: 0.5} m_Pivot: {x: 1, y: 0.5}
--- !u!114 &129013734 --- !u!114 &129013734
@ -4744,9 +4744,9 @@ RectTransform:
m_Father: {fileID: 539838476} m_Father: {fileID: 539838476}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 112, y: -21} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32} m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 1, y: 0.5} m_Pivot: {x: 1, y: 0.5}
--- !u!114 &151246938 --- !u!114 &151246938
@ -36540,6 +36540,11 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
dialog: {fileID: 1336470761} dialog: {fileID: 1336470761}
tabsManager: {fileID: 1523610372} tabsManager: {fileID: 1523610372}
returnIcon: {fileID: 21300000, guid: 348825b5c77b9d143961119fc008e631, type: 3}
returnColor: {r: 1, g: 0, b: 0, a: 1}
saveIcon: {fileID: 21300000, guid: 9ae7ecf2cc001d14595ec03e1d4d86a6, type: 3}
saveColor: {r: 1, g: 1, b: 1, a: 1}
returnButtonImage: {fileID: 1089381436}
containers: containers:
- {fileID: 0} - {fileID: 0}
- {fileID: 0} - {fileID: 0}
@ -36761,9 +36766,9 @@ RectTransform:
m_Father: {fileID: 574002313} m_Father: {fileID: 574002313}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 40, y: -21} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32} m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0, y: 0.5} m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1345846031 --- !u!114 &1345846031
@ -38133,6 +38138,8 @@ MonoBehaviour:
- {fileID: 1265865542} - {fileID: 1265865542}
- {fileID: 1336470763} - {fileID: 1336470763}
- {fileID: 1946344932} - {fileID: 1946344932}
- {fileID: 992457124}
- {fileID: 1851635078}
- {fileID: 292323699} - {fileID: 292323699}
tooltipText: {fileID: 1196204504} tooltipText: {fileID: 1196204504}
fullscreen: 0 fullscreen: 0
@ -46417,9 +46424,9 @@ RectTransform:
m_Father: {fileID: 574002313} m_Father: {fileID: 574002313}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 80, y: -21} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32} m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0, y: 0.5} m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1783491359 --- !u!114 &1783491359

View file

@ -239,7 +239,7 @@ namespace HeavenStudio
Debug.Log("Creating new remix"); Debug.Log("Creating new remix");
AudioLoadDone = false; AudioLoadDone = false;
Beatmap = new("1", "HeavenStudio"); Beatmap = new("1", "HeavenStudio");
Beatmap.data.properties = Minigames.propertiesModel; Beatmap.data.properties = new(Minigames.propertiesModel);
Beatmap.AddNewTempoChange(0, 120f); Beatmap.AddNewTempoChange(0, 120f);
Beatmap.AddNewVolumeChange(0, 100f); Beatmap.AddNewVolumeChange(0, 100f);
Beatmap.data.offset = 0f; Beatmap.data.offset = 0f;

View file

@ -358,6 +358,22 @@ namespace HeavenStudio.Editor
} }
public void SaveRemix(bool saveAs = true) public void SaveRemix(bool saveAs = true)
{
Debug.Log(GameManager.instance.Beatmap["propertiesmodified"]);
if (!(bool)GameManager.instance.Beatmap["propertiesmodified"])
{
foreach (var dialog in Dialogs)
{
if (dialog.GetType() == typeof(RemixPropertiesDialog))
{
GlobalGameManager.ShowErrorMessage("Set Remix Properties", "Set remix properties before saving.");
(dialog as RemixPropertiesDialog).SwitchPropertiesDialog();
(dialog as RemixPropertiesDialog).SetSaveOnClose(true, saveAs);
return;
}
}
}
else
{ {
if (saveAs == true) if (saveAs == true)
{ {
@ -375,6 +391,7 @@ namespace HeavenStudio.Editor
} }
} }
} }
}
private void SaveRemixFilePanel() private void SaveRemixFilePanel()
{ {

View file

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using HeavenStudio.Editor.Track; using HeavenStudio.Editor.Track;
using Jukebox; using Jukebox;
using Jukebox.Legacy; using Jukebox.Legacy;
@ -14,6 +15,11 @@ namespace HeavenStudio.Editor
{ {
[Header("General References")] [Header("General References")]
[SerializeField] TabsManager tabsManager; [SerializeField] TabsManager tabsManager;
[SerializeField] Sprite returnIcon;
[SerializeField] Color returnColor;
[SerializeField] Sprite saveIcon;
[SerializeField] Color saveColor;
[SerializeField] Image returnButtonImage;
[Header("Containers")] [Header("Containers")]
[SerializeField] ChartInfoProperties[] containers; [SerializeField] ChartInfoProperties[] containers;
@ -38,6 +44,7 @@ namespace HeavenStudio.Editor
[NonSerialized] public RiqBeatmap chart; [NonSerialized] public RiqBeatmap chart;
List<GameObject> tabContents; List<GameObject> tabContents;
bool saveAfterClose = false, saveAs = false;
private void Start() { } private void Start() { }
@ -52,6 +59,11 @@ namespace HeavenStudio.Editor
tabsManager.CleanTabs(); tabsManager.CleanTabs();
tabContents = null; tabContents = null;
if (saveAfterClose)
{
Editor.instance.SaveRemix(saveAs);
}
} }
else else
{ {
@ -63,6 +75,7 @@ namespace HeavenStudio.Editor
chart = GameManager.instance.Beatmap; chart = GameManager.instance.Beatmap;
chart["propertiesmodified"] = true; chart["propertiesmodified"] = true;
SetSaveOnClose(false);
tabContents = tabsManager.GenerateTabs(tabs); tabContents = tabsManager.GenerateTabs(tabs);
foreach (var tab in tabContents) foreach (var tab in tabContents)
@ -72,6 +85,14 @@ namespace HeavenStudio.Editor
} }
} }
public void SetSaveOnClose(bool saveAfterClose, bool saveAs = false)
{
this.saveAfterClose = saveAfterClose;
this.saveAs = saveAs;
returnButtonImage.sprite = saveAfterClose ? saveIcon : returnIcon;
returnButtonImage.color = saveAfterClose ? saveColor : returnColor;
}
public void SetupDialog(PropertyTag[] tags, ChartInfoProperties container) public void SetupDialog(PropertyTag[] tags, ChartInfoProperties container)
{ {
chart = GameManager.instance.Beatmap; chart = GameManager.instance.Beatmap;

View file

@ -36,7 +36,7 @@ namespace HeavenStudio
RiqFileHandler.AudioConverter = JukeboxAudioConverter; RiqFileHandler.AudioConverter = JukeboxAudioConverter;
} }
public static Dictionary<string, object> propertiesModel = new() readonly public static Dictionary<string, object> propertiesModel = new()
{ {
// mapper set properties? (future: use this to flash the button) // mapper set properties? (future: use this to flash the button)
{"propertiesmodified", false}, {"propertiesmodified", false},
@ -91,20 +91,20 @@ namespace HeavenStudio
{"epilogue_ng_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Ng")}, // epilogue "Try Again" image resource path {"epilogue_ng_res", new EntityTypes.Resource(EntityTypes.Resource.ResourceType.Image, "Images/Epilogue/", "Ng")}, // epilogue "Try Again" image resource path
}; };
static Dictionary<string, object> tempoChangeModel = new() readonly static Dictionary<string, object> tempoChangeModel = new()
{ {
{"tempo", 120f}, {"tempo", 120f},
{"swing", 0f}, {"swing", 0f},
{"timeSignature", new Vector2(4, 4)}, {"timeSignature", new Vector2(4, 4)},
}; };
static Dictionary<string, object> volumeChangeModel = new() readonly static Dictionary<string, object> volumeChangeModel = new()
{ {
{"volume", 1f}, {"volume", 1f},
{"fade", Util.EasingFunction.Ease.Instant}, {"fade", Util.EasingFunction.Ease.Instant},
}; };
static Dictionary<string, object> sectionMarkModel = new() readonly static Dictionary<string, object> sectionMarkModel = new()
{ {
{"sectionName", ""}, {"sectionName", ""},
{"startPerfect", false}, {"startPerfect", false},