UNPKG

wonder.js

Version:
58 lines (52 loc) 3.77 kB
'use strict'; var Caml_array = require("bs-platform/lib/js/caml_array.js"); var Contract$WonderLog = require("wonder-log/lib/js/src/Contract.js"); var StateDataMain$Wonderjs = require("../data/StateDataMain.js"); var IsDebugMainService$Wonderjs = require("../state/IsDebugMainService.js"); var ArrayService$WonderCommonlib = require("wonder-commonlib/lib/js/src/ArrayService.js"); var DisposeScriptService$Wonderjs = require("../../../record/main/script/DisposeScriptService.js"); var DisposeComponentService$Wonderjs = require("../../../primitive/component/DisposeComponentService.js"); var MutableSparseMapService$WonderCommonlib = require("wonder-commonlib/lib/js/src/MutableSparseMapService.js"); var ImmutableSparseMapService$WonderCommonlib = require("wonder-commonlib/lib/js/src/ImmutableSparseMapService.js"); var OperateScriptEventFunctionDataMainService$Wonderjs = require("./OperateScriptEventFunctionDataMainService.js"); function _disposeData(script, state) { var scriptRecord = state[/* scriptRecord */27]; var newrecord = Caml_array.caml_array_dup(state); newrecord[/* scriptRecord */27] = /* record */[ /* index */scriptRecord[/* index */0], /* isScriptEventFunctionEnable */scriptRecord[/* isScriptEventFunctionEnable */1], /* disposedIndexArray */scriptRecord[/* disposedIndexArray */2], /* gameObjectMap */DisposeComponentService$Wonderjs.disposeSparseMapData(script, scriptRecord[/* gameObjectMap */3]), /* isActiveMap */MutableSparseMapService$WonderCommonlib.deleteVal(script, scriptRecord[/* isActiveMap */4]), /* scriptEventFunctionDataMap */ImmutableSparseMapService$WonderCommonlib.deleteVal(script, scriptRecord[/* scriptEventFunctionDataMap */5]), /* scriptAttributeMap */ImmutableSparseMapService$WonderCommonlib.deleteVal(script, scriptRecord[/* scriptAttributeMap */6]) ]; return newrecord; } function _batchExecDisposeEventFunction(scriptArray, state) { return OperateScriptEventFunctionDataMainService$Wonderjs.execAllEventFunction(OperateScriptEventFunctionDataMainService$Wonderjs.getActiveScriptAllDisposeEventFunctionData(scriptArray, state), state); } function handleBatchDisposeComponent(scriptArray, state) { var scriptRecord = state[/* scriptRecord */27]; Contract$WonderLog.requireCheck((function (param) { return DisposeComponentService$Wonderjs.checkComponentShouldAliveWithBatchDispose(scriptArray, DisposeScriptService$Wonderjs.isAlive, scriptRecord); }), IsDebugMainService$Wonderjs.getIsDebug(StateDataMain$Wonderjs.stateData)); var state$1 = _batchExecDisposeEventFunction(scriptArray, state); var scriptRecord$1 = state$1[/* scriptRecord */27]; var newrecord = Caml_array.caml_array_dup(state$1); return ArrayService$WonderCommonlib.reduceOneParam((function (state, script) { return _disposeData(script, state); }), (newrecord[/* scriptRecord */27] = /* record */[ /* index */scriptRecord$1[/* index */0], /* isScriptEventFunctionEnable */scriptRecord$1[/* isScriptEventFunctionEnable */1], /* disposedIndexArray */scriptRecord$1[/* disposedIndexArray */2].concat(scriptArray), /* gameObjectMap */scriptRecord$1[/* gameObjectMap */3], /* isActiveMap */scriptRecord$1[/* isActiveMap */4], /* scriptEventFunctionDataMap */scriptRecord$1[/* scriptEventFunctionDataMap */5], /* scriptAttributeMap */scriptRecord$1[/* scriptAttributeMap */6] ], newrecord), scriptArray); } exports._disposeData = _disposeData; exports._batchExecDisposeEventFunction = _batchExecDisposeEventFunction; exports.handleBatchDisposeComponent = handleBatchDisposeComponent; /* Contract-WonderLog Not a pure module */