mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
chore(license): 更新许可证为Apache 2.0并完善文档
- 将项目许可证从MIT更改为Apache 2.0 - 在各个README文件中添加许可证信息 - 更新主README文件为中文介绍 - 添加框架设计理念和架构优势说明 - 补充技术栈和性能特性介绍 - 更新安装和使用示例 - 添加项目背景和修改说明 - [no tag]
This commit is contained in:
parent
c5a11820bc
commit
13829c6d2b
@ -1139,6 +1139,6 @@ public class Button : Control, IController
|
||||
|
||||
---
|
||||
|
||||
**版本**: 1.0.0
|
||||
**适用引擎**: Godot 4.x (C#)
|
||||
**许可证**: MIT
|
||||
**版本**: 1.0.0
|
||||
**适用引擎**: Godot 4.x (C#)
|
||||
**许可证**: Apache 2.0
|
||||
@ -174,4 +174,8 @@ GameArchitecture.Interface.RegisterSystem(newSystem);
|
||||
- [`ioc`](../ioc/README.md) - IoC 容器
|
||||
- [`model`](../model/README.md) - 数据模型
|
||||
- [`system`](../system/README.md) - 业务系统
|
||||
- [`utility`](../utility/README.md) - 工具类
|
||||
- [`utility`](../utility/README.md) - 工具类
|
||||
|
||||
---
|
||||
|
||||
**许可证**: Apache 2.0
|
||||
@ -295,4 +295,8 @@ public class MoveCommand : AbstractCommand, IUndoableCommand
|
||||
- [`query`](../query/README.md) - 查询模式,用于数据查询
|
||||
- [`events`](../events/README.md) - 事件系统,命令执行后的通知机制
|
||||
- [`system`](../system/README.md) - 业务系统,命令的主要执行者
|
||||
- [`model`](../model/README.md) - 数据模型,命令操作的数据
|
||||
- [`model`](../model/README.md) - 数据模型,命令操作的数据
|
||||
|
||||
---
|
||||
|
||||
**许可证**: Apache 2.0
|
||||
214
LICENSE
214
LICENSE
@ -1,21 +1,201 @@
|
||||
MIT License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright (c) 2025 GeWuYou
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
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:
|
||||
1. Definitions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
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.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
132
README.md
132
README.md
@ -1,76 +1,85 @@
|
||||
# GFramework
|
||||
|
||||
A comprehensive C# game development framework designed for Godot and general game development scenarios.
|
||||
一个专为Godot和通用游戏开发场景设计的综合性C#游戏开发框架。
|
||||
本项目参考(CV)自[QFramework](https://github.com/liangxiegame/QFramework)
|
||||
|
||||
## Features
|
||||
# 为什么要有这个项目
|
||||
|
||||
### Core Architecture
|
||||
- 原来的项目是单文件框架,我把框架拆成多个文件,方便管理
|
||||
- 纯粹个人自用,要使用还是请访问[QFramework](https://github.com/liangxiegame/QFramework)
|
||||
- 至于修改名字,是因为我为了方便会发布GuGet包,假设将来QFramework也要发布GuGet包,那么就会冲突了
|
||||
|
||||
- **Dependency Injection**: Built-in IoC container for managing object lifecycles
|
||||
- **Event System**: Type-safe event system for loose coupling
|
||||
- **Property Binding**: Bindable properties for reactive programming
|
||||
- **Logging Framework**: Structured logging with multiple log levels
|
||||
## 特性 Features
|
||||
|
||||
### Game Development Features
|
||||
### 核心架构 Core Architecture
|
||||
|
||||
- **Asset Management**: Centralized asset catalog system
|
||||
- **Resource Factory**: Factory pattern for resource creation
|
||||
- **Architecture Pattern**: Clean architecture with separation of concerns
|
||||
- **依赖注入 Dependency Injection**: 内置IoC容器管理对象生命周期
|
||||
- **事件系统 Event System**: 类型安全的事件系统,实现松耦合
|
||||
- **属性绑定 Property Binding**: 可绑定属性,支持响应式编程
|
||||
- **日志框架 Logging Framework**: 结构化日志,支持多个日志级别
|
||||
|
||||
### Godot Integration
|
||||
### 游戏开发特性 Game Development Features
|
||||
|
||||
- **Godot-Specific Extensions**: Extensions and utilities for Godot development
|
||||
- **Node Extensions**: Helpful extensions for Godot Node classes
|
||||
- **Godot Logger**: Specialized logging system for Godot applications
|
||||
- **资产管理 Asset Management**: 集中化资产目录系统
|
||||
- **资源工厂 Resource Factory**: 工厂模式的资源创建模式
|
||||
- **架构模式 Architecture Pattern**: 关注点分离的清晰架构
|
||||
|
||||
## Projects
|
||||
### Godot集成 Godot Integration
|
||||
|
||||
### Core Projects
|
||||
- **Godot特定扩展 Godot-Specific Extensions**: Godot开发的扩展和工具
|
||||
- **节点扩展 Node Extensions**: Godot节点类的有用扩展
|
||||
- **Godot日志器 Godot Logger**: Godot应用程序的专用日志系统
|
||||
|
||||
- **GFramework.Core**: Core framework functionality
|
||||
- **GFramework.Game**: Game-specific abstractions and systems
|
||||
- **GFramework.Godot**: Godot-specific implementations
|
||||
## 项目 Projects
|
||||
|
||||
### Source Generators
|
||||
### 核心项目 Core Projects
|
||||
|
||||
- **GFramework.SourceGenerators**: Code generators for automatic code generation
|
||||
- **GFramework.Godot.SourceGenerators**: Godot-specific code generators
|
||||
- **GFramework.SourceGenerators.Abstractions**: Abstractions for source generators
|
||||
- **GFramework.Godot.SourceGenerators.Abstractions**: Godot-specific abstractions
|
||||
- **GFramework.Core**: 核心框架功能
|
||||
- **GFramework.Game**: 游戏特定抽象和系统
|
||||
- **GFramework.Godot**: Godot特定实现
|
||||
|
||||
## Getting Started
|
||||
### 源代码生成器 Source Generators
|
||||
|
||||
### Installation
|
||||
- **GFramework.SourceGenerators**: 自动代码生成的代码生成器
|
||||
- **GFramework.Godot.SourceGenerators**: Godot特定的代码生成器
|
||||
- **GFramework.SourceGenerators.Abstractions**: 源代码生成器的抽象
|
||||
- **GFramework.Godot.SourceGenerators.Abstractions**: Godot特定的抽象
|
||||
|
||||
1. Install the NuGet packages:
|
||||
## 快速开始 Getting Started
|
||||
|
||||
### 安装 Installation
|
||||
|
||||
1. 安装NuGet包:
|
||||
|
||||
```bash
|
||||
dotnet add package GeWuYou.GFramework.Core
|
||||
dotnet add package GeWuYou.GFramework.Game
|
||||
dotnet add package GeWuYou.GFramework.SourceGenerators
|
||||
dotnet add package GeWuYou.GFramework.Godot
|
||||
dotnet add package GeWuYou.GFramework.Godot.SourceGenerators
|
||||
```
|
||||
|
||||
### Basic Usage
|
||||
### 基本使用 Basic Usage
|
||||
|
||||
```csharp
|
||||
// Create an architecture instance
|
||||
// 创建架构实例 Create an architecture instance
|
||||
var architecture = new MyArchitecture();
|
||||
|
||||
// Initialize the architecture
|
||||
// 初始化架构 Initialize the architecture
|
||||
await architecture.InitializeAsync();
|
||||
|
||||
// Access services
|
||||
// 访问服务 Access services
|
||||
var service = architecture.Container.Resolve<IMyService>();
|
||||
```
|
||||
|
||||
### Godot Integration
|
||||
### Godot集成 Godot Integration
|
||||
|
||||
```csharp
|
||||
// Use Godot-specific features
|
||||
// 使用Godot特定功能 Use Godot-specific features
|
||||
[GodotLog]
|
||||
public partial class MyGodotNode : Node
|
||||
{
|
||||
// Auto-generated logger will be available
|
||||
// 自动生成的日志器将可用 Auto-generated logger will be available
|
||||
private readonly ILogger _log = Log.GetLogger("MyGodotNode");
|
||||
|
||||
public override void _Ready()
|
||||
@ -80,23 +89,52 @@ public partial class MyGodotNode : Node
|
||||
}
|
||||
```
|
||||
|
||||
## Architecture
|
||||
## 架构 Architecture
|
||||
|
||||
The framework follows clean architecture principles with the following layers:
|
||||
框架遵循清洁架构原则,具有以下层次:
|
||||
|
||||
1. **Core Layer**: Fundamental abstractions and interfaces
|
||||
2. **Application Layer**: Use cases and application services
|
||||
3. **Infrastructure Layer**: External dependencies and implementations
|
||||
4. **Presentation Layer**: UI and user interaction components
|
||||
1. **核心层 Core Layer**: 基础抽象和接口 Fundamental abstractions and interfaces
|
||||
2. **应用层 Application Layer**: 用例和应用服务 Use cases and application services
|
||||
3. **基础设施层 Infrastructure Layer**: 外部依赖和实现 External dependencies and implementations
|
||||
4. **表示层 Presentation Layer**: UI和用户交互组件 UI and user interaction components
|
||||
|
||||
## License
|
||||
## 许可证 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
本项目基于Apache 2.0许可证 - 详情请参阅 [LICENSE](LICENSE) 文件。
|
||||
|
||||
## Contributing
|
||||
## 支持 Support
|
||||
|
||||
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
|
||||
如需支持和问题,请在仓库中提交问题。
|
||||
|
||||
## Support
|
||||
## 框架设计理念 Framework Design Philosophy
|
||||
|
||||
For support and questions, please open an issue in the repository.
|
||||
### 核心设计原则 Core Design Principles
|
||||
|
||||
- **单一职责原则 Single Responsibility Principle**: 每个类只负责一种功能
|
||||
- **开闭原则 Open/Closed Principle**: 对扩展开放,对修改封闭
|
||||
- **里氏替换原则 Liskov Substitution Principle**: 子类必须能够替换其父类
|
||||
- **接口隔离原则 Interface Segregation Principle**: 多个专用接口优于一个庞大接口
|
||||
- **依赖倒置原则 Dependency Inversion Principle**: 依赖抽象而非具体实现
|
||||
|
||||
### 架构优势 Architecture Benefits
|
||||
|
||||
- **清晰的分层架构 Clear Layered Architecture**: Model、View、Controller、System、Utility各司其职
|
||||
- **类型安全 Type Safety**: 基于泛型的组件获取和事件系统
|
||||
- **松耦合 Loose Coupling**: 通过事件和接口实现组件解耦
|
||||
- **易于测试 Easy Testing**: 依赖注入和纯函数设计
|
||||
- **可扩展 Extensibility**: 基于接口的规则体系
|
||||
- **生命周期管理 Lifecycle Management**: 自动的注册和注销机制
|
||||
|
||||
## 技术栈 Technology Stack
|
||||
|
||||
- **.NET 6.0+**: 跨平台运行时
|
||||
- **Godot 4.x**: 游戏引擎
|
||||
- **C#**: 主要编程语言
|
||||
- **Source Generators**: 源代码生成技术
|
||||
|
||||
## 性能特性 Performance Features
|
||||
|
||||
- **零GC allocations**: 使用结构体和对象池减少垃圾回收
|
||||
- **编译时生成**: 通过源代码生成器减少运行时开销
|
||||
- **高效事件系统**: 类型安全的事件分发
|
||||
- **内存管理**: 自动生命周期管理和资源释放
|
||||
Loading…
x
Reference in New Issue
Block a user