### Basic ActionKit Usage Examples Source: https://github.com/nikaidoshinku1/yukiframework/blob/main/YukiFrameWork/Tool~/ActionKit/5.动作时序管理模块.md Demonstrates common ActionKit functionalities like delays, sequences, timers, updates, and repeats. All actions require a `Start` call to bind to a MonoBehavior's lifecycle. ```csharp ActionKit.Delay(2f,()=>Debug.Log("延迟两秒")).Start(this); ActionKit.Sequence().Delay(1f).CallBack(() => Debug.Log("队列先等待一秒")).Condition(() => Input.GetMouseButtonDown(1)).CallBack(()=>Debug.Log("按下了鼠标")).Start(this); ActionKit.StartTimer(5f,v=>Debug.Log(v),false,()=>{Debug.Log("执行完毕")}).Start(this); ActionKit.OnUpdate().Where(()=>Input.GetMouseButtonDown(0)).Register(x =>{ }).Start(this); ActionKit.Repeat().Delay(2f,()=>Debug.Log("循环延迟两秒")).Start(this); ``` -------------------------------- ### Architecture Initialization Example Source: https://github.com/nikaidoshinku1/yukiframework/blob/main/YukiFrameWork/Framework/AbstractController使用说明.md Example of defining an architecture class by inheriting from Architecture and overriding the OnInit method. This sets up the foundational structure for controllers. ```csharp ///首先是一个架构类 using YukiFrameWork; public class World : Architecture { ///需要重写的初始化方法 public override void OnInit() { } } ``` -------------------------------- ### Advanced ActionKit Sequence with Nested Structures Source: https://github.com/nikaidoshinku1/yukiframework/blob/main/YukiFrameWork/Tool~/ActionKit/5.动作时序管理模块.md Illustrates complex chaining of Delay, Condition, Parallel, Sequence, and Repeat actions. This example shows how to nest these operations for intricate timing and conditional logic. The `Start` method binds the entire sequence to a MonoBehavior, and an optional completion callback is provided. ```csharp ActionKit.Sequence() .Delay(1f, () => Debug.Log("当前时间"+Time.time)) .Delay(2f, () => Debug.Log("当前时间" + Time.time)) .Condition(() => Input.GetMouseButtonDown(0)) .Parallel(p => { p.Delay(1f, () => Debug.Log("在上一个条件完成并延迟一秒后的时间" + Time.time)) .Delay(2f, () => Debug.Log("在上一个条件完成并延迟二秒后的时间" + Time.time)) .Condition(() => Input.GetMouseButtonDown(1)); }) .Sequence(s => { s.Repeat(2, r => { r.ExecuteFrame(() => Input.GetMouseButtonDown(0), () => Debug.Log("在上述并行全部执行完后按下了鼠标")); }); }) .CallBack(() => Debug.Log("该动作完全执行完毕")) .Start(this, () => Debug.Log("完成并销毁")); ``` -------------------------------- ### MainPanel Implementation Example Source: https://github.com/nikaidoshinku1/yukiframework/blob/main/YukiFrameWork/Tool~/UI/6.UI模块.md Example of a custom UI panel inheriting from BasePanel, demonstrating the implementation of lifecycle methods like OnPreInit, OnInit, OnEnter, OnPause, OnResume, and OnExit. ```csharp using UnityEngine.UI; public partial class MainPanel : BasePanel { private Button btn; /// 面板预初始化方法。执行在OnInit方法之前。当使用OpenPanel打开面板且是该面板第一次加载时,传递的参数会同步到该方法中! public override void OnPreInit(params object[] param) { } public override void OnInit() { base.OnInit(); Debug.Log(btn); } public override void OnEnter(params object[] param)//OnEnter的进入可以获得从外部传入的参数 { base.OnEnter(param); } public override void OnPause() { base.OnPause(); } public override void OnResume() { base.OnResume(); } public override void OnExit() { base.OnExit(); } } ``` -------------------------------- ### SingletonMono Example Source: https://github.com/nikaidoshinku1/yukiframework/blob/main/YukiFrameWork/Framework/Singleton/9.单例.md Example of implementing a Singleton using the SingletonMono base class. This is suitable for Mono-based singletons. ```csharp public class GameManager : SingletonMono { } ``` -------------------------------- ### UI Binding Example for Three-Tier Volume Control Source: https://github.com/nikaidoshinku1/yukiframework/blob/main/YukiFrameWork/Tool~/Audio/8.声音管理模块.md A complete example demonstrating how to bind UI elements (Sliders and Toggles) to audio group settings (Volume and IsOn) for Music, Voice, and Sound categories. Ensure AudioKit is initialized before use. ```csharp namespace YukiFrameWork.Example { public class AudioTest : MonoBehaviour { private void Awake() { AudioKit.Init("YourProjectName"); transform.Find("PlayMusic").GetComponent