From 9cede092b02b7ac35af529964161874b8f50acf4 Mon Sep 17 00:00:00 2001 From: T0086OH Date: Tue, 30 Jan 2024 18:05:31 +0800 Subject: [PATCH] Fixed underline displaying issue by selfimplement reversing text, instead of reversing with TMPro. --- Assets/RTLTMPro/Scenes/Underline.unity | 695 ++++++++++++++++++ Assets/RTLTMPro/Scenes/Underline.unity.meta | 7 + .../Scripts/Editor/RTLTextMeshProEditor.cs | 110 ++- .../Scripts/Runtime/FastStringBuilder.cs | 13 + .../Scripts/Runtime/LigatureFixer.cs.meta | 12 +- Assets/RTLTMPro/Scripts/Runtime/RTLSupport.cs | 13 +- .../RTLTMPro/Scripts/Runtime/RTLTMPro.asmdef | 3 +- .../Scripts/Runtime/RTLTextMeshPro.cs | 23 +- .../RTLTMPro/Scripts/Runtime/RichTextFixer.cs | 167 ++++- Packages/manifest.json | 8 +- Packages/packages-lock.json | 41 +- ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/VersionControlSettings.asset | 8 + UserSettings/EditorUserSettings.asset | 45 ++ 14 files changed, 1117 insertions(+), 32 deletions(-) create mode 100644 Assets/RTLTMPro/Scenes/Underline.unity create mode 100644 Assets/RTLTMPro/Scenes/Underline.unity.meta create mode 100644 ProjectSettings/VersionControlSettings.asset create mode 100644 UserSettings/EditorUserSettings.asset diff --git a/Assets/RTLTMPro/Scenes/Underline.unity b/Assets/RTLTMPro/Scenes/Underline.unity new file mode 100644 index 0000000..d0b16cd --- /dev/null +++ b/Assets/RTLTMPro/Scenes/Underline.unity @@ -0,0 +1,695 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &171417980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 171417983} + - component: {fileID: 171417982} + - component: {fileID: 171417981} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &171417981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171417980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &171417982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171417980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &171417983 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171417980} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &435169006 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 435169009} + - component: {fileID: 435169008} + - component: {fileID: 435169007} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &435169007 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435169006} + m_Enabled: 1 +--- !u!20 &435169008 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435169006} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &435169009 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435169006} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &885890685 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 885890689} + - component: {fileID: 885890688} + - component: {fileID: 885890687} + - component: {fileID: 885890686} + m_Layer: 0 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &885890686 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 885890685} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &885890687 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 885890685} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!223 &885890688 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 885890685} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 25 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &885890689 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 885890685} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1140899792} + - {fileID: 2073584614} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1140899791 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1140899792} + - component: {fileID: 1140899794} + - component: {fileID: 1140899793} + m_Layer: 0 + m_Name: Text - RTLTMP + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1140899792 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140899791} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 885890689} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 3840, y: 500} + m_Pivot: {x: 0, y: 1} +--- !u!114 &1140899793 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140899791} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b9839c2d141529145a431aef4d757ff3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\uFEE6\uFE98\uFEE3 \uFEAD\uFEA9 1234567890 \uFBFD\uFEB4\uFBFF\uFEE0\uFB95\uFEE7\uFE8D + \uFBFC\uFE8E\uFEEB \uFEA9\uFEAA\uFECB \uFEAF\uFE8D \uFEE9\uFEA9\uFE8E\uFED4\uFE98\uFEB3\uFE8D + \uFEE5\uFE8E\uFB91\uFEE3\uFE8D" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 3fbde2e562e333d488bc46986fc6f4f1, type: 2} + m_sharedMaterial: {fileID: -6949820610600499109, guid: 3fbde2e562e333d488bc46986fc6f4f1, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 150 + m_fontSizeBase: 150 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 4 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} + rtlText: "\uFEE6\uFE98\uFEE3 \uFEAD\uFEA9 1234567890 \uFBFD\uFEB4\uFBFF\uFEE0\uFB95\uFEE7\uFE8D + \uFBFC\uFE8E\uFEEB \uFEA9\uFEAA\uFECB \uFEAF\uFE8D \uFEE9\uFEA9\uFE8E\uFED4\uFE98\uFEB3\uFE8D + \uFEE5\uFE8E\uFB91\uFEE3\uFE8D" + enalbeRTL: 1 + preserveNumbers: 1 + farsi: 1 + originalText: "\u0627\u0645\u06A9\u0627\u0646 \u0627\u0633\u062A\u0641\u0627\u062F\u0647 + \u0627\u0632 \u0639\u062F\u062F \u0647\u0627\u064A \u0627\u0646\u06AF\u0644\u064A\u0633\u064A + 1234567890 \u062F\u0631 \u0645\u062A\u0646" + fixTags: 1 + forceFix: 0 +--- !u!222 &1140899794 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140899791} + m_CullTransparentMesh: 1 +--- !u!1 &2073584613 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2073584614} + - component: {fileID: 2073584616} + - component: {fileID: 2073584615} + m_Layer: 0 + m_Name: Text - RTLTMP (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2073584614 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2073584613} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 885890689} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -600} + m_SizeDelta: {x: 3840, y: 1000} + m_Pivot: {x: 0, y: 1} +--- !u!114 &2073584615 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2073584613} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b9839c2d141529145a431aef4d757ff3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: ".\uFE8D\uFEAC\uFEEC\uFEDB \uFEB0\uFBFF\uFBFF\uFEE4\uFE97 \uFEF0\uFEE0\uFECB + \uFEBE\uFBFE\uFEAE\uFEA4\uFE97 \uFBFC\uFE83 \uFEAA\uFEBF\uFEED \uFEE5\uFEFC\uFECB\uFEF9\uFE8D + \uFE8D\uFEAC\uFEEC\uFE91 \uFEDE\uFEA8\u064F\uFBFE \uFEB0\uFBFF\uFBFF\uFEE4\uFE97 + \uFBFC\uFE83 \uFEAA\uFEBF \uFE94\uFBFE\uFEED\uFE8E\uFEB4\uFE98\uFEE3 + \uFE94\uFBFE\uFE8E\uFEE4\uFEA3 \uFBFD\uFED3 \uFED6\uFEA4\uFEDF\uFE8D \u064B\uFE8E\uFECC\uFBFF\uFEE4\uFE9F + \uFEE2\uFEEC\uFEDF \uFEE5\uFE83 \uFE8E\uFEE4\uFEDB \u060C\uFE94\uFED7\uFEAE\uFED4\uFE97 + \uFE94\uFBFE\uFE83 \uFEE5\uFEED\uFEA9 \uFEEA\uFEE8\uFECB \uFE94\uFE8C\uFED3\uFE8E\uFEDC\uFE98\uFEE3 + \uFE94\uFBFE\uFE8E\uFEE4\uFEA4\uFE91 \uFECA\uFE98\uFEE4\uFE98\uFEDF\uFE8D \uFBFD\uFED3 + \uFED6\uFEA4\uFEDF\uFE8D \uFEE2\uFEEC\uFEDF\uFEED \uFEE5\uFEEE\uFEE7\uFE8E\uFED8\uFEDF\uFE8D + \uFEE1\uFE8E\uFEE3\uFE83\uFE94\uFBFF\uFEB3\uFE8D\uFEEE\uFEB3 \uFEB1\uFE8E\uFEE8\uFEDF\uFE8D + \uFEDE\uFEDB" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 3fbde2e562e333d488bc46986fc6f4f1, type: 2} + m_sharedMaterial: {fileID: -6949820610600499109, guid: 3fbde2e562e333d488bc46986fc6f4f1, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 150 + m_fontSizeBase: 150 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 4 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} + rtlText: ".\uFE8D\uFEAC\uFEEC\uFEDB \uFEB0\uFBFF\uFBFF\uFEE4\uFE97 \uFEF0\uFEE0\uFECB + \uFEBE\uFBFE\uFEAE\uFEA4\uFE97 \uFBFC\uFE83 \uFEAA\uFEBF\uFEED \uFEE5\uFEFC\uFECB\uFEF9\uFE8D + \uFE8D\uFEAC\uFEEC\uFE91 \uFEDE\uFEA8\u064F\uFBFE \uFEB0\uFBFF\uFBFF\uFEE4\uFE97 + \uFBFC\uFE83 \uFEAA\uFEBF \uFE94\uFBFE\uFEED\uFE8E\uFEB4\uFE98\uFEE3 + \uFE94\uFBFE\uFE8E\uFEE4\uFEA3 \uFBFD\uFED3 \uFED6\uFEA4\uFEDF\uFE8D \u064B\uFE8E\uFECC\uFBFF\uFEE4\uFE9F + \uFEE2\uFEEC\uFEDF \uFEE5\uFE83 \uFE8E\uFEE4\uFEDB \u060C\uFE94\uFED7\uFEAE\uFED4\uFE97 + \uFE94\uFBFE\uFE83 \uFEE5\uFEED\uFEA9 \uFEEA\uFEE8\uFECB \uFE94\uFE8C\uFED3\uFE8E\uFEDC\uFE98\uFEE3 + \uFE94\uFBFE\uFE8E\uFEE4\uFEA4\uFE91 \uFECA\uFE98\uFEE4\uFE98\uFEDF\uFE8D \uFBFD\uFED3 + \uFED6\uFEA4\uFEDF\uFE8D \uFEE2\uFEEC\uFEDF\uFEED \uFEE5\uFEEE\uFEE7\uFE8E\uFED8\uFEDF\uFE8D + \uFEE1\uFE8E\uFEE3\uFE83\uFE94\uFBFF\uFEB3\uFE8D\uFEEE\uFEB3 \uFEB1\uFE8E\uFEE8\uFEDF\uFE8D + \uFEDE\uFEDB" + enalbeRTL: 1 + preserveNumbers: 0 + farsi: 1 + originalText: "\u0643\u0644 \u0627\u0644\u0646\u0627\u0633 \u0633\u0648\u0627\u0633\u064A\u0629 + \u0623\u0645\u0627\u0645 \u0627\u0644\u0642\u0627\u0646\u0648\u0646 + \u0648\u0644\u0647\u0645 \u0627\u0644\u062D\u0642 \u0641\u064A \u0627\u0644\u062A\u0645\u062A\u0639 + \u0628\u062D\u0645\u0627\u064A\u0629 \u0645\u062A\u0643\u0627\u0641\u0626\u0629 + \u0639\u0646\u0647 \u062F\u0648\u0646 \u0623\u064A\u0629 \u062A\u0641\u0631\u0642\u0629\u060C + \u0643\u0645\u0627 \u0623\u0646 \u0644\u0647\u0645 \u062C\u0645\u064A\u0639\u0627\u064B + \u0627\u0644\u062D\u0642 \u0641\u064A \u062D\u0645\u0627\u064A\u0629 \u0645\u062A\u0633\u0627\u0648\u064A\u0629 + \u0636\u062F \u0623\u064A \u062A\u0645\u064A\u064A\u0632 \u064A\u064F\u062E\u0644 + \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u0639\u0644\u0627\u0646 \u0648\u0636\u062F + \u0623\u064A \u062A\u062D\u0631\u064A\u0636 \u0639\u0644\u0649 \u062A\u0645\u064A\u064A\u0632 + \u0643\u0647\u0630\u0627." + fixTags: 1 + forceFix: 0 +--- !u!222 &2073584616 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2073584613} + m_CullTransparentMesh: 1 diff --git a/Assets/RTLTMPro/Scenes/Underline.unity.meta b/Assets/RTLTMPro/Scenes/Underline.unity.meta new file mode 100644 index 0000000..ec6c8a2 --- /dev/null +++ b/Assets/RTLTMPro/Scenes/Underline.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d56025fd103c76d4299ad79fab56b30d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RTLTMPro/Scripts/Editor/RTLTextMeshProEditor.cs b/Assets/RTLTMPro/Scripts/Editor/RTLTextMeshProEditor.cs index 7733b39..f05a2cf 100644 --- a/Assets/RTLTMPro/Scripts/Editor/RTLTextMeshProEditor.cs +++ b/Assets/RTLTMPro/Scripts/Editor/RTLTextMeshProEditor.cs @@ -1,4 +1,6 @@ -using TMPro.EditorUtilities; +using System.Reflection; +using TMPro; +using TMPro.EditorUtilities; using UnityEditor; using UnityEngine; @@ -13,6 +15,15 @@ namespace RTLTMPro [CustomEditor(typeof(RTLTextMeshPro)), CanEditMultipleObjects] public class RTLTextMeshProEditor : TMP_UiEditorPanel { + static readonly GUIContent k_RtlToggleLabel = new GUIContent("Enable RTL Editor", "Reverses text direction and allows right to left editing."); + static readonly GUIContent k_StyleLabel = new GUIContent("Text Style", "The style from a style sheet to be applied to the text."); + + FieldInfo m_inputSourceField; + FieldInfo m_TextStyleField; + + RTLTextMeshPro rTLTextMeshPro; + + private SerializedProperty enableRTLProp; private SerializedProperty originalTextProp; private SerializedProperty preserveNumbersProp; private SerializedProperty farsiProp; @@ -24,8 +35,14 @@ public class RTLTextMeshProEditor : TMP_UiEditorPanel protected override void OnEnable() { + rTLTextMeshPro = (RTLTextMeshPro)target; base.OnEnable(); foldout = true; + + m_inputSourceField = m_TextComponent.GetType().GetField("m_TextComponent", BindingFlags.Instance | BindingFlags.NonPublic); + m_TextStyleField = m_TextComponent.GetType().GetField("m_TextStyle", BindingFlags.Instance | BindingFlags.NonPublic); + + enableRTLProp = serializedObject.FindProperty("enalbeRTL"); preserveNumbersProp = serializedObject.FindProperty("preserveNumbers"); farsiProp = serializedObject.FindProperty("farsi"); fixTagsProp = serializedObject.FindProperty("fixTags"); @@ -49,7 +66,26 @@ public override void OnInspectorGUI() serializedObject.ApplyModifiedProperties(); - base.OnInspectorGUI(); + // Make sure Multi selection only includes TMP Text objects. + if (IsMixSelectionTypes()) + return; + + serializedObject.Update(); + + DrawTextInput(); + + DrawMainSettings(); + + DrawExtraSettings(); + + EditorGUILayout.Space(); + + if (serializedObject.ApplyModifiedProperties() || m_HavePropertiesChanged) + { + m_TextComponent.havePropertiesChanged = true; + m_HavePropertiesChanged = false; + EditorUtility.SetDirty(target); + } foldout = EditorGUILayout.Foldout(foldout, "RTL Settings", TMP_UIStyleManager.boldFoldout); if (foldout) @@ -109,5 +145,75 @@ protected virtual void ListenForZeroWidthNoJoiner() Event.current.Use(); Repaint(); } + + protected new void DrawTextInput() + { + EditorGUILayout.Space(); + + Rect rect = EditorGUILayout.GetControlRect(false, 22); + GUI.Label(rect, new GUIContent("Text Input"), TMP_UIStyleManager.sectionHeader); + + EditorGUI.indentLevel = 0; + + // If the text component is linked, disable the text input box. + if (m_ParentLinkedTextComponentProp.objectReferenceValue != null) + { + EditorGUILayout.HelpBox("The Text Input Box is disabled due to this text component being linked to another.", MessageType.Info); + } + else + { + // Display RTL Toggle + float labelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 110f; + + enableRTLProp.boolValue = EditorGUI.Toggle(new Rect(rect.width - 120, rect.y + 3, 130, 20), k_RtlToggleLabel, enableRTLProp.boolValue); + + EditorGUIUtility.labelWidth = labelWidth; + + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(m_TextProp, GUIContent.none); + + // Need to also compare string content due to issue related to scroll bar drag handle + if (EditorGUI.EndChangeCheck() && m_TextProp.stringValue != m_TextComponent.text) + { + m_inputSourceField.SetValue(m_TextComponent, 0); + m_HavePropertiesChanged = true; + } + + if (enableRTLProp.boolValue) + { + GUILayout.Label("RTL Text Input"); + + EditorGUI.BeginChangeCheck(); + rTLTextMeshPro.rtlText = EditorGUILayout.TextArea(rTLTextMeshPro.rtlText, TMP_UIStyleManager.wrappingTextArea, GUILayout.Height(EditorGUI.GetPropertyHeight(m_TextProp) - EditorGUIUtility.singleLineHeight), GUILayout.ExpandWidth(true)); + + if (EditorGUI.EndChangeCheck()) + { + m_TextProp.stringValue = rTLTextMeshPro.rtlText; + } + } + + // TEXT STYLE + if (m_StyleNames != null) + { + rect = EditorGUILayout.GetControlRect(false, 17); + + EditorGUI.BeginProperty(rect, k_StyleLabel, m_TextStyleHashCodeProp); + + m_TextStyleIndexLookup.TryGetValue(m_TextStyleHashCodeProp.intValue, out m_StyleSelectionIndex); + + EditorGUI.BeginChangeCheck(); + m_StyleSelectionIndex = EditorGUI.Popup(rect, k_StyleLabel, m_StyleSelectionIndex, m_StyleNames); + if (EditorGUI.EndChangeCheck()) + { + m_TextStyleHashCodeProp.intValue = m_Styles[m_StyleSelectionIndex].hashCode; + m_TextStyleField.SetValue(m_TextComponent, m_Styles[m_StyleSelectionIndex]); + m_HavePropertiesChanged = true; + } + + EditorGUI.EndProperty(); + } + } + } } } \ No newline at end of file diff --git a/Assets/RTLTMPro/Scripts/Runtime/FastStringBuilder.cs b/Assets/RTLTMPro/Scripts/Runtime/FastStringBuilder.cs index ea4f346..81c6bf2 100644 --- a/Assets/RTLTMPro/Scripts/Runtime/FastStringBuilder.cs +++ b/Assets/RTLTMPro/Scripts/Runtime/FastStringBuilder.cs @@ -278,5 +278,18 @@ private static void Copy(int[] src, int[] dst) { for (int i = 0; i < src.Length; i++) dst[i] = src[i]; } + + public void Join(FastStringBuilder output, params FastStringBuilder[] inputs) + { + output.Clear(); + + foreach (var input in inputs) + { + for (int i = 0; i < input.length; i++) + { + output.Append(input.Get(i)); + } + } + } } } \ No newline at end of file diff --git a/Assets/RTLTMPro/Scripts/Runtime/LigatureFixer.cs.meta b/Assets/RTLTMPro/Scripts/Runtime/LigatureFixer.cs.meta index a513aba..739f145 100644 --- a/Assets/RTLTMPro/Scripts/Runtime/LigatureFixer.cs.meta +++ b/Assets/RTLTMPro/Scripts/Runtime/LigatureFixer.cs.meta @@ -1,3 +1,11 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: a16617d79f574f4bb5493cfa180873d7 -timeCreated: 1563990533 \ No newline at end of file +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RTLTMPro/Scripts/Runtime/RTLSupport.cs b/Assets/RTLTMPro/Scripts/Runtime/RTLSupport.cs index 60a92f1..f2608d5 100644 --- a/Assets/RTLTMPro/Scripts/Runtime/RTLSupport.cs +++ b/Assets/RTLTMPro/Scripts/Runtime/RTLSupport.cs @@ -1,6 +1,8 @@ -// ReSharper disable IdentifierTypo +// ReSharper disable IdentifierTypo // ReSharper disable CommentTypo +using UnityEngine; + namespace RTLTMPro { public static class RTLSupport @@ -38,16 +40,17 @@ public static void FixRTL( GlyphFixer.Fix(inputBuilder, glyphFixerOutput, preserveNumbers, farsi, fixTextTags); //Restore tashkeel to their places. TashkeelFixer.RestoreTashkeel(glyphFixerOutput); - + TashkeelFixer.FixShaddaCombinations(glyphFixerOutput); + // Fix flow of the text and put the result in FinalLetters field LigatureFixer.Fix(glyphFixerOutput, output, farsi, fixTextTags, preserveNumbers); if (fixTextTags) { - RichTextFixer.Fix(output); + RichTextFixer.CorrectTagOrder(output); } + inputBuilder.Clear(); } - } -} \ No newline at end of file +} diff --git a/Assets/RTLTMPro/Scripts/Runtime/RTLTMPro.asmdef b/Assets/RTLTMPro/Scripts/Runtime/RTLTMPro.asmdef index 8f5b99a..2ca622d 100644 --- a/Assets/RTLTMPro/Scripts/Runtime/RTLTMPro.asmdef +++ b/Assets/RTLTMPro/Scripts/Runtime/RTLTMPro.asmdef @@ -1,7 +1,8 @@ { "name": "RTLTMPro", + "rootNamespace": "", "references": [ - "Unity.TextMeshPro" + "GUID:6055be8ebefd69e48b49212b09b47b2f" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/RTLTMPro/Scripts/Runtime/RTLTextMeshPro.cs b/Assets/RTLTMPro/Scripts/Runtime/RTLTextMeshPro.cs index cd6d3e3..7ca8460 100644 --- a/Assets/RTLTMPro/Scripts/Runtime/RTLTextMeshPro.cs +++ b/Assets/RTLTMPro/Scripts/Runtime/RTLTextMeshPro.cs @@ -1,4 +1,4 @@ -using TMPro; +using TMPro; using UnityEngine; namespace RTLTMPro @@ -25,6 +25,8 @@ public override string text } } + public string rtlText; + public string OriginalText { get { return originalText; } @@ -76,12 +78,15 @@ public bool ForceFix { if (forceFix == value) return; + forceFix = value; havePropertiesChanged = true; } } + [SerializeField] protected bool enalbeRTL = true; + [SerializeField] protected bool preserveNumbers; [SerializeField] protected bool farsi = true; @@ -106,15 +111,16 @@ public void UpdateText() { if (originalText == null) originalText = ""; - - if (ForceFix == false && TextUtils.IsRTLInput(originalText) == false) + + if (!enalbeRTL || (ForceFix == false && TextUtils.IsRTLInput(originalText) == false)) { - isRightToLeftText = false; + rtlText = string.Empty; base.text = originalText; - } else + } + else { - isRightToLeftText = true; - base.text = GetFixedText(originalText); + rtlText = GetFixedText(originalText); + base.text = rtlText; } havePropertiesChanged = true; @@ -127,8 +133,7 @@ private string GetFixedText(string input) finalText.Clear(); RTLSupport.FixRTL(input, finalText, farsi, fixTags, preserveNumbers); - finalText.Reverse(); return finalText.ToString(); } } -} \ No newline at end of file +} diff --git a/Assets/RTLTMPro/Scripts/Runtime/RichTextFixer.cs b/Assets/RTLTMPro/Scripts/Runtime/RichTextFixer.cs index 26a5dcb..decdd32 100644 --- a/Assets/RTLTMPro/Scripts/Runtime/RichTextFixer.cs +++ b/Assets/RTLTMPro/Scripts/Runtime/RichTextFixer.cs @@ -1,3 +1,6 @@ +using UnityEngine; +using System.Collections.Generic; + namespace RTLTMPro { public static class RichTextFixer @@ -47,6 +50,167 @@ public static void Fix(FastStringBuilder text) } } + // The structure of the tag: + // Opening: or + // Closing: + public static void CorrectTagOrder(FastStringBuilder str) + { + if (str.Length <= 0) + { + return; + } + + List substrings = new List(); + List closingTags = new List(); + List openingTags = new List(); + + int count = 0; + int index = -1; + for (int i = 0; i < str.Length; i++) + { + // TODO: precheck? + if (count > 0 && + (str.Get(i) == '<' && str.Get(i+1) != ' ' || + str.Get(i) == '>' || + i == str.Length - 1)) + { + if (str.Get(i) == '>') + { + count++; + + // Tag name is empty -> It's not a tag + if (count < 3) + { + continue; + } + } + else if (str.Get(i) == '<') + { + i--; + } + + // Cache new substring + FastStringBuilder substr = new FastStringBuilder(count); + str.Substring(substr, i - count + 1, count); + substrings.Add(substr); + + // Mark indexes of closing tags + index++; + if (substr.Get(0) == '<') + { + if (substr.Get(1) == '/') + { + closingTags.Add(index); + } + else + { + openingTags.Add(index); + } + } + + // Reset + count = 0; + continue; + } + + count++; + } + + // Nothing to be fixed + if (closingTags.Count <= 0 && openingTags.Count <= 0) + { + return; + } + + // Make pairs and correct order + for (int i = 0; i < closingTags.Count; i++) + { + int closingIndex = closingTags[i]; + var targetClosing = substrings[closingIndex]; + + // Get the first 3 letters of the closing tag as the compared type + int tagType = 0; + for (int k = 2; k < 5; k++) + { + if (k < targetClosing.Length) + { + tagType += targetClosing.Get(k); + } + else + { + break; + } + } + + for (int j = 0; j < openingTags.Count; j++) + { + var openingIndex = openingTags[j]; + if (openingIndex <= closingIndex) + { + continue; + } + + var comparedOpening = substrings[openingIndex]; + + // Get the first 3 letters of the opening tag as the compared type + int comparedTagType = 0; + for (int k = 1; k < 4; k++) + { + if (k < comparedOpening.Length) + { + comparedTagType += comparedOpening.Get(k); + } + else + { + break; + } + } + + // Find the closest openign tag with the same type + if (comparedOpening.Get(0) == '<' && comparedTagType == tagType) + { + // Swap the positions + substrings[closingIndex] = comparedOpening; + substrings[openingIndex] = targetClosing; + + openingTags[j] = -1; + } + } + } + + if (openingTags.Count != closingTags.Count) + { + List header = new List(); + for(int i = 0; i < openingTags.Count; i++) + { + if (openingTags[i] != -1) + { + int tagIndex = openingTags[i]; + var tag = substrings[tagIndex].ToString(); + header.Add(new FastStringBuilder(tag)); + + // Get the tag name + for (int j = 1; j < tag.Length; j++) + { + if (tag[j] == '>' || tag[j] == '=') + { + tag = tag.Substring(1, j-1); + string newTag = string.Format("", tag); + substrings[tagIndex].SetValue(newTag); + } + } + } + } + + for (int i = 0; i < header.Count; i++) + { + substrings.Insert(0, header[i]); + } + } + + str.Join(str, substrings.ToArray()); + } + public static void FindTag( FastStringBuilder str, int start, @@ -59,13 +223,12 @@ public static void FindTag( i++; continue; } - + bool calculateHashCode = true; tag.HashCode = 0; for (int j = i + 1; j < str.Length; j++) { int jChar = str.Get(j); - if (calculateHashCode) { if (Char32Utils.IsLetter(jChar)) diff --git a/Packages/manifest.json b/Packages/manifest.json index 0d045aa..17cb831 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -4,15 +4,15 @@ "com.unity.2d.tilemap": "1.0.0", "com.unity.ads": "3.7.5", "com.unity.analytics": "3.6.12", - "com.unity.collab-proxy": "1.14.9", + "com.unity.collab-proxy": "1.15.7", "com.unity.ext.nunit": "1.0.6", - "com.unity.ide.rider": "1.2.1", + "com.unity.ide.rider": "2.0.7", "com.unity.ide.visualstudio": "2.0.14", "com.unity.ide.vscode": "1.2.5", "com.unity.multiplayer-hlapi": "1.0.8", "com.unity.test-framework": "1.1.31", - "com.unity.textmeshpro": "2.1.6", - "com.unity.timeline": "1.2.18", + "com.unity.textmeshpro": "3.0.6", + "com.unity.timeline": "1.4.8", "com.unity.toolchain.win-x86_64-linux-x86_64": "0.1.21-preview", "com.unity.ugui": "1.0.0", "com.unity.xr.legacyinputhelpers": "2.1.8", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 955ef93..2b91f39 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -31,10 +31,13 @@ "url": "https://packages.unity.com" }, "com.unity.collab-proxy": { - "version": "1.14.9", + "version": "1.15.7", "depth": 0, "source": "registry", - "dependencies": {}, + "dependencies": { + "com.unity.nuget.newtonsoft-json": "2.0.0", + "com.unity.services.core": "1.0.1" + }, "url": "https://packages.unity.com" }, "com.unity.ext.nunit": { @@ -45,7 +48,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "1.2.1", + "version": "2.0.7", "depth": 0, "source": "registry", "dependencies": { @@ -78,6 +81,22 @@ }, "url": "https://packages.unity.com" }, + "com.unity.nuget.newtonsoft-json": { + "version": "2.0.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.services.core": { + "version": "1.0.1", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.sysroot": { "version": "0.1.19-preview", "depth": 1, @@ -106,7 +125,7 @@ "url": "https://packages.unity.com" }, "com.unity.textmeshpro": { - "version": "2.1.6", + "version": "3.0.6", "depth": 0, "source": "registry", "dependencies": { @@ -115,7 +134,7 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.2.18", + "version": "1.4.8", "depth": 0, "source": "registry", "dependencies": { @@ -295,6 +314,18 @@ "depth": 0, "source": "builtin", "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.uielementsnative": "1.0.0" + } + }, + "com.unity.modules.uielementsnative": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", "com.unity.modules.imgui": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0" } diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 89a11d7..ffab026 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.4.35f1 -m_EditorVersionWithRevision: 2019.4.35f1 (0462406dff2e) +m_EditorVersion: 2020.3.27f1 +m_EditorVersionWithRevision: 2020.3.27f1 (e759542391ea) diff --git a/ProjectSettings/VersionControlSettings.asset b/ProjectSettings/VersionControlSettings.asset new file mode 100644 index 0000000..dca2881 --- /dev/null +++ b/ProjectSettings/VersionControlSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!890905787 &1 +VersionControlSettings: + m_ObjectHideFlags: 0 + m_Mode: Visible Meta Files + m_CollabEditorSettings: + inProgressEnabled: 1 diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset new file mode 100644 index 0000000..7874db3 --- /dev/null +++ b/UserSettings/EditorUserSettings.asset @@ -0,0 +1,45 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!162 &1 +EditorUserSettings: + m_ObjectHideFlags: 0 + serializedVersion: 4 + m_ConfigSettings: + RecentlyUsedScenePath-0: + value: 22424703114646693922380f2031505f25141d24293b691d3825093aeee93a3dacf238e0f323 + flags: 0 + RecentlyUsedScenePath-1: + value: 22424703114646693922380f2031505f25141d24293b69113f281f3ae1a00039f1ef3dece2367129370bfb25 + flags: 0 + RecentlyUsedScenePath-2: + value: 22424703114646693922380f2031505f25141d24293b6912242e5d01ebe33c78d6e22efda7123a3e2b07f8721130082beb + flags: 0 + RecentlyUsedScenePath-3: + value: 22424703114646693922380f2031505f25141d24293b690324240d3fe7a0003df1f378fce9332b25 + flags: 0 + RecentlyUsedScenePath-4: + value: 22424703114646693922380f2031505f25141d24293b691f383d113aece5721feee821a7f234362820 + flags: 0 + RecentlyUsedScenePath-5: + value: 22424703114646693922380f2031505f25141d24293b6902242a1573d6e52c2cacf238e0f323 + flags: 0 + RecentlyUsedScenePath-6: + value: 22424703114646693922380f2031505f25141d24293b691e38241f36f0f37a2decee22f0 + flags: 0 + RecentlyUsedScenePath-7: + value: 22424703114646693922380f2031505f25141d24293b6905232d1821eee93a3dacf238e0f323 + flags: 0 + vcSharedLogLevel: + value: 0d5e400f0650 + flags: 0 + m_VCAutomaticAdd: 1 + m_VCDebugCom: 0 + m_VCDebugCmd: 0 + m_VCDebugOut: 0 + m_SemanticMergeMode: 2 + m_VCShowFailedCheckout: 1 + m_VCOverwriteFailedCheckoutAssets: 1 + m_VCProjectOverlayIcons: 1 + m_VCHierarchyOverlayIcons: 1 + m_VCOtherOverlayIcons: 1 + m_VCAllowAsyncUpdate: 1