Skip to content
Permalink
Browse files

feat(engine): update wonder.js to 1.1.0

  • Loading branch information...
yyc-git committed May 31, 2019
1 parent f236513 commit dda7c6b80d315a02de251075c088948e8b6d8691
@@ -74,7 +74,7 @@
"wonder-commonlib": "^0.2.32",
"wonder-hotkey": "^0.0.1",
"wonder-log": "^0.2.11",
"wonder.js": "1.1.0-alpha.13"
"wonder.js": "1.1.0"
},
"resolutions": {
"wonder-log": "^0.2.11",
@@ -317,31 +317,6 @@ let _buildWDBData =
);
};

let _convertEventFunctionToStr = eventFunction =>
SerializeService.serializeFunction(eventFunction);

let _convertEventFunctionDataToStr =
({init, update, dispose}: Wonderjs.StateDataMainType.eventFunctionData) =>
(
{
init:
init
|> Js.Option.andThen((. init) => _convertEventFunctionToStr(init)),
update:
update
|> Js.Option.andThen((. update) =>
_convertEventFunctionToStr(update)
),
dispose:
dispose
|> Js.Option.andThen((. dispose) =>
_convertEventFunctionToStr(dispose)
),
}: Wonderjs.StateDataMainType.eventFunctionData
)
|> Obj.magic
|> Js.Json.stringify;

let _buildScriptEventFunctionData = ((editorState, engineState)) =>
ScriptEventFunctionNodeAssetEditorService.findAllScriptEventFunctionNodes(
editorState,
@@ -364,16 +339,15 @@ let _buildScriptEventFunctionData = ((editorState, engineState)) =>
name,
path,
eventFunctionDataStr:
_convertEventFunctionDataToStr(eventFunctionData),
Wonderjs.BuildSingleRABJsonDataSystem.convertEventFunctionDataToStr(
eventFunctionData,
),
}: ExportAssetType.scriptEventFunction,
);
},
[||],
);

let _convertAttributeToStr = attribute =>
attribute |> Obj.magic |> Js.Json.stringify;

let _buildScriptAttributeData = ((editorState, engineState)) =>
ScriptAttributeNodeAssetEditorService.findAllScriptAttributeNodes(
editorState,
@@ -389,7 +363,14 @@ let _buildScriptAttributeData = ((editorState, engineState)) =>
ScriptAttributeNodeAssetService.getNodeData(node);

(
{name, path, attributeStr: _convertAttributeToStr(attribute)}: ExportAssetType.scriptAttribute
{
name,
path,
attributeStr:
Wonderjs.BuildSingleRABJsonDataSystem.convertAttributeToStr(
attribute,
),
}: ExportAssetType.scriptAttribute
);
});

@@ -406,31 +406,6 @@ let _addScriptEventFunctionToAssetTree =
);
};

let _convertEventFunctionDataStrToRecord =
(eventFunctionDataStr: string)
: Wonderjs.StateDataMainType.eventFunctionData => {
open Wonderjs.StateDataMainType;

let {init, update, dispose} =
eventFunctionDataStr |> Js.Json.parseExn |> Obj.magic;

let initJsonData = init |> Obj.magic;
let updateJsonData = update |> Obj.magic;
let disposeJsonData = dispose |> Obj.magic;

{
init:
OptionService.isJsonSerializedValueNone(initJsonData) ?
None : Some(initJsonData |> SerializeService.deserializeFunction),
update:
OptionService.isJsonSerializedValueNone(updateJsonData) ?
None : Some(updateJsonData |> SerializeService.deserializeFunction),
dispose:
OptionService.isJsonSerializedValueNone(disposeJsonData) ?
None : Some(disposeJsonData |> SerializeService.deserializeFunction),
};
};

let buildScriptEventFunctionData =
(
{scriptEventFunctions}: ExportAssetType.assets,
@@ -445,7 +420,9 @@ let buildScriptEventFunctionData =
scriptEventFunctionIndex,
) => {
let eventFunctionData =
_convertEventFunctionDataStrToRecord(eventFunctionDataStr);
Wonderjs.AssembleABSystem.RAB.convertEventFunctionDataStrToRecord(
eventFunctionDataStr,
);

let editorState =
_addScriptEventFunctionToAssetTree(
@@ -490,10 +467,6 @@ let _addScriptAttributeToAssetTree =
);
};

let _convertAttributeStrToRecord =
attributeMapStr: Wonderjs.ScriptAttributeType.scriptAttribute =>
attributeMapStr |> Js.Json.parseExn |> Obj.magic;

let buildScriptAttributeData =
({scriptAttributes}: ExportAssetType.assets, engineState, editorState) =>
scriptAttributes
@@ -503,7 +476,10 @@ let buildScriptAttributeData =
{name, path, attributeStr}: ExportAssetType.scriptAttribute,
scriptAttributeIndex,
) => {
let attribute = _convertAttributeStrToRecord(attributeStr);
let attribute =
Wonderjs.AssembleABSystem.RAB.convertAttributeStrToRecord(
attributeStr,
);

let editorState =
_addScriptAttributeToAssetTree(

0 comments on commit dda7c6b

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