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

BIN
.DS_Store vendored

Binary file not shown.

1
.gitignore vendored
View File

@@ -75,3 +75,4 @@ crashlytics-build.properties
# Ignore temporaries from GameCI
/[Aa]rtifacts/
/[Cc]odeCoverage/
.DS_Store

BIN
Assets/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -54,6 +54,8 @@ MonoBehaviour:
type: 3}
areaHint: {fileID: 7671065637303904002, guid: f4b4e87edddc74e4e8d6b9d4cc0e31fc,
type: 3}
triggerHint: {fileID: 7671065637303904002, guid: da8eca5e2d8a648e586955315c267d64,
type: 3}
bloomEffect: {fileID: 845605030242152257, guid: 1ea739ef6f1bf4e87835b0f554587451,
type: 3}
cameraShakeEffect: {fileID: 5030288017655597913, guid: 46175bea33f87445bbec1389a53da172,

View File

@@ -0,0 +1,136 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7671065637303904002
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5502985463212138770}
- component: {fileID: 2890788359140629188}
- component: {fileID: 8895664740165319164}
m_Layer: 5
m_Name: TriggerHint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5502985463212138770
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7671065637303904002}
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}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2890788359140629188
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7671065637303904002}
m_CullTransparentMesh: 1
--- !u!114 &8895664740165319164
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7671065637303904002}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Name
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 59.3
m_fontSizeBase: 14
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 12
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: da8eca5e2d8a648e586955315c267d64
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -11,7 +11,8 @@ Material:
m_Shader: {fileID: 4800000, guid: 44e8d6dab1446644688189717537509a, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_ValidKeywords:
- _EMISSION_ON
m_InvalidKeywords:
- _RECEIVE_SHADOWS_OFF
m_LightmapFlags: 4
@@ -127,7 +128,7 @@ Material:
- _DistortionStrengthScaled: 0
- _DstBlend: 0
- _DstBlendAlpha: 0
- _Emission: 0
- _Emission: 1
- _EmissionEnabled: 0
- _EnableExternalAlpha: 0
- _EnvironmentReflections: 1
@@ -164,12 +165,12 @@ Material:
- _ZWrite: 1
- _ZWriteControl: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor: {r: 1, g: 0, b: 0, a: 1}
- _BaseColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}

File diff suppressed because one or more lines are too long

View File

@@ -14322,7 +14322,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 4337614255116277774}
m_HandleRect: {fileID: 4337614255116277775}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@@ -14916,7 +14916,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 20, y: 0}
m_AnchoredPosition: {x: 20, y: 0.000030517578}
m_SizeDelta: {x: 40, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &4337614255290428457

View File

@@ -4,6 +4,7 @@ using Ichni.RhythmGame;
using Michsky.MUIP;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Serialization;
using UnityEngine.UI;
@@ -94,7 +95,23 @@ namespace Ichni.Editor
public void SelectGameElement()
{
EditorManager.instance.operationManager.SelectElement(connectedGameElement);
if (Keyboard.current.leftCtrlKey.isPressed)
{
if (!isSelected)
{
EditorManager.instance.operationManager.AddSelectElement(connectedGameElement);
}
else
{
EditorManager.instance.operationManager.RemoveSelectElement(connectedGameElement);
}
}
else
{
EditorManager.instance.operationManager.ClearSelectedElements();
EditorManager.instance.operationManager.AddSelectElement(connectedGameElement);
}
EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement);
EditorManager.instance.timeline.SetTimeLine(connectedGameElement); // TODO: Error
}

View File

@@ -39,7 +39,7 @@ namespace Ichni.Editor
{
private void GenerateSaveClipWindow()
{
GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElement;
GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElements[0];
if (currentElement == null)
{
@@ -69,7 +69,7 @@ namespace Ichni.Editor
private void GenerateLoadClipWindow()
{
GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElement;
GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElements[0];
if (currentElement == null)
{

View File

@@ -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);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fff7882e84c5b461bb7cd0a3c3657d9d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -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),
};
}
}
}

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;

View File

@@ -29,9 +29,10 @@ public class BasePrefabsCollection : SerializedScriptableObject
public AudioClip holdNoteLoopSound;
public AudioClip holdNoteEndSound;
public AudioClip flickNoteSound;
[Title("Note 判定UI")] public GameObject fullscreenNearTimeHint;
[Title("Note 判定UI")]
public GameObject fullscreenNearTimeHint;
public GameObject areaHint;
public GameObject triggerHint;
[Title("Effect相关")]
public GameObject bloomEffect;

View File

@@ -157,19 +157,37 @@ namespace Ichni.Editor
private void CopyPasteDeleteOperation()
{
if (Keyboard.current.leftCtrlKey.isPressed)
if (Keyboard.current.leftCtrlKey.isPressed) // TODO: 后续适应多选
{
if (Keyboard.current.cKey.wasPressedThisFrame) // Ctrl + C 复制
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.CopyElement(EditorManager.instance.operationManager.currentSelectedElement);
if (EditorManager.instance.operationManager.currentSelectedElements.Count != 1) // TODO: 后续适应多选
{
LogWindow.Log("Please select only one Game Element to copy.", Color.red);
return;
}
EditorManager.instance.operationManager.CopyPasteDeleteModule.CopyElement(EditorManager.instance.operationManager.currentSelectedElements[0]);
}
else if (Keyboard.current.vKey.wasPressedThisFrame) // Ctrl + V 粘贴
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.PasteElement(EditorManager.instance.operationManager.currentSelectedElement);
if (EditorManager.instance.operationManager.currentSelectedElements.Count != 1)
{
LogWindow.Log("Please select only one Game Element to paste.", Color.red);
return;
}
EditorManager.instance.operationManager.CopyPasteDeleteModule.PasteElement(EditorManager.instance.operationManager.currentSelectedElements[0]);
}
else if (Keyboard.current.dKey.wasPressedThisFrame) // Ctrl + D 删除
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(EditorManager.instance.operationManager.currentSelectedElement);
if (EditorManager.instance.operationManager.currentSelectedElements.Count != 1) // TODO: 后续适应多选,为同时选中了父物体和子物体做防呆设计
{
LogWindow.Log("Please select only one Game Element to copy.", Color.red);
return;
}
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(EditorManager.instance.operationManager.currentSelectedElements[0]);
}
}
}

View File

@@ -8,29 +8,61 @@ namespace Ichni.Editor
{
public class OperationManager
{
public GameElement currentSelectedElement { get; private set; }
public List<GameElement> currentSelectedElements { get; private set; }
public CopyPasteDeleteModule CopyPasteDeleteModule;
public FindingModule FindingModule;
public OperationManager()
{
currentSelectedElements = new List<GameElement>();
CopyPasteDeleteModule = new CopyPasteDeleteModule();
FindingModule = new FindingModule();
}
public void SelectElement(GameElement gameElement)
public void AddSelectElement(GameElement gameElement)
{
if (currentSelectedElement != null)
currentSelectedElements.Add(gameElement);
gameElement.connectedTab.isSelected = true;
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
}
public void RemoveSelectElement(GameElement gameElement)
{
currentSelectedElement.connectedTab.isSelected = false;
if (currentSelectedElement.connectedTab.BgImage != null)
currentSelectedElements.Remove(gameElement);
gameElement.connectedTab.isSelected = false;
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
}
public void ClearSelectedElements()
{
currentSelectedElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
currentSelectedElements.ForEach(gameElement =>
{
gameElement.connectedTab.isSelected = false;
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0);
});
currentSelectedElements.Clear();
}
}
currentSelectedElement = gameElement;
currentSelectedElement.connectedTab.isSelected = true;
currentSelectedElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
public class FindingModule
{
public GameElement FindGameElementByName(string elementName)
{
foreach (GameElement element in EditorManager.instance.beatmapContainer.gameElementList)
{
if (element.elementName == elementName)
{
return element;
}
}
LogWindow.Log("Element not found: " + elementName, Color.red);
return null;
}
}

View File

@@ -189,7 +189,13 @@ namespace Ichni
{
LogWindow.Log("Start Saving Clip...");
GameElement selectedElement = EditorManager.instance.operationManager.currentSelectedElement;
if (EditorManager.instance.operationManager.currentSelectedElements.Count != 1) // TODO: 后续适应多选
{
LogWindow.Log("Please select only one Game Element to save the beatmap clip.", Color.red);
return;
}
GameElement selectedElement = EditorManager.instance.operationManager.currentSelectedElements[0];
if (selectedElement is null)
{
@@ -212,7 +218,13 @@ namespace Ichni
return;
}
GameElement selectedElement = EditorManager.instance.operationManager.currentSelectedElement;
if (EditorManager.instance.operationManager.currentSelectedElements.Count != 1) // TODO: 后续适应多选
{
LogWindow.Log("Please select only one Game Element to load the beatmap clip.", Color.red);
return;
}
GameElement selectedElement = EditorManager.instance.operationManager.currentSelectedElements[0];
if (selectedElement is null)
{

View File

@@ -287,8 +287,10 @@
"__type" : "Ichni.RhythmGame.Beatmap.NoteJudgeSubmodule_BM,Assembly-CSharp",
"judgeUnitList" : [
{
"__type" : "Ichni.RhythmGame.Beatmap.TouchAreaJudgeUnit_BM,Assembly-CSharp",
"areaRadius" : 1000
"__type" : "Ichni.RhythmGame.Beatmap.TriggerConnectJudgeUnit_BM,Assembly-CSharp",
"connectedTriggerID" : {
"value" : "9152b7fd-4cb9-46c0-9033-5d821ce3fe8e"
}
}
],
"attachedElementGuid" : {
@@ -1140,6 +1142,108 @@
"attachedElementGuid" : {
"value" : "d0d1bd95-4361-42da-95a7-a7a1ae330c78"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.GameCamera_BM,Assembly-CSharp",
"cameraViewType" : 0,
"perspectiveAngle" : 60,
"orthographicSize" : 10,
"elementName" : "New Camera",
"tags" : [
],
"elementGuid" : {
"value" : "778235c0-d588-47f0-a017-1e0d15092464"
},
"attachedElementGuid" : {
"value" : "030b4b43-46bb-43c9-84e7-6a98207a39c9"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "778235c0-d588-47f0-a017-1e0d15092464"
}
},{
"__type" : "Ichni.RhythmGame.ThemeBundles.Basic.Beatmap.JudgeTrigger_BM,Assembly-CSharp",
"isStatic" : false,
"themeBundleName" : "basic",
"objectName" : "JudgeTrigger",
"elementName" : "TestTrigger",
"tags" : [
],
"elementGuid" : {
"value" : "9152b7fd-4cb9-46c0-9033-5d821ce3fe8e"
},
"attachedElementGuid" : {
"value" : "030b4b43-46bb-43c9-84e7-6a98207a39c9"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 3
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "9152b7fd-4cb9-46c0-9033-5d821ce3fe8e"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -1,
"endTime" : 0,
"attachedElementGuid" : {
"value" : "9152b7fd-4cb9-46c0-9033-5d821ce3fe8e"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.NoteJudgeTriggerSubmodule_BM,Assembly-CSharp",
"attachedElementGuid" : {
"value" : "9152b7fd-4cb9-46c0-9033-5d821ce3fe8e"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : false,
"originalEmissionColor" : {
"r" : 0,
"g" : 0,
"b" : 0,
"a" : 1
},
"originalEmissionIntensity" : 0,
"attachedElementGuid" : {
"value" : "9152b7fd-4cb9-46c0-9033-5d821ce3fe8e"
}
}
],
"attachedElementGuid" : {

View File

@@ -1,5 +1,5 @@
ManifestFileVersion: 0
CRC: 3941038012
CRC: 397764644
AssetBundleManifest:
AssetBundleInfos:
Info_0:

View File

@@ -1,15 +1,15 @@
ManifestFileVersion: 0
CRC: 573726586
CRC: 1419050323
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: bb34ed79fa83e8a7a222f718bad2bc20
Hash: 4fa493e79cb9b7a151567546c39765cb
TypeTreeHash:
serializedVersion: 2
Hash: 4b172f4c084fd18781da20e5fc19bfa6
Hash: 3351282a7c71eaafc0a1806906e9804f
IncrementalBuildHash:
serializedVersion: 2
Hash: bb34ed79fa83e8a7a222f718bad2bc20
Hash: 4fa493e79cb9b7a151567546c39765cb
HashAppended: 0
ClassTypes:
- Class: 1
@@ -28,12 +28,16 @@ ClassTypes:
Script: {instanceID: 0}
- Class: 48
Script: {instanceID: 0}
- Class: 65
Script: {instanceID: 0}
- Class: 108
Script: {instanceID: 0}
- Class: 114
Script: {fileID: 11500000, guid: 77ab80dc0820f9d4a8cd9fddbbc89057, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: b73aa7982dc9e4261b2ff45db0112d48, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: d94f163ef3d384b7eac5af0a344d786d, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: 0def5156137c6d14082064fa7b5d5247, type: 3}
- Class: 114
@@ -51,7 +55,7 @@ ClassTypes:
- Class: 114
Script: {fileID: 11500000, guid: f92b9b8f89de544adaa001ccfdf7eae4, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: d94f163ef3d384b7eac5af0a344d786d, type: 3}
Script: {fileID: 11500000, guid: 9a7a990728bad4e9ba201e72267e7eca, type: 3}
- Class: 115
Script: {instanceID: 0}
- Class: 212
@@ -88,6 +92,7 @@ Assets:
- Assets/ThemeBundles/Basic/Prefabs/Capsule.prefab
- Assets/ThemeBundles/Basic/Prefabs/Triangle2D.prefab
- Assets/ThemeBundles/Basic/Prefabs/Sphere.prefab
- Assets/ThemeBundles/Basic/Prefabs/JudgeTrigger.prefab
- Assets/ThemeBundles/Basic/Prefabs/Quad.prefab
- Assets/ThemeBundles/Basic/Prefabs/BasicNoteTap3D.prefab
- Assets/ThemeBundles/Basic/Prefabs/BasicNoteHoldStatic.prefab

Binary file not shown.

View File

@@ -0,0 +1,157 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1090389037458094011
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4203870200413301323}
- component: {fileID: 1757564759357892046}
- component: {fileID: 7968102027598966237}
- component: {fileID: 4215253012635783264}
m_Layer: 0
m_Name: JudgeTrigger
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4203870200413301323
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1090389037458094011}
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!212 &1757564759357892046
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1090389037458094011}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6,
type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &7968102027598966237
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1090389037458094011}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a7a990728bad4e9ba201e72267e7eca, type: 3}
m_Name:
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: elementGuid
Entry: 2
Data: 00000000000000000000000000000000
- Name: submoduleList
Entry: 7
Data: 0|System.Collections.Generic.List`1[[Ichni.RhythmGame.SubmoduleBase,
Assembly-CSharp]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
elementName:
tags: []
parentElement: {fileID: 0}
connectedTab: {fileID: 0}
childElementList: []
themeBundleName:
objectName:
isStatic: 0
triggerSprite: {fileID: 1757564759357892046}
triggerCollider: {fileID: 4215253012635783264}
--- !u!65 &4215253012635783264
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1090389037458094011}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 0.2}
m_Center: {x: 0, y: 0, z: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a52bcdffed3b44279bb0c8960ddc7a1d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: basic
assetBundleVariant:

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Ichni.RhythmGame.ThemeBundles.Basic
{
public class JudgeTrigger : EnvironmentObject, IHaveNoteJudgeTriggerSubmodule
{
public SpriteRenderer triggerSprite;
public Collider triggerCollider;
public NoteJudgeTriggerSubmodule noteJudgeTriggerSubmodule { get; set; }
public static JudgeTrigger GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName, bool isStatic)
{
JudgeTrigger judgeTrigger = EnvironmentObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<JudgeTrigger>();
return judgeTrigger;
}
public override void SetDefaultSubmodules()
{
base.SetDefaultSubmodules();
noteJudgeTriggerSubmodule = new NoteJudgeTriggerSubmodule(this);
}
private void Update()
{
if (EditorManager.instance.cameraManager.isSceneCameraActive)
{
return;
}
//If mouse is hovering over the object, sprite becomes red, otherwise it becomes white
triggerSprite.color = IsMouseOver() ? Color.red : Color.white;
}
private bool IsMouseOver()
{
//Raycast to check if mouse is over the object
Ray ray = EditorManager.instance.cameraManager.gameCamera.camera.ScreenPointToRay(Mouse.current.position.ReadValue());
if (Physics.Raycast(ray, out RaycastHit hit))
{
if (hit.collider == triggerCollider)
{
return true;
}
}
return false;
}
}
namespace Beatmap
{
public class JudgeTrigger_BM : EnvironmentObject_BM
{
public JudgeTrigger_BM()
{
}
public JudgeTrigger_BM(string elementName, Guid elementGuid, List<string> tags,
GameElement_BM parentElement, string themeBundleName, string objectName, bool isStatic) :
base(elementName, elementGuid, tags, parentElement, themeBundleName, objectName, isStatic)
{
}
public override void ExecuteBM()
{
matchedElement = JudgeTrigger.GenerateElement(elementName, elementGuid, tags, false,
GetElement(attachedElementGuid), themeBundleName, objectName, isStatic);
}
public override GameElement DuplicateBM(GameElement parent)
{
return JudgeTrigger.GenerateElement(elementName, Guid.NewGuid(), tags, false,
parent, themeBundleName, objectName, isStatic);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a7a990728bad4e9ba201e72267e7eca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: