Skip to content
Permalink
Browse files

feat(gameObject): add "is active" logic; (feat(script): add "is activ…

…e" logic);
  • Loading branch information...
yyc-git committed Apr 13, 2019
1 parent 81d16bd commit d77251214c399b3a70c27fedd1bc7c63a8c86026
Showing with 876 additions and 111 deletions.
  1. +29 −1 src/api/GameObjectAPI.re
  2. +259 −13 src/api/script/ScriptAPI.re
  3. +1 −1 src/job/utils/InitScriptJobUtils.re
  4. +1 −1 src/job/utils/UpdateScriptJobUtils.re
  5. +1 −0 src/service/record/main/data/GameObjectType.re
  6. +4 −0 src/service/record/main/gameObject/RecordGameObjectService.re
  7. +6 −0 src/service/record/main/memory/ReallocateGameObjectCPUMemoryService.re
  8. +4 −0 src/service/record/main/script/DisposeScriptService.re
  9. +1 −0 src/service/state/main/data/StateDataMainType.re
  10. +22 −1 src/service/state/main/gameObject/CloneGameObjectMainService.re
  11. +11 −0 src/service/state/main/gameObject/GetIsActiveGameObjectMainService.re
  12. +40 −0 src/service/state/main/gameObject/SetIsActiveGameObjectMainService.re
  13. +57 −35 src/service/state/main/meshRenderer/OperateMeshRendererMainService.re
  14. +14 −1 src/service/state/main/script/CloneScriptMainService.re
  15. +12 −6 src/service/state/main/script/DisposeScriptMainService.re
  16. +36 −0 src/service/state/main/script/IsActiveScriptMainService.re
  17. +13 −8 src/service/state/main/script/OperateScriptEventFunctionDataMainService.re
  18. +3 −1 src/service/state/main/script/RecordScriptMainService.re
  19. +1 −0 src/service/state/main/state/DeepCopyStateMainService.re
  20. +24 −3 test/integration/no_worker/core/clone/cloneGameObject_test.re
  21. +3 −0 test/integration/no_worker/core/state/redo_undo_ecs_test.re
  22. +15 −0 test/integration/no_worker/core/state/redo_undo_script_test.re
  23. +4 −2 test/integration/no_worker/job/init/initScriptJob_test.re
  24. +39 −0 test/integration/no_worker/job/loop/updateScriptJob_test.re
  25. +6 −2 test/tool/service/script/ScriptTool.re
  26. +73 −33 test/unit/ecs/component/meshRenderer/MeshRenderer_test.re
  27. +114 −3 test/unit/ecs/component/script/Script_test.re
  28. +83 −0 test/unit/ecs/gameObject/GameObject_test.re
@@ -1189,4 +1189,32 @@ let getAllLightMaterialComponents = GetComponentGameObjectMainService.getAllLigh

let getAllDirectionLightComponents = GetComponentGameObjectMainService.getAllDirectionLightComponents;

let getAllPointLightComponents = GetComponentGameObjectMainService.getAllPointLightComponents;
let getAllPointLightComponents = GetComponentGameObjectMainService.getAllPointLightComponents;

let unsafeGetGameObjectIsActive = (gameObject, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(Operators.(_checkGameObjectShouldAlive(gameObject, state)))
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

GetIsActiveGameObjectMainService.unsafeGetIsActive(gameObject, state);
};

let setGameObjectIsActive = (gameObject, isScriptActive, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(Operators.(_checkGameObjectShouldAlive(gameObject, state)))
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

SetIsActiveGameObjectMainService.setIsActive(
gameObject,
isScriptActive,
state,
);
};
@@ -1,88 +1,276 @@
open StateDataMainType;

open DisposeScriptService;

let createScript = state => CreateScriptMainService.create(. state);

let unsafeGetScriptGameObject = (script, state) =>
let unsafeGetScriptGameObject = (script, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

GameObjectScriptMainService.unsafeGetGameObject(script, state.scriptRecord);
};

let addScriptEventFunctionData =
(script, scriptEventFunctionDataName, scriptEventFunctionData, state) =>
(script, scriptEventFunctionDataName, scriptEventFunctionData, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

OperateScriptDataMainService.addScriptEventFunctionData(
script,
scriptEventFunctionDataName,
scriptEventFunctionData,
state,
);
};

let removeScriptEventFunctionData =
(script, scriptEventFunctionDataName, state) =>
(script, scriptEventFunctionDataName, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

OperateScriptDataMainService.removeScriptEventFunctionData(
script,
scriptEventFunctionDataName,
state,
);
};

let replaceScriptEventFunctionData =
(
script,
(sourceScriptEventFunctionDataName, targetScriptEventFunctionDataName),
targetScriptEventFunctionData,
state,
) =>
) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

OperateScriptDataMainService.replaceScriptEventFunctionData(
script,
(sourceScriptEventFunctionDataName, targetScriptEventFunctionDataName),
targetScriptEventFunctionData,
state,
);
};

let unsafeGetScriptEventFunctionDataEntries = (script, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

let unsafeGetScriptEventFunctionDataEntries = (script, state) =>
OperateScriptDataMainService.unsafeGetScriptEventFunctionDataEntries(
script,
state,
);
};

let addScriptAttribute = (script, scriptAttributeName, scriptAttribute, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

let addScriptAttribute = (script, scriptAttributeName, scriptAttribute, state) =>
OperateScriptDataMainService.addScriptAttribute(
script,
scriptAttributeName,
scriptAttribute,
state,
);
};

let removeScriptAttribute = (script, scriptAttributeName, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

let removeScriptAttribute = (script, scriptAttributeName, state) =>
OperateScriptDataMainService.removeScriptAttribute(
script,
scriptAttributeName,
state,
);
};

let replaceScriptAttribute =
(
script,
(sourceScriptAttributeName, targetScriptAttributeName),
targetScriptAttribute,
state,
) =>
) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

OperateScriptDataMainService.replaceScriptAttribute(
script,
(sourceScriptAttributeName, targetScriptAttributeName),
targetScriptAttribute,
state,
);
};

let unsafeGetScriptAttributeEntries = (script, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

let unsafeGetScriptAttributeEntries = (script, state) =>
OperateScriptDataMainService.unsafeGetScriptAttributeEntries(script, state);
};

let unsafeGetScriptAttribute = (script, scriptAttributeName, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

let unsafeGetScriptAttribute = (script, scriptAttributeName, state) =>
OperateScriptDataMainService.unsafeGetScriptAttribute(
script,
scriptAttributeName,
state,
);
};

let unsafeGetScriptAttributeFieldDefaultValue =
(script, scriptAttributeName, fieldName, state) =>
(script, scriptAttributeName, fieldName, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

OperateScriptDataMainService.unsafeGetScriptAttribute(
script,
scriptAttributeName,
@@ -91,11 +279,69 @@ let unsafeGetScriptAttributeFieldDefaultValue =
|> OperateScriptAttributeDataMainService.unsafeGetScriptAttributeFieldDefaultValue(
fieldName,
);
};

let setScriptAttributeFieldDefaultValueAndValue =
(script, scriptAttributeName, fieldName, value, state) =>
(script, scriptAttributeName, fieldName, value, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

OperateScriptDataMainService.setScriptAttributeFieldDefaultValueAndValue(
script,
(scriptAttributeName, fieldName, value),
state,
);
);
};

let unsafeGetScriptIsActive = (script, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

IsActiveScriptMainService.unsafeGetIsActive(script, state);
};

let setScriptIsActive = (script, isScriptActive, state) => {
WonderLog.Contract.requireCheck(
() =>
WonderLog.(
Contract.(
Operators.(
AliveComponentService.checkComponentShouldAlive(
script,
isAlive,
state.scriptRecord,
)
)
)
),
IsDebugMainService.getIsDebug(StateDataMain.stateData),
);

IsActiveScriptMainService.setIsActive(script, isScriptActive, state);
};

0 comments on commit d772512

Please sign in to comment.
You can’t perform that action at this time.