Skip to content

Latest commit

 

History

History
171 lines (100 loc) · 10.6 KB

README_EN.md

File metadata and controls

171 lines (100 loc) · 10.6 KB

CosmosGitLogo

License: MIT Issues:Welcome

CosmosFramework

CosmosFramework is a lightweight Unity development framework . Has a rich Unity method extensions and toolchain. async/await syntax support, multi-network channel support,complete packaging pipeline. Support for automated deployment.The framework follows the unityPackage specification and is recommended to be imported for use through UPM.

Navigation

Environment

  • Unity version:2018 and above,DOTNET API version:4.x.

Launch CosmosFramework

CosmosConfig

  • Add the CosmosConfig component to the game entry and add it to start the framework.

Module Introduction

  • Audio : Game audio module. By registering audio information, you can automatically load audio resources to play by passing in the audio name when playing. audio effects support grouping, and the whole group can be played.

  • Config : Game configuration module. The user can read the configuration file at game initialization and cache it in the configuration module. At runtime the data corresponding to the configuration is read at other desired locations.

  • Controller : Controller module. By registering with this module, polling can be managed without generating a GameObject. This module provides update polling.

  • DataNode : Data node module. The data is stored in this module in a tree structure, and the object corresponding to the data can be obtained by web address format or comma separator.

  • DataTable : Data Table module. In this module, data rows are stored as objects in a data table. The data table can be added, deleted, and checked in real time, and the required data objects are generated by custom deserialization.

  • Download : Download module. Support localhost local file download and http file download. Asynchronous incremental writing to localhost in byte stream when downloading files. Support for dynamic addition and removal of download tasks during downloading.

  • Entity : Game Entity Module. Manage the game runtime entity objects. Entity support group classification, by passing in the resource address can directly manage the resource entity object generation, recycling and other operations, built-in object pool generation.

  • Event : Event Center module. Using the standard event model, it provides common event functions such as listening, removing and dispatching. Provides event observation methods to detect event status in real time.

  • FSM : Finite state machine module. Fully abstract finite state machines that can do state machine implementations for different types of owners.

  • Input : Input adaptation module. The input of each platform is simulated by virtual keys, and different input adapters can be passed in to adapt the input methods of different platforms.

  • Main : Module Center. Both custom modules and extensions are stored here. Custom modules are written in the same format as the built-in modules and have exactly the same lifecycle and permissions as the built-in modules. It is almost identical to the built-in module. The built-in polling pools of this main module: FixedRefreshHandler, LateRefreshHandler, RefreshHandler, ElapseRefreshHandler can poll the objects that need to be polled uniformly, reducing the performance loss caused by too many update and other mono callbacks. performance loss caused by too many update and other mono callbacks.

  • Network : Network module. A variety of high-speed and reliable UDP protocols are provided, such as RUDP, SUDP, KCP, TCP, etc. The KCP protocol is used by default. Network in the form of channel (Channel) to distinguish each connection, support a variety of network types connected at the same time. Can be implemented (Client-Server) mode. Support async/await syntax.

  • ObjectsPool : Object pool module. Provides commonly used functions such as entity object generation and recycling. The underlying implementation uses the data structure Pool.

  • Procedure:Procedure node module. It is convenient to manage the logical nodes executed at runtime, such as hot game start node, resource check node, download resource node, enter game node, etc. Encapsulating each operation into a node greatly facilitates project maintenance.

  • Resource : Resource module.Three built-in loading modes: AssetDatabase, AssetBundle and Resource. AssetDatabase and AssetBundle modes support reference counting, and resource bundles automatically manage the loading or unloading of package bodies based on reference counts. the Runtime loader can be customized with loading schemes. Support for automated pipelines, such as Jenkins build deployments, etc. The editor corresponding to the resource module is located at Window>Cosmos>Module>Resource.Use the AssetDatabase mode during the development phase and the AssetBundle mode when building the app. If you need to use Unity Resource as the loading scheme, switch to Resource mode.ResourceEditorDoc.

  • Scene : Scene module. Provide common asynchronous and synchronous loading of embedded scenes. Support custom implementation of loading methods.

  • UI : UI module.Abstract implementation of UI panels and the way UI is loaded. Support for activation, deactivation, panel priority, group settings and other functions , the use of more lightweight . Framework provides a panel based on the implementation of UGUI class and resource loading help body . Other UI programs can be extended by themselves , currently stable and compatible with FGUI.

  • WebRequest : UnityWebRequest module, can be used to load persistent resources, network resources download and other needs. It supports getting AssetBundle, AudioClip, Texture2D, string, and when the resource is obtained, the user can operate on the resource through WebRequestCallback.

Built-in data structures,tools

  • Utility : Provides common tool functions such as Reflection, Algorithm, Assertion, Conversion, Debug Rich Text, IO, Encryption, Json, MessagePack, Time, Text, Unity Coroutine, Unity Component, etc.

  • Singleton : Singleton base class. Provides thread-safe, non-thread-safe, MONO singleton base classes.

  • DataStructure : Common data structures. Data structures such as linked table, bidirectional linked table, bidirectional dictionary, binary tree, quadtree, AStar, LRU, thread lock, etc.

  • Extensions : Static extension library. Provides Unity and C# native related extension methods.

  • Awaitable : This tool provides support for async/await syntax in the unity environment. You can write asynchronous in Unity just like c# native asynchronous. Support Task asynchronous, Task execution will return to the main thread after completion, when using the normal format can be written.

  • EventCore : Fully abstract event data structure. Contains normal, standard and thread-safe types.

    //Declare a class so that it derives from EventCore and does type constraints.
    public class MyEventCore :EventCore<string,string, MyEventCore>{}
    //Once implemented, you can use the custom event listener.
  • ReferencePool : Global reference pool module.

  • Editor : Editor provides methods to retrieve objects and components commonly used in Hierarchy, and EditorConfig provides the ability to automatically create code headers for code generation.

  • FutureTask:Asynchronous task detection, supports multi-threaded and concurrent asynchronous progress detection. The detection function needs to be passed in Func format. Asynchronous detection ends when the condition return value is true. Support async/await syntax, you can use await statement to wait for the task to complete.

  • Pool:Pool data structure. Includes thread-safe and non-thread-safe types. Object pools, reference pools and cache pools of other modules in the framework are implemented using "Pool".

Built-in Architecture PureMVC

  • A more understandable architecture based on the original PureMVC improvements. The framework provides a more concise feature-based registration:

    • 1.MVCCommandAttribute, corresponding to the Command, i.e. C layer.
    • 2.MVCMediatorAttribute, corresponding to the Mediator, i.e. the V layer.
    • 3.MVCProxyAttribute, corresponding to the Proxy, i.e. the M layer.
  • The derived proxy class needs to override the constructor and pass in the NAME parameter.

  • The derived proxy class needs to override the constructor and pass in the NAME parameter.

  • Note that the MVC.RegisterAttributedMVC() method needs to be passed in the corresponding assembly. Multi-assembly reflection is supported.

Cautions

  • Built-in case address:Assets\Examples\ .

UPM

  • CosmosFramework follows the unityPackage specification and can completely place the entire library in the Packages directory.

  • Import from local: Select the Assets/CosmosFramework folder and copy it to the project's Packages directory.

  • Import from git: fill in the url: https://github.com/DonnYep/CosmosFramework.git#v1.3_upm

Other

Library link

Back to top