new rating / epilogue settings look
This commit is contained in:
parent
e666bbd317
commit
2012bef87f
|
|
@ -841,33 +841,6 @@ MonoBehaviour:
|
||||||
- tag: subheader
|
- tag: subheader
|
||||||
label: Change the messages shown on the rating screen.
|
label: Change the messages shown on the rating screen.
|
||||||
isReadOnly: 0
|
isReadOnly: 0
|
||||||
- tag: resultcaption
|
- tag: resultmessagediag
|
||||||
label: Result Screen Header
|
label:
|
||||||
isReadOnly: 0
|
|
||||||
- tag: resultcommon_hi
|
|
||||||
label: Superb Message
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: resultcommon_ok
|
|
||||||
label: OK Message
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: resultcommon_ng
|
|
||||||
label: Try Again Message
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: epilogue_hi
|
|
||||||
label: Superb Epilogue Caption
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: epilogue_ok
|
|
||||||
label: OK Epilogue Caption
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: epilogue_ng
|
|
||||||
label: Try Again Epilogue Caption
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: epilogue_hi_res
|
|
||||||
label: Superb Epilogue Image
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: epilogue_ok_res
|
|
||||||
label: OK Epilogue Image
|
|
||||||
isReadOnly: 0
|
|
||||||
- tag: epilogue_ng_res
|
|
||||||
label: Try Again Epilogue Image
|
|
||||||
isReadOnly: 0
|
isReadOnly: 0
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,246 @@
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
|
using Jukebox;
|
||||||
|
using TMPro;
|
||||||
|
using SFB;
|
||||||
|
|
||||||
|
namespace HeavenStudio.Editor
|
||||||
|
{
|
||||||
|
public class RatingScreenPropertyDialog : RemixPropertyPrefab
|
||||||
|
{
|
||||||
|
enum Ranks
|
||||||
|
{
|
||||||
|
Ng,
|
||||||
|
Ok,
|
||||||
|
Hi
|
||||||
|
}
|
||||||
|
|
||||||
|
[SerializeField] TMP_InputField headerInput;
|
||||||
|
[SerializeField] TMP_InputField messageInput;
|
||||||
|
[SerializeField] TMP_InputField epilogueInput;
|
||||||
|
|
||||||
|
[SerializeField] Image imagePreview;
|
||||||
|
[SerializeField] Image rankPreview;
|
||||||
|
|
||||||
|
[SerializeField] Sprite catOff;
|
||||||
|
[SerializeField] Button[] catButtons;
|
||||||
|
[SerializeField] Sprite[] catSprites;
|
||||||
|
|
||||||
|
[SerializeField] Sprite[] rankSprites;
|
||||||
|
|
||||||
|
Sprite[] rankImages;
|
||||||
|
|
||||||
|
bool initHooks;
|
||||||
|
RemixPropertiesDialog diag;
|
||||||
|
Ranks currentEditingRank;
|
||||||
|
|
||||||
|
new public void InitProperties(RemixPropertiesDialog diag, string propertyName, string caption)
|
||||||
|
{
|
||||||
|
this.diag = diag;
|
||||||
|
currentEditingRank = Ranks.Ok;
|
||||||
|
rankImages = new Sprite[3];
|
||||||
|
diag.StartCoroutine(LoadRankImages());
|
||||||
|
UpdateInfo();
|
||||||
|
|
||||||
|
if (!initHooks)
|
||||||
|
{
|
||||||
|
initHooks = true;
|
||||||
|
headerInput.onSelect.AddListener(
|
||||||
|
_ =>
|
||||||
|
Editor.instance.editingInputField = true
|
||||||
|
);
|
||||||
|
headerInput.onValueChanged.AddListener(
|
||||||
|
_ =>
|
||||||
|
{
|
||||||
|
diag.chart["resultcaption"] = headerInput.text;
|
||||||
|
Editor.instance.editingInputField = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
epilogueInput.onSelect.AddListener(
|
||||||
|
_ =>
|
||||||
|
Editor.instance.editingInputField = true
|
||||||
|
);
|
||||||
|
epilogueInput.onValueChanged.AddListener(
|
||||||
|
_ =>
|
||||||
|
{
|
||||||
|
string propSuffix = currentEditingRank switch
|
||||||
|
{
|
||||||
|
Ranks.Ng => "ng",
|
||||||
|
Ranks.Hi => "hi",
|
||||||
|
_ => "ok",
|
||||||
|
};
|
||||||
|
diag.chart["epilogue_" + propSuffix] = epilogueInput.text;
|
||||||
|
Editor.instance.editingInputField = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
messageInput.onSelect.AddListener(
|
||||||
|
_ =>
|
||||||
|
Editor.instance.editingInputField = true
|
||||||
|
);
|
||||||
|
messageInput.onValueChanged.AddListener(DoMessageInput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateInfo()
|
||||||
|
{
|
||||||
|
headerInput.text = (string)diag.chart["resultcaption"];
|
||||||
|
imagePreview.sprite = rankImages[(int)currentEditingRank];
|
||||||
|
imagePreview.preserveAspect = true;
|
||||||
|
|
||||||
|
rankPreview.sprite = rankSprites[(int)currentEditingRank];
|
||||||
|
|
||||||
|
string propSuffix = currentEditingRank switch
|
||||||
|
{
|
||||||
|
Ranks.Ng => "ng",
|
||||||
|
Ranks.Hi => "hi",
|
||||||
|
_ => "ok",
|
||||||
|
};
|
||||||
|
epilogueInput.text = (string)diag.chart["epilogue_" + propSuffix];
|
||||||
|
|
||||||
|
//todo: check categories
|
||||||
|
messageInput.text = (string)diag.chart["resultcommon_" + propSuffix];
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoMessageInput(string _)
|
||||||
|
{
|
||||||
|
string propSuffix = currentEditingRank switch
|
||||||
|
{
|
||||||
|
Ranks.Ng => "ng",
|
||||||
|
Ranks.Hi => "hi",
|
||||||
|
_ => "ok",
|
||||||
|
};
|
||||||
|
diag.chart["resultcommon_" + propSuffix] = messageInput.text;
|
||||||
|
Editor.instance.editingInputField = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GoPrevRank()
|
||||||
|
{
|
||||||
|
currentEditingRank--;
|
||||||
|
if (currentEditingRank < 0)
|
||||||
|
currentEditingRank = Ranks.Hi;
|
||||||
|
UpdateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GoNextRank()
|
||||||
|
{
|
||||||
|
currentEditingRank++;
|
||||||
|
if (currentEditingRank > Ranks.Hi)
|
||||||
|
currentEditingRank = Ranks.Ng;
|
||||||
|
UpdateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UploadImage()
|
||||||
|
{
|
||||||
|
var extensions = new[]
|
||||||
|
{
|
||||||
|
new ExtensionFilter("Image Files", "png", "jpg", "jpeg" ),
|
||||||
|
};
|
||||||
|
|
||||||
|
StandaloneFileBrowser.OpenFilePanelAsync("Open Image", "", extensions, false, (string[] paths) =>
|
||||||
|
{
|
||||||
|
var path = Path.Combine(paths);
|
||||||
|
if (path == string.Empty)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// fetch the image using UnityWebRequest
|
||||||
|
string resource = currentEditingRank switch
|
||||||
|
{
|
||||||
|
Ranks.Ng => "Ng",
|
||||||
|
Ranks.Hi => "Hi",
|
||||||
|
_ => "Ok",
|
||||||
|
};
|
||||||
|
StartCoroutine(UploadImage(path, currentEditingRank));
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Error uploading image: {e.Message}");
|
||||||
|
GlobalGameManager.ShowErrorMessage("Error Uploading Image", e.Message + "\n\n" + e.StackTrace);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator LoadRankImages()
|
||||||
|
{
|
||||||
|
for (Ranks i = 0; i <= Ranks.Hi; i++)
|
||||||
|
{
|
||||||
|
string resource = i switch
|
||||||
|
{
|
||||||
|
Ranks.Ng => "Ng",
|
||||||
|
Ranks.Hi => "Hi",
|
||||||
|
_ => "Ok",
|
||||||
|
};
|
||||||
|
string path;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
path = RiqFileHandler.GetResourcePath(resource, "Images/Epilogue/");
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.Log($"Error loading image: {e.Message}, using fallback");
|
||||||
|
rankImages[(int)i] = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnityWebRequest www = UnityWebRequestTexture.GetTexture("file://" + path);
|
||||||
|
yield return www.SendWebRequest();
|
||||||
|
|
||||||
|
if (www.result == UnityWebRequest.Result.ConnectionError)
|
||||||
|
{
|
||||||
|
Debug.Log(www.error);
|
||||||
|
rankImages[(int)i] = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Texture2D texture = DownloadHandlerTexture.GetContent(www);
|
||||||
|
rankImages[(int)i] = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
|
||||||
|
Debug.Log("Uploaded image successfully!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imagePreview.sprite = rankImages[(int)currentEditingRank];
|
||||||
|
imagePreview.preserveAspect = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator UploadImage(string path, Ranks rank)
|
||||||
|
{
|
||||||
|
UnityWebRequest www = UnityWebRequestTexture.GetTexture("file://" + path);
|
||||||
|
yield return www.SendWebRequest();
|
||||||
|
|
||||||
|
if (www.result == UnityWebRequest.Result.ConnectionError)
|
||||||
|
{
|
||||||
|
Debug.Log(www.error);
|
||||||
|
rankImages[(int)rank] = null;
|
||||||
|
imagePreview.sprite = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Texture2D texture = DownloadHandlerTexture.GetContent(www);
|
||||||
|
rankImages[(int)rank] = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
|
||||||
|
imagePreview.sprite = rankImages[(int)rank];
|
||||||
|
imagePreview.preserveAspect = true;
|
||||||
|
|
||||||
|
string resource = rank switch
|
||||||
|
{
|
||||||
|
Ranks.Ng => "Ng",
|
||||||
|
Ranks.Hi => "Hi",
|
||||||
|
_ => "Ok",
|
||||||
|
};
|
||||||
|
|
||||||
|
RiqFileHandler.AddResource(path, resource, "Images/Epilogue/");
|
||||||
|
Debug.Log("Uploaded image successfully!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2b9ca0465f11dcf47b3e129ef391c862
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -34,6 +34,7 @@ namespace HeavenStudio.Editor
|
||||||
[SerializeField] public GameObject DividerP;
|
[SerializeField] public GameObject DividerP;
|
||||||
[SerializeField] public GameObject HeaderP;
|
[SerializeField] public GameObject HeaderP;
|
||||||
[SerializeField] public GameObject SubHeaderP;
|
[SerializeField] public GameObject SubHeaderP;
|
||||||
|
[SerializeField] public GameObject ResultDialogP;
|
||||||
|
|
||||||
[NonSerialized] public RiqBeatmap chart;
|
[NonSerialized] public RiqBeatmap chart;
|
||||||
List<GameObject> tabContents;
|
List<GameObject> tabContents;
|
||||||
|
|
@ -94,6 +95,10 @@ namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
container.AddSubHeader(this, property.label);
|
container.AddSubHeader(this, property.label);
|
||||||
}
|
}
|
||||||
|
else if (property.tag == "resultmessagediag")
|
||||||
|
{
|
||||||
|
container.AddResultMessageEditor(this);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning("Property Menu generation Warning: Property " + property.tag + " not found, skipping...");
|
Debug.LogWarning("Property Menu generation Warning: Property " + property.tag + " not found, skipping...");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using Jukebox;
|
||||||
|
|
||||||
namespace HeavenStudio.Editor
|
namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
|
|
@ -10,20 +11,6 @@ namespace HeavenStudio.Editor
|
||||||
[SerializeField] private GameObject propertyHolder;
|
[SerializeField] private GameObject propertyHolder;
|
||||||
RemixPropertiesDialog dialog;
|
RemixPropertiesDialog dialog;
|
||||||
|
|
||||||
[Header("Property Prefabs")]
|
|
||||||
[SerializeField] private GameObject IntegerP;
|
|
||||||
[SerializeField] private GameObject FloatP;
|
|
||||||
[SerializeField] private GameObject BooleanP;
|
|
||||||
[SerializeField] private GameObject DropdownP;
|
|
||||||
[SerializeField] private GameObject ColorP;
|
|
||||||
[SerializeField] private GameObject StringP;
|
|
||||||
[SerializeField] private GameObject ImageP;
|
|
||||||
|
|
||||||
[Header("Layout Prefabs")]
|
|
||||||
[SerializeField] private GameObject DividerP;
|
|
||||||
[SerializeField] private GameObject HeaderP;
|
|
||||||
[SerializeField] private GameObject SubHeaderP;
|
|
||||||
|
|
||||||
[Header("Editable Properties")]
|
[Header("Editable Properties")]
|
||||||
[SerializeField] RemixPropertiesDialog.PropertyTag[] tags;
|
[SerializeField] RemixPropertiesDialog.PropertyTag[] tags;
|
||||||
|
|
||||||
|
|
@ -124,6 +111,12 @@ namespace HeavenStudio.Editor
|
||||||
input.GetComponent<RemixPropertyPrefab>().InitProperties(diag, "", text);
|
input.GetComponent<RemixPropertyPrefab>().InitProperties(diag, "", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddResultMessageEditor(RemixPropertiesDialog diag)
|
||||||
|
{
|
||||||
|
var input = InitPrefab(diag.ResultDialogP);
|
||||||
|
input.GetComponent<RatingScreenPropertyDialog>().InitProperties(diag, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
private GameObject InitPrefab(GameObject prefab, string tooltip = "")
|
private GameObject InitPrefab(GameObject prefab, string tooltip = "")
|
||||||
{
|
{
|
||||||
GameObject input = Instantiate(prefab);
|
GameObject input = Instantiate(prefab);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ public class SectionDialog : Dialog
|
||||||
[SerializeField] Button[] catButtons;
|
[SerializeField] Button[] catButtons;
|
||||||
[SerializeField] Sprite[] catSprites;
|
[SerializeField] Sprite[] catSprites;
|
||||||
|
|
||||||
|
bool initHooks;
|
||||||
|
|
||||||
public void SwitchSectionDialog()
|
public void SwitchSectionDialog()
|
||||||
{
|
{
|
||||||
if (dialog.activeSelf)
|
if (dialog.activeSelf)
|
||||||
|
|
@ -38,6 +40,21 @@ public class SectionDialog : Dialog
|
||||||
markerWeight.maxValue = 8;
|
markerWeight.maxValue = 8;
|
||||||
markerWeight.minValue = 0;
|
markerWeight.minValue = 0;
|
||||||
markerWeight.wholeNumbers = true;
|
markerWeight.wholeNumbers = true;
|
||||||
|
|
||||||
|
if (!initHooks)
|
||||||
|
{
|
||||||
|
initHooks = true;
|
||||||
|
for (int i = 0; i < catButtons.Length; i++)
|
||||||
|
{
|
||||||
|
int cat = i;
|
||||||
|
catButtons[i].onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
if (sectionObj == null) return;
|
||||||
|
sectionObj.chartEntity["category"] = cat;
|
||||||
|
UpdateCatButtonState();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
Image,
|
Image,
|
||||||
Audio,
|
Audio,
|
||||||
MSMD
|
MSMD,
|
||||||
|
AssetBundle
|
||||||
}
|
}
|
||||||
|
|
||||||
public string path;
|
public string path;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue