Skip to content

Commit

Permalink
feat(language): add camera group language
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyOrz committed Mar 15, 2019
1 parent 9ef009d commit 4fb0700
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,53 +65,73 @@ module Method = {
|> StateLogicService.getAndRefreshEngineStateWithFunc;

let buildNearComponent =
((uiState, dispatchFunc), currentGameObjectPerspectiveCamera) =>
(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
languageType,
) =>
<MainEditorFloatInputBaseComponent
label="Near"
getComponentValueFunc=(
title={
LanguageUtils.getInspectorLanguageDataByType(
"projection-near-describe",
languageType,
)
}
getComponentValueFunc={
PerspectiveCameraProjectionEngineService.getPerspectiveCameraNear(
currentGameObjectPerspectiveCamera,
)
)
changeComponentValueFunc=(
}
changeComponentValueFunc={
changeNear(currentGameObjectPerspectiveCamera)
)
blurValueFunc=(
}
blurValueFunc={
blurNearEvent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
)
dragDropFunc=(
}
dragDropFunc={
blurNearEvent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
)
}
/>;

let buildFarComponent =
((uiState, dispatchFunc), currentGameObjectPerspectiveCamera) =>
(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
languageType,
) =>
<MainEditorFloatInputBaseComponent
label="Far"
getComponentValueFunc=(
title={
LanguageUtils.getInspectorLanguageDataByType(
"projection-far-describe",
languageType,
)
}
getComponentValueFunc={
PerspectiveCameraProjectionEngineService.getPerspectiveCameraFar(
currentGameObjectPerspectiveCamera,
)
)
changeComponentValueFunc=(changeFar(currentGameObjectPerspectiveCamera))
blurValueFunc=(
}
changeComponentValueFunc={changeFar(currentGameObjectPerspectiveCamera)}
blurValueFunc={
blurFarEvent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
)
dragDropFunc=(
}
dragDropFunc={
blurFarEvent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
)
}
/>;

/* let buildAspectComponent =
Expand All @@ -135,29 +155,39 @@ module Method = {
/>; */

let buildFovyComponent =
((uiState, dispatchFunc), currentGameObjectPerspectiveCamera) =>
(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
languageType,
) =>
<MainEditorFloatInputBaseComponent
label="Fovy"
getComponentValueFunc=(
title={
LanguageUtils.getInspectorLanguageDataByType(
"projection-fovy-describe",
languageType,
)
}
getComponentValueFunc={
PerspectiveCameraProjectionEngineService.getPerspectiveCameraFovy(
currentGameObjectPerspectiveCamera,
)
)
changeComponentValueFunc=(
}
changeComponentValueFunc={
changeFovy(currentGameObjectPerspectiveCamera)
)
blurValueFunc=(
}
blurValueFunc={
blurFovyEvent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
)
dragDropFunc=(
}
dragDropFunc={
blurFovyEvent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
)
}
/>;
};

Expand All @@ -171,39 +201,50 @@ let render = ((uiState, dispatchFunc), _self) => {
SceneTreeEditorService.unsafeGetCurrentSceneTreeNode
|> StateLogicService.getEditorState,
);
let languageType =
LanguageUtils.getLanguageType(WindowType.window##wonderLanguage);

<article
key="MainEditorCameraProjection" className="wonder-camera-projection">
<Select
label="Type"
options=(MainEditorCameraProjectionUtils.getCameraProjectionOptions())
onChange=(value => ())
selectedKey=(PerspectiveCamera |> convertCameraProjectionTypeToInt)
title={
LanguageUtils.getInspectorLanguageDataByType(
"projection-type-describe",
languageType,
)
}
options={MainEditorCameraProjectionUtils.getCameraProjectionOptions()}
onChange={value => ()}
selectedKey={PerspectiveCamera |> convertCameraProjectionTypeToInt}
/>
(
{
Method.buildNearComponent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
languageType,
)
)
(
}
{
Method.buildFarComponent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
languageType,
)
)
}
/* (
Method.buildAspectComponent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
)
) */
(
{
Method.buildFovyComponent(
(uiState, dispatchFunc),
currentGameObjectPerspectiveCamera,
languageType,
)
)
}
</article>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,43 @@ let render = ((uiState, dispatchFunc), _self) => {
StateEditorService.getState(),
);

let languageType =
LanguageUtils.getLanguageType(WindowType.window##wonderLanguage);

<article key="MainEditorCameraView" className="wonder-camera-view">
<Select
label="Type"
options=(MainEditorCameraViewUtils.getCameraViewOptions())
selectedKey=(BasicCameraView |> convertCameraViewTypeToInt)
onChange=(value => ())
title={
LanguageUtils.getInspectorLanguageDataByType(
"view-type-describe",
languageType,
)
}
options={MainEditorCameraViewUtils.getCameraViewOptions()}
selectedKey={BasicCameraView |> convertCameraViewTypeToInt}
onChange={value => ()}
/>
<div className="inspector-item">
<div className="item-header"> (DomHelper.textEl("CurrentCamera")) </div>
<div
className="item-header"
title={
LanguageUtils.getInspectorLanguageDataByType(
"current-camera-describe",
languageType,
)
}>
{DomHelper.textEl("CurrentCamera")}
</div>
<div className="item-content">
<input
type_="checkbox"
defaultChecked=isCurrentCamera
onClick=(
onClick={
Method.setCurrentCamera(
(uiState, dispatchFunc),
currentSceneTreeNodeBasicCameraViewComponent,
)
)
}
disabled=isCurrentCamera
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
let component = ReasonReact.statelessComponent("MainEditorCameraGroup");

let render = ((uiState, dispatchFunc), _self) =>
let render = ((uiState, dispatchFunc), _self) => {
let languageType =
LanguageUtils.getLanguageType(WindowType.window##wonderLanguage);

<article key="MainEditorCameraGroup" className="wonder-camera-group">
<div className="inspector-component">
<div className="component-title"> (DomHelper.textEl("CameView")) </div>
<div
className="component-title"
title={
LanguageUtils.getInspectorLanguageDataByType(
"camera-view-describe",
languageType,
)
}>
{DomHelper.textEl("Camera View")}
</div>
<hr />
<div className="component-content">
<MainEditorCameraView uiState dispatchFunc />
</div>
</div>
<div className="inspector-component">
<div className="component-title">
(DomHelper.textEl("Projection"))
<div
className="component-title"
title={
LanguageUtils.getInspectorLanguageDataByType(
"camera-projection-describe",
languageType,
)
}>
{DomHelper.textEl("Projection")}
</div>
<hr />
<div className="component-content">
<MainEditorCameraProjection uiState dispatchFunc />
</div>
</div>
</article>;
};

let make = (~uiState, ~dispatchFunc, _children) => {
...component,
Expand Down
2 changes: 1 addition & 1 deletion src/core/config/data/LanguageInspectorData.re
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ let inspector_language_array = [|
},
},
{
title: "projection-describe",
title: "camera-projection-describe",
language: {
zh: {j|自定义名词|j},
en: "name for yourself",
Expand Down

0 comments on commit 4fb0700

Please sign in to comment.