JudgeTrigger

外部区域判定区
This commit is contained in:
SoulliesOfficial
2025-04-02 18:18:25 -04:00
parent e528cdea9c
commit 5c0e9c5a76
39 changed files with 818 additions and 51 deletions

View File

@@ -73,7 +73,7 @@ namespace Ichni.RhythmGame
LogWindow.Log("Game Element not found.", Color.red);
}
inspectorMain.SetInspector(EditorManager.instance.operationManager.currentSelectedElement);
inspectorMain.SetInspector(connectedGameElement);
});
string ShowConnection() => connectedGameElement == null ? "No Game Element Connected" : "Connected With: " + connectedGameElement.elementName;

View File

@@ -66,6 +66,7 @@ namespace Ichni.RhythmGame
{
{ "TouchArea", new TouchAreaJudgeUnit(note, 1000) },
{ "FullScreenNearTime", new FullScreenNearTimeJudgeUnit(note) },
{ "TriggerConnect", new TriggerConnectJudgeUnit(note, null) }
};
public NoteJudgeUnit AddJudgeUnit(string judgeUnitName)

View File

@@ -20,7 +20,7 @@ namespace Ichni.RhythmGame
this.note = note;
}
protected void SetShowingJudge(bool isShowing)
protected virtual void SetShowingJudge(bool isShowing)
{
if (isShowing)
{

View File

@@ -41,7 +41,7 @@ namespace Ichni.RhythmGame
var isShowingJudgeField = inspector.GenerateToggle(this, container, "Is Showing Judge", nameof(isShowingJudge));
isShowingJudgeField.AddListenerFunction(() => SetShowingJudge(isShowingJudge));
var effectTimeField = inspector.GenerateInputField(this, container, "Area Radius", nameof(areaRadius));
var areaRadiusField = inspector.GenerateInputField(this, container, "Area Radius", nameof(areaRadius));
var removeButton = inspector.GenerateButton(this, container, "Remove", () =>
{

View File

@@ -1,26 +1,107 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using TMPro;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class TriggerConnectJudgeUnit : NoteJudgeUnit
{
protected override GameObject GetHintImagePrefab()
public GameElement connectedJudgeTrigger;
protected override GameObject GetHintImagePrefab() => EditorManager.instance.basePrefabs.triggerHint;
public TriggerConnectJudgeUnit(NoteBase note, GameElement judgeTrigger) : base(note)
{
throw new System.NotImplementedException();
this.connectedJudgeTrigger = judgeTrigger;
}
public TriggerConnectJudgeUnit(NoteBase note) : base(note)
protected override void SetShowingJudge(bool isShowing)
{
if(connectedJudgeTrigger == null) return;
base.SetShowingJudge(isShowing);
if (judgeHintImage != null)
{
judgeHintImage.GetComponent<TMP_Text>().text = connectedJudgeTrigger.elementName;
}
}
public override void UpdateJudge()
{
if(note.isFirstJudged || connectedJudgeTrigger == null) return;
Vector2 noteScreenPosition = note.noteScreenPosition;
RectTransform canvasRect = EditorManager.instance.judgeHintCanvas.GetComponent<RectTransform>();
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, noteScreenPosition, null, out Vector2 uiPosition))
{
judgeHintImage.anchoredPosition = uiPosition;
}
}
public override void SetUpInspector()
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Trigger Connect Judge Unit");
var isShowingJudgeField = inspector.GenerateToggle(this, container, "Is Showing Judge", nameof(isShowingJudge));
isShowingJudgeField.AddListenerFunction(() => SetShowingJudge(isShowingJudge));
var triggerNameField = inspector.GenerateInputField(container, "Trigger Name");
var connectTriggerButton = inspector.GenerateButton(this, container, "Connect Trigger", () =>
{
GameElement trigger = EditorManager.instance.operationManager.FindingModule.FindGameElementByName(triggerNameField.GetValue<string>());
if (trigger is not IHaveNoteJudgeTriggerSubmodule)
{
LogWindow.Log("The element you are trying to connect is not a Note Judge Trigger.");
return;
}
connectedJudgeTrigger = trigger;
(trigger as IHaveNoteJudgeTriggerSubmodule).noteJudgeTriggerSubmodule.connectedNotes.Add(note);
});
var removeButton = inspector.GenerateButton(this, container, "Remove", () =>
{
SetShowingJudge(false);
note.noteJudgeSubmodule.judgeUnitList.Remove(this);
inspectorMain.SetInspector(note);
});
}
public override NoteJudgeUnit_BM ConvertToBM()
{
throw new System.NotImplementedException();
return new TriggerConnectJudgeUnit_BM(connectedJudgeTrigger.elementGuid);
}
}
namespace Beatmap
{
public class TriggerConnectJudgeUnit_BM : NoteJudgeUnit_BM
{
public Guid connectedTriggerID;
public TriggerConnectJudgeUnit_BM()
{
}
public TriggerConnectJudgeUnit_BM(Guid connectedTriggerID)
{
this.connectedTriggerID = connectedTriggerID;
}
public override NoteJudgeUnit ConvertToGameType(NoteBase attachedNote)
{
Debug.Log(GameElement_BM.GetElement(connectedTriggerID));
return new TriggerConnectJudgeUnit(attachedNote, GameElement_BM.GetElement(connectedTriggerID));
}
}
}
}

View File

@@ -19,7 +19,6 @@ namespace Ichni.RhythmGame
string themeBundleName, string objectName, GameElement parentElement)
{
GameObject themeBundleObject = ThemeBundleManager.instance.GetObject<GameObject>(themeBundleName, objectName);
Debug.Log(parentElement.elementName);
SubstantialObject substantialObject = Instantiate(themeBundleObject, parentElement.transform).GetComponent<SubstantialObject>();
substantialObject.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
substantialObject.themeBundleName = themeBundleName;