JudgeTrigger
外部区域判定区
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class NoteJudgeTriggerSubmodule : SubmoduleBase
|
||||
{
|
||||
public List<NoteBase> connectedNotes;
|
||||
|
||||
public NoteJudgeTriggerSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
connectedNotes = new List<NoteBase>();
|
||||
(attachedGameElement as IHaveNoteJudgeTriggerSubmodule).noteJudgeTriggerSubmodule = this;
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new NoteJudgeTriggerSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveNoteJudgeTriggerSubmodule
|
||||
{
|
||||
public NoteJudgeTriggerSubmodule noteJudgeTriggerSubmodule { get; set; }
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class NoteJudgeTriggerSubmodule_BM : Submodule_BM
|
||||
{
|
||||
public NoteJudgeTriggerSubmodule_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public NoteJudgeTriggerSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveNoteJudgeTriggerSubmodule).noteJudgeTriggerSubmodule = new NoteJudgeTriggerSubmodule(attachedElement);
|
||||
|
||||
}
|
||||
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as IHaveNoteJudgeTriggerSubmodule).noteJudgeTriggerSubmodule = new NoteJudgeTriggerSubmodule(attached);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fff7882e84c5b461bb7cd0a3c3657d9d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -91,7 +91,6 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Time Duration");
|
||||
var overrideToggle = inspector.GenerateToggle(this, container, "Override Duration", nameof(isOverridingDuration));
|
||||
@@ -108,8 +107,6 @@ namespace Ichni.RhythmGame
|
||||
SetInputFieldInteractable(isOverridingDuration);
|
||||
overrideToggle.AddListenerFunction(() => SetInputFieldInteractable(isOverridingDuration));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface IHaveTimeDurationSubmodule
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
@@ -33,7 +34,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BeatmapContainer_BM : BaseElement_BM
|
||||
public partial class BeatmapContainer_BM : BaseElement_BM
|
||||
{
|
||||
public List<BaseElement_BM> elementList;
|
||||
|
||||
@@ -66,6 +67,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
elementList.ForEach(element =>
|
||||
{
|
||||
if (LowLoadPriorityTypes.Contains(element.GetType()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (element is GameElement_BM gameElement)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
@@ -76,7 +82,23 @@ namespace Ichni.RhythmGame
|
||||
|
||||
element.ExecuteBM();
|
||||
});
|
||||
|
||||
elementList.ForEach(element =>
|
||||
{
|
||||
if (LowLoadPriorityTypes.Contains(element.GetType()))
|
||||
{
|
||||
element.ExecuteBM();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BeatmapContainer_BM : BaseElement_BM
|
||||
{
|
||||
private static readonly List<Type> LowLoadPriorityTypes = new()
|
||||
{
|
||||
typeof(NoteJudgeSubmodule_BM),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Ichni.RhythmGame
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
protected void SetShowingJudge(bool isShowing)
|
||||
protected virtual void SetShowingJudge(bool isShowing)
|
||||
{
|
||||
if (isShowing)
|
||||
{
|
||||
|
||||
@@ -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", () =>
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user