定义 Game Core P0 共享契约

This commit is contained in:
JSD\13999
2026-05-15 15:57:30 +08:00
parent 76c35d8d99
commit 49318c50a4
45 changed files with 527 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6f15a20a42b04f9a86de633ca4831e25
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: faa0e59581ea46ed8994f743336decdc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
namespace FlowScope.Audio
{
public interface IAudioHandle
{
void Stop(float fadeOut = 0f);
bool IsPlaying { get; }
}
}

View File

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

View File

@@ -0,0 +1,12 @@
namespace FlowScope.Audio
{
public interface IAudioService
{
IAudioHandle PlayBgm(string key, bool loop = true, float fadeIn = 0f);
IAudioHandle PlaySfx(string key);
void StopBgm(float fadeOut = 0f);
void SetBgmVolume(float volume);
void SetSfxVolume(float volume);
void SetMute(bool mute);
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 76e811c4a8bd4f6497926d5befb64b83
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
using System.Collections.Generic;
namespace FlowScope.Common
{
public sealed class ResultLog
{
private readonly List<string> _warnings = new();
private readonly List<string> _errors = new();
public IReadOnlyList<string> Warnings => _warnings;
public IReadOnlyList<string> Errors => _errors;
public bool HasErrors => _errors.Count > 0;
public void AddWarning(string message) => _warnings.Add(message);
public void AddError(string message) => _errors.Add(message);
public void Clear()
{
_warnings.Clear();
_errors.Clear();
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2f421e0a585f4a279d8db9410eb82711
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace FlowScope.Config
{
public interface IConfigProvider
{
Task LoadAllAsync(CancellationToken cancellationToken);
T Get<T>(int id) where T : class, IConfigRow;
IReadOnlyList<T> GetAll<T>() where T : class, IConfigRow;
}
}

View File

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

View File

@@ -0,0 +1,7 @@
namespace FlowScope.Config
{
public interface IConfigRow
{
int Id { get; }
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d24db89928e4010a3c1af79ffb15709
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
using System;
namespace FlowScope.Container
{
public sealed class Container : IDisposable
{
public void RegisterInstance<T>(T instance) => throw new NotImplementedException();
public void RegisterFactory<T>(Func<Container, T> factory) => throw new NotImplementedException();
public void RegisterType<TInterface, TImplementation>() where TImplementation : TInterface => throw new NotImplementedException();
public void RegisterType<TImplementation>() => throw new NotImplementedException();
public void RegisterAssembly() => throw new NotImplementedException();
public T Resolve<T>() => throw new NotImplementedException();
public bool TryResolve<T>(out T value)
{
value = default;
throw new NotImplementedException();
}
public Container CreateScope() => throw new NotImplementedException();
public void Dispose() => throw new NotImplementedException();
}
}

View File

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

View File

@@ -0,0 +1,9 @@
using System;
namespace FlowScope.Container
{
[AttributeUsage(AttributeTargets.Class)]
public sealed class InjectableAttribute : Attribute
{
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 87d135bef01743c29768ef28ce8acf69
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
using System.Threading;
using FlowScope.Resources;
using R3;
using ContainerType = FlowScope.Container.Container;
namespace FlowScope.Flow
{
public sealed class FeatureContext
{
public FeatureContext(
ContainerType scope,
IResourceGroup resources,
CompositeDisposable disposables,
CancellationToken cancellationToken)
{
Scope = scope;
Resources = resources;
Disposables = disposables;
CancellationToken = cancellationToken;
}
public ContainerType Scope { get; }
public IResourceGroup Resources { get; }
public CompositeDisposable Disposables { get; }
public CancellationToken CancellationToken { get; }
}
}

View File

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

View File

@@ -0,0 +1,13 @@
namespace FlowScope.Flow
{
public enum GameFlowState
{
Idle,
Starting,
Running,
Switching,
NoActiveFeature,
ShuttingDown,
Disposed
}
}

View File

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

View File

@@ -0,0 +1,12 @@
using System;
using System.Threading.Tasks;
namespace FlowScope.Flow
{
public interface IFeature : IDisposable
{
Task LoadAsync(FeatureContext context);
Task EnterAsync(FeatureContext context);
Task ExitAsync(FeatureContext context);
}
}

View File

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

View File

@@ -0,0 +1,14 @@
{
"name": "FlowScope.Runtime",
"rootNamespace": "FlowScope",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4f077ee742b346a188dc0c93b419f3ee
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2a7d670c048e4930b0a0980773a6210b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
using System;
namespace FlowScope.Resources
{
public interface IResourceGroup : IDisposable
{
void Add<T>(IResourceHandle<T> handle) where T : class;
int Count { get; }
}
}

View File

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

View File

@@ -0,0 +1,11 @@
using System;
namespace FlowScope.Resources
{
public interface IResourceHandle<T> : IDisposable where T : class
{
string Key { get; }
T Asset { get; }
bool IsDisposed { get; }
}
}

View File

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

View File

@@ -0,0 +1,15 @@
using System.Threading;
using System.Threading.Tasks;
namespace FlowScope.Resources
{
public interface IResourceService
{
Task<IResourceHandle<T>> LoadAsync<T>(
string key,
CancellationToken cancellationToken)
where T : class;
IResourceGroup CreateGroup();
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aade8defc2324dde8776534f5d8acccc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using System.Threading;
using System.Threading.Tasks;
namespace FlowScope.Save
{
public interface ISaveService
{
Task SaveAsync<T>(string key, T data, CancellationToken cancellationToken);
Task<T> LoadAsync<T>(string key, T defaultValue, CancellationToken cancellationToken);
void Delete(string key);
bool Exists(string key);
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3e730e1406e843dd957ffddac73ac8be
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
namespace FlowScope.UI
{
public enum PanelStrategy
{
Destroy,
Cache
}
}

View File

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

View File

@@ -0,0 +1,22 @@
using System;
namespace FlowScope.UI
{
[AttributeUsage(AttributeTargets.Class)]
public sealed class UIPanelAttribute : Attribute
{
public UIPanelAttribute(
string layer,
string path = null,
PanelStrategy? overrideStrategy = null)
{
Layer = layer;
Path = path;
OverrideStrategy = overrideStrategy;
}
public string Layer { get; }
public string Path { get; }
public PanelStrategy? OverrideStrategy { get; }
}
}

View File

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

View File

@@ -0,0 +1,24 @@
using R3;
using UnityEngine;
namespace FlowScope.UI
{
public abstract class UIPanelBase<TViewModel> : MonoBehaviour
{
protected TViewModel ViewModel { get; private set; }
protected CompositeDisposable Disposables { get; } = new();
public void Bind(TViewModel viewModel)
{
ViewModel = viewModel;
OnBind(viewModel);
}
public virtual void Unbind()
{
Disposables.Clear();
}
protected abstract void OnBind(TViewModel viewModel);
}
}

View File

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