mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15175 from FrostPolaris/v3_localizeManage
Add language localization support for Button, Text, TextField and TextBMFont. It's OK, merged
This commit is contained in:
commit
e46e392ff5
|
@ -3838,6 +3838,12 @@
|
|||
85505F0E1B60E3DB003F2CD4 /* SkeletonNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306741B60B5B2001E6D43 /* SkeletonNodeReader.h */; };
|
||||
85B3743A1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; };
|
||||
85B3743B1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; };
|
||||
94A6DF051C7303FD0094AEF7 /* LocalizationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A6DF031C7303FD0094AEF7 /* LocalizationManager.cpp */; };
|
||||
94A6DF061C7303FD0094AEF7 /* LocalizationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94A6DF041C7303FD0094AEF7 /* LocalizationManager.h */; };
|
||||
94A6DF071C73040D0094AEF7 /* LocalizationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A6DF031C7303FD0094AEF7 /* LocalizationManager.cpp */; };
|
||||
94A6DF081C73040E0094AEF7 /* LocalizationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A6DF031C7303FD0094AEF7 /* LocalizationManager.cpp */; };
|
||||
94A6DF091C7304120094AEF7 /* LocalizationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94A6DF041C7303FD0094AEF7 /* LocalizationManager.h */; };
|
||||
94A6DF0A1C7304120094AEF7 /* LocalizationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94A6DF041C7303FD0094AEF7 /* LocalizationManager.h */; };
|
||||
A045F6D61BA81577005076C7 /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6D41BA81577005076C7 /* CCTextureCube.cpp */; };
|
||||
A045F6D71BA81577005076C7 /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6D41BA81577005076C7 /* CCTextureCube.cpp */; };
|
||||
A045F6D81BA81577005076C7 /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6D51BA81577005076C7 /* CCTextureCube.h */; };
|
||||
|
@ -6717,6 +6723,8 @@
|
|||
5E9F61251A3FFE3D0038DE01 /* CCPlane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlane.h; sourceTree = "<group>"; };
|
||||
8525E3A11B291E42008EE815 /* clipper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = clipper.hpp; sourceTree = "<group>"; };
|
||||
85B374381B204B9400C488D6 /* clipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipper.cpp; sourceTree = "<group>"; };
|
||||
94A6DF031C7303FD0094AEF7 /* LocalizationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalizationManager.cpp; sourceTree = "<group>"; };
|
||||
94A6DF041C7303FD0094AEF7 /* LocalizationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizationManager.h; sourceTree = "<group>"; };
|
||||
A045F6D41BA81577005076C7 /* CCTextureCube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTextureCube.cpp; sourceTree = "<group>"; };
|
||||
A045F6D51BA81577005076C7 /* CCTextureCube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTextureCube.h; sourceTree = "<group>"; };
|
||||
A045F6DA1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCCameraBackgroundBrush.cpp; sourceTree = "<group>"; };
|
||||
|
@ -8510,6 +8518,8 @@
|
|||
1A8C5946180E930E00EF57C3 /* cocostudio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
94A6DF031C7303FD0094AEF7 /* LocalizationManager.cpp */,
|
||||
94A6DF041C7303FD0094AEF7 /* LocalizationManager.h */,
|
||||
382384021A259005002C4610 /* CSParseBinary_generated.h */,
|
||||
182C5CAD1A95961600C30D34 /* CSParse3DBinary_generated.h */,
|
||||
382384051A25900F002C4610 /* FlatBuffersSerialize.cpp */,
|
||||
|
@ -11339,6 +11349,7 @@
|
|||
15AE187F19AAD33D00C27E9E /* CCBKeyframe.h in Headers */,
|
||||
B665E2B41AA80A6500DDB1C5 /* CCPUForceField.h in Headers */,
|
||||
1A570073180BC5A10088DEC7 /* CCActionGrid.h in Headers */,
|
||||
94A6DF061C7303FD0094AEF7 /* LocalizationManager.h in Headers */,
|
||||
15AE1BCC19AAE01E00C27E9E /* CCControlButton.h in Headers */,
|
||||
B6CAB3D71AF9AA1A00B9B856 /* btSolve2LinearConstraint.h in Headers */,
|
||||
C50306771B60B5B2001E6D43 /* CSBoneBinary_generated.h in Headers */,
|
||||
|
@ -12267,6 +12278,7 @@
|
|||
507B3D3A1C31BDD30067B53E /* CCEventListenerAssetsManagerEx.h in Headers */,
|
||||
507B3D3B1C31BDD30067B53E /* btGpu3DGridBroadphase.h in Headers */,
|
||||
507B3D3C1C31BDD30067B53E /* CCAllocatorGlobal.h in Headers */,
|
||||
94A6DF0A1C7304120094AEF7 /* LocalizationManager.h in Headers */,
|
||||
507B3D3D1C31BDD30067B53E /* btSolverConstraint.h in Headers */,
|
||||
507B3D3E1C31BDD30067B53E /* SpuDoubleBuffer.h in Headers */,
|
||||
507B3D3F1C31BDD30067B53E /* CCPUScriptCompiler.h in Headers */,
|
||||
|
@ -13307,6 +13319,7 @@
|
|||
15B3708319EE414C00ABE682 /* CCEventListenerAssetsManagerEx.h in Headers */,
|
||||
B6CAB4361AF9AA1A00B9B856 /* btGpu3DGridBroadphase.h in Headers */,
|
||||
D0FD03521A3B51AA00825BB5 /* CCAllocatorGlobal.h in Headers */,
|
||||
94A6DF091C7304120094AEF7 /* LocalizationManager.h in Headers */,
|
||||
B6CAB3DC1AF9AA1A00B9B856 /* btSolverConstraint.h in Headers */,
|
||||
B6CAB4B61AF9AA1A00B9B856 /* SpuDoubleBuffer.h in Headers */,
|
||||
B665E3D11AA80A6600DDB1C5 /* CCPUScriptCompiler.h in Headers */,
|
||||
|
@ -14984,6 +14997,7 @@
|
|||
1A570354180BD0B00088DEC7 /* ioapi.cpp in Sources */,
|
||||
15B3707819EE414C00ABE682 /* AssetsManagerEx.cpp in Sources */,
|
||||
1A570358180BD0B00088DEC7 /* unzip.cpp in Sources */,
|
||||
94A6DF051C7303FD0094AEF7 /* LocalizationManager.cpp in Sources */,
|
||||
B665E3861AA80A6500DDB1C5 /* CCPUPathFollowerTranslator.cpp in Sources */,
|
||||
B29A7DCB19EE1B7700872B35 /* Skeleton.c in Sources */,
|
||||
15AE196E19AAD35700C27E9E /* CCActionTimelineCache.cpp in Sources */,
|
||||
|
@ -15829,6 +15843,7 @@
|
|||
507B3C141C31BDD30067B53E /* CCPUBoxCollider.cpp in Sources */,
|
||||
507B3C151C31BDD30067B53E /* CCPUMeshSurfaceEmitter.cpp in Sources */,
|
||||
507B3C161C31BDD30067B53E /* CCPUOnQuotaObserverTranslator.cpp in Sources */,
|
||||
94A6DF081C73040E0094AEF7 /* LocalizationManager.cpp in Sources */,
|
||||
507B3C171C31BDD30067B53E /* UIPageView.cpp in Sources */,
|
||||
507B3C181C31BDD30067B53E /* CCComponentContainer.cpp in Sources */,
|
||||
507B3C191C31BDD30067B53E /* ccCArray.cpp in Sources */,
|
||||
|
@ -16674,6 +16689,7 @@
|
|||
B665E22B1AA80A6500DDB1C5 /* CCPUBoxCollider.cpp in Sources */,
|
||||
B665E3031AA80A6500DDB1C5 /* CCPUMeshSurfaceEmitter.cpp in Sources */,
|
||||
B665E3571AA80A6500DDB1C5 /* CCPUOnQuotaObserverTranslator.cpp in Sources */,
|
||||
94A6DF071C73040D0094AEF7 /* LocalizationManager.cpp in Sources */,
|
||||
15AE1B7619AADA9A00C27E9E /* UIPageView.cpp in Sources */,
|
||||
1A570311180BCF190088DEC7 /* CCComponentContainer.cpp in Sources */,
|
||||
50ABBE2C1925AB6F00A911A9 /* ccCArray.cpp in Sources */,
|
||||
|
|
|
@ -526,6 +526,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\LocalizationManager.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\TriggerMng.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\TriggerObj.cpp" />
|
||||
|
@ -1132,6 +1133,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\FlatBuffersSerialize.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\LocalizationManager.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\TriggerBase.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\TriggerMng.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\TriggerObj.h" />
|
||||
|
|
|
@ -1950,6 +1950,9 @@
|
|||
<ClCompile Include="..\ui\UITabControl.cpp">
|
||||
<Filter>ui\UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\LocalizationManager.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -3809,6 +3812,9 @@
|
|||
<ClInclude Include="..\ui\UITabControl.h">
|
||||
<Filter>ui\UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\LocalizationManager.h">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -399,6 +399,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CSParse3DBinary_generated.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\DictionaryHelper.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\FlatBuffersSerialize.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\LocalizationManager.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerBase.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerMng.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerObj.h" />
|
||||
|
@ -1014,6 +1015,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\LocalizationManager.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerBase.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerMng.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerObj.cpp" />
|
||||
|
|
|
@ -1886,6 +1886,9 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\TabControlReader\TabControlReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\TabControlReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\LocalizationManager.h">
|
||||
<Filter>cocostudio\components</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos2d.cpp">
|
||||
|
@ -3604,6 +3607,9 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\TabControlReader\TabControlReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\TabControlReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\LocalizationManager.cpp">
|
||||
<Filter>cocostudio\components</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="2d">
|
||||
|
|
|
@ -509,6 +509,7 @@
|
|||
<ClCompile Include="..\..\editor-support\cocostudio\CocoStudio.cpp" />
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\LocalizationManager.cpp" />
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\TriggerBase.cpp" />
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\TriggerMng.cpp" />
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\TriggerObj.cpp" />
|
||||
|
@ -1127,6 +1128,7 @@
|
|||
<ClInclude Include="..\..\editor-support\cocostudio\CSParseBinary_generated.h" />
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\DictionaryHelper.h" />
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\FlatBuffersSerialize.h" />
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\LocalizationManager.h" />
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\TriggerBase.h" />
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\TriggerMng.h" />
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\TriggerObj.h" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resource Files">
|
||||
|
@ -1978,6 +1978,9 @@
|
|||
<ClCompile Include="..\..\editor-support\cocostudio\WidgetReader\Light3DReader\Light3DReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\Light3DReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\editor-support\cocostudio\LocalizationManager.cpp">
|
||||
<Filter>cocostudio\components</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\cocos2d.h" />
|
||||
|
@ -3863,6 +3866,9 @@
|
|||
<ClInclude Include="..\..\editor-support\cocostudio\WidgetReader\Light3DReader\Light3DReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\Light3DReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\editor-support\cocostudio\LocalizationManager.h">
|
||||
<Filter>cocostudio\components</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\base\CCController-iOS.mm">
|
||||
|
@ -4023,4 +4029,4 @@
|
|||
<Filter>3d</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -34,6 +34,7 @@ CCComController.cpp \
|
|||
CCComRender.cpp \
|
||||
CCInputDelegate.cpp \
|
||||
DictionaryHelper.cpp \
|
||||
LocalizationManager.cpp \
|
||||
CCSGUIReader.cpp \
|
||||
CCSSceneReader.cpp \
|
||||
TriggerBase.cpp \
|
||||
|
|
|
@ -39,6 +39,7 @@ set(COCOS_CS_SRC
|
|||
editor-support/cocostudio/CCUtilMath.cpp
|
||||
editor-support/cocostudio/CocoLoader.cpp
|
||||
editor-support/cocostudio/DictionaryHelper.cpp
|
||||
editor-support/cocostudio/LocalizationManager.cpp
|
||||
editor-support/cocostudio/TriggerBase.cpp
|
||||
editor-support/cocostudio/TriggerMng.cpp
|
||||
editor-support/cocostudio/TriggerObj.cpp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_CSPARSEBINARY_FLATBUFFERS_H_
|
||||
#define FLATBUFFERS_GENERATED_CSPARSEBINARY_FLATBUFFERS_H_
|
||||
|
@ -721,21 +721,22 @@ struct ButtonOptions : private flatbuffers::Table {
|
|||
const ResourceData *disabledData() const { return GetPointer<const ResourceData *>(10); }
|
||||
const ResourceData *fontResource() const { return GetPointer<const ResourceData *>(12); }
|
||||
const flatbuffers::String *text() const { return GetPointer<const flatbuffers::String *>(14); }
|
||||
const flatbuffers::String *fontName() const { return GetPointer<const flatbuffers::String *>(16); }
|
||||
int32_t fontSize() const { return GetField<int32_t>(18, 0); }
|
||||
const Color *textColor() const { return GetStruct<const Color *>(20); }
|
||||
const CapInsets *capInsets() const { return GetStruct<const CapInsets *>(22); }
|
||||
const FlatSize *scale9Size() const { return GetStruct<const FlatSize *>(24); }
|
||||
uint8_t scale9Enabled() const { return GetField<uint8_t>(26, 0); }
|
||||
uint8_t displaystate() const { return GetField<uint8_t>(28, 1); }
|
||||
uint8_t outlineEnabled() const { return GetField<uint8_t>(30, 0); }
|
||||
const Color *outlineColor() const { return GetStruct<const Color *>(32); }
|
||||
int32_t outlineSize() const { return GetField<int32_t>(34, 1); }
|
||||
uint8_t shadowEnabled() const { return GetField<uint8_t>(36, 0); }
|
||||
const Color *shadowColor() const { return GetStruct<const Color *>(38); }
|
||||
float shadowOffsetX() const { return GetField<float>(40, 2); }
|
||||
float shadowOffsetY() const { return GetField<float>(42, -2); }
|
||||
int32_t shadowBlurRadius() const { return GetField<int32_t>(44, 0); }
|
||||
uint8_t isLocalized() const { return GetField<uint8_t>(16, 0); }
|
||||
const flatbuffers::String *fontName() const { return GetPointer<const flatbuffers::String *>(18); }
|
||||
int32_t fontSize() const { return GetField<int32_t>(20, 0); }
|
||||
const Color *textColor() const { return GetStruct<const Color *>(22); }
|
||||
const CapInsets *capInsets() const { return GetStruct<const CapInsets *>(24); }
|
||||
const FlatSize *scale9Size() const { return GetStruct<const FlatSize *>(26); }
|
||||
uint8_t scale9Enabled() const { return GetField<uint8_t>(28, 0); }
|
||||
uint8_t displaystate() const { return GetField<uint8_t>(30, 1); }
|
||||
uint8_t outlineEnabled() const { return GetField<uint8_t>(32, 0); }
|
||||
const Color *outlineColor() const { return GetStruct<const Color *>(34); }
|
||||
int32_t outlineSize() const { return GetField<int32_t>(36, 1); }
|
||||
uint8_t shadowEnabled() const { return GetField<uint8_t>(38, 0); }
|
||||
const Color *shadowColor() const { return GetStruct<const Color *>(40); }
|
||||
float shadowOffsetX() const { return GetField<float>(42, 2); }
|
||||
float shadowOffsetY() const { return GetField<float>(44, -2); }
|
||||
int32_t shadowBlurRadius() const { return GetField<int32_t>(46, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
|
||||
|
@ -750,22 +751,23 @@ struct ButtonOptions : private flatbuffers::Table {
|
|||
verifier.VerifyTable(fontResource()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* text */) &&
|
||||
verifier.Verify(text()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* fontName */) &&
|
||||
VerifyField<uint8_t>(verifier, 16 /* isLocalized */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* fontName */) &&
|
||||
verifier.Verify(fontName()) &&
|
||||
VerifyField<int32_t>(verifier, 18 /* fontSize */) &&
|
||||
VerifyField<Color>(verifier, 20 /* textColor */) &&
|
||||
VerifyField<CapInsets>(verifier, 22 /* capInsets */) &&
|
||||
VerifyField<FlatSize>(verifier, 24 /* scale9Size */) &&
|
||||
VerifyField<uint8_t>(verifier, 26 /* scale9Enabled */) &&
|
||||
VerifyField<uint8_t>(verifier, 28 /* displaystate */) &&
|
||||
VerifyField<uint8_t>(verifier, 30 /* outlineEnabled */) &&
|
||||
VerifyField<Color>(verifier, 32 /* outlineColor */) &&
|
||||
VerifyField<int32_t>(verifier, 34 /* outlineSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 36 /* shadowEnabled */) &&
|
||||
VerifyField<Color>(verifier, 38 /* shadowColor */) &&
|
||||
VerifyField<float>(verifier, 40 /* shadowOffsetX */) &&
|
||||
VerifyField<float>(verifier, 42 /* shadowOffsetY */) &&
|
||||
VerifyField<int32_t>(verifier, 44 /* shadowBlurRadius */) &&
|
||||
VerifyField<int32_t>(verifier, 20 /* fontSize */) &&
|
||||
VerifyField<Color>(verifier, 22 /* textColor */) &&
|
||||
VerifyField<CapInsets>(verifier, 24 /* capInsets */) &&
|
||||
VerifyField<FlatSize>(verifier, 26 /* scale9Size */) &&
|
||||
VerifyField<uint8_t>(verifier, 28 /* scale9Enabled */) &&
|
||||
VerifyField<uint8_t>(verifier, 30 /* displaystate */) &&
|
||||
VerifyField<uint8_t>(verifier, 32 /* outlineEnabled */) &&
|
||||
VerifyField<Color>(verifier, 34 /* outlineColor */) &&
|
||||
VerifyField<int32_t>(verifier, 36 /* outlineSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 38 /* shadowEnabled */) &&
|
||||
VerifyField<Color>(verifier, 40 /* shadowColor */) &&
|
||||
VerifyField<float>(verifier, 42 /* shadowOffsetX */) &&
|
||||
VerifyField<float>(verifier, 44 /* shadowOffsetY */) &&
|
||||
VerifyField<int32_t>(verifier, 46 /* shadowBlurRadius */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -779,25 +781,26 @@ struct ButtonOptionsBuilder {
|
|||
void add_disabledData(flatbuffers::Offset<ResourceData> disabledData) { fbb_.AddOffset(10, disabledData); }
|
||||
void add_fontResource(flatbuffers::Offset<ResourceData> fontResource) { fbb_.AddOffset(12, fontResource); }
|
||||
void add_text(flatbuffers::Offset<flatbuffers::String> text) { fbb_.AddOffset(14, text); }
|
||||
void add_fontName(flatbuffers::Offset<flatbuffers::String> fontName) { fbb_.AddOffset(16, fontName); }
|
||||
void add_fontSize(int32_t fontSize) { fbb_.AddElement<int32_t>(18, fontSize, 0); }
|
||||
void add_textColor(const Color *textColor) { fbb_.AddStruct(20, textColor); }
|
||||
void add_capInsets(const CapInsets *capInsets) { fbb_.AddStruct(22, capInsets); }
|
||||
void add_scale9Size(const FlatSize *scale9Size) { fbb_.AddStruct(24, scale9Size); }
|
||||
void add_scale9Enabled(uint8_t scale9Enabled) { fbb_.AddElement<uint8_t>(26, scale9Enabled, 0); }
|
||||
void add_displaystate(uint8_t displaystate) { fbb_.AddElement<uint8_t>(28, displaystate, 1); }
|
||||
void add_outlineEnabled(uint8_t outlineEnabled) { fbb_.AddElement<uint8_t>(30, outlineEnabled, 0); }
|
||||
void add_outlineColor(const Color *outlineColor) { fbb_.AddStruct(32, outlineColor); }
|
||||
void add_outlineSize(int32_t outlineSize) { fbb_.AddElement<int32_t>(34, outlineSize, 1); }
|
||||
void add_shadowEnabled(uint8_t shadowEnabled) { fbb_.AddElement<uint8_t>(36, shadowEnabled, 0); }
|
||||
void add_shadowColor(const Color *shadowColor) { fbb_.AddStruct(38, shadowColor); }
|
||||
void add_shadowOffsetX(float shadowOffsetX) { fbb_.AddElement<float>(40, shadowOffsetX, 2); }
|
||||
void add_shadowOffsetY(float shadowOffsetY) { fbb_.AddElement<float>(42, shadowOffsetY, -2); }
|
||||
void add_shadowBlurRadius(int32_t shadowBlurRadius) { fbb_.AddElement<int32_t>(44, shadowBlurRadius, 0); }
|
||||
void add_isLocalized(uint8_t isLocalized) { fbb_.AddElement<uint8_t>(16, isLocalized, 0); }
|
||||
void add_fontName(flatbuffers::Offset<flatbuffers::String> fontName) { fbb_.AddOffset(18, fontName); }
|
||||
void add_fontSize(int32_t fontSize) { fbb_.AddElement<int32_t>(20, fontSize, 0); }
|
||||
void add_textColor(const Color *textColor) { fbb_.AddStruct(22, textColor); }
|
||||
void add_capInsets(const CapInsets *capInsets) { fbb_.AddStruct(24, capInsets); }
|
||||
void add_scale9Size(const FlatSize *scale9Size) { fbb_.AddStruct(26, scale9Size); }
|
||||
void add_scale9Enabled(uint8_t scale9Enabled) { fbb_.AddElement<uint8_t>(28, scale9Enabled, 0); }
|
||||
void add_displaystate(uint8_t displaystate) { fbb_.AddElement<uint8_t>(30, displaystate, 1); }
|
||||
void add_outlineEnabled(uint8_t outlineEnabled) { fbb_.AddElement<uint8_t>(32, outlineEnabled, 0); }
|
||||
void add_outlineColor(const Color *outlineColor) { fbb_.AddStruct(34, outlineColor); }
|
||||
void add_outlineSize(int32_t outlineSize) { fbb_.AddElement<int32_t>(36, outlineSize, 1); }
|
||||
void add_shadowEnabled(uint8_t shadowEnabled) { fbb_.AddElement<uint8_t>(38, shadowEnabled, 0); }
|
||||
void add_shadowColor(const Color *shadowColor) { fbb_.AddStruct(40, shadowColor); }
|
||||
void add_shadowOffsetX(float shadowOffsetX) { fbb_.AddElement<float>(42, shadowOffsetX, 2); }
|
||||
void add_shadowOffsetY(float shadowOffsetY) { fbb_.AddElement<float>(44, shadowOffsetY, -2); }
|
||||
void add_shadowBlurRadius(int32_t shadowBlurRadius) { fbb_.AddElement<int32_t>(46, shadowBlurRadius, 0); }
|
||||
ButtonOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
ButtonOptionsBuilder &operator=(const ButtonOptionsBuilder &);
|
||||
flatbuffers::Offset<ButtonOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<ButtonOptions>(fbb_.EndTable(start_, 21));
|
||||
auto o = flatbuffers::Offset<ButtonOptions>(fbb_.EndTable(start_, 22));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -809,6 +812,7 @@ inline flatbuffers::Offset<ButtonOptions> CreateButtonOptions(flatbuffers::FlatB
|
|||
flatbuffers::Offset<ResourceData> disabledData = 0,
|
||||
flatbuffers::Offset<ResourceData> fontResource = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> text = 0,
|
||||
uint8_t isLocalized = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> fontName = 0,
|
||||
int32_t fontSize = 0,
|
||||
const Color *textColor = 0,
|
||||
|
@ -846,6 +850,7 @@ inline flatbuffers::Offset<ButtonOptions> CreateButtonOptions(flatbuffers::FlatB
|
|||
builder_.add_outlineEnabled(outlineEnabled);
|
||||
builder_.add_displaystate(displaystate);
|
||||
builder_.add_scale9Enabled(scale9Enabled);
|
||||
builder_.add_isLocalized(isLocalized);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
|
@ -1029,6 +1034,7 @@ struct TextBMFontOptions : private flatbuffers::Table {
|
|||
const WidgetOptions *widgetOptions() const { return GetPointer<const WidgetOptions *>(4); }
|
||||
const ResourceData *fileNameData() const { return GetPointer<const ResourceData *>(6); }
|
||||
const flatbuffers::String *text() const { return GetPointer<const flatbuffers::String *>(8); }
|
||||
uint8_t isLocalized() const { return GetField<uint8_t>(10, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
|
||||
|
@ -1037,6 +1043,7 @@ struct TextBMFontOptions : private flatbuffers::Table {
|
|||
verifier.VerifyTable(fileNameData()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* text */) &&
|
||||
verifier.Verify(text()) &&
|
||||
VerifyField<uint8_t>(verifier, 10 /* isLocalized */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -1047,10 +1054,11 @@ struct TextBMFontOptionsBuilder {
|
|||
void add_widgetOptions(flatbuffers::Offset<WidgetOptions> widgetOptions) { fbb_.AddOffset(4, widgetOptions); }
|
||||
void add_fileNameData(flatbuffers::Offset<ResourceData> fileNameData) { fbb_.AddOffset(6, fileNameData); }
|
||||
void add_text(flatbuffers::Offset<flatbuffers::String> text) { fbb_.AddOffset(8, text); }
|
||||
void add_isLocalized(uint8_t isLocalized) { fbb_.AddElement<uint8_t>(10, isLocalized, 0); }
|
||||
TextBMFontOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
TextBMFontOptionsBuilder &operator=(const TextBMFontOptionsBuilder &);
|
||||
flatbuffers::Offset<TextBMFontOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<TextBMFontOptions>(fbb_.EndTable(start_, 3));
|
||||
auto o = flatbuffers::Offset<TextBMFontOptions>(fbb_.EndTable(start_, 4));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -1058,11 +1066,13 @@ struct TextBMFontOptionsBuilder {
|
|||
inline flatbuffers::Offset<TextBMFontOptions> CreateTextBMFontOptions(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<WidgetOptions> widgetOptions = 0,
|
||||
flatbuffers::Offset<ResourceData> fileNameData = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> text = 0) {
|
||||
flatbuffers::Offset<flatbuffers::String> text = 0,
|
||||
uint8_t isLocalized = 0) {
|
||||
TextBMFontOptionsBuilder builder_(_fbb);
|
||||
builder_.add_text(text);
|
||||
builder_.add_fileNameData(fileNameData);
|
||||
builder_.add_widgetOptions(widgetOptions);
|
||||
builder_.add_isLocalized(isLocalized);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
|
@ -1072,20 +1082,21 @@ struct TextOptions : private flatbuffers::Table {
|
|||
const flatbuffers::String *fontName() const { return GetPointer<const flatbuffers::String *>(8); }
|
||||
int32_t fontSize() const { return GetField<int32_t>(10, 0); }
|
||||
const flatbuffers::String *text() const { return GetPointer<const flatbuffers::String *>(12); }
|
||||
int32_t areaWidth() const { return GetField<int32_t>(14, 0); }
|
||||
int32_t areaHeight() const { return GetField<int32_t>(16, 0); }
|
||||
int32_t hAlignment() const { return GetField<int32_t>(18, 0); }
|
||||
int32_t vAlignment() const { return GetField<int32_t>(20, 0); }
|
||||
uint8_t touchScaleEnable() const { return GetField<uint8_t>(22, 0); }
|
||||
uint8_t isCustomSize() const { return GetField<uint8_t>(24, 0); }
|
||||
uint8_t outlineEnabled() const { return GetField<uint8_t>(26, 0); }
|
||||
const Color *outlineColor() const { return GetStruct<const Color *>(28); }
|
||||
int32_t outlineSize() const { return GetField<int32_t>(30, 1); }
|
||||
uint8_t shadowEnabled() const { return GetField<uint8_t>(32, 0); }
|
||||
const Color *shadowColor() const { return GetStruct<const Color *>(34); }
|
||||
float shadowOffsetX() const { return GetField<float>(36, 2); }
|
||||
float shadowOffsetY() const { return GetField<float>(38, -2); }
|
||||
int32_t shadowBlurRadius() const { return GetField<int32_t>(40, 0); }
|
||||
uint8_t isLocalized() const { return GetField<uint8_t>(14, 0); }
|
||||
int32_t areaWidth() const { return GetField<int32_t>(16, 0); }
|
||||
int32_t areaHeight() const { return GetField<int32_t>(18, 0); }
|
||||
int32_t hAlignment() const { return GetField<int32_t>(20, 0); }
|
||||
int32_t vAlignment() const { return GetField<int32_t>(22, 0); }
|
||||
uint8_t touchScaleEnable() const { return GetField<uint8_t>(24, 0); }
|
||||
uint8_t isCustomSize() const { return GetField<uint8_t>(26, 0); }
|
||||
uint8_t outlineEnabled() const { return GetField<uint8_t>(28, 0); }
|
||||
const Color *outlineColor() const { return GetStruct<const Color *>(30); }
|
||||
int32_t outlineSize() const { return GetField<int32_t>(32, 1); }
|
||||
uint8_t shadowEnabled() const { return GetField<uint8_t>(34, 0); }
|
||||
const Color *shadowColor() const { return GetStruct<const Color *>(36); }
|
||||
float shadowOffsetX() const { return GetField<float>(38, 2); }
|
||||
float shadowOffsetY() const { return GetField<float>(40, -2); }
|
||||
int32_t shadowBlurRadius() const { return GetField<int32_t>(42, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
|
||||
|
@ -1097,20 +1108,21 @@ struct TextOptions : private flatbuffers::Table {
|
|||
VerifyField<int32_t>(verifier, 10 /* fontSize */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* text */) &&
|
||||
verifier.Verify(text()) &&
|
||||
VerifyField<int32_t>(verifier, 14 /* areaWidth */) &&
|
||||
VerifyField<int32_t>(verifier, 16 /* areaHeight */) &&
|
||||
VerifyField<int32_t>(verifier, 18 /* hAlignment */) &&
|
||||
VerifyField<int32_t>(verifier, 20 /* vAlignment */) &&
|
||||
VerifyField<uint8_t>(verifier, 22 /* touchScaleEnable */) &&
|
||||
VerifyField<uint8_t>(verifier, 24 /* isCustomSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 26 /* outlineEnabled */) &&
|
||||
VerifyField<Color>(verifier, 28 /* outlineColor */) &&
|
||||
VerifyField<int32_t>(verifier, 30 /* outlineSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 32 /* shadowEnabled */) &&
|
||||
VerifyField<Color>(verifier, 34 /* shadowColor */) &&
|
||||
VerifyField<float>(verifier, 36 /* shadowOffsetX */) &&
|
||||
VerifyField<float>(verifier, 38 /* shadowOffsetY */) &&
|
||||
VerifyField<int32_t>(verifier, 40 /* shadowBlurRadius */) &&
|
||||
VerifyField<uint8_t>(verifier, 14 /* isLocalized */) &&
|
||||
VerifyField<int32_t>(verifier, 16 /* areaWidth */) &&
|
||||
VerifyField<int32_t>(verifier, 18 /* areaHeight */) &&
|
||||
VerifyField<int32_t>(verifier, 20 /* hAlignment */) &&
|
||||
VerifyField<int32_t>(verifier, 22 /* vAlignment */) &&
|
||||
VerifyField<uint8_t>(verifier, 24 /* touchScaleEnable */) &&
|
||||
VerifyField<uint8_t>(verifier, 26 /* isCustomSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 28 /* outlineEnabled */) &&
|
||||
VerifyField<Color>(verifier, 30 /* outlineColor */) &&
|
||||
VerifyField<int32_t>(verifier, 32 /* outlineSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 34 /* shadowEnabled */) &&
|
||||
VerifyField<Color>(verifier, 36 /* shadowColor */) &&
|
||||
VerifyField<float>(verifier, 38 /* shadowOffsetX */) &&
|
||||
VerifyField<float>(verifier, 40 /* shadowOffsetY */) &&
|
||||
VerifyField<int32_t>(verifier, 42 /* shadowBlurRadius */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -1123,24 +1135,25 @@ struct TextOptionsBuilder {
|
|||
void add_fontName(flatbuffers::Offset<flatbuffers::String> fontName) { fbb_.AddOffset(8, fontName); }
|
||||
void add_fontSize(int32_t fontSize) { fbb_.AddElement<int32_t>(10, fontSize, 0); }
|
||||
void add_text(flatbuffers::Offset<flatbuffers::String> text) { fbb_.AddOffset(12, text); }
|
||||
void add_areaWidth(int32_t areaWidth) { fbb_.AddElement<int32_t>(14, areaWidth, 0); }
|
||||
void add_areaHeight(int32_t areaHeight) { fbb_.AddElement<int32_t>(16, areaHeight, 0); }
|
||||
void add_hAlignment(int32_t hAlignment) { fbb_.AddElement<int32_t>(18, hAlignment, 0); }
|
||||
void add_vAlignment(int32_t vAlignment) { fbb_.AddElement<int32_t>(20, vAlignment, 0); }
|
||||
void add_touchScaleEnable(uint8_t touchScaleEnable) { fbb_.AddElement<uint8_t>(22, touchScaleEnable, 0); }
|
||||
void add_isCustomSize(uint8_t isCustomSize) { fbb_.AddElement<uint8_t>(24, isCustomSize, 0); }
|
||||
void add_outlineEnabled(uint8_t outlineEnabled) { fbb_.AddElement<uint8_t>(26, outlineEnabled, 0); }
|
||||
void add_outlineColor(const Color *outlineColor) { fbb_.AddStruct(28, outlineColor); }
|
||||
void add_outlineSize(int32_t outlineSize) { fbb_.AddElement<int32_t>(30, outlineSize, 1); }
|
||||
void add_shadowEnabled(uint8_t shadowEnabled) { fbb_.AddElement<uint8_t>(32, shadowEnabled, 0); }
|
||||
void add_shadowColor(const Color *shadowColor) { fbb_.AddStruct(34, shadowColor); }
|
||||
void add_shadowOffsetX(float shadowOffsetX) { fbb_.AddElement<float>(36, shadowOffsetX, 2); }
|
||||
void add_shadowOffsetY(float shadowOffsetY) { fbb_.AddElement<float>(38, shadowOffsetY, -2); }
|
||||
void add_shadowBlurRadius(int32_t shadowBlurRadius) { fbb_.AddElement<int32_t>(40, shadowBlurRadius, 0); }
|
||||
void add_isLocalized(uint8_t isLocalized) { fbb_.AddElement<uint8_t>(14, isLocalized, 0); }
|
||||
void add_areaWidth(int32_t areaWidth) { fbb_.AddElement<int32_t>(16, areaWidth, 0); }
|
||||
void add_areaHeight(int32_t areaHeight) { fbb_.AddElement<int32_t>(18, areaHeight, 0); }
|
||||
void add_hAlignment(int32_t hAlignment) { fbb_.AddElement<int32_t>(20, hAlignment, 0); }
|
||||
void add_vAlignment(int32_t vAlignment) { fbb_.AddElement<int32_t>(22, vAlignment, 0); }
|
||||
void add_touchScaleEnable(uint8_t touchScaleEnable) { fbb_.AddElement<uint8_t>(24, touchScaleEnable, 0); }
|
||||
void add_isCustomSize(uint8_t isCustomSize) { fbb_.AddElement<uint8_t>(26, isCustomSize, 0); }
|
||||
void add_outlineEnabled(uint8_t outlineEnabled) { fbb_.AddElement<uint8_t>(28, outlineEnabled, 0); }
|
||||
void add_outlineColor(const Color *outlineColor) { fbb_.AddStruct(30, outlineColor); }
|
||||
void add_outlineSize(int32_t outlineSize) { fbb_.AddElement<int32_t>(32, outlineSize, 1); }
|
||||
void add_shadowEnabled(uint8_t shadowEnabled) { fbb_.AddElement<uint8_t>(34, shadowEnabled, 0); }
|
||||
void add_shadowColor(const Color *shadowColor) { fbb_.AddStruct(36, shadowColor); }
|
||||
void add_shadowOffsetX(float shadowOffsetX) { fbb_.AddElement<float>(38, shadowOffsetX, 2); }
|
||||
void add_shadowOffsetY(float shadowOffsetY) { fbb_.AddElement<float>(40, shadowOffsetY, -2); }
|
||||
void add_shadowBlurRadius(int32_t shadowBlurRadius) { fbb_.AddElement<int32_t>(42, shadowBlurRadius, 0); }
|
||||
TextOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
TextOptionsBuilder &operator=(const TextOptionsBuilder &);
|
||||
flatbuffers::Offset<TextOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<TextOptions>(fbb_.EndTable(start_, 19));
|
||||
auto o = flatbuffers::Offset<TextOptions>(fbb_.EndTable(start_, 20));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -1151,6 +1164,7 @@ inline flatbuffers::Offset<TextOptions> CreateTextOptions(flatbuffers::FlatBuffe
|
|||
flatbuffers::Offset<flatbuffers::String> fontName = 0,
|
||||
int32_t fontSize = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> text = 0,
|
||||
uint8_t isLocalized = 0,
|
||||
int32_t areaWidth = 0,
|
||||
int32_t areaHeight = 0,
|
||||
int32_t hAlignment = 0,
|
||||
|
@ -1185,6 +1199,7 @@ inline flatbuffers::Offset<TextOptions> CreateTextOptions(flatbuffers::FlatBuffe
|
|||
builder_.add_outlineEnabled(outlineEnabled);
|
||||
builder_.add_isCustomSize(isCustomSize);
|
||||
builder_.add_touchScaleEnable(touchScaleEnable);
|
||||
builder_.add_isLocalized(isLocalized);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
|
@ -1194,14 +1209,15 @@ struct TextFieldOptions : private flatbuffers::Table {
|
|||
const flatbuffers::String *fontName() const { return GetPointer<const flatbuffers::String *>(8); }
|
||||
int32_t fontSize() const { return GetField<int32_t>(10, 0); }
|
||||
const flatbuffers::String *text() const { return GetPointer<const flatbuffers::String *>(12); }
|
||||
const flatbuffers::String *placeHolder() const { return GetPointer<const flatbuffers::String *>(14); }
|
||||
uint8_t passwordEnabled() const { return GetField<uint8_t>(16, 0); }
|
||||
const flatbuffers::String *passwordStyleText() const { return GetPointer<const flatbuffers::String *>(18); }
|
||||
uint8_t maxLengthEnabled() const { return GetField<uint8_t>(20, 0); }
|
||||
int32_t maxLength() const { return GetField<int32_t>(22, 0); }
|
||||
int32_t areaWidth() const { return GetField<int32_t>(24, 0); }
|
||||
int32_t areaHeight() const { return GetField<int32_t>(26, 0); }
|
||||
uint8_t isCustomSize() const { return GetField<uint8_t>(28, 0); }
|
||||
uint8_t isLocalized() const { return GetField<uint8_t>(14, 0); }
|
||||
const flatbuffers::String *placeHolder() const { return GetPointer<const flatbuffers::String *>(16); }
|
||||
uint8_t passwordEnabled() const { return GetField<uint8_t>(18, 0); }
|
||||
const flatbuffers::String *passwordStyleText() const { return GetPointer<const flatbuffers::String *>(20); }
|
||||
uint8_t maxLengthEnabled() const { return GetField<uint8_t>(22, 0); }
|
||||
int32_t maxLength() const { return GetField<int32_t>(24, 0); }
|
||||
int32_t areaWidth() const { return GetField<int32_t>(26, 0); }
|
||||
int32_t areaHeight() const { return GetField<int32_t>(28, 0); }
|
||||
uint8_t isCustomSize() const { return GetField<uint8_t>(30, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
|
||||
|
@ -1213,16 +1229,17 @@ struct TextFieldOptions : private flatbuffers::Table {
|
|||
VerifyField<int32_t>(verifier, 10 /* fontSize */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* text */) &&
|
||||
verifier.Verify(text()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* placeHolder */) &&
|
||||
VerifyField<uint8_t>(verifier, 14 /* isLocalized */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* placeHolder */) &&
|
||||
verifier.Verify(placeHolder()) &&
|
||||
VerifyField<uint8_t>(verifier, 16 /* passwordEnabled */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* passwordStyleText */) &&
|
||||
VerifyField<uint8_t>(verifier, 18 /* passwordEnabled */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 20 /* passwordStyleText */) &&
|
||||
verifier.Verify(passwordStyleText()) &&
|
||||
VerifyField<uint8_t>(verifier, 20 /* maxLengthEnabled */) &&
|
||||
VerifyField<int32_t>(verifier, 22 /* maxLength */) &&
|
||||
VerifyField<int32_t>(verifier, 24 /* areaWidth */) &&
|
||||
VerifyField<int32_t>(verifier, 26 /* areaHeight */) &&
|
||||
VerifyField<uint8_t>(verifier, 28 /* isCustomSize */) &&
|
||||
VerifyField<uint8_t>(verifier, 22 /* maxLengthEnabled */) &&
|
||||
VerifyField<int32_t>(verifier, 24 /* maxLength */) &&
|
||||
VerifyField<int32_t>(verifier, 26 /* areaWidth */) &&
|
||||
VerifyField<int32_t>(verifier, 28 /* areaHeight */) &&
|
||||
VerifyField<uint8_t>(verifier, 30 /* isCustomSize */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -1235,18 +1252,19 @@ struct TextFieldOptionsBuilder {
|
|||
void add_fontName(flatbuffers::Offset<flatbuffers::String> fontName) { fbb_.AddOffset(8, fontName); }
|
||||
void add_fontSize(int32_t fontSize) { fbb_.AddElement<int32_t>(10, fontSize, 0); }
|
||||
void add_text(flatbuffers::Offset<flatbuffers::String> text) { fbb_.AddOffset(12, text); }
|
||||
void add_placeHolder(flatbuffers::Offset<flatbuffers::String> placeHolder) { fbb_.AddOffset(14, placeHolder); }
|
||||
void add_passwordEnabled(uint8_t passwordEnabled) { fbb_.AddElement<uint8_t>(16, passwordEnabled, 0); }
|
||||
void add_passwordStyleText(flatbuffers::Offset<flatbuffers::String> passwordStyleText) { fbb_.AddOffset(18, passwordStyleText); }
|
||||
void add_maxLengthEnabled(uint8_t maxLengthEnabled) { fbb_.AddElement<uint8_t>(20, maxLengthEnabled, 0); }
|
||||
void add_maxLength(int32_t maxLength) { fbb_.AddElement<int32_t>(22, maxLength, 0); }
|
||||
void add_areaWidth(int32_t areaWidth) { fbb_.AddElement<int32_t>(24, areaWidth, 0); }
|
||||
void add_areaHeight(int32_t areaHeight) { fbb_.AddElement<int32_t>(26, areaHeight, 0); }
|
||||
void add_isCustomSize(uint8_t isCustomSize) { fbb_.AddElement<uint8_t>(28, isCustomSize, 0); }
|
||||
void add_isLocalized(uint8_t isLocalized) { fbb_.AddElement<uint8_t>(14, isLocalized, 0); }
|
||||
void add_placeHolder(flatbuffers::Offset<flatbuffers::String> placeHolder) { fbb_.AddOffset(16, placeHolder); }
|
||||
void add_passwordEnabled(uint8_t passwordEnabled) { fbb_.AddElement<uint8_t>(18, passwordEnabled, 0); }
|
||||
void add_passwordStyleText(flatbuffers::Offset<flatbuffers::String> passwordStyleText) { fbb_.AddOffset(20, passwordStyleText); }
|
||||
void add_maxLengthEnabled(uint8_t maxLengthEnabled) { fbb_.AddElement<uint8_t>(22, maxLengthEnabled, 0); }
|
||||
void add_maxLength(int32_t maxLength) { fbb_.AddElement<int32_t>(24, maxLength, 0); }
|
||||
void add_areaWidth(int32_t areaWidth) { fbb_.AddElement<int32_t>(26, areaWidth, 0); }
|
||||
void add_areaHeight(int32_t areaHeight) { fbb_.AddElement<int32_t>(28, areaHeight, 0); }
|
||||
void add_isCustomSize(uint8_t isCustomSize) { fbb_.AddElement<uint8_t>(30, isCustomSize, 0); }
|
||||
TextFieldOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
TextFieldOptionsBuilder &operator=(const TextFieldOptionsBuilder &);
|
||||
flatbuffers::Offset<TextFieldOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<TextFieldOptions>(fbb_.EndTable(start_, 13));
|
||||
auto o = flatbuffers::Offset<TextFieldOptions>(fbb_.EndTable(start_, 14));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -1257,6 +1275,7 @@ inline flatbuffers::Offset<TextFieldOptions> CreateTextFieldOptions(flatbuffers:
|
|||
flatbuffers::Offset<flatbuffers::String> fontName = 0,
|
||||
int32_t fontSize = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> text = 0,
|
||||
uint8_t isLocalized = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> placeHolder = 0,
|
||||
uint8_t passwordEnabled = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> passwordStyleText = 0,
|
||||
|
@ -1279,6 +1298,7 @@ inline flatbuffers::Offset<TextFieldOptions> CreateTextFieldOptions(flatbuffers:
|
|||
builder_.add_isCustomSize(isCustomSize);
|
||||
builder_.add_maxLengthEnabled(maxLengthEnabled);
|
||||
builder_.add_passwordEnabled(passwordEnabled);
|
||||
builder_.add_isLocalized(isLocalized);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1615,8 +1615,10 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFileForLanguageData
|
|||
else if (strcmp(languageName.c_str(), childElement->Name()) == 0)
|
||||
{
|
||||
const char* langText = childElement->GetText();
|
||||
if (langText)
|
||||
if (langText && langText[0] != '\0')
|
||||
text = langText;
|
||||
else
|
||||
text = key;
|
||||
hasTextReaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
#include "LocalizationManager.h"
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "editor-support/cocostudio/CSLanguageDataBinary_generated.h"
|
||||
|
||||
using namespace cocostudio;
|
||||
using namespace cocos2d;
|
||||
|
||||
static JsonLocalizationManager* _sharedJsonLocalizationManager = nullptr;
|
||||
|
||||
ILocalizationManager* JsonLocalizationManager::getInstance()
|
||||
{
|
||||
if (!_sharedJsonLocalizationManager)
|
||||
{
|
||||
_sharedJsonLocalizationManager = new (std::nothrow) JsonLocalizationManager();
|
||||
}
|
||||
|
||||
return _sharedJsonLocalizationManager;
|
||||
}
|
||||
|
||||
void JsonLocalizationManager::destroyInstance()
|
||||
{
|
||||
if (_sharedJsonLocalizationManager != nullptr)
|
||||
{
|
||||
delete _sharedJsonLocalizationManager;
|
||||
_sharedJsonLocalizationManager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
JsonLocalizationManager::JsonLocalizationManager()
|
||||
:languageData(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
JsonLocalizationManager::~JsonLocalizationManager()
|
||||
{
|
||||
CC_SAFE_DELETE(languageData);
|
||||
}
|
||||
|
||||
bool JsonLocalizationManager::initLanguageData(std::string file)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
std::string data = FileUtils::getInstance()->getStringFromFile(file);
|
||||
if (!data.empty())
|
||||
{
|
||||
if (!languageData)
|
||||
languageData = new rapidjson::Document;
|
||||
languageData->Parse(data.c_str());
|
||||
if (languageData->IsObject())
|
||||
result = true;
|
||||
else
|
||||
CC_SAFE_DELETE(languageData);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string JsonLocalizationManager::getLocalizationString(std::string key)
|
||||
{
|
||||
std::string result = key;
|
||||
|
||||
if (languageData && languageData->HasMember(key.c_str()) &&
|
||||
(*languageData)[key.c_str()].IsString())
|
||||
result = (*languageData)[key.c_str()].GetString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static BinLocalizationManager* _sharedBinLocalizationManager = nullptr;
|
||||
|
||||
ILocalizationManager* BinLocalizationManager::getInstance()
|
||||
{
|
||||
if (!_sharedBinLocalizationManager)
|
||||
{
|
||||
_sharedBinLocalizationManager = new (std::nothrow) BinLocalizationManager();
|
||||
}
|
||||
|
||||
return _sharedBinLocalizationManager;
|
||||
}
|
||||
|
||||
void BinLocalizationManager::destroyInstance()
|
||||
{
|
||||
if (_sharedBinLocalizationManager != nullptr)
|
||||
{
|
||||
delete _sharedBinLocalizationManager;
|
||||
_sharedBinLocalizationManager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
BinLocalizationManager::BinLocalizationManager()
|
||||
{
|
||||
}
|
||||
|
||||
BinLocalizationManager::~BinLocalizationManager()
|
||||
{
|
||||
}
|
||||
|
||||
bool BinLocalizationManager::initLanguageData(std::string file)
|
||||
{
|
||||
bool result = false;
|
||||
languageData.clear();
|
||||
|
||||
Data buf = FileUtils::getInstance()->getDataFromFile(file);
|
||||
if (!buf.isNull())
|
||||
{
|
||||
auto lanSet = flatbuffers::GetLanguageSet(buf.getBytes());
|
||||
if (lanSet && lanSet->languageItems()->size() > 0)
|
||||
{
|
||||
result = true;
|
||||
auto items = lanSet->languageItems();
|
||||
int count = items->size();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
auto it = items->Get(i);
|
||||
std::string key = it->key()->c_str();
|
||||
std::string value = it->value()->c_str();
|
||||
if (!key.empty())
|
||||
languageData[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string BinLocalizationManager::getLocalizationString(std::string key)
|
||||
{
|
||||
std::string result = key;
|
||||
|
||||
if (!languageData.empty())
|
||||
{
|
||||
auto it = languageData.find(key);
|
||||
if (it != languageData.end())
|
||||
result = it->second;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static bool isCurrentBinManager = true;
|
||||
static ILocalizationManager* _sharedLocalizationManager = nullptr;
|
||||
|
||||
ILocalizationManager* LocalizationHelper::getCurrentManager()
|
||||
{
|
||||
if (!_sharedLocalizationManager)
|
||||
{
|
||||
_sharedLocalizationManager = BinLocalizationManager::getInstance();
|
||||
isCurrentBinManager = true;
|
||||
}
|
||||
|
||||
return _sharedLocalizationManager;
|
||||
}
|
||||
|
||||
void LocalizationHelper::setCurrentManager(ILocalizationManager* manager, bool isBinary)
|
||||
{
|
||||
_sharedLocalizationManager = manager;
|
||||
isCurrentBinManager = isBinary;
|
||||
}
|
||||
|
||||
bool LocalizationHelper::isBinManager()
|
||||
{
|
||||
return isCurrentBinManager;
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
#ifndef __LOCALLIZATION_MANAGER_H__
|
||||
#define __LOCALLIZATION_MANAGER_H__
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include "json/document.h"
|
||||
#include "cocostudio/CocosStudioExport.h"
|
||||
|
||||
namespace cocostudio {
|
||||
/**
|
||||
*@brief Localization string manager interface template.
|
||||
*/
|
||||
class ILocalizationManager
|
||||
{
|
||||
public:
|
||||
virtual bool initLanguageData(std::string file) = 0;
|
||||
virtual std::string getLocalizationString(std::string key) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
*@brief Localization string manager for output Json data file by cocostudio localization editor.
|
||||
* Note: If changed localization data file manually, please make sure the data file save as
|
||||
* text file format with encoding as 'UTF8 no BOM', otherwise the localization data may
|
||||
* not been parse successfully.
|
||||
*/
|
||||
class CC_STUDIO_DLL JsonLocalizationManager : ILocalizationManager
|
||||
{
|
||||
public:
|
||||
static ILocalizationManager* getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
public:
|
||||
/* Init manager with special localize json data file.
|
||||
* @param file Name of localize file.
|
||||
* @return If manager initialize success return true.
|
||||
*/
|
||||
virtual bool initLanguageData(std::string file);
|
||||
|
||||
/* Get localization string for special key.
|
||||
* @param key Special key to search in localization data.
|
||||
* @return If manager find the key in localization data, return value
|
||||
* set to key, otherwise return key itself.
|
||||
*/
|
||||
virtual std::string getLocalizationString(std::string key);
|
||||
|
||||
protected:
|
||||
JsonLocalizationManager();
|
||||
~JsonLocalizationManager();
|
||||
|
||||
protected:
|
||||
rapidjson::Document * languageData;
|
||||
};
|
||||
|
||||
class CC_STUDIO_DLL BinLocalizationManager : ILocalizationManager
|
||||
{
|
||||
public:
|
||||
static ILocalizationManager* getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
/* Init manager with special localize binary data file.
|
||||
* @param file Name of localize file.
|
||||
* @return If manager initialize success return true.
|
||||
*/
|
||||
virtual bool initLanguageData(std::string file);
|
||||
|
||||
/* Get localization string for special key.
|
||||
* @param key Special key to search in localization data.
|
||||
* @return If manager find the key in localization data, return value
|
||||
* set to key, otherwise return key itself.
|
||||
*/
|
||||
virtual std::string getLocalizationString(std::string key);
|
||||
|
||||
protected:
|
||||
BinLocalizationManager();
|
||||
~BinLocalizationManager();
|
||||
|
||||
protected:
|
||||
std::unordered_map<std::string, std::string> languageData;
|
||||
};
|
||||
|
||||
class CC_STUDIO_DLL LocalizationHelper
|
||||
{
|
||||
public:
|
||||
/* Get current localization manager.
|
||||
* @return The instance of current localization manager.
|
||||
* If the manager hasn't been set, it will return the singleton instance of BinLocalizationManager.
|
||||
*/
|
||||
static ILocalizationManager* getCurrentManager();
|
||||
|
||||
/* Set current localization manager.
|
||||
* @param manager The instance of current manager.
|
||||
* @param isBinary Wether the manager is binary localization manager.
|
||||
* If the param is false, current manager will be set to JsonLocalizationManager.
|
||||
*/
|
||||
static void setCurrentManager(ILocalizationManager* manager, bool isBinary);
|
||||
|
||||
/* Get the type of current localization manager.
|
||||
* @return If current manager is BinLocalizationManager, return true.
|
||||
* Otherwise return false, that means current manager is JsonLocalizationManager.
|
||||
*/
|
||||
static bool isBinManager();
|
||||
};
|
||||
}
|
||||
|
||||
#endif //__LOCALLIZATION_MANAGER_H__
|
|
@ -6,6 +6,7 @@
|
|||
#include "cocostudio/CocoLoader.h"
|
||||
#include "cocostudio/CSParseBinary_generated.h"
|
||||
#include "cocostudio/FlatBuffersSerialize.h"
|
||||
#include "cocostudio/LocalizationManager.h"
|
||||
|
||||
#include "tinyxml2.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
@ -253,6 +254,7 @@ namespace cocostudio
|
|||
bool scale9Enabled = false;
|
||||
Rect capInsets;
|
||||
std::string text = "";
|
||||
bool isLocalized = false;
|
||||
int fontSize = 14;
|
||||
std::string fontName = "";
|
||||
cocos2d::Size scale9Size;
|
||||
|
@ -316,6 +318,10 @@ namespace cocostudio
|
|||
{
|
||||
text = value;
|
||||
}
|
||||
else if (name == "IsLocalized")
|
||||
{
|
||||
isLocalized = (value == "True") ? true : false;
|
||||
}
|
||||
else if (name == "FontSize")
|
||||
{
|
||||
fontSize = atoi(value.c_str());
|
||||
|
@ -624,6 +630,7 @@ namespace cocostudio
|
|||
builder->CreateString(fontResourcePlistFile),
|
||||
fontResourceResourceType),
|
||||
builder->CreateString(text),
|
||||
isLocalized,
|
||||
builder->CreateString(fontName),
|
||||
fontSize,
|
||||
&f_textColor,
|
||||
|
@ -824,7 +831,16 @@ namespace cocostudio
|
|||
}
|
||||
|
||||
std::string titleText = options->text()->c_str();
|
||||
button->setTitleText(titleText);
|
||||
bool isLocalized = options->isLocalized() != 0;
|
||||
if (isLocalized)
|
||||
{
|
||||
ILocalizationManager* lm = LocalizationHelper::getCurrentManager();
|
||||
button->setTitleText(lm->getLocalizationString(titleText));
|
||||
}
|
||||
else
|
||||
{
|
||||
button->setTitleText(titleText);
|
||||
}
|
||||
|
||||
auto textColor = options->textColor();
|
||||
Color3B titleColor(textColor->r(), textColor->g(), textColor->b());
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "ui/UITextBMFont.h"
|
||||
#include "cocostudio/CocoLoader.h"
|
||||
#include "cocostudio/CSParseBinary_generated.h"
|
||||
#include "cocostudio/LocalizationManager.h"
|
||||
|
||||
#include "tinyxml2.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
@ -124,6 +125,7 @@ namespace cocostudio
|
|||
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||
|
||||
std::string text = "Fnt Text Label";
|
||||
bool isLocalized = false;
|
||||
|
||||
std::string path = "";
|
||||
std::string plistFlie = "";
|
||||
|
@ -140,6 +142,10 @@ namespace cocostudio
|
|||
{
|
||||
text = value;
|
||||
}
|
||||
else if (name == "IsLocalized")
|
||||
{
|
||||
isLocalized = (value == "True") ? true : false;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
@ -185,7 +191,8 @@ namespace cocostudio
|
|||
builder->CreateString(path),
|
||||
builder->CreateString(plistFlie),
|
||||
resourceType),
|
||||
builder->CreateString(text));
|
||||
builder->CreateString(text),
|
||||
isLocalized);
|
||||
|
||||
return *(Offset<Table>*)(&options);
|
||||
}
|
||||
|
@ -230,7 +237,16 @@ namespace cocostudio
|
|||
}
|
||||
|
||||
std::string text = options->text()->c_str();
|
||||
labelBMFont->setString(text);
|
||||
bool isLocalized = options->isLocalized() != 0;
|
||||
if (isLocalized)
|
||||
{
|
||||
ILocalizationManager* lm = LocalizationHelper::getCurrentManager();
|
||||
labelBMFont->setString(lm->getLocalizationString(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
labelBMFont->setString(text);
|
||||
}
|
||||
|
||||
auto widgetReader = WidgetReader::getInstance();
|
||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "ui/UITextField.h"
|
||||
#include "cocostudio/CocoLoader.h"
|
||||
#include "cocostudio/CSParseBinary_generated.h"
|
||||
#include "cocostudio/LocalizationManager.h"
|
||||
|
||||
#include "tinyxml2.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
@ -164,6 +165,7 @@ namespace cocostudio
|
|||
std::string fontName = "";
|
||||
int fontSize = 20;
|
||||
std::string text = "";
|
||||
bool isLocalized = false;
|
||||
std::string placeHolder = "Text Field";
|
||||
bool passwordEnabled = false;
|
||||
std::string passwordStyleText = "*";
|
||||
|
@ -189,6 +191,10 @@ namespace cocostudio
|
|||
{
|
||||
text = value;
|
||||
}
|
||||
else if (name == "IsLocalized")
|
||||
{
|
||||
isLocalized = (value == "True") ? true : false;
|
||||
}
|
||||
else if (name == "FontSize")
|
||||
{
|
||||
fontSize = atoi(value.c_str());
|
||||
|
@ -266,6 +272,7 @@ namespace cocostudio
|
|||
builder->CreateString(fontName),
|
||||
fontSize,
|
||||
builder->CreateString(text),
|
||||
isLocalized,
|
||||
builder->CreateString(placeHolder),
|
||||
passwordEnabled,
|
||||
builder->CreateString(passwordStyleText),
|
||||
|
@ -288,7 +295,16 @@ namespace cocostudio
|
|||
textField->setPlaceHolder(placeholder);
|
||||
|
||||
std::string text = options->text()->c_str();
|
||||
textField->setString(text);
|
||||
bool isLocalized = options->isLocalized() != 0;
|
||||
if (isLocalized)
|
||||
{
|
||||
ILocalizationManager* lm = LocalizationHelper::getCurrentManager();
|
||||
textField->setString(lm->getLocalizationString(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
textField->setString(text);
|
||||
}
|
||||
|
||||
int fontSize = options->fontSize();
|
||||
textField->setFontSize(fontSize);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "ui/UIText.h"
|
||||
#include "cocostudio/CocoLoader.h"
|
||||
#include "cocostudio/CSParseBinary_generated.h"
|
||||
#include "cocostudio/LocalizationManager.h"
|
||||
|
||||
#include "tinyxml2.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
@ -160,6 +161,7 @@ namespace cocostudio
|
|||
std::string fontName = "";
|
||||
int fontSize = 20;
|
||||
std::string text = "Text Label";
|
||||
bool isLocalized = false;
|
||||
int areaWidth = 0;
|
||||
int areaHeight = 0;
|
||||
int h_alignment = 0;
|
||||
|
@ -191,6 +193,10 @@ namespace cocostudio
|
|||
{
|
||||
text = value;
|
||||
}
|
||||
else if (name == "IsLocalized")
|
||||
{
|
||||
isLocalized = (value == "True") ? true : false;
|
||||
}
|
||||
else if (name == "FontSize")
|
||||
{
|
||||
fontSize = atoi(value.c_str());
|
||||
|
@ -374,6 +380,7 @@ namespace cocostudio
|
|||
builder->CreateString(fontName),
|
||||
fontSize,
|
||||
builder->CreateString(text),
|
||||
isLocalized,
|
||||
areaWidth,
|
||||
areaHeight,
|
||||
h_alignment,
|
||||
|
@ -450,7 +457,16 @@ namespace cocostudio
|
|||
}
|
||||
|
||||
std::string text = options->text()->c_str();
|
||||
label->setString(text);
|
||||
bool isLocalized = options->isLocalized() != 0;
|
||||
if (isLocalized)
|
||||
{
|
||||
ILocalizationManager* lm = LocalizationHelper::getCurrentManager();
|
||||
label->setString(lm->getLocalizationString(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
label->setString(text);
|
||||
}
|
||||
|
||||
// Save node color before set widget properties
|
||||
auto oldColor = node->getColor();
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include "HelloWorldScene.h"
|
||||
#include "AppMacros.h"
|
||||
|
||||
//Uncomment the following line to use localize manager
|
||||
//#include "editor-support/cocostudio/LocalizationManager.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace std;
|
||||
|
||||
|
@ -71,7 +74,23 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
|||
|
||||
// set searching path
|
||||
FileUtils::getInstance()->setSearchPaths(searchPath);
|
||||
|
||||
|
||||
// Uncomment follow block to use localize manager to set localize strings
|
||||
|
||||
// If you want to load json localize data, use follow block
|
||||
/*
|
||||
cocostudio::ILocalizationManager * lm = cocostudio::JsonLocalizationManager::getInstance();
|
||||
lm->initLanguageData("your localize file name.lang.json");
|
||||
cocostudio::LocalizationHelper::setCurrentManager(lm, false);
|
||||
*/
|
||||
|
||||
// If you want to load binary localize data, use follow block
|
||||
/*
|
||||
cocostudio::ILocalizationManager * lm = cocostudio::BinLocalizationManager::getInstance();
|
||||
lm->initLanguageData("your localize file name.lang.csb");
|
||||
cocostudio::LocalizationHelper::setCurrentManager(lm, true);
|
||||
*/
|
||||
|
||||
// turn on display FPS
|
||||
director->setDisplayStats(true);
|
||||
|
||||
|
|
|
@ -105,6 +105,8 @@ NewLabelTests::NewLabelTests()
|
|||
ADD_TEST_CASE(LabelUnderlineMultiline);
|
||||
ADD_TEST_CASE(LabelItalics);
|
||||
ADD_TEST_CASE(LabelBold);
|
||||
|
||||
ADD_TEST_CASE(LabelLocalizationTest);
|
||||
};
|
||||
|
||||
LabelFNTColorAndOpacity::LabelFNTColorAndOpacity()
|
||||
|
@ -3053,3 +3055,109 @@ std::string LabelStrikethrough::subtitle() const
|
|||
return "Strikethrough on TTF and BMfont with multiline";
|
||||
}
|
||||
|
||||
LabelLocalizationTest::LabelLocalizationTest()
|
||||
{
|
||||
_localizationJson = cocostudio::JsonLocalizationManager::getInstance();
|
||||
_localizationJson->initLanguageData("configs/en-US.lang.json");
|
||||
|
||||
_localizationBin = cocostudio::BinLocalizationManager::getInstance();
|
||||
_localizationBin->initLanguageData("configs/ENGLISH.lang.csb");
|
||||
|
||||
const float BUTTON_WIDTH = 100;
|
||||
float startPosX = 0;
|
||||
Size winSize = Director::getInstance()->getVisibleSize();
|
||||
|
||||
// Create a radio button group
|
||||
auto radioButtonGroup = RadioButtonGroup::create();
|
||||
this->addChild(radioButtonGroup);
|
||||
|
||||
// Create the radio buttons
|
||||
const int NUMBER_OF_BUTTONS = 3;
|
||||
startPosX = winSize.width / 2.0f - (NUMBER_OF_BUTTONS - 1) * 0.5 * BUTTON_WIDTH - 30;
|
||||
std::vector<std::string> labelTypes = { "English", "Chinese", "Japanese" };
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_BUTTONS; ++i)
|
||||
{
|
||||
RadioButton* radioButton = RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
|
||||
float posX = startPosX + BUTTON_WIDTH * i;
|
||||
radioButton->setPosition(Vec2(posX, winSize.height / 2.0f + 70));
|
||||
radioButton->setScale(1.2f);
|
||||
radioButton->addEventListener(CC_CALLBACK_2(LabelLocalizationTest::onChangedRadioButtonSelect, this));
|
||||
radioButton->setTag(i);
|
||||
radioButtonGroup->addRadioButton(radioButton);
|
||||
this->addChild(radioButton);
|
||||
|
||||
auto label = Label::createWithSystemFont(labelTypes.at(i), "Arial", 20);
|
||||
label->setPosition(radioButton->getPosition() + Vec2(50, 0));
|
||||
this->addChild(label);
|
||||
}
|
||||
|
||||
_label1 = Label::createWithSystemFont(_localizationJson->getLocalizationString("Text Label"), "Arial", 24);
|
||||
addChild(_label1, 0);
|
||||
_label1->setPosition(Vec2(winSize.width / 2, winSize.height * 1 / 3));
|
||||
|
||||
Label * label = Label::createWithSystemFont("From json data :", "Arial", 24);
|
||||
label->setAnchorPoint(Vec2(0, 0.5));
|
||||
addChild(label, 0);
|
||||
label->setPosition(Vec2(20, winSize.height * 1 / 3 + 24));
|
||||
|
||||
_label2 = Label::createWithSystemFont(_localizationBin->getLocalizationString("Text Label"), "Arial", 24);
|
||||
addChild(_label2, 0);
|
||||
_label2->setPosition(Vec2(winSize.width / 2, winSize.height * 1 / 2));
|
||||
|
||||
label = Label::createWithSystemFont("From binary data :", "Arial", 24);
|
||||
label->setAnchorPoint(Vec2(0, 0.5));
|
||||
addChild(label, 0);
|
||||
label->setPosition(Vec2(20, winSize.height * 1 / 2 + 24));
|
||||
}
|
||||
|
||||
std::string LabelLocalizationTest::title() const
|
||||
{
|
||||
return "Localization Test";
|
||||
}
|
||||
|
||||
std::string LabelLocalizationTest::subtitle() const
|
||||
{
|
||||
return "Change language selected and see label change";
|
||||
}
|
||||
|
||||
|
||||
void LabelLocalizationTest::onChangedRadioButtonSelect(RadioButton* radioButton, RadioButton::EventType type)
|
||||
{
|
||||
if (radioButton == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RadioButton::EventType::SELECTED:
|
||||
{
|
||||
switch (radioButton->getTag()) {
|
||||
case 0:
|
||||
_localizationJson->initLanguageData("configs/en-US.lang.json");
|
||||
_label1->setString(_localizationJson->getLocalizationString("Text Label"));
|
||||
_localizationBin->initLanguageData("configs/ENGLISH.lang.csb");
|
||||
_label2->setString(_localizationJson->getLocalizationString("Text Label"));
|
||||
break;
|
||||
case 1:
|
||||
_localizationJson->initLanguageData("configs/zh-CN.lang.json");
|
||||
_label1->setString(_localizationJson->getLocalizationString("Text Label"));
|
||||
_localizationBin->initLanguageData("configs/CHINESE.lang.csb");
|
||||
_label2->setString(_localizationJson->getLocalizationString("Text Label"));
|
||||
break;
|
||||
case 2:
|
||||
_localizationJson->initLanguageData("configs/ja-JP.lang.json");
|
||||
_label1->setString(_localizationJson->getLocalizationString("Text Label"));
|
||||
_localizationBin->initLanguageData("configs/JAPANESE.lang.csb");
|
||||
_label2->setString(_localizationJson->getLocalizationString("Text Label"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "renderer/CCCustomCommand.h"
|
||||
#include "ui/CocosGUI.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
#include "editor-support/cocostudio/LocalizationManager.h"
|
||||
|
||||
DEFINE_TEST_SUITE(NewLabelTests);
|
||||
|
||||
|
@ -842,4 +843,21 @@ public:
|
|||
cocos2d::Label* _label2a;
|
||||
};
|
||||
|
||||
class LabelLocalizationTest : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelLocalizationTest);
|
||||
|
||||
LabelLocalizationTest();
|
||||
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton, cocos2d::ui::RadioButton::EventType type);
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
cocos2d::Label* _label1;
|
||||
cocos2d::Label* _label2;
|
||||
cocostudio::ILocalizationManager* _localizationJson;
|
||||
cocostudio::ILocalizationManager* _localizationBin;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"Text Label": "Text Label"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"Text Label": "テキストラベル"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"Text Label": "文本标签"
|
||||
}
|
|
@ -434,6 +434,12 @@ void ProjectConfig::parseCommandLine(const vector<string> &args)
|
|||
setUseLocalScript(false);
|
||||
}
|
||||
}
|
||||
else if (arg.compare("-language-data-path") == 0)
|
||||
{
|
||||
++it;
|
||||
if (it == args.end()) break;
|
||||
setLanguageDataPath(*it);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
@ -652,6 +658,26 @@ const vector<string> &ProjectConfig::getSearchPath() const
|
|||
return _searchPath;
|
||||
}
|
||||
|
||||
void ProjectConfig::setLanguageDataPath(const std::string &filePath)
|
||||
{
|
||||
bool isBinary = true;
|
||||
string jsonExtension = ".json";
|
||||
int exLength = jsonExtension.length();
|
||||
if (filePath.length() >= exLength &&
|
||||
(0 == filePath.compare(filePath.length() - exLength, exLength, jsonExtension)))
|
||||
{
|
||||
isBinary = false;
|
||||
}
|
||||
|
||||
cocostudio::ILocalizationManager* lm;
|
||||
if (isBinary)
|
||||
lm = cocostudio::BinLocalizationManager::getInstance();
|
||||
else
|
||||
lm = cocostudio::JsonLocalizationManager::getInstance();
|
||||
lm->initLanguageData(filePath);
|
||||
cocostudio::LocalizationHelper::setCurrentManager(lm, isBinary);
|
||||
}
|
||||
|
||||
bool ProjectConfig::isAppMenu() const
|
||||
{
|
||||
return _isAppMenu;
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
const std::string &getBindAddress() const;
|
||||
void setSearchPath(const vector<string> &args);
|
||||
const vector<string> &getSearchPath() const;
|
||||
void setLanguageDataPath(const std::string &filePath);
|
||||
|
||||
bool isUseLocalScript() const;
|
||||
void setUseLocalScript(bool useLocalScript);
|
||||
|
@ -138,6 +139,7 @@ private:
|
|||
string _bindAddress;
|
||||
vector<string> _searchPath;
|
||||
bool _useLocalScript;
|
||||
string _languageDataPath;
|
||||
|
||||
void normalize();
|
||||
string replaceProjectDirToMacro(const string &path) const;
|
||||
|
|
Loading…
Reference in New Issue