Forum Discussion Post

1.1 Panda’s original words:

That’s right, so it’s very necessary for ET to be divided into 4 programs. It can not only make robots, but also share the same logic layer with mobile games. Once the presentation layer is changed to the logic layer of the end game, one mobile game can be created immediately, and the presentation layer and logic layer are two, each with data layer and logic. 2 * 2 is 4 data and logic together, it is difficult to reconstruct the server because it needs to do continuous heating, so model and hotfix need to be separated. Et is the data + fuction writing method, data and fuction are forced to separate, there is no coupling, and it is very easy to reconstruct

1.2 Personal Understanding:

The assembly role example
Model Non-ui data User
ModelView The UI of the data Text,Button
Hotfix Non-ui logic ChangeUserInfo
HotfixView The logic of the UI ChangeText,ClickButton

Model and Hotfix will have a different name when the client is refactored.

1.3 the presentation layer

The presentation layer refers to the UI-related parts, and the corresponding data and logic layers are ModelView and HotfixView. UI declarations should be placed in ModelView, such as:

using FairyGUI;
using FairyGUI.Utils;

namespace ETModel.View
{
    public partial class CheckForResUpdateBar : GProgressBar
    {
        public GImage bar;
        public const string URL = "ui://233k1ld9rfuv4";

        public static CheckForResUpdateBar CreateInstance()
        {
            return (CheckForResUpdateBar)UIPackage.CreateObject("FUICheckForResUpdate"."CheckForResUpdateBar");
        }

        public override void ConstructFromXML(XML xml)
        {
            base.ConstructFromXML(xml);
            n0 = (GImage)GetChildAt(0); }}}Copy the code

UI operations should be placed in HotfixView, such as:

using FairyGUI; namespace ETModel { public class FUILoadingFactory { public static FUI Create() { FUI fui = ComponentFactory.Create<FUI,  GObject>(FUILoading.CreateInstance()); fui.MakeFullScreen(); return fui; }}}Copy the code

1.4 the logical level

The logical layer is the UI-independent part, and the corresponding data and logic layer is Model and Hotfix. This part will also be reused by the robot

Declarations of data structures should be placed in the Model, such as:

namespace ETModel { public sealed class Unit : Entity { public long UnitId { get; set; } public override void Dispose() { if (this.IsDisposed) { return; } base.Dispose(); }}}Copy the code

Data structure operations should be placed in Hotfix, such as:

namespace ET { public class UnitSystem: AwakeSystem<Unit, int> { public override void Awake(Unit self, int configId) { self.ConfigId = configId; }}}Copy the code