chore: initialize standalone UPM package
Publish UPM package / publish (push) Failing after 1s

This commit is contained in:
2026-08-26 02:50:43 +08:00
commit 1180be88a6
72 changed files with 3331 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
using UnityEngine;
namespace ShrinkTutorial
{
public class ShrinkTutorialAnchor : MonoBehaviour
{
[SerializeField] private string anchorId = string.Empty;
public string AnchorId => anchorId;
public void SetAnchorId(string value)
{
anchorId = value ?? string.Empty;
if (isActiveAndEnabled)
ShrinkTutorialAnchorRegistry.Register(this);
}
private void OnEnable()
{
ShrinkTutorialAnchorRegistry.Register(this);
}
private void OnDisable()
{
ShrinkTutorialAnchorRegistry.Unregister(this);
}
private void OnValidate()
{
if (!Application.isPlaying)
return;
ShrinkTutorialAnchorRegistry.Register(this);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d553777c8c60c3342a2b6c6d47f9a36d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
using System.Collections.Generic;
using UnityEngine;
namespace ShrinkTutorial
{
public static class ShrinkTutorialAnchorRegistry
{
private static readonly Dictionary<string, ShrinkTutorialAnchor> Anchors = new();
public static void Register(ShrinkTutorialAnchor anchor)
{
if (!anchor || string.IsNullOrWhiteSpace(anchor.AnchorId))
return;
Anchors[anchor.AnchorId] = anchor;
}
public static void Unregister(ShrinkTutorialAnchor anchor)
{
if (!anchor || string.IsNullOrWhiteSpace(anchor.AnchorId))
return;
if (Anchors.TryGetValue(anchor.AnchorId, out var current) && current == anchor)
Anchors.Remove(anchor.AnchorId);
}
public static Transform Get(string anchorId)
{
if (string.IsNullOrWhiteSpace(anchorId))
return null;
return Anchors.TryGetValue(anchorId, out var anchor) && anchor
? anchor.transform
: null;
}
public static void Reset()
{
Anchors.Clear();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d49253f099902345bd20e381ed50127
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+49
View File
@@ -0,0 +1,49 @@
using System.Collections.Generic;
using UnityEngine;
namespace ShrinkTutorial
{
public class ShrinkTutorialTrigger : MonoBehaviour
{
private static readonly HashSet<string> FiredSessionKeys = new();
[SerializeField] private string tutorialId = string.Empty;
[SerializeField] private bool fireOnEnable = true;
[SerializeField] private bool onlyOncePerSession = true;
[SerializeField] private bool onlyIfNotCompleted = true;
private void OnEnable()
{
if (fireOnEnable)
Fire();
}
public void Fire()
{
if (string.IsNullOrWhiteSpace(tutorialId))
return;
var sessionKey = $"{gameObject.scene.path}:{gameObject.GetInstanceID()}:{tutorialId}";
if (onlyOncePerSession && !FiredSessionKeys.Add(sessionKey))
return;
var manager = ShrinkTutorialManager.Instance;
if (!manager)
{
Debug.LogWarning($"[ShrinkTutorial] 触发器 {name} 找不到 TutorialManager。");
return;
}
if (onlyIfNotCompleted && manager.HasCompleted(tutorialId))
return;
manager.StartTutorial(tutorialId);
}
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void ResetSessionState()
{
FiredSessionKeys.Clear();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13a35349f92056c4682d3355ca61f107
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: