based on https://github.com/hiramtan/HiFramework
下載
使用
var io = Center . Get < IIOComponent > ( ) ;
io . ReadFile ( "path" ) ; public override void Init ( )
{
base . Init ( ) ;
Bind < Example_Bind_ITest > ( ) . To < Example_Bind_ITestComponent > ( ) ;
} 更多示例在:unity/Assets/Example
void Start ( )
{
Center . Init ( ) ;
new AsyncTaskWaitTime ( OnLog , 10 ) ;
}
// Update is called once per frame
void Update ( )
{
Center . Tick ( Time . deltaTime ) ;
}
void OnLog ( )
{
Debug . Log ( "wait for 10s" ) ;
} void Start ( )
{
Center . Init ( ) ;
var task = new AsyncTaskRepea ( OnLog , 2 ) ;
//task.Stop();
}
// Update is called once per frame
void Update ( )
{
Center . Tick ( Time . deltaTime ) ;
}
void OnLog ( )
{
Debug . Log ( "log every 2s" ) ;
} Center . Init ( ) ;
var eventComponent = Center . Get < IEventComponent > ( ) ;
eventComponent . Subscribe < int > ( "key" , OnEvent ) ;
eventComponent . Dispatch ( "key" , 100 ) ; Center . Init ( ) ;
var inject = Center . Get < IInjectComponent > ( ) ;
inject . Bind < Example_Inject > ( ) . To ( this ) ;
var newClass = new Example_Inject_NewClass ( ) ;
inject . Inject ( newClass ) ;
newClass . Log ( ) ; var signalComponent = Center . Get < ISignalComponent > ( ) ;
var signal = signalComponent . GetSignal < Example_Signal_Score > ( ) ;
signal . AddListener ( OnSignal ) ;
signal . Fire ( 100 ) ; - 对象池
```csharp
Center.Tick(Time.deltaTime);
_timeCounter += Time.deltaTime;
if (_timeCounter > _timeRate)
{
_timeCounter = 0;
var writer = _pool.GetOneObjectFromPool();
//let writer do something that cost time, will reuse this write when it finish task
}
舊文檔:(更多文檔查看wiki: https://github.com/hiramtan/HiFramework_unity/wiki ):
點擊鏈接加入QQ群【83596104】:https://jq.qq.com/?_wv=1027&k=5l6rZEr
support: [email protected]
MIT License
Copyright (c) [2017] [Hiram]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.