Skip to content
Permalink
Browse files

feat(asset-bundle): asset tree->add assetBundle node

add logic
  • Loading branch information...
yyc-git committed May 6, 2019
1 parent 2c34074 commit f0f289c499b79b8e42b8726500fea1441efbe504
Binary file not shown.
@@ -231,6 +231,7 @@ module Method = {
engineState,
);
},
~assetBundleNodeFunc=(parentFolderNode, acc, nodeId, nodeData) => acc,
~materialNodeFunc=
(
parentFolderNode,
@@ -238,6 +238,22 @@ module Method = {
/>
|> Result.SameDataResult.success;
},
/* TODO update assetBundle.png */
~assetBundleNodeFunc=
(nodeId, {name}) =>
<FileBox
key
uiState
dispatchFunc
dragImg
effectAllowd="move"
imgSrc="./public/img/assetBundle.png"
nodeId
fileName=name
widget
isSelected
/>
|> Result.SameDataResult.success,
~folderNodeFunc=
(nodeId, nodeData, children) => {
let name = FolderNodeAssetService.getNodeName(nodeData);
@@ -0,0 +1,36 @@
module Method = {};

let component = ReasonReact.statelessComponent("AssetBundleInspector");

let render = (name, type_, (onChangeFunc, onBlurFunc), _self) =>
<article className="inspector-asset-wdb">
<h1> {DomHelper.textEl("AssetBundle")} </h1>
<hr />
<div className="inspector-item">
<div className="item-header">
<span className=""> {DomHelper.textEl("Name:")} </span>
</div>
<div className="item-content">
<input
className="input-component float-input"
type_="text"
value=name
onChange=onChangeFunc
onBlur=onBlurFunc
/>
</div>
</div>
<div className="inspector-item">
<div className="item-header">
<span className=""> {DomHelper.textEl("Type:")} </span>
</div>
<div className="item-content">
<span className=""> {DomHelper.textEl(type_)} </span>
</div>
</div>
</article>;

let make = (~name, ~type_, ~onChangeFunc, ~onBlurFunc, _children) => {
...component,
render: _self => render(name, type_, (onChangeFunc, onBlurFunc), _self),
};
@@ -133,18 +133,22 @@ module Method = {
/>;

let buildWDBComponent =
(
(uiState, dispatchFunc),
(state, send),
currentNodeId,
{name, wdbGameObject},
) =>
((state, send), currentNodeId, {name, wdbGameObject}) =>
<WDBInspector
name={state.inputValue}
onChangeFunc={_e => send(change(_e))}
onBlurFunc={_e => send(Blur)}
/>;

/* TODO test */
let buildAssetBundleComponent = ((state, send), currentNodeId, nodeData) =>
<AssetBundleInspector
name={state.inputValue}
type_={AssetBundleNodeAssetService.getTypeStr(nodeData)}
onChangeFunc={_e => send(change(_e))}
onBlurFunc={_e => send(Blur)}
/>;

let showAssetNodeComponent =
(
reduxTuple,
@@ -160,7 +164,8 @@ module Method = {
buildScriptEventFunctionComponent(reduxTuple, state),
~scriptAttributeNodeFunc=
buildScriptAttributeComponent(reduxTuple, state),
~wdbNodeFunc=buildWDBComponent(reduxTuple, (state, send)),
~wdbNodeFunc=buildWDBComponent((state, send)),
~assetBundleNodeFunc=buildAssetBundleComponent((state, send)),
~folderNodeFunc=buildFolderComponent(state, send, languageType),
);

@@ -216,6 +221,12 @@ module Method = {

{inputValue: baseName, originalName: baseName};
};

let initAssetBundleName = (_currentNodeId, currentNodeData) => {
let baseName = AssetBundleNodeAssetService.getNodeName(currentNodeData);

{inputValue: baseName, originalName: baseName};
};
};

let component = ReasonReact.reducerComponent("AssetTreeInspector");
@@ -277,6 +288,7 @@ let make =
~scriptAttributeNodeFunc=
Method.initScriptAttributeNodeName(engineState),
~wdbNodeFunc=Method.initWDBName,
~assetBundleNodeFunc=Method.initAssetBundleName,
~folderNodeFunc=Method.initFolderName,
);
},
@@ -0,0 +1,26 @@
open TreeAssetType;

open NodeAssetType;

let getNodeName = ({name}: assetBundleNodeData) => name;

let getTypeStr = ({type_}: assetBundleNodeData) =>
switch (type_) {
| RAB => "RAB"
| SAB => "SAB"
| WAB => "WAB"
};

let buildNodeData = (~name, ~assetBundle, ~type_) => {
name,
assetBundle,
type_,
};

let buildNode = (~nodeId, ~name, ~assetBundle, ~type_) =>
AssetBundleNode(nodeId, buildNodeData(~name, ~assetBundle, ~type_));

let buildNodeByNodeData = (~nodeId, ~nodeData) =>
AssetBundleNode(nodeId, nodeData);

let rename = (~name, ~nodeData): assetBundleNodeData => {...nodeData, name};

0 comments on commit f0f289c

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