Example #1
0
    private BaseSystem InitSystem(OperationObject operationObject, ECSDefine.SystemType systemType, int systemId)
    {
        BaseSystem system = operationObject as BaseSystem;

        system.SetSystemId(systemId);
        system.SetSystemType(systemType);

        ECSDefine.SystemPriority systemPriority;
        if (!ECSInstanceDefine.SystemType2Priority.TryGetValue(systemType, out systemPriority))
        {
            Debug.LogError($"[ECSModule] GetSystemType2Priority Fail. No Reocrd. systemType:{Enum.GetName(typeof(ECSDefine.SystemType), systemType)}");
            systemPriority = ECSDefine.SystemPriority.Normal;
        }
        system.SetSystemPriority(systemPriority);

        ECSDefine.SystemFunctionType systemFunctionType;
        if (!ECSInstanceDefine.SystemType2Function.TryGetValue(systemType, out systemFunctionType))
        {
            Debug.LogError($"[ECSModule] SystemType2Function Fail. No Reocrd. systemType:{Enum.GetName(typeof(ECSDefine.SystemType), systemType)}");
            systemFunctionType = ECSDefine.SystemFunctionType.Logic;
        }
        system.SetSystemFunctionType(systemFunctionType);

        system.FillInComponentInfo();

        return(system);
    }