J Engine by JasonXuDeveloper - 2

Frameworks

JEngine is a streamlined and easy-to-use framework designed for Unity Programmers.

Unknown VersionMIT LicenseUpdated 12 hours agoCreated on July 14th, 2020
Go to source

JENGINE v0.3.6.3

JEngine is a streamlined and easy-to-use framework designed for Unity Programmers.

What can JEngine do?

  • Hot-update solution

    • Resource hot update & management is based on XAsset which JEngine’s author has contributed into.
    • Code hot update is based on ILRuntime which JEngine’s author has also contributed into.
    • Encrypts your hot-updatable codes and resources, codes will go into your assetbundles, assetbundles will be encrypt within VFS by XAsset, and also, your codes will be encrypted in AES-128 ECB mode
  • Own Action solution

    • Less code, does more

      int num = 0;
      int repeatCounts = 3;
      float repeatDuration = 0.5f;
      float timeout = 10f;
      JAction j = new JAction();
      j.Do(() => Log.Print("Hello from JAction!"))
        .Repeat(() =>
                {
                  num++;
                  Log.Print(____ROOT____quot;num is: {num}");
                }, repeatCounts, repeatDuration)
        .Do(() => Log.Print(____ROOT____quot;num has increased {repeatCounts} times"))
        .RepeatWhen(() =>
                    {
                      Log.Print(____ROOT____quot;num is more than 0, num--");
                      num--;
                    },
                    () => num > 0, repeatDuration, timeout)
        .Do(() => Log.Print("JAction will do something else in 3 seconds"))
        .Delay(3.0f)
        .Do(() => Log.Print("Bye from JAction"))
        .Excute();
      
  • Own UI solution

    • Method-Chaining style makes codes prettier and easier to visualize

      var JUI = Showcase.AddComponent<JUI>()
        .onInit(t =>
                {
                  ...
                })
        .onLoop(t1 =>
                {
                  ...
                })
        .onEnd(t2 =>
               {
                 ...
               })
        .Activate();
      
    • Easier to manage lifecycle

      • Can easily set up what you want the UI element to do in specific time
      t.FrameMode = false;//Run in ms
      t.Frequency = 1000;//Loop each 1s
      
    • Bindable to data

      • UI can be binded to a data, once data has changed, it will call the method that you has binded
      var JUI = b.AddComponent<JUI>()
        .Bind(data.b)
        .onMessage(t1 =>
                   {
                     ...
                   })
        .Activate();
      
    • Supports any UIBehaviour objects

      t1.Element<UIBehaviour>()
      
  • Own Behaviour based on MonoBehaviour

    • More friendly to manage lifecycle

      • You can make loop easier using JEngine
      public class JBehaviourExample : JBehaviour
      {
        public override void Init()
        {
          base.Init();
          ...
        }
        
        public override void Run()
        {
          base.Run();
          ...
        }
        
        public override void Loop()
        {
          ...
        }
        
        public override void End()
        {
          ...
        }
      }
      
  • More to explore!!!

JEngine has its own purpose to help developers write powerful codes which are streamlined and beautiful; and to help developers easier making their games.

If you enjoy using JEngine, please give this repo a star!

中文请点这里

Latest Features

  • JAction supports Cancelation Callback

    //Cancel a JAction
    JAction j8 = new JAction();
    j8.RepeatWhen(() => Log.Print("[j8] I am repeating!!!"), () => true, 1, timeout)
      .ExecuteAsyncParallel();
    //You can either add a cancel callback
    j8.OnCancel(() => Log.Print("[j8] has been cancelled!"));
    
  • JAction supports Reset

    //Reset a JAction
    j8.Reset();
    
  • Fixed bug on JAction.ExecuteAsyncParallel

Click here to see all version updates

Features

  • Hot-update solution

    • No need to learn Lua, C# codes can be hot-updated
    • Drop your resources in specific directories and can be generate hot-updatable resources automatically, all you need to do is to press “Build Bundle” button, and to put your what it generated into your server
    • Encrypts DLL, your hot-update codes are safe now unless someone got your encrypted password
  • JBehaviour is a Behaviour in JEngine which is based on MonoBehaviour, and it is easier to manage lifecycle of UI elements

  • JUI is a class in JEngine which can enhance the performence of UI elements based on UGUI

    • JUI borrowed concept from MVVM Framework and rewrote it, JUI supports binding a data with an action, once data has changed, the action will be called
    • You can choose to either update your UI in specific Loop with Frequency, or to update your UI only if the binded data changed
    • You can get UI components more efficiently with JUI via the generic method Method
    • Method-Chaning style of coding makes your codes prettier and easier to read
  • JAction is an extension of Action

    • Method-chaining Style

    • Great variation of features

      • Do action
      • Delay
      • Wait Until
      • Repeat
      • Repeat When
      • Repeat Until
      • Cancel
      • Reset
      • Excute(Async/AsyncParallel)
    • Shorter and more powerful

      • Less code can do more things
      int num = 0;
      int repeatCounts = 3;
      float repeatDuration = 0.5f;
      float timeout = 10f;
      JAction j = new JAction();
      j.Do(() => Log.Print("Hello from JAction!"))
        .Repeat(() =>
                {
                  num++;
                  Log.Print(____ROOT____quot;num is: {num}");
                }, repeatCounts, repeatDuration)
        .Do(() => Log.Print(____ROOT____quot;num has increased {repeatCounts} times"))
        .RepeatWhen(() =>
                    {
                      Log.Print(____ROOT____quot;num is more than 0, num--");
                      num--;
                    },
                    () => num > 0, repeatDuration, timeout)
        .Do(() => Log.Print("JAction will do something else in 3 seconds"))
        .Delay(3.0f)
        .Do(() => Log.Print("Bye from JAction"))
        .Excute();
      
    • Extension of System.Action

      • Add what to do, add delayings, JAction will do them in order
  • Object Pool solution

    • MUCH MORE Enhances the performence rather than using Instantiate method
      • With this solution, you don’t have to repeat instantiate gameObject
      • Just tell JObjectPool what gameObject you will repeatedly create, and how many you except to create at the start, it will do it for you
      • Request PoolObject to get the GameObject
    • Easy and powerful
    • With algorithm which fairly controls gameObjects

    Example will come soon

  • GUI-Redis helps visualize data in Redis Databases and can modify data in it.

    • Supports connect through SSH tunnel
    • Supports connect through normay way (IP, Port connection)
    • Supports add/modify/delete/search key-value pairs

Future Features

  • Supports local hot-update resources development in Unity Editor (Done)
  • Encrypt Hot-update DLL and decrypt in runtime
  • Object Pool which significantly improves performance rather than using Instantiate method
  • JUI with more extended APIs
  • UI Special Effects
  • Optiimize logics which can improve process speed (As always doing it)
  • Unity Editor FTP Tool (Maybe)

What is Hot update and Why

Click here to have a read

Directory Structure (IMPORTANT)

Please clone this framework into your project and keep this directory structure

.
├── Assets
│   ├── Dependencies
│   │   ├── ILRuntime
│   │   │   ├── Editor
│   │   │   ├── Essential
│   │   │   ├── Generated
│   │   │   └── ILRuntime
│   │   ├── JEngine
│   │   │   ├── Core
│   │   │   └── Editor
│   │   ├── LitJson
│   │   └── XAsset
│   │       ├── Editor
│   │       ├── Resources
│   │       ├── Runtime
│   │       ├── ScriptableObjects
│   │       └── UI
│   ├── HotUpdateResources
│   │   ├── Controller
│   │   ├── Dll
│   │   ├── Material
│   │   ├── Other
│   │   ├── Prefab
│   │   ├── Scene
│   │   ├── ScriptableObject
│   │   ├── TextAsset
│   │   └── UI
│   ├── Init.unity
│   └── Scripts
│       ├── Init.cs
│       └── APIs
├── Builds
├── DLC
├── HotUpdateScrpts
├── ProjectSettings

Description for those Directories

Click here to have a read

JEngine Hot Update Logics

flowchart

Quick Start

Basics

The basics tells you how to use this framework in basics (How to make your project hot-updatable)

Click here to have a read

Extensions

The extensions will show you how to hot-update your game in coding levels (How to make hot-updatable codes)

Click here to have a read

Developement Guide

This will enable you quick develop your game and you don’t need to upload your latest hot-update resources into your server (which saves your time)

  1. Go to Unity Editor, open Init scene

  2. Choose Updater from inspector

  3. Enable development mode in Updater script section

    guide1

Common “Bugs”

  • Cannot find Delegate Adapter for: XXX, Please add following code into Assets/Scripts/Init.cs ‘InitializeILRuntime()’ Method:

    Just do what it asked you to add into Scripts/Init.cs, ‘InitializeILRuntime()’ Method

    bug1

IMPORTANT

  • When building bundle, a window will pop up, and you need to provide the encrypt key which encrypts your dll

    key1

  • In Init scene, select HotFixCode on hierarchy, you will see Init (Script) on inspector, there will be a section called Key, just fill the encrypt key in, and it will decrypt dll in runtime

    key2

  • When you build your project, remember to remove hot-update scenes in build setting panel to avoid redundancy

    build

Development Environment

  • Debuging Unity Engine Version: 2019.3.13f1

    Should supports Unity Engine From 2018 LTS till the latest

  • .net Environment: .net 2.0 standard

  • Operating System: MacOS 10.15.5

    Definityly supports windows

Recommend Repositories

  • XAsset - A more streamlined, efficient and secure Unity Resource Management Solution for you.
  • IFramework - Simple Unity Tools



中文说明

将在获得 100 stars之后补充

Show all projects by JasonXuDeveloper