con un clic
f8-features-module-workflow
// Use when implementing or troubleshooting Module feature workflows — ModuleCenter lifecycle, module creation, StaticModule, ActivityModule, update attributes in F8Framework.
// Use when implementing or troubleshooting Module feature workflows — ModuleCenter lifecycle, module creation, StaticModule, ActivityModule, update attributes in F8Framework.
Use when implementing or troubleshooting Tween feature workflows — tween animations, sequences, chain calls, UI relative motion, and coroutine/async support in F8Framework.
Use when implementing or troubleshooting Audio feature workflows — BGM, voice, SFX, 3D audio, volume control, and AudioMixer in F8Framework.
Use when implementing or troubleshooting ExcelTool feature workflows — config table loading, Excel binary/JSON generation, variant support, and runtime data access in F8Framework.
Use when working with Module editor tools — right-click context menu for creating Module, ModuleMono, StaticModule, and ActivityModule templates in F8Framework.
Use as the routing skill for selecting the correct F8Framework layer skill chain across foundation, features, editor, tools, and build.
Use when working with Assembly Reflection tools — type discovery, reflection utilities, and assembly scanning in F8Framework.
| name | f8-features-module-workflow |
| description | Use when implementing or troubleshooting Module feature workflows — ModuleCenter lifecycle, module creation, StaticModule, ActivityModule, update attributes in F8Framework. |
⚠️ IMPORTANT: Before using this feature, you MUST formally initialize F8Framework in the launch sequence. Ensure
ModuleCenter.Initialize(this);has run first before anyModuleCenter.CreateModule<T>()call.
| Class | Role |
|---|---|
ModuleCenter | Core lifecycle management. Initialize, Create, Get, Destroy modules. |
ModuleSingleton<T> | Non-MonoBehaviour module base with singleton. |
ModuleSingletonMono<T> | MonoBehaviour module base with singleton. |
IModule | Module interface: OnInit, OnUpdate, OnLateUpdate, OnFixedUpdate, OnTermination. |
StaticModule | Auto-initialized static modules with OnEnterGame/OnQuitGame. |
ActivityModule | Auto-discovered activity modules with unlock/visible/open state evaluation and state change callbacks. |
// Initialize with MonoBehaviour driver
ModuleCenter.Initialize(this);
// Create module with optional priority (lower = earlier update)
ModuleCenter.CreateModule<TimerManager>(100);
// Access module
ModuleCenter.GetModule<TimerManager>().GetServerTime();
// Or via singleton
TimerManager.Instance.GetServerTime();
[UpdateRefresh]
[LateUpdateRefresh]
[FixedUpdateRefresh]
public class MyModule : ModuleSingleton<MyModule>, IModule
{
public void OnInit(object createParam)
{
// Module created
}
public void OnUpdate() { }
public void OnLateUpdate() { }
public void OnFixedUpdate() { }
public void OnTermination()
{
Destroy(gameObject);
}
}
public class MyStaticModule : StaticModule
{
public static MyStaticModule Instance => GetInstance<MyStaticModule>();
protected override void Init() { }
public override void OnEnterGame() { }
public override void OnQuitGame() { }
}
// Usage
StaticModule.GetStaticModule(); // Get all
StaticModule.GetStaticModuleByType(typeof(MyStaticModule)); // Get one
MyStaticModule.Instance.OnEnterGame();
// Iterate all static modules
foreach (var center in StaticModule.GetStaticModule())
{
center.Value.OnEnterGame();
}
public class MyActivityModule : ActivityModule
{
public static MyActivityModule Instance => GetInstance<MyActivityModule>();
protected override void Init() { }
public override void OnEnterGame() { }
public override void OnQuitGame() { }
protected override bool EvaluateUnlockedCore() => true;
protected override bool EvaluateVisibleCore(bool isUnlocked) => isUnlocked;
protected override bool EvaluateOpenCore(bool isUnlocked) => isUnlocked;
protected override void OnStateChanged(ActivityModuleState previousState, ActivityModuleState currentState) { }
}
// Usage
ActivityModule.GetActivityModule<MyActivityModule>();
ActivityModule.GetActivityModules(); // Get all instances
ActivityModule.GetActivityModuleTypes(); // Get all discovered types
ActivityModule.RefreshAllModules(); // Re-evaluate activity state
[UpdateRefresh] — Enable OnUpdate loop[LateUpdateRefresh] — Enable OnLateUpdate loop[FixedUpdateRefresh] — Enable OnFixedUpdate loopRight-click in Project → F8 Module Center → Create Module / ModuleMono / StaticModule / ActivityModule template.
ModuleSingleton<T> (pure C#) or ModuleSingletonMono<T> (MonoBehaviour).IModule interface.ModuleCenter.CreateModule<T>() with priority.StaticModule pattern.ActivityModule pattern.| Type | Base Class | MonoBehaviour | Init | Update | Usage |
|---|---|---|---|---|---|
| Game Module | ModuleSingleton<T> | No | Lazy via CreateModule | Via attributes | Most modules |
| Game Module Mono | ModuleSingletonMono<T> | Yes | Lazy via CreateModule | Via attributes | Needs coroutines |
| Static Module | StaticModule | No | Auto on game start | Manual | Global utilities |
| Activity Module | ActivityModule | No | Auto-discovered and initialized | State refresh via RefreshAllModules | Unlock/show/open activity logic |
| Error | Cause | Solution |
|---|---|---|
| Module is null | Not created via CreateModule | Create before accessing |
| Update not running | Missing [UpdateRefresh] attribute | Add appropriate attribute |
| Module init order issue | Dependency module not yet created | Adjust priority or creation order |