Compare commits
4 Commits
c89d789c84
...
98d5d0d6e3
Author | SHA1 | Date |
---|---|---|
|
98d5d0d6e3 | 6 months ago |
|
afe372f849 | 6 months ago |
|
cbfbc584fa | 6 months ago |
|
ea6b0023a7 | 6 months ago |
17 changed files with 274 additions and 37 deletions
@ -0,0 +1,21 @@ |
|||||||
|
MIT License |
||||||
|
|
||||||
|
Copyright (c) 2023 凉鞋 |
||||||
|
|
||||||
|
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. |
@ -0,0 +1,60 @@ |
|||||||
|
using Godot; |
||||||
|
using static Godot.GD; |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace EGFramework{ |
||||||
|
public partial class EGThread : Node,IModule,IEGFramework{ |
||||||
|
|
||||||
|
public EasyEventOnce EventPool = new EasyEventOnce(); |
||||||
|
public Dictionary<Action,SceneTreeTimer> EventDelayPool = new Dictionary<Action, SceneTreeTimer>(); |
||||||
|
|
||||||
|
public void Init() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public override void _Ready() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public override void _Process(double delta) |
||||||
|
{ |
||||||
|
//base._Process(delta); |
||||||
|
EventPool.Invoke(); |
||||||
|
} |
||||||
|
|
||||||
|
public void ExecuteInMainThread(Action action){ |
||||||
|
//ActionQueue.Enqueue(action); |
||||||
|
EventPool.Register(action); |
||||||
|
} |
||||||
|
|
||||||
|
public void ExecuteAfterSecond(Action action,double delay){ |
||||||
|
SceneTreeTimer timer = this.GetTree().CreateTimer(delay); |
||||||
|
timer.Timeout += action; |
||||||
|
timer.Timeout += () => EventDelayPool.Remove(action); |
||||||
|
EventDelayPool.Add(action,timer); |
||||||
|
} |
||||||
|
|
||||||
|
public IArchitecture GetArchitecture() |
||||||
|
{ |
||||||
|
return EGArchitectureImplement.Interface; |
||||||
|
} |
||||||
|
} |
||||||
|
public static class EGThreadExtension |
||||||
|
{ |
||||||
|
public static void ExecuteInMainThread(this Node self, Action action){ |
||||||
|
//action.Invoke(); |
||||||
|
self.NodeModule<EGThread>().ExecuteInMainThread(action); |
||||||
|
} |
||||||
|
|
||||||
|
public static void ExecuteAfterSecond(this Node self, Action action,double delay){ |
||||||
|
self.NodeModule<EGThread>().ExecuteAfterSecond(action,delay); |
||||||
|
} |
||||||
|
|
||||||
|
public static void EGEnabledThread(this Node self){ |
||||||
|
self.NodeModule<EGThread>(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Data.Common; |
||||||
|
using System.Linq.Expressions; |
||||||
|
|
||||||
|
//ORM Save tools. First support SQLite and MySQL,In future we will support other Database who implement DBConnection. |
||||||
|
namespace EGFramework{ |
||||||
|
public class EGDapper : IEGSave, IEGSaveData |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// |
||||||
|
/// </summary> |
||||||
|
/// <param name="conn">files conn Str or address ip port,username and passwd</param> |
||||||
|
public void InitSaveFile(string conn) |
||||||
|
{ |
||||||
|
throw new System.NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<TData> FindData<TData>(string dataKey, Expression<Func<TData, bool>> expression) where TData : new() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<TData> GetAll<TData>(string dataKey) where TData : new() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public TData GetData<TData>(string dataKey, object id) where TData : new() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void SetData<TData>(string dataKey, TData data, object id) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue