From a22c505984697881f5f911a165ee022087b69e09 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 20 May 2024 22:36:58 +0800 Subject: *rename --- Thronefall_1_57/.gitignore | 1 - Thronefall_1_57/Thronefall/.gitignore | 399 -- Thronefall_1_57/Thronefall/Ara/AraTrail.cs | 947 ---- Thronefall_1_57/Thronefall/Ara/ColorFromSpeed.cs | 40 - Thronefall_1_57/Thronefall/Ara/ElasticArray.cs | 160 - Thronefall_1_57/Thronefall/Ara/ElectricalArc.cs | 57 - Thronefall_1_57/Thronefall/Ara/TireTrack.cs | 50 - Thronefall_1_57/Thronefall/Ara/TrailSection.cs | 57 - .../Thronefall/FlatKit/BlitTexturePass.cs | 80 - Thronefall_1_57/Thronefall/FlatKit/Buoyancy.cs | 105 - Thronefall_1_57/Thronefall/FlatKit/FlatKitFog.cs | 175 - .../Thronefall/FlatKit/FlatKitOutline.cs | 139 - Thronefall_1_57/Thronefall/FlatKit/FogSettings.cs | 59 - .../Thronefall/FlatKit/OutlineSettings.cs | 61 - Thronefall_1_57/Thronefall/FlatKit/UvScroller.cs | 34 - .../Thronefall/I2.Loc.SimpleJSON/JSON.cs | 9 - .../Thronefall/I2.Loc.SimpleJSON/JSONArray.cs | 127 - .../Thronefall/I2.Loc.SimpleJSON/JSONBinaryTag.cs | 12 - .../Thronefall/I2.Loc.SimpleJSON/JSONClass.cs | 171 - .../Thronefall/I2.Loc.SimpleJSON/JSONData.cs | 92 - .../I2.Loc.SimpleJSON/JSONLazyCreator.cs | 193 - .../Thronefall/I2.Loc.SimpleJSON/JSONNode.cs | 526 -- Thronefall_1_57/Thronefall/I2.Loc/ArabicMapping.cs | 14 - Thronefall_1_57/Thronefall/I2.Loc/ArabicTable.cs | 80 - .../Thronefall/I2.Loc/AutoChangeCultureInfo.cs | 11 - .../Thronefall/I2.Loc/BaseSpecializationManager.cs | 52 - .../Thronefall/I2.Loc/CallbackNotification.cs | 15 - .../Thronefall/I2.Loc/CoroutineManager.cs | 40 - .../Thronefall/I2.Loc/CustomLocalizeCallback.cs | 26 - Thronefall_1_57/Thronefall/I2.Loc/EventCallback.cs | 29 - .../Thronefall/I2.Loc/Example_ChangeLanguage.cs | 29 - .../Thronefall/I2.Loc/Example_LocalizedString.cs | 31 - .../Thronefall/I2.Loc/GeneralArabicLetters.cs | 46 - .../Thronefall/I2.Loc/GlobalParametersExample.cs | 17 - .../Thronefall/I2.Loc/GoogleLanguages.cs | 2873 ---------- .../Thronefall/I2.Loc/GoogleTranslation.cs | 575 -- Thronefall_1_57/Thronefall/I2.Loc/HindiFixer.cs | 83 - .../Thronefall/I2.Loc/I2BasePersistentStorage.cs | 197 - .../Thronefall/I2.Loc/I2CustomPersistentStorage.cs | 5 - Thronefall_1_57/Thronefall/I2.Loc/I2Utils.cs | 301 -- .../Thronefall/I2.Loc/ILanguageSource.cs | 6 - .../I2.Loc/ILocalizationParamsManager.cs | 6 - .../Thronefall/I2.Loc/ILocalizeTarget.cs | 22 - .../Thronefall/I2.Loc/ILocalizeTargetDescriptor.cs | 16 - .../Thronefall/I2.Loc/IResourceManager_Bundles.cs | 9 - .../Thronefall/I2.Loc/IsolatedArabicLetters.cs | 46 - Thronefall_1_57/Thronefall/I2.Loc/LanguageData.cs | 67 - .../Thronefall/I2.Loc/LanguageSource.cs | 145 - .../Thronefall/I2.Loc/LanguageSourceAsset.cs | 21 - .../Thronefall/I2.Loc/LanguageSourceData.cs | 1661 ------ .../Thronefall/I2.Loc/LocalizationManager.cs | 1056 ---- .../Thronefall/I2.Loc/LocalizationParamsManager.cs | 97 - .../Thronefall/I2.Loc/LocalizationReader.cs | 195 - Thronefall_1_57/Thronefall/I2.Loc/Localize.cs | 464 -- .../Thronefall/I2.Loc/LocalizeDropdown.cs | 100 - .../Thronefall/I2.Loc/LocalizeTarget.cs | 25 - .../Thronefall/I2.Loc/LocalizeTargetDesc.cs | 17 - .../Thronefall/I2.Loc/LocalizeTargetDesc_Child.cs | 9 - .../Thronefall/I2.Loc/LocalizeTargetDesc_Prefab.cs | 9 - .../Thronefall/I2.Loc/LocalizeTargetDesc_Type.cs | 23 - .../I2.Loc/LocalizeTarget_TextMeshPro_Label.cs | 257 - .../I2.Loc/LocalizeTarget_TextMeshPro_UGUI.cs | 116 - .../LocalizeTarget_UnityStandard_AudioSource.cs | 68 - .../I2.Loc/LocalizeTarget_UnityStandard_Child.cs | 76 - .../LocalizeTarget_UnityStandard_MeshRenderer.cs | 89 - .../I2.Loc/LocalizeTarget_UnityStandard_Prefab.cs | 108 - .../LocalizeTarget_UnityStandard_SpriteRenderer.cs | 62 - .../LocalizeTarget_UnityStandard_TextMesh.cs | 92 - .../LocalizeTarget_UnityStandard_VideoPlayer.cs | 63 - .../I2.Loc/LocalizeTarget_UnityUI_Image.cs | 70 - .../I2.Loc/LocalizeTarget_UnityUI_RawImage.cs | 62 - .../I2.Loc/LocalizeTarget_UnityUI_Text.cs | 156 - .../Thronefall/I2.Loc/LocalizedString.cs | 45 - .../Thronefall/I2.Loc/PersistentStorage.cs | 104 - Thronefall_1_57/Thronefall/I2.Loc/RTLFixer.cs | 79 - Thronefall_1_57/Thronefall/I2.Loc/RTLFixerTool.cs | 404 -- .../Thronefall/I2.Loc/RealTimeTranslation.cs | 118 - .../Thronefall/I2.Loc/RegisterBundlesManager.cs | 25 - .../I2.Loc/RegisterCallback_AllowSyncFromGoogle.cs | 26 - .../Thronefall/I2.Loc/RegisterGlobalParameters.cs | 25 - .../Thronefall/I2.Loc/ResourceManager.cs | 160 - Thronefall_1_57/Thronefall/I2.Loc/SetLanguage.cs | 22 - .../Thronefall/I2.Loc/SetLanguageDropdown.cs | 39 - .../Thronefall/I2.Loc/SpecializationManager.cs | 156 - .../Thronefall/I2.Loc/StringObfucator.cs | 64 - .../Thronefall/I2.Loc/TashkeelLocation.cs | 14 - Thronefall_1_57/Thronefall/I2.Loc/TermData.cs | 123 - Thronefall_1_57/Thronefall/I2.Loc/TermsPopup.cs | 13 - .../Thronefall/I2.Loc/ToggleLanguage.cs | 27 - .../Thronefall/I2.Loc/TranslationFlag.cs | 7 - .../Thronefall/I2.Loc/TranslationJob.cs | 24 - .../Thronefall/I2.Loc/TranslationJob_GET.cs | 72 - .../Thronefall/I2.Loc/TranslationJob_Main.cs | 96 - .../Thronefall/I2.Loc/TranslationJob_POST.cs | 51 - .../Thronefall/I2.Loc/TranslationJob_WEB.cs | 154 - .../Thronefall/I2.Loc/TranslationJob_WWW.cs | 17 - .../Thronefall/I2.Loc/TranslationQuery.cs | 16 - .../Thronefall/I2.Loc/eLanguageDataFlags.cs | 8 - Thronefall_1_57/Thronefall/I2.Loc/ePluralType.cs | 11 - .../Thronefall/I2.Loc/eSpreadsheetUpdateMode.cs | 9 - Thronefall_1_57/Thronefall/I2.Loc/eTermType.cs | 17 - .../MoreMountains.Feedbacks/OneShotAudioTrigger.cs | 18 - .../NGS.MeshFusionPro/AfterCombineAction.cs | 8 - .../Thronefall/NGS.MeshFusionPro/BinaryTree.cs | 156 - .../NGS.MeshFusionPro/BinaryTreeDrawer.cs | 22 - .../Thronefall/NGS.MeshFusionPro/BinaryTreeNode.cs | 48 - .../Thronefall/NGS.MeshFusionPro/BoundsHelper.cs | 39 - .../NGS.MeshFusionPro/CombineErrorStrategy.cs | 7 - .../Thronefall/NGS.MeshFusionPro/CombineMethod.cs | 6 - .../Thronefall/NGS.MeshFusionPro/CombineSource.cs | 92 - .../Thronefall/NGS.MeshFusionPro/CombineTree.cs | 112 - .../NGS.MeshFusionPro/CombineTreeNode.cs | 45 - .../NGS.MeshFusionPro/CombinedLODGroup.cs | 265 - .../NGS.MeshFusionPro/CombinedLODGroupMatcher.cs | 20 - .../NGS.MeshFusionPro/CombinedLODGroupPart.cs | 49 - .../Thronefall/NGS.MeshFusionPro/CombinedMesh.cs | 86 - .../NGS.MeshFusionPro/CombinedMeshData.cs | 17 - .../NGS.MeshFusionPro/CombinedMeshDataInternal.cs | 124 - .../NGS.MeshFusionPro/CombinedMeshFactory.cs | 43 - .../NGS.MeshFusionPro/CombinedMeshPart.cs | 26 - .../NGS.MeshFusionPro/CombinedMeshPartInternal.cs | 16 - .../Thronefall/NGS.MeshFusionPro/CombinedObject.cs | 209 - .../NGS.MeshFusionPro/CombinedObjectMatcher.cs | 10 - .../NGS.MeshFusionPro/CombinedObjectPart.cs | 35 - .../NGS.MeshFusionPro/DynamicCombineSource.cs | 70 - .../NGS.MeshFusionPro/DynamicCombinedObject.cs | 155 - .../DynamicCombinedObjectMatcher.cs | 39 - .../NGS.MeshFusionPro/DynamicCombinedObjectPart.cs | 44 - .../DynamicCombinedObjectPartInternal.cs | 61 - .../NGS.MeshFusionPro/DynamicMeshFusionSource.cs | 130 - .../NGS.MeshFusionPro/DynamicObjectsCombiner.cs | 42 - .../NGS.MeshFusionPro/IAsyncCombinedMeshMover.cs | 10 - .../NGS.MeshFusionPro/IBinaryTreeNode.cs | 20 - .../Thronefall/NGS.MeshFusionPro/ICombineSource.cs | 25 - .../NGS.MeshFusionPro/ICombinedMeshFactory.cs | 8 - .../NGS.MeshFusionPro/ICombinedMeshMover.cs | 10 - .../NGS.MeshFusionPro/ICombinedObject.cs | 16 - .../NGS.MeshFusionPro/ICombinedObjectPart.cs | 18 - .../Thronefall/NGS.MeshFusionPro/IMeshCombiner.cs | 9 - .../Thronefall/NGS.MeshFusionPro/IMeshCutter.cs | 11 - .../NGS.MeshFusionPro/IMeshToolsFactory.cs | 8 - .../IMovableCombinedMeshFactory.cs | 6 - .../NGS.MeshFusionPro/ISourceTrackingStrategy.cs | 6 - .../NGS.MeshFusionPro/JobsMeshMoverLW.cs | 139 - .../NGS.MeshFusionPro/JobsMeshMoverSTD.cs | 144 - .../NGS.MeshFusionPro/JobsMovableMeshLWFactory.cs | 18 - .../NGS.MeshFusionPro/JobsMovableMeshSTDFactory.cs | 18 - .../NGS.MeshFusionPro/LODGroupCombineSource.cs | 106 - .../NGS.MeshFusionPro/LODGroupSettings.cs | 63 - .../NGS.MeshFusionPro/LODGroupsCombiner.cs | 34 - .../NGS.MeshFusionPro/LODMeshFusionSource.cs | 141 - .../NGS.MeshFusionPro/LightweightVertex.cs | 95 - .../Thronefall/NGS.MeshFusionPro/MatrixHelper.cs | 18 - .../NGS.MeshFusionPro/MeshCombineInfo.cs | 43 - .../NGS.MeshFusionPro/MeshCombinerBase.cs | 44 - .../NGS.MeshFusionPro/MeshCombinerSimpleLW.cs | 29 - .../NGS.MeshFusionPro/MeshCombinerSimpleSTD.cs | 42 - .../NGS.MeshFusionPro/MeshCutterSimpleLW.cs | 66 - .../NGS.MeshFusionPro/MeshCutterSimpleSTD.cs | 138 - .../NGS.MeshFusionPro/MeshCuttingInfo.cs | 20 - .../NGS.MeshFusionPro/MeshDataListsSTD.cs | 83 - .../NGS.MeshFusionPro/MeshDataNativeArraysLW.cs | 131 - .../NGS.MeshFusionPro/MeshDataNativeArraysSTD.cs | 104 - .../NGS.MeshFusionPro/MeshFusionSource.cs | 333 -- .../NGS.MeshFusionPro/MeshSeparatorSimple.cs | 130 - .../Thronefall/NGS.MeshFusionPro/MeshType.cs | 7 - .../Thronefall/NGS.MeshFusionPro/MoveMethod.cs | 7 - .../NGS.MeshFusionPro/ObjectsCombiner.cs | 155 - .../Thronefall/NGS.MeshFusionPro/PartMoveInfo.cs | 16 - .../Thronefall/NGS.MeshFusionPro/RendererHelper.cs | 20 - .../NGS.MeshFusionPro/RendererSettings.cs | 43 - .../NGS.MeshFusionPro/RigidbodyTrackingStrategy.cs | 62 - .../NGS.MeshFusionPro/RuntimeMeshFusion.cs | 197 - .../NGS.MeshFusionPro/SimpleMeshMoverSTD.cs | 62 - .../SimpleMovableMeshSTDFactory.cs | 18 - .../NGS.MeshFusionPro/SimpleToolsLWFactory.cs | 14 - .../NGS.MeshFusionPro/SimpleToolsSTDFactory.cs | 14 - .../NGS.MeshFusionPro/SourceCombineStatus.cs | 10 - .../Thronefall/NGS.MeshFusionPro/SourceTracker.cs | 161 - .../StaticCombinedObjectMatcher.cs | 39 - .../NGS.MeshFusionPro/StaticMeshFusionSource.cs | 131 - .../NGS.MeshFusionPro/StaticObjectsCombiner.cs | 42 - .../Thronefall/NGS.MeshFusionPro/TrackingTarget.cs | 7 - .../NGS.MeshFusionPro/TransformTrackingStrategy.cs | 30 - .../NGS.MeshFusionPro/UniversalObjectsCombiner.cs | 102 - .../NGS.MeshFusionPro/VertexBufferUtil.cs | 124 - .../Thronefall/Properties/AssemblyInfo.cs | 5 - .../Rewired.Data/UserDataStore_PlayerPrefs.cs | 1358 ----- .../ControllerUIEffect.cs | 57 - .../ControllerUIElement.cs | 186 - .../GamepadTemplateUI.cs | 417 -- Thronefall_1_57/Thronefall/Rewired.Demos/Bullet.cs | 30 - .../Rewired.Demos/ControlRemappingDemo1.cs | 1797 ------- .../Rewired.Demos/CustomControllerDemo.cs | 144 - .../Rewired.Demos/CustomControllerDemo_Player.cs | 58 - .../Rewired.Demos/CustomControllersTiltDemo.cs | 47 - .../DualShock4SpecialFeaturesExample.cs | 219 - .../Rewired.Demos/EightPlayersExample_Player.cs | 71 - .../FallbackJoystickIdentificationDemo.cs | 114 - .../Rewired.Demos/PlayerMouseSpriteExample.cs | 116 - .../PlayerPointerEventHandlerExample.cs | 138 - .../PressAnyButtonToJoinExample_Assigner.cs | 57 - .../PressAnyButtonToJoinExample_GamePlayer.cs | 67 - .../PressStartToJoinExample_Assigner.cs | 87 - .../PressStartToJoinExample_GamePlayer.cs | 57 - .../SimpleCombinedKeyboardMouseRemapping.cs | 225 - .../Rewired.Demos/SimpleControlRemapping.cs | 257 - .../Thronefall/Rewired.Demos/TouchButtonExample.cs | 52 - .../Rewired.Demos/TouchJoystickExample.cs | 110 - .../Thronefall/Rewired.Demos/UIPointer.cs | 98 - .../PlayerPointerEventData.cs | 41 - .../PointerEventType.cs | 7 - .../RewiredEventSystem.cs | 49 - .../RewiredPointerInputModule.cs | 781 --- .../RewiredStandaloneInputModule.cs | 1415 ----- .../Rewired.Internal/ControllerTemplateFactory.cs | 59 - .../Thronefall/Rewired.Utils/ExternalTools.cs | 171 - .../Thronefall/Rewired/FlightPedalsTemplate.cs | 25 - .../Thronefall/Rewired/FlightYokeTemplate.cs | 265 - .../Thronefall/Rewired/GamepadTemplate.cs | 149 - .../Thronefall/Rewired/HOTASTemplate.cs | 525 -- .../Thronefall/Rewired/IFlightPedalsTemplate.cs | 10 - .../Thronefall/Rewired/IFlightYokeTemplate.cs | 102 - .../Thronefall/Rewired/IGamepadTemplate.cs | 62 - .../Thronefall/Rewired/IHOTASTemplate.cs | 180 - .../Thronefall/Rewired/IRacingWheelTemplate.cs | 88 - .../Rewired/ISixDofControllerTemplate.cs | 86 - Thronefall_1_57/Thronefall/Rewired/InputManager.cs | 81 - .../Thronefall/Rewired/RacingWheelTemplate.cs | 189 - .../Thronefall/Rewired/SixDofControllerTemplate.cs | 229 - .../Thronefall/Thronefall/AchievementManager.cs | 158 - .../Thronefall/AdditionalWeaponEffectScript.cs | 9 - .../Thronefall/Thronefall/AfterMatchUIManager.cs | 251 - .../Thronefall/Thronefall/AimbotProjectile.cs | 192 - .../Thronefall/Thronefall/AncientShrinePerk.cs | 29 - .../Thronefall/Thronefall/AnimateSizeAndDestroy.cs | 30 - .../Thronefall/Thronefall/ApplyHeroUnitPerks.cs | 20 - .../Thronefall/ApplyUpgradeIndicatorColor.cs | 15 - .../Thronefall/AttackCooldownAnimation.cs | 50 - .../Thronefall/Thronefall/AudioDayNightFader.cs | 91 - Thronefall_1_57/Thronefall/Thronefall/AudioSet.cs | 453 -- .../Thronefall/Thronefall/AutoAttack.cs | 138 - .../Thronefall/AutoAttackHighestHealth.cs | 15 - .../Thronefall/AutoAttackLowestHealth.cs | 17 - .../Thronefall/AutoAttackLowestInRangeMulti.cs | 61 - .../Thronefall/Thronefall/AutoAttackRandom.cs | 15 - .../Thronefall/Thronefall/AutoAttackTower.cs | 180 - .../Thronefall/Thronefall/AutoAttackTwoTargets.cs | 40 - .../Thronefall/Thronefall/AutoAttackWithWarning.cs | 86 - .../Thronefall/Thronefall/AutoDayNight.cs | 17 - .../Thronefall/Thronefall/AutoRevive.cs | 112 - .../Thronefall/AutoUpgradeBuildingOnStart.cs | 37 - .../Thronefall/BackToTitlescreenUIHelper.cs | 9 - .../Thronefall/Thronefall/BackupAudioListener.cs | 24 - Thronefall_1_57/Thronefall/Thronefall/BakeTrail.cs | 38 - .../Thronefall/Thronefall/BalancingParameter.cs | 47 - .../Thronefall/Thronefall/BalancingParameters.cs | 7 - .../Thronefall/Thronefall/BarricadeDamage.cs | 73 - .../Thronefall/Thronefall/BeforeGamePopUp.cs | 15 - .../Thronefall/Thronefall/BillboardAlign.cs | 18 - .../Thronefall/Thronefall/BlacksmithUpgrade.cs | 161 - .../Thronefall/Thronefall/BlacksmithUpgrades.cs | 43 - .../Thronefall/Thronefall/BlockProjectiles.cs | 53 - .../Thronefall/Thronefall/BoatAnimation.cs | 37 - .../Thronefall/Thronefall/BonusLevelInteractor.cs | 192 - Thronefall_1_57/Thronefall/Thronefall/BuildSlot.cs | 830 --- .../Thronefall/BuildingDestructionHandler.cs | 62 - .../Thronefall/Thronefall/BuildingFXProcessor.cs | 65 - .../Thronefall/Thronefall/BuildingInteractor.cs | 500 -- .../Thronefall/Thronefall/BuildingMeshTracker.cs | 60 - .../Thronefall/Thronefall/BuildingMeshesTracker.cs | 57 - .../Thronefall/BuildingRangeIndicator.cs | 161 - .../Thronefall/Thronefall/CameraBounds.cs | 135 - .../Thronefall/Thronefall/CameraController.cs | 56 - Thronefall_1_57/Thronefall/Thronefall/CameraRig.cs | 120 - .../Thronefall/Thronefall/CancelOrOpenPauseMenu.cs | 30 - Thronefall_1_57/Thronefall/Thronefall/Checkbox.cs | 29 - Thronefall_1_57/Thronefall/Thronefall/Choice.cs | 40 - .../Thronefall/Thronefall/ChoiceManager.cs | 83 - Thronefall_1_57/Thronefall/Thronefall/ChoiceUI.cs | 52 - .../Thronefall/Thronefall/ChoiceUIFrameHelper.cs | 116 - Thronefall_1_57/Thronefall/Thronefall/Coin.cs | 137 - .../Thronefall/Thronefall/CoinSpawner.cs | 63 - Thronefall_1_57/Thronefall/Thronefall/Coinslot.cs | 76 - .../Thronefall/Thronefall/ColorAndLightManager.cs | 340 -- .../Thronefall/Thronefall/Colorscheme.cs | 106 - .../Thronefall/Thronefall/CommandUnits.cs | 414 -- .../Thronefall/Thronefall/ControlConfig.cs | 41 - .../Thronefall/Thronefall/ControlConfigSaveLoad.cs | 110 - .../Thronefall/Thronefall/ControlMapButton.cs | 193 - .../Thronefall/Thronefall/ControllerPicker.cs | 12 - .../Thronefall/Thronefall/CostDisplay.cs | 257 - .../Thronefall/Thronefall/CurseBlastMA.cs | 78 - .../Thronefall/Thronefall/CurseEffect.cs | 13 - .../Thronefall/Thronefall/CustomPostProcess.cs | 62 - .../Thronefall/Thronefall/DamageModifyer.cs | 42 - .../Thronefall/DamagePlayerWhenEnteringRange.cs | 94 - .../Thronefall/Thronefall/DayCountdownUI.cs | 33 - .../Thronefall/Thronefall/DayNightCycle.cs | 283 - .../Thronefall/Thronefall/DaytimeDisplay.cs | 15 - .../Thronefall/DaytimeSensitiveActivation.cs | 53 - .../Thronefall/Thronefall/DaytimeSensitiveLight.cs | 87 - .../Thronefall/DebugBuildingDestroyer.cs | 33 - .../Thronefall/Thronefall/DebugCoinDisplay.cs | 19 - .../Thronefall/Thronefall/DebugController.cs | 138 - .../Thronefall/Thronefall/DemoQuitSwitch.cs | 11 - .../Thronefall/Thronefall/DestroyAfter.cs | 15 - .../Thronefall/DestroyOrDisableOnEnable.cs | 27 - .../Thronefall/DisableButtonInWaveZero.cs | 25 - .../Thronefall/Thronefall/DisableOnStart.cs | 9 - .../Thronefall/DynamicLayoutGroupSpacing.cs | 49 - .../Thronefall/Thronefall/ETChoicePickScreen.cs | 294 - .../Thronefall/Thronefall/ETMapChoiceDisplay.cs | 124 - .../Thronefall/Thronefall/EconomySimulator.cs | 137 - .../Thronefall/Thronefall/EliteTowers.cs | 79 - .../Thronefall/Thronefall/EnableAllChildren.cs | 12 - .../Thronefall/EndOfMatchScoreUIHelper.cs | 728 --- .../Thronefall/Thronefall/EndOfMatchUI.cs | 39 - .../Thronefall/Thronefall/EndscreenRetryHelper.cs | 31 - .../Thronefall/EnemyScreenMarkerUIHelper.cs | 89 - .../Thronefall/Thronefall/EnemySpawnLine.cs | 34 - .../Thronefall/Thronefall/EnemySpawnManager.cs | 19 - .../Thronefall/Thronefall/EnemySpawner.cs | 539 -- .../Thronefall/Thronefall/EnumSelector.cs | 163 - .../Thronefall/EnumSelectorButtonAnimation.cs | 14 - .../Thronefall/Thronefall/Equippable.cs | 15 - .../Thronefall/EquippableBuildingUpgrade.cs | 6 - .../Thronefall/Thronefall/EquippableMutation.cs | 8 - .../Thronefall/Thronefall/EquippablePerk.cs | 6 - .../Thronefall/Thronefall/EquippableWeapon.cs | 6 - .../Thronefall/Thronefall/EternalTrialEnemy.cs | 97 - .../Thronefall/Thronefall/EternalTrialEnemySet.cs | 47 - .../Thronefall/Thronefall/EternalTrialsDefeatUI.cs | 516 -- .../Thronefall/EternalTrialsHighscorePreview.cs | 66 - .../Thronefall/EternalTrialsInteractor.cs | 37 - .../Thronefall/EternalTrialsLoadoutScreenHelper.cs | 11 - .../Thronefall/EternalTrialsMapPreview.cs | 36 - .../Thronefall/Thronefall/EternalTrialsRun.cs | 124 - .../Thronefall/EternalTrialsRunManager.cs | 214 - .../Thronefall/EternalTrialsSelectScreen.cs | 67 - .../Thronefall/EternalTrialsStageCountDisplay.cs | 27 - .../Thronefall/EternalTrialsVictoryUI.cs | 246 - .../Thronefall/Thronefall/EternalWaveGenerator.cs | 17 - .../Thronefall/Thronefall/FakeChildTo.cs | 40 - .../Thronefall/Thronefall/FakeTransorm.cs | 41 - .../Thronefall/Thronefall/FireArcherBurn.cs | 83 - .../Thronefall/Thronefall/FishingHarbour.cs | 97 - .../Thronefall/Thronefall/FishingHarbourUpgrade.cs | 15 - .../Thronefall/Thronefall/FollowTransform.cs | 14 - .../Thronefall/ForceCameraPosOnEnable.cs | 27 - .../Thronefall/FreezePositionOnEnable.cs | 25 - .../Thronefall/Thronefall/FromToAnimation.cs | 45 - .../Thronefall/Thronefall/GPUInstanced.cs | 80 - .../Thronefall/Thronefall/GPUInstancingManager.cs | 119 - .../Thronefall/Thronefall/GateOpener.cs | 172 - .../Thronefall/Thronefall/GlobalAudioListener.cs | 48 - .../Thronefall/Thronefall/GlobalHealing.cs | 78 - .../Thronefall/Thronefall/GraphDrawer.cs | 125 - .../Thronefall/Thronefall/HealBoostMA.cs | 69 - .../Thronefall/HealthStealWeaponEffect.cs | 14 - Thronefall_1_57/Thronefall/Thronefall/Healthbar.cs | 172 - .../Thronefall/Thronefall/HealthbarMulti.cs | 46 - .../Thronefall/Thronefall/HighscorePreviewUI.cs | 66 - .../Thronefall/Thronefall/HighscoreTable.cs | 132 - .../Thronefall/Thronefall/HotOilTower.cs | 106 - Thronefall_1_57/Thronefall/Thronefall/Hp.cs | 463 -- Thronefall_1_57/Thronefall/Thronefall/ISaveLoad.cs | 10 - .../Thronefall/Thronefall/IUIAnimationSequence.cs | 9 - .../Thronefall/Thronefall/InGamePopUp.cs | 9 - .../Thronefall/Thronefall/InGamePopUpHelper.cs | 56 - .../Thronefall/Thronefall/InGameResignUIHelper.cs | 18 - .../Thronefall/Thronefall/InMatchResignHelper.cs | 45 - .../Thronefall/Thronefall/IncomeModifyer.cs | 17 - .../Thronefall/IncreaseAttackSpeedOverTime.cs | 56 - .../Thronefall/Thronefall/IncreaseIncomeDaily.cs | 56 - .../Thronefall/Thronefall/InteractorBase.cs | 27 - .../Thronefall/Thronefall/Invulnerable.cs | 16 - .../Thronefall/KeepRelativeRotationTo.cs | 59 - .../Thronefall/Thronefall/KeyRebinder.cs | 444 -- .../Thronefall/Thronefall/KeyframedBoss.cs | 180 - .../LaunchableDefenseMechanismInteractor.cs | 87 - .../Thronefall/Thronefall/LaunchableProjectile.cs | 66 - .../Thronefall/Thronefall/LevelAudio.cs | 69 - .../Thronefall/Thronefall/LevelBorder.cs | 191 - Thronefall_1_57/Thronefall/Thronefall/LevelData.cs | 46 - Thronefall_1_57/Thronefall/Thronefall/LevelInfo.cs | 93 - .../Thronefall/Thronefall/LevelInteractor.cs | 231 - .../Thronefall/Thronefall/LevelNameDisplay.cs | 32 - .../Thronefall/Thronefall/LevelProgressManager.cs | 129 - .../Thronefall/Thronefall/LevelSelectManager.cs | 95 - .../Thronefall/LevelSelectUIFrameHelper.cs | 53 - .../Thronefall/LevelUpScreenAnimation.cs | 29 - .../Thronefall/Thronefall/LightningStriker.cs | 87 - .../Thronefall/Thronefall/LightningWandMA.cs | 70 - .../Thronefall/Thronefall/LimitDeltaTime.cs | 11 - .../Thronefall/Thronefall/LimitedLifetime.cs | 11 - .../Thronefall/Thronefall/LoadSceneOnTop.cs | 25 - .../Thronefall/Thronefall/LoadoutUIHelper.cs | 552 -- .../Thronefall/Thronefall/LocalGamestate.cs | 171 - .../Thronefall/Thronefall/LocalMatchSaveLoad.cs | 137 - .../Thronefall/Thronefall/LvlSelectTabButton.cs | 51 - .../Thronefall/Thronefall/ManualAttack.cs | 306 -- .../Thronefall/Thronefall/MapAchievements.cs | 17 - Thronefall_1_57/Thronefall/Thronefall/MapChoice.cs | 74 - Thronefall_1_57/Thronefall/Thronefall/MatchSave.cs | 190 - .../Thronefall/Thronefall/MatchSaveLoadHandler.cs | 136 - .../Thronefall/Thronefall/MaterialFlasherFX.cs | 77 - Thronefall_1_57/Thronefall/Thronefall/MetaLevel.cs | 9 - Thronefall_1_57/Thronefall/Thronefall/MillRotor.cs | 44 - .../Thronefall/Thronefall/Mill_ImprovedPlow.cs | 26 - .../Thronefall/Mill_ImprovementExplosiveTrap.cs | 87 - .../Thronefall/Mill_ImprovementWindSpirits.cs | 119 - .../Thronefall/Mill_Improvement_Scarecrows.cs | 26 - Thronefall_1_57/Thronefall/Thronefall/MineShaft.cs | 216 - .../Thronefall/Thronefall/ModeRulesDisplay.cs | 31 - Thronefall_1_57/Thronefall/Thronefall/Moleman.cs | 168 - .../Thronefall/Thronefall/MusicManager.cs | 163 - .../Thronefall/Thronefall/NavmeshBakeHelper.cs | 19 - Thronefall_1_57/Thronefall/Thronefall/NightCall.cs | 144 - .../Thronefall/Thronefall/NightLight.cs | 106 - .../Thronefall/Thronefall/NightPreviewElement.cs | 42 - Thronefall_1_57/Thronefall/Thronefall/Nighthorn.cs | 172 - .../Thronefall/Thronefall/NightscoreUI.cs | 294 - .../Thronefall/OnDamageFeedbackHandler.cs | 28 - .../Thronefall/Thronefall/OneShotAnimationBase.cs | 6 - .../Thronefall/Thronefall/PathMesher.cs | 339 -- .../Thronefall/Thronefall/PathfindMovement.cs | 15 - .../Thronefall/Thronefall/PathfindMovementEnemy.cs | 300 -- .../Thronefall/PathfindMovementPlayerunit.cs | 405 -- .../Thronefall/Thronefall/PaulsWaveGenerator.cs | 238 - .../Thronefall/Thronefall/PauseBackToMenuHelper.cs | 9 - .../Thronefall/Thronefall/PauseUILoadoutHelper.cs | 235 - ...PeriodicallyEnableAndDisableDuringEnemySpawn.cs | 29 - .../Thronefall/Thronefall/PerkCooldownModifyer.cs | 21 - .../Thronefall/Thronefall/PerkCostModifyer.cs | 26 - .../Thronefall/PerkDamageAutoAttackModifyer.cs | 23 - .../Thronefall/PerkDamageModifyerPlayerunitAuto.cs | 54 - .../Thronefall/PerkDestroyGameObjectModifyer.cs | 47 - .../Thronefall/Thronefall/PerkHpModifyer.cs | 74 - .../Thronefall/Thronefall/PerkIncomeModifyer.cs | 54 - .../Thronefall/Thronefall/PerkIndestructible.cs | 20 - .../Thronefall/Thronefall/PerkManager.cs | 403 -- .../Thronefall/Thronefall/PerkPlayerHealthRegen.cs | 46 - Thronefall_1_57/Thronefall/Thronefall/PerkPoint.cs | 6 - .../Thronefall/Thronefall/PerkRangeModifyer.cs | 31 - .../Thronefall/Thronefall/PerkSelectionGroup.cs | 165 - .../Thronefall/Thronefall/PerkSelectionItem.cs | 80 - .../Thronefall/PerkSelectionTooltipHelper.cs | 187 - .../Thronefall/Thronefall/PerkSpeedModifyer.cs | 20 - .../Thronefall/Thronefall/PerkWeaponModifyer.cs | 19 - .../Thronefall/Thronefall/PhysicalCoinAnimator.cs | 26 - .../Thronefall/Thronefall/PlayLevelButton.cs | 40 - .../Thronefall/Thronefall/PlayMusicOnStart.cs | 31 - .../Thronefall/PlayOneShotAfterSeconds.cs | 22 - .../Thronefall/Thronefall/PlayerAttack.cs | 33 - .../Thronefall/Thronefall/PlayerAttackAnimator.cs | 27 - .../Thronefall/PlayerAttackTargetFacer.cs | 66 - .../Thronefall/Thronefall/PlayerBallMovement.cs | 115 - .../Thronefall/Thronefall/PlayerCharacterAudio.cs | 94 - .../Thronefall/Thronefall/PlayerHpRegen.cs | 64 - .../Thronefall/Thronefall/PlayerInteraction.cs | 254 - .../Thronefall/Thronefall/PlayerManager.cs | 68 - .../Thronefall/Thronefall/PlayerMovement.cs | 218 - .../Thronefall/Thronefall/PlayerScept.cs | 89 - .../Thronefall/Thronefall/PlayerUpgradeManager.cs | 133 - .../Thronefall/Thronefall/PlayerWeaponAudio.cs | 63 - .../Thronefall/Thronefall/PlayerWeaponVisuals.cs | 35 - .../Thronefall/Thronefall/PositionAnimation.cs | 42 - .../Thronefall/Thronefall/PowerTowerPerk.cs | 56 - .../Thronefall/PracticeTargetCoinDrop.cs | 33 - .../Thronefall/Thronefall/PriorityAudioListener.cs | 27 - .../Thronefall/Thronefall/ProductionBar.cs | 23 - .../Thronefall/Thronefall/ProjectileAudio.cs | 37 - .../Thronefall/ProjectileImpactParticles.cs | 22 - .../Thronefall/Thronefall/ProjectileSpawnAudio.cs | 11 - .../Thronefall/Thronefall/PushPlayer2D.cs | 28 - Thronefall_1_57/Thronefall/Thronefall/Quest.cs | 126 - .../Thronefall/QuestConditionEquippable.cs | 33 - .../Thronefall/Thronefall/QuestEntry.cs | 88 - Thronefall_1_57/Thronefall/Thronefall/QuestMenu.cs | 21 - .../Thronefall/QuestOverallProgressDisplay.cs | 15 - .../Thronefall/Thronefall/QuestTagUI.cs | 107 - .../Thronefall/QuickslingBarrelRotator.cs | 40 - Thronefall_1_57/Thronefall/Thronefall/RacerRoll.cs | 16 - .../Thronefall/RandomizeExtensionsForLists.cs | 18 - .../Thronefall/Thronefall/RangeIndicatorHandler.cs | 207 - .../ReduceChildrensBuildRequirementIfPerk.cs | 23 - .../Thronefall/Thronefall/ResetAudioSettings.cs | 13 - .../Thronefall/Thronefall/ResetControlsHelper.cs | 9 - .../Thronefall/Thronefall/ResolutionExtensions.cs | 13 - .../Thronefall/Thronefall/RevivePanel.cs | 29 - .../Thronefall/Thronefall/RidingDamager.cs | 81 - .../Thronefall/Thronefall/RiverScroller.cs | 18 - .../Thronefall/RotateForwardToRVOVelocity.cs | 64 - .../Thronefall/Thronefall/RoyalForgeUpgrade.cs | 203 - .../Thronefall/Thronefall/RoyalForgeUpgrades.cs | 27 - .../Thronefall/Thronefall/SaveLoadEntity.cs | 63 - .../Thronefall/Thronefall/SaveLoadManager.cs | 238 - .../Thronefall/Thronefall/ScaleAnimation.cs | 42 - .../Thronefall/Thronefall/ScalePulse.cs | 18 - .../Thronefall/Thronefall/SceneNameToLevelData.cs | 6 - .../Thronefall/SceneTransitionManager.cs | 276 - .../Thronefall/Thronefall/ScoreManager.cs | 209 - Thronefall_1_57/Thronefall/Thronefall/ScoreTag.cs | 21 - .../Thronefall/Thronefall/ScreenMarker.cs | 212 - .../Thronefall/ScreenMarkerCanvasHelper.cs | 19 - .../Thronefall/Thronefall/ScreenMarkerIcon.cs | 12 - .../Thronefall/Thronefall/ScreenMarkerManager.cs | 284 - .../Thronefall/Thronefall/ScrollArea.cs | 119 - .../Thronefall/Thronefall/ScrollElementID.cs | 6 - .../Thronefall/Thronefall/SeasonTwoWaveGen.cs | 389 -- .../Thronefall/Thronefall/SelectUnitUI.cs | 28 - .../Thronefall/SelfDestructWhenInRangeOf.cs | 33 - .../Thronefall/Thronefall/SetStateWhenMacOSX.cs | 13 - .../Thronefall/Thronefall/SetWidthToTarget.cs | 29 - .../Thronefall/Thronefall/SettingsAntiAliasing.cs | 26 - .../Thronefall/Thronefall/SettingsAudioVolume.cs | 26 - .../Thronefall/Thronefall/SettingsFullscreen.cs | 19 - .../Thronefall/Thronefall/SettingsLanguage.cs | 32 - .../Thronefall/Thronefall/SettingsLanguageReset.cs | 14 - .../Thronefall/Thronefall/SettingsManager.cs | 443 -- .../Thronefall/SettingsPostProcessing.cs | 19 - .../Thronefall/SettingsPostProcessingHelper.cs | 18 - .../Thronefall/Thronefall/SettingsRenderScale.cs | 24 - .../Thronefall/SettingsResetUnitsMorning.cs | 19 - .../Thronefall/Thronefall/SettingsResetVideo.cs | 13 - .../Thronefall/Thronefall/SettingsResolution.cs | 41 - .../Thronefall/SettingsShadowResolution.cs | 26 - .../Thronefall/Thronefall/SettingsUIHelper.cs | 122 - .../Thronefall/Thronefall/SettingsUseLargeUI.cs | 22 - .../Thronefall/Thronefall/SettingsVsync.cs | 19 - .../Thronefall/Thronefall/SettingsWinterMode.cs | 19 - .../Thronefall/Thronefall/ShapeGroupFader.cs | 31 - .../Thronefall/Thronefall/SharpCornerMidigator.cs | 46 - .../Thronefall/Thronefall/ShieldOnFirstDamaged.cs | 86 - Thronefall_1_57/Thronefall/Thronefall/Shrine.cs | 208 - .../Thronefall/Thronefall/SimpleRotator.cs | 23 - .../Thronefall/Thronefall/SimpleUIScaler.cs | 43 - .../Thronefall/Thronefall/SimpleWalk.cs | 55 - .../Thronefall/SizeRectangleToMeshBounds.cs | 20 - .../Thronefall/Thronefall/SlowEffect.cs | 17 - Thronefall_1_57/Thronefall/Thronefall/Spawn.cs | 265 - .../Thronefall/Thronefall/SpawnAttackAfter.cs | 67 - Thronefall_1_57/Thronefall/Thronefall/SpawnMA.cs | 15 - .../Thronefall/Thronefall/SpinAnimation.cs | 45 - .../Thronefall/Thronefall/SplashDamageArea.cs | 51 - Thronefall_1_57/Thronefall/Thronefall/StabMA.cs | 92 - .../Thronefall/Thronefall/SteamManager.cs | 209 - .../StringFloatSerializableDictionary.cs | 6 - .../Thronefall/SuperSimpleOceanAnimation.cs | 47 - .../Thronefall/Thronefall/SuperWaveGen.cs | 1508 ------ .../SuspendPlayerCollisionUntilNoOverlap.cs | 98 - .../Thronefall/Thronefall/TFUIAudioHelper.cs | 53 - .../Thronefall/Thronefall/TFUIBlockoutElement.cs | 44 - .../Thronefall/TFUICheckboxMouseCatcher.cs | 43 - Thronefall_1_57/Thronefall/Thronefall/TFUIEnemy.cs | 250 - .../Thronefall/Thronefall/TFUIEnumMouseCatcher.cs | 51 - .../Thronefall/TFUIEnumSelectorButton.cs | 40 - .../Thronefall/Thronefall/TFUIEquippable.cs | 375 -- .../Thronefall/Thronefall/TFUIFocusCatcher.cs | 26 - .../Thronefall/Thronefall/TFUIIncomeDisplay.cs | 92 - .../Thronefall/Thronefall/TFUIPerklike.cs | 161 - .../Thronefall/Thronefall/TFUIScrollBar.cs | 51 - .../Thronefall/Thronefall/TFUISlider.cs | 141 - .../Thronefall/Thronefall/TFUISliderDragArea.cs | 127 - .../Thronefall/Thronefall/TFUITextButton.cs | 206 - .../Thronefall/Thronefall/TFUIUpgradeChoice.cs | 207 - .../Thronefall/Thronefall/TagManager.cs | 299 -- .../Thronefall/Thronefall/TaggedObject.cs | 102 - .../Thronefall/Thronefall/TargetPriority.cs | 247 - .../Thronefall/Thronefall/TelePlayer.cs | 66 - .../Thronefall/Thronefall/TextBackgroundFitter.cs | 24 - .../Thronefall/Thronefall/TextMirror.cs | 14 - .../Thronefall/Thronefall/TextTranslator.cs | 41 - .../Thronefall/ThronefallAudioManager.cs | 348 -- .../Thronefall/Thronefall/ThronefallUIElement.cs | 168 - .../Thronefall/Thronefall/TieBreaker.cs | 111 - .../Thronefall/Thronefall/TimesensitiveLight.cs | 72 - .../Thronefall/TitleScreenPopUpHelper.cs | 50 - .../Thronefall/Thronefall/TitleScreenUIHelper.cs | 32 - Thronefall_1_57/Thronefall/Thronefall/Tooltip.cs | 63 - .../Thronefall/Thronefall/TooltipManager.cs | 102 - .../Thronefall/Thronefall/TowerUpgrade.cs | 114 - .../Thronefall/TransitionToSelectedLevelHelper.cs | 19 - .../Thronefall/Thronefall/TreasureChestUIHelper.cs | 39 - .../Thronefall/Thronefall/TreasuryUI.cs | 218 - .../Thronefall/Thronefall/TutorialManager.cs | 662 --- .../Thronefall/Thronefall/UIBonusLevelSelect.cs | 109 - Thronefall_1_57/Thronefall/Thronefall/UIFrame.cs | 343 -- .../Thronefall/Thronefall/UIFrameManager.cs | 406 -- .../Thronefall/Thronefall/UIParentResizer.cs | 40 - .../Thronefall/Thronefall/UIScaleHandler.cs | 45 - .../Thronefall/Thronefall/UnitAttackAnimator.cs | 31 - Thronefall_1_57/Thronefall/Thronefall/UnitAudio.cs | 395 -- .../Thronefall/UnitCommandRadiusAnimation.cs | 68 - .../Thronefall/Thronefall/UnitDashJump.cs | 137 - .../Thronefall/UnitProductionSelector.cs | 114 - .../Thronefall/UnitRespawnerForBuildings.cs | 113 - .../Thronefall/Thronefall/UnitSpawnAppear.cs | 36 - .../Thronefall/UnitySerializedDictionary.cs | 35 - .../Thronefall/UnparentAndDestroyDelayedOnDeath.cs | 19 - .../Thronefall/Thronefall/UnparentOnStart.cs | 9 - .../Thronefall/UpgradeAssassinsTraining.cs | 36 - .../Thronefall/Thronefall/UpgradeBuildersGuild.cs | 82 - .../Thronefall/Thronefall/UpgradeCastleUp.cs | 76 - .../Thronefall/Thronefall/UpgradeCommander.cs | 39 - .../Thronefall/Thronefall/UpgradeGodlyCurse.cs | 9 - .../Thronefall/Thronefall/UpgradeMagicArmor.cs | 19 - .../Thronefall/Thronefall/UpgradePlayerDmg.cs | 12 - .../Thronefall/Thronefall/UpgradePlayerHp.cs | 22 - .../Thronefall/Thronefall/UpgradeUnitsOnEnable.cs | 30 - .../Thronefall/Thronefall/VersionNumberDisplay.cs | 12 - .../Thronefall/Thronefall/VirtualBuilding.cs | 113 - Thronefall_1_57/Thronefall/Thronefall/Wave.cs | 153 - .../Thronefall/Thronefall/WaveCountPopUp.cs | 81 - .../Thronefall/Thronefall/WaveDescriptionUI.cs | 30 - Thronefall_1_57/Thronefall/Thronefall/WaveDraft.cs | 28 - .../Thronefall/Thronefall/WaveEnemyInfo.cs | 16 - .../Thronefall/Thronefall/WaveGenUtility.cs | 39 - Thronefall_1_57/Thronefall/Thronefall/WaveInfo.cs | 38 - Thronefall_1_57/Thronefall/Thronefall/Weapon.cs | 249 - .../Thronefall/Thronefall/WeaponDamageDealer.cs | 18 - .../Thronefall/Thronefall/WeaponEquipper.cs | 37 - Thronefall_1_57/Thronefall/Thronefall/Wiggler.cs | 46 - .../Thronefall/WigglerAnimatedVelocity.cs | 45 - .../Thronefall/Thronefall/WigglerAnimationState.cs | 6 - .../Thronefall/Thronefall/WigglerVelocity.cs | 40 - .../Thronefall/Thronefall/WishlistButton.cs | 9 - ...__JobReflectionRegistrationOutput__296523972.cs | 29 - Thronefall_1_57/Thronefall/Thronefall_1_57.csproj | 377 -- Thronefall_1_57/Thronefall/Thronefall_1_57.sln | 25 - ...itySourceGeneratedAssemblyMonoScriptTypes_v1.cs | 5653 -------------------- 632 files changed, 75738 deletions(-) delete mode 100644 Thronefall_1_57/.gitignore delete mode 100644 Thronefall_1_57/Thronefall/.gitignore delete mode 100644 Thronefall_1_57/Thronefall/Ara/AraTrail.cs delete mode 100644 Thronefall_1_57/Thronefall/Ara/ColorFromSpeed.cs delete mode 100644 Thronefall_1_57/Thronefall/Ara/ElasticArray.cs delete mode 100644 Thronefall_1_57/Thronefall/Ara/ElectricalArc.cs delete mode 100644 Thronefall_1_57/Thronefall/Ara/TireTrack.cs delete mode 100644 Thronefall_1_57/Thronefall/Ara/TrailSection.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/BlitTexturePass.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/Buoyancy.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/FlatKitFog.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/FlatKitOutline.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/FogSettings.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/OutlineSettings.cs delete mode 100644 Thronefall_1_57/Thronefall/FlatKit/UvScroller.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSON.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONArray.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONBinaryTag.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONClass.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONData.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONLazyCreator.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONNode.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ArabicMapping.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ArabicTable.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/AutoChangeCultureInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/BaseSpecializationManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/CallbackNotification.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/CoroutineManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/CustomLocalizeCallback.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/EventCallback.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/Example_ChangeLanguage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/Example_LocalizedString.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/GeneralArabicLetters.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/GlobalParametersExample.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/GoogleLanguages.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/GoogleTranslation.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/HindiFixer.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/I2BasePersistentStorage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/I2CustomPersistentStorage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/I2Utils.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ILanguageSource.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ILocalizationParamsManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTarget.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTargetDescriptor.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/IResourceManager_Bundles.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/IsolatedArabicLetters.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LanguageData.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LanguageSource.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceAsset.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceData.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizationManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizationParamsManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizationReader.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/Localize.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeDropdown.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Child.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Prefab.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Type.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_Label.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_UGUI.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_AudioSource.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Child.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_MeshRenderer.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Prefab.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_SpriteRenderer.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_TextMesh.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_VideoPlayer.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Image.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_RawImage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Text.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/LocalizedString.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/PersistentStorage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/RTLFixer.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/RTLFixerTool.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/RealTimeTranslation.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/RegisterBundlesManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/RegisterCallback_AllowSyncFromGoogle.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/RegisterGlobalParameters.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ResourceManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/SetLanguage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/SetLanguageDropdown.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/SpecializationManager.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/StringObfucator.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TashkeelLocation.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TermData.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TermsPopup.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ToggleLanguage.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationFlag.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationJob.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_GET.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_Main.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_POST.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WEB.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WWW.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/TranslationQuery.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/eLanguageDataFlags.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/ePluralType.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/eSpreadsheetUpdateMode.cs delete mode 100644 Thronefall_1_57/Thronefall/I2.Loc/eTermType.cs delete mode 100644 Thronefall_1_57/Thronefall/MoreMountains.Feedbacks/OneShotAudioTrigger.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/AfterCombineAction.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTree.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeDrawer.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeNode.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BoundsHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineErrorStrategy.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineMethod.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTree.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTreeNode.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroup.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupMatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupPart.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMesh.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshData.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshDataInternal.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPart.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPartInternal.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObject.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectMatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectPart.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombineSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObject.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPart.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPartInternal.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicMeshFusionSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicObjectsCombiner.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IAsyncCombinedMeshMover.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IBinaryTreeNode.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombineSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshMover.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObject.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObjectPart.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCombiner.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCutter.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshToolsFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMovableCombinedMeshFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ISourceTrackingStrategy.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverLW.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverSTD.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshLWFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshSTDFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupCombineSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupSettings.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupsCombiner.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODMeshFusionSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LightweightVertex.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MatrixHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombineInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerBase.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleLW.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleSTD.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleLW.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleSTD.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCuttingInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataListsSTD.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysLW.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysSTD.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshFusionSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshSeparatorSimple.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshType.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MoveMethod.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ObjectsCombiner.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/PartMoveInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererSettings.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RigidbodyTrackingStrategy.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RuntimeMeshFusion.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMeshMoverSTD.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMovableMeshSTDFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsLWFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsSTDFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceCombineStatus.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceTracker.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticCombinedObjectMatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticMeshFusionSource.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticObjectsCombiner.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TrackingTarget.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TransformTrackingStrategy.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/UniversalObjectsCombiner.cs delete mode 100644 Thronefall_1_57/Thronefall/NGS.MeshFusionPro/VertexBufferUtil.cs delete mode 100644 Thronefall_1_57/Thronefall/Properties/AssemblyInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Data/UserDataStore_PlayerPrefs.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIEffect.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIElement.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/GamepadTemplateUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/Bullet.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/ControlRemappingDemo1.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo_Player.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllersTiltDemo.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/DualShock4SpecialFeaturesExample.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/EightPlayersExample_Player.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/FallbackJoystickIdentificationDemo.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/PlayerMouseSpriteExample.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/PlayerPointerEventHandlerExample.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_Assigner.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_GamePlayer.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_Assigner.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_GamePlayer.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/SimpleCombinedKeyboardMouseRemapping.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/SimpleControlRemapping.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/TouchButtonExample.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/TouchJoystickExample.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Demos/UIPointer.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Integration.UnityUI/PlayerPointerEventData.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Integration.UnityUI/PointerEventType.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Integration.UnityUI/RewiredEventSystem.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Integration.UnityUI/RewiredPointerInputModule.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Integration.UnityUI/RewiredStandaloneInputModule.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Internal/ControllerTemplateFactory.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired.Utils/ExternalTools.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/FlightPedalsTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/FlightYokeTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/GamepadTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/HOTASTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/IFlightPedalsTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/IFlightYokeTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/IGamepadTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/IHOTASTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/IRacingWheelTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/ISixDofControllerTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/InputManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/RacingWheelTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Rewired/SixDofControllerTemplate.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AchievementManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AdditionalWeaponEffectScript.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AfterMatchUIManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AimbotProjectile.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AncientShrinePerk.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AnimateSizeAndDestroy.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ApplyHeroUnitPerks.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ApplyUpgradeIndicatorColor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AttackCooldownAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AudioDayNightFader.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AudioSet.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttack.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackHighestHealth.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackLowestHealth.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackLowestInRangeMulti.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackRandom.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackTower.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackTwoTargets.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoAttackWithWarning.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoDayNight.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoRevive.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/AutoUpgradeBuildingOnStart.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BackToTitlescreenUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BackupAudioListener.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BakeTrail.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BalancingParameter.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BalancingParameters.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BarricadeDamage.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BeforeGamePopUp.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BillboardAlign.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BlacksmithUpgrade.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BlacksmithUpgrades.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BlockProjectiles.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BoatAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BonusLevelInteractor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildSlot.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildingDestructionHandler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildingFXProcessor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildingInteractor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildingMeshTracker.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildingMeshesTracker.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/BuildingRangeIndicator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CameraBounds.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CameraController.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CameraRig.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CancelOrOpenPauseMenu.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Checkbox.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Choice.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ChoiceManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ChoiceUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ChoiceUIFrameHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Coin.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CoinSpawner.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Coinslot.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ColorAndLightManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Colorscheme.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CommandUnits.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ControlConfig.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ControlConfigSaveLoad.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ControlMapButton.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ControllerPicker.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CostDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CurseBlastMA.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CurseEffect.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/CustomPostProcess.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DamageModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DamagePlayerWhenEnteringRange.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DayCountdownUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DayNightCycle.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DaytimeDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DaytimeSensitiveActivation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DaytimeSensitiveLight.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DebugBuildingDestroyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DebugCoinDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DebugController.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DemoQuitSwitch.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DestroyAfter.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DestroyOrDisableOnEnable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DisableButtonInWaveZero.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DisableOnStart.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/DynamicLayoutGroupSpacing.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ETChoicePickScreen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ETMapChoiceDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EconomySimulator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EliteTowers.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnableAllChildren.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EndOfMatchScoreUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EndOfMatchUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EndscreenRetryHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnemyScreenMarkerUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnemySpawnLine.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnemySpawnManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnemySpawner.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnumSelector.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EnumSelectorButtonAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Equippable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EquippableBuildingUpgrade.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EquippableMutation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EquippablePerk.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EquippableWeapon.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialEnemy.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialEnemySet.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsDefeatUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsHighscorePreview.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsInteractor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsLoadoutScreenHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsMapPreview.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsRun.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsRunManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsSelectScreen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsStageCountDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalTrialsVictoryUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/EternalWaveGenerator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FakeChildTo.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FakeTransorm.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FireArcherBurn.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FishingHarbour.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FishingHarbourUpgrade.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FollowTransform.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ForceCameraPosOnEnable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FreezePositionOnEnable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/FromToAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/GPUInstanced.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/GPUInstancingManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/GateOpener.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/GlobalAudioListener.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/GlobalHealing.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/GraphDrawer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/HealBoostMA.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/HealthStealWeaponEffect.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Healthbar.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/HealthbarMulti.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/HighscorePreviewUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/HighscoreTable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/HotOilTower.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Hp.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ISaveLoad.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/IUIAnimationSequence.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/InGamePopUp.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/InGamePopUpHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/InGameResignUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/InMatchResignHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/IncomeModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/IncreaseAttackSpeedOverTime.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/IncreaseIncomeDaily.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/InteractorBase.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Invulnerable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/KeepRelativeRotationTo.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/KeyRebinder.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/KeyframedBoss.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LaunchableDefenseMechanismInteractor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LaunchableProjectile.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelAudio.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelBorder.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelData.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelInteractor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelNameDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelProgressManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelSelectManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelSelectUIFrameHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LevelUpScreenAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LightningStriker.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LightningWandMA.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LimitDeltaTime.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LimitedLifetime.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LoadSceneOnTop.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LoadoutUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LocalGamestate.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LocalMatchSaveLoad.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/LvlSelectTabButton.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ManualAttack.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MapAchievements.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MapChoice.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MatchSave.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MatchSaveLoadHandler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MaterialFlasherFX.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MetaLevel.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MillRotor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Mill_ImprovedPlow.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Mill_ImprovementExplosiveTrap.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Mill_ImprovementWindSpirits.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Mill_Improvement_Scarecrows.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MineShaft.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ModeRulesDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Moleman.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/MusicManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/NavmeshBakeHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/NightCall.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/NightLight.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Nighthorn.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/NightscoreUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/OnDamageFeedbackHandler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/OneShotAnimationBase.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PathMesher.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PathfindMovement.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PathfindMovementEnemy.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PathfindMovementPlayerunit.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PaulsWaveGenerator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PauseBackToMenuHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PauseUILoadoutHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PeriodicallyEnableAndDisableDuringEnemySpawn.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkCooldownModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkCostModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkDamageAutoAttackModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkDamageModifyerPlayerunitAuto.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkDestroyGameObjectModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkHpModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkIncomeModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkIndestructible.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkPlayerHealthRegen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkPoint.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkRangeModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkSelectionGroup.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkSelectionItem.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkSelectionTooltipHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkSpeedModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PerkWeaponModifyer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PhysicalCoinAnimator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayLevelButton.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayMusicOnStart.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayOneShotAfterSeconds.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerAttack.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerAttackAnimator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerAttackTargetFacer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerBallMovement.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerCharacterAudio.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerHpRegen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerInteraction.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerMovement.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerScept.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerUpgradeManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerWeaponAudio.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PlayerWeaponVisuals.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PositionAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PowerTowerPerk.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PracticeTargetCoinDrop.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PriorityAudioListener.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ProductionBar.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ProjectileAudio.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ProjectileImpactParticles.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ProjectileSpawnAudio.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/PushPlayer2D.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Quest.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/QuestConditionEquippable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/QuestEntry.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/QuestMenu.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/QuestOverallProgressDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/QuestTagUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/QuickslingBarrelRotator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RacerRoll.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RandomizeExtensionsForLists.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RangeIndicatorHandler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ReduceChildrensBuildRequirementIfPerk.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ResetAudioSettings.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ResetControlsHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ResolutionExtensions.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RevivePanel.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RidingDamager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RiverScroller.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RotateForwardToRVOVelocity.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RoyalForgeUpgrade.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/RoyalForgeUpgrades.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SaveLoadEntity.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SaveLoadManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScaleAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScalePulse.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SceneNameToLevelData.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SceneTransitionManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScoreManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScoreTag.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScreenMarker.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScreenMarkerCanvasHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScreenMarkerIcon.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScreenMarkerManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScrollArea.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ScrollElementID.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SeasonTwoWaveGen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SelectUnitUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SelfDestructWhenInRangeOf.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SetStateWhenMacOSX.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SetWidthToTarget.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsAntiAliasing.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsAudioVolume.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsFullscreen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsLanguage.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsLanguageReset.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsPostProcessing.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsPostProcessingHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsRenderScale.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsResetUnitsMorning.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsResetVideo.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsResolution.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsShadowResolution.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsUseLargeUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsVsync.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SettingsWinterMode.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ShapeGroupFader.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SharpCornerMidigator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ShieldOnFirstDamaged.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Shrine.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SimpleRotator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SimpleUIScaler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SimpleWalk.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SizeRectangleToMeshBounds.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SlowEffect.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Spawn.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SpawnAttackAfter.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SpawnMA.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SpinAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SplashDamageArea.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/StabMA.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SteamManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/StringFloatSerializableDictionary.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SuperSimpleOceanAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SuperWaveGen.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/SuspendPlayerCollisionUntilNoOverlap.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIAudioHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIBlockoutElement.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUICheckboxMouseCatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIEnemy.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIEnumMouseCatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIEnumSelectorButton.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIEquippable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIFocusCatcher.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIIncomeDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIPerklike.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIScrollBar.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUISlider.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUISliderDragArea.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUITextButton.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TFUIUpgradeChoice.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TagManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TaggedObject.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TargetPriority.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TelePlayer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TextBackgroundFitter.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TextMirror.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TextTranslator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ThronefallAudioManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/ThronefallUIElement.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TieBreaker.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TimesensitiveLight.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TitleScreenPopUpHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TitleScreenUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Tooltip.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TooltipManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TowerUpgrade.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TransitionToSelectedLevelHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TreasureChestUIHelper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TreasuryUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/TutorialManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UIBonusLevelSelect.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UIFrame.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UIFrameManager.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UIParentResizer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UIScaleHandler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitAttackAnimator.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitAudio.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitCommandRadiusAnimation.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitDashJump.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitProductionSelector.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitRespawnerForBuildings.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitSpawnAppear.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnitySerializedDictionary.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnparentAndDestroyDelayedOnDeath.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UnparentOnStart.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeAssassinsTraining.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeBuildersGuild.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeCastleUp.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeCommander.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeGodlyCurse.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeMagicArmor.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradePlayerDmg.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradePlayerHp.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/UpgradeUnitsOnEnable.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/VersionNumberDisplay.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/VirtualBuilding.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Wave.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WaveCountPopUp.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WaveDescriptionUI.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WaveDraft.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WaveEnemyInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WaveGenUtility.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WaveInfo.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Weapon.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WeaponDamageDealer.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/Wiggler.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WigglerAnimatedVelocity.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WigglerAnimationState.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WigglerVelocity.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/WishlistButton.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall/__JobReflectionRegistrationOutput__296523972.cs delete mode 100644 Thronefall_1_57/Thronefall/Thronefall_1_57.csproj delete mode 100644 Thronefall_1_57/Thronefall/Thronefall_1_57.sln delete mode 100644 Thronefall_1_57/Thronefall/UnitySourceGeneratedAssemblyMonoScriptTypes_v1.cs (limited to 'Thronefall_1_57') diff --git a/Thronefall_1_57/.gitignore b/Thronefall_1_57/.gitignore deleted file mode 100644 index 3f7077b..0000000 --- a/Thronefall_1_57/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/Game \ No newline at end of file diff --git a/Thronefall_1_57/Thronefall/.gitignore b/Thronefall_1_57/Thronefall/.gitignore deleted file mode 100644 index a4da27a..0000000 --- a/Thronefall_1_57/Thronefall/.gitignore +++ /dev/null @@ -1,399 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.tlog -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# Visual Studio History (VSHistory) files -.vshistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml -.vs diff --git a/Thronefall_1_57/Thronefall/Ara/AraTrail.cs b/Thronefall_1_57/Thronefall/Ara/AraTrail.cs deleted file mode 100644 index e5ade61..0000000 --- a/Thronefall_1_57/Thronefall/Ara/AraTrail.cs +++ /dev/null @@ -1,947 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Serialization; - -namespace Ara; - -[ExecuteInEditMode] -public class AraTrail : MonoBehaviour -{ - public enum TrailAlignment - { - View, - Velocity, - Local - } - - public enum TrailSpace - { - World, - Self, - Custom - } - - public enum TrailSorting - { - OlderOnTop, - NewerOnTop - } - - public enum Timescale - { - Normal, - Unscaled - } - - public enum TextureMode - { - Stretch, - Tile, - WorldTile - } - - public struct CurveFrame - { - public Vector3 position; - - public Vector3 normal; - - public Vector3 bitangent; - - public Vector3 tangent; - - public CurveFrame(Vector3 position, Vector3 normal, Vector3 bitangent, Vector3 tangent) - { - this.position = position; - this.normal = normal; - this.bitangent = bitangent; - this.tangent = tangent; - } - - public Vector3 Transport(Vector3 newTangent, Vector3 newPosition) - { - Vector3 vector = newPosition - position; - float num = Vector3.Dot(vector, vector); - Vector3 vector2 = normal - 2f / (num + 1E-05f) * Vector3.Dot(vector, normal) * vector; - Vector3 vector3 = tangent - 2f / (num + 1E-05f) * Vector3.Dot(vector, tangent) * vector; - Vector3 vector4 = newTangent - vector3; - float num2 = Vector3.Dot(vector4, vector4); - Vector3 rhs = vector2 - 2f / (num2 + 1E-05f) * Vector3.Dot(vector4, vector2) * vector4; - Vector3 vector5 = Vector3.Cross(newTangent, rhs); - normal = rhs; - bitangent = vector5; - tangent = newTangent; - position = newPosition; - return normal; - } - } - - public struct Point - { - public Vector3 position; - - public Vector3 velocity; - - public Vector3 tangent; - - public Vector3 normal; - - public Color color; - - public float thickness; - - public float life; - - public float texcoord; - - public bool discontinuous; - - public Point(Vector3 position, Vector3 velocity, Vector3 tangent, Vector3 normal, Color color, float thickness, float texcoord, float lifetime) - { - this.position = position; - this.velocity = velocity; - this.tangent = tangent; - this.normal = normal; - this.color = color; - this.thickness = thickness; - life = lifetime; - this.texcoord = texcoord; - discontinuous = false; - } - - public static float CatmullRom(float p0, float p1, float p2, float p3, float t) - { - float num = t * t; - return 0.5f * (2f * p1 + (0f - p0 + p2) * t + (2f * p0 - 5f * p1 + 4f * p2 - p3) * num + (0f - p0 + 3f * p1 - 3f * p2 + p3) * num * t); - } - - public static Point operator +(Point p1, Point p2) - { - return new Point(p1.position + p2.position, p1.velocity + p2.velocity, p1.tangent + p2.tangent, p1.normal + p2.normal, p1.color + p2.color, p1.thickness + p2.thickness, p1.texcoord + p2.texcoord, p1.life + p2.life); - } - - public static Point operator -(Point p1, Point p2) - { - return new Point(p1.position - p2.position, p1.velocity - p2.velocity, p1.tangent - p2.tangent, p1.normal - p2.normal, p1.color - p2.color, p1.thickness - p2.thickness, p1.texcoord - p2.texcoord, p1.life - p2.life); - } - } - - public const float epsilon = 1E-05f; - - [Header("Overall")] - [Tooltip("Trail cross-section asset, determines the shape of the emitted trail. If no asset is specified, the trail will be a simple strip.")] - public TrailSection section; - - [Tooltip("Whether to use world or local space to generate and simulate the trail.")] - public TrailSpace space; - - [Tooltip("Custom space to use when generating and simulating the trail")] - public Transform customSpace; - - [Tooltip("Whether to use regular time.")] - public Timescale timescale; - - [Tooltip("How to align the trail geometry: facing the camera (view) of using the transform's rotation (local).")] - public TrailAlignment alignment; - - [Tooltip("Determines the order in which trail points will be rendered.")] - public TrailSorting sorting; - - [Tooltip("Thickness multiplier, in meters.")] - public float thickness = 0.1f; - - [Tooltip("Amount of smoothing iterations applied to the trail shape.")] - [Range(1f, 8f)] - public int smoothness = 1; - - [Tooltip("Calculate accurate thickness at sharp corners.")] - public bool highQualityCorners; - - [Range(0f, 12f)] - public int cornerRoundness = 5; - - [Header("Length")] - [Tooltip("How should the thickness of the curve evolve over its lenght. The horizontal axis is normalized lenght (in the [0,1] range) and the vertical axis is a thickness multiplier.")] - [FormerlySerializedAs("thicknessOverLenght")] - public AnimationCurve thicknessOverLength = AnimationCurve.Linear(0f, 1f, 0f, 1f); - - [Tooltip("How should vertex color evolve over the trail's length.")] - [FormerlySerializedAs("colorOverLenght")] - public Gradient colorOverLength = new Gradient(); - - [Header("Time")] - [Tooltip("How should the thickness of the curve evolve with its lifetime. The horizontal axis is normalized lifetime (in the [0,1] range) and the vertical axis is a thickness multiplier.")] - public AnimationCurve thicknessOverTime = AnimationCurve.Linear(0f, 1f, 0f, 1f); - - [Tooltip("How should vertex color evolve over the trail's lifetime.")] - public Gradient colorOverTime = new Gradient(); - - [Header("Emission")] - public bool emit = true; - - [Tooltip("Initial thickness of trail points when they are first spawned.")] - public float initialThickness = 1f; - - [Tooltip("Initial color of trail points when they are first spawned.")] - public Color initialColor = Color.white; - - [Tooltip("Initial velocity of trail points when they are first spawned.")] - public Vector3 initialVelocity = Vector3.zero; - - [Tooltip("Minimum amount of time (in seconds) that must pass before spawning a new point.")] - public float timeInterval = 0.025f; - - [Tooltip("Minimum distance (in meters) that must be left between consecutive points in the trail.")] - public float minDistance = 0.025f; - - [Tooltip("Duration of the trail (in seconds).")] - public float time = 2f; - - [Header("Physics")] - [Tooltip("Toggles trail physics.")] - public bool enablePhysics; - - [Tooltip("Amount of seconds pre-simulated before the trail appears. Useful when you want a trail to be already simulating when the game starts.")] - public float warmup; - - [Tooltip("Gravity affecting the trail.")] - public Vector3 gravity = Vector3.zero; - - [Tooltip("Amount of speed transferred from the transform to the trail. 0 means no velocity is transferred, 1 means 100% of the velocity is transferred.")] - [Range(0f, 1f)] - public float inertia; - - [Tooltip("Amount of temporal smoothing applied to the velocity transferred from the transform to the trail.")] - [Range(0f, 1f)] - public float velocitySmoothing = 0.75f; - - [Tooltip("Amount of damping applied to the trail's velocity. Larger values will slow down the trail more as time passes.")] - [Range(0f, 1f)] - public float damping = 0.75f; - - [Header("Rendering")] - public Material[] materials = new Material[1]; - - public ShadowCastingMode castShadows = ShadowCastingMode.On; - - public bool receiveShadows = true; - - public bool useLightProbes = true; - - [Header("Texture")] - [Tooltip("Quad mapping will send the shader an extra coordinate for each vertex, that can be used to correct UV distortion using tex2Dproj.")] - public bool quadMapping; - - [Tooltip("How to apply the texture over the trail: stretch it all over its lenght, or tile it.")] - public TextureMode textureMode; - - [Tooltip("Defines how many times are U coords repeated across the length of the trail.")] - public float uvFactor = 1f; - - [Tooltip("Defines how many times are V coords repeated trough the width of the trail.")] - public float uvWidthFactor = 1f; - - [Tooltip("When the texture mode is set to 'Tile', defines where to begin tiling from: 0 means the start of the trail, 1 means the end.")] - [Range(0f, 1f)] - public float tileAnchor = 1f; - - [HideInInspector] - public ElasticArray points = new ElasticArray(); - - private ElasticArray renderablePoints = new ElasticArray(); - - private List discontinuities = new List(); - - private Mesh mesh_; - - private Vector3 velocity = Vector3.zero; - - private Vector3 prevPosition; - - private float accumTime; - - private List vertices = new List(); - - private List normals = new List(); - - private List tangents = new List(); - - private List uvs = new List(); - - private List vertColors = new List(); - - private List tris = new List(); - - private Vector3 nextV = Vector3.zero; - - private Vector3 prevV = Vector3.zero; - - private Vector3 vertex = Vector3.zero; - - private Vector3 normal = Vector3.zero; - - private Vector3 bitangent = Vector3.zero; - - private Vector4 tangent = new Vector4(0f, 0f, 0f, 1f); - - private Vector4 texTangent = Vector4.zero; - - private Vector4 uv = Vector4.zero; - - private Color color; - - private Action renderCallback; - - public Vector3 Velocity => velocity; - - private float DeltaTime - { - get - { - if (timescale != Timescale.Unscaled) - { - return Time.deltaTime; - } - return Time.unscaledDeltaTime; - } - } - - private float FixedDeltaTime - { - get - { - if (timescale != Timescale.Unscaled) - { - return Time.fixedDeltaTime; - } - return Time.fixedUnscaledDeltaTime; - } - } - - public Mesh mesh => mesh_; - - public Matrix4x4 worldToTrail - { - get - { - switch (space) - { - case TrailSpace.World: - return Matrix4x4.identity; - case TrailSpace.Self: - return base.transform.worldToLocalMatrix; - case TrailSpace.Custom: - if (!(customSpace != null)) - { - return Matrix4x4.identity; - } - return customSpace.worldToLocalMatrix; - default: - return Matrix4x4.identity; - } - } - } - - public event Action onUpdatePoints; - - public void OnValidate() - { - time = Mathf.Max(time, 1E-05f); - warmup = Mathf.Max(0f, warmup); - } - - public void Awake() - { - Warmup(); - } - - private void OnEnable() - { - prevPosition = base.transform.position; - velocity = Vector3.zero; - mesh_ = new Mesh(); - mesh_.name = "ara_trail_mesh"; - mesh_.MarkDynamic(); - AttachToCameraRendering(); - } - - private void OnDisable() - { - UnityEngine.Object.DestroyImmediate(mesh_); - DetachFromCameraRendering(); - } - - private void AttachToCameraRendering() - { - renderCallback = delegate(ScriptableRenderContext cntxt, Camera cam) - { - UpdateTrailMesh(cam); - }; - RenderPipelineManager.beginCameraRendering += renderCallback; - Camera.onPreCull = (Camera.CameraCallback)Delegate.Combine(Camera.onPreCull, new Camera.CameraCallback(UpdateTrailMesh)); - } - - private void DetachFromCameraRendering() - { - RenderPipelineManager.beginCameraRendering -= renderCallback; - Camera.onPreCull = (Camera.CameraCallback)Delegate.Remove(Camera.onPreCull, new Camera.CameraCallback(UpdateTrailMesh)); - } - - public void Clear() - { - points.Clear(); - } - - private void UpdateVelocity() - { - if (DeltaTime > 0f) - { - velocity = Vector3.Lerp((base.transform.position - prevPosition) / DeltaTime, velocity, velocitySmoothing); - } - prevPosition = base.transform.position; - } - - private void LateUpdate() - { - UpdateVelocity(); - EmissionStep(DeltaTime); - SnapLastPointToTransform(); - UpdatePointsLifecycle(); - if (this.onUpdatePoints != null) - { - this.onUpdatePoints(); - } - } - - private void EmissionStep(float time) - { - accumTime += time; - if (accumTime >= timeInterval && emit) - { - Vector3 vector = worldToTrail.MultiplyPoint3x4(base.transform.position); - if (points.Count <= 1 || Vector3.Distance(vector, points[points.Count - 2].position) >= minDistance) - { - EmitPoint(vector); - accumTime = 0f; - } - } - } - - private void Warmup() - { - if (!Application.isPlaying || !enablePhysics) - { - return; - } - for (float num = warmup; num > FixedDeltaTime; num -= FixedDeltaTime) - { - PhysicsStep(FixedDeltaTime); - EmissionStep(FixedDeltaTime); - SnapLastPointToTransform(); - UpdatePointsLifecycle(); - if (this.onUpdatePoints != null) - { - this.onUpdatePoints(); - } - } - } - - private void PhysicsStep(float timestep) - { - float num = Mathf.Pow(1f - Mathf.Clamp01(damping), timestep); - for (int i = 0; i < points.Count; i++) - { - Point value = points[i]; - value.velocity += gravity * timestep; - value.velocity *= num; - value.position += value.velocity * timestep; - points[i] = value; - } - } - - private void FixedUpdate() - { - if (enablePhysics) - { - PhysicsStep(FixedDeltaTime); - } - } - - public void EmitPoint(Vector3 position) - { - float texcoord = 0f; - if (points.Count > 0) - { - texcoord = points[points.Count - 1].texcoord + Vector3.Distance(position, points[points.Count - 1].position); - } - points.Add(new Point(position, initialVelocity + velocity * inertia, base.transform.right, base.transform.forward, initialColor, initialThickness, texcoord, time)); - } - - private void SnapLastPointToTransform() - { - if (points.Count <= 0) - { - return; - } - Point value = points[points.Count - 1]; - if (!emit) - { - value.discontinuous = true; - } - if (!value.discontinuous) - { - value.position = worldToTrail.MultiplyPoint3x4(base.transform.position); - value.normal = base.transform.forward; - value.tangent = base.transform.right; - if (points.Count > 1) - { - value.texcoord = points[points.Count - 2].texcoord + Vector3.Distance(value.position, points[points.Count - 2].position); - } - } - points[points.Count - 1] = value; - } - - private void UpdatePointsLifecycle() - { - for (int num = points.Count - 1; num >= 0; num--) - { - Point value = points[num]; - value.life -= DeltaTime; - points[num] = value; - if (value.life <= 0f) - { - if (smoothness <= 1) - { - points.RemoveAt(num); - } - else if (points[Mathf.Min(num + 1, points.Count - 1)].life <= 0f && points[Mathf.Min(num + 2, points.Count - 1)].life <= 0f) - { - points.RemoveAt(num); - } - } - } - } - - private void ClearMeshData() - { - mesh_.Clear(); - vertices.Clear(); - normals.Clear(); - tangents.Clear(); - uvs.Clear(); - vertColors.Clear(); - tris.Clear(); - } - - private void CommitMeshData() - { - mesh_.SetVertices(vertices); - mesh_.SetNormals(normals); - mesh_.SetTangents(tangents); - mesh_.SetColors(vertColors); - mesh_.SetUVs(0, uvs); - mesh_.SetTriangles(tris, 0, calculateBounds: true); - } - - private void RenderMesh(Camera cam) - { - Matrix4x4 inverse = worldToTrail.inverse; - for (int i = 0; i < materials.Length; i++) - { - Graphics.DrawMesh(mesh_, inverse, materials[i], base.gameObject.layer, cam, 0, null, castShadows, receiveShadows, null, useLightProbes); - } - } - - public float GetLenght(ElasticArray input) - { - float num = 0f; - for (int i = 0; i < input.Count - 1; i++) - { - num += Vector3.Distance(input[i].position, input[i + 1].position); - } - return num; - } - - private ElasticArray GetRenderablePoints(int start, int end) - { - renderablePoints.Clear(); - if (smoothness <= 1) - { - for (int i = start; i <= end; i++) - { - renderablePoints.Add(points[i]); - } - return renderablePoints; - } - Point[] data = points.Data; - float num = 1f / (float)smoothness; - Point item = new Point(Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, Color.white, 0f, 0f, 0f); - for (int j = start; j < end; j++) - { - int num2 = ((j == start) ? start : (j - 1)); - int num3 = ((j == end - 1) ? end : (j + 2)); - int num4 = j + 1; - float p = data[num2].position[0]; - float p2 = data[num2].position[1]; - float p3 = data[num2].position[2]; - float p4 = data[num2].velocity[0]; - float p5 = data[num2].velocity[1]; - float p6 = data[num2].velocity[2]; - float p7 = data[num2].tangent[0]; - float p8 = data[num2].tangent[1]; - float p9 = data[num2].tangent[2]; - float p10 = data[num2].normal[0]; - float p11 = data[num2].normal[1]; - float p12 = data[num2].normal[2]; - float p13 = data[num2].color[0]; - float p14 = data[num2].color[1]; - float p15 = data[num2].color[2]; - float p16 = data[num2].color[3]; - float p17 = data[j].position[0]; - float p18 = data[j].position[1]; - float p19 = data[j].position[2]; - float p20 = data[j].velocity[0]; - float p21 = data[j].velocity[1]; - float p22 = data[j].velocity[2]; - float p23 = data[j].tangent[0]; - float p24 = data[j].tangent[1]; - float p25 = data[j].tangent[2]; - float p26 = data[j].normal[0]; - float p27 = data[j].normal[1]; - float p28 = data[j].normal[2]; - float p29 = data[j].color[0]; - float p30 = data[j].color[1]; - float p31 = data[j].color[2]; - float p32 = data[j].color[3]; - float p33 = data[num4].position[0]; - float p34 = data[num4].position[1]; - float p35 = data[num4].position[2]; - float p36 = data[num4].velocity[0]; - float p37 = data[num4].velocity[1]; - float p38 = data[num4].velocity[2]; - float p39 = data[num4].tangent[0]; - float p40 = data[num4].tangent[1]; - float p41 = data[num4].tangent[2]; - float p42 = data[num4].normal[0]; - float p43 = data[num4].normal[1]; - float p44 = data[num4].normal[2]; - float p45 = data[num4].color[0]; - float p46 = data[num4].color[1]; - float p47 = data[num4].color[2]; - float p48 = data[num4].color[3]; - float p49 = data[num3].position[0]; - float p50 = data[num3].position[1]; - float p51 = data[num3].position[2]; - float p52 = data[num3].velocity[0]; - float p53 = data[num3].velocity[1]; - float p54 = data[num3].velocity[2]; - float p55 = data[num3].tangent[0]; - float p56 = data[num3].tangent[1]; - float p57 = data[num3].tangent[2]; - float p58 = data[num3].normal[0]; - float p59 = data[num3].normal[1]; - float p60 = data[num3].normal[2]; - float p61 = data[num3].color[0]; - float p62 = data[num3].color[1]; - float p63 = data[num3].color[2]; - float p64 = data[num3].color[3]; - for (int k = 0; k < smoothness; k++) - { - float t = (float)k * num; - item.life = Point.CatmullRom(data[num2].life, data[j].life, data[num4].life, data[num3].life, t); - if (item.life > 0f) - { - item.position.x = Point.CatmullRom(p, p17, p33, p49, t); - item.position.y = Point.CatmullRom(p2, p18, p34, p50, t); - item.position.z = Point.CatmullRom(p3, p19, p35, p51, t); - item.velocity.x = Point.CatmullRom(p4, p20, p36, p52, t); - item.velocity.y = Point.CatmullRom(p5, p21, p37, p53, t); - item.velocity.z = Point.CatmullRom(p6, p22, p38, p54, t); - item.tangent.x = Point.CatmullRom(p7, p23, p39, p55, t); - item.tangent.y = Point.CatmullRom(p8, p24, p40, p56, t); - item.tangent.z = Point.CatmullRom(p9, p25, p41, p57, t); - item.normal.x = Point.CatmullRom(p10, p26, p42, p58, t); - item.normal.y = Point.CatmullRom(p11, p27, p43, p59, t); - item.normal.z = Point.CatmullRom(p12, p28, p44, p60, t); - item.color.r = Point.CatmullRom(p13, p29, p45, p61, t); - item.color.g = Point.CatmullRom(p14, p30, p46, p62, t); - item.color.b = Point.CatmullRom(p15, p31, p47, p63, t); - item.color.a = Point.CatmullRom(p16, p32, p48, p64, t); - item.thickness = Point.CatmullRom(data[num2].thickness, data[j].thickness, data[num4].thickness, data[num3].thickness, t); - item.texcoord = Point.CatmullRom(data[num2].texcoord, data[j].texcoord, data[num4].texcoord, data[num3].texcoord, t); - renderablePoints.Add(item); - } - } - } - if (points[end].life > 0f) - { - renderablePoints.Add(points[end]); - } - return renderablePoints; - } - - private CurveFrame InitializeCurveFrame(Vector3 point, Vector3 nextPoint) - { - Vector3 vector = nextPoint - point; - if (Mathf.Approximately(Mathf.Abs(Vector3.Dot(vector.normalized, base.transform.forward)), 1f)) - { - vector += base.transform.right * 0.01f; - } - return new CurveFrame(point, base.transform.forward, base.transform.up, vector); - } - - private void UpdateTrailMesh(Camera cam) - { - if ((cam.cullingMask & (1 << base.gameObject.layer)) == 0) - { - return; - } - ClearMeshData(); - if (points.Count <= 1) - { - return; - } - Vector3 localCamPosition = worldToTrail.MultiplyPoint3x4(cam.transform.position); - discontinuities.Clear(); - for (int i = 0; i < points.Count; i++) - { - if (points[i].discontinuous || i == points.Count - 1) - { - discontinuities.Add(i); - } - } - int start = 0; - for (int j = 0; j < discontinuities.Count; j++) - { - UpdateSegmentMesh(start, discontinuities[j], localCamPosition); - start = discontinuities[j] + 1; - } - CommitMeshData(); - RenderMesh(cam); - } - - private void UpdateSegmentMesh(int start, int end, Vector3 localCamPosition) - { - ElasticArray elasticArray = GetRenderablePoints(start, end); - if (sorting == TrailSorting.NewerOnTop) - { - elasticArray.Reverse(); - } - Point[] data = elasticArray.Data; - if (elasticArray.Count <= 1) - { - return; - } - float num = Mathf.Max(GetLenght(elasticArray), 1E-05f); - float num2 = 0f; - float num3 = ((textureMode == TextureMode.Stretch) ? 0f : ((0f - uvFactor) * num * tileAnchor)); - if (sorting == TrailSorting.NewerOnTop) - { - num3 = 1f - num3; - } - CurveFrame frame = InitializeCurveFrame(data[elasticArray.Count - 1].position, data[elasticArray.Count - 2].position); - int va = 1; - int vb = 0; - for (int num4 = elasticArray.Count - 1; num4 >= 0; num4--) - { - int num5 = Mathf.Max(num4 - 1, 0); - int num6 = Mathf.Min(num4 + 1, elasticArray.Count - 1); - nextV.x = data[num5].position.x - data[num4].position.x; - nextV.y = data[num5].position.y - data[num4].position.y; - nextV.z = data[num5].position.z - data[num4].position.z; - prevV.x = data[num4].position.x - data[num6].position.x; - prevV.y = data[num4].position.y - data[num6].position.y; - prevV.z = data[num4].position.z - data[num6].position.z; - float num7 = ((num5 == num4) ? prevV.magnitude : nextV.magnitude); - nextV.Normalize(); - prevV.Normalize(); - if (alignment == TrailAlignment.Local) - { - tangent = data[num4].tangent.normalized; - } - else - { - tangent.x = (nextV.x + prevV.x) * 0.5f; - tangent.y = (nextV.y + prevV.y) * 0.5f; - tangent.z = (nextV.z + prevV.z) * 0.5f; - } - normal = data[num4].normal; - if (alignment != TrailAlignment.Local) - { - normal = ((alignment == TrailAlignment.View) ? (localCamPosition - data[num4].position) : frame.Transport(tangent, data[num4].position)); - } - normal.Normalize(); - if (alignment == TrailAlignment.Velocity) - { - bitangent = frame.bitangent; - } - else - { - bitangent.x = tangent.y * normal.z - tangent.z * normal.y; - bitangent.y = tangent.z * normal.x - tangent.x * normal.z; - bitangent.z = tangent.x * normal.y - tangent.y * normal.x; - } - bitangent.Normalize(); - float num8 = ((sorting == TrailSorting.OlderOnTop) ? (num2 / num) : ((num - num2) / num)); - float num9 = Mathf.Clamp01(1f - data[num4].life / time); - num2 += num7; - color = data[num4].color * colorOverTime.Evaluate(num9) * colorOverLength.Evaluate(num8); - float sectionThickness = thickness * data[num4].thickness * thicknessOverTime.Evaluate(num9) * thicknessOverLength.Evaluate(num8); - if (textureMode == TextureMode.WorldTile) - { - num3 = tileAnchor + data[num4].texcoord * uvFactor; - } - if (section != null) - { - AppendSection(data, ref frame, num4, elasticArray.Count, sectionThickness, num3); - } - else - { - AppendFlatTrail(data, ref frame, num4, elasticArray.Count, sectionThickness, num3, ref va, ref vb); - } - float num10 = ((textureMode == TextureMode.Stretch) ? (num7 / num) : num7); - num3 += uvFactor * ((sorting == TrailSorting.NewerOnTop) ? (0f - num10) : num10); - } - } - - private void AppendSection(Point[] data, ref CurveFrame frame, int i, int count, float sectionThickness, float vCoord) - { - int segments = section.Segments; - int num = segments + 1; - for (int j = 0; j <= segments; j++) - { - normal.x = (section.vertices[j].x * bitangent.x + section.vertices[j].y * tangent.x) * sectionThickness; - normal.y = (section.vertices[j].x * bitangent.y + section.vertices[j].y * tangent.y) * sectionThickness; - normal.z = (section.vertices[j].x * bitangent.z + section.vertices[j].y * tangent.z) * sectionThickness; - vertex.x = data[i].position.x + normal.x; - vertex.y = data[i].position.y + normal.y; - vertex.z = data[i].position.z + normal.z; - texTangent.x = 0f - (normal.y * frame.tangent.z - normal.z * frame.tangent.y); - texTangent.y = 0f - (normal.z * frame.tangent.x - normal.x * frame.tangent.z); - texTangent.z = 0f - (normal.x * frame.tangent.y - normal.y * frame.tangent.x); - texTangent.w = 1f; - uv.x = (float)j / (float)segments * uvWidthFactor; - uv.y = vCoord; - uv.z = 0f; - uv.w = 1f; - vertices.Add(vertex); - normals.Add(normal); - tangents.Add(texTangent); - uvs.Add(uv); - vertColors.Add(color); - if (j < segments && i < count - 1) - { - tris.Add(i * num + j); - tris.Add(i * num + (j + 1)); - tris.Add((i + 1) * num + j); - tris.Add(i * num + (j + 1)); - tris.Add((i + 1) * num + (j + 1)); - tris.Add((i + 1) * num + j); - } - } - } - - private void AppendFlatTrail(Point[] data, ref CurveFrame frame, int i, int count, float sectionThickness, float vCoord, ref int va, ref int vb) - { - bool num = highQualityCorners && alignment != TrailAlignment.Local; - Quaternion quaternion = Quaternion.identity; - Vector3 vector = Vector3.zero; - float num2 = 0f; - float num3 = sectionThickness; - Vector3 vector2 = bitangent; - if (num) - { - Vector3 vector3 = ((i == 0) ? bitangent : Vector3.Cross(nextV, Vector3.Cross(bitangent, tangent)).normalized); - if (cornerRoundness > 0) - { - vector2 = ((i == count - 1) ? (-bitangent) : Vector3.Cross(prevV, Vector3.Cross(bitangent, tangent)).normalized); - num2 = ((i == 0 || i == count - 1) ? 1f : Mathf.Sign(Vector3.Dot(nextV, -vector2))); - float num4 = ((i == 0 || i == count - 1) ? MathF.PI : Mathf.Acos(Mathf.Clamp(Vector3.Dot(vector3, vector2), -1f, 1f))); - quaternion = Quaternion.AngleAxis(57.29578f * num4 / (float)cornerRoundness, normal * num2); - vector = vector2 * sectionThickness * num2; - } - if (vector3.sqrMagnitude > 0.1f) - { - num3 = sectionThickness / Mathf.Max(Vector3.Dot(bitangent, vector3), 0.15f); - } - } - if (num && cornerRoundness > 0) - { - if (num2 > 0f) - { - vertices.Add(data[i].position + vector2 * sectionThickness); - vertices.Add(data[i].position - bitangent * num3); - } - else - { - vertices.Add(data[i].position + bitangent * num3); - vertices.Add(data[i].position - vector2 * sectionThickness); - } - } - else - { - vertices.Add(data[i].position + bitangent * num3); - vertices.Add(data[i].position - bitangent * num3); - } - normals.Add(normal); - normals.Add(normal); - tangents.Add(tangent); - tangents.Add(tangent); - vertColors.Add(color); - vertColors.Add(color); - if (quadMapping) - { - uv.Set(vCoord * sectionThickness, (sorting == TrailSorting.NewerOnTop) ? (uvWidthFactor * sectionThickness) : 0f, 0f, sectionThickness); - uvs.Add(uv); - uv.Set(vCoord * sectionThickness, (sorting == TrailSorting.NewerOnTop) ? 0f : (uvWidthFactor * sectionThickness), 0f, sectionThickness); - uvs.Add(uv); - } - else - { - uv.Set(vCoord, (sorting == TrailSorting.NewerOnTop) ? uvWidthFactor : 0f, 0f, 1f); - uvs.Add(uv); - uv.Set(vCoord, (sorting == TrailSorting.NewerOnTop) ? 0f : uvWidthFactor, 0f, 1f); - uvs.Add(uv); - } - if (i < count - 1) - { - int num5 = vertices.Count - 1; - tris.Add(num5); - tris.Add(va); - tris.Add(vb); - tris.Add(vb); - tris.Add(num5 - 1); - tris.Add(num5); - } - va = vertices.Count - 1; - vb = vertices.Count - 2; - if (!num || cornerRoundness <= 0) - { - return; - } - for (int j = 0; j <= cornerRoundness; j++) - { - vertices.Add(data[i].position + vector); - normals.Add(normal); - tangents.Add(tangent); - vertColors.Add(color); - uv.Set(vCoord, (!(num2 > 0f)) ? 1 : 0, 0f, 1f); - uvs.Add(uv); - int num6 = vertices.Count - 1; - tris.Add(num6); - tris.Add(va); - tris.Add(vb); - if (num2 > 0f) - { - vb = num6; - } - else - { - va = num6; - } - vector = quaternion * vector; - } - } -} diff --git a/Thronefall_1_57/Thronefall/Ara/ColorFromSpeed.cs b/Thronefall_1_57/Thronefall/Ara/ColorFromSpeed.cs deleted file mode 100644 index a73fb92..0000000 --- a/Thronefall_1_57/Thronefall/Ara/ColorFromSpeed.cs +++ /dev/null @@ -1,40 +0,0 @@ -using UnityEngine; - -namespace Ara; - -[RequireComponent(typeof(AraTrail))] -public class ColorFromSpeed : MonoBehaviour -{ - private AraTrail trail; - - [Tooltip("Maps trail speed to color. Control how much speed is transferred to the trail by setting inertia > 0. The trail will be colorized even if physics are disabled. ")] - public Gradient colorFromSpeed = new Gradient(); - - [Tooltip("Min speed used to map speed to color.")] - public float minSpeed; - - [Tooltip("Max speed used to map speed to color.")] - public float maxSpeed = 5f; - - private void OnEnable() - { - trail = GetComponent(); - trail.onUpdatePoints += SetColorFromSpeed; - } - - private void OnDisable() - { - trail.onUpdatePoints -= SetColorFromSpeed; - } - - private void SetColorFromSpeed() - { - float num = Mathf.Max(1E-05f, maxSpeed - minSpeed); - for (int i = 0; i < trail.points.Count; i++) - { - AraTrail.Point value = trail.points[i]; - value.color = colorFromSpeed.Evaluate((value.velocity.magnitude - minSpeed) / num); - trail.points[i] = value; - } - } -} diff --git a/Thronefall_1_57/Thronefall/Ara/ElasticArray.cs b/Thronefall_1_57/Thronefall/Ara/ElasticArray.cs deleted file mode 100644 index 038435c..0000000 --- a/Thronefall_1_57/Thronefall/Ara/ElasticArray.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Ara; - -public class ElasticArray : IList, ICollection, IEnumerable, IEnumerable -{ - private T[] data = new T[16]; - - private int count; - - public int Count => count; - - public bool IsReadOnly => false; - - public T this[int index] - { - get - { - return data[index]; - } - set - { - data[index] = value; - } - } - - public T[] Data => data; - - public IEnumerator GetEnumerator() - { - int i = 0; - while (i < count) - { - yield return data[i]; - int num = i + 1; - i = num; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public void Add(T item) - { - EnsureCapacity(count + 1); - data[count++] = item; - } - - public void Clear() - { - count = 0; - } - - public bool Contains(T item) - { - for (int i = 0; i < count; i++) - { - if (data[i].Equals(item)) - { - return true; - } - } - return false; - } - - public void CopyTo(T[] array, int arrayIndex) - { - if (array == null) - { - throw new ArgumentNullException(); - } - if (array.Length - arrayIndex < count) - { - throw new ArgumentException(); - } - Array.Copy(data, 0, array, arrayIndex, count); - } - - public bool Remove(T item) - { - bool flag = false; - for (int i = 0; i < count; i++) - { - if (!flag && data[i].Equals(item)) - { - flag = true; - } - if (flag && i < count - 1) - { - data[i] = data[i + 1]; - } - } - if (flag) - { - count--; - } - return flag; - } - - public int IndexOf(T item) - { - return Array.IndexOf(data, item); - } - - public void Insert(int index, T item) - { - if (index < 0 || index > count) - { - throw new ArgumentOutOfRangeException(); - } - EnsureCapacity(++count); - for (int i = count - 1; i > index; i++) - { - data[i] = data[i - 1]; - } - data[index] = item; - } - - public void RemoveAt(int index) - { - for (int i = index; i < count; i++) - { - if (i < count - 1) - { - data[i] = data[i + 1]; - } - } - count--; - } - - public void SetCount(int count) - { - EnsureCapacity(count); - this.count = count; - } - - public void EnsureCapacity(int capacity) - { - if (capacity >= data.Length) - { - Array.Resize(ref data, capacity * 2); - } - } - - public void Reverse() - { - int num = 0; - int num2 = count - 1; - while (num < num2) - { - T val = data[num]; - data[num++] = data[num2]; - data[num2--] = val; - } - } -} diff --git a/Thronefall_1_57/Thronefall/Ara/ElectricalArc.cs b/Thronefall_1_57/Thronefall/Ara/ElectricalArc.cs deleted file mode 100644 index 14ff239..0000000 --- a/Thronefall_1_57/Thronefall/Ara/ElectricalArc.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using UnityEngine; - -namespace Ara; - -[RequireComponent(typeof(AraTrail))] -public class ElectricalArc : MonoBehaviour -{ - private AraTrail trail; - - public Transform source; - - public Transform target; - - public int points = 20; - - public float burstInterval = 0.5f; - - public float burstRandom = 0.2f; - - public float speedRandom = 2f; - - public float positionRandom = 0.1f; - - private float accum; - - private void OnEnable() - { - trail = GetComponent(); - trail.emit = false; - } - - private void Update() - { - accum += Time.deltaTime; - if (accum >= burstInterval) - { - ChangeArc(); - accum = (0f - burstInterval) * UnityEngine.Random.value * burstRandom; - } - } - - private void ChangeArc() - { - trail.points.Clear(); - if (source != null && target != null) - { - for (int i = 0; i < points; i++) - { - float num = (float)i / (float)(points - 1); - float num2 = Mathf.Sin(num * MathF.PI); - Vector3 vector = Vector3.Lerp(source.position, target.position, num); - trail.points.Add(new AraTrail.Point(vector + UnityEngine.Random.onUnitSphere * positionRandom * num2, UnityEngine.Random.onUnitSphere * speedRandom * num2, Vector3.up, Vector3.forward, Color.white, 1f, 0f, burstInterval * 2f)); - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/Ara/TireTrack.cs b/Thronefall_1_57/Thronefall/Ara/TireTrack.cs deleted file mode 100644 index 845bee2..0000000 --- a/Thronefall_1_57/Thronefall/Ara/TireTrack.cs +++ /dev/null @@ -1,50 +0,0 @@ -using UnityEngine; - -namespace Ara; - -[RequireComponent(typeof(AraTrail))] -public class TireTrack : MonoBehaviour -{ - private AraTrail trail; - - public float offset = 0.05f; - - public float maxDist = 0.1f; - - private void OnEnable() - { - trail = GetComponent(); - trail.onUpdatePoints += ProjectToGround; - } - - private void OnDisable() - { - trail.onUpdatePoints -= ProjectToGround; - } - - private void ProjectToGround() - { - if (Physics.Raycast(new Ray(base.transform.position, -Vector3.up), out var hitInfo, maxDist)) - { - if (trail.emit && trail.points.Count > 0) - { - AraTrail.Point value = trail.points[trail.points.Count - 1]; - if (!value.discontinuous) - { - value.normal = hitInfo.normal; - value.position = hitInfo.point + hitInfo.normal * offset; - trail.points[trail.points.Count - 1] = value; - } - } - trail.emit = true; - } - else if (trail.emit) - { - trail.emit = false; - if (trail.points.Count > 0) - { - trail.points.RemoveAt(trail.points.Count - 1); - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/Ara/TrailSection.cs b/Thronefall_1_57/Thronefall/Ara/TrailSection.cs deleted file mode 100644 index f530aef..0000000 --- a/Thronefall_1_57/Thronefall/Ara/TrailSection.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace Ara; - -[CreateAssetMenu(menuName = "Ara Trails/Trail Section")] -public class TrailSection : ScriptableObject -{ - [HideInInspector] - public List vertices; - - public int snapX; - - public int snapY; - - public int Segments => vertices.Count - 1; - - public void OnEnable() - { - if (vertices == null) - { - vertices = new List(); - CirclePreset(8); - } - } - - public void CirclePreset(int segments) - { - vertices.Clear(); - for (int i = 0; i <= segments; i++) - { - float f = MathF.PI * 2f / (float)segments * (float)i; - vertices.Add(Mathf.Cos(f) * Vector2.right + Mathf.Sin(f) * Vector2.up); - } - } - - public static int SnapTo(float val, int snapInterval, int threshold) - { - int num = (int)val; - if (snapInterval <= 0) - { - return num; - } - int num2 = Mathf.FloorToInt(val / (float)snapInterval) * snapInterval; - int num3 = num2 + snapInterval; - if (num - num2 < threshold) - { - return num2; - } - if (num3 - num < threshold) - { - return num3; - } - return num; - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/BlitTexturePass.cs b/Thronefall_1_57/Thronefall/FlatKit/BlitTexturePass.cs deleted file mode 100644 index 5b9e754..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/BlitTexturePass.cs +++ /dev/null @@ -1,80 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -namespace FlatKit; - -internal class BlitTexturePass : ScriptableRenderPass -{ - public static readonly string CopyEffectShaderName = "Hidden/FlatKit/CopyTexture"; - - private ProfilingSampler _profilingSampler; - - private Material _effectMaterial; - - private Material _copyMaterial; - - private RenderTargetHandle _temporaryColorTexture; - - public void Setup(Material effectMaterial, bool useDepth, bool useNormals, bool useColor) - { - _effectMaterial = effectMaterial; - string text = effectMaterial.name.Substring(effectMaterial.name.LastIndexOf('/') + 1); - _profilingSampler = new ProfilingSampler("Blit " + text); - _copyMaterial = CoreUtils.CreateEngineMaterial(CopyEffectShaderName); - ConfigureInput((useColor ? ScriptableRenderPassInput.Color : ScriptableRenderPassInput.None) | (useDepth ? ScriptableRenderPassInput.Depth : ScriptableRenderPassInput.None) | (useNormals ? ScriptableRenderPassInput.Normal : ScriptableRenderPassInput.None)); - } - - public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) - { - ConfigureTarget(new RenderTargetIdentifier(renderingData.cameraData.renderer.cameraColorTarget, 0, CubemapFace.Unknown, -1)); - } - - public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { - if (_effectMaterial == null || renderingData.cameraData.camera.cameraType != CameraType.Game) - { - return; - } - _temporaryColorTexture = default(RenderTargetHandle); - CommandBuffer commandBuffer = CommandBufferPool.Get(); - using (new ProfilingScope(commandBuffer, _profilingSampler)) - { - RenderTextureDescriptor cameraTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor; - cameraTargetDescriptor.depthBufferBits = 0; - SetSourceSize(commandBuffer, cameraTargetDescriptor); - RTHandle cameraColorTargetHandle = renderingData.cameraData.renderer.cameraColorTargetHandle; - commandBuffer.GetTemporaryRT(_temporaryColorTexture.id, cameraTargetDescriptor); - if (renderingData.cameraData.xrRendering) - { - _effectMaterial.EnableKeyword("_USE_DRAW_PROCEDURAL"); - commandBuffer.SetRenderTarget(_temporaryColorTexture.Identifier()); - commandBuffer.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, _effectMaterial, 0, 0); - commandBuffer.SetGlobalTexture("_EffectTexture", _temporaryColorTexture.Identifier()); - commandBuffer.SetRenderTarget(new RenderTargetIdentifier(cameraColorTargetHandle, 0, CubemapFace.Unknown, -1)); - commandBuffer.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, _copyMaterial, 0, 0); - } - else - { - _effectMaterial.DisableKeyword("_USE_DRAW_PROCEDURAL"); - commandBuffer.Blit(cameraColorTargetHandle, _temporaryColorTexture.Identifier(), _effectMaterial, 0); - commandBuffer.Blit(_temporaryColorTexture.Identifier(), cameraColorTargetHandle); - } - } - context.ExecuteCommandBuffer(commandBuffer); - commandBuffer.Clear(); - CommandBufferPool.Release(commandBuffer); - } - - private static void SetSourceSize(CommandBuffer cmd, RenderTextureDescriptor desc) - { - float num = desc.width; - float num2 = desc.height; - if (desc.useDynamicScale) - { - num *= ScalableBufferManager.widthScaleFactor; - num2 *= ScalableBufferManager.heightScaleFactor; - } - cmd.SetGlobalVector("_SourceSize", new Vector4(num, num2, 1f / num, 1f / num2)); - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/Buoyancy.cs b/Thronefall_1_57/Thronefall/FlatKit/Buoyancy.cs deleted file mode 100644 index 9e876ab..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/Buoyancy.cs +++ /dev/null @@ -1,105 +0,0 @@ -using UnityEngine; - -namespace FlatKit; - -public class Buoyancy : MonoBehaviour -{ - [Tooltip("The object that contains a Water material.")] - public Transform water; - - [Space] - [Tooltip("Range of probing wave height for buoyancy rotation.")] - public float size = 1f; - - [Tooltip("Max height of buoyancy going up and down.")] - public float amplitude = 1f; - - [Space] - [Tooltip("Optionally provide a separate material to get the wave parameters.")] - public Material overrideWaterMaterial; - - private Material _material; - - private float _speed; - - private float _amplitude; - - private float _frequency; - - private float _direction; - - private Vector3 _originalPosition; - - private void Start() - { - Renderer component = water.GetComponent(); - _material = ((overrideWaterMaterial != null) ? overrideWaterMaterial : component.sharedMaterial); - _speed = _material.GetFloat("_WaveSpeed"); - _amplitude = _material.GetFloat("_WaveAmplitude"); - _frequency = _material.GetFloat("_WaveFrequency"); - _direction = _material.GetFloat("_WaveDirection"); - Transform transform = base.transform; - _originalPosition = transform.position; - } - - private void Update() - { - Vector3 position = base.transform.position; - Vector3 positionOS = water.InverseTransformPoint(position); - position.y = GetHeightOS(positionOS) + _originalPosition.y; - base.transform.position = position; - base.transform.up = GetNormalWS(positionOS); - } - - private Vector2 GradientNoiseDir(Vector2 p) - { - p = new Vector2(p.x % 289f, p.y % 289f); - float num = (34f * p.x + 1f) * p.x % 289f + p.y; - num = (34f * num + 1f) * num % 289f; - num = num / 41f % 1f * 2f - 1f; - return new Vector2(num - Mathf.Floor(num + 0.5f), Mathf.Abs(num) - 0.5f).normalized; - } - - private float GradientNoise(Vector2 p) - { - Vector2 vector = new Vector2(Mathf.Floor(p.x), Mathf.Floor(p.y)); - Vector2 vector2 = new Vector2(p.x % 1f, p.y % 1f); - float a = Vector3.Dot(GradientNoiseDir(vector), vector2); - float b = Vector3.Dot(GradientNoiseDir(vector + Vector2.up), vector2 - Vector2.up); - float a2 = Vector3.Dot(GradientNoiseDir(vector + Vector2.right), vector2 - Vector2.right); - float b2 = Vector3.Dot(GradientNoiseDir(vector + Vector2.one), vector2 - Vector2.one); - vector2 = vector2 * vector2 * vector2 * (vector2 * (vector2 * 6f - Vector2.one * 15f) + Vector2.one * 10f); - return Mathf.Lerp(Mathf.Lerp(a, b, vector2.y), Mathf.Lerp(a2, b2, vector2.y), vector2.x); - } - - private Vector3 GetNormalWS(Vector3 positionOS) - { - Vector3 vector = positionOS + Vector3.forward * size; - vector.y = GetHeightOS(vector); - Vector3 vector2 = positionOS + Vector3.right * size; - vector2.y = GetHeightOS(vector); - Vector3 normalized = Vector3.Cross(vector - positionOS, vector2 - positionOS).normalized; - return water.TransformDirection(normalized); - } - - private float SineWave(Vector3 positionOS, float offset) - { - float num = Time.timeSinceLevelLoad * 2f; - float num2 = Mathf.Sin(offset + num * _speed + (positionOS.x * Mathf.Sin(offset + _direction) + positionOS.z * Mathf.Cos(offset + _direction)) * _frequency); - if (_material.IsKeywordEnabled("_WAVEMODE_POINTY")) - { - num2 = 1f - Mathf.Abs(num2); - } - return num2 * _amplitude; - } - - private float GetHeightOS(Vector3 positionOS) - { - float num = SineWave(positionOS, 0f); - if (_material.IsKeywordEnabled("_WAVEMODE_GRID")) - { - num *= SineWave(positionOS, 1.57f); - } - return num * amplitude; - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/FlatKitFog.cs b/Thronefall_1_57/Thronefall/FlatKit/FlatKitFog.cs deleted file mode 100644 index 6991bf9..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/FlatKitFog.cs +++ /dev/null @@ -1,175 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -namespace FlatKit; - -public class FlatKitFog : ScriptableRendererFeature -{ - [Tooltip("To create new settings use 'Create > FlatKit > Fog Settings'.")] - public FogSettings settings; - - [SerializeField] - [HideInInspector] - private Material _effectMaterial; - - private BlitTexturePass _blitTexturePass; - - private RenderTargetHandle _fogTexture; - - private Texture2D _lutDepth; - - private Texture2D _lutHeight; - - private static readonly string FogShaderName = "Hidden/FlatKit/FogFilter"; - - private static readonly int DistanceLut = Shader.PropertyToID("_DistanceLUT"); - - private static readonly int Near = Shader.PropertyToID("_Near"); - - private static readonly int Far = Shader.PropertyToID("_Far"); - - private static readonly int UseDistanceFog = Shader.PropertyToID("_UseDistanceFog"); - - private static readonly int UseDistanceFogOnSky = Shader.PropertyToID("_UseDistanceFogOnSky"); - - private static readonly int DistanceFogIntensity = Shader.PropertyToID("_DistanceFogIntensity"); - - private static readonly int HeightLut = Shader.PropertyToID("_HeightLUT"); - - private static readonly int LowWorldY = Shader.PropertyToID("_LowWorldY"); - - private static readonly int HighWorldY = Shader.PropertyToID("_HighWorldY"); - - private static readonly int UseHeightFog = Shader.PropertyToID("_UseHeightFog"); - - private static readonly int UseHeightFogOnSky = Shader.PropertyToID("_UseHeightFogOnSky"); - - private static readonly int HeightFogIntensity = Shader.PropertyToID("_HeightFogIntensity"); - - private static readonly int DistanceHeightBlend = Shader.PropertyToID("_DistanceHeightBlend"); - - public override void Create() - { - if (settings == null) - { - Debug.LogWarning("[FlatKit] Missing Fog Settings"); - return; - } - _blitTexturePass = new BlitTexturePass - { - renderPassEvent = settings.renderEvent - }; - _fogTexture.Init("_EffectTexture"); - } - - public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) - { - if (settings == null) - { - Debug.LogWarning("[FlatKit] Missing Fog Settings"); - } - else if (CreateMaterials()) - { - SetMaterialProperties(); - _blitTexturePass.Setup(_effectMaterial, useDepth: true, useNormals: false, useColor: false); - renderer.EnqueuePass(_blitTexturePass); - } - } - - protected override void Dispose(bool disposing) - { - CoreUtils.Destroy(_effectMaterial); - } - - private bool CreateMaterials() - { - if (_effectMaterial == null) - { - Shader shader = Shader.Find(FogShaderName); - Shader shader2 = Shader.Find(BlitTexturePass.CopyEffectShaderName); - if (shader == null || shader2 == null) - { - return false; - } - _effectMaterial = CoreUtils.CreateEngineMaterial(shader); - } - return true; - } - - private void SetMaterialProperties() - { - if (!(_effectMaterial == null)) - { - UpdateDistanceLut(); - _effectMaterial.SetTexture(DistanceLut, _lutDepth); - _effectMaterial.SetFloat(Near, settings.near); - _effectMaterial.SetFloat(Far, settings.far); - _effectMaterial.SetFloat(UseDistanceFog, settings.useDistance ? 1f : 0f); - _effectMaterial.SetFloat(UseDistanceFogOnSky, settings.useDistanceFogOnSky ? 1f : 0f); - _effectMaterial.SetFloat(DistanceFogIntensity, settings.distanceFogIntensity); - UpdateHeightLut(); - _effectMaterial.SetTexture(HeightLut, _lutHeight); - _effectMaterial.SetFloat(LowWorldY, settings.low); - _effectMaterial.SetFloat(HighWorldY, settings.high); - _effectMaterial.SetFloat(UseHeightFog, settings.useHeight ? 1f : 0f); - _effectMaterial.SetFloat(UseHeightFogOnSky, settings.useHeightFogOnSky ? 1f : 0f); - _effectMaterial.SetFloat(HeightFogIntensity, settings.heightFogIntensity); - _effectMaterial.SetFloat(DistanceHeightBlend, settings.distanceHeightBlend); - } - } - - private void UpdateDistanceLut() - { - if (settings.distanceGradient == null) - { - return; - } - if (_lutDepth != null) - { - Object.DestroyImmediate(_lutDepth); - } - _lutDepth = new Texture2D(256, 1, TextureFormat.RGBA32, mipChain: false) - { - wrapMode = TextureWrapMode.Clamp, - hideFlags = HideFlags.HideAndDontSave, - filterMode = FilterMode.Bilinear - }; - for (float num = 0f; num < 256f; num += 1f) - { - Color color = settings.distanceGradient.Evaluate(num / 255f); - for (float num2 = 0f; num2 < 1f; num2 += 1f) - { - _lutDepth.SetPixel(Mathf.CeilToInt(num), Mathf.CeilToInt(num2), color); - } - } - _lutDepth.Apply(); - } - - private void UpdateHeightLut() - { - if (settings.heightGradient == null) - { - return; - } - if (_lutHeight != null) - { - Object.DestroyImmediate(_lutHeight); - } - _lutHeight = new Texture2D(256, 1, TextureFormat.RGBA32, mipChain: false) - { - wrapMode = TextureWrapMode.Clamp, - hideFlags = HideFlags.HideAndDontSave, - filterMode = FilterMode.Bilinear - }; - for (float num = 0f; num < 256f; num += 1f) - { - Color color = settings.heightGradient.Evaluate(num / 255f); - for (float num2 = 0f; num2 < 1f; num2 += 1f) - { - _lutHeight.SetPixel(Mathf.CeilToInt(num), Mathf.CeilToInt(num2), color); - } - } - _lutHeight.Apply(); - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/FlatKitOutline.cs b/Thronefall_1_57/Thronefall/FlatKit/FlatKitOutline.cs deleted file mode 100644 index aefc75d..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/FlatKitOutline.cs +++ /dev/null @@ -1,139 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -namespace FlatKit; - -public class FlatKitOutline : ScriptableRendererFeature -{ - [Tooltip("To create new settings use 'Create > FlatKit > Outline Settings'.")] - public OutlineSettings settings; - - [SerializeField] - [HideInInspector] - private Material _effectMaterial; - - private BlitTexturePass _blitTexturePass; - - private static readonly string OutlineShaderName = "Hidden/FlatKit/OutlineFilter"; - - private static readonly int EdgeColor = Shader.PropertyToID("_EdgeColor"); - - private static readonly int Thickness = Shader.PropertyToID("_Thickness"); - - private static readonly int DepthThresholdMin = Shader.PropertyToID("_DepthThresholdMin"); - - private static readonly int DepthThresholdMax = Shader.PropertyToID("_DepthThresholdMax"); - - private static readonly int NormalThresholdMin = Shader.PropertyToID("_NormalThresholdMin"); - - private static readonly int NormalThresholdMax = Shader.PropertyToID("_NormalThresholdMax"); - - private static readonly int ColorThresholdMin = Shader.PropertyToID("_ColorThresholdMin"); - - private static readonly int ColorThresholdMax = Shader.PropertyToID("_ColorThresholdMax"); - - public override void Create() - { - if (settings == null) - { - Debug.LogWarning("[FlatKit] Missing Outline Settings"); - } - else if (_blitTexturePass == null) - { - _blitTexturePass = new BlitTexturePass - { - renderPassEvent = settings.renderEvent - }; - } - } - - public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) - { - if (settings == null) - { - Debug.LogWarning("[FlatKit] Missing Outline Settings"); - } - else if (CreateMaterials()) - { - SetMaterialProperties(); - _blitTexturePass.Setup(_effectMaterial, settings.useDepth, settings.useNormals, useColor: true); - renderer.EnqueuePass(_blitTexturePass); - } - } - - protected override void Dispose(bool disposing) - { - CoreUtils.Destroy(_effectMaterial); - } - - private bool CreateMaterials() - { - if (_effectMaterial == null) - { - Shader shader = Shader.Find(OutlineShaderName); - Shader shader2 = Shader.Find(BlitTexturePass.CopyEffectShaderName); - if (shader == null || shader2 == null) - { - return false; - } - _effectMaterial = CoreUtils.CreateEngineMaterial(shader); - } - return true; - } - - private void SetMaterialProperties() - { - if (!(_effectMaterial == null)) - { - if (settings.useDepth) - { - _effectMaterial.EnableKeyword("OUTLINE_USE_DEPTH"); - } - else - { - _effectMaterial.DisableKeyword("OUTLINE_USE_DEPTH"); - } - if (settings.useNormals) - { - _effectMaterial.EnableKeyword("OUTLINE_USE_NORMALS"); - } - else - { - _effectMaterial.DisableKeyword("OUTLINE_USE_NORMALS"); - } - if (settings.useColor) - { - _effectMaterial.EnableKeyword("OUTLINE_USE_COLOR"); - } - else - { - _effectMaterial.DisableKeyword("OUTLINE_USE_COLOR"); - } - if (settings.outlineOnly) - { - _effectMaterial.EnableKeyword("OUTLINE_ONLY"); - } - else - { - _effectMaterial.DisableKeyword("OUTLINE_ONLY"); - } - if (settings.resolutionInvariant) - { - _effectMaterial.EnableKeyword("RESOLUTION_INVARIANT_THICKNESS"); - } - else - { - _effectMaterial.DisableKeyword("RESOLUTION_INVARIANT_THICKNESS"); - } - _effectMaterial.SetColor(EdgeColor, settings.edgeColor); - _effectMaterial.SetFloat(Thickness, settings.thickness); - _effectMaterial.SetFloat(DepthThresholdMin, settings.minDepthThreshold); - _effectMaterial.SetFloat(DepthThresholdMax, settings.maxDepthThreshold); - _effectMaterial.SetFloat(NormalThresholdMin, settings.minNormalsThreshold); - _effectMaterial.SetFloat(NormalThresholdMax, settings.maxNormalsThreshold); - _effectMaterial.SetFloat(ColorThresholdMin, settings.minColorThreshold); - _effectMaterial.SetFloat(ColorThresholdMax, settings.maxColorThreshold); - } - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/FogSettings.cs b/Thronefall_1_57/Thronefall/FlatKit/FogSettings.cs deleted file mode 100644 index 60e5eb0..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/FogSettings.cs +++ /dev/null @@ -1,59 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering.Universal; - -namespace FlatKit; - -[CreateAssetMenu(fileName = "FogSettings", menuName = "FlatKit/Fog Settings")] -public class FogSettings : ScriptableObject -{ - [Header("Distance Fog")] - public bool useDistance = true; - - public Gradient distanceGradient; - - public float near; - - public float far = 100f; - - [Range(0f, 1f)] - public float distanceFogIntensity = 1f; - - public bool useDistanceFogOnSky; - - [Header("Height Fog")] - [Space] - public bool useHeight; - - public Gradient heightGradient; - - public float low; - - public float high = 10f; - - [Range(0f, 1f)] - public float heightFogIntensity = 1f; - - public bool useHeightFogOnSky; - - [Header("Blending")] - [Space] - [Range(0f, 1f)] - public float distanceHeightBlend = 0.5f; - - [Header("Advanced settings")] - [Space] - [Tooltip("The render stage at which the effect is applied. To exclude transparent objects, like water or UI elements, set this to \"Before Transparent\".")] - public RenderPassEvent renderEvent = RenderPassEvent.BeforeRenderingPostProcessing; - - private void OnValidate() - { - if (low > high) - { - Debug.LogWarning("[FlatKit] Fog Height configuration error: 'Low' must not be greater than 'High'"); - } - if (near > far) - { - Debug.LogWarning("[FlatKit] Fog Distance configuration error: 'Near' must not be greater than 'Far'"); - } - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/OutlineSettings.cs b/Thronefall_1_57/Thronefall/FlatKit/OutlineSettings.cs deleted file mode 100644 index 47a6b97..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/OutlineSettings.cs +++ /dev/null @@ -1,61 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering.Universal; - -namespace FlatKit; - -[CreateAssetMenu(fileName = "OutlineSettings", menuName = "FlatKit/Outline Settings")] -public class OutlineSettings : ScriptableObject -{ - public Color edgeColor = Color.white; - - [Range(0f, 5f)] - public int thickness = 1; - - [Tooltip("If enabled, the line width will stay constant regardless of the rendering resolution. However, some of the lines may appear blurry.")] - public bool resolutionInvariant; - - [Space] - public bool useDepth = true; - - public bool useNormals; - - public bool useColor; - - [Header("Advanced settings")] - public float minDepthThreshold; - - public float maxDepthThreshold = 0.25f; - - [Space] - public float minNormalsThreshold; - - public float maxNormalsThreshold = 0.25f; - - [Space] - public float minColorThreshold; - - public float maxColorThreshold = 0.25f; - - [Space] - [Tooltip("The render stage at which the effect is applied. To exclude transparent objects, like water or UI elements, set this to \"Before Transparent\".")] - public RenderPassEvent renderEvent = RenderPassEvent.BeforeRenderingPostProcessing; - - [Space] - public bool outlineOnly; - - private void OnValidate() - { - if (minDepthThreshold > maxDepthThreshold) - { - Debug.LogWarning("[FlatKit] Outline configuration error: 'Min Depth Threshold' must not be greater than 'Max Depth Threshold'"); - } - if (minNormalsThreshold > maxNormalsThreshold) - { - Debug.LogWarning("[FlatKit] Outline configuration error: 'Min Normals Threshold' must not be greater than 'Max Normals Threshold'"); - } - if (minColorThreshold > maxColorThreshold) - { - Debug.LogWarning("[FlatKit] Outline configuration error: 'Min Color Threshold' must not be greater than 'Max Color Threshold'"); - } - } -} diff --git a/Thronefall_1_57/Thronefall/FlatKit/UvScroller.cs b/Thronefall_1_57/Thronefall/FlatKit/UvScroller.cs deleted file mode 100644 index e3ab4a3..0000000 --- a/Thronefall_1_57/Thronefall/FlatKit/UvScroller.cs +++ /dev/null @@ -1,34 +0,0 @@ -using UnityEngine; - -namespace FlatKit; - -public class UvScroller : MonoBehaviour -{ - public Material targetMaterial; - - public float speedX; - - public float speedY; - - private Vector2 offset; - - private Vector2 initOffset; - - private void Start() - { - offset = targetMaterial.mainTextureOffset; - initOffset = targetMaterial.mainTextureOffset; - } - - private void OnDisable() - { - targetMaterial.mainTextureOffset = initOffset; - } - - private void Update() - { - offset.x += speedX * Time.deltaTime; - offset.y += speedY * Time.deltaTime; - targetMaterial.mainTextureOffset = offset; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSON.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSON.cs deleted file mode 100644 index de135ed..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSON.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace I2.Loc.SimpleJSON; - -public static class JSON -{ - public static JSONNode Parse(string aJSON) - { - return JSONNode.Parse(aJSON); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONArray.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONArray.cs deleted file mode 100644 index e2cbcef..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONArray.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.IO; - -namespace I2.Loc.SimpleJSON; - -public class JSONArray : JSONNode, IEnumerable -{ - private List m_List = new List(); - - public override JSONNode this[int aIndex] - { - get - { - if (aIndex < 0 || aIndex >= m_List.Count) - { - return new JSONLazyCreator(this); - } - return m_List[aIndex]; - } - set - { - if (aIndex < 0 || aIndex >= m_List.Count) - { - m_List.Add(value); - } - else - { - m_List[aIndex] = value; - } - } - } - - public override JSONNode this[string aKey] - { - get - { - return new JSONLazyCreator(this); - } - set - { - m_List.Add(value); - } - } - - public override int Count => m_List.Count; - - public override IEnumerable Childs - { - get - { - foreach (JSONNode item in m_List) - { - yield return item; - } - } - } - - public override void Add(string aKey, JSONNode aItem) - { - m_List.Add(aItem); - } - - public override JSONNode Remove(int aIndex) - { - if (aIndex < 0 || aIndex >= m_List.Count) - { - return null; - } - JSONNode result = m_List[aIndex]; - m_List.RemoveAt(aIndex); - return result; - } - - public override JSONNode Remove(JSONNode aNode) - { - m_List.Remove(aNode); - return aNode; - } - - public IEnumerator GetEnumerator() - { - foreach (JSONNode item in m_List) - { - yield return item; - } - } - - public override string ToString() - { - string text = "[ "; - foreach (JSONNode item in m_List) - { - if (text.Length > 2) - { - text += ", "; - } - text += item.ToString(); - } - return text + " ]"; - } - - public override string ToString(string aPrefix) - { - string text = "[ "; - foreach (JSONNode item in m_List) - { - if (text.Length > 3) - { - text += ", "; - } - text = text + "\n" + aPrefix + " "; - text += item.ToString(aPrefix + " "); - } - return text + "\n" + aPrefix + "]"; - } - - public override void Serialize(BinaryWriter aWriter) - { - aWriter.Write((byte)1); - aWriter.Write(m_List.Count); - for (int i = 0; i < m_List.Count; i++) - { - m_List[i].Serialize(aWriter); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONBinaryTag.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONBinaryTag.cs deleted file mode 100644 index 53df430..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONBinaryTag.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace I2.Loc.SimpleJSON; - -public enum JSONBinaryTag -{ - Array = 1, - Class, - Value, - IntValue, - DoubleValue, - BoolValue, - FloatValue -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONClass.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONClass.cs deleted file mode 100644 index da9c432..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONClass.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace I2.Loc.SimpleJSON; - -public class JSONClass : JSONNode, IEnumerable -{ - private Dictionary m_Dict = new Dictionary(StringComparer.Ordinal); - - public override JSONNode this[string aKey] - { - get - { - if (m_Dict.ContainsKey(aKey)) - { - return m_Dict[aKey]; - } - return new JSONLazyCreator(this, aKey); - } - set - { - if (m_Dict.ContainsKey(aKey)) - { - m_Dict[aKey] = value; - } - else - { - m_Dict.Add(aKey, value); - } - } - } - - public override JSONNode this[int aIndex] - { - get - { - if (aIndex < 0 || aIndex >= m_Dict.Count) - { - return null; - } - return m_Dict.ElementAt(aIndex).Value; - } - set - { - if (aIndex >= 0 && aIndex < m_Dict.Count) - { - string key = m_Dict.ElementAt(aIndex).Key; - m_Dict[key] = value; - } - } - } - - public override int Count => m_Dict.Count; - - public override IEnumerable Childs - { - get - { - foreach (KeyValuePair item in m_Dict) - { - yield return item.Value; - } - } - } - - public override void Add(string aKey, JSONNode aItem) - { - if (!string.IsNullOrEmpty(aKey)) - { - if (m_Dict.ContainsKey(aKey)) - { - m_Dict[aKey] = aItem; - } - else - { - m_Dict.Add(aKey, aItem); - } - } - else - { - m_Dict.Add(Guid.NewGuid().ToString(), aItem); - } - } - - public override JSONNode Remove(string aKey) - { - if (!m_Dict.ContainsKey(aKey)) - { - return null; - } - JSONNode result = m_Dict[aKey]; - m_Dict.Remove(aKey); - return result; - } - - public override JSONNode Remove(int aIndex) - { - if (aIndex < 0 || aIndex >= m_Dict.Count) - { - return null; - } - KeyValuePair keyValuePair = m_Dict.ElementAt(aIndex); - m_Dict.Remove(keyValuePair.Key); - return keyValuePair.Value; - } - - public override JSONNode Remove(JSONNode aNode) - { - try - { - KeyValuePair keyValuePair = m_Dict.Where((KeyValuePair k) => k.Value == aNode).First(); - m_Dict.Remove(keyValuePair.Key); - return aNode; - } - catch - { - return null; - } - } - - public IEnumerator GetEnumerator() - { - foreach (KeyValuePair item in m_Dict) - { - yield return item; - } - } - - public override string ToString() - { - string text = "{"; - foreach (KeyValuePair item in m_Dict) - { - if (text.Length > 2) - { - text += ", "; - } - text = text + "\"" + JSONNode.Escape(item.Key) + "\":" + item.Value; - } - return text + "}"; - } - - public override string ToString(string aPrefix) - { - string text = "{ "; - foreach (KeyValuePair item in m_Dict) - { - if (text.Length > 3) - { - text += ", "; - } - text = text + "\n" + aPrefix + " "; - text = text + "\"" + JSONNode.Escape(item.Key) + "\" : " + item.Value.ToString(aPrefix + " "); - } - return text + "\n" + aPrefix + "}"; - } - - public override void Serialize(BinaryWriter aWriter) - { - aWriter.Write((byte)2); - aWriter.Write(m_Dict.Count); - foreach (string key in m_Dict.Keys) - { - aWriter.Write(key); - m_Dict[key].Serialize(aWriter); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONData.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONData.cs deleted file mode 100644 index a4c7160..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONData.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System.IO; - -namespace I2.Loc.SimpleJSON; - -public class JSONData : JSONNode -{ - private string m_Data; - - public override string Value - { - get - { - return m_Data; - } - set - { - m_Data = value; - } - } - - public JSONData(string aData) - { - m_Data = aData; - } - - public JSONData(float aData) - { - AsFloat = aData; - } - - public JSONData(double aData) - { - AsDouble = aData; - } - - public JSONData(bool aData) - { - AsBool = aData; - } - - public JSONData(int aData) - { - AsInt = aData; - } - - public override string ToString() - { - return "\"" + JSONNode.Escape(m_Data) + "\""; - } - - public override string ToString(string aPrefix) - { - return "\"" + JSONNode.Escape(m_Data) + "\""; - } - - public override void Serialize(BinaryWriter aWriter) - { - JSONData jSONData = new JSONData(""); - jSONData.AsInt = AsInt; - if (jSONData.m_Data == m_Data) - { - aWriter.Write((byte)4); - aWriter.Write(AsInt); - return; - } - jSONData.AsFloat = AsFloat; - if (jSONData.m_Data == m_Data) - { - aWriter.Write((byte)7); - aWriter.Write(AsFloat); - return; - } - jSONData.AsDouble = AsDouble; - if (jSONData.m_Data == m_Data) - { - aWriter.Write((byte)5); - aWriter.Write(AsDouble); - return; - } - jSONData.AsBool = AsBool; - if (jSONData.m_Data == m_Data) - { - aWriter.Write((byte)6); - aWriter.Write(AsBool); - } - else - { - aWriter.Write((byte)3); - aWriter.Write(m_Data); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONLazyCreator.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONLazyCreator.cs deleted file mode 100644 index 28e23df..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONLazyCreator.cs +++ /dev/null @@ -1,193 +0,0 @@ -namespace I2.Loc.SimpleJSON; - -internal class JSONLazyCreator : JSONNode -{ - private JSONNode m_Node; - - private string m_Key; - - public override JSONNode this[int aIndex] - { - get - { - return new JSONLazyCreator(this); - } - set - { - JSONArray jSONArray = new JSONArray(); - jSONArray.Add(value); - Set(jSONArray); - } - } - - public override JSONNode this[string aKey] - { - get - { - return new JSONLazyCreator(this, aKey); - } - set - { - JSONClass jSONClass = new JSONClass(); - jSONClass.Add(aKey, value); - Set(jSONClass); - } - } - - public override int AsInt - { - get - { - JSONData aVal = new JSONData(0); - Set(aVal); - return 0; - } - set - { - JSONData aVal = new JSONData(value); - Set(aVal); - } - } - - public override float AsFloat - { - get - { - JSONData aVal = new JSONData(0f); - Set(aVal); - return 0f; - } - set - { - JSONData aVal = new JSONData(value); - Set(aVal); - } - } - - public override double AsDouble - { - get - { - JSONData aVal = new JSONData(0.0); - Set(aVal); - return 0.0; - } - set - { - JSONData aVal = new JSONData(value); - Set(aVal); - } - } - - public override bool AsBool - { - get - { - JSONData aVal = new JSONData(aData: false); - Set(aVal); - return false; - } - set - { - JSONData aVal = new JSONData(value); - Set(aVal); - } - } - - public override JSONArray AsArray - { - get - { - JSONArray jSONArray = new JSONArray(); - Set(jSONArray); - return jSONArray; - } - } - - public override JSONClass AsObject - { - get - { - JSONClass jSONClass = new JSONClass(); - Set(jSONClass); - return jSONClass; - } - } - - public JSONLazyCreator(JSONNode aNode) - { - m_Node = aNode; - m_Key = null; - } - - public JSONLazyCreator(JSONNode aNode, string aKey) - { - m_Node = aNode; - m_Key = aKey; - } - - private void Set(JSONNode aVal) - { - if (m_Key == null) - { - m_Node.Add(aVal); - } - else - { - m_Node.Add(m_Key, aVal); - } - m_Node = null; - } - - public override void Add(JSONNode aItem) - { - JSONArray jSONArray = new JSONArray(); - jSONArray.Add(aItem); - Set(jSONArray); - } - - public override void Add(string aKey, JSONNode aItem) - { - JSONClass jSONClass = new JSONClass(); - jSONClass.Add(aKey, aItem); - Set(jSONClass); - } - - public static bool operator ==(JSONLazyCreator a, object b) - { - if (b == null) - { - return true; - } - return (object)a == b; - } - - public static bool operator !=(JSONLazyCreator a, object b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - if (obj == null) - { - return true; - } - return (object)this == obj; - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override string ToString() - { - return ""; - } - - public override string ToString(string aPrefix) - { - return ""; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONNode.cs b/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONNode.cs deleted file mode 100644 index a655045..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc.SimpleJSON/JSONNode.cs +++ /dev/null @@ -1,526 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; - -namespace I2.Loc.SimpleJSON; - -public class JSONNode -{ - public virtual JSONNode this[int aIndex] - { - get - { - return null; - } - set - { - } - } - - public virtual JSONNode this[string aKey] - { - get - { - return null; - } - set - { - } - } - - public virtual string Value - { - get - { - return ""; - } - set - { - } - } - - public virtual int Count => 0; - - public virtual IEnumerable Childs - { - get - { - yield break; - } - } - - public IEnumerable DeepChilds - { - get - { - foreach (JSONNode child in Childs) - { - foreach (JSONNode deepChild in child.DeepChilds) - { - yield return deepChild; - } - } - } - } - - public virtual int AsInt - { - get - { - int result = 0; - if (int.TryParse(Value, out result)) - { - return result; - } - return 0; - } - set - { - Value = value.ToString(); - } - } - - public virtual float AsFloat - { - get - { - float result = 0f; - if (float.TryParse(Value, out result)) - { - return result; - } - return 0f; - } - set - { - Value = value.ToString(); - } - } - - public virtual double AsDouble - { - get - { - double result = 0.0; - if (double.TryParse(Value, out result)) - { - return result; - } - return 0.0; - } - set - { - Value = value.ToString(); - } - } - - public virtual bool AsBool - { - get - { - bool result = false; - if (bool.TryParse(Value, out result)) - { - return result; - } - return !string.IsNullOrEmpty(Value); - } - set - { - Value = (value ? "true" : "false"); - } - } - - public virtual JSONArray AsArray => this as JSONArray; - - public virtual JSONClass AsObject => this as JSONClass; - - public virtual void Add(string aKey, JSONNode aItem) - { - } - - public virtual void Add(JSONNode aItem) - { - Add("", aItem); - } - - public virtual JSONNode Remove(string aKey) - { - return null; - } - - public virtual JSONNode Remove(int aIndex) - { - return null; - } - - public virtual JSONNode Remove(JSONNode aNode) - { - return aNode; - } - - public override string ToString() - { - return "JSONNode"; - } - - public virtual string ToString(string aPrefix) - { - return "JSONNode"; - } - - public static implicit operator JSONNode(string s) - { - return new JSONData(s); - } - - public static implicit operator string(JSONNode d) - { - if (!(d == null)) - { - return d.Value; - } - return null; - } - - public static bool operator ==(JSONNode a, object b) - { - if (b == null && a is JSONLazyCreator) - { - return true; - } - return (object)a == b; - } - - public static bool operator !=(JSONNode a, object b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - return (object)this == obj; - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - internal static string Escape(string aText) - { - string text = ""; - for (int i = 0; i < aText.Length; i++) - { - char c = aText[i]; - text = c switch - { - '\\' => text + "\\\\", - '"' => text + "\\\"", - '\n' => text + "\\n", - '\r' => text + "\\r", - '\t' => text + "\\t", - '\b' => text + "\\b", - '\f' => text + "\\f", - _ => text + c, - }; - } - return text; - } - - public static JSONNode Parse(string aJSON) - { - Stack stack = new Stack(); - JSONNode jSONNode = null; - int i = 0; - string text = ""; - string text2 = ""; - bool flag = false; - for (; i < aJSON.Length; i++) - { - switch (aJSON[i]) - { - case '{': - if (flag) - { - text += aJSON[i]; - break; - } - stack.Push(new JSONClass()); - if (jSONNode != null) - { - text2 = text2.Trim(); - if (jSONNode is JSONArray) - { - jSONNode.Add(stack.Peek()); - } - else if (text2 != "") - { - jSONNode.Add(text2, stack.Peek()); - } - } - text2 = ""; - text = ""; - jSONNode = stack.Peek(); - break; - case '[': - if (flag) - { - text += aJSON[i]; - break; - } - stack.Push(new JSONArray()); - if (jSONNode != null) - { - text2 = text2.Trim(); - if (jSONNode is JSONArray) - { - jSONNode.Add(stack.Peek()); - } - else if (text2 != "") - { - jSONNode.Add(text2, stack.Peek()); - } - } - text2 = ""; - text = ""; - jSONNode = stack.Peek(); - break; - case ']': - case '}': - if (flag) - { - text += aJSON[i]; - break; - } - if (stack.Count == 0) - { - throw new Exception("JSON Parse: Too many closing brackets"); - } - stack.Pop(); - if (text != "") - { - text2 = text2.Trim(); - if (jSONNode is JSONArray) - { - jSONNode.Add(text); - } - else if (text2 != "") - { - jSONNode.Add(text2, text); - } - } - text2 = ""; - text = ""; - if (stack.Count > 0) - { - jSONNode = stack.Peek(); - } - break; - case ':': - if (flag) - { - text += aJSON[i]; - break; - } - text2 = text; - text = ""; - break; - case '"': - flag = !flag; - break; - case ',': - if (flag) - { - text += aJSON[i]; - break; - } - if (text != "") - { - if (jSONNode is JSONArray) - { - jSONNode.Add(text); - } - else if (text2 != "") - { - jSONNode.Add(text2, text); - } - } - text2 = ""; - text = ""; - break; - case '\t': - case ' ': - if (flag) - { - text += aJSON[i]; - } - break; - case '\\': - i++; - if (flag) - { - char c = aJSON[i]; - switch (c) - { - case 't': - text += "\t"; - break; - case 'r': - text += "\r"; - break; - case 'n': - text += "\n"; - break; - case 'b': - text += "\b"; - break; - case 'f': - text += "\f"; - break; - case 'u': - { - string s = aJSON.Substring(i + 1, 4); - text += (char)int.Parse(s, NumberStyles.AllowHexSpecifier); - i += 4; - break; - } - default: - text += c; - break; - } - } - break; - default: - text += aJSON[i]; - break; - case '\n': - case '\r': - break; - } - } - if (flag) - { - throw new Exception("JSON Parse: Quotation marks seems to be messed up."); - } - return jSONNode; - } - - public virtual void Serialize(BinaryWriter aWriter) - { - } - - public void SaveToStream(Stream aData) - { - BinaryWriter aWriter = new BinaryWriter(aData); - Serialize(aWriter); - } - - public void SaveToCompressedStream(Stream aData) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public void SaveToCompressedFile(string aFileName) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public string SaveToCompressedBase64() - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public void SaveToFile(string aFileName) - { - Directory.CreateDirectory(new FileInfo(aFileName).Directory.FullName); - using FileStream aData = File.OpenWrite(aFileName); - SaveToStream(aData); - } - - public string SaveToBase64() - { - using MemoryStream memoryStream = new MemoryStream(); - SaveToStream(memoryStream); - memoryStream.Position = 0L; - return Convert.ToBase64String(memoryStream.ToArray()); - } - - public static JSONNode Deserialize(BinaryReader aReader) - { - JSONBinaryTag jSONBinaryTag = (JSONBinaryTag)aReader.ReadByte(); - switch (jSONBinaryTag) - { - case JSONBinaryTag.Array: - { - int num2 = aReader.ReadInt32(); - JSONArray jSONArray = new JSONArray(); - for (int j = 0; j < num2; j++) - { - jSONArray.Add(Deserialize(aReader)); - } - return jSONArray; - } - case JSONBinaryTag.Class: - { - int num = aReader.ReadInt32(); - JSONClass jSONClass = new JSONClass(); - for (int i = 0; i < num; i++) - { - string aKey = aReader.ReadString(); - JSONNode aItem = Deserialize(aReader); - jSONClass.Add(aKey, aItem); - } - return jSONClass; - } - case JSONBinaryTag.Value: - return new JSONData(aReader.ReadString()); - case JSONBinaryTag.IntValue: - return new JSONData(aReader.ReadInt32()); - case JSONBinaryTag.DoubleValue: - return new JSONData(aReader.ReadDouble()); - case JSONBinaryTag.BoolValue: - return new JSONData(aReader.ReadBoolean()); - case JSONBinaryTag.FloatValue: - return new JSONData(aReader.ReadSingle()); - default: - throw new Exception("Error deserializing JSON. Unknown tag: " + jSONBinaryTag); - } - } - - public static JSONNode LoadFromCompressedFile(string aFileName) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public static JSONNode LoadFromCompressedStream(Stream aData) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public static JSONNode LoadFromCompressedBase64(string aBase64) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public static JSONNode LoadFromStream(Stream aData) - { - using BinaryReader aReader = new BinaryReader(aData); - return Deserialize(aReader); - } - - public static JSONNode LoadFromFile(string aFileName) - { - using FileStream aData = File.OpenRead(aFileName); - return LoadFromStream(aData); - } - - public static JSONNode LoadFromBase64(string aBase64) - { - return LoadFromStream(new MemoryStream(Convert.FromBase64String(aBase64)) - { - Position = 0L - }); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ArabicMapping.cs b/Thronefall_1_57/Thronefall/I2.Loc/ArabicMapping.cs deleted file mode 100644 index 70b399e..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ArabicMapping.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace I2.Loc; - -internal class ArabicMapping -{ - public int from; - - public int to; - - public ArabicMapping(int from, int to) - { - this.from = from; - this.to = to; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ArabicTable.cs b/Thronefall_1_57/Thronefall/I2.Loc/ArabicTable.cs deleted file mode 100644 index 18db6a9..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ArabicTable.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections.Generic; - -namespace I2.Loc; - -internal class ArabicTable -{ - private static List mapList; - - private static ArabicTable arabicMapper; - - internal static ArabicTable ArabicMapper - { - get - { - if (arabicMapper == null) - { - arabicMapper = new ArabicTable(); - } - return arabicMapper; - } - } - - private ArabicTable() - { - mapList = new List(); - mapList.Add(new ArabicMapping(1569, 65152)); - mapList.Add(new ArabicMapping(1575, 65165)); - mapList.Add(new ArabicMapping(1571, 65155)); - mapList.Add(new ArabicMapping(1572, 65157)); - mapList.Add(new ArabicMapping(1573, 65159)); - mapList.Add(new ArabicMapping(1609, 64508)); - mapList.Add(new ArabicMapping(1574, 65161)); - mapList.Add(new ArabicMapping(1576, 65167)); - mapList.Add(new ArabicMapping(1578, 65173)); - mapList.Add(new ArabicMapping(1579, 65177)); - mapList.Add(new ArabicMapping(1580, 65181)); - mapList.Add(new ArabicMapping(1581, 65185)); - mapList.Add(new ArabicMapping(1582, 65189)); - mapList.Add(new ArabicMapping(1583, 65193)); - mapList.Add(new ArabicMapping(1584, 65195)); - mapList.Add(new ArabicMapping(1585, 65197)); - mapList.Add(new ArabicMapping(1586, 65199)); - mapList.Add(new ArabicMapping(1587, 65201)); - mapList.Add(new ArabicMapping(1588, 65205)); - mapList.Add(new ArabicMapping(1589, 65209)); - mapList.Add(new ArabicMapping(1590, 65213)); - mapList.Add(new ArabicMapping(1591, 65217)); - mapList.Add(new ArabicMapping(1592, 65221)); - mapList.Add(new ArabicMapping(1593, 65225)); - mapList.Add(new ArabicMapping(1594, 65229)); - mapList.Add(new ArabicMapping(1601, 65233)); - mapList.Add(new ArabicMapping(1602, 65237)); - mapList.Add(new ArabicMapping(1603, 65241)); - mapList.Add(new ArabicMapping(1604, 65245)); - mapList.Add(new ArabicMapping(1605, 65249)); - mapList.Add(new ArabicMapping(1606, 65253)); - mapList.Add(new ArabicMapping(1607, 65257)); - mapList.Add(new ArabicMapping(1608, 65261)); - mapList.Add(new ArabicMapping(1610, 65265)); - mapList.Add(new ArabicMapping(1570, 65153)); - mapList.Add(new ArabicMapping(1577, 65171)); - mapList.Add(new ArabicMapping(1662, 64342)); - mapList.Add(new ArabicMapping(1670, 64378)); - mapList.Add(new ArabicMapping(1688, 64394)); - mapList.Add(new ArabicMapping(1711, 64402)); - mapList.Add(new ArabicMapping(1705, 64398)); - } - - internal int Convert(int toBeConverted) - { - foreach (ArabicMapping map in mapList) - { - if (map.from == toBeConverted) - { - return map.to; - } - } - return toBeConverted; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/AutoChangeCultureInfo.cs b/Thronefall_1_57/Thronefall/I2.Loc/AutoChangeCultureInfo.cs deleted file mode 100644 index 569f62e..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/AutoChangeCultureInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class AutoChangeCultureInfo : MonoBehaviour -{ - public void Start() - { - LocalizationManager.EnableChangingCultureInfo(bEnable: true); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/BaseSpecializationManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/BaseSpecializationManager.cs deleted file mode 100644 index bb91640..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/BaseSpecializationManager.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace I2.Loc; - -public class BaseSpecializationManager -{ - public string[] mSpecializations; - - public Dictionary mSpecializationsFallbacks; - - public virtual void InitializeSpecializations() - { - mSpecializations = new string[12] - { - "Any", "PC", "Touch", "Controller", "VR", "XBox", "PS4", "OculusVR", "ViveVR", "GearVR", - "Android", "IOS" - }; - mSpecializationsFallbacks = new Dictionary(StringComparer.Ordinal) - { - { "XBox", "Controller" }, - { "PS4", "Controller" }, - { "OculusVR", "VR" }, - { "ViveVR", "VR" }, - { "GearVR", "VR" }, - { "Android", "Touch" }, - { "IOS", "Touch" } - }; - } - - public virtual string GetCurrentSpecialization() - { - if (mSpecializations == null) - { - InitializeSpecializations(); - } - return "PC"; - } - - public virtual string GetFallbackSpecialization(string specialization) - { - if (mSpecializationsFallbacks == null) - { - InitializeSpecializations(); - } - if (mSpecializationsFallbacks.TryGetValue(specialization, out var value)) - { - return value; - } - return "Any"; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/CallbackNotification.cs b/Thronefall_1_57/Thronefall/I2.Loc/CallbackNotification.cs deleted file mode 100644 index 7060292..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/CallbackNotification.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class CallbackNotification : MonoBehaviour -{ - public void OnModifyLocalization() - { - if (!string.IsNullOrEmpty(Localize.MainTranslation)) - { - string newValue = TextTranslator.Translate("Color/Red"); - Localize.MainTranslation = Localize.MainTranslation.Replace("{PLAYER_COLOR}", newValue); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/CoroutineManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/CoroutineManager.cs deleted file mode 100644 index fa93b47..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/CoroutineManager.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections; -using UnityEngine; - -namespace I2.Loc; - -public class CoroutineManager : MonoBehaviour -{ - private static CoroutineManager mInstance; - - private static CoroutineManager pInstance - { - get - { - if (mInstance == null) - { - GameObject gameObject = new GameObject("_Coroutiner"); - gameObject.hideFlags = HideFlags.HideAndDontSave; - mInstance = gameObject.AddComponent(); - if (Application.isPlaying) - { - Object.DontDestroyOnLoad(gameObject); - } - } - return mInstance; - } - } - - private void Awake() - { - if (Application.isPlaying) - { - Object.DontDestroyOnLoad(base.gameObject); - } - } - - public static Coroutine Start(IEnumerator coroutine) - { - return pInstance.StartCoroutine(coroutine); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/CustomLocalizeCallback.cs b/Thronefall_1_57/Thronefall/I2.Loc/CustomLocalizeCallback.cs deleted file mode 100644 index d308920..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/CustomLocalizeCallback.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UnityEngine; -using UnityEngine.Events; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/I2 Localize Callback")] -public class CustomLocalizeCallback : MonoBehaviour -{ - public UnityEvent _OnLocalize = new UnityEvent(); - - public void OnEnable() - { - LocalizationManager.OnLocalizeEvent -= OnLocalize; - LocalizationManager.OnLocalizeEvent += OnLocalize; - } - - public void OnDisable() - { - LocalizationManager.OnLocalizeEvent -= OnLocalize; - } - - public void OnLocalize() - { - _OnLocalize.Invoke(); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/EventCallback.cs b/Thronefall_1_57/Thronefall/I2.Loc/EventCallback.cs deleted file mode 100644 index e0d63c6..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/EventCallback.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using UnityEngine; - -namespace I2.Loc; - -[Serializable] -public class EventCallback -{ - public MonoBehaviour Target; - - public string MethodName = string.Empty; - - public void Execute(UnityEngine.Object Sender = null) - { - if (HasCallback() && Application.isPlaying) - { - Target.gameObject.SendMessage(MethodName, Sender, SendMessageOptions.DontRequireReceiver); - } - } - - public bool HasCallback() - { - if (Target != null) - { - return !string.IsNullOrEmpty(MethodName); - } - return false; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/Example_ChangeLanguage.cs b/Thronefall_1_57/Thronefall/I2.Loc/Example_ChangeLanguage.cs deleted file mode 100644 index 69819ad..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/Example_ChangeLanguage.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class Example_ChangeLanguage : MonoBehaviour -{ - public void SetLanguage_English() - { - SetLanguage("English"); - } - - public void SetLanguage_French() - { - SetLanguage("French"); - } - - public void SetLanguage_Spanish() - { - SetLanguage("Spanish"); - } - - public void SetLanguage(string LangName) - { - if (LocalizationManager.HasLanguage(LangName)) - { - LocalizationManager.CurrentLanguage = LangName; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/Example_LocalizedString.cs b/Thronefall_1_57/Thronefall/I2.Loc/Example_LocalizedString.cs deleted file mode 100644 index bd19bbb..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/Example_LocalizedString.cs +++ /dev/null @@ -1,31 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class Example_LocalizedString : MonoBehaviour -{ - public LocalizedString _MyLocalizedString; - - public string _NormalString; - - [TermsPopup("")] - public string _StringWithTermPopup; - - public void Start() - { - Debug.Log(_MyLocalizedString); - Debug.Log(TextTranslator.Translate(_NormalString)); - Debug.Log(TextTranslator.Translate(_StringWithTermPopup)); - Debug.Log((string)(LocalizedString)"Term2"); - Debug.Log(_MyLocalizedString); - Debug.Log((LocalizedString)"Term3"); - LocalizedString localizedString = "Term3"; - localizedString.mRTL_IgnoreArabicFix = true; - Debug.Log(localizedString); - LocalizedString localizedString2 = "Term3"; - localizedString2.mRTL_ConvertNumbers = true; - localizedString2.mRTL_MaxLineLength = 20; - Debug.Log(localizedString2); - Debug.Log(localizedString2); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/GeneralArabicLetters.cs b/Thronefall_1_57/Thronefall/I2.Loc/GeneralArabicLetters.cs deleted file mode 100644 index c6fecdd..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/GeneralArabicLetters.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace I2.Loc; - -internal enum GeneralArabicLetters -{ - Hamza = 1569, - Alef = 1575, - AlefHamza = 1571, - WawHamza = 1572, - AlefMaksoor = 1573, - AlefMagsora = 1609, - HamzaNabera = 1574, - Ba = 1576, - Ta = 1578, - Tha2 = 1579, - Jeem = 1580, - H7aa = 1581, - Khaa2 = 1582, - Dal = 1583, - Thal = 1584, - Ra2 = 1585, - Zeen = 1586, - Seen = 1587, - Sheen = 1588, - S9a = 1589, - Dha = 1590, - T6a = 1591, - T6ha = 1592, - Ain = 1593, - Gain = 1594, - Fa = 1601, - Gaf = 1602, - Kaf = 1603, - Lam = 1604, - Meem = 1605, - Noon = 1606, - Ha = 1607, - Waw = 1608, - Ya = 1610, - AlefMad = 1570, - TaMarboota = 1577, - PersianPe = 1662, - PersianChe = 1670, - PersianZe = 1688, - PersianGaf = 1711, - PersianGaf2 = 1705 -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/GlobalParametersExample.cs b/Thronefall_1_57/Thronefall/I2.Loc/GlobalParametersExample.cs deleted file mode 100644 index 5b5a66c..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/GlobalParametersExample.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace I2.Loc; - -public class GlobalParametersExample : RegisterGlobalParameters -{ - public override string GetParameterValue(string ParamName) - { - if (ParamName == "WINNER") - { - return "Javier"; - } - if (ParamName == "NUM PLAYERS") - { - return 5.ToString(); - } - return null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/GoogleLanguages.cs b/Thronefall_1_57/Thronefall/I2.Loc/GoogleLanguages.cs deleted file mode 100644 index 3157d04..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/GoogleLanguages.cs +++ /dev/null @@ -1,2873 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace I2.Loc; - -public static class GoogleLanguages -{ - public struct LanguageCodeDef - { - public string Code; - - public string GoogleCode; - - public bool HasJoinedWords; - - public int PluralRule; - } - - public static Dictionary mLanguageDef = new Dictionary(StringComparer.Ordinal) - { - { - "Abkhazian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ab", - GoogleCode = "-" - } - }, - { - "Afar", - new LanguageCodeDef - { - PluralRule = 1, - Code = "aa", - GoogleCode = "-" - } - }, - { - "Afrikaans", - new LanguageCodeDef - { - PluralRule = 1, - Code = "af" - } - }, - { - "Akan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ak", - GoogleCode = "-" - } - }, - { - "Albanian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sq" - } - }, - { - "Amharic", - new LanguageCodeDef - { - PluralRule = 1, - Code = "am" - } - }, - { - "Arabic", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar" - } - }, - { - "Arabic/Algeria", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-DZ", - GoogleCode = "ar" - } - }, - { - "Arabic/Bahrain", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-BH", - GoogleCode = "ar" - } - }, - { - "Arabic/Egypt", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-EG", - GoogleCode = "ar" - } - }, - { - "Arabic/Iraq", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-IQ", - GoogleCode = "ar" - } - }, - { - "Arabic/Jordan", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-JO", - GoogleCode = "ar" - } - }, - { - "Arabic/Kuwait", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-KW", - GoogleCode = "ar" - } - }, - { - "Arabic/Lebanon", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-LB", - GoogleCode = "ar" - } - }, - { - "Arabic/Libya", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-LY", - GoogleCode = "ar" - } - }, - { - "Arabic/Morocco", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-MA", - GoogleCode = "ar" - } - }, - { - "Arabic/Oman", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-OM", - GoogleCode = "ar" - } - }, - { - "Arabic/Qatar", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-QA", - GoogleCode = "ar" - } - }, - { - "Arabic/Saudi Arabia", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-SA", - GoogleCode = "ar" - } - }, - { - "Arabic/Syria", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-SY", - GoogleCode = "ar" - } - }, - { - "Arabic/Tunisia", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-TN", - GoogleCode = "ar" - } - }, - { - "Arabic/U.A.E.", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-AE", - GoogleCode = "ar" - } - }, - { - "Arabic/Yemen", - new LanguageCodeDef - { - PluralRule = 11, - Code = "ar-YE", - GoogleCode = "ar" - } - }, - { - "Aragonese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "an", - GoogleCode = "-" - } - }, - { - "Armenian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "hy" - } - }, - { - "Assamese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "as", - GoogleCode = "-" - } - }, - { - "Avaric", - new LanguageCodeDef - { - PluralRule = 1, - Code = "av", - GoogleCode = "-" - } - }, - { - "Avestan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ae", - GoogleCode = "-" - } - }, - { - "Aymara", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ay", - GoogleCode = "-" - } - }, - { - "Azerbaijani", - new LanguageCodeDef - { - PluralRule = 1, - Code = "az" - } - }, - { - "Bambara", - new LanguageCodeDef - { - PluralRule = 1, - Code = "bm", - GoogleCode = "-" - } - }, - { - "Bashkir", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ba", - GoogleCode = "-" - } - }, - { - "Basque", - new LanguageCodeDef - { - PluralRule = 1, - Code = "eu" - } - }, - { - "Basque/Spain", - new LanguageCodeDef - { - PluralRule = 1, - Code = "eu-ES", - GoogleCode = "eu" - } - }, - { - "Belarusian", - new LanguageCodeDef - { - PluralRule = 6, - Code = "be" - } - }, - { - "Bengali", - new LanguageCodeDef - { - PluralRule = 1, - Code = "bn" - } - }, - { - "Bihari", - new LanguageCodeDef - { - PluralRule = 1, - Code = "bh", - GoogleCode = "-" - } - }, - { - "Bislama", - new LanguageCodeDef - { - PluralRule = 1, - Code = "bi", - GoogleCode = "-" - } - }, - { - "Bosnian", - new LanguageCodeDef - { - PluralRule = 6, - Code = "bs" - } - }, - { - "Breton", - new LanguageCodeDef - { - PluralRule = 1, - Code = "br", - GoogleCode = "-" - } - }, - { - "Bulgariaa", - new LanguageCodeDef - { - PluralRule = 1, - Code = "bg" - } - }, - { - "Burmese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "my" - } - }, - { - "Catalan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ca" - } - }, - { - "Chamorro", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ch", - GoogleCode = "-" - } - }, - { - "Chechen", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ce", - GoogleCode = "-" - } - }, - { - "Chichewa", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ny" - } - }, - { - "Chinese", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh", - GoogleCode = "zh-CN", - HasJoinedWords = true - } - }, - { - "Chinese/Hong Kong", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-HK", - GoogleCode = "zh-TW", - HasJoinedWords = true - } - }, - { - "Chinese/Macau", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-MO", - GoogleCode = "zh-CN", - HasJoinedWords = true - } - }, - { - "Chinese/PRC", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-CN", - GoogleCode = "zh-CN", - HasJoinedWords = true - } - }, - { - "Chinese/Simplified", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-CN", - GoogleCode = "zh-CN", - HasJoinedWords = true - } - }, - { - "Chinese/Singapore", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-SG", - GoogleCode = "zh-CN", - HasJoinedWords = true - } - }, - { - "Chinese/Taiwan", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-TW", - GoogleCode = "zh-TW", - HasJoinedWords = true - } - }, - { - "Chinese/Traditional", - new LanguageCodeDef - { - PluralRule = 0, - Code = "zh-TW", - GoogleCode = "zh-TW", - HasJoinedWords = true - } - }, - { - "Chuvash", - new LanguageCodeDef - { - PluralRule = 1, - Code = "cv", - GoogleCode = "-" - } - }, - { - "Cornish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kw", - GoogleCode = "-" - } - }, - { - "Corsican", - new LanguageCodeDef - { - PluralRule = 1, - Code = "co" - } - }, - { - "Cree", - new LanguageCodeDef - { - PluralRule = 1, - Code = "cr", - GoogleCode = "-" - } - }, - { - "Croatian", - new LanguageCodeDef - { - PluralRule = 6, - Code = "hr" - } - }, - { - "Croatian/Bosnia and Herzegovina", - new LanguageCodeDef - { - PluralRule = 5, - Code = "hr-BA", - GoogleCode = "hr" - } - }, - { - "Czech", - new LanguageCodeDef - { - PluralRule = 7, - Code = "cs" - } - }, - { - "Danish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "da" - } - }, - { - "Divehi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "dv", - GoogleCode = "-" - } - }, - { - "Dutch", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nl" - } - }, - { - "Dutch/Belgium", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nl-BE", - GoogleCode = "nl" - } - }, - { - "Dutch/Netherlands", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nl-NL", - GoogleCode = "nl" - } - }, - { - "Dzongkha", - new LanguageCodeDef - { - PluralRule = 1, - Code = "dz", - GoogleCode = "-" - } - }, - { - "English", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en" - } - }, - { - "English/Australia", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-AU", - GoogleCode = "en" - } - }, - { - "English/Belize", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-BZ", - GoogleCode = "en" - } - }, - { - "English/Canada", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-CA", - GoogleCode = "en" - } - }, - { - "English/Caribbean", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-CB", - GoogleCode = "en" - } - }, - { - "English/Ireland", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-IE", - GoogleCode = "en" - } - }, - { - "English/Jamaica", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-JM", - GoogleCode = "en" - } - }, - { - "English/New Zealand", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-NZ", - GoogleCode = "en" - } - }, - { - "English/Republic of the Philippines", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-PH", - GoogleCode = "en" - } - }, - { - "English/South Africa", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-ZA", - GoogleCode = "en" - } - }, - { - "English/Trinidad", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-TT", - GoogleCode = "en" - } - }, - { - "English/United Kingdom", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-GB", - GoogleCode = "en" - } - }, - { - "English/United States", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-US", - GoogleCode = "en" - } - }, - { - "English/Zimbabwe", - new LanguageCodeDef - { - PluralRule = 1, - Code = "en-ZW", - GoogleCode = "en" - } - }, - { - "Esperanto", - new LanguageCodeDef - { - PluralRule = 1, - Code = "eo" - } - }, - { - "Estonian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "et" - } - }, - { - "Ewe", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ee", - GoogleCode = "-" - } - }, - { - "Faeroese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "fo", - GoogleCode = "-" - } - }, - { - "Fijian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "fj", - GoogleCode = "-" - } - }, - { - "Finnish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "fi" - } - }, - { - "French", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr" - } - }, - { - "French/Belgium", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr-BE", - GoogleCode = "fr" - } - }, - { - "French/Canada", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr-CA", - GoogleCode = "fr" - } - }, - { - "French/France", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr-FR", - GoogleCode = "fr" - } - }, - { - "French/Luxembourg", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr-LU", - GoogleCode = "fr" - } - }, - { - "French/Principality of Monaco", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr-MC", - GoogleCode = "fr" - } - }, - { - "French/Switzerland", - new LanguageCodeDef - { - PluralRule = 2, - Code = "fr-CH", - GoogleCode = "fr" - } - }, - { - "Fulah", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ff", - GoogleCode = "-" - } - }, - { - "Galician", - new LanguageCodeDef - { - PluralRule = 1, - Code = "gl" - } - }, - { - "Galician/Spain", - new LanguageCodeDef - { - PluralRule = 1, - Code = "gl-ES", - GoogleCode = "gl" - } - }, - { - "Georgian", - new LanguageCodeDef - { - PluralRule = 0, - Code = "ka" - } - }, - { - "German", - new LanguageCodeDef - { - PluralRule = 1, - Code = "de" - } - }, - { - "German/Austria", - new LanguageCodeDef - { - PluralRule = 1, - Code = "de-AT", - GoogleCode = "de" - } - }, - { - "German/Germany", - new LanguageCodeDef - { - PluralRule = 1, - Code = "de-DE", - GoogleCode = "de" - } - }, - { - "German/Liechtenstein", - new LanguageCodeDef - { - PluralRule = 1, - Code = "de-LI", - GoogleCode = "de" - } - }, - { - "German/Luxembourg", - new LanguageCodeDef - { - PluralRule = 1, - Code = "de-LU", - GoogleCode = "de" - } - }, - { - "German/Switzerland", - new LanguageCodeDef - { - PluralRule = 1, - Code = "de-CH", - GoogleCode = "de" - } - }, - { - "Greek", - new LanguageCodeDef - { - PluralRule = 1, - Code = "el" - } - }, - { - "Guaraní", - new LanguageCodeDef - { - PluralRule = 1, - Code = "gn", - GoogleCode = "-" - } - }, - { - "Gujarati", - new LanguageCodeDef - { - PluralRule = 1, - Code = "gu" - } - }, - { - "Haitian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ht" - } - }, - { - "Hausa", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ha" - } - }, - { - "Hebrew", - new LanguageCodeDef - { - PluralRule = 1, - Code = "he", - GoogleCode = "iw" - } - }, - { - "Herero", - new LanguageCodeDef - { - PluralRule = 1, - Code = "hz", - GoogleCode = "-" - } - }, - { - "Hindi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "hi" - } - }, - { - "Hiri Motu", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ho", - GoogleCode = "-" - } - }, - { - "Hungarian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "hu" - } - }, - { - "Interlingua", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ia", - GoogleCode = "-" - } - }, - { - "Indonesian", - new LanguageCodeDef - { - PluralRule = 0, - Code = "id" - } - }, - { - "Interlingue", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ie", - GoogleCode = "-" - } - }, - { - "Irish", - new LanguageCodeDef - { - PluralRule = 10, - Code = "ga" - } - }, - { - "Igbo", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ig" - } - }, - { - "Inupiaq", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ik", - GoogleCode = "-" - } - }, - { - "Ido", - new LanguageCodeDef - { - PluralRule = 1, - Code = "io", - GoogleCode = "-" - } - }, - { - "Icelandic", - new LanguageCodeDef - { - PluralRule = 14, - Code = "is" - } - }, - { - "Italian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "it" - } - }, - { - "Italian/Italy", - new LanguageCodeDef - { - PluralRule = 1, - Code = "it-IT", - GoogleCode = "it" - } - }, - { - "Italian/Switzerland", - new LanguageCodeDef - { - PluralRule = 1, - Code = "it-CH", - GoogleCode = "it" - } - }, - { - "Inuktitut", - new LanguageCodeDef - { - PluralRule = 1, - Code = "iu", - GoogleCode = "-" - } - }, - { - "Japanese", - new LanguageCodeDef - { - PluralRule = 0, - Code = "ja", - HasJoinedWords = true - } - }, - { - "Javanese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "jv" - } - }, - { - "Kalaallisut", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kl", - GoogleCode = "-" - } - }, - { - "Kannada", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kn" - } - }, - { - "Kanuri", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kr", - GoogleCode = "-" - } - }, - { - "Kashmiri", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ks", - GoogleCode = "-" - } - }, - { - "Kazakh", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kk" - } - }, - { - "Central Khmer", - new LanguageCodeDef - { - PluralRule = 1, - Code = "km" - } - }, - { - "Kikuyu", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ki", - GoogleCode = "-" - } - }, - { - "Kinyarwanda", - new LanguageCodeDef - { - PluralRule = 1, - Code = "rw", - GoogleCode = "-" - } - }, - { - "Kirghiz", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ky" - } - }, - { - "Komi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kv", - GoogleCode = "-" - } - }, - { - "Kongo", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kg", - GoogleCode = "-" - } - }, - { - "Korean", - new LanguageCodeDef - { - PluralRule = 0, - Code = "ko" - } - }, - { - "Kurdish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ku" - } - }, - { - "Kuanyama", - new LanguageCodeDef - { - PluralRule = 1, - Code = "kj", - GoogleCode = "-" - } - }, - { - "Latin", - new LanguageCodeDef - { - PluralRule = 1, - Code = "la" - } - }, - { - "Luxembourgish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "lb" - } - }, - { - "Ganda", - new LanguageCodeDef - { - PluralRule = 1, - Code = "lg", - GoogleCode = "-" - } - }, - { - "Limburgan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "li", - GoogleCode = "-" - } - }, - { - "Lingala", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ln", - GoogleCode = "-" - } - }, - { - "Lao", - new LanguageCodeDef - { - PluralRule = 1, - Code = "lo" - } - }, - { - "Latvian", - new LanguageCodeDef - { - PluralRule = 5, - Code = "lv" - } - }, - { - "Luba-Katanga", - new LanguageCodeDef - { - PluralRule = 1, - Code = "lu", - GoogleCode = "-" - } - }, - { - "Lithuanian", - new LanguageCodeDef - { - PluralRule = 5, - Code = "lt" - } - }, - { - "Manx", - new LanguageCodeDef - { - PluralRule = 1, - Code = "gv", - GoogleCode = "-" - } - }, - { - "Macedonian", - new LanguageCodeDef - { - PluralRule = 13, - Code = "mk" - } - }, - { - "Malagasy", - new LanguageCodeDef - { - PluralRule = 1, - Code = "mg" - } - }, - { - "Malay", - new LanguageCodeDef - { - PluralRule = 0, - Code = "ms" - } - }, - { - "Malay/Brunei Darussalam", - new LanguageCodeDef - { - PluralRule = 0, - Code = "ms-BN", - GoogleCode = "ms" - } - }, - { - "Malay/Malaysia", - new LanguageCodeDef - { - PluralRule = 0, - Code = "ms-MY", - GoogleCode = "ms" - } - }, - { - "Malayalam", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ml" - } - }, - { - "Maltese", - new LanguageCodeDef - { - PluralRule = 12, - Code = "mt" - } - }, - { - "Maori", - new LanguageCodeDef - { - PluralRule = 2, - Code = "mi" - } - }, - { - "Marathi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "mr" - } - }, - { - "Marshallese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "mh", - GoogleCode = "-" - } - }, - { - "Mongolian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "mn" - } - }, - { - "Nauru", - new LanguageCodeDef - { - PluralRule = 1, - Code = "na", - GoogleCode = "-" - } - }, - { - "Navajo", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nv", - GoogleCode = "-" - } - }, - { - "North Ndebele", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nd", - GoogleCode = "-" - } - }, - { - "Nepali", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ne" - } - }, - { - "Ndonga", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ng", - GoogleCode = "-" - } - }, - { - "Northern Sotho", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ns", - GoogleCode = "st" - } - }, - { - "Norwegian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nb", - GoogleCode = "no" - } - }, - { - "Norwegian/Nynorsk", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nn", - GoogleCode = "no" - } - }, - { - "Sichuan Yi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ii", - GoogleCode = "-" - } - }, - { - "South Ndebele", - new LanguageCodeDef - { - PluralRule = 1, - Code = "nr", - GoogleCode = "-" - } - }, - { - "Occitan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "oc", - GoogleCode = "-" - } - }, - { - "Ojibwa", - new LanguageCodeDef - { - PluralRule = 1, - Code = "oj", - GoogleCode = "-" - } - }, - { - "Church\u00a0Slavic", - new LanguageCodeDef - { - PluralRule = 1, - Code = "cu", - GoogleCode = "-" - } - }, - { - "Oromo", - new LanguageCodeDef - { - PluralRule = 1, - Code = "om", - GoogleCode = "-" - } - }, - { - "Oriya", - new LanguageCodeDef - { - PluralRule = 1, - Code = "or", - GoogleCode = "-" - } - }, - { - "Ossetian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "os", - GoogleCode = "-" - } - }, - { - "Pali", - new LanguageCodeDef - { - PluralRule = 1, - Code = "pi", - GoogleCode = "-" - } - }, - { - "Pashto", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ps" - } - }, - { - "Persian", - new LanguageCodeDef - { - PluralRule = 0, - Code = "fa" - } - }, - { - "Polish", - new LanguageCodeDef - { - PluralRule = 8, - Code = "pl" - } - }, - { - "Portuguese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "pt" - } - }, - { - "Portuguese/Brazil", - new LanguageCodeDef - { - PluralRule = 2, - Code = "pt-BR", - GoogleCode = "pt" - } - }, - { - "Portuguese/Portugal", - new LanguageCodeDef - { - PluralRule = 1, - Code = "pt-PT", - GoogleCode = "pt" - } - }, - { - "Punjabi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "pa" - } - }, - { - "Quechua", - new LanguageCodeDef - { - PluralRule = 1, - Code = "qu", - GoogleCode = "-" - } - }, - { - "Quechua/Bolivia", - new LanguageCodeDef - { - PluralRule = 1, - Code = "qu-BO", - GoogleCode = "-" - } - }, - { - "Quechua/Ecuador", - new LanguageCodeDef - { - PluralRule = 1, - Code = "qu-EC", - GoogleCode = "-" - } - }, - { - "Quechua/Peru", - new LanguageCodeDef - { - PluralRule = 1, - Code = "qu-PE", - GoogleCode = "-" - } - }, - { - "Rhaeto-Romanic", - new LanguageCodeDef - { - PluralRule = 1, - Code = "rm", - GoogleCode = "ro" - } - }, - { - "Romanian", - new LanguageCodeDef - { - PluralRule = 4, - Code = "ro" - } - }, - { - "Rundi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "rn", - GoogleCode = "-" - } - }, - { - "Russian", - new LanguageCodeDef - { - PluralRule = 6, - Code = "ru" - } - }, - { - "Russian/Republic of Moldova", - new LanguageCodeDef - { - PluralRule = 6, - Code = "ru-MO", - GoogleCode = "ru" - } - }, - { - "Sanskrit", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sa", - GoogleCode = "-" - } - }, - { - "Sardinian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sc", - GoogleCode = "-" - } - }, - { - "Sindhi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sd" - } - }, - { - "Northern Sami", - new LanguageCodeDef - { - PluralRule = 1, - Code = "se", - GoogleCode = "-" - } - }, - { - "Samoan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sm" - } - }, - { - "Sango", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sg", - GoogleCode = "-" - } - }, - { - "Serbian", - new LanguageCodeDef - { - PluralRule = 6, - Code = "sr" - } - }, - { - "Serbian/Bosnia and Herzegovina", - new LanguageCodeDef - { - PluralRule = 5, - Code = "sr-BA", - GoogleCode = "sr" - } - }, - { - "Serbian/Serbia and Montenegro", - new LanguageCodeDef - { - PluralRule = 5, - Code = "sr-SP", - GoogleCode = "sr" - } - }, - { - "Scottish Gaelic", - new LanguageCodeDef - { - PluralRule = 1, - Code = "gd" - } - }, - { - "Shona", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sn" - } - }, - { - "Sinhala", - new LanguageCodeDef - { - PluralRule = 1, - Code = "si" - } - }, - { - "Slovak", - new LanguageCodeDef - { - PluralRule = 7, - Code = "sk" - } - }, - { - "Slovenian", - new LanguageCodeDef - { - PluralRule = 9, - Code = "sl" - } - }, - { - "Somali", - new LanguageCodeDef - { - PluralRule = 1, - Code = "so" - } - }, - { - "Southern Sotho", - new LanguageCodeDef - { - PluralRule = 1, - Code = "st" - } - }, - { - "Spanish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es" - } - }, - { - "Spanish/Argentina", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-AR", - GoogleCode = "es" - } - }, - { - "Spanish/Bolivia", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-BO", - GoogleCode = "es" - } - }, - { - "Spanish/Castilian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-ES", - GoogleCode = "es" - } - }, - { - "Spanish/Chile", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-CL", - GoogleCode = "es" - } - }, - { - "Spanish/Colombia", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-CO", - GoogleCode = "es" - } - }, - { - "Spanish/Costa Rica", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-CR", - GoogleCode = "es" - } - }, - { - "Spanish/Dominican Republic", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-DO", - GoogleCode = "es" - } - }, - { - "Spanish/Ecuador", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-EC", - GoogleCode = "es" - } - }, - { - "Spanish/El Salvador", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-SV", - GoogleCode = "es" - } - }, - { - "Spanish/Guatemala", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-GT", - GoogleCode = "es" - } - }, - { - "Spanish/Honduras", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-HN", - GoogleCode = "es" - } - }, - { - "Spanish/Mexico", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-MX", - GoogleCode = "es" - } - }, - { - "Spanish/Nicaragua", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-NI", - GoogleCode = "es" - } - }, - { - "Spanish/Panama", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-PA", - GoogleCode = "es" - } - }, - { - "Spanish/Paraguay", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-PY", - GoogleCode = "es" - } - }, - { - "Spanish/Peru", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-PE", - GoogleCode = "es" - } - }, - { - "Spanish/Puerto Rico", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-PR", - GoogleCode = "es" - } - }, - { - "Spanish/Spain", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-ES", - GoogleCode = "es" - } - }, - { - "Spanish/Uruguay", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-UY", - GoogleCode = "es" - } - }, - { - "Spanish/Venezuela", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-VE", - GoogleCode = "es" - } - }, - { - "Spanish/Latin Americas", - new LanguageCodeDef - { - PluralRule = 1, - Code = "es-US", - GoogleCode = "es" - } - }, - { - "Sundanese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "su" - } - }, - { - "Swahili", - new LanguageCodeDef - { - Code = "sw" - } - }, - { - "Swati", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ss", - GoogleCode = "-" - } - }, - { - "Swedish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sv" - } - }, - { - "Swedish/Finland", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sv-FI", - GoogleCode = "sv" - } - }, - { - "Swedish/Sweden", - new LanguageCodeDef - { - PluralRule = 1, - Code = "sv-SE", - GoogleCode = "sv" - } - }, - { - "Tamil", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ta" - } - }, - { - "Tatar", - new LanguageCodeDef - { - PluralRule = 0, - Code = "tt", - GoogleCode = "-" - } - }, - { - "Telugu", - new LanguageCodeDef - { - PluralRule = 1, - Code = "te" - } - }, - { - "Tajik", - new LanguageCodeDef - { - PluralRule = 1, - Code = "tg" - } - }, - { - "Thai", - new LanguageCodeDef - { - PluralRule = 0, - Code = "th", - HasJoinedWords = true - } - }, - { - "Tigrinya", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ti", - GoogleCode = "-" - } - }, - { - "Tibetan", - new LanguageCodeDef - { - PluralRule = 1, - Code = "bo", - GoogleCode = "-" - } - }, - { - "Turkmen", - new LanguageCodeDef - { - PluralRule = 1, - Code = "tk", - GoogleCode = "-" - } - }, - { - "Tagalog", - new LanguageCodeDef - { - PluralRule = 1, - Code = "tl" - } - }, - { - "Tswana", - new LanguageCodeDef - { - PluralRule = 1, - Code = "tn", - GoogleCode = "-" - } - }, - { - "Tonga", - new LanguageCodeDef - { - PluralRule = 1, - Code = "to", - GoogleCode = "-" - } - }, - { - "Turkish", - new LanguageCodeDef - { - PluralRule = 0, - Code = "tr" - } - }, - { - "Tsonga", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ts", - GoogleCode = "-" - } - }, - { - "Twi", - new LanguageCodeDef - { - PluralRule = 1, - Code = "tw", - GoogleCode = "-" - } - }, - { - "Tahitian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ty", - GoogleCode = "-" - } - }, - { - "Uighur", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ug", - GoogleCode = "-" - } - }, - { - "Ukrainian", - new LanguageCodeDef - { - PluralRule = 6, - Code = "uk" - } - }, - { - "Urdu", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ur" - } - }, - { - "Uzbek", - new LanguageCodeDef - { - PluralRule = 2, - Code = "uz" - } - }, - { - "Venda", - new LanguageCodeDef - { - PluralRule = 1, - Code = "ve", - GoogleCode = "-" - } - }, - { - "Vietnamese", - new LanguageCodeDef - { - PluralRule = 1, - Code = "vi" - } - }, - { - "Volapük", - new LanguageCodeDef - { - PluralRule = 1, - Code = "vo", - GoogleCode = "-" - } - }, - { - "Walloon", - new LanguageCodeDef - { - PluralRule = 1, - Code = "wa", - GoogleCode = "-" - } - }, - { - "Welsh", - new LanguageCodeDef - { - PluralRule = 16, - Code = "cy" - } - }, - { - "Wolof", - new LanguageCodeDef - { - PluralRule = 1, - Code = "wo", - GoogleCode = "-" - } - }, - { - "Frisian", - new LanguageCodeDef - { - PluralRule = 1, - Code = "fy" - } - }, - { - "Xhosa", - new LanguageCodeDef - { - PluralRule = 1, - Code = "xh" - } - }, - { - "Yiddish", - new LanguageCodeDef - { - PluralRule = 1, - Code = "yi" - } - }, - { - "Yoruba", - new LanguageCodeDef - { - PluralRule = 1, - Code = "yo" - } - }, - { - "Zhuang", - new LanguageCodeDef - { - PluralRule = 1, - Code = "za", - GoogleCode = "-" - } - }, - { - "Zulu", - new LanguageCodeDef - { - PluralRule = 1, - Code = "zu" - } - } - }; - - public static string GetLanguageCode(string Filter, bool ShowWarnings = false) - { - if (string.IsNullOrEmpty(Filter)) - { - return string.Empty; - } - string[] filters = Filter.ToLowerInvariant().Split(" /(),".ToCharArray()); - foreach (KeyValuePair item in mLanguageDef) - { - if (LanguageMatchesFilter(item.Key, filters)) - { - return item.Value.Code; - } - } - if (ShowWarnings) - { - Debug.Log("Language '" + Filter + "' not recognized. Please, add the language code to GoogleTranslation.cs"); - } - return string.Empty; - } - - public static List GetLanguagesForDropdown(string Filter, string CodesToExclude) - { - string[] filters = Filter.ToLowerInvariant().Split(" /(),".ToCharArray()); - List list = new List(); - foreach (KeyValuePair item in mLanguageDef) - { - if (string.IsNullOrEmpty(Filter) || LanguageMatchesFilter(item.Key, filters)) - { - string text = string.Concat("[" + item.Value.Code + "]"); - if (!CodesToExclude.Contains(text)) - { - list.Add(item.Key + " " + text); - } - } - } - for (int num = list.Count - 2; num >= 0; num--) - { - string text2 = list[num].Substring(0, list[num].IndexOf(" [")); - if (list[num + 1].StartsWith(text2, StringComparison.Ordinal)) - { - list[num] = text2 + "/" + list[num]; - list.Insert(num + 1, text2 + "/"); - } - } - return list; - } - - private static bool LanguageMatchesFilter(string Language, string[] Filters) - { - Language = Language.ToLowerInvariant(); - int i = 0; - for (int num = Filters.Length; i < num; i++) - { - if (Filters[i] != "") - { - if (!Language.Contains(Filters[i].ToLower())) - { - return false; - } - Language = Language.Remove(Language.IndexOf(Filters[i], StringComparison.Ordinal), Filters[i].Length); - } - } - return true; - } - - public static string GetFormatedLanguageName(string Language) - { - string empty = string.Empty; - int num = Language.IndexOf(" [", StringComparison.Ordinal); - if (num > 0) - { - Language = Language.Substring(0, num); - } - num = Language.IndexOf('/'); - if (num > 0) - { - empty = Language.Substring(0, num); - if (Language == empty + "/" + empty) - { - return empty; - } - Language = Language.Replace("/", " (") + ")"; - } - return Language; - } - - public static string GetCodedLanguage(string Language, string code) - { - string languageCode = GetLanguageCode(Language); - if (string.Compare(code, languageCode, StringComparison.OrdinalIgnoreCase) == 0) - { - return Language; - } - return Language + " [" + code + "]"; - } - - public static void UnPackCodeFromLanguageName(string CodedLanguage, out string Language, out string code) - { - if (string.IsNullOrEmpty(CodedLanguage)) - { - Language = string.Empty; - code = string.Empty; - return; - } - int num = CodedLanguage.IndexOf("[", StringComparison.Ordinal); - if (num < 0) - { - Language = CodedLanguage; - code = GetLanguageCode(Language); - } - else - { - Language = CodedLanguage.Substring(0, num).Trim(); - code = CodedLanguage.Substring(num + 1, CodedLanguage.IndexOf("]", num, StringComparison.Ordinal) - num - 1); - } - } - - public static string GetGoogleLanguageCode(string InternationalCode) - { - foreach (KeyValuePair item in mLanguageDef) - { - if (InternationalCode == item.Value.Code) - { - if (item.Value.GoogleCode == "-") - { - return null; - } - return (!string.IsNullOrEmpty(item.Value.GoogleCode)) ? item.Value.GoogleCode : InternationalCode; - } - } - return InternationalCode; - } - - public static string GetLanguageName(string code, bool useParenthesesForRegion = false, bool allowDiscardRegion = true) - { - foreach (KeyValuePair item in mLanguageDef) - { - if (!(code == item.Value.Code)) - { - continue; - } - string text = item.Key; - if (useParenthesesForRegion) - { - int num = text.IndexOf('/'); - if (num > 0) - { - text = text.Substring(0, num) + " (" + text.Substring(num + 1) + ")"; - } - } - return text; - } - if (allowDiscardRegion) - { - int num2 = code.IndexOf("-", StringComparison.Ordinal); - if (num2 > 0) - { - return GetLanguageName(code.Substring(0, num2), useParenthesesForRegion, allowDiscardRegion: false); - } - } - return null; - } - - public static List GetAllInternationalCodes() - { - HashSet hashSet = new HashSet(StringComparer.Ordinal); - foreach (KeyValuePair item in mLanguageDef) - { - hashSet.Add(item.Value.Code); - } - return new List(hashSet); - } - - public static bool LanguageCode_HasJoinedWord(string languageCode) - { - foreach (KeyValuePair item in mLanguageDef) - { - if (languageCode == item.Value.GoogleCode || languageCode == item.Value.Code) - { - return item.Value.HasJoinedWords; - } - } - return false; - } - - private static int GetPluralRule(string langCode) - { - if (langCode.Length > 2) - { - langCode = langCode.Substring(0, 2); - } - langCode = langCode.ToLower(); - foreach (KeyValuePair item in mLanguageDef) - { - if (item.Value.Code == langCode) - { - return item.Value.PluralRule; - } - } - return 0; - } - - public static bool LanguageHasPluralType(string langCode, string pluralType) - { - switch (pluralType) - { - case "Plural": - case "Zero": - case "One": - return true; - default: - switch (GetPluralRule(langCode)) - { - case 3: - if (!(pluralType == "Two")) - { - return pluralType == "Few"; - } - return true; - case 4: - case 5: - case 6: - case 7: - case 8: - return pluralType == "Few"; - case 9: - if (!(pluralType == "Two")) - { - return pluralType == "Few"; - } - return true; - case 10: - case 11: - case 15: - case 16: - if (!(pluralType == "Two") && !(pluralType == "Few")) - { - return pluralType == "Many"; - } - return true; - case 12: - if (!(pluralType == "Few")) - { - return pluralType == "Many"; - } - return true; - case 13: - return pluralType == "Two"; - default: - return false; - } - } - } - - public static ePluralType GetPluralType(string langCode, int n) - { - switch (n) - { - case 0: - return ePluralType.Zero; - case 1: - return ePluralType.One; - default: - switch (GetPluralRule(langCode)) - { - case 0: - return ePluralType.Plural; - case 1: - if (n != 1) - { - return ePluralType.Plural; - } - return ePluralType.One; - case 2: - if (n > 1) - { - return ePluralType.Plural; - } - return ePluralType.One; - case 3: - switch (n) - { - default: - if (!inRange(n, 3, 10) && !inRange(n, 13, 19)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - case 2: - case 12: - return ePluralType.Two; - case 1: - case 11: - return ePluralType.One; - } - case 4: - if (n != 1) - { - if (!inRange(n % 100, 1, 19)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - } - return ePluralType.One; - case 5: - if (n % 10 != 1 || n % 100 == 11) - { - if (n % 10 < 2 || (n % 100 >= 10 && n % 100 < 20)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - } - return ePluralType.One; - case 6: - if (n % 10 != 1 || n % 100 == 11) - { - if (!inRange(n % 10, 2, 4) || inRange(n % 100, 12, 14)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - } - return ePluralType.One; - case 7: - if (n != 1) - { - if (!inRange(n, 2, 4)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - } - return ePluralType.One; - case 8: - if (n != 1) - { - if (!inRange(n % 10, 2, 4) || inRange(n % 100, 12, 14)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - } - return ePluralType.One; - case 9: - if (n % 100 != 1) - { - if (n % 100 != 2) - { - if (!inRange(n % 100, 3, 4)) - { - return ePluralType.Plural; - } - return ePluralType.Few; - } - return ePluralType.Two; - } - return ePluralType.One; - case 10: - switch (n) - { - default: - if (!inRange(n, 3, 6)) - { - if (!inRange(n, 7, 10)) - { - return ePluralType.Plural; - } - return ePluralType.Many; - } - return ePluralType.Few; - case 2: - return ePluralType.Two; - case 1: - return ePluralType.One; - } - case 11: - switch (n) - { - default: - if (!inRange(n % 100, 3, 10)) - { - if (n % 100 < 11) - { - return ePluralType.Plural; - } - return ePluralType.Many; - } - return ePluralType.Few; - case 2: - return ePluralType.Two; - case 1: - return ePluralType.One; - case 0: - return ePluralType.Zero; - } - case 12: - if (n != 1) - { - if (!inRange(n % 100, 1, 10)) - { - if (!inRange(n % 100, 11, 19)) - { - return ePluralType.Plural; - } - return ePluralType.Many; - } - return ePluralType.Few; - } - return ePluralType.One; - case 13: - if (n % 10 != 1) - { - if (n % 10 != 2) - { - return ePluralType.Plural; - } - return ePluralType.Two; - } - return ePluralType.One; - case 14: - if (n % 10 != 1 || n % 100 == 11) - { - return ePluralType.Plural; - } - return ePluralType.One; - case 15: - if (n % 10 != 1 || n % 100 == 11 || n % 100 == 71 || n % 100 == 91) - { - if (n % 10 != 2 || n % 100 == 12 || n % 100 == 72 || n % 100 == 92) - { - if ((n % 10 != 3 && n % 10 != 4 && n % 10 != 9) || n % 100 == 13 || n % 100 == 14 || n % 100 == 19 || n % 100 == 73 || n % 100 == 74 || n % 100 == 79 || n % 100 == 93 || n % 100 == 94 || n % 100 == 99) - { - if (n % 1000000 != 0) - { - return ePluralType.Plural; - } - return ePluralType.Many; - } - return ePluralType.Few; - } - return ePluralType.Two; - } - return ePluralType.One; - case 16: - return n switch - { - 6 => ePluralType.Many, - 3 => ePluralType.Few, - 2 => ePluralType.Two, - 1 => ePluralType.One, - 0 => ePluralType.Zero, - _ => ePluralType.Plural, - }; - default: - return ePluralType.Plural; - } - } - } - - public static int GetPluralTestNumber(string langCode, ePluralType pluralType) - { - switch (pluralType) - { - case ePluralType.Zero: - return 0; - case ePluralType.One: - return 1; - case ePluralType.Few: - return 3; - case ePluralType.Many: - switch (GetPluralRule(langCode)) - { - case 10: - return 8; - case 11: - case 12: - return 13; - case 15: - return 1000000; - default: - return 6; - } - default: - return 936; - } - } - - private static bool inRange(int amount, int min, int max) - { - if (amount >= min) - { - return amount <= max; - } - return false; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/GoogleTranslation.cs b/Thronefall_1_57/Thronefall/I2.Loc/GoogleTranslation.cs deleted file mode 100644 index 94f3869..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/GoogleTranslation.cs +++ /dev/null @@ -1,575 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using UnityEngine.Networking; - -namespace I2.Loc; - -public static class GoogleTranslation -{ - public delegate void fnOnTranslated(string Translation, string Error); - - public delegate void fnOnTranslationReady(Dictionary dict, string error); - - private static List mCurrentTranslations = new List(); - - private static List mTranslationJobs = new List(); - - public static bool CanTranslate() - { - if (LocalizationManager.Sources.Count > 0) - { - return !string.IsNullOrEmpty(LocalizationManager.GetWebServiceURL()); - } - return false; - } - - public static void Translate(string text, string LanguageCodeFrom, string LanguageCodeTo, fnOnTranslated OnTranslationReady) - { - LocalizationManager.InitializeIfNeeded(); - if (!CanTranslate()) - { - OnTranslationReady(null, "WebService is not set correctly or needs to be reinstalled"); - return; - } - if (LanguageCodeTo == LanguageCodeFrom) - { - OnTranslationReady(text, null); - return; - } - Dictionary queries = new Dictionary(StringComparer.Ordinal); - if (string.IsNullOrEmpty(LanguageCodeTo)) - { - OnTranslationReady(string.Empty, null); - return; - } - CreateQueries(text, LanguageCodeFrom, LanguageCodeTo, queries); - Translate(queries, delegate(Dictionary results, string error) - { - if (!string.IsNullOrEmpty(error) || results.Count == 0) - { - OnTranslationReady(null, error); - } - else - { - string translation = RebuildTranslation(text, queries, LanguageCodeTo); - OnTranslationReady(translation, null); - } - }); - } - - public static string ForceTranslate(string text, string LanguageCodeFrom, string LanguageCodeTo) - { - Dictionary dictionary = new Dictionary(StringComparer.Ordinal); - AddQuery(text, LanguageCodeFrom, LanguageCodeTo, dictionary); - TranslationJob_Main translationJob_Main = new TranslationJob_Main(dictionary, null); - while (true) - { - switch (translationJob_Main.GetState()) - { - case TranslationJob.eJobState.Running: - break; - case TranslationJob.eJobState.Failed: - return null; - default: - return GetQueryResult(text, "", dictionary); - } - } - } - - public static void Translate(Dictionary requests, fnOnTranslationReady OnTranslationReady, bool usePOST = true) - { - AddTranslationJob(new TranslationJob_Main(requests, OnTranslationReady)); - } - - public static bool ForceTranslate(Dictionary requests, bool usePOST = true) - { - TranslationJob_Main translationJob_Main = new TranslationJob_Main(requests, null); - while (true) - { - switch (translationJob_Main.GetState()) - { - case TranslationJob.eJobState.Running: - break; - case TranslationJob.eJobState.Failed: - return false; - default: - return true; - } - } - } - - public static List ConvertTranslationRequest(Dictionary requests, bool encodeGET) - { - List list = new List(); - StringBuilder stringBuilder = new StringBuilder(); - foreach (KeyValuePair request in requests) - { - TranslationQuery value = request.Value; - if (stringBuilder.Length > 0) - { - stringBuilder.Append(""); - } - stringBuilder.Append(GoogleLanguages.GetGoogleLanguageCode(value.LanguageCode)); - stringBuilder.Append(":"); - for (int i = 0; i < value.TargetLanguagesCode.Length; i++) - { - if (i != 0) - { - stringBuilder.Append(","); - } - stringBuilder.Append(GoogleLanguages.GetGoogleLanguageCode(value.TargetLanguagesCode[i])); - } - stringBuilder.Append("="); - string text = ((TitleCase(value.Text) == value.Text) ? value.Text.ToLowerInvariant() : value.Text); - if (!encodeGET) - { - stringBuilder.Append(text); - continue; - } - stringBuilder.Append(Uri.EscapeDataString(text)); - if (stringBuilder.Length > 4000) - { - list.Add(stringBuilder.ToString()); - stringBuilder.Length = 0; - } - } - list.Add(stringBuilder.ToString()); - return list; - } - - private static void AddTranslationJob(TranslationJob job) - { - mTranslationJobs.Add(job); - if (mTranslationJobs.Count == 1) - { - CoroutineManager.Start(WaitForTranslations()); - } - } - - private static IEnumerator WaitForTranslations() - { - while (mTranslationJobs.Count > 0) - { - TranslationJob[] array = mTranslationJobs.ToArray(); - foreach (TranslationJob translationJob in array) - { - if (translationJob.GetState() != 0) - { - mTranslationJobs.Remove(translationJob); - } - } - yield return null; - } - } - - public static string ParseTranslationResult(string html, Dictionary requests) - { - if (html.StartsWith("") || html.StartsWith("")) - { - if (html.Contains("The script completed but did not return anything")) - { - return "The current Google WebService is not supported.\nPlease, delete the WebService from the Google Drive and Install the latest version."; - } - if (html.Contains("Service invoked too many times in a short time")) - { - return ""; - } - return "There was a problem contacting the WebService. Please try again later\n" + html; - } - string[] array = html.Split(new string[1] { "" }, StringSplitOptions.None); - string[] separator = new string[1] { "" }; - int num = 0; - string[] array2 = requests.Keys.ToArray(); - foreach (string text in array2) - { - TranslationQuery value = FindQueryFromOrigText(text, requests); - string text2 = array[num++]; - if (value.Tags != null) - { - for (int num2 = value.Tags.Length - 1; num2 >= 0; num2--) - { - text2 = text2.Replace(GetGoogleNoTranslateTag(num2), value.Tags[num2]); - } - } - value.Results = text2.Split(separator, StringSplitOptions.None); - if (TitleCase(text) == text) - { - for (int j = 0; j < value.Results.Length; j++) - { - value.Results[j] = TitleCase(value.Results[j]); - } - } - requests[value.OrigText] = value; - } - return null; - } - - public static bool IsTranslating() - { - if (mCurrentTranslations.Count <= 0) - { - return mTranslationJobs.Count > 0; - } - return true; - } - - public static void CancelCurrentGoogleTranslations() - { - mCurrentTranslations.Clear(); - foreach (TranslationJob mTranslationJob in mTranslationJobs) - { - mTranslationJob.Dispose(); - } - mTranslationJobs.Clear(); - } - - public static void CreateQueries(string text, string LanguageCodeFrom, string LanguageCodeTo, Dictionary dict) - { - if (!text.Contains("[i2s_")) - { - CreateQueries_Plurals(text, LanguageCodeFrom, LanguageCodeTo, dict); - return; - } - foreach (KeyValuePair specialization in SpecializationManager.GetSpecializations(text)) - { - CreateQueries_Plurals(specialization.Value, LanguageCodeFrom, LanguageCodeTo, dict); - } - } - - private static void CreateQueries_Plurals(string text, string LanguageCodeFrom, string LanguageCodeTo, Dictionary dict) - { - bool flag = text.Contains("{[#"); - bool flag2 = text.Contains("[i2p_"); - if (!HasParameters(text) || (!flag && !flag2)) - { - AddQuery(text, LanguageCodeFrom, LanguageCodeTo, dict); - return; - } - bool forceTag = flag; - for (ePluralType ePluralType2 = ePluralType.Zero; ePluralType2 <= ePluralType.Plural; ePluralType2++) - { - string pluralType = ePluralType2.ToString(); - if (GoogleLanguages.LanguageHasPluralType(LanguageCodeTo, pluralType)) - { - string text2 = GetPluralText(text, pluralType); - int pluralTestNumber = GoogleLanguages.GetPluralTestNumber(LanguageCodeTo, ePluralType2); - string pluralParameter = GetPluralParameter(text2, forceTag); - if (!string.IsNullOrEmpty(pluralParameter)) - { - text2 = text2.Replace(pluralParameter, pluralTestNumber.ToString()); - } - AddQuery(text2, LanguageCodeFrom, LanguageCodeTo, dict); - } - } - } - - public static void AddQuery(string text, string LanguageCodeFrom, string LanguageCodeTo, Dictionary dict) - { - if (string.IsNullOrEmpty(text)) - { - return; - } - if (!dict.ContainsKey(text)) - { - TranslationQuery translationQuery = default(TranslationQuery); - translationQuery.OrigText = text; - translationQuery.LanguageCode = LanguageCodeFrom; - translationQuery.TargetLanguagesCode = new string[1] { LanguageCodeTo }; - TranslationQuery query = translationQuery; - query.Text = text; - ParseNonTranslatableElements(ref query); - dict[text] = query; - } - else - { - TranslationQuery value = dict[text]; - if (Array.IndexOf(value.TargetLanguagesCode, LanguageCodeTo) < 0) - { - value.TargetLanguagesCode = value.TargetLanguagesCode.Concat(new string[1] { LanguageCodeTo }).Distinct().ToArray(); - } - dict[text] = value; - } - } - - private static string GetTranslation(string text, string LanguageCodeTo, Dictionary dict) - { - if (!dict.ContainsKey(text)) - { - return null; - } - TranslationQuery translationQuery = dict[text]; - int num = Array.IndexOf(translationQuery.TargetLanguagesCode, LanguageCodeTo); - if (num < 0) - { - return ""; - } - if (translationQuery.Results == null) - { - return ""; - } - return translationQuery.Results[num]; - } - - private static TranslationQuery FindQueryFromOrigText(string origText, Dictionary dict) - { - foreach (KeyValuePair item in dict) - { - if (item.Value.OrigText == origText) - { - return item.Value; - } - } - return default(TranslationQuery); - } - - public static bool HasParameters(string text) - { - int num = text.IndexOf("{[", StringComparison.Ordinal); - if (num < 0) - { - return false; - } - return text.IndexOf("]}", num, StringComparison.Ordinal) > 0; - } - - public static string GetPluralParameter(string text, bool forceTag) - { - int num = text.IndexOf("{[#", StringComparison.Ordinal); - if (num < 0) - { - if (forceTag) - { - return null; - } - num = text.IndexOf("{[", StringComparison.Ordinal); - } - if (num < 0) - { - return null; - } - int num2 = text.IndexOf("]}", num + 2, StringComparison.Ordinal); - if (num2 < 0) - { - return null; - } - return text.Substring(num, num2 - num + 2); - } - - public static string GetPluralText(string text, string pluralType) - { - pluralType = "[i2p_" + pluralType + "]"; - int num = text.IndexOf(pluralType, StringComparison.Ordinal); - if (num >= 0) - { - num += pluralType.Length; - int num2 = text.IndexOf("[i2p_", num, StringComparison.Ordinal); - if (num2 < 0) - { - num2 = text.Length; - } - return text.Substring(num, num2 - num); - } - num = text.IndexOf("[i2p_", StringComparison.Ordinal); - if (num < 0) - { - return text; - } - if (num > 0) - { - return text.Substring(0, num); - } - num = text.IndexOf("]", StringComparison.Ordinal); - if (num < 0) - { - return text; - } - num++; - int num3 = text.IndexOf("[i2p_", num, StringComparison.Ordinal); - if (num3 < 0) - { - num3 = text.Length; - } - return text.Substring(num, num3 - num); - } - - private static int FindClosingTag(string tag, MatchCollection matches, int startIndex) - { - int i = startIndex; - for (int count = matches.Count; i < count; i++) - { - string captureMatch = I2Utils.GetCaptureMatch(matches[i]); - if (captureMatch[0] == '/' && tag.StartsWith(captureMatch.Substring(1), StringComparison.Ordinal)) - { - return i; - } - } - return -1; - } - - private static string GetGoogleNoTranslateTag(int tagNumber) - { - if (tagNumber < 70) - { - return "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++".Substring(0, tagNumber + 1); - } - string text = ""; - for (int i = -1; i < tagNumber; i++) - { - text += "+"; - } - return text; - } - - private static void ParseNonTranslatableElements(ref TranslationQuery query) - { - MatchCollection matchCollection = Regex.Matches(query.Text, "\\{\\[(.*?)]}|\\[(.*?)]|\\<(.*?)>"); - if (matchCollection == null || matchCollection.Count == 0) - { - return; - } - string text = query.Text; - List list = new List(); - int i = 0; - for (int count = matchCollection.Count; i < count; i++) - { - string captureMatch = I2Utils.GetCaptureMatch(matchCollection[i]); - int num = FindClosingTag(captureMatch, matchCollection, i); - if (num < 0) - { - string text2 = matchCollection[i].ToString(); - if (text2.StartsWith("{[", StringComparison.Ordinal) && text2.EndsWith("]}", StringComparison.Ordinal)) - { - text = text.Replace(text2, GetGoogleNoTranslateTag(list.Count) + " "); - list.Add(text2); - } - } - else if (captureMatch == "i2nt") - { - string text3 = query.Text.Substring(matchCollection[i].Index, matchCollection[num].Index - matchCollection[i].Index + matchCollection[num].Length); - text = text.Replace(text3, GetGoogleNoTranslateTag(list.Count) + " "); - list.Add(text3); - } - else - { - string text4 = matchCollection[i].ToString(); - text = text.Replace(text4, GetGoogleNoTranslateTag(list.Count) + " "); - list.Add(text4); - string text5 = matchCollection[num].ToString(); - text = text.Replace(text5, GetGoogleNoTranslateTag(list.Count) + " "); - list.Add(text5); - } - } - query.Text = text; - query.Tags = list.ToArray(); - } - - public static string GetQueryResult(string text, string LanguageCodeTo, Dictionary dict) - { - if (!dict.ContainsKey(text)) - { - return null; - } - TranslationQuery translationQuery = dict[text]; - if (translationQuery.Results == null || translationQuery.Results.Length < 0) - { - return null; - } - if (string.IsNullOrEmpty(LanguageCodeTo)) - { - return translationQuery.Results[0]; - } - int num = Array.IndexOf(translationQuery.TargetLanguagesCode, LanguageCodeTo); - if (num < 0) - { - return null; - } - return translationQuery.Results[num]; - } - - public static string RebuildTranslation(string text, Dictionary dict, string LanguageCodeTo) - { - if (!text.Contains("[i2s_")) - { - return RebuildTranslation_Plural(text, dict, LanguageCodeTo); - } - Dictionary specializations = SpecializationManager.GetSpecializations(text); - Dictionary dictionary = new Dictionary(StringComparer.Ordinal); - foreach (KeyValuePair item in specializations) - { - dictionary[item.Key] = RebuildTranslation_Plural(item.Value, dict, LanguageCodeTo); - } - return SpecializationManager.SetSpecializedText(dictionary); - } - - private static string RebuildTranslation_Plural(string text, Dictionary dict, string LanguageCodeTo) - { - bool flag = text.Contains("{[#"); - bool flag2 = text.Contains("[i2p_"); - if (!HasParameters(text) || (!flag && !flag2)) - { - return GetTranslation(text, LanguageCodeTo, dict); - } - StringBuilder stringBuilder = new StringBuilder(); - string text2 = null; - bool forceTag = flag; - for (ePluralType ePluralType2 = ePluralType.Plural; ePluralType2 >= ePluralType.Zero; ePluralType2--) - { - string text3 = ePluralType2.ToString(); - if (!GoogleLanguages.LanguageHasPluralType(LanguageCodeTo, text3)) - { - continue; - } - string text4 = GetPluralText(text, text3); - int pluralTestNumber = GoogleLanguages.GetPluralTestNumber(LanguageCodeTo, ePluralType2); - string pluralParameter = GetPluralParameter(text4, forceTag); - if (!string.IsNullOrEmpty(pluralParameter)) - { - text4 = text4.Replace(pluralParameter, pluralTestNumber.ToString()); - } - string text5 = GetTranslation(text4, LanguageCodeTo, dict); - if (!string.IsNullOrEmpty(pluralParameter)) - { - text5 = text5.Replace(pluralTestNumber.ToString(), pluralParameter); - } - if (ePluralType2 == ePluralType.Plural) - { - text2 = text5; - } - else - { - if (text5 == text2) - { - continue; - } - stringBuilder.AppendFormat("[i2p_{0}]", text3); - } - stringBuilder.Append(text5); - } - return stringBuilder.ToString(); - } - - public static string UppercaseFirst(string s) - { - if (string.IsNullOrEmpty(s)) - { - return string.Empty; - } - char[] array = s.ToLower().ToCharArray(); - array[0] = char.ToUpper(array[0]); - return new string(array); - } - - public static string TitleCase(string s) - { - if (string.IsNullOrEmpty(s)) - { - return string.Empty; - } - return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/HindiFixer.cs b/Thronefall_1_57/Thronefall/I2.Loc/HindiFixer.cs deleted file mode 100644 index 41e3740..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/HindiFixer.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Linq; - -namespace I2.Loc; - -public class HindiFixer -{ - internal static string Fix(string text) - { - char[] array = text.ToCharArray(); - bool flag = false; - for (int i = 0; i < array.Length; i++) - { - if (array[i] == '\u093f' && !char.IsWhiteSpace(array[i - 1]) && array[i - 1] != 0) - { - array[i] = array[i - 1]; - array[i - 1] = '\u093f'; - flag = true; - } - if (i != array.Length - 1) - { - if (array[i] == 'इ' && array[i + 1] == '\u093c') - { - array[i] = 'ऌ'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == '\u0943' && array[i + 1] == '\u093c') - { - array[i] = '\u0944'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == '\u0901' && array[i + 1] == '\u093c') - { - array[i] = 'ॐ'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == 'ऋ' && array[i + 1] == '\u093c') - { - array[i] = 'ॠ'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == 'ई' && array[i + 1] == '\u093c') - { - array[i] = 'ॡ'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == '\u093f' && array[i + 1] == '\u093c') - { - array[i] = '\u0962'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == '\u0940' && array[i + 1] == '\u093c') - { - array[i] = '\u0963'; - array[i + 1] = '\0'; - flag = true; - } - if (array[i] == '।' && array[i + 1] == '\u093c') - { - array[i] = 'ऽ'; - array[i + 1] = '\0'; - flag = true; - } - } - } - if (!flag) - { - return text; - } - string text2 = new string(array.Where((char x) => x != '\0').ToArray()); - if (text2 == text) - { - return text2; - } - text = text2; - return text; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/I2BasePersistentStorage.cs b/Thronefall_1_57/Thronefall/I2.Loc/I2BasePersistentStorage.cs deleted file mode 100644 index bd4a52c..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/I2BasePersistentStorage.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Globalization; -using System.IO; -using System.Text; -using UnityEngine; - -namespace I2.Loc; - -public abstract class I2BasePersistentStorage -{ - public virtual void SetSetting_String(string key, string value) - { - try - { - int length = value.Length; - int num = 8000; - if (length <= num) - { - PlayerPrefs.SetString(key, value); - return; - } - int num2 = Mathf.CeilToInt((float)length / (float)num); - for (int i = 0; i < num2; i++) - { - int num3 = num * i; - PlayerPrefs.SetString($"[I2split]{i}{key}", value.Substring(num3, Mathf.Min(num, length - num3))); - } - PlayerPrefs.SetString(key, "[$I2#@div$]" + num2); - } - catch (Exception) - { - Debug.LogError("Error saving PlayerPrefs " + key); - } - } - - public virtual string GetSetting_String(string key, string defaultValue) - { - try - { - string text = PlayerPrefs.GetString(key, defaultValue); - if (!string.IsNullOrEmpty(text) && text.StartsWith("[I2split]", StringComparison.Ordinal)) - { - int num = int.Parse(text.Substring("[I2split]".Length), CultureInfo.InvariantCulture); - text = ""; - for (int i = 0; i < num; i++) - { - text += PlayerPrefs.GetString($"[I2split]{i}{key}", ""); - } - } - return text; - } - catch (Exception) - { - Debug.LogError("Error loading PlayerPrefs " + key); - return defaultValue; - } - } - - public virtual void DeleteSetting(string key) - { - try - { - string @string = PlayerPrefs.GetString(key, null); - if (!string.IsNullOrEmpty(@string) && @string.StartsWith("[I2split]", StringComparison.Ordinal)) - { - int num = int.Parse(@string.Substring("[I2split]".Length), CultureInfo.InvariantCulture); - for (int i = 0; i < num; i++) - { - PlayerPrefs.DeleteKey($"[I2split]{i}{key}"); - } - } - PlayerPrefs.DeleteKey(key); - } - catch (Exception) - { - Debug.LogError("Error deleting PlayerPrefs " + key); - } - } - - public virtual void ForceSaveSettings() - { - PlayerPrefs.Save(); - } - - public virtual bool HasSetting(string key) - { - return PlayerPrefs.HasKey(key); - } - - public virtual bool CanAccessFiles() - { - return true; - } - - private string UpdateFilename(PersistentStorage.eFileType fileType, string fileName) - { - switch (fileType) - { - case PersistentStorage.eFileType.Persistent: - fileName = Application.persistentDataPath + "/" + fileName; - break; - case PersistentStorage.eFileType.Temporal: - fileName = Application.temporaryCachePath + "/" + fileName; - break; - case PersistentStorage.eFileType.Streaming: - fileName = Application.streamingAssetsPath + "/" + fileName; - break; - } - return fileName; - } - - public virtual bool SaveFile(PersistentStorage.eFileType fileType, string fileName, string data, bool logExceptions = true) - { - if (!CanAccessFiles()) - { - return false; - } - try - { - fileName = UpdateFilename(fileType, fileName); - File.WriteAllText(fileName, data, Encoding.UTF8); - return true; - } - catch (Exception ex) - { - if (logExceptions) - { - Debug.LogError("Error saving file '" + fileName + "'\n" + ex); - } - return false; - } - } - - public virtual string LoadFile(PersistentStorage.eFileType fileType, string fileName, bool logExceptions = true) - { - if (!CanAccessFiles()) - { - return null; - } - try - { - fileName = UpdateFilename(fileType, fileName); - return File.ReadAllText(fileName, Encoding.UTF8); - } - catch (Exception ex) - { - if (logExceptions) - { - Debug.LogError("Error loading file '" + fileName + "'\n" + ex); - } - return null; - } - } - - public virtual bool DeleteFile(PersistentStorage.eFileType fileType, string fileName, bool logExceptions = true) - { - if (!CanAccessFiles()) - { - return false; - } - try - { - fileName = UpdateFilename(fileType, fileName); - File.Delete(fileName); - return true; - } - catch (Exception ex) - { - if (logExceptions) - { - Debug.LogError("Error deleting file '" + fileName + "'\n" + ex); - } - return false; - } - } - - public virtual bool HasFile(PersistentStorage.eFileType fileType, string fileName, bool logExceptions = true) - { - if (!CanAccessFiles()) - { - return false; - } - try - { - fileName = UpdateFilename(fileType, fileName); - return File.Exists(fileName); - } - catch (Exception ex) - { - if (logExceptions) - { - Debug.LogError("Error requesting file '" + fileName + "'\n" + ex); - } - return false; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/I2CustomPersistentStorage.cs b/Thronefall_1_57/Thronefall/I2.Loc/I2CustomPersistentStorage.cs deleted file mode 100644 index f518316..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/I2CustomPersistentStorage.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace I2.Loc; - -public class I2CustomPersistentStorage : I2BasePersistentStorage -{ -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/I2Utils.cs b/Thronefall_1_57/Thronefall/I2.Loc/I2Utils.cs deleted file mode 100644 index a60bb8e..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/I2Utils.cs +++ /dev/null @@ -1,301 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using UnityEngine; -using UnityEngine.Networking; -using UnityEngine.SceneManagement; - -namespace I2.Loc; - -public static class I2Utils -{ - public const string ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; - - public const string NumberChars = "0123456789"; - - public const string ValidNameSymbols = ".-_$#@*()[]{}+:?!&',^=<>~`"; - - public static string ReverseText(string source) - { - int length = source.Length; - char[] output = new char[length]; - char[] anyOf = new char[2] { '\r', '\n' }; - int i = 0; - while (i < length) - { - int num = source.IndexOfAny(anyOf, i); - if (num < 0) - { - num = length; - } - Reverse(i, num - 1); - for (i = num; i < length && (source[i] == '\r' || source[i] == '\n'); i++) - { - output[i] = source[i]; - } - } - return new string(output); - void Reverse(int start, int end) - { - for (int j = 0; j <= end - start; j++) - { - output[end - j] = source[start + j]; - } - } - } - - public static string RemoveNonASCII(string text, bool allowCategory = false) - { - if (string.IsNullOrEmpty(text)) - { - return text; - } - int num = 0; - char[] array = new char[text.Length]; - bool flag = false; - string text2 = text.Trim(); - foreach (char c in text2) - { - char c2 = ' '; - if ((allowCategory && (c == '\\' || c == '"' || c == '/')) || char.IsLetterOrDigit(c) || ".-_$#@*()[]{}+:?!&',^=<>~`".IndexOf(c) >= 0) - { - c2 = c; - } - if (char.IsWhiteSpace(c2)) - { - if (!flag) - { - if (num > 0) - { - array[num++] = ' '; - } - flag = true; - } - } - else - { - flag = false; - array[num++] = c2; - } - } - return new string(array, 0, num); - } - - public static string GetValidTermName(string text, bool allowCategory = false) - { - if (text == null) - { - return null; - } - text = RemoveTags(text); - return RemoveNonASCII(text, allowCategory); - } - - public static string SplitLine(string line, int maxCharacters) - { - if (maxCharacters <= 0 || line.Length < maxCharacters) - { - return line; - } - char[] array = line.ToCharArray(); - bool flag = true; - bool flag2 = false; - int i = 0; - int num = 0; - for (; i < array.Length; i++) - { - if (flag) - { - num++; - if (array[i] == '\n') - { - num = 0; - } - if (num >= maxCharacters && char.IsWhiteSpace(array[i])) - { - array[i] = '\n'; - flag = false; - flag2 = false; - } - } - else if (!char.IsWhiteSpace(array[i])) - { - flag = true; - num = 0; - } - else if (array[i] != '\n') - { - array[i] = '\0'; - } - else - { - if (!flag2) - { - array[i] = '\0'; - } - flag2 = true; - } - } - return new string(array.Where((char c) => c != '\0').ToArray()); - } - - public static bool FindNextTag(string line, int iStart, out int tagStart, out int tagEnd) - { - tagStart = -1; - tagEnd = -1; - int length = line.Length; - tagStart = iStart; - while (tagStart < length && line[tagStart] != '[' && line[tagStart] != '(' && line[tagStart] != '{' && line[tagStart] != '<') - { - tagStart++; - } - if (tagStart == length) - { - return false; - } - bool flag = false; - for (tagEnd = tagStart + 1; tagEnd < length; tagEnd++) - { - char c = line[tagEnd]; - if (c == ']' || c == ')' || c == '}' || c == '>') - { - if (flag) - { - return FindNextTag(line, tagEnd + 1, out tagStart, out tagEnd); - } - return true; - } - if (c > 'ÿ') - { - flag = true; - } - } - return false; - } - - public static string RemoveTags(string text) - { - return Regex.Replace(text, "\\{\\[(.*?)]}|\\[(.*?)]|\\<(.*?)>", ""); - } - - public static bool RemoveResourcesPath(ref string sPath) - { - int num = sPath.IndexOf("\\Resources\\", StringComparison.Ordinal); - int num2 = sPath.IndexOf("\\Resources/", StringComparison.Ordinal); - int num3 = sPath.IndexOf("/Resources\\", StringComparison.Ordinal); - int num4 = sPath.IndexOf("/Resources/", StringComparison.Ordinal); - int num5 = Mathf.Max(num, num2, num3, num4); - bool result = false; - if (num5 >= 0) - { - sPath = sPath.Substring(num5 + 11); - result = true; - } - else - { - num5 = sPath.LastIndexOfAny(LanguageSourceData.CategorySeparators); - if (num5 > 0) - { - sPath = sPath.Substring(num5 + 1); - } - } - string extension = Path.GetExtension(sPath); - if (!string.IsNullOrEmpty(extension)) - { - sPath = sPath.Substring(0, sPath.Length - extension.Length); - } - return result; - } - - public static bool IsPlaying() - { - if (Application.isPlaying) - { - return true; - } - return false; - } - - public static string GetPath(this Transform tr) - { - Transform parent = tr.parent; - if (tr == null) - { - return tr.name; - } - return parent.GetPath() + "/" + tr.name; - } - - public static Transform FindObject(string objectPath) - { - return FindObject(SceneManager.GetActiveScene(), objectPath); - } - - public static Transform FindObject(Scene scene, string objectPath) - { - GameObject[] rootGameObjects = scene.GetRootGameObjects(); - for (int i = 0; i < rootGameObjects.Length; i++) - { - Transform transform = rootGameObjects[i].transform; - if (transform.name == objectPath) - { - return transform; - } - if (objectPath.StartsWith(transform.name + "/", StringComparison.Ordinal)) - { - return FindObject(transform, objectPath.Substring(transform.name.Length + 1)); - } - } - return null; - } - - public static Transform FindObject(Transform root, string objectPath) - { - for (int i = 0; i < root.childCount; i++) - { - Transform child = root.GetChild(i); - if (child.name == objectPath) - { - return child; - } - if (objectPath.StartsWith(child.name + "/", StringComparison.Ordinal)) - { - return FindObject(child, objectPath.Substring(child.name.Length + 1)); - } - } - return null; - } - - public static H FindInParents(Transform tr) where H : Component - { - if (!tr) - { - return null; - } - H component = tr.GetComponent(); - while (!(UnityEngine.Object)component && (bool)tr) - { - component = tr.GetComponent(); - tr = tr.parent; - } - return component; - } - - public static string GetCaptureMatch(Match match) - { - for (int num = match.Groups.Count - 1; num >= 0; num--) - { - if (match.Groups[num].Success) - { - return match.Groups[num].ToString(); - } - } - return match.ToString(); - } - - public static void SendWebRequest(UnityWebRequest www) - { - www.SendWebRequest(); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ILanguageSource.cs b/Thronefall_1_57/Thronefall/I2.Loc/ILanguageSource.cs deleted file mode 100644 index 7717e4d..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ILanguageSource.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace I2.Loc; - -public interface ILanguageSource -{ - LanguageSourceData SourceData { get; set; } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ILocalizationParamsManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/ILocalizationParamsManager.cs deleted file mode 100644 index c96bd20..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ILocalizationParamsManager.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace I2.Loc; - -public interface ILocalizationParamsManager -{ - string GetParameterValue(string Param); -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTarget.cs b/Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTarget.cs deleted file mode 100644 index 2d8c155..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTarget.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public abstract class ILocalizeTarget : ScriptableObject -{ - public abstract bool IsValid(Localize cmp); - - public abstract void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm); - - public abstract void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation); - - public abstract bool CanUseSecondaryTerm(); - - public abstract bool AllowMainTermToBeRTL(); - - public abstract bool AllowSecondTermToBeRTL(); - - public abstract eTermType GetPrimaryTermType(Localize cmp); - - public abstract eTermType GetSecondaryTermType(Localize cmp); -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTargetDescriptor.cs b/Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTargetDescriptor.cs deleted file mode 100644 index 0b807cd..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ILocalizeTargetDescriptor.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace I2.Loc; - -public abstract class ILocalizeTargetDescriptor -{ - public string Name; - - public int Priority; - - public abstract bool CanLocalize(Localize cmp); - - public abstract ILocalizeTarget CreateTarget(Localize cmp); - - public abstract Type GetTargetType(); -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/IResourceManager_Bundles.cs b/Thronefall_1_57/Thronefall/I2.Loc/IResourceManager_Bundles.cs deleted file mode 100644 index 1ba81a2..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/IResourceManager_Bundles.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using UnityEngine; - -namespace I2.Loc; - -public interface IResourceManager_Bundles -{ - UnityEngine.Object LoadFromBundle(string path, Type assetType); -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/IsolatedArabicLetters.cs b/Thronefall_1_57/Thronefall/I2.Loc/IsolatedArabicLetters.cs deleted file mode 100644 index 93a8938..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/IsolatedArabicLetters.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace I2.Loc; - -internal enum IsolatedArabicLetters -{ - Hamza = 65152, - Alef = 65165, - AlefHamza = 65155, - WawHamza = 65157, - AlefMaksoor = 65159, - AlefMaksora = 64508, - HamzaNabera = 65161, - Ba = 65167, - Ta = 65173, - Tha2 = 65177, - Jeem = 65181, - H7aa = 65185, - Khaa2 = 65189, - Dal = 65193, - Thal = 65195, - Ra2 = 65197, - Zeen = 65199, - Seen = 65201, - Sheen = 65205, - S9a = 65209, - Dha = 65213, - T6a = 65217, - T6ha = 65221, - Ain = 65225, - Gain = 65229, - Fa = 65233, - Gaf = 65237, - Kaf = 65241, - Lam = 65245, - Meem = 65249, - Noon = 65253, - Ha = 65257, - Waw = 65261, - Ya = 65265, - AlefMad = 65153, - TaMarboota = 65171, - PersianPe = 64342, - PersianChe = 64378, - PersianZe = 64394, - PersianGaf = 64402, - PersianGaf2 = 64398 -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LanguageData.cs b/Thronefall_1_57/Thronefall/I2.Loc/LanguageData.cs deleted file mode 100644 index 566d28a..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LanguageData.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; - -namespace I2.Loc; - -[Serializable] -public class LanguageData -{ - public string Name; - - public string Code; - - public byte Flags; - - [NonSerialized] - public bool Compressed; - - public bool IsEnabled() - { - return (Flags & 1) == 0; - } - - public void SetEnabled(bool bEnabled) - { - if (bEnabled) - { - Flags = (byte)(Flags & 0xFFFFFFFEu); - } - else - { - Flags |= 1; - } - } - - public bool IsLoaded() - { - return (Flags & 4) == 0; - } - - public bool CanBeUnloaded() - { - return (Flags & 2) == 0; - } - - public void SetLoaded(bool loaded) - { - if (loaded) - { - Flags = (byte)(Flags & 0xFFFFFFFBu); - } - else - { - Flags |= 4; - } - } - - public void SetCanBeUnLoaded(bool allowUnloading) - { - if (allowUnloading) - { - Flags = (byte)(Flags & 0xFFFFFFFDu); - } - else - { - Flags |= 2; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LanguageSource.cs b/Thronefall_1_57/Thronefall/I2.Loc/LanguageSource.cs deleted file mode 100644 index 15023e7..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LanguageSource.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/Source")] -[ExecuteInEditMode] -public class LanguageSource : MonoBehaviour, ISerializationCallbackReceiver, ILanguageSource -{ - public delegate void fnOnSourceUpdated(LanguageSourceData source, bool ReceivedNewData, string errorMsg); - - public LanguageSourceData mSource = new LanguageSourceData(); - - public int version; - - public bool NeverDestroy; - - public bool UserAgreesToHaveItOnTheScene; - - public bool UserAgreesToHaveItInsideThePluginsFolder; - - public bool GoogleLiveSyncIsUptoDate = true; - - public List Assets = new List(); - - public string Google_WebServiceURL; - - public string Google_SpreadsheetKey; - - public string Google_SpreadsheetName; - - public string Google_LastUpdatedVersion; - - public LanguageSourceData.eGoogleUpdateFrequency GoogleUpdateFrequency = LanguageSourceData.eGoogleUpdateFrequency.Weekly; - - public float GoogleUpdateDelay = 5f; - - public List mLanguages = new List(); - - public bool IgnoreDeviceLanguage; - - public LanguageSourceData.eAllowUnloadLanguages _AllowUnloadingLanguages; - - public List mTerms = new List(); - - public bool CaseInsensitiveTerms; - - public LanguageSourceData.MissingTranslationAction OnMissingTranslation = LanguageSourceData.MissingTranslationAction.Fallback; - - public string mTerm_AppName; - - public LanguageSourceData SourceData - { - get - { - return mSource; - } - set - { - mSource = value; - } - } - - public event fnOnSourceUpdated Event_OnSourceUpdateFromGoogle; - - private void Awake() - { - mSource.owner = this; - mSource.Awake(); - } - - private void OnDestroy() - { - NeverDestroy = false; - if (!NeverDestroy) - { - mSource.OnDestroy(); - } - } - - public string GetSourceName() - { - string text = base.gameObject.name; - Transform parent = base.transform.parent; - while ((bool)parent) - { - text = parent.name + "_" + text; - parent = parent.parent; - } - return text; - } - - public void OnBeforeSerialize() - { - version = 1; - } - - public void OnAfterDeserialize() - { - if (version != 0 && mSource != null) - { - return; - } - mSource = new LanguageSourceData(); - mSource.owner = this; - mSource.UserAgreesToHaveItOnTheScene = UserAgreesToHaveItOnTheScene; - mSource.UserAgreesToHaveItInsideThePluginsFolder = UserAgreesToHaveItInsideThePluginsFolder; - mSource.IgnoreDeviceLanguage = IgnoreDeviceLanguage; - mSource._AllowUnloadingLanguages = _AllowUnloadingLanguages; - mSource.CaseInsensitiveTerms = CaseInsensitiveTerms; - mSource.OnMissingTranslation = OnMissingTranslation; - mSource.mTerm_AppName = mTerm_AppName; - mSource.GoogleLiveSyncIsUptoDate = GoogleLiveSyncIsUptoDate; - mSource.Google_WebServiceURL = Google_WebServiceURL; - mSource.Google_SpreadsheetKey = Google_SpreadsheetKey; - mSource.Google_SpreadsheetName = Google_SpreadsheetName; - mSource.Google_LastUpdatedVersion = Google_LastUpdatedVersion; - mSource.GoogleUpdateFrequency = GoogleUpdateFrequency; - mSource.GoogleUpdateDelay = GoogleUpdateDelay; - mSource.Event_OnSourceUpdateFromGoogle += this.Event_OnSourceUpdateFromGoogle; - if (mLanguages != null && mLanguages.Count > 0) - { - mSource.mLanguages.Clear(); - mSource.mLanguages.AddRange(mLanguages); - mLanguages.Clear(); - } - if (Assets != null && Assets.Count > 0) - { - mSource.Assets.Clear(); - mSource.Assets.AddRange(Assets); - Assets.Clear(); - } - if (mTerms != null && mTerms.Count > 0) - { - mSource.mTerms.Clear(); - for (int i = 0; i < mTerms.Count; i++) - { - mSource.mTerms.Add(mTerms[i]); - } - mTerms.Clear(); - } - version = 1; - this.Event_OnSourceUpdateFromGoogle = null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceAsset.cs b/Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceAsset.cs deleted file mode 100644 index 5c4e9b6..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceAsset.cs +++ /dev/null @@ -1,21 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -[CreateAssetMenu(fileName = "I2Languages", menuName = "I2 Localization/LanguageSource", order = 1)] -public class LanguageSourceAsset : ScriptableObject, ILanguageSource -{ - public LanguageSourceData mSource = new LanguageSourceData(); - - public LanguageSourceData SourceData - { - get - { - return mSource; - } - set - { - mSource = value; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceData.cs b/Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceData.cs deleted file mode 100644 index 47646f7..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LanguageSourceData.cs +++ /dev/null @@ -1,1661 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; -using UnityEngine.Networking; -using UnityEngine.SceneManagement; - -namespace I2.Loc; - -[Serializable] -[ExecuteInEditMode] -public class LanguageSourceData -{ - public enum MissingTranslationAction - { - Empty, - Fallback, - ShowWarning, - ShowTerm - } - - public enum eAllowUnloadLanguages - { - Never, - OnlyInDevice, - EditorAndDevice - } - - public enum eGoogleUpdateFrequency - { - Always, - Never, - Daily, - Weekly, - Monthly, - OnlyOnce, - EveryOtherDay - } - - public enum eGoogleUpdateSynchronization - { - Manual, - OnSceneLoaded, - AsSoonAsDownloaded - } - - [NonSerialized] - public ILanguageSource owner; - - public bool UserAgreesToHaveItOnTheScene; - - public bool UserAgreesToHaveItInsideThePluginsFolder; - - public bool GoogleLiveSyncIsUptoDate = true; - - [NonSerialized] - public bool mIsGlobalSource; - - public List mTerms = new List(); - - public bool CaseInsensitiveTerms; - - [NonSerialized] - public Dictionary mDictionary = new Dictionary(StringComparer.Ordinal); - - public MissingTranslationAction OnMissingTranslation = MissingTranslationAction.Fallback; - - public string mTerm_AppName; - - public List mLanguages = new List(); - - public bool IgnoreDeviceLanguage; - - public eAllowUnloadLanguages _AllowUnloadingLanguages; - - public string Google_WebServiceURL; - - public string Google_SpreadsheetKey; - - public string Google_SpreadsheetName; - - public string Google_LastUpdatedVersion; - - public eGoogleUpdateFrequency GoogleUpdateFrequency = eGoogleUpdateFrequency.Weekly; - - public eGoogleUpdateFrequency GoogleInEditorCheckFrequency = eGoogleUpdateFrequency.Daily; - - public eGoogleUpdateSynchronization GoogleUpdateSynchronization = eGoogleUpdateSynchronization.OnSceneLoaded; - - public float GoogleUpdateDelay; - - public List Assets = new List(); - - [NonSerialized] - public Dictionary mAssetDictionary = new Dictionary(StringComparer.Ordinal); - - private string mDelayedGoogleData; - - public static string EmptyCategory = "Default"; - - public static char[] CategorySeparators = "/\\".ToCharArray(); - - public UnityEngine.Object ownerObject => owner as UnityEngine.Object; - - public event LanguageSource.fnOnSourceUpdated Event_OnSourceUpdateFromGoogle; - - public void Awake() - { - LocalizationManager.AddSource(this); - UpdateDictionary(); - UpdateAssetDictionary(); - LocalizationManager.LocalizeAll(Force: true); - } - - public void OnDestroy() - { - LocalizationManager.RemoveSource(this); - } - - public bool IsEqualTo(LanguageSourceData Source) - { - if (Source.mLanguages.Count != mLanguages.Count) - { - return false; - } - int i = 0; - for (int count = mLanguages.Count; i < count; i++) - { - if (Source.GetLanguageIndex(mLanguages[i].Name) < 0) - { - return false; - } - } - if (Source.mTerms.Count != mTerms.Count) - { - return false; - } - for (int j = 0; j < mTerms.Count; j++) - { - if (Source.GetTermData(mTerms[j].Term) == null) - { - return false; - } - } - return true; - } - - internal bool ManagerHasASimilarSource() - { - int i = 0; - for (int count = LocalizationManager.Sources.Count; i < count; i++) - { - LanguageSourceData languageSourceData = LocalizationManager.Sources[i]; - if (languageSourceData != null && languageSourceData.IsEqualTo(this) && languageSourceData != this) - { - return true; - } - } - return false; - } - - public void ClearAllData() - { - mTerms.Clear(); - mLanguages.Clear(); - mDictionary.Clear(); - mAssetDictionary.Clear(); - } - - public bool IsGlobalSource() - { - return mIsGlobalSource; - } - - public void Editor_SetDirty() - { - } - - public void UpdateAssetDictionary() - { - Assets.RemoveAll((UnityEngine.Object x) => x == null); - mAssetDictionary = Assets.Distinct().GroupBy((UnityEngine.Object o) => o.name, StringComparer.Ordinal).ToDictionary((IGrouping g) => g.Key, (IGrouping g) => g.First(), StringComparer.Ordinal); - } - - public UnityEngine.Object FindAsset(string Name) - { - if (Assets != null) - { - if (mAssetDictionary == null || mAssetDictionary.Count != Assets.Count) - { - UpdateAssetDictionary(); - } - if (mAssetDictionary.TryGetValue(Name, out var value)) - { - return value; - } - } - return null; - } - - public bool HasAsset(UnityEngine.Object Obj) - { - return Assets.Contains(Obj); - } - - public void AddAsset(UnityEngine.Object Obj) - { - if (!Assets.Contains(Obj)) - { - Assets.Add(Obj); - UpdateAssetDictionary(); - } - } - - private string Export_Language_to_Cache(int langIndex, bool fillTermWithFallback) - { - if (!mLanguages[langIndex].IsLoaded()) - { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - for (int i = 0; i < mTerms.Count; i++) - { - if (i > 0) - { - stringBuilder.Append("[i2t]"); - } - TermData termData = mTerms[i]; - stringBuilder.Append(termData.Term); - stringBuilder.Append("="); - string Translation = termData.Languages[langIndex]; - if (OnMissingTranslation == MissingTranslationAction.Fallback && string.IsNullOrEmpty(Translation) && TryGetFallbackTranslation(termData, out Translation, langIndex, null, skipDisabled: true)) - { - stringBuilder.Append("[i2fb]"); - if (fillTermWithFallback) - { - termData.Languages[langIndex] = Translation; - } - } - if (!string.IsNullOrEmpty(Translation)) - { - stringBuilder.Append(Translation); - } - } - return stringBuilder.ToString(); - } - - public string Export_I2CSV(string Category, char Separator = ',', bool specializationsAsRows = true) - { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.Append("Key[*]Type[*]Desc"); - foreach (LanguageData mLanguage in mLanguages) - { - stringBuilder.Append("[*]"); - if (!mLanguage.IsEnabled()) - { - stringBuilder.Append('$'); - } - stringBuilder.Append(GoogleLanguages.GetCodedLanguage(mLanguage.Name, mLanguage.Code)); - } - stringBuilder.Append("[ln]"); - mTerms.Sort((TermData a, TermData b) => string.CompareOrdinal(a.Term, b.Term)); - int count = mLanguages.Count; - bool flag = true; - foreach (TermData mTerm in mTerms) - { - string term; - if (string.IsNullOrEmpty(Category) || (Category == EmptyCategory && mTerm.Term.IndexOfAny(CategorySeparators) < 0)) - { - term = mTerm.Term; - } - else - { - if (!mTerm.Term.StartsWith(Category + "/", StringComparison.Ordinal) || !(Category != mTerm.Term)) - { - continue; - } - term = mTerm.Term.Substring(Category.Length + 1); - } - if (!flag) - { - stringBuilder.Append("[ln]"); - } - flag = false; - if (!specializationsAsRows) - { - AppendI2Term(stringBuilder, count, term, mTerm, Separator, null); - continue; - } - List allSpecializations = mTerm.GetAllSpecializations(); - for (int i = 0; i < allSpecializations.Count; i++) - { - if (i != 0) - { - stringBuilder.Append("[ln]"); - } - string forceSpecialization = allSpecializations[i]; - AppendI2Term(stringBuilder, count, term, mTerm, Separator, forceSpecialization); - } - } - return stringBuilder.ToString(); - } - - private static void AppendI2Term(StringBuilder Builder, int nLanguages, string Term, TermData termData, char Separator, string forceSpecialization) - { - AppendI2Text(Builder, Term); - if (!string.IsNullOrEmpty(forceSpecialization) && forceSpecialization != "Any") - { - Builder.Append("["); - Builder.Append(forceSpecialization); - Builder.Append("]"); - } - Builder.Append("[*]"); - Builder.Append(termData.TermType.ToString()); - Builder.Append("[*]"); - Builder.Append(termData.Description); - for (int i = 0; i < Mathf.Min(nLanguages, termData.Languages.Length); i++) - { - Builder.Append("[*]"); - string text = termData.Languages[i]; - if (!string.IsNullOrEmpty(forceSpecialization)) - { - text = termData.GetTranslation(i, forceSpecialization); - } - AppendI2Text(Builder, text); - } - } - - private static void AppendI2Text(StringBuilder Builder, string text) - { - if (!string.IsNullOrEmpty(text)) - { - if (text.StartsWith("'", StringComparison.Ordinal) || text.StartsWith("=", StringComparison.Ordinal)) - { - Builder.Append('\''); - } - Builder.Append(text); - } - } - - public string Export_CSV(string Category, char Separator = ',', bool specializationsAsRows = true) - { - StringBuilder stringBuilder = new StringBuilder(); - int count = mLanguages.Count; - stringBuilder.AppendFormat("Key{0}Type{0}Desc", Separator); - foreach (LanguageData mLanguage in mLanguages) - { - stringBuilder.Append(Separator); - if (!mLanguage.IsEnabled()) - { - stringBuilder.Append('$'); - } - AppendString(stringBuilder, GoogleLanguages.GetCodedLanguage(mLanguage.Name, mLanguage.Code), Separator); - } - stringBuilder.Append("\n"); - mTerms.Sort((TermData a, TermData b) => string.CompareOrdinal(a.Term, b.Term)); - foreach (TermData mTerm in mTerms) - { - string term; - if (string.IsNullOrEmpty(Category) || (Category == EmptyCategory && mTerm.Term.IndexOfAny(CategorySeparators) < 0)) - { - term = mTerm.Term; - } - else - { - if (!mTerm.Term.StartsWith(Category + "/", StringComparison.Ordinal) || !(Category != mTerm.Term)) - { - continue; - } - term = mTerm.Term.Substring(Category.Length + 1); - } - if (specializationsAsRows) - { - foreach (string allSpecialization in mTerm.GetAllSpecializations()) - { - AppendTerm(stringBuilder, count, term, mTerm, allSpecialization, Separator); - } - } - else - { - AppendTerm(stringBuilder, count, term, mTerm, null, Separator); - } - } - return stringBuilder.ToString(); - } - - private static void AppendTerm(StringBuilder Builder, int nLanguages, string Term, TermData termData, string specialization, char Separator) - { - AppendString(Builder, Term, Separator); - if (!string.IsNullOrEmpty(specialization) && specialization != "Any") - { - Builder.AppendFormat("[{0}]", specialization); - } - Builder.Append(Separator); - Builder.Append(termData.TermType.ToString()); - Builder.Append(Separator); - AppendString(Builder, termData.Description, Separator); - for (int i = 0; i < Mathf.Min(nLanguages, termData.Languages.Length); i++) - { - Builder.Append(Separator); - string text = termData.Languages[i]; - if (!string.IsNullOrEmpty(specialization)) - { - text = termData.GetTranslation(i, specialization); - } - AppendTranslation(Builder, text, Separator, null); - } - Builder.Append("\n"); - } - - private static void AppendString(StringBuilder Builder, string Text, char Separator) - { - if (!string.IsNullOrEmpty(Text)) - { - Text = Text.Replace("\\n", "\n"); - if (Text.IndexOfAny((Separator + "\n\"").ToCharArray()) >= 0) - { - Text = Text.Replace("\"", "\"\""); - Builder.AppendFormat("\"{0}\"", Text); - } - else - { - Builder.Append(Text); - } - } - } - - private static void AppendTranslation(StringBuilder Builder, string Text, char Separator, string tags) - { - if (!string.IsNullOrEmpty(Text)) - { - Text = Text.Replace("\\n", "\n"); - if (Text.IndexOfAny((Separator + "\n\"").ToCharArray()) >= 0) - { - Text = Text.Replace("\"", "\"\""); - Builder.AppendFormat("\"{0}{1}\"", tags, Text); - } - else - { - Builder.Append(tags); - Builder.Append(Text); - } - } - } - - public UnityWebRequest Export_Google_CreateWWWcall(eSpreadsheetUpdateMode UpdateMode = eSpreadsheetUpdateMode.Replace) - { - string value = Export_Google_CreateData(); - WWWForm wWWForm = new WWWForm(); - wWWForm.AddField("key", Google_SpreadsheetKey); - wWWForm.AddField("action", "SetLanguageSource"); - wWWForm.AddField("data", value); - wWWForm.AddField("updateMode", UpdateMode.ToString()); - UnityWebRequest unityWebRequest = UnityWebRequest.Post(LocalizationManager.GetWebServiceURL(this), wWWForm); - I2Utils.SendWebRequest(unityWebRequest); - return unityWebRequest; - } - - private string Export_Google_CreateData() - { - List categories = GetCategories(OnlyMainCategory: true); - StringBuilder stringBuilder = new StringBuilder(); - bool flag = true; - foreach (string item in categories) - { - if (flag) - { - flag = false; - } - else - { - stringBuilder.Append(""); - } - bool specializationsAsRows = true; - string value = Export_I2CSV(item, ',', specializationsAsRows); - stringBuilder.Append(item); - stringBuilder.Append(""); - stringBuilder.Append(value); - } - return stringBuilder.ToString(); - } - - public string Import_CSV(string Category, string CSVstring, eSpreadsheetUpdateMode UpdateMode = eSpreadsheetUpdateMode.Replace, char Separator = ',') - { - List cSV = LocalizationReader.ReadCSV(CSVstring, Separator); - return Import_CSV(Category, cSV, UpdateMode); - } - - public string Import_I2CSV(string Category, string I2CSVstring, eSpreadsheetUpdateMode UpdateMode = eSpreadsheetUpdateMode.Replace) - { - List cSV = LocalizationReader.ReadI2CSV(I2CSVstring); - return Import_CSV(Category, cSV, UpdateMode); - } - - public string Import_CSV(string Category, List CSV, eSpreadsheetUpdateMode UpdateMode = eSpreadsheetUpdateMode.Replace) - { - string[] array = CSV[0]; - int num = 1; - int num2 = -1; - int num3 = -1; - string[] texts = new string[1] { "Key" }; - string[] texts2 = new string[1] { "Type" }; - string[] texts3 = new string[2] { "Desc", "Description" }; - if (array.Length > 1 && ArrayContains(array[0], texts)) - { - if (UpdateMode == eSpreadsheetUpdateMode.Replace) - { - ClearAllData(); - } - if (array.Length > 2) - { - if (ArrayContains(array[1], texts2)) - { - num2 = 1; - num = 2; - } - if (ArrayContains(array[1], texts3)) - { - num3 = 1; - num = 2; - } - } - if (array.Length > 3) - { - if (ArrayContains(array[2], texts2)) - { - num2 = 2; - num = 3; - } - if (ArrayContains(array[2], texts3)) - { - num3 = 2; - num = 3; - } - } - int num4 = Mathf.Max(array.Length - num, 0); - int[] array2 = new int[num4]; - for (int i = 0; i < num4; i++) - { - if (string.IsNullOrEmpty(array[i + num])) - { - array2[i] = -1; - continue; - } - string text = array[i + num]; - bool flag = true; - if (text.StartsWith("$", StringComparison.Ordinal)) - { - flag = false; - text = text.Substring(1); - } - GoogleLanguages.UnPackCodeFromLanguageName(text, out var Language, out var code); - int num5 = -1; - num5 = (string.IsNullOrEmpty(code) ? GetLanguageIndex(Language, AllowDiscartingRegion: true, SkipDisabled: false) : GetLanguageIndexFromCode(code)); - if (num5 < 0) - { - LanguageData languageData = new LanguageData(); - languageData.Name = Language; - languageData.Code = code; - languageData.Flags = (byte)(0u | ((!flag) ? 1u : 0u)); - mLanguages.Add(languageData); - num5 = mLanguages.Count - 1; - } - array2[i] = num5; - } - num4 = mLanguages.Count; - int j = 0; - for (int count = mTerms.Count; j < count; j++) - { - TermData termData = mTerms[j]; - if (termData.Languages.Length < num4) - { - Array.Resize(ref termData.Languages, num4); - Array.Resize(ref termData.Flags, num4); - } - } - int k = 1; - for (int count2 = CSV.Count; k < count2; k++) - { - array = CSV[k]; - string Term = (string.IsNullOrEmpty(Category) ? array[0] : (Category + "/" + array[0])); - string text2 = null; - if (Term.EndsWith("]", StringComparison.Ordinal)) - { - int num6 = Term.LastIndexOf('['); - if (num6 > 0) - { - text2 = Term.Substring(num6 + 1, Term.Length - num6 - 2); - if (text2 == "touch") - { - text2 = "Touch"; - } - Term = Term.Remove(num6); - } - } - ValidateFullTerm(ref Term); - if (string.IsNullOrEmpty(Term)) - { - continue; - } - TermData termData2 = GetTermData(Term); - if (termData2 == null) - { - termData2 = new TermData(); - termData2.Term = Term; - termData2.Languages = new string[mLanguages.Count]; - termData2.Flags = new byte[mLanguages.Count]; - for (int l = 0; l < mLanguages.Count; l++) - { - termData2.Languages[l] = string.Empty; - } - mTerms.Add(termData2); - mDictionary.Add(Term, termData2); - } - else if (UpdateMode == eSpreadsheetUpdateMode.AddNewTerms) - { - continue; - } - if (num2 > 0) - { - termData2.TermType = GetTermType(array[num2]); - } - if (num3 > 0) - { - termData2.Description = array[num3]; - } - for (int m = 0; m < array2.Length && m < array.Length - num; m++) - { - if (string.IsNullOrEmpty(array[m + num])) - { - continue; - } - int num7 = array2[m]; - if (num7 >= 0) - { - string text3 = array[m + num]; - if (text3 == "-") - { - text3 = string.Empty; - } - else if (text3 == "") - { - text3 = null; - } - termData2.SetTranslation(num7, text3, text2); - } - } - } - if (Application.isPlaying) - { - SaveLanguages(HasUnloadedLanguages()); - } - return string.Empty; - } - return "Bad Spreadsheet Format.\nFirst columns should be 'Key', 'Type' and 'Desc'"; - } - - private bool ArrayContains(string MainText, params string[] texts) - { - int i = 0; - for (int num = texts.Length; i < num; i++) - { - if (MainText.IndexOf(texts[i], StringComparison.OrdinalIgnoreCase) >= 0) - { - return true; - } - } - return false; - } - - public static eTermType GetTermType(string type) - { - int i = 0; - for (int num = 10; i <= num; i++) - { - eTermType eTermType2 = (eTermType)i; - if (string.Equals(eTermType2.ToString(), type, StringComparison.OrdinalIgnoreCase)) - { - return (eTermType)i; - } - } - return eTermType.Text; - } - - private void Import_Language_from_Cache(int langIndex, string langData, bool useFallback, bool onlyCurrentSpecialization) - { - int num = 0; - while (num < langData.Length) - { - int num2 = langData.IndexOf("[i2t]", num, StringComparison.Ordinal); - if (num2 < 0) - { - num2 = langData.Length; - } - int num3 = langData.IndexOf("=", num, StringComparison.Ordinal); - if (num3 >= num2) - { - break; - } - string term = langData.Substring(num, num3 - num); - num = num3 + 1; - TermData termData = GetTermData(term); - if (termData != null) - { - string text = null; - if (num != num2) - { - text = langData.Substring(num, num2 - num); - if (text.StartsWith("[i2fb]", StringComparison.Ordinal)) - { - text = (useFallback ? text.Substring(6) : null); - } - if (onlyCurrentSpecialization && text != null) - { - text = SpecializationManager.GetSpecializedText(text); - } - } - termData.Languages[langIndex] = text; - } - num = num2 + 5; - } - } - - public static void FreeUnusedLanguages() - { - LanguageSourceData languageSourceData = LocalizationManager.Sources[0]; - int languageIndex = languageSourceData.GetLanguageIndex(LocalizationManager.CurrentLanguage); - for (int i = 0; i < languageSourceData.mTerms.Count; i++) - { - TermData termData = languageSourceData.mTerms[i]; - for (int j = 0; j < termData.Languages.Length; j++) - { - if (j != languageIndex) - { - termData.Languages[j] = null; - } - } - } - } - - public void Import_Google_FromCache() - { - if (GoogleUpdateFrequency == eGoogleUpdateFrequency.Never || !I2Utils.IsPlaying()) - { - return; - } - string sourcePlayerPrefName = GetSourcePlayerPrefName(); - string text = PersistentStorage.LoadFile(PersistentStorage.eFileType.Persistent, "I2Source_" + sourcePlayerPrefName + ".loc", logExceptions: false); - if (string.IsNullOrEmpty(text)) - { - return; - } - if (text.StartsWith("[i2e]", StringComparison.Ordinal)) - { - text = StringObfucator.Decode(text.Substring(5, text.Length - 5)); - } - bool flag = false; - string text2 = Google_LastUpdatedVersion; - if (PersistentStorage.HasSetting("I2SourceVersion_" + sourcePlayerPrefName)) - { - text2 = PersistentStorage.GetSetting_String("I2SourceVersion_" + sourcePlayerPrefName, Google_LastUpdatedVersion); - flag = IsNewerVersion(Google_LastUpdatedVersion, text2); - } - if (!flag) - { - PersistentStorage.DeleteFile(PersistentStorage.eFileType.Persistent, "I2Source_" + sourcePlayerPrefName + ".loc", logExceptions: false); - PersistentStorage.DeleteSetting("I2SourceVersion_" + sourcePlayerPrefName); - return; - } - if (text2.Length > 19) - { - text2 = string.Empty; - } - Google_LastUpdatedVersion = text2; - Import_Google_Result(text, eSpreadsheetUpdateMode.Replace); - } - - private bool IsNewerVersion(string currentVersion, string newVersion) - { - if (string.IsNullOrEmpty(newVersion)) - { - return false; - } - if (string.IsNullOrEmpty(currentVersion)) - { - return true; - } - if (!long.TryParse(newVersion, out var result) || !long.TryParse(currentVersion, out var result2)) - { - return true; - } - return result > result2; - } - - public void Import_Google(bool ForceUpdate, bool justCheck) - { - if ((!ForceUpdate && GoogleUpdateFrequency == eGoogleUpdateFrequency.Never) || !I2Utils.IsPlaying()) - { - return; - } - eGoogleUpdateFrequency googleUpdateFrequency = GoogleUpdateFrequency; - string sourcePlayerPrefName = GetSourcePlayerPrefName(); - if (!ForceUpdate && googleUpdateFrequency != 0) - { - string setting_String = PersistentStorage.GetSetting_String("LastGoogleUpdate_" + sourcePlayerPrefName, ""); - try - { - if (DateTime.TryParse(setting_String, out var result)) - { - double totalDays = (DateTime.Now - result).TotalDays; - switch (googleUpdateFrequency) - { - case eGoogleUpdateFrequency.Daily: - if (totalDays < 1.0) - { - return; - } - break; - case eGoogleUpdateFrequency.Weekly: - if (totalDays < 8.0) - { - return; - } - break; - case eGoogleUpdateFrequency.Monthly: - if (totalDays < 31.0) - { - return; - } - break; - case eGoogleUpdateFrequency.OnlyOnce: - return; - case eGoogleUpdateFrequency.EveryOtherDay: - if (totalDays < 2.0) - { - return; - } - break; - } - } - } - catch (Exception) - { - } - } - PersistentStorage.SetSetting_String("LastGoogleUpdate_" + sourcePlayerPrefName, DateTime.Now.ToString()); - CoroutineManager.Start(Import_Google_Coroutine(ForceUpdate, justCheck)); - } - - private string GetSourcePlayerPrefName() - { - if (owner == null) - { - return null; - } - string text = (owner as UnityEngine.Object).name; - if (!string.IsNullOrEmpty(Google_SpreadsheetKey)) - { - text += Google_SpreadsheetKey; - } - if (Array.IndexOf(LocalizationManager.GlobalSources, (owner as UnityEngine.Object).name) >= 0) - { - return text; - } - return SceneManager.GetActiveScene().name + "_" + text; - } - - private IEnumerator Import_Google_Coroutine(bool forceUpdate, bool JustCheck) - { - UnityWebRequest www = Import_Google_CreateWWWcall(forceUpdate, JustCheck); - if (www == null) - { - yield break; - } - while (!www.isDone) - { - yield return null; - } - byte[] data = www.downloadHandler.data; - if (string.IsNullOrEmpty(www.error) && data != null) - { - string @string = Encoding.UTF8.GetString(data, 0, data.Length); - bool flag = string.IsNullOrEmpty(@string) || @string == "\"\""; - if (JustCheck) - { - if (!flag) - { - Debug.LogWarning("Spreadsheet is not up-to-date and Google Live Synchronization is enabled\nWhen playing in the device the Spreadsheet will be downloaded and translations may not behave as what you see in the editor.\nTo fix this, Import or Export replace to Google"); - GoogleLiveSyncIsUptoDate = false; - } - yield break; - } - if (!flag) - { - mDelayedGoogleData = @string; - switch (GoogleUpdateSynchronization) - { - case eGoogleUpdateSynchronization.AsSoonAsDownloaded: - ApplyDownloadedDataFromGoogle(); - break; - case eGoogleUpdateSynchronization.OnSceneLoaded: - SceneManager.sceneLoaded += ApplyDownloadedDataOnSceneLoaded; - break; - } - yield break; - } - } - if (this.Event_OnSourceUpdateFromGoogle != null) - { - this.Event_OnSourceUpdateFromGoogle(this, ReceivedNewData: false, www.error); - } - Debug.Log("Language Source was up-to-date with Google Spreadsheet"); - } - - private void ApplyDownloadedDataOnSceneLoaded(Scene scene, LoadSceneMode mode) - { - SceneManager.sceneLoaded -= ApplyDownloadedDataOnSceneLoaded; - ApplyDownloadedDataFromGoogle(); - } - - public void ApplyDownloadedDataFromGoogle() - { - if (string.IsNullOrEmpty(mDelayedGoogleData)) - { - return; - } - if (string.IsNullOrEmpty(Import_Google_Result(mDelayedGoogleData, eSpreadsheetUpdateMode.Replace, saveInPlayerPrefs: true))) - { - if (this.Event_OnSourceUpdateFromGoogle != null) - { - this.Event_OnSourceUpdateFromGoogle(this, ReceivedNewData: true, ""); - } - LocalizationManager.LocalizeAll(Force: true); - Debug.Log("Done Google Sync"); - } - else - { - if (this.Event_OnSourceUpdateFromGoogle != null) - { - this.Event_OnSourceUpdateFromGoogle(this, ReceivedNewData: false, ""); - } - Debug.Log("Done Google Sync: source was up-to-date"); - } - } - - public UnityWebRequest Import_Google_CreateWWWcall(bool ForceUpdate, bool justCheck) - { - if (!HasGoogleSpreadsheet()) - { - return null; - } - string text = PersistentStorage.GetSetting_String("I2SourceVersion_" + GetSourcePlayerPrefName(), Google_LastUpdatedVersion); - if (text.Length > 19) - { - text = string.Empty; - } - if (IsNewerVersion(text, Google_LastUpdatedVersion)) - { - Google_LastUpdatedVersion = text; - } - UnityWebRequest unityWebRequest = UnityWebRequest.Get(string.Format("{0}?key={1}&action=GetLanguageSource&version={2}", LocalizationManager.GetWebServiceURL(this), Google_SpreadsheetKey, ForceUpdate ? "0" : Google_LastUpdatedVersion)); - I2Utils.SendWebRequest(unityWebRequest); - return unityWebRequest; - } - - public bool HasGoogleSpreadsheet() - { - if (!string.IsNullOrEmpty(Google_WebServiceURL) && !string.IsNullOrEmpty(Google_SpreadsheetKey)) - { - return !string.IsNullOrEmpty(LocalizationManager.GetWebServiceURL(this)); - } - return false; - } - - public string Import_Google_Result(string JsonString, eSpreadsheetUpdateMode UpdateMode, bool saveInPlayerPrefs = false) - { - try - { - string empty = string.Empty; - if (string.IsNullOrEmpty(JsonString) || JsonString == "\"\"") - { - return empty; - } - int num = JsonString.IndexOf("version=", StringComparison.Ordinal); - int num2 = JsonString.IndexOf("script_version=", StringComparison.Ordinal); - if (num < 0 || num2 < 0) - { - return "Invalid Response from Google, Most likely the WebService needs to be updated"; - } - num += "version=".Length; - num2 += "script_version=".Length; - string text = JsonString.Substring(num, JsonString.IndexOf(",", num, StringComparison.Ordinal) - num); - int num3 = int.Parse(JsonString.Substring(num2, JsonString.IndexOf(",", num2, StringComparison.Ordinal) - num2)); - if (text.Length > 19) - { - text = string.Empty; - } - if (num3 != LocalizationManager.GetRequiredWebServiceVersion()) - { - return "The current Google WebService is not supported.\nPlease, delete the WebService from the Google Drive and Install the latest version."; - } - if (saveInPlayerPrefs && !IsNewerVersion(Google_LastUpdatedVersion, text)) - { - return "LanguageSource is up-to-date"; - } - if (saveInPlayerPrefs) - { - string sourcePlayerPrefName = GetSourcePlayerPrefName(); - PersistentStorage.SaveFile(PersistentStorage.eFileType.Persistent, "I2Source_" + sourcePlayerPrefName + ".loc", "[i2e]" + StringObfucator.Encode(JsonString)); - PersistentStorage.SetSetting_String("I2SourceVersion_" + sourcePlayerPrefName, text); - PersistentStorage.ForceSaveSettings(); - } - Google_LastUpdatedVersion = text; - if (UpdateMode == eSpreadsheetUpdateMode.Replace) - { - ClearAllData(); - } - int num4 = JsonString.IndexOf("[i2category]", StringComparison.Ordinal); - while (num4 > 0) - { - num4 += "[i2category]".Length; - int num5 = JsonString.IndexOf("[/i2category]", num4, StringComparison.Ordinal); - string category = JsonString.Substring(num4, num5 - num4); - num5 += "[/i2category]".Length; - int num6 = JsonString.IndexOf("[/i2csv]", num5, StringComparison.Ordinal); - string i2CSVstring = JsonString.Substring(num5, num6 - num5); - num4 = JsonString.IndexOf("[i2category]", num6, StringComparison.Ordinal); - Import_I2CSV(category, i2CSVstring, UpdateMode); - if (UpdateMode == eSpreadsheetUpdateMode.Replace) - { - UpdateMode = eSpreadsheetUpdateMode.Merge; - } - } - GoogleLiveSyncIsUptoDate = true; - if (I2Utils.IsPlaying()) - { - SaveLanguages(unloadAll: true); - } - if (!string.IsNullOrEmpty(empty)) - { - Editor_SetDirty(); - } - return empty; - } - catch (Exception ex) - { - Debug.LogWarning(ex); - return ex.ToString(); - } - } - - public int GetLanguageIndex(string language, bool AllowDiscartingRegion = true, bool SkipDisabled = true) - { - int i = 0; - for (int count = mLanguages.Count; i < count; i++) - { - if ((!SkipDisabled || mLanguages[i].IsEnabled()) && string.Compare(mLanguages[i].Name, language, StringComparison.OrdinalIgnoreCase) == 0) - { - return i; - } - } - if (AllowDiscartingRegion) - { - int num = -1; - int num2 = 0; - int j = 0; - for (int count2 = mLanguages.Count; j < count2; j++) - { - if (!SkipDisabled || mLanguages[j].IsEnabled()) - { - int commonWordInLanguageNames = GetCommonWordInLanguageNames(mLanguages[j].Name, language); - if (commonWordInLanguageNames > num2) - { - num2 = commonWordInLanguageNames; - num = j; - } - } - } - if (num >= 0) - { - return num; - } - } - return -1; - } - - public LanguageData GetLanguageData(string language, bool AllowDiscartingRegion = true) - { - int languageIndex = GetLanguageIndex(language, AllowDiscartingRegion, SkipDisabled: false); - if (languageIndex >= 0) - { - return mLanguages[languageIndex]; - } - return null; - } - - public bool IsCurrentLanguage(int languageIndex) - { - return LocalizationManager.CurrentLanguage == mLanguages[languageIndex].Name; - } - - public int GetLanguageIndexFromCode(string Code, bool exactMatch = true, bool ignoreDisabled = false) - { - int i = 0; - for (int count = mLanguages.Count; i < count; i++) - { - if ((!ignoreDisabled || mLanguages[i].IsEnabled()) && string.Compare(mLanguages[i].Code, Code, StringComparison.OrdinalIgnoreCase) == 0) - { - return i; - } - } - if (!exactMatch) - { - int j = 0; - for (int count2 = mLanguages.Count; j < count2; j++) - { - if ((!ignoreDisabled || mLanguages[j].IsEnabled()) && string.Compare(mLanguages[j].Code, 0, Code, 0, 2, StringComparison.OrdinalIgnoreCase) == 0) - { - return j; - } - } - } - return -1; - } - - public static int GetCommonWordInLanguageNames(string Language1, string Language2) - { - if (string.IsNullOrEmpty(Language1) || string.IsNullOrEmpty(Language2)) - { - return 0; - } - char[] separator = "( )-/\\".ToCharArray(); - string[] array = Language1.ToLower().Split(separator); - string[] array2 = Language2.ToLower().Split(separator); - int num = 0; - string[] array3 = array; - foreach (string value in array3) - { - if (!string.IsNullOrEmpty(value) && array2.Contains(value)) - { - num++; - } - } - array3 = array2; - foreach (string value2 in array3) - { - if (!string.IsNullOrEmpty(value2) && array.Contains(value2)) - { - num++; - } - } - return num; - } - - public static bool AreTheSameLanguage(string Language1, string Language2) - { - Language1 = GetLanguageWithoutRegion(Language1); - Language2 = GetLanguageWithoutRegion(Language2); - return string.Compare(Language1, Language2, StringComparison.OrdinalIgnoreCase) == 0; - } - - public static string GetLanguageWithoutRegion(string Language) - { - int num = Language.IndexOfAny("(/\\[,{".ToCharArray()); - if (num < 0) - { - return Language; - } - return Language.Substring(0, num).Trim(); - } - - public void AddLanguage(string LanguageName) - { - AddLanguage(LanguageName, GoogleLanguages.GetLanguageCode(LanguageName)); - } - - public void AddLanguage(string LanguageName, string LanguageCode) - { - if (GetLanguageIndex(LanguageName, AllowDiscartingRegion: false) < 0) - { - LanguageData languageData = new LanguageData(); - languageData.Name = LanguageName; - languageData.Code = LanguageCode; - mLanguages.Add(languageData); - int count = mLanguages.Count; - int i = 0; - for (int count2 = mTerms.Count; i < count2; i++) - { - Array.Resize(ref mTerms[i].Languages, count); - Array.Resize(ref mTerms[i].Flags, count); - } - Editor_SetDirty(); - } - } - - public void RemoveLanguage(string LanguageName) - { - int languageIndex = GetLanguageIndex(LanguageName, AllowDiscartingRegion: false, SkipDisabled: false); - if (languageIndex < 0) - { - return; - } - int count = mLanguages.Count; - int i = 0; - for (int count2 = mTerms.Count; i < count2; i++) - { - for (int j = languageIndex + 1; j < count; j++) - { - mTerms[i].Languages[j - 1] = mTerms[i].Languages[j]; - mTerms[i].Flags[j - 1] = mTerms[i].Flags[j]; - } - Array.Resize(ref mTerms[i].Languages, count - 1); - Array.Resize(ref mTerms[i].Flags, count - 1); - } - mLanguages.RemoveAt(languageIndex); - Editor_SetDirty(); - } - - public List GetLanguages(bool skipDisabled = true) - { - List list = new List(); - int i = 0; - for (int count = mLanguages.Count; i < count; i++) - { - if (!skipDisabled || mLanguages[i].IsEnabled()) - { - list.Add(mLanguages[i].Name); - } - } - return list; - } - - public List GetLanguagesCode(bool allowRegions = true, bool skipDisabled = true) - { - List list = new List(); - int i = 0; - for (int count = mLanguages.Count; i < count; i++) - { - if (!skipDisabled || mLanguages[i].IsEnabled()) - { - string text = mLanguages[i].Code; - if (!allowRegions && text != null && text.Length > 2) - { - text = text.Substring(0, 2); - } - if (!string.IsNullOrEmpty(text) && !list.Contains(text)) - { - list.Add(text); - } - } - } - return list; - } - - public bool IsLanguageEnabled(string Language) - { - int languageIndex = GetLanguageIndex(Language, AllowDiscartingRegion: false); - if (languageIndex >= 0) - { - return mLanguages[languageIndex].IsEnabled(); - } - return false; - } - - public void EnableLanguage(string Language, bool bEnabled) - { - int languageIndex = GetLanguageIndex(Language, AllowDiscartingRegion: false, SkipDisabled: false); - if (languageIndex >= 0) - { - mLanguages[languageIndex].SetEnabled(bEnabled); - } - } - - public bool AllowUnloadingLanguages() - { - return _AllowUnloadingLanguages != eAllowUnloadLanguages.Never; - } - - private string GetSavedLanguageFileName(int languageIndex) - { - if (languageIndex < 0) - { - return null; - } - return "LangSource_" + GetSourcePlayerPrefName() + "_" + mLanguages[languageIndex].Name + ".loc"; - } - - public void LoadLanguage(int languageIndex, bool UnloadOtherLanguages, bool useFallback, bool onlyCurrentSpecialization, bool forceLoad) - { - if (!AllowUnloadingLanguages() || !PersistentStorage.CanAccessFiles()) - { - return; - } - if (languageIndex >= 0 && (forceLoad || !mLanguages[languageIndex].IsLoaded())) - { - string savedLanguageFileName = GetSavedLanguageFileName(languageIndex); - string text = PersistentStorage.LoadFile(PersistentStorage.eFileType.Temporal, savedLanguageFileName, logExceptions: false); - if (!string.IsNullOrEmpty(text)) - { - Import_Language_from_Cache(languageIndex, text, useFallback, onlyCurrentSpecialization); - mLanguages[languageIndex].SetLoaded(loaded: true); - } - } - if (!UnloadOtherLanguages || !I2Utils.IsPlaying()) - { - return; - } - for (int i = 0; i < mLanguages.Count; i++) - { - if (i != languageIndex) - { - UnloadLanguage(i); - } - } - } - - public void LoadAllLanguages(bool forceLoad = false) - { - for (int i = 0; i < mLanguages.Count; i++) - { - LoadLanguage(i, UnloadOtherLanguages: false, useFallback: false, onlyCurrentSpecialization: false, forceLoad); - } - } - - public void UnloadLanguage(int languageIndex) - { - if (!AllowUnloadingLanguages() || !PersistentStorage.CanAccessFiles() || !I2Utils.IsPlaying() || !mLanguages[languageIndex].IsLoaded() || !mLanguages[languageIndex].CanBeUnloaded() || IsCurrentLanguage(languageIndex) || !PersistentStorage.HasFile(PersistentStorage.eFileType.Temporal, GetSavedLanguageFileName(languageIndex))) - { - return; - } - foreach (TermData mTerm in mTerms) - { - mTerm.Languages[languageIndex] = null; - } - mLanguages[languageIndex].SetLoaded(loaded: false); - } - - public void SaveLanguages(bool unloadAll, PersistentStorage.eFileType fileLocation = PersistentStorage.eFileType.Temporal) - { - if (!AllowUnloadingLanguages() || !PersistentStorage.CanAccessFiles()) - { - return; - } - for (int i = 0; i < mLanguages.Count; i++) - { - string text = Export_Language_to_Cache(i, IsCurrentLanguage(i)); - if (!string.IsNullOrEmpty(text)) - { - PersistentStorage.SaveFile(PersistentStorage.eFileType.Temporal, GetSavedLanguageFileName(i), text); - } - } - if (!unloadAll) - { - return; - } - for (int j = 0; j < mLanguages.Count; j++) - { - if (unloadAll && !IsCurrentLanguage(j)) - { - UnloadLanguage(j); - } - } - } - - public bool HasUnloadedLanguages() - { - for (int i = 0; i < mLanguages.Count; i++) - { - if (!mLanguages[i].IsLoaded()) - { - return true; - } - } - return false; - } - - public List GetCategories(bool OnlyMainCategory = false, List Categories = null) - { - if (Categories == null) - { - Categories = new List(); - } - foreach (TermData mTerm in mTerms) - { - string categoryFromFullTerm = GetCategoryFromFullTerm(mTerm.Term, OnlyMainCategory); - if (!Categories.Contains(categoryFromFullTerm)) - { - Categories.Add(categoryFromFullTerm); - } - } - Categories.Sort(); - return Categories; - } - - public static string GetKeyFromFullTerm(string FullTerm, bool OnlyMainCategory = false) - { - int num = (OnlyMainCategory ? FullTerm.IndexOfAny(CategorySeparators) : FullTerm.LastIndexOfAny(CategorySeparators)); - if (num >= 0) - { - return FullTerm.Substring(num + 1); - } - return FullTerm; - } - - public static string GetCategoryFromFullTerm(string FullTerm, bool OnlyMainCategory = false) - { - int num = (OnlyMainCategory ? FullTerm.IndexOfAny(CategorySeparators) : FullTerm.LastIndexOfAny(CategorySeparators)); - if (num >= 0) - { - return FullTerm.Substring(0, num); - } - return EmptyCategory; - } - - public static void DeserializeFullTerm(string FullTerm, out string Key, out string Category, bool OnlyMainCategory = false) - { - int num = (OnlyMainCategory ? FullTerm.IndexOfAny(CategorySeparators) : FullTerm.LastIndexOfAny(CategorySeparators)); - if (num < 0) - { - Category = EmptyCategory; - Key = FullTerm; - } - else - { - Category = FullTerm.Substring(0, num); - Key = FullTerm.Substring(num + 1); - } - } - - public void UpdateDictionary(bool force = false) - { - if (force || mDictionary == null || mDictionary.Count != mTerms.Count) - { - StringComparer stringComparer = (CaseInsensitiveTerms ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal); - if (mDictionary.Comparer != stringComparer) - { - mDictionary = new Dictionary(stringComparer); - } - else - { - mDictionary.Clear(); - } - int i = 0; - for (int count = mTerms.Count; i < count; i++) - { - TermData termData = mTerms[i]; - ValidateFullTerm(ref termData.Term); - mDictionary[termData.Term] = mTerms[i]; - mTerms[i].Validate(); - } - if (I2Utils.IsPlaying()) - { - SaveLanguages(unloadAll: true); - } - } - } - - public string GetTranslation(string term, string overrideLanguage = null, string overrideSpecialization = null, bool skipDisabled = false, bool allowCategoryMistmatch = false) - { - TryGetTranslation(term, out var Translation, overrideLanguage, overrideSpecialization, skipDisabled, allowCategoryMistmatch); - return Translation; - } - - public bool TryGetTranslation(string term, out string Translation, string overrideLanguage = null, string overrideSpecialization = null, bool skipDisabled = false, bool allowCategoryMistmatch = false) - { - int languageIndex = GetLanguageIndex((overrideLanguage == null) ? LocalizationManager.CurrentLanguage : overrideLanguage, AllowDiscartingRegion: true, SkipDisabled: false); - if (languageIndex >= 0 && (!skipDisabled || mLanguages[languageIndex].IsEnabled())) - { - TermData termData = GetTermData(term, allowCategoryMistmatch); - if (termData != null) - { - Translation = termData.GetTranslation(languageIndex, overrideSpecialization, editMode: true); - if (Translation == "---") - { - Translation = string.Empty; - return true; - } - if (!string.IsNullOrEmpty(Translation)) - { - return true; - } - Translation = null; - } - if (OnMissingTranslation == MissingTranslationAction.ShowWarning) - { - Translation = ""; - Debug.LogWarning("Missing Translation for '" + term + "'", Localize.CurrentLocalizeComponent); - return false; - } - if (OnMissingTranslation == MissingTranslationAction.Fallback && termData != null) - { - return TryGetFallbackTranslation(termData, out Translation, languageIndex, overrideSpecialization, skipDisabled); - } - if (OnMissingTranslation == MissingTranslationAction.Empty) - { - Translation = string.Empty; - return false; - } - if (OnMissingTranslation == MissingTranslationAction.ShowTerm) - { - Translation = term; - return false; - } - } - Translation = null; - return false; - } - - private bool TryGetFallbackTranslation(TermData termData, out string Translation, int langIndex, string overrideSpecialization = null, bool skipDisabled = false) - { - string text = mLanguages[langIndex].Code; - if (!string.IsNullOrEmpty(text)) - { - if (text.Contains("-")) - { - text = text.Substring(0, text.IndexOf('-')); - } - for (int i = 0; i < mLanguages.Count; i++) - { - if (i != langIndex && mLanguages[i].Code.StartsWith(text, StringComparison.Ordinal) && (!skipDisabled || mLanguages[i].IsEnabled())) - { - Translation = termData.GetTranslation(i, overrideSpecialization, editMode: true); - if (!string.IsNullOrEmpty(Translation)) - { - return true; - } - } - } - } - for (int j = 0; j < mLanguages.Count; j++) - { - if (j != langIndex && (!skipDisabled || mLanguages[j].IsEnabled()) && (text == null || !mLanguages[j].Code.StartsWith(text, StringComparison.Ordinal))) - { - Translation = termData.GetTranslation(j, overrideSpecialization, editMode: true); - if (!string.IsNullOrEmpty(Translation)) - { - return true; - } - } - } - Translation = null; - return false; - } - - public TermData AddTerm(string term) - { - return AddTerm(term, eTermType.Text); - } - - public TermData GetTermData(string term, bool allowCategoryMistmatch = false) - { - if (string.IsNullOrEmpty(term)) - { - return null; - } - if (mDictionary.Count == 0) - { - UpdateDictionary(); - } - if (mDictionary.TryGetValue(term, out var value)) - { - return value; - } - TermData termData = null; - if (allowCategoryMistmatch) - { - string keyFromFullTerm = GetKeyFromFullTerm(term); - { - foreach (KeyValuePair item in mDictionary) - { - if (item.Value.IsTerm(keyFromFullTerm, allowCategoryMistmatch: true)) - { - if (termData != null) - { - return null; - } - termData = item.Value; - } - } - return termData; - } - } - return termData; - } - - public bool ContainsTerm(string term) - { - return GetTermData(term) != null; - } - - public List GetTermsList(string Category = null) - { - if (mDictionary.Count != mTerms.Count) - { - UpdateDictionary(); - } - if (string.IsNullOrEmpty(Category)) - { - return new List(mDictionary.Keys); - } - List list = new List(); - for (int i = 0; i < mTerms.Count; i++) - { - TermData termData = mTerms[i]; - if (GetCategoryFromFullTerm(termData.Term) == Category) - { - list.Add(termData.Term); - } - } - return list; - } - - public TermData AddTerm(string NewTerm, eTermType termType, bool SaveSource = true) - { - ValidateFullTerm(ref NewTerm); - NewTerm = NewTerm.Trim(); - if (mLanguages.Count == 0) - { - AddLanguage("English", "en"); - } - TermData termData = GetTermData(NewTerm); - if (termData == null) - { - termData = new TermData(); - termData.Term = NewTerm; - termData.TermType = termType; - termData.Languages = new string[mLanguages.Count]; - termData.Flags = new byte[mLanguages.Count]; - mTerms.Add(termData); - mDictionary.Add(NewTerm, termData); - } - return termData; - } - - public void RemoveTerm(string term) - { - int i = 0; - for (int count = mTerms.Count; i < count; i++) - { - if (mTerms[i].Term == term) - { - mTerms.RemoveAt(i); - mDictionary.Remove(term); - break; - } - } - } - - public static void ValidateFullTerm(ref string Term) - { - Term = Term.Replace('\\', '/'); - Term = Term.Trim(); - if (Term.StartsWith(EmptyCategory, StringComparison.Ordinal) && Term.Length > EmptyCategory.Length && Term[EmptyCategory.Length] == '/') - { - Term = Term.Substring(EmptyCategory.Length + 1); - } - Term = I2Utils.GetValidTermName(Term, allowCategory: true); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizationManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizationManager.cs deleted file mode 100644 index 49292c5..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizationManager.cs +++ /dev/null @@ -1,1056 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading; -using UnityEngine; - -namespace I2.Loc; - -public static class LocalizationManager -{ - public delegate bool FnCustomApplyLocalizationParams(ref string translation, _GetParam getParam, bool allowLocalizedParameters); - - public delegate object _GetParam(string param); - - public delegate void OnLocalizeCallback(); - - private static string mCurrentLanguage; - - private static string mLanguageCode; - - private static CultureInfo mCurrentCulture; - - private static bool mChangeCultureInfo; - - public static bool IsRight2Left; - - public static bool HasJoinedWords; - - public static List ParamManagers = new List(); - - public static FnCustomApplyLocalizationParams CustomApplyLocalizationParams; - - private static string[] LanguagesRTL = new string[21] - { - "ar-DZ", "ar", "ar-BH", "ar-EG", "ar-IQ", "ar-JO", "ar-KW", "ar-LB", "ar-LY", "ar-MA", - "ar-OM", "ar-QA", "ar-SA", "ar-SY", "ar-TN", "ar-AE", "ar-YE", "fa", "he", "ur", - "ji" - }; - - public static List Sources = new List(); - - public static string[] GlobalSources = new string[1] { "I2Languages" }; - - public static Func Callback_AllowSyncFromGoogle = null; - - private static string mCurrentDeviceLanguage; - - public static List mLocalizeTargets = new List(); - - private static bool mLocalizeIsScheduled; - - private static bool mLocalizeIsScheduledWithForcedValue; - - public static bool HighlightLocalizedTargets = false; - - public static string CurrentLanguage - { - get - { - InitializeIfNeeded(); - return mCurrentLanguage; - } - set - { - InitializeIfNeeded(); - string supportedLanguage = GetSupportedLanguage(value); - if (!string.IsNullOrEmpty(supportedLanguage) && mCurrentLanguage != supportedLanguage) - { - SetLanguageAndCode(supportedLanguage, GetLanguageCode(supportedLanguage)); - } - } - } - - public static string CurrentLanguageCode - { - get - { - InitializeIfNeeded(); - return mLanguageCode; - } - set - { - InitializeIfNeeded(); - if (mLanguageCode != value) - { - string languageFromCode = GetLanguageFromCode(value); - if (!string.IsNullOrEmpty(languageFromCode)) - { - SetLanguageAndCode(languageFromCode, value); - } - } - } - } - - public static string CurrentRegion - { - get - { - string currentLanguage = CurrentLanguage; - int num = currentLanguage.IndexOfAny("/\\".ToCharArray()); - if (num > 0) - { - return currentLanguage.Substring(num + 1); - } - num = currentLanguage.IndexOfAny("[(".ToCharArray()); - int num2 = currentLanguage.LastIndexOfAny("])".ToCharArray()); - if (num > 0 && num != num2) - { - return currentLanguage.Substring(num + 1, num2 - num - 1); - } - return string.Empty; - } - set - { - string text = CurrentLanguage; - int num = text.IndexOfAny("/\\".ToCharArray()); - if (num > 0) - { - CurrentLanguage = text.Substring(num + 1) + value; - return; - } - num = text.IndexOfAny("[(".ToCharArray()); - int num2 = text.LastIndexOfAny("])".ToCharArray()); - if (num > 0 && num != num2) - { - text = text.Substring(num); - } - CurrentLanguage = text + "(" + value + ")"; - } - } - - public static string CurrentRegionCode - { - get - { - string currentLanguageCode = CurrentLanguageCode; - int num = currentLanguageCode.IndexOfAny(" -_/\\".ToCharArray()); - if (num >= 0) - { - return currentLanguageCode.Substring(num + 1); - } - return string.Empty; - } - set - { - string text = CurrentLanguageCode; - int num = text.IndexOfAny(" -_/\\".ToCharArray()); - if (num > 0) - { - text = text.Substring(0, num); - } - CurrentLanguageCode = text + "-" + value; - } - } - - public static CultureInfo CurrentCulture => mCurrentCulture; - - public static event OnLocalizeCallback OnLocalizeEvent; - - public static void InitializeIfNeeded() - { - if (string.IsNullOrEmpty(mCurrentLanguage) || Sources.Count == 0) - { - AutoLoadGlobalParamManagers(); - UpdateSources(); - SelectStartupLanguage(); - } - } - - public static string GetVersion() - { - return "2.8.20 f2"; - } - - public static int GetRequiredWebServiceVersion() - { - return 5; - } - - public static string GetWebServiceURL(LanguageSourceData source = null) - { - if (source != null && !string.IsNullOrEmpty(source.Google_WebServiceURL)) - { - return source.Google_WebServiceURL; - } - InitializeIfNeeded(); - for (int i = 0; i < Sources.Count; i++) - { - if (Sources[i] != null && !string.IsNullOrEmpty(Sources[i].Google_WebServiceURL)) - { - return Sources[i].Google_WebServiceURL; - } - } - return string.Empty; - } - - public static void SetLanguageAndCode(string LanguageName, string LanguageCode, bool RememberLanguage = true, bool Force = false) - { - if (mCurrentLanguage != LanguageName || mLanguageCode != LanguageCode || Force) - { - if (RememberLanguage) - { - PersistentStorage.SetSetting_String("I2 Language", LanguageName); - } - mCurrentLanguage = LanguageName; - mLanguageCode = LanguageCode; - mCurrentCulture = CreateCultureForCode(LanguageCode); - if (mChangeCultureInfo) - { - SetCurrentCultureInfo(); - } - IsRight2Left = IsRTL(mLanguageCode); - HasJoinedWords = GoogleLanguages.LanguageCode_HasJoinedWord(mLanguageCode); - LocalizeAll(Force); - } - } - - private static CultureInfo CreateCultureForCode(string code) - { - try - { - return CultureInfo.CreateSpecificCulture(code); - } - catch (Exception) - { - return CultureInfo.InvariantCulture; - } - } - - public static void EnableChangingCultureInfo(bool bEnable) - { - if (!mChangeCultureInfo && bEnable) - { - SetCurrentCultureInfo(); - } - mChangeCultureInfo = bEnable; - } - - private static void SetCurrentCultureInfo() - { - Thread.CurrentThread.CurrentCulture = mCurrentCulture; - } - - private static void SelectStartupLanguage() - { - if (Sources.Count == 0) - { - return; - } - string setting_String = PersistentStorage.GetSetting_String("I2 Language", string.Empty); - string currentDeviceLanguage = GetCurrentDeviceLanguage(); - if (!string.IsNullOrEmpty(setting_String) && HasLanguage(setting_String, AllowDiscartingRegion: true, Initialize: false)) - { - SetLanguageAndCode(setting_String, GetLanguageCode(setting_String)); - return; - } - if (!Sources[0].IgnoreDeviceLanguage) - { - string supportedLanguage = GetSupportedLanguage(currentDeviceLanguage, ignoreDisabled: true); - if (!string.IsNullOrEmpty(supportedLanguage)) - { - SetLanguageAndCode(supportedLanguage, GetLanguageCode(supportedLanguage), RememberLanguage: false); - return; - } - } - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - if (Sources[i].mLanguages.Count <= 0) - { - continue; - } - for (int j = 0; j < Sources[i].mLanguages.Count; j++) - { - if (Sources[i].mLanguages[j].IsEnabled()) - { - SetLanguageAndCode(Sources[i].mLanguages[j].Name, Sources[i].mLanguages[j].Code, RememberLanguage: false); - return; - } - } - } - } - - public static bool HasLanguage(string Language, bool AllowDiscartingRegion = true, bool Initialize = true, bool SkipDisabled = true) - { - if (Initialize) - { - InitializeIfNeeded(); - } - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - if (Sources[i].GetLanguageIndex(Language, AllowDiscartingRegion: false, SkipDisabled) >= 0) - { - return true; - } - } - if (AllowDiscartingRegion) - { - int j = 0; - for (int count2 = Sources.Count; j < count2; j++) - { - if (Sources[j].GetLanguageIndex(Language, AllowDiscartingRegion: true, SkipDisabled) >= 0) - { - return true; - } - } - } - return false; - } - - public static string GetSupportedLanguage(string Language, bool ignoreDisabled = false) - { - string languageCode = GoogleLanguages.GetLanguageCode(Language); - if (!string.IsNullOrEmpty(languageCode)) - { - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - int languageIndexFromCode = Sources[i].GetLanguageIndexFromCode(languageCode, exactMatch: true, ignoreDisabled); - if (languageIndexFromCode >= 0) - { - return Sources[i].mLanguages[languageIndexFromCode].Name; - } - } - int j = 0; - for (int count2 = Sources.Count; j < count2; j++) - { - int languageIndexFromCode2 = Sources[j].GetLanguageIndexFromCode(languageCode, exactMatch: false, ignoreDisabled); - if (languageIndexFromCode2 >= 0) - { - return Sources[j].mLanguages[languageIndexFromCode2].Name; - } - } - } - int k = 0; - for (int count3 = Sources.Count; k < count3; k++) - { - int languageIndex = Sources[k].GetLanguageIndex(Language, AllowDiscartingRegion: false, ignoreDisabled); - if (languageIndex >= 0) - { - return Sources[k].mLanguages[languageIndex].Name; - } - } - int l = 0; - for (int count4 = Sources.Count; l < count4; l++) - { - int languageIndex2 = Sources[l].GetLanguageIndex(Language, AllowDiscartingRegion: true, ignoreDisabled); - if (languageIndex2 >= 0) - { - return Sources[l].mLanguages[languageIndex2].Name; - } - } - return string.Empty; - } - - public static string GetLanguageCode(string Language) - { - if (Sources.Count == 0) - { - UpdateSources(); - } - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - int languageIndex = Sources[i].GetLanguageIndex(Language); - if (languageIndex >= 0) - { - return Sources[i].mLanguages[languageIndex].Code; - } - } - return string.Empty; - } - - public static string GetLanguageFromCode(string Code, bool exactMatch = true) - { - if (Sources.Count == 0) - { - UpdateSources(); - } - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - int languageIndexFromCode = Sources[i].GetLanguageIndexFromCode(Code, exactMatch); - if (languageIndexFromCode >= 0) - { - return Sources[i].mLanguages[languageIndexFromCode].Name; - } - } - return string.Empty; - } - - public static List GetAllLanguages(bool SkipDisabled = true) - { - if (Sources.Count == 0) - { - UpdateSources(); - } - List Languages = new List(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - Languages.AddRange(from x in Sources[i].GetLanguages(SkipDisabled) - where !Languages.Contains(x) - select x); - } - return Languages; - } - - public static List GetAllLanguagesCode(bool allowRegions = true, bool SkipDisabled = true) - { - List Languages = new List(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - Languages.AddRange(from x in Sources[i].GetLanguagesCode(allowRegions, SkipDisabled) - where !Languages.Contains(x) - select x); - } - return Languages; - } - - public static bool IsLanguageEnabled(string Language) - { - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - if (!Sources[i].IsLanguageEnabled(Language)) - { - return false; - } - } - return true; - } - - private static void LoadCurrentLanguage() - { - for (int i = 0; i < Sources.Count; i++) - { - int languageIndex = Sources[i].GetLanguageIndex(mCurrentLanguage, AllowDiscartingRegion: true, SkipDisabled: false); - Sources[i].LoadLanguage(languageIndex, UnloadOtherLanguages: true, useFallback: true, onlyCurrentSpecialization: true, forceLoad: false); - } - } - - public static void PreviewLanguage(string NewLanguage) - { - mCurrentLanguage = NewLanguage; - mLanguageCode = GetLanguageCode(mCurrentLanguage); - IsRight2Left = IsRTL(mLanguageCode); - HasJoinedWords = GoogleLanguages.LanguageCode_HasJoinedWord(mLanguageCode); - } - - public static void AutoLoadGlobalParamManagers() - { - LocalizationParamsManager[] array = UnityEngine.Object.FindObjectsOfType(); - foreach (LocalizationParamsManager localizationParamsManager in array) - { - if (localizationParamsManager._IsGlobalManager && !ParamManagers.Contains(localizationParamsManager)) - { - Debug.Log(localizationParamsManager); - ParamManagers.Add(localizationParamsManager); - } - } - } - - public static void ApplyLocalizationParams(ref string translation, bool allowLocalizedParameters = true) - { - ApplyLocalizationParams(ref translation, (string p) => GetLocalizationParam(p, null), allowLocalizedParameters); - } - - public static void ApplyLocalizationParams(ref string translation, GameObject root, bool allowLocalizedParameters = true) - { - ApplyLocalizationParams(ref translation, (string p) => GetLocalizationParam(p, root), allowLocalizedParameters); - } - - public static void ApplyLocalizationParams(ref string translation, Dictionary parameters, bool allowLocalizedParameters = true) - { - ApplyLocalizationParams(ref translation, delegate(string p) - { - object value = null; - return parameters.TryGetValue(p, out value) ? value : null; - }, allowLocalizedParameters); - } - - public static void ApplyLocalizationParams(ref string translation, _GetParam getParam, bool allowLocalizedParameters = true) - { - if (translation == null || (CustomApplyLocalizationParams != null && CustomApplyLocalizationParams(ref translation, getParam, allowLocalizedParameters))) - { - return; - } - string text = null; - int num = 0; - int length = translation.Length; - int num2 = 0; - while (num2 >= 0 && num2 < translation.Length) - { - int num3 = translation.IndexOf("{[", num2, StringComparison.Ordinal); - if (num3 < 0) - { - break; - } - int num4 = translation.IndexOf("]}", num3, StringComparison.Ordinal); - if (num4 < 0) - { - break; - } - int num5 = translation.IndexOf("{[", num3 + 1, StringComparison.Ordinal); - if (num5 > 0 && num5 < num4) - { - num2 = num5; - continue; - } - int num6 = ((translation[num3 + 2] == '#') ? 3 : 2); - string param = translation.Substring(num3 + num6, num4 - num3 - num6); - string text2 = (string)getParam(param); - if (text2 != null) - { - if (allowLocalizedParameters) - { - LanguageSourceData source; - TermData termData = GetTermData(text2, out source); - if (termData != null) - { - int languageIndex = source.GetLanguageIndex(CurrentLanguage); - if (languageIndex >= 0) - { - text2 = termData.GetTranslation(languageIndex); - } - } - } - string oldValue = translation.Substring(num3, num4 - num3 + 2); - translation = translation.Replace(oldValue, text2); - int result = 0; - if (int.TryParse(text2, out result)) - { - text = GoogleLanguages.GetPluralType(CurrentLanguageCode, result).ToString(); - } - num2 = num3 + text2.Length; - } - else - { - num2 = num4 + 2; - } - } - if (text != null) - { - string text3 = "[i2p_" + text + "]"; - num = translation.IndexOf(text3, StringComparison.OrdinalIgnoreCase); - num = ((num >= 0) ? (num + text3.Length) : 0); - length = translation.IndexOf("[i2p_", num + 1, StringComparison.OrdinalIgnoreCase); - if (length < 0) - { - length = translation.Length; - } - translation = translation.Substring(num, length - num); - } - } - - internal static string GetLocalizationParam(string ParamName, GameObject root) - { - string text = null; - if ((bool)root) - { - MonoBehaviour[] components = root.GetComponents(); - int i = 0; - for (int num = components.Length; i < num; i++) - { - if (components[i] is ILocalizationParamsManager localizationParamsManager && components[i].enabled) - { - text = localizationParamsManager.GetParameterValue(ParamName); - if (text != null) - { - return text; - } - } - } - } - int j = 0; - for (int count = ParamManagers.Count; j < count; j++) - { - text = ParamManagers[j].GetParameterValue(ParamName); - if (text != null) - { - return text; - } - } - return null; - } - - private static string GetPluralType(MatchCollection matches, string langCode, _GetParam getParam) - { - int i = 0; - for (int count = matches.Count; i < count; i++) - { - Match match = matches[i]; - string value = match.Groups[match.Groups.Count - 1].Value; - string text = (string)getParam(value); - if (text != null) - { - int result = 0; - if (int.TryParse(text, out result)) - { - return GoogleLanguages.GetPluralType(langCode, result).ToString(); - } - } - } - return null; - } - - public static string ApplyRTLfix(string line) - { - return ApplyRTLfix(line, 0, ignoreNumbers: true); - } - - public static string ApplyRTLfix(string line, int maxCharacters, bool ignoreNumbers) - { - if (string.IsNullOrEmpty(line)) - { - return line; - } - char c = line[0]; - if (c == '!' || c == '.' || c == '?') - { - line = line.Substring(1) + c; - } - int tagStart = -1; - int num = 0; - int num2 = 40000; - num = 0; - List list = new List(); - while (I2Utils.FindNextTag(line, num, out tagStart, out num)) - { - string text = "@@" + (char)(num2 + list.Count) + "@@"; - list.Add(line.Substring(tagStart, num - tagStart + 1)); - line = line.Substring(0, tagStart) + text + line.Substring(num + 1); - num = tagStart + 5; - } - line = line.Replace("\r\n", "\n"); - line = I2Utils.SplitLine(line, maxCharacters); - line = RTLFixer.Fix(line, showTashkeel: true, !ignoreNumbers); - for (int i = 0; i < list.Count; i++) - { - int length = line.Length; - for (int j = 0; j < length - 4; j++) - { - if (line[j] == '@' && line[j + 1] == '@' && line[j + 2] >= num2 && line[j + 3] == '@' && line[j + 4] == '@') - { - int num3 = line[j + 2] - num2; - num3 = ((num3 % 2 != 0) ? (num3 - 1) : (num3 + 1)); - if (num3 >= list.Count) - { - num3 = list.Count - 1; - } - line = line.Substring(0, j) + list[num3] + line.Substring(j + 5); - break; - } - } - } - return line; - } - - public static string FixRTL_IfNeeded(string text, int maxCharacters = 0, bool ignoreNumber = false) - { - if (IsRight2Left) - { - return ApplyRTLfix(text, maxCharacters, ignoreNumber); - } - return text; - } - - public static bool IsRTL(string Code) - { - return Array.IndexOf(LanguagesRTL, Code) >= 0; - } - - public static bool UpdateSources() - { - UnregisterDeletededSources(); - RegisterSourceInResources(); - RegisterSceneSources(); - return Sources.Count > 0; - } - - private static void UnregisterDeletededSources() - { - for (int num = Sources.Count - 1; num >= 0; num--) - { - if (Sources[num] == null) - { - RemoveSource(Sources[num]); - } - } - } - - private static void RegisterSceneSources() - { - LanguageSource[] array = (LanguageSource[])Resources.FindObjectsOfTypeAll(typeof(LanguageSource)); - foreach (LanguageSource languageSource in array) - { - if (!Sources.Contains(languageSource.mSource)) - { - if (languageSource.mSource.owner == null) - { - languageSource.mSource.owner = languageSource; - } - AddSource(languageSource.mSource); - } - } - } - - private static void RegisterSourceInResources() - { - string[] globalSources = GlobalSources; - foreach (string name in globalSources) - { - LanguageSourceAsset asset = ResourceManager.pInstance.GetAsset(name); - if ((bool)asset && !Sources.Contains(asset.mSource)) - { - if (!asset.mSource.mIsGlobalSource) - { - asset.mSource.mIsGlobalSource = true; - } - asset.mSource.owner = asset; - AddSource(asset.mSource); - } - } - } - - private static bool AllowSyncFromGoogle(LanguageSourceData Source) - { - if (Callback_AllowSyncFromGoogle == null) - { - return true; - } - return Callback_AllowSyncFromGoogle(Source); - } - - internal static void AddSource(LanguageSourceData Source) - { - if (Sources.Contains(Source)) - { - return; - } - Sources.Add(Source); - if (Source.HasGoogleSpreadsheet() && Source.GoogleUpdateFrequency != LanguageSourceData.eGoogleUpdateFrequency.Never && AllowSyncFromGoogle(Source)) - { - Source.Import_Google_FromCache(); - bool justCheck = false; - if (Source.GoogleUpdateDelay > 0f) - { - CoroutineManager.Start(Delayed_Import_Google(Source, Source.GoogleUpdateDelay, justCheck)); - } - else - { - Source.Import_Google(ForceUpdate: false, justCheck); - } - } - for (int i = 0; i < Source.mLanguages.Count; i++) - { - Source.mLanguages[i].SetLoaded(loaded: true); - } - if (Source.mDictionary.Count == 0) - { - Source.UpdateDictionary(force: true); - } - } - - private static IEnumerator Delayed_Import_Google(LanguageSourceData source, float delay, bool justCheck) - { - yield return new WaitForSeconds(delay); - source?.Import_Google(ForceUpdate: false, justCheck); - } - - internal static void RemoveSource(LanguageSourceData Source) - { - Sources.Remove(Source); - } - - public static bool IsGlobalSource(string SourceName) - { - return Array.IndexOf(GlobalSources, SourceName) >= 0; - } - - public static LanguageSourceData GetSourceContaining(string term, bool fallbackToFirst = true) - { - if (!string.IsNullOrEmpty(term)) - { - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - if (Sources[i].GetTermData(term) != null) - { - return Sources[i]; - } - } - } - if (!fallbackToFirst || Sources.Count <= 0) - { - return null; - } - return Sources[0]; - } - - public static UnityEngine.Object FindAsset(string value) - { - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - UnityEngine.Object @object = Sources[i].FindAsset(value); - if ((bool)@object) - { - return @object; - } - } - return null; - } - - public static void ApplyDownloadedDataFromGoogle() - { - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - Sources[i].ApplyDownloadedDataFromGoogle(); - } - } - - public static string GetCurrentDeviceLanguage(bool force = false) - { - if (force || string.IsNullOrEmpty(mCurrentDeviceLanguage)) - { - DetectDeviceLanguage(); - } - return mCurrentDeviceLanguage; - } - - private static void DetectDeviceLanguage() - { - mCurrentDeviceLanguage = Application.systemLanguage.ToString(); - if (mCurrentDeviceLanguage == "ChineseSimplified") - { - mCurrentDeviceLanguage = "Chinese (Simplified)"; - } - if (mCurrentDeviceLanguage == "ChineseTraditional") - { - mCurrentDeviceLanguage = "Chinese (Traditional)"; - } - } - - public static void RegisterTarget(ILocalizeTargetDescriptor desc) - { - if (mLocalizeTargets.FindIndex((ILocalizeTargetDescriptor x) => x.Name == desc.Name) != -1) - { - return; - } - for (int i = 0; i < mLocalizeTargets.Count; i++) - { - if (mLocalizeTargets[i].Priority > desc.Priority) - { - mLocalizeTargets.Insert(i, desc); - return; - } - } - mLocalizeTargets.Add(desc); - } - - public static string GetTranslation(string Term, bool FixForRTL = true, int maxLineLengthForRTL = 0, bool ignoreRTLnumbers = true, bool applyParameters = false, GameObject localParametersRoot = null, string overrideLanguage = null, bool allowLocalizedParameters = true) - { - string Translation = null; - TryGetTranslation(Term, out Translation, FixForRTL, maxLineLengthForRTL, ignoreRTLnumbers, applyParameters, localParametersRoot, overrideLanguage, allowLocalizedParameters); - return Translation; - } - - public static string GetTermTranslation(string Term, bool FixForRTL = true, int maxLineLengthForRTL = 0, bool ignoreRTLnumbers = true, bool applyParameters = false, GameObject localParametersRoot = null, string overrideLanguage = null, bool allowLocalizedParameters = true) - { - return GetTranslation(Term, FixForRTL, maxLineLengthForRTL, ignoreRTLnumbers, applyParameters, localParametersRoot, overrideLanguage, allowLocalizedParameters); - } - - public static bool TryGetTranslation(string Term, out string Translation, bool FixForRTL = true, int maxLineLengthForRTL = 0, bool ignoreRTLnumbers = true, bool applyParameters = false, GameObject localParametersRoot = null, string overrideLanguage = null, bool allowLocalizedParameters = true) - { - Translation = null; - if (string.IsNullOrEmpty(Term)) - { - return false; - } - InitializeIfNeeded(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - if (Sources[i].TryGetTranslation(Term, out Translation, overrideLanguage)) - { - if (applyParameters) - { - ApplyLocalizationParams(ref Translation, localParametersRoot, allowLocalizedParameters); - } - if (IsRight2Left && FixForRTL) - { - Translation = ApplyRTLfix(Translation, maxLineLengthForRTL, ignoreRTLnumbers); - } - return true; - } - } - return false; - } - - public static T GetTranslatedObject(string AssetName, Localize optionalLocComp = null) where T : UnityEngine.Object - { - if (optionalLocComp != null) - { - return optionalLocComp.FindTranslatedObject(AssetName); - } - T val = FindAsset(AssetName) as T; - if ((bool)(UnityEngine.Object)val) - { - return val; - } - return ResourceManager.pInstance.GetAsset(AssetName); - } - - public static T GetTranslatedObjectByTermName(string Term, Localize optionalLocComp = null) where T : UnityEngine.Object - { - return GetTranslatedObject(GetTranslation(Term, FixForRTL: false)); - } - - public static string GetAppName(string languageCode) - { - if (!string.IsNullOrEmpty(languageCode)) - { - for (int i = 0; i < Sources.Count; i++) - { - if (string.IsNullOrEmpty(Sources[i].mTerm_AppName)) - { - continue; - } - int languageIndexFromCode = Sources[i].GetLanguageIndexFromCode(languageCode, exactMatch: false); - if (languageIndexFromCode < 0) - { - continue; - } - TermData termData = Sources[i].GetTermData(Sources[i].mTerm_AppName); - if (termData != null) - { - string translation = termData.GetTranslation(languageIndexFromCode); - if (!string.IsNullOrEmpty(translation)) - { - return translation; - } - } - } - } - return Application.productName; - } - - public static void LocalizeAll(bool Force = false) - { - LoadCurrentLanguage(); - if (!Application.isPlaying) - { - DoLocalizeAll(Force); - return; - } - mLocalizeIsScheduledWithForcedValue |= Force; - if (!mLocalizeIsScheduled) - { - CoroutineManager.Start(Coroutine_LocalizeAll()); - } - } - - private static IEnumerator Coroutine_LocalizeAll() - { - mLocalizeIsScheduled = true; - yield return null; - mLocalizeIsScheduled = false; - bool force = mLocalizeIsScheduledWithForcedValue; - mLocalizeIsScheduledWithForcedValue = false; - DoLocalizeAll(force); - } - - private static void DoLocalizeAll(bool Force = false) - { - Localize[] array = (Localize[])Resources.FindObjectsOfTypeAll(typeof(Localize)); - int i = 0; - for (int num = array.Length; i < num; i++) - { - array[i].OnLocalize(Force); - } - if (LocalizationManager.OnLocalizeEvent != null) - { - LocalizationManager.OnLocalizeEvent(); - } - } - - public static List GetCategories() - { - List list = new List(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - Sources[i].GetCategories(OnlyMainCategory: false, list); - } - return list; - } - - public static List GetTermsList(string Category = null) - { - if (Sources.Count == 0) - { - UpdateSources(); - } - if (Sources.Count == 1) - { - return Sources[0].GetTermsList(Category); - } - HashSet hashSet = new HashSet(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - hashSet.UnionWith(Sources[i].GetTermsList(Category)); - } - return new List(hashSet); - } - - public static TermData GetTermData(string term) - { - InitializeIfNeeded(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - TermData termData = Sources[i].GetTermData(term); - if (termData != null) - { - return termData; - } - } - return null; - } - - public static TermData GetTermData(string term, out LanguageSourceData source) - { - InitializeIfNeeded(); - int i = 0; - for (int count = Sources.Count; i < count; i++) - { - TermData termData = Sources[i].GetTermData(term); - if (termData != null) - { - source = Sources[i]; - return termData; - } - } - source = null; - return null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizationParamsManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizationParamsManager.cs deleted file mode 100644 index 2690bf1..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizationParamsManager.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace I2.Loc; - -public class LocalizationParamsManager : MonoBehaviour, ILocalizationParamsManager -{ - [Serializable] - public struct ParamValue - { - public string Name; - - public string Value; - } - - [SerializeField] - public List _Params = new List(); - - public bool _IsGlobalManager; - - public string GetParameterValue(string ParamName) - { - if (_Params != null) - { - int i = 0; - for (int count = _Params.Count; i < count; i++) - { - if (_Params[i].Name == ParamName) - { - return _Params[i].Value; - } - } - } - return null; - } - - public void SetParameterValue(string ParamName, string ParamValue, bool localize = true) - { - bool flag = false; - int i = 0; - for (int count = _Params.Count; i < count; i++) - { - if (_Params[i].Name == ParamName) - { - ParamValue value = _Params[i]; - value.Value = ParamValue; - _Params[i] = value; - flag = true; - break; - } - } - if (!flag) - { - _Params.Add(new ParamValue - { - Name = ParamName, - Value = ParamValue - }); - } - if (localize) - { - OnLocalize(); - } - } - - public void OnLocalize() - { - Localize component = GetComponent(); - if (component != null) - { - component.OnLocalize(Force: true); - } - } - - public virtual void OnEnable() - { - if (_IsGlobalManager) - { - DoAutoRegister(); - } - } - - public void DoAutoRegister() - { - if (!LocalizationManager.ParamManagers.Contains(this)) - { - LocalizationManager.ParamManagers.Add(this); - LocalizationManager.LocalizeAll(Force: true); - } - } - - public void OnDisable() - { - LocalizationManager.ParamManagers.Remove(this); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizationReader.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizationReader.cs deleted file mode 100644 index a940e76..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizationReader.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using UnityEngine; - -namespace I2.Loc; - -public class LocalizationReader -{ - public static Dictionary ReadTextAsset(TextAsset asset) - { - StringReader stringReader = new StringReader(Encoding.UTF8.GetString(asset.bytes, 0, asset.bytes.Length).Replace("\r\n", "\n").Replace("\r", "\n")); - Dictionary dictionary = new Dictionary(StringComparer.Ordinal); - string line; - while ((line = stringReader.ReadLine()) != null) - { - if (TextAsset_ReadLine(line, out var key, out var value, out var _, out var _, out var _) && !string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value)) - { - dictionary[key] = value; - } - } - return dictionary; - } - - public static bool TextAsset_ReadLine(string line, out string key, out string value, out string category, out string comment, out string termType) - { - key = string.Empty; - category = string.Empty; - comment = string.Empty; - termType = string.Empty; - value = string.Empty; - int num = line.LastIndexOf("//", StringComparison.Ordinal); - if (num >= 0) - { - comment = line.Substring(num + 2).Trim(); - comment = DecodeString(comment); - line = line.Substring(0, num); - } - int num2 = line.IndexOf("=", StringComparison.Ordinal); - if (num2 < 0) - { - return false; - } - key = line.Substring(0, num2).Trim(); - value = line.Substring(num2 + 1).Trim(); - value = value.Replace("\r\n", "\n").Replace("\n", "\\n"); - value = DecodeString(value); - if (key.Length > 2 && key[0] == '[') - { - int num3 = key.IndexOf(']'); - if (num3 >= 0) - { - termType = key.Substring(1, num3 - 1); - key = key.Substring(num3 + 1); - } - } - ValidateFullTerm(ref key); - return true; - } - - public static string ReadCSVfile(string Path, Encoding encoding) - { - string text = string.Empty; - using (StreamReader streamReader = new StreamReader(Path, encoding)) - { - text = streamReader.ReadToEnd(); - } - text = text.Replace("\r\n", "\n"); - return text.Replace("\r", "\n"); - } - - public static List ReadCSV(string Text, char Separator = ',') - { - int iStart = 0; - List list = new List(); - while (iStart < Text.Length) - { - string[] array = ParseCSVline(Text, ref iStart, Separator); - if (array == null) - { - break; - } - list.Add(array); - } - return list; - } - - private static string[] ParseCSVline(string Line, ref int iStart, char Separator) - { - List list = new List(); - int length = Line.Length; - int iWordStart = iStart; - bool flag = false; - while (iStart < length) - { - char c = Line[iStart]; - if (flag) - { - if (c == '"') - { - if (iStart + 1 >= length || Line[iStart + 1] != '"') - { - flag = false; - } - else if (iStart + 2 < length && Line[iStart + 2] == '"') - { - flag = false; - iStart += 2; - } - else - { - iStart++; - } - } - } - else if (c == '\n' || c == Separator) - { - AddCSVtoken(ref list, ref Line, iStart, ref iWordStart); - if (c == '\n') - { - iStart++; - break; - } - } - else if (c == '"') - { - flag = true; - } - iStart++; - } - if (iStart > iWordStart) - { - AddCSVtoken(ref list, ref Line, iStart, ref iWordStart); - } - return list.ToArray(); - } - - private static void AddCSVtoken(ref List list, ref string Line, int iEnd, ref int iWordStart) - { - string text = Line.Substring(iWordStart, iEnd - iWordStart); - iWordStart = iEnd + 1; - text = text.Replace("\"\"", "\""); - if (text.Length > 1 && text[0] == '"' && text[text.Length - 1] == '"') - { - text = text.Substring(1, text.Length - 2); - } - list.Add(text); - } - - public static List ReadI2CSV(string Text) - { - string[] separator = new string[1] { "[*]" }; - string[] separator2 = new string[1] { "[ln]" }; - List list = new List(); - string[] array = Text.Split(separator2, StringSplitOptions.None); - foreach (string text in array) - { - list.Add(text.Split(separator, StringSplitOptions.None)); - } - return list; - } - - public static void ValidateFullTerm(ref string Term) - { - Term = Term.Replace('\\', '/'); - int num = Term.IndexOf('/'); - if (num >= 0) - { - int startIndex; - while ((startIndex = Term.LastIndexOf('/')) != num) - { - Term = Term.Remove(startIndex, 1); - } - } - } - - public static string EncodeString(string str) - { - if (string.IsNullOrEmpty(str)) - { - return string.Empty; - } - return str.Replace("\r\n", "<\\n>").Replace("\r", "<\\n>").Replace("\n", "<\\n>"); - } - - public static string DecodeString(string str) - { - if (string.IsNullOrEmpty(str)) - { - return string.Empty; - } - return str.Replace("<\\n>", "\r\n"); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/Localize.cs b/Thronefall_1_57/Thronefall/I2.Loc/Localize.cs deleted file mode 100644 index 5fc8fac..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/Localize.cs +++ /dev/null @@ -1,464 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; -using UnityEngine.Events; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/I2 Localize")] -public class Localize : MonoBehaviour -{ - public enum TermModification - { - DontModify, - ToUpper, - ToLower, - ToUpperFirst, - ToTitle - } - - public string mTerm = string.Empty; - - public string mTermSecondary = string.Empty; - - [NonSerialized] - public string FinalTerm; - - [NonSerialized] - public string FinalSecondaryTerm; - - public TermModification PrimaryTermModifier; - - public TermModification SecondaryTermModifier; - - public string TermPrefix; - - public string TermSuffix; - - public bool LocalizeOnAwake = true; - - private string LastLocalizedLanguage; - - public bool IgnoreRTL; - - public int MaxCharactersInRTL; - - public bool IgnoreNumbersInRTL = true; - - public bool CorrectAlignmentForRTL = true; - - public bool AddSpacesToJoinedLanguages; - - public bool AllowLocalizedParameters = true; - - public bool AllowParameters = true; - - public List TranslatedObjects = new List(); - - [NonSerialized] - public Dictionary mAssetDictionary = new Dictionary(StringComparer.Ordinal); - - public UnityEvent LocalizeEvent = new UnityEvent(); - - public static string MainTranslation; - - public static string SecondaryTranslation; - - public static string CallBackTerm; - - public static string CallBackSecondaryTerm; - - public static Localize CurrentLocalizeComponent; - - public bool AlwaysForceLocalize; - - [SerializeField] - public EventCallback LocalizeCallBack = new EventCallback(); - - public bool mGUI_ShowReferences; - - public bool mGUI_ShowTems = true; - - public bool mGUI_ShowCallback; - - public ILocalizeTarget mLocalizeTarget; - - public string mLocalizeTargetName; - - public string Term - { - get - { - return mTerm; - } - set - { - SetTerm(value); - } - } - - public string SecondaryTerm - { - get - { - return mTermSecondary; - } - set - { - SetTerm(null, value); - } - } - - private void Awake() - { - UpdateAssetDictionary(); - FindTarget(); - if (LocalizeOnAwake) - { - OnLocalize(); - } - } - - private void OnEnable() - { - OnLocalize(); - } - - public bool HasCallback() - { - if (LocalizeCallBack.HasCallback()) - { - return true; - } - return LocalizeEvent.GetPersistentEventCount() > 0; - } - - public void OnLocalize(bool Force = false) - { - if ((!Force && (!base.enabled || base.gameObject == null || !base.gameObject.activeInHierarchy)) || string.IsNullOrEmpty(LocalizationManager.CurrentLanguage) || (!AlwaysForceLocalize && !Force && !HasCallback() && LastLocalizedLanguage == LocalizationManager.CurrentLanguage)) - { - return; - } - LastLocalizedLanguage = LocalizationManager.CurrentLanguage; - if (string.IsNullOrEmpty(FinalTerm) || string.IsNullOrEmpty(FinalSecondaryTerm)) - { - GetFinalTerms(out FinalTerm, out FinalSecondaryTerm); - } - bool flag = I2Utils.IsPlaying() && HasCallback(); - if (!flag && string.IsNullOrEmpty(FinalTerm) && string.IsNullOrEmpty(FinalSecondaryTerm)) - { - return; - } - CurrentLocalizeComponent = this; - CallBackTerm = FinalTerm; - CallBackSecondaryTerm = FinalSecondaryTerm; - MainTranslation = ((string.IsNullOrEmpty(FinalTerm) || FinalTerm == "-") ? null : LocalizationManager.GetTranslation(FinalTerm, FixForRTL: false)); - SecondaryTranslation = ((string.IsNullOrEmpty(FinalSecondaryTerm) || FinalSecondaryTerm == "-") ? null : LocalizationManager.GetTranslation(FinalSecondaryTerm, FixForRTL: false)); - if (!flag && string.IsNullOrEmpty(FinalTerm) && string.IsNullOrEmpty(SecondaryTranslation)) - { - return; - } - LocalizeCallBack.Execute(this); - LocalizeEvent.Invoke(); - if (AllowParameters) - { - LocalizationManager.ApplyLocalizationParams(ref MainTranslation, base.gameObject, AllowLocalizedParameters); - } - if (!FindTarget()) - { - return; - } - bool flag2 = LocalizationManager.IsRight2Left && !IgnoreRTL; - if (MainTranslation != null) - { - switch (PrimaryTermModifier) - { - case TermModification.ToUpper: - MainTranslation = MainTranslation.ToUpper(); - break; - case TermModification.ToLower: - MainTranslation = MainTranslation.ToLower(); - break; - case TermModification.ToUpperFirst: - MainTranslation = GoogleTranslation.UppercaseFirst(MainTranslation); - break; - case TermModification.ToTitle: - MainTranslation = GoogleTranslation.TitleCase(MainTranslation); - break; - } - if (!string.IsNullOrEmpty(TermPrefix)) - { - MainTranslation = (flag2 ? (MainTranslation + TermPrefix) : (TermPrefix + MainTranslation)); - } - if (!string.IsNullOrEmpty(TermSuffix)) - { - MainTranslation = (flag2 ? (TermSuffix + MainTranslation) : (MainTranslation + TermSuffix)); - } - if (AddSpacesToJoinedLanguages && LocalizationManager.HasJoinedWords && !string.IsNullOrEmpty(MainTranslation)) - { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.Append(MainTranslation[0]); - int i = 1; - for (int length = MainTranslation.Length; i < length; i++) - { - stringBuilder.Append(' '); - stringBuilder.Append(MainTranslation[i]); - } - MainTranslation = stringBuilder.ToString(); - } - if (flag2 && mLocalizeTarget.AllowMainTermToBeRTL() && !string.IsNullOrEmpty(MainTranslation)) - { - MainTranslation = LocalizationManager.ApplyRTLfix(MainTranslation, MaxCharactersInRTL, IgnoreNumbersInRTL); - } - } - if (SecondaryTranslation != null) - { - switch (SecondaryTermModifier) - { - case TermModification.ToUpper: - SecondaryTranslation = SecondaryTranslation.ToUpper(); - break; - case TermModification.ToLower: - SecondaryTranslation = SecondaryTranslation.ToLower(); - break; - case TermModification.ToUpperFirst: - SecondaryTranslation = GoogleTranslation.UppercaseFirst(SecondaryTranslation); - break; - case TermModification.ToTitle: - SecondaryTranslation = GoogleTranslation.TitleCase(SecondaryTranslation); - break; - } - if (flag2 && mLocalizeTarget.AllowSecondTermToBeRTL() && !string.IsNullOrEmpty(SecondaryTranslation)) - { - SecondaryTranslation = LocalizationManager.ApplyRTLfix(SecondaryTranslation); - } - } - if (LocalizationManager.HighlightLocalizedTargets) - { - MainTranslation = "LOC:" + FinalTerm; - } - mLocalizeTarget.DoLocalize(this, MainTranslation, SecondaryTranslation); - CurrentLocalizeComponent = null; - } - - public bool FindTarget() - { - if (mLocalizeTarget != null && mLocalizeTarget.IsValid(this)) - { - return true; - } - if (mLocalizeTarget != null) - { - UnityEngine.Object.DestroyImmediate(mLocalizeTarget); - mLocalizeTarget = null; - mLocalizeTargetName = null; - } - if (!string.IsNullOrEmpty(mLocalizeTargetName)) - { - foreach (ILocalizeTargetDescriptor mLocalizeTarget in LocalizationManager.mLocalizeTargets) - { - if (mLocalizeTargetName == mLocalizeTarget.GetTargetType().ToString()) - { - if (mLocalizeTarget.CanLocalize(this)) - { - this.mLocalizeTarget = mLocalizeTarget.CreateTarget(this); - } - if (this.mLocalizeTarget != null) - { - return true; - } - } - } - } - foreach (ILocalizeTargetDescriptor mLocalizeTarget2 in LocalizationManager.mLocalizeTargets) - { - if (mLocalizeTarget2.CanLocalize(this)) - { - this.mLocalizeTarget = mLocalizeTarget2.CreateTarget(this); - mLocalizeTargetName = mLocalizeTarget2.GetTargetType().ToString(); - if (this.mLocalizeTarget != null) - { - return true; - } - } - } - return false; - } - - public void GetFinalTerms(out string primaryTerm, out string secondaryTerm) - { - primaryTerm = string.Empty; - secondaryTerm = string.Empty; - if (FindTarget()) - { - if (mLocalizeTarget != null) - { - mLocalizeTarget.GetFinalTerms(this, mTerm, mTermSecondary, out primaryTerm, out secondaryTerm); - primaryTerm = I2Utils.GetValidTermName(primaryTerm); - } - if (!string.IsNullOrEmpty(mTerm)) - { - primaryTerm = mTerm; - } - if (!string.IsNullOrEmpty(mTermSecondary)) - { - secondaryTerm = mTermSecondary; - } - if (primaryTerm != null) - { - primaryTerm = primaryTerm.Trim(); - } - if (secondaryTerm != null) - { - secondaryTerm = secondaryTerm.Trim(); - } - } - } - - public string GetMainTargetsText() - { - string primaryTerm = null; - string secondaryTerm = null; - if (mLocalizeTarget != null) - { - mLocalizeTarget.GetFinalTerms(this, null, null, out primaryTerm, out secondaryTerm); - } - if (!string.IsNullOrEmpty(primaryTerm)) - { - return primaryTerm; - } - return mTerm; - } - - public void SetFinalTerms(string Main, string Secondary, out string primaryTerm, out string secondaryTerm, bool RemoveNonASCII) - { - primaryTerm = (RemoveNonASCII ? I2Utils.GetValidTermName(Main) : Main); - secondaryTerm = Secondary; - } - - public void SetTerm(string primary) - { - if (!string.IsNullOrEmpty(primary)) - { - FinalTerm = (mTerm = primary); - } - OnLocalize(Force: true); - } - - public void SetTerm(string primary, string secondary) - { - if (!string.IsNullOrEmpty(primary)) - { - FinalTerm = (mTerm = primary); - } - FinalSecondaryTerm = (mTermSecondary = secondary); - OnLocalize(Force: true); - } - - internal T GetSecondaryTranslatedObj(ref string mainTranslation, ref string secondaryTranslation) where T : UnityEngine.Object - { - DeserializeTranslation(mainTranslation, out var value, out var secondary); - T val = null; - if (!string.IsNullOrEmpty(secondary)) - { - val = GetObject(secondary); - if ((UnityEngine.Object)val != (UnityEngine.Object)null) - { - mainTranslation = value; - secondaryTranslation = secondary; - } - } - if ((UnityEngine.Object)val == (UnityEngine.Object)null) - { - val = GetObject(secondaryTranslation); - } - return val; - } - - public void UpdateAssetDictionary() - { - TranslatedObjects.RemoveAll((UnityEngine.Object x) => x == null); - mAssetDictionary = (from o in TranslatedObjects.Distinct() - group o by o.name).ToDictionary((IGrouping g) => g.Key, (IGrouping g) => g.First()); - } - - internal T GetObject(string Translation) where T : UnityEngine.Object - { - if (string.IsNullOrEmpty(Translation)) - { - return null; - } - return GetTranslatedObject(Translation); - } - - private T GetTranslatedObject(string Translation) where T : UnityEngine.Object - { - return FindTranslatedObject(Translation); - } - - private void DeserializeTranslation(string translation, out string value, out string secondary) - { - if (!string.IsNullOrEmpty(translation) && translation.Length > 1 && translation[0] == '[') - { - int num = translation.IndexOf(']'); - if (num > 0) - { - secondary = translation.Substring(1, num - 1); - value = translation.Substring(num + 1); - return; - } - } - value = translation; - secondary = string.Empty; - } - - public T FindTranslatedObject(string value) where T : UnityEngine.Object - { - if (string.IsNullOrEmpty(value)) - { - return null; - } - if (mAssetDictionary == null || mAssetDictionary.Count != TranslatedObjects.Count) - { - UpdateAssetDictionary(); - } - foreach (KeyValuePair item in mAssetDictionary) - { - if (item.Value is T && value.EndsWith(item.Key, StringComparison.OrdinalIgnoreCase) && string.Compare(value, item.Key, StringComparison.OrdinalIgnoreCase) == 0) - { - return (T)item.Value; - } - } - T val = LocalizationManager.FindAsset(value) as T; - if ((bool)(UnityEngine.Object)val) - { - return val; - } - return ResourceManager.pInstance.GetAsset(value); - } - - public bool HasTranslatedObject(UnityEngine.Object Obj) - { - if (TranslatedObjects.Contains(Obj)) - { - return true; - } - return ResourceManager.pInstance.HasAsset(Obj); - } - - public void AddTranslatedObject(UnityEngine.Object Obj) - { - if (!TranslatedObjects.Contains(Obj)) - { - TranslatedObjects.Add(Obj); - UpdateAssetDictionary(); - } - } - - public void SetGlobalLanguage(string Language) - { - LocalizationManager.CurrentLanguage = Language; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeDropdown.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeDropdown.cs deleted file mode 100644 index 57fd328..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeDropdown.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using TMPro; -using UnityEngine; -using UnityEngine.UI; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/Localize Dropdown")] -public class LocalizeDropdown : MonoBehaviour -{ - public List _Terms = new List(); - - public void Start() - { - LocalizationManager.OnLocalizeEvent += OnLocalize; - OnLocalize(); - } - - public void OnDestroy() - { - LocalizationManager.OnLocalizeEvent -= OnLocalize; - } - - private void OnEnable() - { - if (_Terms.Count == 0) - { - FillValues(); - } - OnLocalize(); - } - - public void OnLocalize() - { - if (base.enabled && !(base.gameObject == null) && base.gameObject.activeInHierarchy && !string.IsNullOrEmpty(LocalizationManager.CurrentLanguage)) - { - UpdateLocalization(); - } - } - - private void FillValues() - { - Dropdown component = GetComponent(); - if (component == null && I2Utils.IsPlaying()) - { - FillValuesTMPro(); - return; - } - foreach (Dropdown.OptionData option in component.options) - { - _Terms.Add(option.text); - } - } - - public void UpdateLocalization() - { - Dropdown component = GetComponent(); - if (component == null) - { - UpdateLocalizationTMPro(); - return; - } - component.options.Clear(); - foreach (string term in _Terms) - { - string text = TextTranslator.Translate(term); - component.options.Add(new Dropdown.OptionData(text)); - } - component.RefreshShownValue(); - } - - public void UpdateLocalizationTMPro() - { - TMP_Dropdown component = GetComponent(); - if (component == null) - { - return; - } - component.options.Clear(); - foreach (string term in _Terms) - { - string text = TextTranslator.Translate(term); - component.options.Add(new TMP_Dropdown.OptionData(text)); - } - component.RefreshShownValue(); - } - - private void FillValuesTMPro() - { - TMP_Dropdown component = GetComponent(); - if (component == null) - { - return; - } - foreach (TMP_Dropdown.OptionData option in component.options) - { - _Terms.Add(option.text); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget.cs deleted file mode 100644 index a746e60..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget.cs +++ /dev/null @@ -1,25 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public abstract class LocalizeTarget : ILocalizeTarget where T : Object -{ - public T mTarget; - - public override bool IsValid(Localize cmp) - { - if ((Object)mTarget != (Object)null) - { - Component component = mTarget as Component; - if (component != null && component.gameObject != cmp.gameObject) - { - mTarget = null; - } - } - if ((Object)mTarget == (Object)null) - { - mTarget = cmp.GetComponent(); - } - return (Object)mTarget != (Object)null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc.cs deleted file mode 100644 index 44f67b2..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using UnityEngine; - -namespace I2.Loc; - -public abstract class LocalizeTargetDesc : ILocalizeTargetDescriptor where T : ILocalizeTarget -{ - public override ILocalizeTarget CreateTarget(Localize cmp) - { - return ScriptableObject.CreateInstance(); - } - - public override Type GetTargetType() - { - return typeof(T); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Child.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Child.cs deleted file mode 100644 index e8401c7..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Child.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace I2.Loc; - -public class LocalizeTargetDesc_Child : LocalizeTargetDesc -{ - public override bool CanLocalize(Localize cmp) - { - return cmp.transform.childCount > 1; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Prefab.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Prefab.cs deleted file mode 100644 index ee10200..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Prefab.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace I2.Loc; - -public class LocalizeTargetDesc_Prefab : LocalizeTargetDesc -{ - public override bool CanLocalize(Localize cmp) - { - return true; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Type.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Type.cs deleted file mode 100644 index 5ee9dba..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTargetDesc_Type.cs +++ /dev/null @@ -1,23 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTargetDesc_Type : LocalizeTargetDesc where T : Object where G : LocalizeTarget -{ - public override bool CanLocalize(Localize cmp) - { - return (Object)cmp.GetComponent() != (Object)null; - } - - public override ILocalizeTarget CreateTarget(Localize cmp) - { - T component = cmp.GetComponent(); - if ((Object)component == (Object)null) - { - return null; - } - G val = ScriptableObject.CreateInstance(); - val.mTarget = component; - return val; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_Label.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_Label.cs deleted file mode 100644 index 6802642..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_Label.cs +++ /dev/null @@ -1,257 +0,0 @@ -using System; -using TMPro; -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_TextMeshPro_Label : LocalizeTarget -{ - private TextAlignmentOptions mAlignment_RTL = TextAlignmentOptions.Right; - - private TextAlignmentOptions mAlignment_LTR = TextAlignmentOptions.Left; - - private bool mAlignmentWasRTL; - - private bool mInitializeAlignment = true; - - static LocalizeTarget_TextMeshPro_Label() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "TextMeshPro Label", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Font; - } - - public override bool CanUseSecondaryTerm() - { - return true; - } - - public override bool AllowMainTermToBeRTL() - { - return true; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = (mTarget ? mTarget.text : null); - secondaryTerm = ((mTarget.font != null) ? mTarget.font.name : string.Empty); - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - TMP_FontAsset secondaryTranslatedObj = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj != null) - { - SetFont(mTarget, secondaryTranslatedObj); - } - else - { - Material secondaryTranslatedObj2 = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj2 != null && mTarget.fontMaterial != secondaryTranslatedObj2) - { - if (!secondaryTranslatedObj2.name.StartsWith(mTarget.font.name, StringComparison.Ordinal)) - { - secondaryTranslatedObj = GetTMPFontFromMaterial(cmp, secondaryTranslation.EndsWith(secondaryTranslatedObj2.name, StringComparison.Ordinal) ? secondaryTranslation : secondaryTranslatedObj2.name); - if (secondaryTranslatedObj != null) - { - SetFont(mTarget, secondaryTranslatedObj); - } - } - SetMaterial(mTarget, secondaryTranslatedObj2); - } - } - if (mInitializeAlignment) - { - mInitializeAlignment = false; - mAlignmentWasRTL = LocalizationManager.IsRight2Left; - InitAlignment_TMPro(mAlignmentWasRTL, mTarget.alignment, out mAlignment_LTR, out mAlignment_RTL); - } - else - { - InitAlignment_TMPro(mAlignmentWasRTL, mTarget.alignment, out var alignLTR, out var alignRTL); - if ((mAlignmentWasRTL && mAlignment_RTL != alignRTL) || (!mAlignmentWasRTL && mAlignment_LTR != alignLTR)) - { - mAlignment_LTR = alignLTR; - mAlignment_RTL = alignRTL; - } - mAlignmentWasRTL = LocalizationManager.IsRight2Left; - } - if (mainTranslation != null && mTarget.text != mainTranslation) - { - if (cmp.CorrectAlignmentForRTL) - { - mTarget.alignment = (LocalizationManager.IsRight2Left ? mAlignment_RTL : mAlignment_LTR); - } - mTarget.isRightToLeftText = LocalizationManager.IsRight2Left; - if (LocalizationManager.IsRight2Left) - { - mainTranslation = I2Utils.ReverseText(mainTranslation); - } - mTarget.text = mainTranslation; - } - } - - internal static TMP_FontAsset GetTMPFontFromMaterial(Localize cmp, string matName) - { - string text = " .\\/-[]()"; - int num = matName.Length - 1; - while (num > 0) - { - while (num > 0 && text.IndexOf(matName[num]) >= 0) - { - num--; - } - if (num <= 0) - { - break; - } - string translation = matName.Substring(0, num + 1); - TMP_FontAsset @object = cmp.GetObject(translation); - if (@object != null) - { - return @object; - } - while (num > 0 && text.IndexOf(matName[num]) < 0) - { - num--; - } - } - return null; - } - - internal static void InitAlignment_TMPro(bool isRTL, TextAlignmentOptions alignment, out TextAlignmentOptions alignLTR, out TextAlignmentOptions alignRTL) - { - alignLTR = (alignRTL = alignment); - if (isRTL) - { - switch (alignment) - { - case TextAlignmentOptions.TopRight: - alignLTR = TextAlignmentOptions.TopLeft; - break; - case TextAlignmentOptions.Right: - alignLTR = TextAlignmentOptions.Left; - break; - case TextAlignmentOptions.BottomRight: - alignLTR = TextAlignmentOptions.BottomLeft; - break; - case TextAlignmentOptions.BaselineRight: - alignLTR = TextAlignmentOptions.BaselineLeft; - break; - case TextAlignmentOptions.MidlineRight: - alignLTR = TextAlignmentOptions.MidlineLeft; - break; - case TextAlignmentOptions.CaplineRight: - alignLTR = TextAlignmentOptions.CaplineLeft; - break; - case TextAlignmentOptions.TopLeft: - alignLTR = TextAlignmentOptions.TopRight; - break; - case TextAlignmentOptions.Left: - alignLTR = TextAlignmentOptions.Right; - break; - case TextAlignmentOptions.BottomLeft: - alignLTR = TextAlignmentOptions.BottomRight; - break; - case TextAlignmentOptions.BaselineLeft: - alignLTR = TextAlignmentOptions.BaselineRight; - break; - case TextAlignmentOptions.MidlineLeft: - alignLTR = TextAlignmentOptions.MidlineRight; - break; - case TextAlignmentOptions.CaplineLeft: - alignLTR = TextAlignmentOptions.CaplineRight; - break; - } - } - else - { - switch (alignment) - { - case TextAlignmentOptions.TopRight: - alignRTL = TextAlignmentOptions.TopLeft; - break; - case TextAlignmentOptions.Right: - alignRTL = TextAlignmentOptions.Left; - break; - case TextAlignmentOptions.BottomRight: - alignRTL = TextAlignmentOptions.BottomLeft; - break; - case TextAlignmentOptions.BaselineRight: - alignRTL = TextAlignmentOptions.BaselineLeft; - break; - case TextAlignmentOptions.MidlineRight: - alignRTL = TextAlignmentOptions.MidlineLeft; - break; - case TextAlignmentOptions.CaplineRight: - alignRTL = TextAlignmentOptions.CaplineLeft; - break; - case TextAlignmentOptions.TopLeft: - alignRTL = TextAlignmentOptions.TopRight; - break; - case TextAlignmentOptions.Left: - alignRTL = TextAlignmentOptions.Right; - break; - case TextAlignmentOptions.BottomLeft: - alignRTL = TextAlignmentOptions.BottomRight; - break; - case TextAlignmentOptions.BaselineLeft: - alignRTL = TextAlignmentOptions.BaselineRight; - break; - case TextAlignmentOptions.MidlineLeft: - alignRTL = TextAlignmentOptions.MidlineRight; - break; - case TextAlignmentOptions.CaplineLeft: - alignRTL = TextAlignmentOptions.CaplineRight; - break; - } - } - } - - internal static void SetFont(TMP_Text label, TMP_FontAsset newFont) - { - if (label.font != newFont) - { - label.font = newFont; - } - if (label.linkedTextComponent != null) - { - SetFont(label.linkedTextComponent, newFont); - } - } - - internal static void SetMaterial(TMP_Text label, Material newMat) - { - if (label.fontSharedMaterial != newMat) - { - label.fontSharedMaterial = newMat; - } - if (label.linkedTextComponent != null) - { - SetMaterial(label.linkedTextComponent, newMat); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_UGUI.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_UGUI.cs deleted file mode 100644 index e2f3d7d..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_TextMeshPro_UGUI.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using TMPro; -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_TextMeshPro_UGUI : LocalizeTarget -{ - public TextAlignmentOptions mAlignment_RTL = TextAlignmentOptions.Right; - - public TextAlignmentOptions mAlignment_LTR = TextAlignmentOptions.Left; - - public bool mAlignmentWasRTL; - - public bool mInitializeAlignment = true; - - static LocalizeTarget_TextMeshPro_UGUI() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "TextMeshPro UGUI", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.TextMeshPFont; - } - - public override bool CanUseSecondaryTerm() - { - return true; - } - - public override bool AllowMainTermToBeRTL() - { - return true; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = (mTarget ? mTarget.text : null); - secondaryTerm = ((mTarget.font != null) ? mTarget.font.name : string.Empty); - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - TMP_FontAsset secondaryTranslatedObj = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj != null) - { - LocalizeTarget_TextMeshPro_Label.SetFont(mTarget, secondaryTranslatedObj); - } - else - { - Material secondaryTranslatedObj2 = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj2 != null && mTarget.fontMaterial != secondaryTranslatedObj2) - { - if (!secondaryTranslatedObj2.name.StartsWith(mTarget.font.name, StringComparison.Ordinal)) - { - secondaryTranslatedObj = LocalizeTarget_TextMeshPro_Label.GetTMPFontFromMaterial(cmp, secondaryTranslation.EndsWith(secondaryTranslatedObj2.name, StringComparison.Ordinal) ? secondaryTranslation : secondaryTranslatedObj2.name); - if (secondaryTranslatedObj != null) - { - LocalizeTarget_TextMeshPro_Label.SetFont(mTarget, secondaryTranslatedObj); - } - } - LocalizeTarget_TextMeshPro_Label.SetMaterial(mTarget, secondaryTranslatedObj2); - } - } - if (mInitializeAlignment) - { - mInitializeAlignment = false; - mAlignmentWasRTL = LocalizationManager.IsRight2Left; - LocalizeTarget_TextMeshPro_Label.InitAlignment_TMPro(mAlignmentWasRTL, mTarget.alignment, out mAlignment_LTR, out mAlignment_RTL); - } - else - { - LocalizeTarget_TextMeshPro_Label.InitAlignment_TMPro(mAlignmentWasRTL, mTarget.alignment, out var alignLTR, out var alignRTL); - if ((mAlignmentWasRTL && mAlignment_RTL != alignRTL) || (!mAlignmentWasRTL && mAlignment_LTR != alignLTR)) - { - mAlignment_LTR = alignLTR; - mAlignment_RTL = alignRTL; - } - mAlignmentWasRTL = LocalizationManager.IsRight2Left; - } - if (mainTranslation != null && mTarget.text != mainTranslation) - { - if (cmp.CorrectAlignmentForRTL) - { - mTarget.alignment = (LocalizationManager.IsRight2Left ? mAlignment_RTL : mAlignment_LTR); - } - mTarget.isRightToLeftText = LocalizationManager.IsRight2Left; - if (LocalizationManager.IsRight2Left) - { - mainTranslation = I2Utils.ReverseText(mainTranslation); - } - mTarget.text = mainTranslation; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_AudioSource.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_AudioSource.cs deleted file mode 100644 index b540830..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_AudioSource.cs +++ /dev/null @@ -1,68 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_AudioSource : LocalizeTarget -{ - static LocalizeTarget_UnityStandard_AudioSource() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "AudioSource", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.AudioClip; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - AudioClip clip = mTarget.clip; - primaryTerm = (clip ? clip.name : string.Empty); - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - bool num = (mTarget.isPlaying || mTarget.loop) && Application.isPlaying; - AudioClip clip = mTarget.clip; - AudioClip audioClip = cmp.FindTranslatedObject(mainTranslation); - if (clip != audioClip) - { - mTarget.clip = audioClip; - } - if (num && (bool)mTarget.clip) - { - mTarget.Play(); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Child.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Child.cs deleted file mode 100644 index da89189..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Child.cs +++ /dev/null @@ -1,76 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_Child : LocalizeTarget -{ - static LocalizeTarget_UnityStandard_Child() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Child - { - Name = "Child", - Priority = 200 - }); - } - - public override bool IsValid(Localize cmp) - { - return cmp.transform.childCount > 1; - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.GameObject; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = cmp.name; - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - if (!string.IsNullOrEmpty(mainTranslation)) - { - Transform transform = cmp.transform; - string text = mainTranslation; - int num = mainTranslation.LastIndexOfAny(LanguageSourceData.CategorySeparators); - if (num >= 0) - { - text = text.Substring(num + 1); - } - for (int i = 0; i < transform.childCount; i++) - { - Transform child = transform.GetChild(i); - child.gameObject.SetActive(child.name == text); - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_MeshRenderer.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_MeshRenderer.cs deleted file mode 100644 index 07cbecd..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_MeshRenderer.cs +++ /dev/null @@ -1,89 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_MeshRenderer : LocalizeTarget -{ - static LocalizeTarget_UnityStandard_MeshRenderer() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "MeshRenderer", - Priority = 800 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Mesh; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Material; - } - - public override bool CanUseSecondaryTerm() - { - return true; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - if (mTarget == null) - { - primaryTerm = (secondaryTerm = null); - } - else - { - MeshFilter component = mTarget.GetComponent(); - if (component == null || component.sharedMesh == null) - { - primaryTerm = null; - } - else - { - primaryTerm = component.sharedMesh.name; - } - } - if (mTarget == null || mTarget.sharedMaterial == null) - { - secondaryTerm = null; - } - else - { - secondaryTerm = mTarget.sharedMaterial.name; - } - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - Material secondaryTranslatedObj = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj != null && mTarget.sharedMaterial != secondaryTranslatedObj) - { - mTarget.material = secondaryTranslatedObj; - } - Mesh mesh = cmp.FindTranslatedObject(mainTranslation); - MeshFilter component = mTarget.GetComponent(); - if (mesh != null && component.sharedMesh != mesh) - { - component.mesh = mesh; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Prefab.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Prefab.cs deleted file mode 100644 index a4c9d7e..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_Prefab.cs +++ /dev/null @@ -1,108 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_Prefab : LocalizeTarget -{ - static LocalizeTarget_UnityStandard_Prefab() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Prefab - { - Name = "Prefab", - Priority = 250 - }); - } - - public override bool IsValid(Localize cmp) - { - return true; - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.GameObject; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = cmp.name; - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - if (string.IsNullOrEmpty(mainTranslation) || ((bool)mTarget && mTarget.name == mainTranslation)) - { - return; - } - Transform transform = cmp.transform; - string text = mainTranslation; - int num = mainTranslation.LastIndexOfAny(LanguageSourceData.CategorySeparators); - if (num >= 0) - { - text = text.Substring(num + 1); - } - Transform transform2 = InstantiateNewPrefab(cmp, mainTranslation); - if (transform2 == null) - { - return; - } - transform2.name = text; - for (int num2 = transform.childCount - 1; num2 >= 0; num2--) - { - Transform child = transform.GetChild(num2); - if (child != transform2) - { - Object.Destroy(child.gameObject); - } - } - } - - private Transform InstantiateNewPrefab(Localize cmp, string mainTranslation) - { - GameObject gameObject = cmp.FindTranslatedObject(mainTranslation); - if (gameObject == null) - { - return null; - } - GameObject gameObject2 = mTarget; - mTarget = Object.Instantiate(gameObject); - if (mTarget == null) - { - return null; - } - Transform transform = cmp.transform; - Transform transform2 = mTarget.transform; - transform2.SetParent(transform); - Transform transform3 = (gameObject2 ? gameObject2.transform : transform); - transform2.rotation = transform3.rotation; - transform2.position = transform3.position; - return transform2; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_SpriteRenderer.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_SpriteRenderer.cs deleted file mode 100644 index 3acb521..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_SpriteRenderer.cs +++ /dev/null @@ -1,62 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_SpriteRenderer : LocalizeTarget -{ - static LocalizeTarget_UnityStandard_SpriteRenderer() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "SpriteRenderer", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Sprite; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - Sprite sprite = mTarget.sprite; - primaryTerm = ((sprite != null) ? sprite.name : string.Empty); - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - Sprite sprite = mTarget.sprite; - if (sprite == null || sprite.name != mainTranslation) - { - mTarget.sprite = cmp.FindTranslatedObject(mainTranslation); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_TextMesh.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_TextMesh.cs deleted file mode 100644 index 4f3e629..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_TextMesh.cs +++ /dev/null @@ -1,92 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_TextMesh : LocalizeTarget -{ - private TextAlignment mAlignment_RTL = TextAlignment.Right; - - private TextAlignment mAlignment_LTR; - - private bool mAlignmentWasRTL; - - private bool mInitializeAlignment = true; - - static LocalizeTarget_UnityStandard_TextMesh() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "TextMesh", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Font; - } - - public override bool CanUseSecondaryTerm() - { - return true; - } - - public override bool AllowMainTermToBeRTL() - { - return true; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = (mTarget ? mTarget.text : null); - secondaryTerm = ((string.IsNullOrEmpty(Secondary) && mTarget.font != null) ? mTarget.font.name : null); - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - Font secondaryTranslatedObj = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj != null && mTarget.font != secondaryTranslatedObj) - { - mTarget.font = secondaryTranslatedObj; - mTarget.GetComponentInChildren().material = secondaryTranslatedObj.material; - } - if (mInitializeAlignment) - { - mInitializeAlignment = false; - mAlignment_LTR = (mAlignment_RTL = mTarget.alignment); - if (LocalizationManager.IsRight2Left && mAlignment_RTL == TextAlignment.Right) - { - mAlignment_LTR = TextAlignment.Left; - } - if (!LocalizationManager.IsRight2Left && mAlignment_LTR == TextAlignment.Left) - { - mAlignment_RTL = TextAlignment.Right; - } - } - if (mainTranslation != null && mTarget.text != mainTranslation) - { - if (cmp.CorrectAlignmentForRTL && mTarget.alignment != TextAlignment.Center) - { - mTarget.alignment = (LocalizationManager.IsRight2Left ? mAlignment_RTL : mAlignment_LTR); - } - mTarget.font.RequestCharactersInTexture(mainTranslation); - mTarget.text = mainTranslation; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_VideoPlayer.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_VideoPlayer.cs deleted file mode 100644 index fb2b0a0..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityStandard_VideoPlayer.cs +++ /dev/null @@ -1,63 +0,0 @@ -using UnityEngine; -using UnityEngine.Video; - -namespace I2.Loc; - -public class LocalizeTarget_UnityStandard_VideoPlayer : LocalizeTarget -{ - static LocalizeTarget_UnityStandard_VideoPlayer() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "VideoPlayer", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Video; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - VideoClip clip = mTarget.clip; - primaryTerm = ((clip != null) ? clip.name : string.Empty); - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - VideoClip clip = mTarget.clip; - if (clip == null || clip.name != mainTranslation) - { - mTarget.clip = cmp.FindTranslatedObject(mainTranslation); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Image.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Image.cs deleted file mode 100644 index 4270743..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Image.cs +++ /dev/null @@ -1,70 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -namespace I2.Loc; - -public class LocalizeTarget_UnityUI_Image : LocalizeTarget -{ - static LocalizeTarget_UnityUI_Image() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "Image", - Priority = 100 - }); - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - if (!(mTarget.sprite == null)) - { - return eTermType.Sprite; - } - return eTermType.Texture; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = (mTarget.mainTexture ? mTarget.mainTexture.name : ""); - if (mTarget.sprite != null && mTarget.sprite.name != primaryTerm) - { - primaryTerm = primaryTerm + "." + mTarget.sprite.name; - } - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - Sprite sprite = mTarget.sprite; - if (sprite == null || sprite.name != mainTranslation) - { - mTarget.sprite = cmp.FindTranslatedObject(mainTranslation); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_RawImage.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_RawImage.cs deleted file mode 100644 index 3275190..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_RawImage.cs +++ /dev/null @@ -1,62 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -namespace I2.Loc; - -public class LocalizeTarget_UnityUI_RawImage : LocalizeTarget -{ - static LocalizeTarget_UnityUI_RawImage() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "RawImage", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Texture; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override bool CanUseSecondaryTerm() - { - return false; - } - - public override bool AllowMainTermToBeRTL() - { - return false; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = (mTarget.mainTexture ? mTarget.mainTexture.name : ""); - secondaryTerm = null; - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - Texture texture = mTarget.texture; - if (texture == null || texture.name != mainTranslation) - { - mTarget.texture = cmp.FindTranslatedObject(mainTranslation); - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Text.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Text.cs deleted file mode 100644 index ab26e0d..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizeTarget_UnityUI_Text.cs +++ /dev/null @@ -1,156 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -namespace I2.Loc; - -public class LocalizeTarget_UnityUI_Text : LocalizeTarget -{ - private TextAnchor mAlignment_RTL = TextAnchor.UpperRight; - - private TextAnchor mAlignment_LTR; - - private bool mAlignmentWasRTL; - - private bool mInitializeAlignment = true; - - static LocalizeTarget_UnityUI_Text() - { - AutoRegister(); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void AutoRegister() - { - LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type - { - Name = "Text", - Priority = 100 - }); - } - - public override eTermType GetPrimaryTermType(Localize cmp) - { - return eTermType.Text; - } - - public override eTermType GetSecondaryTermType(Localize cmp) - { - return eTermType.Font; - } - - public override bool CanUseSecondaryTerm() - { - return true; - } - - public override bool AllowMainTermToBeRTL() - { - return true; - } - - public override bool AllowSecondTermToBeRTL() - { - return false; - } - - public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm) - { - primaryTerm = (mTarget ? mTarget.text : null); - secondaryTerm = ((mTarget.font != null) ? mTarget.font.name : string.Empty); - } - - public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation) - { - Font secondaryTranslatedObj = cmp.GetSecondaryTranslatedObj(ref mainTranslation, ref secondaryTranslation); - if (secondaryTranslatedObj != null && secondaryTranslatedObj != mTarget.font) - { - mTarget.font = secondaryTranslatedObj; - } - if (mInitializeAlignment) - { - mInitializeAlignment = false; - mAlignmentWasRTL = LocalizationManager.IsRight2Left; - InitAlignment(mAlignmentWasRTL, mTarget.alignment, out mAlignment_LTR, out mAlignment_RTL); - } - else - { - InitAlignment(mAlignmentWasRTL, mTarget.alignment, out var alignLTR, out var alignRTL); - if ((mAlignmentWasRTL && mAlignment_RTL != alignRTL) || (!mAlignmentWasRTL && mAlignment_LTR != alignLTR)) - { - mAlignment_LTR = alignLTR; - mAlignment_RTL = alignRTL; - } - mAlignmentWasRTL = LocalizationManager.IsRight2Left; - } - if (mainTranslation != null && mTarget.text != mainTranslation) - { - if (cmp.CorrectAlignmentForRTL) - { - mTarget.alignment = (LocalizationManager.IsRight2Left ? mAlignment_RTL : mAlignment_LTR); - } - mTarget.text = mainTranslation; - mTarget.SetVerticesDirty(); - } - } - - private void InitAlignment(bool isRTL, TextAnchor alignment, out TextAnchor alignLTR, out TextAnchor alignRTL) - { - alignLTR = (alignRTL = alignment); - if (isRTL) - { - switch (alignment) - { - case TextAnchor.UpperRight: - alignLTR = TextAnchor.UpperLeft; - break; - case TextAnchor.MiddleRight: - alignLTR = TextAnchor.MiddleLeft; - break; - case TextAnchor.LowerRight: - alignLTR = TextAnchor.LowerLeft; - break; - case TextAnchor.UpperLeft: - alignLTR = TextAnchor.UpperRight; - break; - case TextAnchor.MiddleLeft: - alignLTR = TextAnchor.MiddleRight; - break; - case TextAnchor.LowerLeft: - alignLTR = TextAnchor.LowerRight; - break; - case TextAnchor.UpperCenter: - case TextAnchor.MiddleCenter: - case TextAnchor.LowerCenter: - break; - } - } - else - { - switch (alignment) - { - case TextAnchor.UpperRight: - alignRTL = TextAnchor.UpperLeft; - break; - case TextAnchor.MiddleRight: - alignRTL = TextAnchor.MiddleLeft; - break; - case TextAnchor.LowerRight: - alignRTL = TextAnchor.LowerLeft; - break; - case TextAnchor.UpperLeft: - alignRTL = TextAnchor.UpperRight; - break; - case TextAnchor.MiddleLeft: - alignRTL = TextAnchor.MiddleRight; - break; - case TextAnchor.LowerLeft: - alignRTL = TextAnchor.LowerRight; - break; - case TextAnchor.UpperCenter: - case TextAnchor.MiddleCenter: - case TextAnchor.LowerCenter: - break; - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/LocalizedString.cs b/Thronefall_1_57/Thronefall/I2.Loc/LocalizedString.cs deleted file mode 100644 index 51ff195..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/LocalizedString.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; - -namespace I2.Loc; - -[Serializable] -public struct LocalizedString -{ - public string mTerm; - - public bool mRTL_IgnoreArabicFix; - - public int mRTL_MaxLineLength; - - public bool mRTL_ConvertNumbers; - - public bool m_DontLocalizeParameters; - - public static implicit operator string(LocalizedString s) - { - return s.ToString(); - } - - public static implicit operator LocalizedString(string term) - { - LocalizedString result = default(LocalizedString); - result.mTerm = term; - return result; - } - - public LocalizedString(LocalizedString str) - { - mTerm = str.mTerm; - mRTL_IgnoreArabicFix = str.mRTL_IgnoreArabicFix; - mRTL_MaxLineLength = str.mRTL_MaxLineLength; - mRTL_ConvertNumbers = str.mRTL_ConvertNumbers; - m_DontLocalizeParameters = str.m_DontLocalizeParameters; - } - - public override string ToString() - { - string translation = TextTranslator.Translate(mTerm, !mRTL_IgnoreArabicFix, mRTL_MaxLineLength, !mRTL_ConvertNumbers); - LocalizationManager.ApplyLocalizationParams(ref translation, !m_DontLocalizeParameters); - return translation; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/PersistentStorage.cs b/Thronefall_1_57/Thronefall/I2.Loc/PersistentStorage.cs deleted file mode 100644 index 37854fd..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/PersistentStorage.cs +++ /dev/null @@ -1,104 +0,0 @@ -namespace I2.Loc; - -public static class PersistentStorage -{ - public enum eFileType - { - Raw, - Persistent, - Temporal, - Streaming - } - - private static I2CustomPersistentStorage mStorage; - - public static void SetSetting_String(string key, string value) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - mStorage.SetSetting_String(key, value); - } - - public static string GetSetting_String(string key, string defaultValue) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.GetSetting_String(key, defaultValue); - } - - public static void DeleteSetting(string key) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - mStorage.DeleteSetting(key); - } - - public static bool HasSetting(string key) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.HasSetting(key); - } - - public static void ForceSaveSettings() - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - mStorage.ForceSaveSettings(); - } - - public static bool CanAccessFiles() - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.CanAccessFiles(); - } - - public static bool SaveFile(eFileType fileType, string fileName, string data, bool logExceptions = true) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.SaveFile(fileType, fileName, data, logExceptions); - } - - public static string LoadFile(eFileType fileType, string fileName, bool logExceptions = true) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.LoadFile(fileType, fileName, logExceptions); - } - - public static bool DeleteFile(eFileType fileType, string fileName, bool logExceptions = true) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.DeleteFile(fileType, fileName, logExceptions); - } - - public static bool HasFile(eFileType fileType, string fileName, bool logExceptions = true) - { - if (mStorage == null) - { - mStorage = new I2CustomPersistentStorage(); - } - return mStorage.HasFile(fileType, fileName, logExceptions); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/RTLFixer.cs b/Thronefall_1_57/Thronefall/I2.Loc/RTLFixer.cs deleted file mode 100644 index 56ccb8b..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/RTLFixer.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; - -namespace I2.Loc; - -public class RTLFixer -{ - public static string Fix(string str) - { - return Fix(str, showTashkeel: false, useHinduNumbers: true); - } - - public static string Fix(string str, bool rtl) - { - if (rtl) - { - return Fix(str); - } - string[] array = str.Split(' '); - string text = ""; - string text2 = ""; - string[] array2 = array; - foreach (string text3 in array2) - { - if (char.IsLower(text3.ToLower()[text3.Length / 2])) - { - text = text + Fix(text2) + text3 + " "; - text2 = ""; - } - else - { - text2 = text2 + text3 + " "; - } - } - if (text2 != "") - { - text += Fix(text2); - } - return text; - } - - public static string Fix(string str, bool showTashkeel, bool useHinduNumbers) - { - string text = HindiFixer.Fix(str); - if (text != str) - { - return text; - } - RTLFixerTool.showTashkeel = showTashkeel; - RTLFixerTool.useHinduNumbers = useHinduNumbers; - if (str.Contains("\n")) - { - str = str.Replace("\n", Environment.NewLine); - } - if (str.Contains(Environment.NewLine)) - { - string[] separator = new string[1] { Environment.NewLine }; - string[] array = str.Split(separator, StringSplitOptions.None); - if (array.Length == 0) - { - return RTLFixerTool.FixLine(str); - } - if (array.Length == 1) - { - return RTLFixerTool.FixLine(str); - } - string text2 = RTLFixerTool.FixLine(array[0]); - int i = 1; - if (array.Length > 1) - { - for (; i < array.Length; i++) - { - text2 = text2 + Environment.NewLine + RTLFixerTool.FixLine(array[i]); - } - } - return text2; - } - return RTLFixerTool.FixLine(str); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/RTLFixerTool.cs b/Thronefall_1_57/Thronefall/I2.Loc/RTLFixerTool.cs deleted file mode 100644 index c0a9b27..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/RTLFixerTool.cs +++ /dev/null @@ -1,404 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace I2.Loc; - -internal class RTLFixerTool -{ - internal static bool showTashkeel = true; - - internal static bool useHinduNumbers; - - internal static string RemoveTashkeel(string str, out List tashkeelLocation) - { - tashkeelLocation = new List(); - char[] array = str.ToCharArray(); - int num = 0; - for (int i = 0; i < array.Length; i++) - { - if (array[i] == '\u064b') - { - tashkeelLocation.Add(new TashkeelLocation('\u064b', i)); - num++; - } - else if (array[i] == '\u064c') - { - tashkeelLocation.Add(new TashkeelLocation('\u064c', i)); - num++; - } - else if (array[i] == '\u064d') - { - tashkeelLocation.Add(new TashkeelLocation('\u064d', i)); - num++; - } - else if (array[i] == '\u064e') - { - if (num > 0 && tashkeelLocation[num - 1].tashkeel == '\u0651') - { - tashkeelLocation[num - 1].tashkeel = 'ﱠ'; - continue; - } - tashkeelLocation.Add(new TashkeelLocation('\u064e', i)); - num++; - } - else if (array[i] == '\u064f') - { - if (num > 0 && tashkeelLocation[num - 1].tashkeel == '\u0651') - { - tashkeelLocation[num - 1].tashkeel = 'ﱡ'; - continue; - } - tashkeelLocation.Add(new TashkeelLocation('\u064f', i)); - num++; - } - else if (array[i] == '\u0650') - { - if (num > 0 && tashkeelLocation[num - 1].tashkeel == '\u0651') - { - tashkeelLocation[num - 1].tashkeel = 'ﱢ'; - continue; - } - tashkeelLocation.Add(new TashkeelLocation('\u0650', i)); - num++; - } - else if (array[i] == '\u0651') - { - if (num > 0) - { - if (tashkeelLocation[num - 1].tashkeel == '\u064e') - { - tashkeelLocation[num - 1].tashkeel = 'ﱠ'; - continue; - } - if (tashkeelLocation[num - 1].tashkeel == '\u064f') - { - tashkeelLocation[num - 1].tashkeel = 'ﱡ'; - continue; - } - if (tashkeelLocation[num - 1].tashkeel == '\u0650') - { - tashkeelLocation[num - 1].tashkeel = 'ﱢ'; - continue; - } - } - tashkeelLocation.Add(new TashkeelLocation('\u0651', i)); - num++; - } - else if (array[i] == '\u0652') - { - tashkeelLocation.Add(new TashkeelLocation('\u0652', i)); - num++; - } - else if (array[i] == '\u0653') - { - tashkeelLocation.Add(new TashkeelLocation('\u0653', i)); - num++; - } - } - string[] array2 = str.Split('\u064b', '\u064c', '\u064d', '\u064e', '\u064f', '\u0650', '\u0651', '\u0652', '\u0653', 'ﱠ', 'ﱡ', 'ﱢ'); - str = ""; - string[] array3 = array2; - foreach (string text in array3) - { - str += text; - } - return str; - } - - internal static char[] ReturnTashkeel(char[] letters, List tashkeelLocation) - { - char[] array = new char[letters.Length + tashkeelLocation.Count]; - int num = 0; - for (int i = 0; i < letters.Length; i++) - { - array[num] = letters[i]; - num++; - foreach (TashkeelLocation item in tashkeelLocation) - { - if (item.position == num) - { - array[num] = item.tashkeel; - num++; - } - } - } - return array; - } - - internal static string FixLine(string str) - { - string text = ""; - List tashkeelLocation; - string text2 = RemoveTashkeel(str, out tashkeelLocation); - char[] array = text2.ToCharArray(); - char[] array2 = text2.ToCharArray(); - for (int i = 0; i < array.Length; i++) - { - array[i] = (char)ArabicTable.ArabicMapper.Convert(array[i]); - } - for (int j = 0; j < array.Length; j++) - { - bool flag = false; - if (array[j] == 'ﻝ' && j < array.Length - 1) - { - if (array[j + 1] == 'ﺇ') - { - array[j] = 'ﻷ'; - array2[j + 1] = '\uffff'; - flag = true; - } - else if (array[j + 1] == 'ﺍ') - { - array[j] = 'ﻹ'; - array2[j + 1] = '\uffff'; - flag = true; - } - else if (array[j + 1] == 'ﺃ') - { - array[j] = 'ﻵ'; - array2[j + 1] = '\uffff'; - flag = true; - } - else if (array[j + 1] == 'ﺁ') - { - array[j] = 'ﻳ'; - array2[j + 1] = '\uffff'; - flag = true; - } - } - if (!IsIgnoredCharacter(array[j])) - { - if (IsMiddleLetter(array, j)) - { - array2[j] = (char)(array[j] + 3); - } - else if (IsFinishingLetter(array, j)) - { - array2[j] = (char)(array[j] + 1); - } - else if (IsLeadingLetter(array, j)) - { - array2[j] = (char)(array[j] + 2); - } - } - text = text + Convert.ToString(array[j], 16) + " "; - if (flag) - { - j++; - } - if (useHinduNumbers) - { - if (array[j] == '0') - { - array2[j] = '٠'; - } - else if (array[j] == '1') - { - array2[j] = '١'; - } - else if (array[j] == '2') - { - array2[j] = '٢'; - } - else if (array[j] == '3') - { - array2[j] = '٣'; - } - else if (array[j] == '4') - { - array2[j] = '٤'; - } - else if (array[j] == '5') - { - array2[j] = '٥'; - } - else if (array[j] == '6') - { - array2[j] = '٦'; - } - else if (array[j] == '7') - { - array2[j] = '٧'; - } - else if (array[j] == '8') - { - array2[j] = '٨'; - } - else if (array[j] == '9') - { - array2[j] = '٩'; - } - } - } - if (showTashkeel) - { - array2 = ReturnTashkeel(array2, tashkeelLocation); - } - List list = new List(); - List list2 = new List(); - for (int num = array2.Length - 1; num >= 0; num--) - { - if (char.IsPunctuation(array2[num]) && num > 0 && num < array2.Length - 1 && (char.IsPunctuation(array2[num - 1]) || char.IsPunctuation(array2[num + 1]))) - { - if (array2[num] == '(') - { - list.Add(')'); - } - else if (array2[num] == ')') - { - list.Add('('); - } - else if (array2[num] == '<') - { - list.Add('>'); - } - else if (array2[num] == '>') - { - list.Add('<'); - } - else if (array2[num] == '[') - { - list.Add(']'); - } - else if (array2[num] == ']') - { - list.Add('['); - } - else if (array2[num] != '\uffff') - { - list.Add(array2[num]); - } - } - else if (array2[num] == ' ' && num > 0 && num < array2.Length - 1 && (char.IsLower(array2[num - 1]) || char.IsUpper(array2[num - 1]) || char.IsNumber(array2[num - 1])) && (char.IsLower(array2[num + 1]) || char.IsUpper(array2[num + 1]) || char.IsNumber(array2[num + 1]))) - { - list2.Add(array2[num]); - } - else if (char.IsNumber(array2[num]) || char.IsLower(array2[num]) || char.IsUpper(array2[num]) || char.IsSymbol(array2[num]) || char.IsPunctuation(array2[num])) - { - if (array2[num] == '(') - { - list2.Add(')'); - } - else if (array2[num] == ')') - { - list2.Add('('); - } - else if (array2[num] == '<') - { - list2.Add('>'); - } - else if (array2[num] == '>') - { - list2.Add('<'); - } - else if (array2[num] == '[') - { - list.Add(']'); - } - else if (array2[num] == ']') - { - list.Add('['); - } - else - { - list2.Add(array2[num]); - } - } - else if ((array2[num] >= '\ud800' && array2[num] <= '\udbff') || (array2[num] >= '\udc00' && array2[num] <= '\udfff')) - { - list2.Add(array2[num]); - } - else - { - if (list2.Count > 0) - { - for (int k = 0; k < list2.Count; k++) - { - list.Add(list2[list2.Count - 1 - k]); - } - list2.Clear(); - } - if (array2[num] != '\uffff') - { - list.Add(array2[num]); - } - } - } - if (list2.Count > 0) - { - for (int l = 0; l < list2.Count; l++) - { - list.Add(list2[list2.Count - 1 - l]); - } - list2.Clear(); - } - array2 = new char[list.Count]; - for (int m = 0; m < array2.Length; m++) - { - array2[m] = list[m]; - } - str = new string(array2); - return str; - } - - internal static bool IsIgnoredCharacter(char ch) - { - bool num = char.IsPunctuation(ch); - bool flag = char.IsNumber(ch); - bool flag2 = char.IsLower(ch); - bool flag3 = char.IsUpper(ch); - bool flag4 = char.IsSymbol(ch); - bool flag5 = ch == 'ﭖ' || ch == 'ﭺ' || ch == 'ﮊ' || ch == 'ﮒ' || ch == 'ﮎ'; - bool flag6 = (ch <= '\ufeff' && ch >= 'ﹰ') || flag5 || ch == 'ﯼ'; - if (!(num || flag || flag2 || flag3 || flag4) && flag6 && ch != 'a' && ch != '>' && ch != '<') - { - return ch == '؛'; - } - return true; - } - - internal static bool IsLeadingLetter(char[] letters, int index) - { - bool num = index == 0 || letters[index - 1] == ' ' || letters[index - 1] == '*' || letters[index - 1] == 'A' || char.IsPunctuation(letters[index - 1]) || letters[index - 1] == '>' || letters[index - 1] == '<' || letters[index - 1] == 'ﺍ' || letters[index - 1] == 'ﺩ' || letters[index - 1] == 'ﺫ' || letters[index - 1] == 'ﺭ' || letters[index - 1] == 'ﺯ' || letters[index - 1] == 'ﮊ' || letters[index - 1] == 'ﻭ' || letters[index - 1] == 'ﺁ' || letters[index - 1] == 'ﺃ' || letters[index - 1] == 'ﺇ' || letters[index - 1] == 'ﺅ'; - bool flag = letters[index] != ' ' && letters[index] != 'ﺩ' && letters[index] != 'ﺫ' && letters[index] != 'ﺭ' && letters[index] != 'ﺯ' && letters[index] != 'ﮊ' && letters[index] != 'ﺍ' && letters[index] != 'ﺃ' && letters[index] != 'ﺇ' && letters[index] != 'ﺁ' && letters[index] != 'ﺅ' && letters[index] != 'ﻭ' && letters[index] != 'ﺀ'; - bool flag2 = index < letters.Length - 1 && letters[index + 1] != ' ' && !char.IsPunctuation(letters[index + 1]) && !char.IsNumber(letters[index + 1]) && !char.IsSymbol(letters[index + 1]) && !char.IsLower(letters[index + 1]) && !char.IsUpper(letters[index + 1]) && letters[index + 1] != 'ﺀ'; - if (num && flag && flag2) - { - return true; - } - return false; - } - - internal static bool IsFinishingLetter(char[] letters, int index) - { - bool num = index != 0 && letters[index - 1] != ' ' && letters[index - 1] != 'ﺩ' && letters[index - 1] != 'ﺫ' && letters[index - 1] != 'ﺭ' && letters[index - 1] != 'ﺯ' && letters[index - 1] != 'ﮊ' && letters[index - 1] != 'ﻭ' && letters[index - 1] != 'ﺍ' && letters[index - 1] != 'ﺁ' && letters[index - 1] != 'ﺃ' && letters[index - 1] != 'ﺇ' && letters[index - 1] != 'ﺅ' && letters[index - 1] != 'ﺀ' && !char.IsPunctuation(letters[index - 1]) && letters[index - 1] != '>' && letters[index - 1] != '<'; - bool flag = letters[index] != ' ' && letters[index] != 'ﺀ'; - if (num && flag) - { - return true; - } - return false; - } - - internal static bool IsMiddleLetter(char[] letters, int index) - { - bool flag = index != 0 && letters[index] != 'ﺍ' && letters[index] != 'ﺩ' && letters[index] != 'ﺫ' && letters[index] != 'ﺭ' && letters[index] != 'ﺯ' && letters[index] != 'ﮊ' && letters[index] != 'ﻭ' && letters[index] != 'ﺁ' && letters[index] != 'ﺃ' && letters[index] != 'ﺇ' && letters[index] != 'ﺅ' && letters[index] != 'ﺀ'; - bool flag2 = index != 0 && letters[index - 1] != 'ﺍ' && letters[index - 1] != 'ﺩ' && letters[index - 1] != 'ﺫ' && letters[index - 1] != 'ﺭ' && letters[index - 1] != 'ﺯ' && letters[index - 1] != 'ﮊ' && letters[index - 1] != 'ﻭ' && letters[index - 1] != 'ﺁ' && letters[index - 1] != 'ﺃ' && letters[index - 1] != 'ﺇ' && letters[index - 1] != 'ﺅ' && letters[index - 1] != 'ﺀ' && !char.IsPunctuation(letters[index - 1]) && letters[index - 1] != '>' && letters[index - 1] != '<' && letters[index - 1] != ' ' && letters[index - 1] != '*'; - if (index < letters.Length - 1 && letters[index + 1] != ' ' && letters[index + 1] != '\r' && letters[index + 1] != 'ﺀ' && !char.IsNumber(letters[index + 1]) && !char.IsSymbol(letters[index + 1]) && !char.IsPunctuation(letters[index + 1]) && flag2 && flag) - { - try - { - if (char.IsPunctuation(letters[index + 1])) - { - return false; - } - return true; - } - catch - { - return false; - } - } - return false; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/RealTimeTranslation.cs b/Thronefall_1_57/Thronefall/I2.Loc/RealTimeTranslation.cs deleted file mode 100644 index d0bee68..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/RealTimeTranslation.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace I2.Loc; - -public class RealTimeTranslation : MonoBehaviour -{ - private string OriginalText = "This is an example showing how to use the google translator to translate chat messages within the game.\nIt also supports multiline translations."; - - private string TranslatedText = string.Empty; - - private bool IsTranslating; - - public void OnGUI() - { - GUILayout.Label("Translate:"); - OriginalText = GUILayout.TextArea(OriginalText, GUILayout.Width(Screen.width)); - GUILayout.Space(10f); - GUILayout.BeginHorizontal(); - if (GUILayout.Button("English -> Español", GUILayout.Height(100f))) - { - StartTranslating("en", "es"); - } - if (GUILayout.Button("Español -> English", GUILayout.Height(100f))) - { - StartTranslating("es", "en"); - } - GUILayout.EndHorizontal(); - GUILayout.Space(10f); - GUILayout.BeginHorizontal(); - GUILayout.TextArea("Multiple Translation with 1 call:\n'This is an example' -> en,zh\n'Hola' -> en"); - if (GUILayout.Button("Multi Translate", GUILayout.ExpandHeight(expand: true))) - { - ExampleMultiTranslations_Async(); - } - GUILayout.EndHorizontal(); - GUILayout.TextArea(TranslatedText, GUILayout.Width(Screen.width)); - GUILayout.Space(10f); - if (IsTranslating) - { - GUILayout.Label("Contacting Google...."); - } - } - - public void StartTranslating(string fromCode, string toCode) - { - IsTranslating = true; - GoogleTranslation.Translate(OriginalText, fromCode, toCode, OnTranslationReady); - } - - private void OnTranslationReady(string Translation, string errorMsg) - { - IsTranslating = false; - if (errorMsg != null) - { - Debug.LogError(errorMsg); - } - else - { - TranslatedText = Translation; - } - } - - public void ExampleMultiTranslations_Blocking() - { - Dictionary dictionary = new Dictionary(); - GoogleTranslation.AddQuery("This is an example", "en", "es", dictionary); - GoogleTranslation.AddQuery("This is an example", "auto", "zh", dictionary); - GoogleTranslation.AddQuery("Hola", "es", "en", dictionary); - if (GoogleTranslation.ForceTranslate(dictionary)) - { - Debug.Log(GoogleTranslation.GetQueryResult("This is an example", "en", dictionary)); - Debug.Log(GoogleTranslation.GetQueryResult("This is an example", "zh", dictionary)); - Debug.Log(GoogleTranslation.GetQueryResult("This is an example", "", dictionary)); - Debug.Log(dictionary["Hola"].Results[0]); - } - } - - public void ExampleMultiTranslations_Async() - { - IsTranslating = true; - Dictionary dictionary = new Dictionary(); - GoogleTranslation.AddQuery("This is an example", "en", "es", dictionary); - GoogleTranslation.AddQuery("This is an example", "auto", "zh", dictionary); - GoogleTranslation.AddQuery("Hola", "es", "en", dictionary); - GoogleTranslation.Translate(dictionary, OnMultitranslationReady); - } - - private void OnMultitranslationReady(Dictionary dict, string errorMsg) - { - if (!string.IsNullOrEmpty(errorMsg)) - { - Debug.LogError(errorMsg); - return; - } - IsTranslating = false; - TranslatedText = ""; - TranslatedText = TranslatedText + GoogleTranslation.GetQueryResult("This is an example", "es", dict) + "\n"; - TranslatedText = TranslatedText + GoogleTranslation.GetQueryResult("This is an example", "zh", dict) + "\n"; - TranslatedText = TranslatedText + GoogleTranslation.GetQueryResult("This is an example", "", dict) + "\n"; - TranslatedText += dict["Hola"].Results[0]; - } - - public bool IsWaitingForTranslation() - { - return IsTranslating; - } - - public string GetTranslatedText() - { - return TranslatedText; - } - - public void SetOriginalText(string text) - { - OriginalText = text; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/RegisterBundlesManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/RegisterBundlesManager.cs deleted file mode 100644 index e475810..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/RegisterBundlesManager.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using UnityEngine; - -namespace I2.Loc; - -public class RegisterBundlesManager : MonoBehaviour, IResourceManager_Bundles -{ - public void OnEnable() - { - if (!ResourceManager.pInstance.mBundleManagers.Contains(this)) - { - ResourceManager.pInstance.mBundleManagers.Add(this); - } - } - - public void OnDisable() - { - ResourceManager.pInstance.mBundleManagers.Remove(this); - } - - public virtual UnityEngine.Object LoadFromBundle(string path, Type assetType) - { - return null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/RegisterCallback_AllowSyncFromGoogle.cs b/Thronefall_1_57/Thronefall/I2.Loc/RegisterCallback_AllowSyncFromGoogle.cs deleted file mode 100644 index 039dc18..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/RegisterCallback_AllowSyncFromGoogle.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class RegisterCallback_AllowSyncFromGoogle : MonoBehaviour -{ - public void Awake() - { - LocalizationManager.Callback_AllowSyncFromGoogle = AllowSyncFromGoogle; - } - - public void OnEnable() - { - LocalizationManager.Callback_AllowSyncFromGoogle = AllowSyncFromGoogle; - } - - public void OnDisable() - { - LocalizationManager.Callback_AllowSyncFromGoogle = null; - } - - public virtual bool AllowSyncFromGoogle(LanguageSourceData Source) - { - return true; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/RegisterGlobalParameters.cs b/Thronefall_1_57/Thronefall/I2.Loc/RegisterGlobalParameters.cs deleted file mode 100644 index 4642977..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/RegisterGlobalParameters.cs +++ /dev/null @@ -1,25 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class RegisterGlobalParameters : MonoBehaviour, ILocalizationParamsManager -{ - public virtual void OnEnable() - { - if (!LocalizationManager.ParamManagers.Contains(this)) - { - LocalizationManager.ParamManagers.Add(this); - LocalizationManager.LocalizeAll(Force: true); - } - } - - public virtual void OnDisable() - { - LocalizationManager.ParamManagers.Remove(this); - } - - public virtual string GetParameterValue(string ParamName) - { - return null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ResourceManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/ResourceManager.cs deleted file mode 100644 index 793bb21..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ResourceManager.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.SceneManagement; - -namespace I2.Loc; - -public class ResourceManager : MonoBehaviour -{ - private static ResourceManager mInstance; - - public List mBundleManagers = new List(); - - public UnityEngine.Object[] Assets; - - private readonly Dictionary mResourcesCache = new Dictionary(StringComparer.Ordinal); - - public static ResourceManager pInstance - { - get - { - bool flag = mInstance == null; - if (mInstance == null) - { - mInstance = (ResourceManager)UnityEngine.Object.FindObjectOfType(typeof(ResourceManager)); - } - if (mInstance == null) - { - GameObject obj = new GameObject("I2ResourceManager", typeof(ResourceManager)); - obj.hideFlags |= HideFlags.HideAndDontSave; - mInstance = obj.GetComponent(); - SceneManager.sceneLoaded += MyOnLevelWasLoaded; - } - if (flag && Application.isPlaying) - { - UnityEngine.Object.DontDestroyOnLoad(mInstance.gameObject); - } - return mInstance; - } - } - - public static void MyOnLevelWasLoaded(Scene scene, LoadSceneMode mode) - { - pInstance.CleanResourceCache(); - LocalizationManager.UpdateSources(); - } - - public T GetAsset(string Name) where T : UnityEngine.Object - { - T val = FindAsset(Name) as T; - if ((UnityEngine.Object)val != (UnityEngine.Object)null) - { - return val; - } - return LoadFromResources(Name); - } - - private UnityEngine.Object FindAsset(string Name) - { - if (Assets != null) - { - int i = 0; - for (int num = Assets.Length; i < num; i++) - { - if (Assets[i] != null && Assets[i].name == Name) - { - return Assets[i]; - } - } - } - return null; - } - - public bool HasAsset(UnityEngine.Object Obj) - { - if (Assets == null) - { - return false; - } - return Array.IndexOf(Assets, Obj) >= 0; - } - - public T LoadFromResources(string Path) where T : UnityEngine.Object - { - try - { - if (string.IsNullOrEmpty(Path)) - { - return null; - } - if (mResourcesCache.TryGetValue(Path, out var value) && value != null) - { - return value as T; - } - T val = null; - if (Path.EndsWith("]", StringComparison.OrdinalIgnoreCase)) - { - int num = Path.LastIndexOf("[", StringComparison.OrdinalIgnoreCase); - int length = Path.Length - num - 2; - string value2 = Path.Substring(num + 1, length); - Path = Path.Substring(0, num); - T[] array = Resources.LoadAll(Path); - int i = 0; - for (int num2 = array.Length; i < num2; i++) - { - if (array[i].name.Equals(value2)) - { - val = array[i]; - break; - } - } - } - else - { - val = Resources.Load(Path, typeof(T)) as T; - } - if ((UnityEngine.Object)val == (UnityEngine.Object)null) - { - val = LoadFromBundle(Path); - } - if ((UnityEngine.Object)val != (UnityEngine.Object)null) - { - mResourcesCache[Path] = val; - } - return val; - } - catch (Exception ex) - { - Debug.LogErrorFormat("Unable to load {0} '{1}'\nERROR: {2}", typeof(T), Path, ex.ToString()); - return null; - } - } - - public T LoadFromBundle(string path) where T : UnityEngine.Object - { - int i = 0; - for (int count = mBundleManagers.Count; i < count; i++) - { - if (mBundleManagers[i] != null) - { - T val = mBundleManagers[i].LoadFromBundle(path, typeof(T)) as T; - if ((UnityEngine.Object)val != (UnityEngine.Object)null) - { - return val; - } - } - } - return null; - } - - public void CleanResourceCache(bool unloadResources = false) - { - mResourcesCache.Clear(); - if (unloadResources) - { - Resources.UnloadUnusedAssets(); - } - CancelInvoke(); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/SetLanguage.cs b/Thronefall_1_57/Thronefall/I2.Loc/SetLanguage.cs deleted file mode 100644 index 108efdc..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/SetLanguage.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/SetLanguage Button")] -public class SetLanguage : MonoBehaviour -{ - public string _Language; - - private void OnClick() - { - ApplyLanguage(); - } - - public void ApplyLanguage() - { - if (LocalizationManager.HasLanguage(_Language)) - { - LocalizationManager.CurrentLanguage = _Language; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/SetLanguageDropdown.cs b/Thronefall_1_57/Thronefall/I2.Loc/SetLanguageDropdown.cs deleted file mode 100644 index 4175b4f..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/SetLanguageDropdown.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/SetLanguage Dropdown")] -public class SetLanguageDropdown : MonoBehaviour -{ - private void OnEnable() - { - Dropdown component = GetComponent(); - if (!(component == null)) - { - string currentLanguage = LocalizationManager.CurrentLanguage; - if (LocalizationManager.Sources.Count == 0) - { - LocalizationManager.UpdateSources(); - } - List allLanguages = LocalizationManager.GetAllLanguages(); - component.ClearOptions(); - component.AddOptions(allLanguages); - component.value = allLanguages.IndexOf(currentLanguage); - component.onValueChanged.RemoveListener(OnValueChanged); - component.onValueChanged.AddListener(OnValueChanged); - } - } - - private void OnValueChanged(int index) - { - Dropdown component = GetComponent(); - if (index < 0) - { - index = 0; - component.value = index; - } - LocalizationManager.CurrentLanguage = component.options[index].text; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/SpecializationManager.cs b/Thronefall_1_57/Thronefall/I2.Loc/SpecializationManager.cs deleted file mode 100644 index 93515a5..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/SpecializationManager.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace I2.Loc; - -public class SpecializationManager : BaseSpecializationManager -{ - public static SpecializationManager Singleton = new SpecializationManager(); - - private SpecializationManager() - { - InitializeSpecializations(); - } - - public static string GetSpecializedText(string text, string specialization = null) - { - int num = text.IndexOf("[i2s_", StringComparison.Ordinal); - if (num < 0) - { - return text; - } - if (string.IsNullOrEmpty(specialization)) - { - specialization = Singleton.GetCurrentSpecialization(); - } - while (!string.IsNullOrEmpty(specialization) && specialization != "Any") - { - string text2 = "[i2s_" + specialization + "]"; - int num2 = text.IndexOf(text2, StringComparison.Ordinal); - if (num2 < 0) - { - specialization = Singleton.GetFallbackSpecialization(specialization); - continue; - } - num2 += text2.Length; - int num3 = text.IndexOf("[i2s_", num2, StringComparison.Ordinal); - if (num3 < 0) - { - num3 = text.Length; - } - return text.Substring(num2, num3 - num2); - } - return text.Substring(0, num); - } - - public static string SetSpecializedText(string text, string newText, string specialization) - { - if (string.IsNullOrEmpty(specialization)) - { - specialization = "Any"; - } - if ((text == null || !text.Contains("[i2s_")) && specialization == "Any") - { - return newText; - } - Dictionary specializations = GetSpecializations(text); - specializations[specialization] = newText; - return SetSpecializedText(specializations); - } - - public static string SetSpecializedText(Dictionary specializations) - { - if (!specializations.TryGetValue("Any", out var value)) - { - value = string.Empty; - } - foreach (KeyValuePair specialization in specializations) - { - if (specialization.Key != "Any" && !string.IsNullOrEmpty(specialization.Value)) - { - value = value + "[i2s_" + specialization.Key + "]" + specialization.Value; - } - } - return value; - } - - public static Dictionary GetSpecializations(string text, Dictionary buffer = null) - { - if (buffer == null) - { - buffer = new Dictionary(StringComparer.Ordinal); - } - else - { - buffer.Clear(); - } - if (text == null) - { - buffer["Any"] = ""; - return buffer; - } - int num = 0; - int num2 = text.IndexOf("[i2s_", StringComparison.Ordinal); - if (num2 < 0) - { - num2 = text.Length; - } - buffer["Any"] = text.Substring(0, num2); - for (num = num2; num < text.Length; num = num2) - { - num += "[i2s_".Length; - int num3 = text.IndexOf(']', num); - if (num3 < 0) - { - break; - } - string key = text.Substring(num, num3 - num); - num = num3 + 1; - num2 = text.IndexOf("[i2s_", num, StringComparison.Ordinal); - if (num2 < 0) - { - num2 = text.Length; - } - string value = text.Substring(num, num2 - num); - buffer[key] = value; - } - return buffer; - } - - public static void AppendSpecializations(string text, List list = null) - { - if (text == null) - { - return; - } - if (list == null) - { - list = new List(); - } - if (!list.Contains("Any")) - { - list.Add("Any"); - } - int num = 0; - while (num < text.Length) - { - num = text.IndexOf("[i2s_", num, StringComparison.Ordinal); - if (num >= 0) - { - num += "[i2s_".Length; - int num2 = text.IndexOf(']', num); - if (num2 >= 0) - { - string item = text.Substring(num, num2 - num); - if (!list.Contains(item)) - { - list.Add(item); - } - continue; - } - break; - } - break; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/StringObfucator.cs b/Thronefall_1_57/Thronefall/I2.Loc/StringObfucator.cs deleted file mode 100644 index 4f054ef..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/StringObfucator.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Text; - -namespace I2.Loc; - -public class StringObfucator -{ - public static char[] StringObfuscatorPassword = "ÝúbUu\u00b8CÁ§*4PÚ©-᩾@T6Dl±ÒWâuzÅm4GÐóØ$=Íg,¥Që®iKEßr¡×60Ít4öÃ~^«y:Èd1(); - - public byte[] Flags = Array.Empty(); - - [SerializeField] - private string[] Languages_Touch; - - public string GetTranslation(int idx, string specialization = null, bool editMode = false) - { - string text = Languages[idx]; - if (text != null) - { - text = SpecializationManager.GetSpecializedText(text, specialization); - if (!editMode) - { - text = text.Replace("[i2nt]", "").Replace("[/i2nt]", ""); - } - } - return text; - } - - public void SetTranslation(int idx, string translation, string specialization = null) - { - Languages[idx] = SpecializationManager.SetSpecializedText(Languages[idx], translation, specialization); - } - - public void RemoveSpecialization(string specialization) - { - for (int i = 0; i < Languages.Length; i++) - { - RemoveSpecialization(i, specialization); - } - } - - public void RemoveSpecialization(int idx, string specialization) - { - string text = Languages[idx]; - if (!(specialization == "Any") && text.Contains("[i2s_" + specialization + "]")) - { - Dictionary specializations = SpecializationManager.GetSpecializations(text); - specializations.Remove(specialization); - Languages[idx] = SpecializationManager.SetSpecializedText(specializations); - } - } - - public bool IsAutoTranslated(int idx, bool IsTouch) - { - return (Flags[idx] & 2) > 0; - } - - public void Validate() - { - int num = Mathf.Max(Languages.Length, Flags.Length); - if (Languages.Length != num) - { - Array.Resize(ref Languages, num); - } - if (Flags.Length != num) - { - Array.Resize(ref Flags, num); - } - if (Languages_Touch == null) - { - return; - } - for (int i = 0; i < Mathf.Min(Languages_Touch.Length, num); i++) - { - if (string.IsNullOrEmpty(Languages[i]) && !string.IsNullOrEmpty(Languages_Touch[i])) - { - Languages[i] = Languages_Touch[i]; - Languages_Touch[i] = null; - } - } - Languages_Touch = null; - } - - public bool IsTerm(string name, bool allowCategoryMistmatch) - { - if (!allowCategoryMistmatch) - { - return name == Term; - } - return name == LanguageSourceData.GetKeyFromFullTerm(Term); - } - - public bool HasSpecializations() - { - for (int i = 0; i < Languages.Length; i++) - { - if (!string.IsNullOrEmpty(Languages[i]) && Languages[i].Contains("[i2s_")) - { - return true; - } - } - return false; - } - - public List GetAllSpecializations() - { - List list = new List(); - for (int i = 0; i < Languages.Length; i++) - { - SpecializationManager.AppendSpecializations(Languages[i], list); - } - return list; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TermsPopup.cs b/Thronefall_1_57/Thronefall/I2.Loc/TermsPopup.cs deleted file mode 100644 index 827e495..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TermsPopup.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine; - -namespace I2.Loc; - -public class TermsPopup : PropertyAttribute -{ - public string Filter { get; private set; } - - public TermsPopup(string filter = "") - { - Filter = filter; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ToggleLanguage.cs b/Thronefall_1_57/Thronefall/I2.Loc/ToggleLanguage.cs deleted file mode 100644 index 881e0fe..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ToggleLanguage.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace I2.Loc; - -public class ToggleLanguage : MonoBehaviour -{ - private void Start() - { - Invoke("test", 3f); - } - - private void test() - { - List allLanguages = LocalizationManager.GetAllLanguages(); - int num = allLanguages.IndexOf(LocalizationManager.CurrentLanguage); - if (num < 0) - { - num = 0; - } - else - { - num = (num + 1) % allLanguages.Count; - } - Invoke("test", 3f); - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationFlag.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationFlag.cs deleted file mode 100644 index c2c705b..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationFlag.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace I2.Loc; - -public enum TranslationFlag : byte -{ - Normal = 1, - AutoTranslated -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob.cs deleted file mode 100644 index a93545d..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace I2.Loc; - -public class TranslationJob : IDisposable -{ - public enum eJobState - { - Running, - Succeeded, - Failed - } - - public eJobState mJobState; - - public virtual eJobState GetState() - { - return mJobState; - } - - public virtual void Dispose() - { - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_GET.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_GET.cs deleted file mode 100644 index d224401..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_GET.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Collections.Generic; -using System.Text; -using UnityEngine.Networking; - -namespace I2.Loc; - -public class TranslationJob_GET : TranslationJob_WWW -{ - private Dictionary _requests; - - private GoogleTranslation.fnOnTranslationReady _OnTranslationReady; - - private List mQueries; - - public string mErrorMessage; - - public TranslationJob_GET(Dictionary requests, GoogleTranslation.fnOnTranslationReady OnTranslationReady) - { - _requests = requests; - _OnTranslationReady = OnTranslationReady; - mQueries = GoogleTranslation.ConvertTranslationRequest(requests, encodeGET: true); - GetState(); - } - - private void ExecuteNextQuery() - { - if (mQueries.Count == 0) - { - mJobState = eJobState.Succeeded; - return; - } - int index = mQueries.Count - 1; - string text = mQueries[index]; - mQueries.RemoveAt(index); - string uri = LocalizationManager.GetWebServiceURL() + "?action=Translate&list=" + text; - www = UnityWebRequest.Get(uri); - I2Utils.SendWebRequest(www); - } - - public override eJobState GetState() - { - if (www != null && www.isDone) - { - ProcessResult(www.downloadHandler.data, www.error); - www.Dispose(); - www = null; - } - if (www == null) - { - ExecuteNextQuery(); - } - return mJobState; - } - - public void ProcessResult(byte[] bytes, string errorMsg) - { - if (string.IsNullOrEmpty(errorMsg)) - { - errorMsg = GoogleTranslation.ParseTranslationResult(Encoding.UTF8.GetString(bytes, 0, bytes.Length), _requests); - if (string.IsNullOrEmpty(errorMsg)) - { - if (_OnTranslationReady != null) - { - _OnTranslationReady(_requests, null); - } - return; - } - } - mJobState = eJobState.Failed; - mErrorMessage = errorMsg; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_Main.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_Main.cs deleted file mode 100644 index 595872a..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_Main.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System.Collections.Generic; - -namespace I2.Loc; - -public class TranslationJob_Main : TranslationJob -{ - private TranslationJob_WEB mWeb; - - private TranslationJob_POST mPost; - - private TranslationJob_GET mGet; - - private Dictionary _requests; - - private GoogleTranslation.fnOnTranslationReady _OnTranslationReady; - - public string mErrorMessage; - - public TranslationJob_Main(Dictionary requests, GoogleTranslation.fnOnTranslationReady OnTranslationReady) - { - _requests = requests; - _OnTranslationReady = OnTranslationReady; - mPost = new TranslationJob_POST(requests, OnTranslationReady); - } - - public override eJobState GetState() - { - if (mWeb != null) - { - switch (mWeb.GetState()) - { - case eJobState.Running: - return eJobState.Running; - case eJobState.Succeeded: - mJobState = eJobState.Succeeded; - break; - case eJobState.Failed: - mWeb.Dispose(); - mWeb = null; - mPost = new TranslationJob_POST(_requests, _OnTranslationReady); - break; - } - } - if (mPost != null) - { - switch (mPost.GetState()) - { - case eJobState.Running: - return eJobState.Running; - case eJobState.Succeeded: - mJobState = eJobState.Succeeded; - break; - case eJobState.Failed: - mPost.Dispose(); - mPost = null; - mGet = new TranslationJob_GET(_requests, _OnTranslationReady); - break; - } - } - if (mGet != null) - { - switch (mGet.GetState()) - { - case eJobState.Running: - return eJobState.Running; - case eJobState.Succeeded: - mJobState = eJobState.Succeeded; - break; - case eJobState.Failed: - mErrorMessage = mGet.mErrorMessage; - if (_OnTranslationReady != null) - { - _OnTranslationReady(_requests, mErrorMessage); - } - mGet.Dispose(); - mGet = null; - break; - } - } - return mJobState; - } - - public override void Dispose() - { - if (mPost != null) - { - mPost.Dispose(); - } - if (mGet != null) - { - mGet.Dispose(); - } - mPost = null; - mGet = null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_POST.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_POST.cs deleted file mode 100644 index 561cb90..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_POST.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using System.Text; -using UnityEngine; -using UnityEngine.Networking; - -namespace I2.Loc; - -public class TranslationJob_POST : TranslationJob_WWW -{ - private Dictionary _requests; - - private GoogleTranslation.fnOnTranslationReady _OnTranslationReady; - - public TranslationJob_POST(Dictionary requests, GoogleTranslation.fnOnTranslationReady OnTranslationReady) - { - _requests = requests; - _OnTranslationReady = OnTranslationReady; - List list = GoogleTranslation.ConvertTranslationRequest(requests, encodeGET: false); - WWWForm wWWForm = new WWWForm(); - wWWForm.AddField("action", "Translate"); - wWWForm.AddField("list", list[0]); - www = UnityWebRequest.Post(LocalizationManager.GetWebServiceURL(), wWWForm); - I2Utils.SendWebRequest(www); - } - - public override eJobState GetState() - { - if (www != null && www.isDone) - { - ProcessResult(www.downloadHandler.data, www.error); - www.Dispose(); - www = null; - } - return mJobState; - } - - public void ProcessResult(byte[] bytes, string errorMsg) - { - if (!string.IsNullOrEmpty(errorMsg)) - { - mJobState = eJobState.Failed; - return; - } - errorMsg = GoogleTranslation.ParseTranslationResult(Encoding.UTF8.GetString(bytes, 0, bytes.Length), _requests); - if (_OnTranslationReady != null) - { - _OnTranslationReady(_requests, errorMsg); - } - mJobState = eJobState.Succeeded; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WEB.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WEB.cs deleted file mode 100644 index 4136e38..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WEB.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; -using System.Text.RegularExpressions; -using UnityEngine; -using UnityEngine.Networking; - -namespace I2.Loc; - -public class TranslationJob_WEB : TranslationJob_WWW -{ - private Dictionary _requests; - - private GoogleTranslation.fnOnTranslationReady _OnTranslationReady; - - public string mErrorMessage; - - private string mCurrentBatch_ToLanguageCode; - - private string mCurrentBatch_FromLanguageCode; - - private List mCurrentBatch_Text; - - private List> mQueries; - - public TranslationJob_WEB(Dictionary requests, GoogleTranslation.fnOnTranslationReady OnTranslationReady) - { - _requests = requests; - _OnTranslationReady = OnTranslationReady; - FindAllQueries(); - ExecuteNextBatch(); - } - - private void FindAllQueries() - { - mQueries = new List>(); - foreach (KeyValuePair request in _requests) - { - string[] targetLanguagesCode = request.Value.TargetLanguagesCode; - foreach (string text in targetLanguagesCode) - { - mQueries.Add(new KeyValuePair(request.Value.OrigText, request.Value.LanguageCode + ":" + text)); - } - } - mQueries.Sort((KeyValuePair a, KeyValuePair b) => a.Value.CompareTo(b.Value)); - } - - private void ExecuteNextBatch() - { - if (mQueries.Count == 0) - { - mJobState = eJobState.Succeeded; - return; - } - mCurrentBatch_Text = new List(); - string text = null; - int num = 200; - StringBuilder stringBuilder = new StringBuilder(); - int i; - for (i = 0; i < mQueries.Count; i++) - { - string key = mQueries[i].Key; - string value = mQueries[i].Value; - if (text == null || value == text) - { - if (i != 0) - { - stringBuilder.Append("|||"); - } - stringBuilder.Append(key); - mCurrentBatch_Text.Add(key); - text = value; - } - if (stringBuilder.Length > num) - { - break; - } - } - mQueries.RemoveRange(0, i); - string[] array = text.Split(':'); - mCurrentBatch_FromLanguageCode = array[0]; - mCurrentBatch_ToLanguageCode = array[1]; - string text2 = $"http://www.google.com/translate_t?hl=en&vi=c&ie=UTF8&oe=UTF8&submit=Translate&langpair={mCurrentBatch_FromLanguageCode}|{mCurrentBatch_ToLanguageCode}&text={Uri.EscapeUriString(stringBuilder.ToString())}"; - Debug.Log(text2); - www = UnityWebRequest.Get(text2); - I2Utils.SendWebRequest(www); - } - - public override eJobState GetState() - { - if (www != null && www.isDone) - { - ProcessResult(www.downloadHandler.data, www.error); - www.Dispose(); - www = null; - } - if (www == null) - { - ExecuteNextBatch(); - } - return mJobState; - } - - public void ProcessResult(byte[] bytes, string errorMsg) - { - if (string.IsNullOrEmpty(errorMsg)) - { - string @string = Encoding.UTF8.GetString(bytes, 0, bytes.Length); - Debug.Log(ParseTranslationResult(@string, "aab")); - if (string.IsNullOrEmpty(errorMsg)) - { - if (_OnTranslationReady != null) - { - _OnTranslationReady(_requests, null); - } - return; - } - } - mJobState = eJobState.Failed; - mErrorMessage = errorMsg; - } - - private string ParseTranslationResult(string html, string OriginalText) - { - try - { - int num = html.IndexOf("TRANSLATED_TEXT='", StringComparison.Ordinal) + "TRANSLATED_TEXT='".Length; - int num2 = html.IndexOf("';var", num, StringComparison.Ordinal); - string input = html.Substring(num, num2 - num); - input = Regex.Replace(input, "\\\\x([a-fA-F0-9]{2})", (Match match) => char.ConvertFromUtf32(int.Parse(match.Groups[1].Value, NumberStyles.HexNumber))); - input = Regex.Replace(input, "&#(\\d+);", (Match match) => char.ConvertFromUtf32(int.Parse(match.Groups[1].Value))); - input = input.Replace("
", "\n"); - if (OriginalText.ToUpper() == OriginalText) - { - input = input.ToUpper(); - } - else if (GoogleTranslation.UppercaseFirst(OriginalText) == OriginalText) - { - input = GoogleTranslation.UppercaseFirst(input); - } - else if (GoogleTranslation.TitleCase(OriginalText) == OriginalText) - { - input = GoogleTranslation.TitleCase(input); - } - return input; - } - catch (Exception ex) - { - Debug.LogError(ex.Message); - return string.Empty; - } - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WWW.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WWW.cs deleted file mode 100644 index f10586e..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationJob_WWW.cs +++ /dev/null @@ -1,17 +0,0 @@ -using UnityEngine.Networking; - -namespace I2.Loc; - -public class TranslationJob_WWW : TranslationJob -{ - public UnityWebRequest www; - - public override void Dispose() - { - if (www != null) - { - www.Dispose(); - } - www = null; - } -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/TranslationQuery.cs b/Thronefall_1_57/Thronefall/I2.Loc/TranslationQuery.cs deleted file mode 100644 index 009b151..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/TranslationQuery.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace I2.Loc; - -public struct TranslationQuery -{ - public string OrigText; - - public string Text; - - public string LanguageCode; - - public string[] TargetLanguagesCode; - - public string[] Results; - - public string[] Tags; -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/eLanguageDataFlags.cs b/Thronefall_1_57/Thronefall/I2.Loc/eLanguageDataFlags.cs deleted file mode 100644 index 4378a2d..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/eLanguageDataFlags.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace I2.Loc; - -public enum eLanguageDataFlags -{ - DISABLED = 1, - KEEP_LOADED = 2, - NOT_LOADED = 4 -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/ePluralType.cs b/Thronefall_1_57/Thronefall/I2.Loc/ePluralType.cs deleted file mode 100644 index cffad52..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/ePluralType.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace I2.Loc; - -public enum ePluralType -{ - Zero, - One, - Two, - Few, - Many, - Plural -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/eSpreadsheetUpdateMode.cs b/Thronefall_1_57/Thronefall/I2.Loc/eSpreadsheetUpdateMode.cs deleted file mode 100644 index 75d6fca..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/eSpreadsheetUpdateMode.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace I2.Loc; - -public enum eSpreadsheetUpdateMode -{ - None, - Replace, - Merge, - AddNewTerms -} diff --git a/Thronefall_1_57/Thronefall/I2.Loc/eTermType.cs b/Thronefall_1_57/Thronefall/I2.Loc/eTermType.cs deleted file mode 100644 index dd00f6d..0000000 --- a/Thronefall_1_57/Thronefall/I2.Loc/eTermType.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace I2.Loc; - -public enum eTermType -{ - Text, - Font, - Texture, - AudioClip, - GameObject, - Sprite, - Material, - Child, - Mesh, - TextMeshPFont, - Object, - Video -} diff --git a/Thronefall_1_57/Thronefall/MoreMountains.Feedbacks/OneShotAudioTrigger.cs b/Thronefall_1_57/Thronefall/MoreMountains.Feedbacks/OneShotAudioTrigger.cs deleted file mode 100644 index a2246cf..0000000 --- a/Thronefall_1_57/Thronefall/MoreMountains.Feedbacks/OneShotAudioTrigger.cs +++ /dev/null @@ -1,18 +0,0 @@ -using UnityEngine; - -namespace MoreMountains.Feedbacks; - -[AddComponentMenu("")] -[FeedbackHelp("This feedback will allow you to play an audio oneshot on the Thronefall Sound Manager.")] -[FeedbackPath("Thronefall/Audio Oneshot")] -public class OneShotAudioTrigger : MMF_Feedback -{ - [MMFInspectorGroup("Audio", true, 12, true, false)] - [Tooltip("The oneshot you want to play.")] - public ThronefallAudioManager.AudioOneShot oneshot; - - protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1f) - { - ThronefallAudioManager.Oneshot(oneshot); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/AfterCombineAction.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/AfterCombineAction.cs deleted file mode 100644 index f586b15..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/AfterCombineAction.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum AfterCombineAction -{ - DisableComponents, - DestroyGameObject, - DoNothing -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTree.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTree.cs deleted file mode 100644 index b7eddf1..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTree.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public abstract class BinaryTree where TNode : BinaryTreeNode -{ - private Dictionary> _dataToNodes; - - public IBinaryTreeNode Root => RootInternal; - - public int Height { get; private set; } - - protected TNode RootInternal { get; private set; } - - public BinaryTree() - { - Height = 0; - _dataToNodes = new Dictionary>(); - } - - public void Add(TData data) - { - if (Root == null) - { - RootInternal = CreateRoot(data); - Height = 1; - } - if (!Includes(RootInternal, data)) - { - GrowTreeUp(data); - } - AddData(RootInternal, data, 1); - } - - public bool Remove(TData data) - { - if (!_dataToNodes.TryGetValue(data, out var value)) - { - return false; - } - foreach (TNode item in value) - { - item.Remove(data); - } - return _dataToNodes.Remove(data); - } - - protected void GrowTreeUp(TData target) - { - if (!Includes(RootInternal, target)) - { - RootInternal = ExpandRoot(RootInternal, target); - Height++; - GrowTreeUp(target); - } - } - - protected void GrowTreeDown(TNode node, TData target, int depth) - { - if (node.HasChilds) - { - throw new Exception("GrowTreeDown::" + depth + " node already has childs"); - } - Bounds bounds = node.Bounds; - Vector3 vector; - Vector3 size; - if (bounds.size.x > bounds.size.y || bounds.size.x > bounds.size.z) - { - vector = new Vector3(bounds.size.x / 4f, 0f, 0f); - size = new Vector3(bounds.size.x / 2f, bounds.size.y, bounds.size.z); - } - else if (bounds.size.y > bounds.size.x || bounds.size.y > bounds.size.z) - { - vector = new Vector3(0f, bounds.size.y / 4f, 0f); - size = new Vector3(bounds.size.x, bounds.size.y / 2f, bounds.size.z); - } - else - { - vector = new Vector3(0f, 0f, bounds.size.z / 4f); - size = new Vector3(bounds.size.x, bounds.size.y, bounds.size.z / 2f); - } - bool flag = depth == Height; - TNode val = CreateNode(bounds.center - vector, size, flag); - TNode val2 = CreateNode(bounds.center + vector, size, flag); - node.SetChilds(val, val2); - if (!flag) - { - if (Intersects(val, target)) - { - GrowTreeDown(val, target, depth + 1); - } - if (Intersects(val2, target)) - { - GrowTreeDown(val2, target, depth + 1); - } - } - } - - protected void AddData(TNode node, TData data, int depth) - { - if (node.IsLeaf) - { - node.Add(data); - if (!_dataToNodes.TryGetValue(data, out var value)) - { - value = new List(); - _dataToNodes.Add(data, value); - } - if (!value.Contains(node)) - { - value.Add(node); - } - return; - } - if (!node.HasChilds) - { - GrowTreeDown(node, data, depth + 1); - } - TNode node2 = (TNode)node.Left; - TNode node3 = (TNode)node.Right; - if (Intersects(node2, data)) - { - AddData(node2, data, depth + 1); - } - if (Intersects(node3, data)) - { - AddData(node3, data, depth + 1); - } - } - - protected void TreeTraversal(Func func) - { - TreeTraversal(RootInternal, 1, func); - } - - protected void TreeTraversal(TNode current, int depth, Func func) - { - if (func(current, depth) && current.HasChilds) - { - TreeTraversal((TNode)current.Left, depth + 1, func); - TreeTraversal((TNode)current.Right, depth + 1, func); - } - } - - protected abstract TNode CreateRoot(TData data); - - protected abstract TNode ExpandRoot(TNode root, TData target); - - protected abstract TNode CreateNode(Vector3 center, Vector3 size, bool isLeaf); - - protected abstract bool Intersects(TNode node, TData data); - - protected abstract bool Includes(TNode node, TData data); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeDrawer.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeDrawer.cs deleted file mode 100644 index 87776a2..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeDrawer.cs +++ /dev/null @@ -1,22 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class BinaryTreeDrawer -{ - public void DrawGizmo(IBinaryTreeNode root, Color color) - { - Gizmos.color = color; - DrawNode(root); - } - - private void DrawNode(IBinaryTreeNode node) - { - Gizmos.DrawWireCube(node.Center, node.Size); - if (node.HasChilds) - { - DrawNode(node.GetLeft()); - DrawNode(node.GetRight()); - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeNode.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeNode.cs deleted file mode 100644 index 4558519..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BinaryTreeNode.cs +++ /dev/null @@ -1,48 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public abstract class BinaryTreeNode : IBinaryTreeNode -{ - public BinaryTreeNode Left { get; private set; } - - public BinaryTreeNode Right { get; private set; } - - public bool IsLeaf { get; private set; } - - public bool HasChilds => Left != null; - - public Vector3 Center { get; private set; } - - public Vector3 Size { get; private set; } - - public Bounds Bounds { get; private set; } - - public BinaryTreeNode(Vector3 center, Vector3 size, bool isLeaf) - { - Center = center; - Size = size; - Bounds = new Bounds(center, size); - IsLeaf = isLeaf; - } - - public IBinaryTreeNode GetLeft() - { - return Left; - } - - public IBinaryTreeNode GetRight() - { - return Right; - } - - public void SetChilds(BinaryTreeNode left, BinaryTreeNode right) - { - Left = left; - Right = right; - } - - public abstract void Add(TData data); - - public abstract void Remove(TData data); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BoundsHelper.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BoundsHelper.cs deleted file mode 100644 index 012a350..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/BoundsHelper.cs +++ /dev/null @@ -1,39 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public static class BoundsHelper -{ - public static Bounds Transform(this Bounds bounds, Matrix4x4 transform) - { - Vector3 min = bounds.min; - Vector3 max = bounds.max; - Vector4 column = transform.GetColumn(3); - Vector3 vector = column; - Vector3 vector2 = column; - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - float num = transform[i, j]; - float num2 = num * min[j]; - float num3 = num * max[j]; - vector[i] += ((num2 < num3) ? num2 : num3); - vector2[i] += ((num2 < num3) ? num3 : num2); - } - } - Bounds result = default(Bounds); - result.center = transform.MultiplyPoint3x4(bounds.center); - result.size = vector2 - vector; - return result; - } - - public static bool Contains(this Bounds bounds, Bounds target) - { - if (bounds.Contains(target.min)) - { - return bounds.Contains(target.max); - } - return false; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineErrorStrategy.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineErrorStrategy.cs deleted file mode 100644 index 89cfbe3..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineErrorStrategy.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum CombineErrorStrategy -{ - UndoCombining, - Ignore -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineMethod.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineMethod.cs deleted file mode 100644 index e30d53e..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineMethod.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum CombineMethod -{ - Simple -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineSource.cs deleted file mode 100644 index f010062..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineSource.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombineSource : ICombineSource, ICombineSource -{ - public Vector3 Position { get; private set; } - - public Bounds Bounds { get; private set; } - - public MeshCombineInfo CombineInfo { get; private set; } - - public RendererSettings RendererSettings { get; private set; } - - public event Action onCombined; - - public event Action onCombineError; - - public event Action onCombineFailed; - - public event Action onCombinedTyped; - - public event Action onCombineErrorTyped; - - public event Action onCombineFailedTyped; - - public CombineSource(GameObject go, int submeshIndex = 0) - : this(go.GetComponent().mesh, go.GetComponent(), submeshIndex) - { - } - - public CombineSource(Mesh mesh, MeshRenderer renderer, int submeshIndex = 0) - { - if (mesh == null) - { - throw new ArgumentException("Mesh is null"); - } - if (renderer == null) - { - throw new ArgumentException("Mesh Renderer is null"); - } - if (submeshIndex >= mesh.subMeshCount) - { - throw new ArgumentException("Submesh index is greater the submeshCount"); - } - MeshCombineInfo info = new MeshCombineInfo(mesh, renderer.localToWorldMatrix, renderer.lightmapScaleOffset, renderer.realtimeLightmapScaleOffset, submeshIndex); - RendererSettings settings = new RendererSettings(renderer, submeshIndex); - Construct(info, settings, renderer.bounds); - } - - public CombineSource(MeshCombineInfo info, RendererSettings settings) - : this(info, settings, info.mesh.bounds.Transform(info.transformMatrix)) - { - } - - public CombineSource(MeshCombineInfo info, RendererSettings settings, Bounds bounds) - { - Construct(info, settings, bounds); - } - - private void Construct(MeshCombineInfo info, RendererSettings settings, Bounds bounds) - { - CombineInfo = info; - RendererSettings = settings; - Position = info.transformMatrix.GetTranslation(); - Bounds = bounds; - } - - public void Combined(CombinedObject root, CombinedObjectPart part) - { - this.onCombined?.Invoke(root, part); - this.onCombinedTyped?.Invoke(root, part); - } - - public void CombineError(CombinedObject root, string errorMessage) - { - if (this.onCombineError == null && this.onCombinedTyped == null) - { - Debug.Log("Error during combine " + root.name + ", reason :" + errorMessage); - return; - } - this.onCombineError?.Invoke(root, errorMessage); - this.onCombineErrorTyped?.Invoke(root, errorMessage); - } - - public void CombineFailed(CombinedObject root) - { - this.onCombineFailed?.Invoke(root); - this.onCombineFailedTyped?.Invoke(root); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTree.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTree.cs deleted file mode 100644 index 2fd39af..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTree.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombineTree : BinaryTree -{ - private ICombinedMeshFactory _factory; - - private float _leafSize; - - private int _vertexLimit; - - public float LeafSize => _leafSize; - - public int VertexLimit => _vertexLimit; - - public ICombinedMeshFactory CombinedMeshFactory => _factory; - - public event Action onStaticCombinedObjectCreated; - - public event Action onDynamicCombinedObjectCreated; - - public event Action onCombinedLODGroupCreated; - - public CombineTree(ICombinedMeshFactory factory, float leafSize, int vertexLimit) - { - _factory = factory; - _leafSize = leafSize; - _vertexLimit = vertexLimit; - } - - public void Combine() - { - TreeTraversal(delegate(CombineTreeNode node, int depth) - { - node.Combine(); - return true; - }); - } - - protected override CombineTreeNode CreateRoot(ICombineSource source) - { - return CreateNode(source.Position, Vector3.one * _leafSize, isLeaf: true); - } - - protected override CombineTreeNode CreateNode(Vector3 center, Vector3 size, bool isLeaf) - { - CombineTreeNode combineTreeNode = new CombineTreeNode(this, center, size, isLeaf); - combineTreeNode.onStaticCombinedObjectCreated += this.onStaticCombinedObjectCreated; - combineTreeNode.onDynamicCombinedObjectCreated += this.onDynamicCombinedObjectCreated; - combineTreeNode.onCombinedLODGroupCreated += this.onCombinedLODGroupCreated; - return combineTreeNode; - } - - protected override CombineTreeNode ExpandRoot(CombineTreeNode root, ICombineSource target) - { - Bounds bounds = root.Bounds; - Bounds bounds2 = target.Bounds; - Vector3 center = Vector3.zero; - Vector3 size = Vector3.zero; - Vector3 center2 = Vector3.zero; - bool flag = false; - for (int i = 0; i < 3; i++) - { - if (bounds2.min[i] < bounds.min[i]) - { - size = bounds.size; - size[i] *= 2f; - center = bounds.center; - center[i] -= bounds.size[i] / 2f; - center2 = bounds.center; - center2[i] -= bounds.size[i]; - break; - } - if (bounds2.max[i] > bounds.max[i]) - { - size = bounds.size; - size[i] *= 2f; - center = bounds.center; - center[i] += bounds.size[i] / 2f; - center2 = bounds.center; - center2[i] += bounds.size[i]; - flag = true; - break; - } - } - CombineTreeNode combineTreeNode = CreateNode(center, size, isLeaf: false); - CombineTreeNode combineTreeNode2 = CreateNode(center2, bounds.size, root.IsLeaf); - if (flag) - { - combineTreeNode.SetChilds(base.RootInternal, combineTreeNode2); - } - else - { - combineTreeNode.SetChilds(combineTreeNode2, base.RootInternal); - } - return combineTreeNode; - } - - protected override bool Includes(CombineTreeNode node, ICombineSource source) - { - Bounds bounds = node.Bounds; - Bounds bounds2 = source.Bounds; - return bounds.Contains(bounds2); - } - - protected override bool Intersects(CombineTreeNode node, ICombineSource source) - { - return node.Bounds.Contains(source.Position); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTreeNode.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTreeNode.cs deleted file mode 100644 index ca4c318..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombineTreeNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombineTreeNode : BinaryTreeNode -{ - private CombineTree _tree; - - private UniversalObjectsCombiner _combiner; - - public event Action onStaticCombinedObjectCreated; - - public event Action onDynamicCombinedObjectCreated; - - public event Action onCombinedLODGroupCreated; - - public CombineTreeNode(CombineTree tree, Vector3 center, Vector3 size, bool isLeaf) - : base(center, size, isLeaf) - { - _tree = tree; - } - - public override void Add(ICombineSource source) - { - if (_combiner == null) - { - _combiner = new UniversalObjectsCombiner(_tree.CombinedMeshFactory, _tree.VertexLimit); - _combiner.onStaticCombinedObjectCreated += this.onStaticCombinedObjectCreated; - _combiner.onDynamicCombinedObjectCreated += this.onDynamicCombinedObjectCreated; - _combiner.onCombinedLODGroupCreated += this.onCombinedLODGroupCreated; - } - _combiner.AddSource(source); - } - - public override void Remove(ICombineSource source) - { - _combiner.RemoveSource(source); - } - - public void Combine() - { - _combiner?.Combine(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroup.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroup.cs deleted file mode 100644 index e5f2a93..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroup.cs +++ /dev/null @@ -1,265 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedLODGroup : MonoBehaviour, ICombinedObject, ICombinedObject -{ - private class LevelOfDetailCombiner : StaticObjectsCombiner - { - private Transform _transform; - - private CombinedLODGroup _group; - - private Renderer[] _renderers; - - private int _level; - - public LevelOfDetailCombiner(int level, CombinedLODGroup group, ICombinedMeshFactory factory, int vertexLimit) - : base(factory, vertexLimit) - { - _level = level; - _group = group; - _transform = new GameObject("LOD" + _level).transform; - _transform.parent = group.transform; - _transform.localPosition = Vector3.zero; - } - - public Renderer[] GetRenderers() - { - if (_renderers == null || _renderers.Length != base.CombinedObjects.Count) - { - UpdateRenderersList(); - } - return _renderers; - } - - public Bounds CalculateBounds() - { - Bounds result = new Bounds(_group.transform.position, Vector3.zero); - GetRenderers(); - for (int i = 0; i < _renderers.Length; i++) - { - if (base.CombinedObjects[i].Parts.Count > 0) - { - result.Encapsulate(_renderers[i].bounds); - } - } - return result; - } - - protected override CombinedObject CreateCombinedObject(CombineSource source) - { - CombinedObject combinedObject = base.CreateCombinedObject(source); - combinedObject.transform.parent = _transform; - _group._updateLODs = true; - return combinedObject; - } - - private void UpdateRenderersList() - { - _renderers = base.CombinedObjects.Select((CombinedObject r) => r.GetComponent()).ToArray(); - } - } - - private LODGroup _group; - - private List _parts; - - private LevelOfDetailCombiner[] _levelCombiners; - - private LOD[] _lods; - - private Bounds _localBounds; - - private int _lodCount; - - private LODGroupSettings _originalSettings; - - private float _originalBoundsSize; - - private bool _updateLODs; - - IReadOnlyList ICombinedObject.Parts => _parts; - - public IReadOnlyList Parts => _parts; - - public LODGroupSettings Settings => _originalSettings; - - public Bounds Bounds - { - get - { - Bounds localBounds = _localBounds; - localBounds.center += base.transform.position; - return localBounds; - } - } - - public static CombinedLODGroup Create(MeshType meshType, CombineMethod combineMethod, LODGroupSettings settings, int vertexLimit = 45000) - { - return Create(new CombinedMeshFactory(meshType, combineMethod), settings, vertexLimit); - } - - public static CombinedLODGroup Create(ICombinedMeshFactory factory, LODGroupSettings settings, int vertexLimit = 45000) - { - CombinedLODGroup combinedLODGroup = new GameObject("CombinedLODGroup").AddComponent(); - combinedLODGroup.Construct(settings, factory, vertexLimit); - return combinedLODGroup; - } - - private void Construct(LODGroupSettings settings, ICombinedMeshFactory factory, int vertexLimit) - { - if (factory == null) - { - throw new ArgumentException("CombinedLODGroup::factory is null"); - } - _group = base.gameObject.AddComponent(); - _parts = new List(); - _group.fadeMode = settings.fadeMode; - _group.animateCrossFading = settings.animateCrossFading; - _originalSettings = settings; - _lodCount = _originalSettings.lodCount; - _levelCombiners = new LevelOfDetailCombiner[_lodCount]; - _lods = new LOD[_originalSettings.lodCount]; - for (int i = 0; i < _originalSettings.lodCount; i++) - { - _levelCombiners[i] = new LevelOfDetailCombiner(i, this, factory, vertexLimit); - _lods[i] = new LOD - { - fadeTransitionWidth = _originalSettings.fadeTransitionsWidth[i], - screenRelativeTransitionHeight = _originalSettings.screenTransitionsHeight[i], - renderers = null - }; - } - } - - public void Combine(IEnumerable sources) - { - Combine(sources.Select((ICombineSource s) => (LODGroupCombineSource)s)); - } - - public void Combine(IEnumerable sourceGroups) - { - if (sourceGroups == null || sourceGroups.Count() == 0) - { - throw new ArgumentException("CombinedLODGroup::sources is null"); - } - LODGroupCombineSource[] array = sourceGroups.ToArray(); - if (_parts.Count == 0) - { - InitBeforeFirstCombine(array); - } - List[] combinedParts = FillCombinersAndCreateBaseParts(array); - for (int i = 0; i < _lodCount; i++) - { - _levelCombiners[i].Combine(); - } - RecalculateBounds(); - if (_updateLODs) - { - UpdateLODs(); - _updateLODs = false; - } - CreatePartsAndNotifySources(array, combinedParts); - } - - public void Destroy(CombinedLODGroupPart part, IList baseParts) - { - if (_parts.Remove(part)) - { - for (int i = 0; i < baseParts.Count; i++) - { - baseParts[i].Destroy(); - } - RecalculateBounds(); - } - } - - private void InitBeforeFirstCombine(LODGroupCombineSource[] sources) - { - Vector3 zero = Vector3.zero; - for (int i = 0; i < sources.Length; i++) - { - zero += sources[i].Position; - } - base.transform.position = zero / sources.Length; - _originalBoundsSize = sources[0].Bounds.size.magnitude; - } - - private List[] FillCombinersAndCreateBaseParts(LODGroupCombineSource[] sourceGroups) - { - List[] parts = new List[sourceGroups.Length]; - for (int i = 0; i < sourceGroups.Length; i++) - { - LODGroupCombineSource sourceGroup = sourceGroups[i]; - parts[i] = new List(); - for (int j = 0; j < _lodCount; j++) - { - CombineSource[] array = sourceGroup.BaseSources[j]; - foreach (CombineSource obj in array) - { - int g = i; - obj.onCombinedTyped += delegate(CombinedObject o, CombinedObjectPart p) - { - parts[g].Add(p); - }; - obj.onCombineErrorTyped += delegate(CombinedObject root, string msg) - { - sourceGroup.CombineError(this, msg); - }; - } - _levelCombiners[j].AddSources(array); - } - } - return parts; - } - - private void RecalculateBounds() - { - _localBounds = new Bounds(base.transform.position, Vector3.zero); - for (int i = 0; i < _levelCombiners.Length; i++) - { - _localBounds.Encapsulate(_levelCombiners[i].CalculateBounds()); - } - _localBounds.center -= base.transform.position; - } - - private void UpdateLODs() - { - float value = _localBounds.size.magnitude / _originalBoundsSize; - float num = 1f; - value = Mathf.Clamp(value, 1f, 100f); - for (int i = 0; i < _lodCount; i++) - { - LOD lOD = _lods[i]; - lOD.renderers = _levelCombiners[i].GetRenderers(); - lOD.screenRelativeTransitionHeight = _originalSettings.screenTransitionsHeight[i] * value; - if (lOD.screenRelativeTransitionHeight >= num) - { - num = (lOD.screenRelativeTransitionHeight = num - 0.03f); - } - _lods[i] = lOD; - } - _group.SetLODs(_lods); - } - - private void CreatePartsAndNotifySources(LODGroupCombineSource[] sourceGroups, List[] combinedParts) - { - for (int i = 0; i < sourceGroups.Length; i++) - { - LODGroupCombineSource lODGroupCombineSource = sourceGroups[i]; - List list = combinedParts[i]; - if (list.Count == 0) - { - lODGroupCombineSource.CombineFailed(this); - continue; - } - CombinedLODGroupPart combinedLODGroupPart = new CombinedLODGroupPart(this, list); - _parts.Add(combinedLODGroupPart); - lODGroupCombineSource.Combined(this, combinedLODGroupPart); - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupMatcher.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupMatcher.cs deleted file mode 100644 index ef1b3c7..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupMatcher.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class CombinedLODGroupMatcher : CombinedObjectMatcher -{ - private LODGroupSettings _settings; - - public override void StartMatching(CombinedLODGroup combinedObject) - { - _settings = combinedObject.Settings; - } - - public override bool CanAddSource(LODGroupCombineSource source) - { - return source.Settings.IsEqual(_settings, 0.01f, 0.01f); - } - - public override void SourceAdded(LODGroupCombineSource source) - { - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupPart.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupPart.cs deleted file mode 100644 index 95c9c00..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedLODGroupPart.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedLODGroupPart : ICombinedObjectPart, ICombinedObjectPart -{ - private List _baseParts; - - private Bounds _localBounds; - - ICombinedObject ICombinedObjectPart.Root => Root; - - public CombinedLODGroup Root { get; private set; } - - public Bounds LocalBounds => _localBounds; - - public Bounds Bounds - { - get - { - Bounds localBounds = _localBounds; - localBounds.center += Root.transform.position; - return localBounds; - } - } - - public CombinedLODGroupPart(CombinedLODGroup root, List baseParts) - { - Root = root; - _baseParts = baseParts; - CalculateLocalBounds(); - } - - public void Destroy() - { - Root.Destroy(this, _baseParts); - } - - private void CalculateLocalBounds() - { - _localBounds = _baseParts[0].Bounds; - for (int i = 1; i < _baseParts.Count; i++) - { - _localBounds.Encapsulate(_baseParts[i].Bounds); - } - _localBounds.center -= Root.transform.position; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMesh.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMesh.cs deleted file mode 100644 index fd9933b..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMesh.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedMesh : IDisposable -{ - private Mesh _mesh; - - private CombinedMeshDataInternal _meshData; - - private IMeshCombiner _combiner; - - private IMeshCutter _cutter; - - public Mesh Mesh => _mesh; - - public CombinedMeshData MeshData => _meshData; - - public CombinedMesh(IMeshCombiner combiner, IMeshCutter cutter) - { - if (combiner == null) - { - throw new ArgumentNullException("MeshCombiner not assigned"); - } - if (cutter == null) - { - throw new ArgumentNullException("MeshCutter not assigned"); - } - _mesh = new Mesh(); - _mesh.MarkDynamic(); - _combiner = combiner; - _cutter = cutter; - _meshData = CreateMeshData(); - _meshData.Initialize(this); - } - - public CombinedMeshPart[] Combine(IList infos) - { - _combiner.Combine(_mesh, infos); - return _meshData.CreateParts(infos); - } - - public void Cut(IList parts) - { - MeshCuttingInfo[] array = new MeshCuttingInfo[parts.Count]; - for (int i = 0; i < parts.Count; i++) - { - CombinedMeshPart combinedMeshPart = parts[i]; - array[i] = new MeshCuttingInfo - { - vertexStart = combinedMeshPart.VertexStart, - vertexCount = combinedMeshPart.VertexCount, - triangleStart = combinedMeshPart.TrianglesStart, - triangleCount = combinedMeshPart.TrianglesCount - }; - } - _cutter.Cut(_mesh, array); - _meshData.RemoveParts(parts); - } - - public void Dispose() - { - _meshData.Dispose(); - } - - protected virtual CombinedMeshDataInternal CreateMeshData() - { - return new CombinedMeshDataInternal(); - } -} -public class CombinedMesh : CombinedMesh where TCombinedMeshData : CombinedMeshDataInternal, new() -{ - public TCombinedMeshData MeshDataInternal => (TCombinedMeshData)base.MeshData; - - public CombinedMesh(IMeshCombiner combiner, IMeshCutter cutter) - : base(combiner, cutter) - { - } - - protected override CombinedMeshDataInternal CreateMeshData() - { - return new TCombinedMeshData(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshData.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshData.cs deleted file mode 100644 index 06afc2b..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshData.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public abstract class CombinedMeshData -{ - public abstract int PartsCount { get; } - - public abstract int VertexCount { get; } - - public abstract Bounds GetBounds(); - - public abstract Bounds GetBounds(CombinedMeshPart part); - - public abstract IEnumerable GetParts(); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshDataInternal.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshDataInternal.cs deleted file mode 100644 index c055f95..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshDataInternal.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedMeshDataInternal : CombinedMeshData, IDisposable -{ - private CombinedMesh _root; - - private List _parts; - - private int _vertexCount; - - private int _trianglesCount; - - private List _partsBounds; - - private Bounds _boundingBox; - - public override int PartsCount => _parts.Count; - - public override int VertexCount => _vertexCount; - - protected CombinedMesh Root => _root; - - public void Initialize(CombinedMesh root) - { - _root = root; - _parts = new List(); - OnInitialized(); - } - - public override Bounds GetBounds() - { - return _boundingBox; - } - - public override Bounds GetBounds(CombinedMeshPart part) - { - return _partsBounds[part.Index]; - } - - public override IEnumerable GetParts() - { - for (int i = 0; i < _parts.Count; i++) - { - yield return _parts[i]; - } - } - - public void Dispose() - { - OnDispose(); - } - - public CombinedMeshPart[] CreateParts(IList infos) - { - CombinedMeshPart[] array = new CombinedMeshPart[infos.Count]; - for (int i = 0; i < array.Length; i++) - { - MeshCombineInfo meshCombineInfo = infos[i]; - Mesh mesh = meshCombineInfo.mesh; - Matrix4x4 transformMatrix = meshCombineInfo.transformMatrix; - int vertexCount = _vertexCount; - int vertexCount2 = meshCombineInfo.vertexCount; - int trianglesCount = _trianglesCount; - int trianglesCount2 = meshCombineInfo.trianglesCount; - CombinedMeshPartInternal combinedMeshPartInternal = new CombinedMeshPartInternal(_root, _parts.Count, vertexCount, vertexCount2, trianglesCount, trianglesCount2); - _parts.Add(combinedMeshPartInternal); - array[i] = combinedMeshPartInternal; - _vertexCount += vertexCount2; - _trianglesCount += trianglesCount2; - OnAddPart(combinedMeshPartInternal, mesh, transformMatrix); - } - OnMeshUpdated(); - return array; - } - - public void RemoveParts(IList parts) - { - for (int i = 0; i < parts.Count; i++) - { - CombinedMeshPartInternal combinedMeshPartInternal = (CombinedMeshPartInternal)parts[i]; - OnRemovePart(combinedMeshPartInternal); - int num = _parts.IndexOf(combinedMeshPartInternal); - int vertexCount = combinedMeshPartInternal.VertexCount; - int trianglesCount = combinedMeshPartInternal.TrianglesCount; - for (int j = num + 1; j < _parts.Count; j++) - { - CombinedMeshPartInternal combinedMeshPartInternal2 = _parts[j]; - combinedMeshPartInternal2.Offset(newVertexStart: combinedMeshPartInternal2.VertexStart - vertexCount, newTrianglesStart: combinedMeshPartInternal2.TrianglesStart - trianglesCount, newIndex: combinedMeshPartInternal2.Index - 1); - } - _parts.Remove(combinedMeshPartInternal); - _vertexCount -= combinedMeshPartInternal.VertexCount; - _trianglesCount -= combinedMeshPartInternal.TrianglesCount; - } - OnMeshUpdated(); - } - - protected virtual void OnInitialized() - { - _partsBounds = new List(); - } - - protected virtual void OnAddPart(CombinedMeshPart part, Mesh mesh, Matrix4x4 transform) - { - _partsBounds.Add(mesh.bounds.Transform(transform)); - } - - protected virtual void OnRemovePart(CombinedMeshPart part) - { - _partsBounds.RemoveAt(part.Index); - } - - protected virtual void OnMeshUpdated() - { - _boundingBox = _root.Mesh.bounds; - } - - protected virtual void OnDispose() - { - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs deleted file mode 100644 index 850efd8..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshFactory.cs +++ /dev/null @@ -1,43 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedMeshFactory : ICombinedMeshFactory -{ - private IMeshToolsFactory _tools; - - private IMovableCombinedMeshFactory _movableMeshFactory; - - public CombinedMeshFactory(MeshType meshType, CombineMethod combineMethod, MoveMethod moveMethod = MoveMethod.Simple) - { - if (meshType == MeshType.Standard) - { - _tools = new SimpleToolsSTDFactory(); - if (moveMethod == MoveMethod.Simple) - { - _movableMeshFactory = new SimpleMovableMeshSTDFactory(_tools); - } - else - { - _movableMeshFactory = new JobsMovableMeshSTDFactory(_tools); - } - return; - } - _tools = new SimpleToolsLWFactory(); - if (moveMethod == MoveMethod.Simple) - { - Debug.Log("Simple mover not implemented yet for lightweight meshes. Jobs mover will be used instead"); - } - _movableMeshFactory = new JobsMovableMeshLWFactory(_tools); - } - - public CombinedMesh CreateCombinedMesh() - { - return new CombinedMesh(_tools.CreateMeshCombiner(), _tools.CreateMeshCutter()); - } - - public CombinedMesh CreateMovableCombinedMesh(out ICombinedMeshMover mover) - { - return _movableMeshFactory.CreateMovableMesh(out mover); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPart.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPart.cs deleted file mode 100644 index 9034a26..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPart.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class CombinedMeshPart -{ - public CombinedMesh Root { get; private set; } - - public int Index { get; protected set; } - - public int VertexStart { get; protected set; } - - public int VertexCount { get; protected set; } - - public int TrianglesStart { get; protected set; } - - public int TrianglesCount { get; protected set; } - - public CombinedMeshPart(CombinedMesh root, int index, int vertexStart, int vertexCount, int trianglesStart, int trianglesCount) - { - Root = root; - Index = index; - VertexStart = vertexStart; - VertexCount = vertexCount; - TrianglesStart = trianglesStart; - TrianglesCount = trianglesCount; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPartInternal.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPartInternal.cs deleted file mode 100644 index 9bc07cd..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedMeshPartInternal.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class CombinedMeshPartInternal : CombinedMeshPart -{ - public CombinedMeshPartInternal(CombinedMesh root, int index, int vertexStart, int vertexCount, int trianglesStart, int trianglesCount) - : base(root, index, vertexStart, vertexCount, trianglesStart, trianglesCount) - { - } - - public void Offset(int newIndex, int newVertexStart, int newTrianglesStart) - { - base.Index = newIndex; - base.VertexStart = newVertexStart; - base.TrianglesStart = newTrianglesStart; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObject.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObject.cs deleted file mode 100644 index 5a7bc43..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObject.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedObject : MonoBehaviour, ICombinedObject, ICombinedObject -{ - private CombinedMesh _combinedMesh; - - private CombinedMeshDataInternal _meshData; - - private List _parts; - - private List _destroyedMeshParts; - - private RendererSettings _rendererSettings; - - private bool _updating; - - IReadOnlyList ICombinedObject.Parts => _parts; - - public IReadOnlyList Parts => _parts; - - public RendererSettings RendererSettings => _rendererSettings; - - public Bounds Bounds - { - get - { - Bounds localBounds = LocalBounds; - localBounds.center += base.transform.position; - return localBounds; - } - } - - public Bounds LocalBounds => _combinedMesh.MeshData.GetBounds(); - - public int VertexCount => _combinedMesh.MeshData.VertexCount; - - public bool Updating - { - get - { - return _updating; - } - set - { - _updating = value; - base.enabled = value; - } - } - - private void Update() - { - if (!Updating) - { - base.enabled = false; - return; - } - ForceUpdate(); - base.enabled = false; - } - - private void OnDestroy() - { - _combinedMesh.Dispose(); - } - - public static CombinedObject Create(MeshType meshType, CombineMethod combineType, RendererSettings settings) - { - return Create(new CombinedMeshFactory(meshType, combineType), settings); - } - - public static CombinedObject Create(ICombinedMeshFactory factory, RendererSettings settings) - { - return Create(factory.CreateCombinedMesh(), settings); - } - - public static CombinedObject Create(CombinedMesh combinedMesh, RendererSettings settings) - { - CombinedObject combinedObject = new GameObject("Combined Object").AddComponent(); - combinedObject.Construct(combinedMesh, settings); - return combinedObject; - } - - private void Construct(CombinedMesh combinedMesh, RendererSettings settings) - { - _combinedMesh = combinedMesh; - _meshData = (CombinedMeshDataInternal)_combinedMesh.MeshData; - _parts = new List(); - _destroyedMeshParts = new List(); - _rendererSettings = settings; - _updating = true; - if (combinedMesh.MeshData.PartsCount > 0) - { - foreach (CombinedMeshPart part in combinedMesh.MeshData.GetParts()) - { - _parts.Add(new CombinedObjectPart(this, part)); - } - } - CreateMeshFilter(_combinedMesh.Mesh); - CreateMeshRenderer(settings); - } - - public void ForceUpdate() - { - if (_destroyedMeshParts.Count > 0) - { - _combinedMesh.Cut(_destroyedMeshParts); - _destroyedMeshParts.Clear(); - } - } - - public Bounds GetLocalBounds(CombinedObjectPart part) - { - return _meshData.GetBounds(part.MeshPart); - } - - public Bounds GetBounds(CombinedObjectPart part) - { - Bounds localBounds = GetLocalBounds(part); - localBounds.center += base.transform.position; - return localBounds; - } - - public void Combine(IEnumerable sources) - { - Combine(sources.Select((ICombineSource s) => (CombineSource)s)); - } - - public void Combine(IEnumerable sources) - { - if (_parts.Count == 0) - { - base.transform.position = GetAveragePosition(sources); - } - Vector3 position = base.transform.position; - int num = sources.Count(); - int num2 = 0; - MeshCombineInfo[] array = new MeshCombineInfo[num]; - foreach (CombineSource source in sources) - { - MeshCombineInfo combineInfo = source.CombineInfo; - combineInfo.transformMatrix = combineInfo.transformMatrix.SetTranslation(source.Position - position); - array[num2++] = combineInfo; - } - try - { - CombinedMeshPart[] array2 = _combinedMesh.Combine(array); - num2 = 0; - foreach (CombineSource source2 in sources) - { - CombinedObjectPart combinedObjectPart = new CombinedObjectPart(this, array2[num2]); - _parts.Add(combinedObjectPart); - source2.Combined(this, combinedObjectPart); - num2++; - } - } - catch (Exception ex) - { - string errorMessage = ex.Message + ex.StackTrace; - foreach (CombineSource source3 in sources) - { - source3.CombineError(this, errorMessage); - source3.CombineFailed(this); - } - } - } - - public void Destroy(CombinedObjectPart part) - { - if (_parts.Remove(part)) - { - _destroyedMeshParts.Add(part.MeshPart); - base.enabled = true; - } - } - - private void CreateMeshFilter(Mesh mesh) - { - base.gameObject.AddComponent().sharedMesh = mesh; - } - - private void CreateMeshRenderer(RendererSettings settings) - { - MeshRenderer meshRenderer = base.gameObject.AddComponent(); - meshRenderer.sharedMaterial = settings.material; - meshRenderer.shadowCastingMode = settings.shadowMode; - meshRenderer.receiveShadows = settings.receiveShadows; - meshRenderer.lightmapIndex = settings.lightmapIndex; - meshRenderer.realtimeLightmapIndex = settings.realtimeLightmapIndex; - meshRenderer.tag = settings.tag; - meshRenderer.gameObject.layer = settings.layer; - } - - private Vector3 GetAveragePosition(IEnumerable sources) - { - Vector3 zero = Vector3.zero; - int num = 0; - foreach (CombineSource source in sources) - { - zero += source.Position; - num++; - } - return zero / num; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectMatcher.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectMatcher.cs deleted file mode 100644 index 57e39b7..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectMatcher.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace NGS.MeshFusionPro; - -public abstract class CombinedObjectMatcher where TCombinedObject : ICombinedObject where TCombineSource : ICombineSource -{ - public abstract void StartMatching(TCombinedObject combinedObject); - - public abstract bool CanAddSource(TCombineSource source); - - public abstract void SourceAdded(TCombineSource source); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectPart.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectPart.cs deleted file mode 100644 index ca434ff..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/CombinedObjectPart.cs +++ /dev/null @@ -1,35 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class CombinedObjectPart : ICombinedObjectPart, ICombinedObjectPart -{ - private bool _destroyed; - - ICombinedObject ICombinedObjectPart.Root => Root; - - public CombinedObject Root { get; private set; } - - public CombinedMeshPart MeshPart { get; private set; } - - public Bounds LocalBounds => Root.GetLocalBounds(this); - - public Bounds Bounds => Root.GetBounds(this); - - public CombinedObjectPart(CombinedObject root, CombinedMeshPart meshPart) - { - Root = root; - MeshPart = meshPart; - } - - public void Destroy() - { - if (_destroyed) - { - Debug.Log("CombinedPart already destroyed"); - return; - } - Root.Destroy(this); - _destroyed = true; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombineSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombineSource.cs deleted file mode 100644 index dcbf244..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombineSource.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class DynamicCombineSource : ICombineSource, ICombineSource -{ - private CombineSource _base; - - public CombineSource Base => _base; - - public Vector3 Position => _base.Position; - - public Bounds Bounds => _base.Bounds; - - public event Action onCombined; - - public event Action onCombineError; - - public event Action onCombineFailed; - - public event Action onCombinedTyped; - - public event Action onCombineErrorTyped; - - public event Action onCombineFailedTyped; - - public DynamicCombineSource(GameObject go, int submeshIndex = 0) - { - _base = new CombineSource(go, submeshIndex); - } - - public DynamicCombineSource(Mesh mesh, MeshRenderer renderer, int submeshIndex = 0) - { - _base = new CombineSource(mesh, renderer, submeshIndex); - } - - public DynamicCombineSource(MeshCombineInfo info, RendererSettings settings) - { - _base = new CombineSource(info, settings); - } - - public DynamicCombineSource(MeshCombineInfo info, RendererSettings settings, Bounds bounds) - { - _base = new CombineSource(info, settings, bounds); - } - - public void Combined(DynamicCombinedObject root, DynamicCombinedObjectPart part) - { - this.onCombined?.Invoke(root, part); - this.onCombinedTyped?.Invoke(root, part); - } - - public void CombineError(DynamicCombinedObject root, string errorMessage) - { - if (this.onCombineError == null && this.onCombineErrorTyped == null) - { - Debug.Log("Error during combine " + root.name + ", reason :" + errorMessage); - return; - } - this.onCombineError?.Invoke(root, errorMessage); - this.onCombineErrorTyped?.Invoke(root, errorMessage); - } - - public void CombineFailed(DynamicCombinedObject root) - { - this.onCombineFailed?.Invoke(root); - this.onCombineFailedTyped?.Invoke(root); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObject.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObject.cs deleted file mode 100644 index 464bee8..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObject.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class DynamicCombinedObject : MonoBehaviour, ICombinedObject, ICombinedObject -{ - private CombinedObject _baseObject; - - private List _parts; - - private ICombinedMeshMover _meshMover; - - private List _movedParts; - - private List _movedPartsData; - - private bool _partsMoved; - - IReadOnlyList ICombinedObject.Parts => _parts; - - public IReadOnlyList Parts => _parts; - - public RendererSettings RendererSettings => _baseObject.RendererSettings; - - public Bounds Bounds => _baseObject.Bounds; - - public Bounds LocalBounds => _baseObject.LocalBounds; - - public int VertexCount => _baseObject.VertexCount; - - private void Update() - { - if (_movedParts.Count > 0) - { - if (_meshMover is IAsyncCombinedMeshMover asyncCombinedMeshMover) - { - asyncCombinedMeshMover.MovePartsAsync(_movedPartsData); - } - else - { - _meshMover.MoveParts(_movedPartsData); - } - for (int i = 0; i < _movedParts.Count; i++) - { - _movedParts[i].PositionUpdated(); - } - _movedParts.Clear(); - _movedPartsData.Clear(); - _partsMoved = true; - } - } - - private void LateUpdate() - { - if (_partsMoved) - { - if (_meshMover is IAsyncCombinedMeshMover asyncCombinedMeshMover) - { - asyncCombinedMeshMover.FinishAsyncMoving(); - } - _meshMover.ApplyData(); - _partsMoved = false; - } - _baseObject.ForceUpdate(); - if (_movedParts.Count == 0) - { - base.enabled = false; - } - } - - private void OnDestroy() - { - if (_meshMover is IDisposable disposable) - { - disposable.Dispose(); - } - } - - public static DynamicCombinedObject Create(MeshType meshType, CombineMethod combineMethod, MoveMethod moveMethod, RendererSettings settings) - { - return Create(new CombinedMeshFactory(meshType, combineMethod, moveMethod), settings); - } - - public static DynamicCombinedObject Create(ICombinedMeshFactory factory, RendererSettings settings) - { - ICombinedMeshMover mover; - CombinedObject combinedObject = CombinedObject.Create(factory.CreateMovableCombinedMesh(out mover), settings); - DynamicCombinedObject dynamicCombinedObject = combinedObject.gameObject.AddComponent(); - dynamicCombinedObject.Construct(combinedObject, mover); - return dynamicCombinedObject; - } - - private void Construct(CombinedObject baseObject, ICombinedMeshMover mover) - { - base.gameObject.name = "Dynamic Combined Object"; - _baseObject = baseObject; - _meshMover = mover; - _parts = new List(); - _movedParts = new List(); - _movedPartsData = new List(); - _baseObject.Updating = false; - } - - public void Combine(IEnumerable sources) - { - Combine(sources.Select((ICombineSource s) => (DynamicCombineSource)s)); - } - - public void Combine(IEnumerable sources) - { - int num = sources.Count(); - CombineSource[] array = new CombineSource[num]; - _ = new DynamicCombinedObjectPart[num]; - int num2 = 0; - foreach (DynamicCombineSource source in sources) - { - CombineSource baseSource = source.Base; - array[num2++] = baseSource; - baseSource.onCombinedTyped += delegate(CombinedObject root, CombinedObjectPart part) - { - DynamicCombinedObjectPart dynamicCombinedObjectPart = new DynamicCombinedObjectPartInternal(this, part, baseSource.CombineInfo.transformMatrix); - _parts.Add(dynamicCombinedObjectPart); - source.Combined(this, dynamicCombinedObjectPart); - }; - baseSource.onCombineErrorTyped += delegate(CombinedObject root, string message) - { - source.CombineError(this, message); - }; - baseSource.onCombineFailedTyped += delegate - { - source.CombineFailed(this); - }; - } - _baseObject.Combine(array); - } - - public void UpdatePart(DynamicCombinedObjectPartInternal part) - { - _movedParts.Add(part); - _movedPartsData.Add(part.CreateMoveInfo()); - base.enabled = true; - } - - public void Destroy(DynamicCombinedObjectPart dynamicPart, CombinedObjectPart basePart) - { - if (_parts.Remove(dynamicPart)) - { - basePart.Destroy(); - base.enabled = true; - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs deleted file mode 100644 index cf76052..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectMatcher.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class DynamicCombinedObjectMatcher : CombinedObjectMatcher -{ - private RendererSettings _settings; - - private int _vertexCount; - - private int _vertexLimit; - - public DynamicCombinedObjectMatcher(int vertexLimit) - { - _vertexLimit = vertexLimit; - } - - public override void StartMatching(DynamicCombinedObject combinedObject) - { - _settings = combinedObject.RendererSettings; - _vertexCount = combinedObject.VertexCount; - } - - public override bool CanAddSource(DynamicCombineSource source) - { - if (!_settings.Equals(source.Base.RendererSettings)) - { - return false; - } - if (_vertexCount + source.Base.CombineInfo.vertexCount > _vertexLimit) - { - return false; - } - return true; - } - - public override void SourceAdded(DynamicCombineSource source) - { - _vertexCount += source.Base.CombineInfo.vertexCount; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPart.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPart.cs deleted file mode 100644 index c2ff95d..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPart.cs +++ /dev/null @@ -1,44 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public abstract class DynamicCombinedObjectPart : ICombinedObjectPart, ICombinedObjectPart -{ - protected DynamicCombinedObject _root; - - protected CombinedObjectPart _basePart; - - private bool _destroyed; - - ICombinedObject ICombinedObjectPart.Root => Root; - - public DynamicCombinedObject Root => _root; - - public Bounds LocalBounds => _basePart.LocalBounds; - - public Bounds Bounds => _basePart.Bounds; - - public DynamicCombinedObjectPart(DynamicCombinedObject root, CombinedObjectPart basePart, Matrix4x4 transformMatrix) - { - _root = root; - _basePart = basePart; - } - - public abstract void Move(Vector3 position, Quaternion rotation, Vector3 scale); - - public abstract void Move(Matrix4x4 transform); - - public abstract void MoveLocal(Matrix4x4 localTransform); - - public void Destroy() - { - if (_destroyed) - { - Debug.Log("Part already destroyed"); - } - else - { - _root.Destroy(this, _basePart); - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPartInternal.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPartInternal.cs deleted file mode 100644 index d7a0c1c..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicCombinedObjectPartInternal.cs +++ /dev/null @@ -1,61 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class DynamicCombinedObjectPartInternal : DynamicCombinedObjectPart -{ - private Matrix4x4 _localTransform; - - private Matrix4x4 _targetLocalTransform; - - private Matrix4x4 _worldToLocalMatrix; - - private bool _inMove; - - public DynamicCombinedObjectPartInternal(DynamicCombinedObject root, CombinedObjectPart basePart, Matrix4x4 transformMatrix) - : base(root, basePart, transformMatrix) - { - Vector3 pos = transformMatrix.GetTranslation() - root.transform.position; - _localTransform = transformMatrix.SetTranslation(pos); - _worldToLocalMatrix = base.Root.transform.worldToLocalMatrix; - } - - public override void Move(Vector3 position, Quaternion rotation, Vector3 scale) - { - Move(Matrix4x4.TRS(position, rotation, scale)); - } - - public override void Move(Matrix4x4 transform) - { - Matrix4x4 localTransform = _worldToLocalMatrix * transform; - MoveLocal(localTransform); - } - - public override void MoveLocal(Matrix4x4 localTransform) - { - if (!_inMove) - { - _targetLocalTransform = localTransform; - _root.UpdatePart(this); - _inMove = true; - } - } - - public PartMoveInfo CreateMoveInfo() - { - CombinedMeshPart meshPart = _basePart.MeshPart; - PartMoveInfo result = default(PartMoveInfo); - result.partIndex = meshPart.Index; - result.vertexStart = meshPart.VertexStart; - result.vertexCount = meshPart.VertexCount; - result.currentTransform = _localTransform; - result.targetTransform = _targetLocalTransform; - return result; - } - - public void PositionUpdated() - { - _localTransform = _targetLocalTransform; - _inMove = false; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicMeshFusionSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicMeshFusionSource.cs deleted file mode 100644 index bf92aec..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicMeshFusionSource.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class DynamicMeshFusionSource : MeshFusionSource -{ - [SerializeField] - [HideInInspector] - private MeshRenderer _renderer; - - [SerializeField] - [HideInInspector] - private MeshFilter _filter; - - [SerializeField] - [HideInInspector] - private Mesh _mesh; - - private DynamicCombineSource[] _sources; - - private DynamicCombinedObjectPart[] _parts; - - public override bool TryGetBounds(ref Bounds bounds) - { - if (_renderer != null) - { - bounds = _renderer.bounds; - return true; - } - return false; - } - - protected override void OnSourceCombinedInternal(ICombinedObject root, ICombinedObjectPart part) - { - for (int i = 0; i < _parts.Length; i++) - { - if (_parts[i] == null) - { - _parts[i] = (DynamicCombinedObjectPart)part; - return; - } - } - throw new Exception("Unexpected Behaviour"); - } - - protected override bool CheckCompatibilityAndGetComponents(out string incompatibilityReason) - { - incompatibilityReason = ""; - return CanCreateCombineSource(base.gameObject, ref incompatibilityReason, ref _renderer, ref _filter, ref _mesh); - } - - protected override void CreateSources() - { - if (_sources == null) - { - _sources = new DynamicCombineSource[_mesh.subMeshCount]; - } - if (_parts == null) - { - _parts = new DynamicCombinedObjectPart[_mesh.subMeshCount]; - } - for (int i = 0; i < _sources.Length; i++) - { - _sources[i] = new DynamicCombineSource(_mesh, _renderer, i); - } - } - - protected override IEnumerable GetCombineSources() - { - if (_sources == null) - { - yield break; - } - for (int i = 0; i < _sources.Length; i++) - { - DynamicCombineSource dynamicCombineSource = _sources[i]; - if (dynamicCombineSource == null) - { - break; - } - yield return dynamicCombineSource; - } - } - - protected override IEnumerable GetCombinedParts() - { - if (_parts == null) - { - yield break; - } - for (int i = 0; i < _parts.Length; i++) - { - DynamicCombinedObjectPart dynamicCombinedObjectPart = _parts[i]; - if (dynamicCombinedObjectPart == null) - { - break; - } - yield return dynamicCombinedObjectPart; - } - } - - protected override void ClearSources() - { - if (_sources != null) - { - for (int i = 0; i < _sources.Length && _sources[i] != null; i++) - { - _sources[i] = null; - } - } - } - - protected override void ClearParts() - { - if (_parts != null) - { - for (int i = 0; i < _parts.Length; i++) - { - _parts[i] = null; - } - } - } - - protected override void ToggleComponents(bool enabled) - { - _renderer.enabled = enabled; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicObjectsCombiner.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicObjectsCombiner.cs deleted file mode 100644 index a7d6115..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/DynamicObjectsCombiner.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public class DynamicObjectsCombiner : ObjectsCombiner -{ - private ICombinedMeshFactory _factory; - - private DynamicCombinedObjectMatcher _matcher; - - private int _vertexLimit; - - public DynamicObjectsCombiner(ICombinedMeshFactory factory, int vertexLimit) - { - _factory = factory; - _matcher = new DynamicCombinedObjectMatcher(vertexLimit); - _vertexLimit = vertexLimit; - } - - public override void AddSource(DynamicCombineSource source) - { - if (source.Base.CombineInfo.vertexCount < _vertexLimit) - { - base.AddSource(source); - } - } - - protected override void CombineSources(DynamicCombinedObject root, IList sources) - { - root.Combine(sources); - } - - protected override DynamicCombinedObject CreateCombinedObject(DynamicCombineSource source) - { - return DynamicCombinedObject.Create(_factory, source.Base.RendererSettings); - } - - protected override CombinedObjectMatcher GetMatcher() - { - return _matcher; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IAsyncCombinedMeshMover.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IAsyncCombinedMeshMover.cs deleted file mode 100644 index 07f0de8..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IAsyncCombinedMeshMover.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public interface IAsyncCombinedMeshMover : ICombinedMeshMover -{ - void MovePartsAsync(IList moveInfos); - - void FinishAsyncMoving(); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IBinaryTreeNode.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IBinaryTreeNode.cs deleted file mode 100644 index c25beae..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IBinaryTreeNode.cs +++ /dev/null @@ -1,20 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public interface IBinaryTreeNode -{ - Vector3 Center { get; } - - Vector3 Size { get; } - - Bounds Bounds { get; } - - bool HasChilds { get; } - - bool IsLeaf { get; } - - IBinaryTreeNode GetLeft(); - - IBinaryTreeNode GetRight(); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombineSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombineSource.cs deleted file mode 100644 index 2b147b7..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombineSource.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public interface ICombineSource -{ - Vector3 Position { get; } - - Bounds Bounds { get; } - - event Action onCombined; - - event Action onCombineError; - - event Action onCombineFailed; -} -public interface ICombineSource : ICombineSource where TCombinedObject : ICombinedObject where TCombinedPart : ICombinedObjectPart -{ - event Action onCombinedTyped; - - event Action onCombineErrorTyped; - - event Action onCombineFailedTyped; -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshFactory.cs deleted file mode 100644 index 98d71f7..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshFactory.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace NGS.MeshFusionPro; - -public interface ICombinedMeshFactory -{ - CombinedMesh CreateCombinedMesh(); - - CombinedMesh CreateMovableCombinedMesh(out ICombinedMeshMover mover); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshMover.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshMover.cs deleted file mode 100644 index 05560a1..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedMeshMover.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public interface ICombinedMeshMover -{ - void MoveParts(IList moveInfos); - - void ApplyData(); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObject.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObject.cs deleted file mode 100644 index 5c2bb55..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObject.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public interface ICombinedObject -{ - IReadOnlyList Parts { get; } - - void Combine(IEnumerable sources); -} -public interface ICombinedObject : ICombinedObject where TCombinedPart : ICombinedObjectPart where TCombinedSource : ICombineSource -{ - new IReadOnlyList Parts { get; } - - void Combine(IEnumerable sources); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObjectPart.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObjectPart.cs deleted file mode 100644 index b5a0f08..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ICombinedObjectPart.cs +++ /dev/null @@ -1,18 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public interface ICombinedObjectPart -{ - ICombinedObject Root { get; } - - Bounds Bounds { get; } - - Bounds LocalBounds { get; } - - void Destroy(); -} -public interface ICombinedObjectPart : ICombinedObjectPart where TCombinedObject : ICombinedObject -{ - new TCombinedObject Root { get; } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCombiner.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCombiner.cs deleted file mode 100644 index ccd84ce..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCombiner.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public interface IMeshCombiner -{ - void Combine(Mesh mesh, IList combineInfos); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCutter.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCutter.cs deleted file mode 100644 index f9af704..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshCutter.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public interface IMeshCutter -{ - void Cut(Mesh mesh, MeshCuttingInfo cuttingInfo); - - void Cut(Mesh mesh, IList cuttingInfos); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshToolsFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshToolsFactory.cs deleted file mode 100644 index 2d670e2..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMeshToolsFactory.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace NGS.MeshFusionPro; - -public interface IMeshToolsFactory -{ - IMeshCombiner CreateMeshCombiner(); - - IMeshCutter CreateMeshCutter(); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMovableCombinedMeshFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMovableCombinedMeshFactory.cs deleted file mode 100644 index 555d632..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/IMovableCombinedMeshFactory.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace NGS.MeshFusionPro; - -public interface IMovableCombinedMeshFactory -{ - CombinedMesh CreateMovableMesh(out ICombinedMeshMover mover); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ISourceTrackingStrategy.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ISourceTrackingStrategy.cs deleted file mode 100644 index ba5db36..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ISourceTrackingStrategy.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace NGS.MeshFusionPro; - -public interface ISourceTrackingStrategy -{ - bool OnUpdate(); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverLW.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverLW.cs deleted file mode 100644 index b2ea31d..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverLW.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using Unity.Burst; -using Unity.Collections; -using Unity.Jobs; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class JobsMeshMoverLW : IAsyncCombinedMeshMover, ICombinedMeshMover, IDisposable -{ - [BurstCompile] - private struct MovePartsJob : IJobParallelFor - { - [NativeDisableParallelForRestriction] - public NativeArray vertices; - - [ReadOnly] - public NativeArray localVertices; - - [WriteOnly] - [NativeDisableParallelForRestriction] - public NativeArray bounds; - - [ReadOnly] - [NativeDisableParallelForRestriction] - public NativeArray localBounds; - - [ReadOnly] - public NativeList moveInfos; - - public void Execute(int idx) - { - PartMoveInfo partMoveInfo = moveInfos[idx]; - int partIndex = partMoveInfo.partIndex; - int vertexStart = partMoveInfo.vertexStart; - int num = vertexStart + partMoveInfo.vertexCount; - Matrix4x4 targetTransform = partMoveInfo.targetTransform; - for (int i = vertexStart; i < num; i++) - { - LightweightVertex lightweightVertex = localVertices[i]; - float w = lightweightVertex.tanW; - Vector3 normalized = targetTransform.MultiplyVector(lightweightVertex.Normal).normalized; - Vector4 tangent = targetTransform.MultiplyVector(lightweightVertex.Tangent).normalized; - tangent.w = w; - LightweightVertex lightweightVertex2 = default(LightweightVertex); - lightweightVertex2.Position = targetTransform.MultiplyPoint3x4(lightweightVertex.Position); - lightweightVertex2.Normal = normalized; - lightweightVertex2.Tangent = tangent; - lightweightVertex2.uv = lightweightVertex.uv; - lightweightVertex2.uv2 = lightweightVertex.uv2; - LightweightVertex value = lightweightVertex2; - vertices[i] = value; - } - bounds[partIndex] = localBounds[partIndex].Transform(targetTransform); - } - } - - [BurstCompile] - private struct RecalculateBoundsJob : IJob - { - public NativeArray bounds; - - public NativeArray boundingBox; - - public void Execute() - { - Bounds value = boundingBox[0]; - value.size = Vector3.zero; - for (int i = 0; i < bounds.Length; i++) - { - value.Encapsulate(bounds[i]); - } - boundingBox[0] = value; - } - } - - private MeshDataNativeArraysLW _meshData; - - private NativeList _moveInfos; - - private JobHandle _handle; - - public JobsMeshMoverLW(MeshDataNativeArraysLW meshData) - { - _meshData = meshData; - _moveInfos = new NativeList(Allocator.Persistent); - } - - public void MoveParts(IList moveInfos) - { - MovePartsAsync(moveInfos); - FinishAsyncMoving(); - } - - public void MovePartsAsync(IList moveInfos) - { - NativeArray bounds = _meshData.Bounds; - bounds[0] = new Bounds(_meshData.GetBounds().center, Vector3.zero); - _moveInfos.Clear(); - for (int i = 0; i < moveInfos.Count; i++) - { - ref NativeList moveInfos2 = ref _moveInfos; - PartMoveInfo value = moveInfos[i]; - moveInfos2.Add(in value); - } - MovePartsJob movePartsJob = default(MovePartsJob); - movePartsJob.vertices = _meshData.Vertices; - movePartsJob.bounds = _meshData.PartsBounds; - movePartsJob.localVertices = _meshData.VerticesLocal; - movePartsJob.localBounds = _meshData.PartsBoundsLocal; - movePartsJob.moveInfos = _moveInfos; - MovePartsJob jobData = movePartsJob; - RecalculateBoundsJob recalculateBoundsJob = default(RecalculateBoundsJob); - recalculateBoundsJob.bounds = _meshData.PartsBounds; - recalculateBoundsJob.boundingBox = bounds; - RecalculateBoundsJob jobData2 = recalculateBoundsJob; - _handle = jobData2.Schedule(IJobParallelForExtensions.Schedule(jobData, _moveInfos.Length, 4)); - } - - public void FinishAsyncMoving() - { - _handle.Complete(); - } - - public void ApplyData() - { - if (!_handle.IsCompleted) - { - FinishAsyncMoving(); - } - _meshData.ApplyDataToMesh(); - } - - public void Dispose() - { - _moveInfos.Dispose(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverSTD.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverSTD.cs deleted file mode 100644 index 535b8af..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMeshMoverSTD.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections.Generic; -using Unity.Burst; -using Unity.Collections; -using Unity.Jobs; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class JobsMeshMoverSTD : IAsyncCombinedMeshMover, ICombinedMeshMover, IDisposable -{ - [BurstCompile] - private struct MovePartsJob : IJobParallelFor - { - [NativeDisableParallelForRestriction] - public NativeArray vertices; - - [NativeDisableParallelForRestriction] - public NativeArray normals; - - [NativeDisableParallelForRestriction] - public NativeArray tangents; - - [WriteOnly] - [NativeDisableParallelForRestriction] - public NativeArray bounds; - - [ReadOnly] - [NativeDisableParallelForRestriction] - public NativeArray localBounds; - - [ReadOnly] - public NativeList moveInfos; - - public void Execute(int idx) - { - PartMoveInfo partMoveInfo = moveInfos[idx]; - int partIndex = partMoveInfo.partIndex; - int vertexStart = partMoveInfo.vertexStart; - int num = vertexStart + partMoveInfo.vertexCount; - Matrix4x4 targetTransform = partMoveInfo.targetTransform; - Matrix4x4 inverse = partMoveInfo.currentTransform.inverse; - for (int i = vertexStart; i < num; i++) - { - Vector3 point = vertices[i]; - Vector3 vector = normals[i]; - Vector4 vector2 = tangents[i]; - float w = vector2.w; - point = inverse.MultiplyPoint3x4(point); - point = targetTransform.MultiplyPoint3x4(point); - vector = inverse.MultiplyVector(vector); - vector = targetTransform.MultiplyVector(vector); - vector2 = inverse.MultiplyVector(vector2); - vector2 = targetTransform.MultiplyVector(vector2); - vector2.w = w; - vertices[i] = point; - normals[i] = vector; - tangents[i] = vector2; - } - bounds[partIndex] = localBounds[partIndex].Transform(targetTransform); - } - } - - [BurstCompile] - private struct RecalculateBoundsJob : IJob - { - public NativeArray bounds; - - public NativeArray boundingBox; - - public void Execute() - { - Bounds value = boundingBox[0]; - for (int i = 0; i < bounds.Length; i++) - { - value.Encapsulate(bounds[i]); - } - boundingBox[0] = value; - } - } - - private MeshDataNativeArraysSTD _meshData; - - private NativeList _moveInfos; - - private JobHandle _handle; - - public JobsMeshMoverSTD(MeshDataNativeArraysSTD meshData) - { - _meshData = meshData; - _moveInfos = new NativeList(Allocator.Persistent); - } - - public void MoveParts(IList moveInfos) - { - MovePartsAsync(moveInfos); - FinishAsyncMoving(); - } - - public void MovePartsAsync(IList moveInfos) - { - NativeArray bounds = _meshData.Bounds; - bounds[0] = new Bounds(_meshData.GetBounds().center, Vector3.zero); - _moveInfos.Clear(); - for (int i = 0; i < moveInfos.Count; i++) - { - ref NativeList moveInfos2 = ref _moveInfos; - PartMoveInfo value = moveInfos[i]; - moveInfos2.Add(in value); - } - MovePartsJob movePartsJob = default(MovePartsJob); - movePartsJob.vertices = _meshData.Vertices; - movePartsJob.normals = _meshData.Normals; - movePartsJob.tangents = _meshData.Tangents; - movePartsJob.bounds = _meshData.PartsBounds; - movePartsJob.localBounds = _meshData.PartsBoundsLocal; - movePartsJob.moveInfos = _moveInfos; - MovePartsJob jobData = movePartsJob; - RecalculateBoundsJob recalculateBoundsJob = default(RecalculateBoundsJob); - recalculateBoundsJob.bounds = _meshData.PartsBounds; - recalculateBoundsJob.boundingBox = bounds; - RecalculateBoundsJob jobData2 = recalculateBoundsJob; - _handle = jobData2.Schedule(IJobParallelForExtensions.Schedule(jobData, _moveInfos.Length, 4)); - } - - public void FinishAsyncMoving() - { - _handle.Complete(); - } - - public void ApplyData() - { - if (!_handle.IsCompleted) - { - FinishAsyncMoving(); - } - _meshData.ApplyDataToMesh(); - } - - public void Dispose() - { - _moveInfos.Dispose(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshLWFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshLWFactory.cs deleted file mode 100644 index 4790976..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshLWFactory.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class JobsMovableMeshLWFactory : IMovableCombinedMeshFactory -{ - private IMeshToolsFactory _tools; - - public JobsMovableMeshLWFactory(IMeshToolsFactory tools) - { - _tools = tools; - } - - public CombinedMesh CreateMovableMesh(out ICombinedMeshMover mover) - { - CombinedMesh combinedMesh = new CombinedMesh(_tools.CreateMeshCombiner(), _tools.CreateMeshCutter()); - mover = new JobsMeshMoverLW(combinedMesh.MeshDataInternal); - return combinedMesh; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshSTDFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshSTDFactory.cs deleted file mode 100644 index 36402f5..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/JobsMovableMeshSTDFactory.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class JobsMovableMeshSTDFactory : IMovableCombinedMeshFactory -{ - private IMeshToolsFactory _tools; - - public JobsMovableMeshSTDFactory(IMeshToolsFactory tools) - { - _tools = tools; - } - - public CombinedMesh CreateMovableMesh(out ICombinedMeshMover mover) - { - CombinedMesh combinedMesh = new CombinedMesh(_tools.CreateMeshCombiner(), _tools.CreateMeshCutter()); - mover = new JobsMeshMoverSTD(combinedMesh.MeshDataInternal); - return combinedMesh; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupCombineSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupCombineSource.cs deleted file mode 100644 index 66c640b..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupCombineSource.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class LODGroupCombineSource : ICombineSource, ICombineSource -{ - private Bounds _bounds; - - private LODGroupSettings _settings; - - private CombineSource[][] _sources; - - public Vector3 Position { get; private set; } - - public Bounds Bounds => _bounds; - - public LODGroup LODGroup { get; private set; } - - public LODGroupSettings Settings => _settings; - - public CombineSource[][] BaseSources => _sources; - - public event Action onCombined; - - public event Action onCombineError; - - public event Action onCombineFailed; - - public event Action onCombinedTyped; - - public event Action onCombineErrorTyped; - - public event Action onCombineFailedTyped; - - public LODGroupCombineSource(LODGroup group) - { - LODGroup = group; - Position = group.transform.position; - LOD[] lODs = group.GetLODs(); - _settings = new LODGroupSettings(group); - _sources = new CombineSource[_settings.lodCount][]; - _bounds = new Bounds(group.localReferencePoint + Position, Vector3.zero); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - CreateSourcesArray(i, renderers); - FillSources(i, renderers); - } - } - - public void Combined(CombinedLODGroup root, CombinedLODGroupPart part) - { - this.onCombined?.Invoke(root, part); - this.onCombinedTyped?.Invoke(root, part); - } - - public void CombineError(CombinedLODGroup root, string errorMessage) - { - if (this.onCombineError == null && this.onCombineErrorTyped == null) - { - Debug.Log("Combine error occured : " + root.name + ", reason : " + errorMessage); - return; - } - this.onCombineError?.Invoke(root, errorMessage); - this.onCombineErrorTyped?.Invoke(root, errorMessage); - } - - public void CombineFailed(CombinedLODGroup root) - { - this.onCombineFailed?.Invoke(root); - this.onCombineFailedTyped?.Invoke(root); - } - - private void CreateSourcesArray(int level, Renderer[] renderers) - { - int num = 0; - for (int i = 0; i < renderers.Length; i++) - { - if (!(renderers[i] == null)) - { - num += renderers[i].sharedMaterials.Length; - } - } - _sources[level] = new CombineSource[num]; - } - - private void FillSources(int level, Renderer[] renderers) - { - int num = 0; - for (int i = 0; i < renderers.Length; i++) - { - MeshRenderer meshRenderer = (MeshRenderer)renderers[i]; - if (!(meshRenderer == null)) - { - Mesh sharedMesh = meshRenderer.GetComponent().sharedMesh; - for (int j = 0; j < sharedMesh.subMeshCount; j++) - { - _sources[level][num] = new CombineSource(sharedMesh, meshRenderer, j); - num++; - } - _bounds.Encapsulate(meshRenderer.bounds); - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupSettings.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupSettings.cs deleted file mode 100644 index b0d123f..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupSettings.cs +++ /dev/null @@ -1,63 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public struct LODGroupSettings -{ - public float size; - - public int lodCount; - - public LODFadeMode fadeMode; - - public bool animateCrossFading; - - public float[] screenTransitionsHeight; - - public float[] fadeTransitionsWidth; - - public LODGroupSettings(LODGroup group) - { - size = group.size; - lodCount = group.lodCount; - fadeMode = group.fadeMode; - animateCrossFading = group.animateCrossFading; - screenTransitionsHeight = new float[lodCount]; - fadeTransitionsWidth = new float[lodCount]; - LOD[] lODs = group.GetLODs(); - for (int i = 0; i < lodCount; i++) - { - LOD lOD = lODs[i]; - screenTransitionsHeight[i] = lOD.screenRelativeTransitionHeight; - fadeTransitionsWidth[i] = lOD.fadeTransitionWidth; - } - } - - public bool IsEqual(LODGroupSettings settings, float screenHeightThreshold = 0.0001f, float fadeWidthThreshold = 0.0001f) - { - if (lodCount != settings.lodCount) - { - return false; - } - if (fadeMode != settings.fadeMode) - { - return false; - } - if (animateCrossFading != settings.animateCrossFading) - { - return false; - } - for (int i = 0; i < lodCount; i++) - { - if (Mathf.Abs(screenTransitionsHeight[i] - settings.screenTransitionsHeight[i]) > screenHeightThreshold) - { - return false; - } - if (Mathf.Abs(fadeTransitionsWidth[i] - settings.fadeTransitionsWidth[i]) > fadeWidthThreshold) - { - return false; - } - } - return true; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupsCombiner.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupsCombiner.cs deleted file mode 100644 index 961bf28..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODGroupsCombiner.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public class LODGroupsCombiner : ObjectsCombiner -{ - private ICombinedMeshFactory _factory; - - private CombinedLODGroupMatcher _matcher; - - private int _vertexLimit; - - public LODGroupsCombiner(ICombinedMeshFactory factory, int vertexLimit) - { - _factory = factory; - _matcher = new CombinedLODGroupMatcher(); - _vertexLimit = vertexLimit; - } - - protected override CombinedLODGroup CreateCombinedObject(LODGroupCombineSource source) - { - return CombinedLODGroup.Create(_factory, source.Settings, _vertexLimit); - } - - protected override void CombineSources(CombinedLODGroup root, IList sources) - { - root.Combine(sources); - } - - protected override CombinedObjectMatcher GetMatcher() - { - return _matcher; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODMeshFusionSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODMeshFusionSource.cs deleted file mode 100644 index 4b941b9..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LODMeshFusionSource.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class LODMeshFusionSource : MeshFusionSource -{ - [SerializeField] - [HideInInspector] - private LODGroup _group; - - private LODGroupCombineSource _source; - - private CombinedLODGroupPart _part; - - private Bounds? _savedBounds; - - public override bool TryGetBounds(ref Bounds bounds) - { - if (_source != null) - { - bounds = _source.Bounds; - return true; - } - if (_part != null) - { - bounds = _part.Bounds; - return true; - } - if (_savedBounds.HasValue) - { - bounds = _savedBounds.Value; - return true; - } - if (base.IsIncompatible) - { - return false; - } - LOD[] lODs = _group.GetLODs(); - bounds = new Bounds(base.transform.position, Vector3.zero); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - for (int j = 0; j < renderers.Length; j++) - { - if (!(renderers[j] == null)) - { - bounds.Encapsulate(renderers[j].bounds); - } - } - } - _savedBounds = bounds; - return true; - } - - protected override void OnSourceCombinedInternal(ICombinedObject root, ICombinedObjectPart part) - { - _part = (CombinedLODGroupPart)part; - } - - protected override bool CheckCompatibilityAndGetComponents(out string incompatibilityReason) - { - if (_group == null) - { - _group = GetComponent(); - } - if (_group == null) - { - incompatibilityReason = "LODGroup not found"; - return false; - } - incompatibilityReason = ""; - MeshFilter filter = null; - Mesh mesh = null; - LOD[] lODs = _group.GetLODs(); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - for (int j = 0; j < renderers.Length; j++) - { - MeshRenderer renderer = renderers[j] as MeshRenderer; - if (!(renderer == null) && !CanCreateCombineSource(renderer.gameObject, ref incompatibilityReason, ref renderer, ref filter, ref mesh)) - { - return false; - } - } - } - return true; - } - - protected override void CreateSources() - { - _source = new LODGroupCombineSource(_group); - } - - protected override IEnumerable GetCombineSources() - { - if (_source != null) - { - yield return _source; - } - } - - protected override IEnumerable GetCombinedParts() - { - if (_part != null) - { - yield return _part; - } - } - - protected override void ClearSources() - { - if (_source != null) - { - _source = null; - } - } - - protected override void ClearParts() - { - if (_part != null) - { - _part = null; - } - } - - protected override void ToggleComponents(bool enabled) - { - LOD[] lODs = _group.GetLODs(); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - for (int j = 0; j < renderers.Length; j++) - { - renderers[j].enabled = enabled; - } - } - _group.enabled = enabled; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LightweightVertex.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LightweightVertex.cs deleted file mode 100644 index 5c5de9e..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/LightweightVertex.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Unity.Mathematics; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public struct LightweightVertex -{ - public float3 pos; - - public sbyte normX; - - public sbyte normY; - - public sbyte normZ; - - public sbyte normW; - - public sbyte tanX; - - public sbyte tanY; - - public sbyte tanZ; - - public sbyte tanW; - - public half2 uv; - - public half2 uv2; - - public Vector3 Position - { - get - { - return pos; - } - set - { - pos = value; - } - } - - public Vector3 Normal - { - get - { - return new Vector3((float)normX / 127f, (float)normY / 127f, (float)normZ / 127f); - } - set - { - normX = (sbyte)(value.x * 127f); - normY = (sbyte)(value.y * 127f); - normZ = (sbyte)(value.z * 127f); - normW = 1; - } - } - - public Vector4 Tangent - { - get - { - return new Vector4((float)tanX / 127f, (float)tanY / 127f, (float)tanZ / 127f, (float)tanW / 127f); - } - set - { - tanX = (sbyte)(value.x * 127f); - tanY = (sbyte)(value.y * 127f); - tanZ = (sbyte)(value.z * 127f); - tanW = (sbyte)(value.w * 127f); - } - } - - public Vector2 UV - { - get - { - return new Vector2(uv.x, uv.y); - } - set - { - uv = new half2((half)value.x, (half)value.y); - } - } - - public Vector2 UV2 - { - get - { - return new Vector2(uv2.x, uv2.y); - } - set - { - uv2 = new half2((half)value.x, (half)value.y); - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MatrixHelper.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MatrixHelper.cs deleted file mode 100644 index feb92b1..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MatrixHelper.cs +++ /dev/null @@ -1,18 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public static class MatrixHelper -{ - public static Vector3 GetTranslation(this Matrix4x4 matrix) - { - return matrix.GetColumn(3); - } - - public static Matrix4x4 SetTranslation(this Matrix4x4 matrix, Vector3 pos) - { - Matrix4x4 result = matrix; - result.SetColumn(3, new Vector4(pos.x, pos.y, pos.z, 1f)); - return result; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombineInfo.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombineInfo.cs deleted file mode 100644 index ed879cb..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombineInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; - -namespace NGS.MeshFusionPro; - -public struct MeshCombineInfo -{ - public Mesh mesh; - - public Matrix4x4 transformMatrix; - - public Vector4 lightmapScaleOffset; - - public Vector4 realtimeLightmapScaleOffset; - - public int submeshIndex; - - public readonly int vertexCount; - - public readonly int trianglesCount; - - public MeshCombineInfo(Mesh mesh, int submeshIndex = 0) - : this(mesh, Matrix4x4.identity, submeshIndex) - { - } - - public MeshCombineInfo(Mesh mesh, Matrix4x4 transformMatrix, int submeshIndex = 0) - : this(mesh, transformMatrix, new Vector4(1f, 1f, 0f, 0f), new Vector4(1f, 1f, 0f, 0f), submeshIndex) - { - } - - public MeshCombineInfo(Mesh mesh, Matrix4x4 transformMatrix, Vector4 lightmapScaleOffset, Vector4 realtimeLightmapScaleOffset, int submeshIndex = 0) - { - this.mesh = mesh; - this.transformMatrix = transformMatrix; - this.lightmapScaleOffset = lightmapScaleOffset; - this.realtimeLightmapScaleOffset = realtimeLightmapScaleOffset; - this.submeshIndex = submeshIndex; - SubMeshDescriptor subMesh = mesh.GetSubMesh(submeshIndex); - vertexCount = subMesh.vertexCount; - trianglesCount = subMesh.indexCount; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerBase.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerBase.cs deleted file mode 100644 index 34804fd..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerBase.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public abstract class MeshCombinerBase : IMeshCombiner -{ - public void Combine(Mesh mesh, IList infos) - { - ValidateMesh(mesh); - ValidateCombineInfos(infos); - CombineInternal(mesh, infos); - } - - protected abstract void CombineInternal(Mesh mesh, IList infos); - - protected virtual void ValidateMesh(Mesh mesh) - { - if (mesh == null) - { - throw new ArgumentNullException("mesh"); - } - if (mesh.subMeshCount > 1) - { - throw new ArgumentException("BaseMeshCombiner::input 'mesh' should have 1 submesh"); - } - } - - protected virtual void ValidateCombineInfos(IList infos) - { - if (infos == null) - { - throw new ArgumentNullException("MeshCombineInfos is null"); - } - for (int i = 0; i < infos.Count; i++) - { - if (infos[i].mesh == null) - { - throw new ArgumentNullException("MeshCombineInfo.mesh is null"); - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleLW.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleLW.cs deleted file mode 100644 index 50e6031..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleLW.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshCombinerSimpleLW : MeshCombinerBase -{ - private MeshCombinerSimpleSTD _stdCombiner; - - public MeshCombinerSimpleLW() - { - _stdCombiner = new MeshCombinerSimpleSTD(); - } - - protected override void CombineInternal(Mesh mesh, IList infos) - { - VertexBufferUtil.ToStandardBuffer(mesh); - try - { - _stdCombiner.Combine(mesh, infos); - VertexBufferUtil.ToLightweightBuffer(mesh); - } - catch - { - VertexBufferUtil.ToLightweightBuffer(mesh); - throw; - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleSTD.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleSTD.cs deleted file mode 100644 index 3e9fb86..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCombinerSimpleSTD.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshCombinerSimpleSTD : MeshCombinerBase -{ - private MeshSeparatorSimple _meshSeparator; - - public MeshCombinerSimpleSTD() - { - _meshSeparator = new MeshSeparatorSimple(); - } - - protected override void CombineInternal(Mesh mesh, IList infos) - { - CombineInstance[] array = new CombineInstance[infos.Count + 1]; - Mesh mesh2 = Object.Instantiate(mesh); - array[0] = CreateCombineInstance(new MeshCombineInfo(mesh2)); - for (int i = 0; i < infos.Count; i++) - { - array[i + 1] = CreateCombineInstance(infos[i]); - } - mesh.CombineMeshes(array, mergeSubMeshes: true, useMatrices: true, hasLightmapData: true); - } - - private CombineInstance CreateCombineInstance(MeshCombineInfo info) - { - Mesh mesh = info.mesh; - if (mesh.subMeshCount > 1) - { - mesh = _meshSeparator.GetSubmesh(mesh, info.submeshIndex); - } - CombineInstance result = default(CombineInstance); - result.mesh = mesh; - result.subMeshIndex = 0; - result.transform = info.transformMatrix; - result.lightmapScaleOffset = info.lightmapScaleOffset; - result.realtimeLightmapScaleOffset = info.realtimeLightmapScaleOffset; - return result; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleLW.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleLW.cs deleted file mode 100644 index 4a70c56..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleLW.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Unity.Collections; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshCutterSimpleLW : IMeshCutter -{ - private static List _triangles; - - static MeshCutterSimpleLW() - { - _triangles = new List(); - } - - public void Cut(Mesh mesh, MeshCuttingInfo info) - { - Cut(mesh, new MeshCuttingInfo[1] { info }); - } - - public void Cut(Mesh mesh, IList infos) - { - ValidateMeshOrThrowException(mesh); - mesh.GetTriangles(_triangles, 0); - using (Mesh.MeshDataArray meshDataArray = Mesh.AcquireReadOnlyMeshData(mesh)) - { - NativeArray other = meshDataArray[0].GetVertexData(); - NativeList nativeList = new NativeList(Allocator.Temp); - nativeList.CopyFrom(in other); - foreach (MeshCuttingInfo item in infos.OrderByDescending((MeshCuttingInfo i) => i.triangleStart)) - { - nativeList.RemoveRange(item.vertexStart, item.vertexCount); - _triangles.RemoveRange(item.triangleStart, item.triangleCount); - OffsetTriangles(item); - } - mesh.SetTriangles(_triangles, 0); - mesh.SetVertexBufferData(nativeList, 0, 0, nativeList.Length); - } - _triangles.Clear(); - } - - private void ValidateMeshOrThrowException(Mesh mesh) - { - if (mesh == null) - { - throw new ArgumentNullException("mesh"); - } - if (mesh.subMeshCount > 1) - { - throw new ArgumentException("SimpleMeshCutter::'mesh' should has only 1 submesh"); - } - } - - private void OffsetTriangles(MeshCuttingInfo info) - { - int vertexCount = info.vertexCount; - int triangleStart = info.triangleStart; - int count = _triangles.Count; - for (int i = triangleStart; i < count; i++) - { - _triangles[i] -= vertexCount; - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleSTD.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleSTD.cs deleted file mode 100644 index 950f0e9..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCutterSimpleSTD.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshCutterSimpleSTD : IMeshCutter -{ - private static List _vertices; - - private static List _normals; - - private static List _tangents; - - private static List _triangles; - - private static List[] _uvs; - - private static int _maxUVsCount; - - static MeshCutterSimpleSTD() - { - _maxUVsCount = 4; - _vertices = new List(); - _normals = new List(); - _tangents = new List(); - _triangles = new List(); - _uvs = new List[_maxUVsCount]; - for (int i = 0; i < _maxUVsCount; i++) - { - _uvs[i] = new List(); - } - } - - public void Cut(Mesh mesh, MeshCuttingInfo info) - { - Cut(mesh, new MeshCuttingInfo[1] { info }); - } - - public void Cut(Mesh mesh, IList infos) - { - ValidateMeshOrThrowException(mesh); - CollectData(mesh); - foreach (MeshCuttingInfo item in infos.OrderByDescending((MeshCuttingInfo i) => i.triangleStart)) - { - RemoveData(item); - OffsetTriangles(item); - } - ApplyDataToMesh(mesh); - ClearData(); - } - - private void ValidateMeshOrThrowException(Mesh mesh) - { - if (mesh == null) - { - throw new ArgumentNullException("mesh is null"); - } - if (mesh.subMeshCount > 1) - { - throw new ArgumentException("SimpleMeshCutter::'mesh' should has only 1 submesh"); - } - } - - private void CollectData(Mesh mesh) - { - mesh.GetVertices(_vertices); - mesh.GetNormals(_normals); - mesh.GetTangents(_tangents); - mesh.GetTriangles(_triangles, 0); - for (int i = 0; i < _maxUVsCount; i++) - { - mesh.GetUVs(i, _uvs[i]); - } - } - - private void RemoveData(MeshCuttingInfo cuttingInfo) - { - int vertexStart = cuttingInfo.vertexStart; - int vertexCount = cuttingInfo.vertexCount; - _vertices.RemoveRange(vertexStart, vertexCount); - if (_normals.Count > 0) - { - _normals.RemoveRange(vertexStart, vertexCount); - } - if (_tangents.Count > 0) - { - _tangents.RemoveRange(vertexStart, vertexCount); - } - _triangles.RemoveRange(cuttingInfo.triangleStart, cuttingInfo.triangleCount); - for (int i = 0; i < _uvs.Length; i++) - { - if (_uvs[i].Count > 0) - { - _uvs[i].RemoveRange(vertexStart, vertexCount); - } - } - } - - private void OffsetTriangles(MeshCuttingInfo info) - { - int vertexCount = info.vertexCount; - int triangleStart = info.triangleStart; - int count = _triangles.Count; - for (int i = triangleStart; i < count; i++) - { - _triangles[i] -= vertexCount; - } - } - - private void ApplyDataToMesh(Mesh mesh) - { - mesh.SetTriangles(_triangles, 0); - mesh.SetVertices(_vertices); - mesh.SetNormals(_normals); - mesh.SetTangents(_tangents); - for (int i = 0; i < _maxUVsCount; i++) - { - if (_uvs[i].Count > 0) - { - mesh.SetUVs(i, _uvs[i]); - } - } - } - - private void ClearData() - { - _vertices.Clear(); - _normals.Clear(); - _tangents.Clear(); - _triangles.Clear(); - for (int i = 0; i < _maxUVsCount; i++) - { - _uvs[i].Clear(); - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCuttingInfo.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCuttingInfo.cs deleted file mode 100644 index a295571..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshCuttingInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace NGS.MeshFusionPro; - -public struct MeshCuttingInfo -{ - public int vertexStart; - - public int vertexCount; - - public int triangleStart; - - public int triangleCount; - - public MeshCuttingInfo(int vertexStart, int vertexCount, int triangleStart, int triangleCount) - { - this.vertexStart = vertexStart; - this.vertexCount = vertexCount; - this.triangleStart = triangleStart; - this.triangleCount = triangleCount; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataListsSTD.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataListsSTD.cs deleted file mode 100644 index 1bf34eb..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataListsSTD.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshDataListsSTD : CombinedMeshDataInternal -{ - private CombinedMesh _root; - - private List _vertices; - - private List _normals; - - private List _tangents; - - private List _partsBounds; - - private List _partsBoundsLocal; - - public List Vertices => _vertices; - - public List Normals => _normals; - - public List Tangents => _tangents; - - public List PartsBounds => _partsBounds; - - public List PartsBoundsLocal => _partsBoundsLocal; - - public Bounds Bounds { get; set; } - - public override Bounds GetBounds() - { - return Bounds; - } - - public override Bounds GetBounds(CombinedMeshPart part) - { - return _partsBounds[part.Index]; - } - - public void ApplyDataToMesh() - { - Mesh mesh = _root.Mesh; - mesh.SetVertices(_vertices); - mesh.SetNormals(_normals); - mesh.SetTangents(_tangents); - mesh.bounds = Bounds; - } - - protected override void OnInitialized() - { - _root = base.Root; - _vertices = new List(); - _normals = new List(); - _tangents = new List(); - _partsBounds = new List(); - _partsBoundsLocal = new List(); - } - - protected override void OnAddPart(CombinedMeshPart part, Mesh mesh, Matrix4x4 transform) - { - Bounds bounds = mesh.bounds; - Bounds item = bounds.Transform(transform); - _partsBounds.Add(item); - _partsBoundsLocal.Add(bounds); - } - - protected override void OnRemovePart(CombinedMeshPart part) - { - _partsBounds.RemoveAt(part.Index); - _partsBoundsLocal.RemoveAt(part.Index); - } - - protected override void OnMeshUpdated() - { - Mesh mesh = _root.Mesh; - mesh.GetVertices(_vertices); - mesh.GetNormals(_normals); - mesh.GetTangents(_tangents); - Bounds = mesh.bounds; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysLW.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysLW.cs deleted file mode 100644 index 939d022..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysLW.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System.Collections.Generic; -using Unity.Collections; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshDataNativeArraysLW : CombinedMeshDataInternal -{ - private CombinedMesh _root; - - private NativeList _vertices; - - private NativeList _partsBounds; - - private NativeArray _bounds; - - private NativeList _verticesLocal; - - private NativeList _partsBoundsLocal; - - private List _tempVertices; - - private List _tempNormals; - - private List _tempTangents; - - private List _tempUV; - - private List _tempUV2; - - public NativeArray Vertices => _vertices; - - public NativeArray PartsBounds => _partsBounds; - - public NativeArray Bounds => _bounds; - - public NativeArray VerticesLocal => _verticesLocal; - - public NativeArray PartsBoundsLocal => _partsBoundsLocal; - - public override Bounds GetBounds() - { - return _bounds[0]; - } - - public override Bounds GetBounds(CombinedMeshPart part) - { - return _partsBounds[part.Index]; - } - - public void ApplyDataToMesh() - { - Mesh mesh = _root.Mesh; - mesh.SetVertexBufferData(Vertices, 0, 0, _vertices.Length); - mesh.bounds = _bounds[0]; - } - - protected override void OnInitialized() - { - _root = base.Root; - VertexBufferUtil.ToLightweightBuffer(_root.Mesh); - _vertices = new NativeList(Allocator.Persistent); - _partsBounds = new NativeList(Allocator.Persistent); - _bounds = new NativeArray(1, Allocator.Persistent); - _verticesLocal = new NativeList(Allocator.Persistent); - _partsBoundsLocal = new NativeList(Allocator.Persistent); - _tempVertices = new List(); - _tempNormals = new List(); - _tempTangents = new List(); - _tempUV = new List(); - _tempUV2 = new List(); - } - - protected override void OnAddPart(CombinedMeshPart part, Mesh mesh, Matrix4x4 transform) - { - Bounds value = mesh.bounds; - Bounds value2 = value.Transform(transform); - _partsBounds.Add(in value2); - _partsBoundsLocal.Add(in value); - mesh.GetVertices(_tempVertices); - mesh.GetNormals(_tempNormals); - mesh.GetTangents(_tempTangents); - mesh.GetUVs(0, _tempUV); - mesh.GetUVs(1, _tempUV2); - int vertexCount = mesh.vertexCount; - for (int i = 0; i < vertexCount; i++) - { - LightweightVertex value3 = default(LightweightVertex); - value3.Position = _tempVertices[i]; - value3.Normal = _tempNormals[i]; - value3.Tangent = _tempTangents[i]; - if (_tempUV.Count > 0) - { - value3.UV = _tempUV[i]; - } - if (_tempUV2.Count > 0) - { - value3.UV2 = _tempUV2[i]; - } - _verticesLocal.Add(in value3); - } - } - - protected override void OnRemovePart(CombinedMeshPart part) - { - _partsBounds.RemoveAt(part.Index); - _verticesLocal.RemoveRange(part.VertexStart, part.VertexCount); - _partsBoundsLocal.RemoveAt(part.Index); - } - - protected override void OnMeshUpdated() - { - Mesh mesh = _root.Mesh; - using (Mesh.MeshDataArray meshDataArray = Mesh.AcquireReadOnlyMeshData(mesh)) - { - Mesh.MeshData meshData = meshDataArray[0]; - _vertices.Clear(); - _vertices.AddRange(meshData.GetVertexData()); - } - _bounds[0] = mesh.bounds; - } - - protected override void OnDispose() - { - _vertices.Dispose(); - _partsBounds.Dispose(); - _bounds.Dispose(); - _verticesLocal.Dispose(); - _partsBoundsLocal.Dispose(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysSTD.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysSTD.cs deleted file mode 100644 index 3063894..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshDataNativeArraysSTD.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Unity.Collections; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class MeshDataNativeArraysSTD : CombinedMeshDataInternal -{ - private CombinedMesh _root; - - private NativeList _vertices; - - private NativeList _normals; - - private NativeList _tangents; - - private NativeList _partsBounds; - - private NativeList _partsBoundsLocal; - - private NativeArray _bounds; - - public NativeArray Vertices => _vertices; - - public NativeArray Normals => _normals; - - public NativeArray Tangents => _tangents; - - public NativeArray PartsBounds => _partsBounds; - - public NativeArray PartsBoundsLocal => _partsBoundsLocal; - - public NativeArray Bounds => _bounds; - - public override Bounds GetBounds() - { - return _bounds[0]; - } - - public override Bounds GetBounds(CombinedMeshPart part) - { - return _partsBounds[part.Index]; - } - - public void ApplyDataToMesh() - { - Mesh mesh = _root.Mesh; - mesh.SetVertices(Vertices); - mesh.SetNormals(Normals); - mesh.SetTangents(Tangents); - mesh.bounds = _bounds[0]; - } - - protected override void OnInitialized() - { - _root = base.Root; - _vertices = new NativeList(Allocator.Persistent); - _normals = new NativeList(Allocator.Persistent); - _tangents = new NativeList(Allocator.Persistent); - _partsBounds = new NativeList(Allocator.Persistent); - _partsBoundsLocal = new NativeList(Allocator.Persistent); - _bounds = new NativeArray(1, Allocator.Persistent); - } - - protected override void OnAddPart(CombinedMeshPart part, Mesh mesh, Matrix4x4 transform) - { - Bounds value = mesh.bounds; - Bounds value2 = value.Transform(transform); - _partsBounds.Add(in value2); - _partsBoundsLocal.Add(in value); - } - - protected override void OnRemovePart(CombinedMeshPart part) - { - _partsBounds.RemoveAt(part.Index); - _partsBoundsLocal.RemoveAt(part.Index); - } - - protected override void OnMeshUpdated() - { - Mesh mesh = _root.Mesh; - int vertexCount = mesh.vertexCount; - _vertices.ResizeUninitialized(vertexCount); - _normals.ResizeUninitialized(vertexCount); - _tangents.ResizeUninitialized(vertexCount); - using (Mesh.MeshDataArray meshDataArray = Mesh.AcquireReadOnlyMeshData(mesh)) - { - Mesh.MeshData meshData = meshDataArray[0]; - meshData.GetVertices(_vertices); - meshData.GetNormals(_normals); - meshData.GetTangents(_tangents); - } - _bounds[0] = mesh.bounds; - } - - protected override void OnDispose() - { - _vertices.Dispose(); - _normals.Dispose(); - _tangents.Dispose(); - _partsBounds.Dispose(); - _partsBoundsLocal.Dispose(); - _bounds.Dispose(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshFusionSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshFusionSource.cs deleted file mode 100644 index 555f9e8..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshFusionSource.cs +++ /dev/null @@ -1,333 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -[DisallowMultipleComponent] -public abstract class MeshFusionSource : MonoBehaviour -{ - private RuntimeMeshFusion _controller; - - private int _combinedSourcesCount; - - private int _failedSourcesCount; - - private int _totalSourcesCount; - - [field: SerializeField] - public SourceCombineStatus CombineStatus { get; private set; } - - [field: SerializeField] - public int ControllerIndex { get; set; } - - [field: SerializeField] - [field: HideInInspector] - public bool CombineAtStart { get; set; } = true; - - - [field: SerializeField] - [field: HideInInspector] - public CombineErrorStrategy CombineErrorStrategy { get; set; } - - [field: SerializeField] - public AfterCombineAction AfterCombineAction { get; set; } - - [field: SerializeField] - public bool IsIncompatible { get; private set; } - - [field: SerializeField] - public string IncompatibilityReason { get; private set; } - - [field: SerializeField] - public bool HasCombineErrors { get; private set; } - - [field: SerializeField] - public string CombineErrors { get; private set; } - - public event Action> onCombineFinished; - - private void Reset() - { - CheckCompatibility(); - } - - private void Start() - { - if (CombineAtStart) - { - AssignToController(); - } - } - - private void OnDestroy() - { - Unfreeze(); - } - - public void Unfreeze() - { - if (CombineStatus == SourceCombineStatus.AssignedToController) - { - UnassignFromController(); - } - ClearSourcesAndUnsubscribe(); - } - - public abstract bool TryGetBounds(ref Bounds bounds); - - public bool CheckCompatibility() - { - try - { - string incompatibilityReason; - bool flag = CheckCompatibilityAndGetComponents(out incompatibilityReason); - IsIncompatible = !flag; - IncompatibilityReason = incompatibilityReason; - return flag; - } - catch (Exception ex) - { - IsIncompatible = true; - IncompatibilityReason += $"\n{ex.Message}{ex.StackTrace}"; - return false; - } - } - - public bool AssignToController() - { - try - { - if (CombineStatus != 0) - { - return false; - } - if (!CheckCompatibility()) - { - return false; - } - _controller = RuntimeMeshFusion.FindByIndex(ControllerIndex); - if (_controller == null) - { - throw new NullReferenceException("RuntimeMeshFusion with index " + ControllerIndex + " not found"); - } - CreateSourcesAndSubscribe(); - HasCombineErrors = false; - CombineErrors = ""; - _combinedSourcesCount = 0; - _failedSourcesCount = 0; - _totalSourcesCount = 0; - foreach (ICombineSource combineSource in GetCombineSources()) - { - _totalSourcesCount++; - _controller.AddSource(combineSource); - } - CombineStatus = SourceCombineStatus.AssignedToController; - return true; - } - catch (Exception ex) - { - HasCombineErrors = true; - CombineErrors += $"\n{ex.Message}\n{ex.StackTrace}"; - UnassignFromController(); - CombineStatus = SourceCombineStatus.FailedToCombine; - return false; - } - } - - public void UndoCombine() - { - try - { - foreach (ICombinedObjectPart combinedPart in GetCombinedParts()) - { - combinedPart.Destroy(); - } - foreach (ICombineSource combineSource in GetCombineSources()) - { - combineSource.onCombined += delegate(ICombinedObject root, ICombinedObjectPart part) - { - part.Destroy(); - }; - } - UnassignFromController(); - ClearSourcesAndUnsubscribe(); - ClearParts(); - _combinedSourcesCount = 0; - _failedSourcesCount = 0; - ToggleComponents(enabled: true); - CombineStatus = SourceCombineStatus.NotCombined; - } - catch (Exception ex) - { - HasCombineErrors = true; - CombineErrors += $"\n{ex.Message}\n{ex.StackTrace}"; - CombineStatus = SourceCombineStatus.FailedToCombine; - } - } - - private void CreateSourcesAndSubscribe() - { - CreateSources(); - foreach (ICombineSource combineSource in GetCombineSources()) - { - combineSource.onCombined += OnSourceCombinedHandler; - combineSource.onCombineError += OnCombineErrorHandler; - combineSource.onCombineFailed += OnFailedCombineSourceHandler; - } - } - - private void ClearSourcesAndUnsubscribe() - { - foreach (ICombineSource combineSource in GetCombineSources()) - { - combineSource.onCombined -= OnSourceCombinedHandler; - combineSource.onCombineError -= OnCombineErrorHandler; - combineSource.onCombineFailed -= OnFailedCombineSourceHandler; - } - ClearSources(); - } - - private void UnassignFromController() - { - if (_controller != null) - { - foreach (ICombineSource combineSource in GetCombineSources()) - { - _controller.RemoveSource(combineSource); - } - } - _controller = null; - } - - private void OnSourceCombinedHandler(ICombinedObject root, ICombinedObjectPart part) - { - CombineStatus = SourceCombineStatus.CombinedPartially; - _combinedSourcesCount++; - OnSourceCombinedInternal(root, part); - if (_combinedSourcesCount + _failedSourcesCount == _totalSourcesCount) - { - OnCombineFinishedHandler(); - } - } - - private void OnCombineErrorHandler(ICombinedObject root, string errorMessage) - { - HasCombineErrors = true; - CombineErrors = CombineErrors + errorMessage + "\n"; - OnCombineErrorInternal(root, errorMessage); - if (CombineErrorStrategy == CombineErrorStrategy.UndoCombining) - { - UndoCombine(); - } - } - - private void OnFailedCombineSourceHandler(ICombinedObject root) - { - _failedSourcesCount++; - OnFailedCombineSourceInternal(root); - if (_combinedSourcesCount + _failedSourcesCount == _totalSourcesCount) - { - OnCombineFinishedHandler(); - } - } - - private void OnCombineFinishedHandler() - { - ClearSourcesAndUnsubscribe(); - if (_combinedSourcesCount == _totalSourcesCount) - { - CombineStatus = SourceCombineStatus.Combined; - } - else if (_failedSourcesCount == _totalSourcesCount) - { - CombineStatus = SourceCombineStatus.FailedToCombine; - return; - } - OnCombineFinishedInternal(); - this.onCombineFinished?.Invoke(this, GetCombinedParts()); - if (AfterCombineAction == AfterCombineAction.DisableComponents) - { - ToggleComponents(enabled: false); - } - else if (AfterCombineAction == AfterCombineAction.DestroyGameObject) - { - UnityEngine.Object.Destroy(base.gameObject); - } - } - - protected virtual void OnSourceCombinedInternal(ICombinedObject root, ICombinedObjectPart part) - { - } - - protected virtual void OnCombineErrorInternal(ICombinedObject root, string errorMessage) - { - } - - protected virtual void OnFailedCombineSourceInternal(ICombinedObject root) - { - } - - protected virtual void OnCombineFinishedInternal() - { - } - - protected bool CanCreateCombineSource(GameObject go, ref string incompatibilityReason, ref MeshRenderer renderer, ref MeshFilter filter, ref Mesh mesh) - { - if (renderer == null) - { - renderer = go.GetComponent(); - } - if (renderer == null) - { - incompatibilityReason = "MeshRenderer not found"; - return false; - } - if (renderer.isPartOfStaticBatch) - { - incompatibilityReason = "MeshRenderer is PartOfStaticBatching\nDisable Static Batching"; - return false; - } - if (filter == null) - { - filter = go.GetComponent(); - } - if (filter == null) - { - incompatibilityReason = "MeshFilter not found"; - return false; - } - mesh = filter.sharedMesh; - if (mesh == null) - { - incompatibilityReason = "Mesh not found"; - return false; - } - if (!mesh.isReadable) - { - incompatibilityReason = "Mesh is not readable. Enable Read/Write in import settings"; - return false; - } - if (mesh.subMeshCount != renderer.sharedMaterials.Length) - { - incompatibilityReason = "Submesh count and Materials count isn't equal"; - return false; - } - incompatibilityReason = ""; - return true; - } - - protected abstract bool CheckCompatibilityAndGetComponents(out string incompatibilityReason); - - protected abstract void CreateSources(); - - protected abstract void ClearSources(); - - protected abstract void ClearParts(); - - protected abstract IEnumerable GetCombineSources(); - - protected abstract IEnumerable GetCombinedParts(); - - protected abstract void ToggleComponents(bool enabled); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshSeparatorSimple.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshSeparatorSimple.cs deleted file mode 100644 index 6c79a16..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshSeparatorSimple.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; - -namespace NGS.MeshFusionPro; - -public class MeshSeparatorSimple -{ - private const int MAX_UV_CHANNELS = 4; - - private static Dictionary _meshToSubmeshes; - - private static List _srcVertices; - - private static List _srcNormals; - - private static List _srcTangents; - - private static List _srcUV; - - private static List _triangles; - - private static List _vertices; - - private static List _normals; - - private static List _tangents; - - private static List _uv; - - static MeshSeparatorSimple() - { - _meshToSubmeshes = new Dictionary(); - _srcVertices = new List(); - _srcNormals = new List(); - _srcTangents = new List(); - _srcUV = new List(); - _triangles = new List(); - _vertices = new List(); - _normals = new List(); - _tangents = new List(); - _uv = new List(); - } - - public Mesh GetSubmesh(Mesh source, int submesh) - { - if (!_meshToSubmeshes.TryGetValue(source, out var value)) - { - value = Separate(source); - _meshToSubmeshes.Add(source, value); - } - return value[submesh]; - } - - private Mesh[] Separate(Mesh mesh) - { - int subMeshCount = mesh.subMeshCount; - Mesh[] array = new Mesh[subMeshCount]; - CollectMeshData(mesh); - for (int i = 0; i < subMeshCount; i++) - { - array[i] = CreateFromSubmesh(mesh, i); - } - ClearData(); - return array; - } - - private void CollectMeshData(Mesh mesh) - { - mesh.GetVertices(_srcVertices); - mesh.GetNormals(_srcNormals); - mesh.GetTangents(_srcTangents); - } - - private Mesh CreateFromSubmesh(Mesh mesh, int submesh) - { - SubMeshDescriptor subMesh = mesh.GetSubMesh(submesh); - Mesh mesh2 = new Mesh(); - int indexCount = subMesh.indexCount; - int vertexCount = subMesh.vertexCount; - int firstVertex = subMesh.firstVertex; - int num = firstVertex + vertexCount; - _vertices.Clear(); - _normals.Clear(); - _tangents.Clear(); - mesh.GetIndices(_triangles, submesh); - for (int i = firstVertex; i < num; i++) - { - _vertices.Add(_srcVertices[i]); - _normals.Add(_srcNormals[i]); - _tangents.Add(_srcTangents[i]); - } - for (int j = 0; j < indexCount; j++) - { - _triangles[j] -= firstVertex; - } - mesh2.SetVertices(_vertices); - mesh2.SetNormals(_normals); - mesh2.SetTangents(_tangents); - mesh2.SetTriangles(_triangles, 0, calculateBounds: false); - mesh2.bounds = subMesh.bounds; - for (int k = 0; k < 4; k++) - { - mesh.GetUVs(k, _srcUV); - if (_srcUV.Count != 0) - { - _uv.Clear(); - for (int l = firstVertex; l < num; l++) - { - _uv.Add(_srcUV[l]); - } - mesh2.SetUVs(k, _uv); - } - } - return mesh2; - } - - private void ClearData() - { - _srcVertices.Clear(); - _srcNormals.Clear(); - _srcTangents.Clear(); - _srcUV.Clear(); - _triangles.Clear(); - _vertices.Clear(); - _normals.Clear(); - _tangents.Clear(); - _uv.Clear(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshType.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshType.cs deleted file mode 100644 index 63cafe1..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MeshType.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum MeshType -{ - Standard, - Lightweight -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MoveMethod.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MoveMethod.cs deleted file mode 100644 index 27d690f..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/MoveMethod.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum MoveMethod -{ - Simple, - Jobs -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ObjectsCombiner.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ObjectsCombiner.cs deleted file mode 100644 index 6cf2299..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/ObjectsCombiner.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public abstract class ObjectsCombiner where TCombinedObject : ICombinedObject where TCombineSource : ICombineSource -{ - private List _combinedObjects; - - private List _sources; - - private List _sourcesForCombine; - - public IReadOnlyList CombinedObjects => _combinedObjects; - - public bool ContainSources => _sources.Count > 0; - - public event Action onCombinedObjectCreated; - - protected ObjectsCombiner() - { - _sources = new List(); - _combinedObjects = new List(); - _sourcesForCombine = new List(); - } - - public virtual void AddSource(TCombineSource source) - { - _sources.Add(source); - } - - public void AddSources(IEnumerable sources) - { - foreach (TCombineSource source in sources) - { - AddSource(source); - } - } - - public void RemoveSource(TCombineSource source) - { - _sources.Remove(source); - } - - public void Combine() - { - if (_sources.Count != 0) - { - CleanEmptyData(); - CombineInternal(); - _sources.Clear(); - } - } - - private void CleanEmptyData() - { - int num = 0; - while (num < _combinedObjects.Count) - { - if (_combinedObjects[num] == null) - { - _combinedObjects.RemoveAt(num); - } - else - { - num++; - } - } - num = 0; - while (num < _sources.Count) - { - if (_sources[num] == null) - { - _sources.RemoveAt(num); - } - else - { - num++; - } - } - } - - private void CombineInternal() - { - _sourcesForCombine.Clear(); - int num = 0; - while (num <= _combinedObjects.Count && _sources.Count != 0) - { - bool flag = false; - TCombinedObject val; - if (num == _combinedObjects.Count) - { - try - { - val = CreateCombinedObject(_sources[0]); - _combinedObjects.Add(val); - flag = true; - } - catch (Exception ex) - { - Debug.Log("Unable to create CombinedObject : " + ex.Message + ex.StackTrace); - _sources.RemoveAt(0); - continue; - } - } - else - { - val = _combinedObjects[num]; - } - CombinedObjectMatcher matcher = GetMatcher(); - matcher.StartMatching(val); - int num2 = 0; - while (num2 < _sources.Count) - { - TCombineSource val2 = _sources[num2]; - if (matcher.CanAddSource(val2)) - { - _sourcesForCombine.Add(val2); - matcher.SourceAdded(val2); - _sources.RemoveAt(num2); - } - else - { - num2++; - } - } - if (_sourcesForCombine.Count > 0) - { - try - { - CombineSources(val, _sourcesForCombine); - _sourcesForCombine.Clear(); - } - catch (Exception ex2) - { - Debug.Log("Unable to combine sources in ObjectsCombiner : " + ex2.Message + ex2.StackTrace); - _sourcesForCombine.Clear(); - continue; - } - } - if (flag) - { - this.onCombinedObjectCreated?.Invoke(val); - } - num++; - } - } - - protected abstract CombinedObjectMatcher GetMatcher(); - - protected abstract TCombinedObject CreateCombinedObject(TCombineSource source); - - protected abstract void CombineSources(TCombinedObject root, IList sources); -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/PartMoveInfo.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/PartMoveInfo.cs deleted file mode 100644 index 776f8ad..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/PartMoveInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public struct PartMoveInfo -{ - public int partIndex; - - public int vertexStart; - - public int vertexCount; - - public Matrix4x4 currentTransform; - - public Matrix4x4 targetTransform; -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererHelper.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererHelper.cs deleted file mode 100644 index f513a90..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererHelper.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public static class RendererHelper -{ - private static List _materials; - - static RendererHelper() - { - _materials = new List(); - } - - public static Material GetSharedMaterialWithoutAlloc(this Renderer renderer, int index) - { - renderer.GetSharedMaterials(_materials); - return _materials[index]; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererSettings.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererSettings.cs deleted file mode 100644 index 8d29b8c..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RendererSettings.cs +++ /dev/null @@ -1,43 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; - -namespace NGS.MeshFusionPro; - -public struct RendererSettings -{ - public string tag; - - public int layer; - - public Material material; - - public ShadowCastingMode shadowMode; - - public bool receiveShadows; - - public int lightmapIndex; - - public int realtimeLightmapIndex; - - public RendererSettings(Material material, ShadowCastingMode shadowMode = ShadowCastingMode.On, bool receiveShadows = true, int lightmapIndex = -1, int realtimeLightmapIndex = -1, string tag = "Untagged", int layer = 0) - { - this.material = material; - this.shadowMode = shadowMode; - this.receiveShadows = receiveShadows; - this.lightmapIndex = lightmapIndex; - this.realtimeLightmapIndex = realtimeLightmapIndex; - this.tag = tag; - this.layer = layer; - } - - public RendererSettings(Renderer renderer, int materialIndex = 0) - { - material = renderer.GetSharedMaterialWithoutAlloc(materialIndex); - shadowMode = renderer.shadowCastingMode; - receiveShadows = renderer.receiveShadows; - lightmapIndex = renderer.lightmapIndex; - realtimeLightmapIndex = renderer.realtimeLightmapIndex; - tag = renderer.tag; - layer = renderer.gameObject.layer; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RigidbodyTrackingStrategy.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RigidbodyTrackingStrategy.cs deleted file mode 100644 index 763f666..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RigidbodyTrackingStrategy.cs +++ /dev/null @@ -1,62 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class RigidbodyTrackingStrategy : ISourceTrackingStrategy -{ - private Rigidbody _rigidbody; - - private Transform _transform; - - private DynamicCombinedObjectPart[] _parts; - - private float _velocityThreashold = 0.5f; - - private float _angularVelocityThreashold = 0.3f; - - public float VelocityThreashold - { - get - { - return _velocityThreashold; - } - set - { - _velocityThreashold = Mathf.Max(0f, value); - } - } - - public float AngularVelocityThreashold - { - get - { - return _angularVelocityThreashold; - } - set - { - _angularVelocityThreashold = Mathf.Max(0f, value); - } - } - - public RigidbodyTrackingStrategy(Rigidbody target, DynamicCombinedObjectPart[] parts) - { - _rigidbody = target; - _transform = target.transform; - _parts = parts; - } - - public bool OnUpdate() - { - float magnitude = _rigidbody.velocity.magnitude; - float magnitude2 = _rigidbody.angularVelocity.magnitude; - if (magnitude > _velocityThreashold || magnitude2 > _angularVelocityThreashold) - { - for (int i = 0; i < _parts.Length; i++) - { - _parts[i].Move(_transform.localToWorldMatrix); - } - return true; - } - return false; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RuntimeMeshFusion.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RuntimeMeshFusion.cs deleted file mode 100644 index 38c811b..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/RuntimeMeshFusion.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class RuntimeMeshFusion : MonoBehaviour -{ - private static List _Instances; - - [SerializeField] - [HideInInspector] - private int _controllerIndex; - - [SerializeField] - [HideInInspector] - private bool _drawGizmo; - - [SerializeField] - [HideInInspector] - private int _cellSize = 80; - - [SerializeField] - [HideInInspector] - private int _maxVerticesPerObject = 40000; - - [SerializeField] - [HideInInspector] - private MeshType _meshType; - - [SerializeField] - [HideInInspector] - private MoveMethod _moveMethod = MoveMethod.Jobs; - - private CombineTree _combineTree; - - private bool _sourceAdded; - - private BinaryTreeDrawer _treeDrawer; - - public int ControllerIndex - { - get - { - return _controllerIndex; - } - set - { - if (!Application.isPlaying) - { - _controllerIndex = value; - } - } - } - - public bool DrawGizmo - { - get - { - return _drawGizmo; - } - set - { - _drawGizmo = value; - } - } - - public int CellSize - { - get - { - return _cellSize; - } - set - { - if (!Application.isPlaying) - { - _cellSize = Mathf.Max(1, value); - } - } - } - - public int MaxVertices - { - get - { - return _maxVerticesPerObject; - } - set - { - if (!Application.isPlaying) - { - _maxVerticesPerObject = Mathf.Clamp(value, 500, 65000); - } - } - } - - public MeshType MeshType - { - get - { - return _meshType; - } - set - { - if (!Application.isPlaying) - { - _meshType = value; - } - } - } - - public MoveMethod MoveMethod - { - get - { - return _moveMethod; - } - set - { - if (!Application.isPlaying) - { - _moveMethod = value; - } - } - } - - private void Awake() - { - if (_Instances == null) - { - _Instances = new List(); - } - _Instances.Add(this); - ICombinedMeshFactory factory = new CombinedMeshFactory(_meshType, CombineMethod.Simple, _moveMethod); - _combineTree = new CombineTree(factory, _cellSize, _maxVerticesPerObject); - _treeDrawer = new BinaryTreeDrawer(); - Transform parent = new GameObject("CombinedObjects").transform; - _combineTree.onStaticCombinedObjectCreated += delegate(CombinedObject r) - { - r.transform.parent = parent; - }; - _combineTree.onDynamicCombinedObjectCreated += delegate(DynamicCombinedObject r) - { - r.transform.parent = parent; - }; - _combineTree.onCombinedLODGroupCreated += delegate(CombinedLODGroup r) - { - r.transform.parent = parent; - }; - } - - private void Update() - { - if (_sourceAdded) - { - _combineTree.Combine(); - _sourceAdded = false; - } - } - - private void OnDrawGizmos() - { - if (Application.isPlaying && _drawGizmo && _combineTree != null && _combineTree.Root != null) - { - _treeDrawer.DrawGizmo(_combineTree.Root, Color.white); - } - } - - private void OnDestroy() - { - _Instances.Remove(this); - } - - public static RuntimeMeshFusion FindByIndex(int index) - { - for (int i = 0; i < _Instances.Count; i++) - { - RuntimeMeshFusion runtimeMeshFusion = _Instances[i]; - if (runtimeMeshFusion.ControllerIndex == index) - { - return runtimeMeshFusion; - } - } - throw new KeyNotFoundException("MeshFusionController with index : " + index + " not found"); - } - - public void AddSource(ICombineSource source) - { - _combineTree.Add(source); - _sourceAdded = true; - } - - public void RemoveSource(ICombineSource source) - { - _combineTree.Remove(source); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMeshMoverSTD.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMeshMoverSTD.cs deleted file mode 100644 index 5a56ec3..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMeshMoverSTD.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class SimpleMeshMoverSTD : ICombinedMeshMover -{ - private MeshDataListsSTD _meshData; - - public SimpleMeshMoverSTD(MeshDataListsSTD meshData) - { - _meshData = meshData; - } - - public void MoveParts(IList moveInfos) - { - List vertices = _meshData.Vertices; - List normals = _meshData.Normals; - List tangents = _meshData.Tangents; - List partsBounds = _meshData.PartsBounds; - List partsBoundsLocal = _meshData.PartsBoundsLocal; - Bounds bounds = _meshData.GetBounds(); - bounds.size = Vector3.zero; - for (int i = 0; i < moveInfos.Count; i++) - { - PartMoveInfo partMoveInfo = moveInfos[i]; - int partIndex = partMoveInfo.partIndex; - int vertexStart = partMoveInfo.vertexStart; - int num = vertexStart + partMoveInfo.vertexCount; - Matrix4x4 targetTransform = partMoveInfo.targetTransform; - Matrix4x4 inverse = partMoveInfo.currentTransform.inverse; - for (int j = vertexStart; j < num; j++) - { - Vector3 point = vertices[j]; - Vector3 vector = normals[j]; - Vector4 vector2 = tangents[j]; - float w = vector2.w; - point = inverse.MultiplyPoint3x4(point); - point = targetTransform.MultiplyPoint3x4(point); - vector = inverse.MultiplyVector(vector); - vector = targetTransform.MultiplyVector(vector); - vector2 = inverse.MultiplyVector(vector2); - vector2 = targetTransform.MultiplyVector(vector2); - vector2.w = w; - vertices[j] = point; - normals[j] = vector; - tangents[j] = vector2; - } - partsBounds[partIndex] = partsBoundsLocal[partIndex].Transform(targetTransform); - } - for (int k = 0; k < partsBounds.Count; k++) - { - bounds.Encapsulate(partsBounds[k]); - } - _meshData.Bounds = bounds; - } - - public void ApplyData() - { - _meshData.ApplyDataToMesh(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMovableMeshSTDFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMovableMeshSTDFactory.cs deleted file mode 100644 index 3454e5e..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleMovableMeshSTDFactory.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class SimpleMovableMeshSTDFactory : IMovableCombinedMeshFactory -{ - private IMeshToolsFactory _tools; - - public SimpleMovableMeshSTDFactory(IMeshToolsFactory tools) - { - _tools = tools; - } - - public CombinedMesh CreateMovableMesh(out ICombinedMeshMover mover) - { - CombinedMesh combinedMesh = new CombinedMesh(_tools.CreateMeshCombiner(), _tools.CreateMeshCutter()); - mover = new SimpleMeshMoverSTD(combinedMesh.MeshDataInternal); - return combinedMesh; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsLWFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsLWFactory.cs deleted file mode 100644 index cedbde2..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsLWFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class SimpleToolsLWFactory : IMeshToolsFactory -{ - public IMeshCombiner CreateMeshCombiner() - { - return new MeshCombinerSimpleLW(); - } - - public IMeshCutter CreateMeshCutter() - { - return new MeshCutterSimpleLW(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsSTDFactory.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsSTDFactory.cs deleted file mode 100644 index ee1ce77..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SimpleToolsSTDFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class SimpleToolsSTDFactory : IMeshToolsFactory -{ - public IMeshCombiner CreateMeshCombiner() - { - return new MeshCombinerSimpleSTD(); - } - - public IMeshCutter CreateMeshCutter() - { - return new MeshCutterSimpleSTD(); - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceCombineStatus.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceCombineStatus.cs deleted file mode 100644 index 8aab0cd..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceCombineStatus.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum SourceCombineStatus -{ - NotCombined, - AssignedToController, - CombinedPartially, - Combined, - FailedToCombine -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceTracker.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceTracker.cs deleted file mode 100644 index 571d46d..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/SourceTracker.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -[DisallowMultipleComponent] -[RequireComponent(typeof(MeshFusionSource))] -public class SourceTracker : MonoBehaviour -{ - [SerializeField] - private MeshFusionSource _source; - - [SerializeField] - private bool _isDynamicObject; - - [SerializeField] - private Rigidbody _rigidbody; - - private IEnumerable _parts; - - private ISourceTrackingStrategy _trackingStrategy; - - private float _idleTime; - - private Action _updateFunc; - - public bool IsDynamicObject => _isDynamicObject; - - [field: SerializeField] - public TrackingTarget TrackingTarget { get; set; } - - [field: SerializeField] - public bool DisableWhenIdle { get; set; } = true; - - - [field: SerializeField] - [field: Min(0.01f)] - public float MaxIdleTime { get; set; } = 5f; - - - [field: SerializeField] - public bool WakeUpWhenCollision { get; set; } = true; - - - [field: SerializeField] - public bool TrackingDestroy { get; set; } = true; - - - public void WakeUp() - { - base.enabled = true; - _idleTime = 0f; - } - - private void Reset() - { - _source = GetComponent(); - _isDynamicObject = _source is DynamicMeshFusionSource; - if (TryGetComponent(out _rigidbody)) - { - TrackingTarget = TrackingTarget.Rigidbody; - } - } - - private void Awake() - { - if (_source == null) - { - _source = GetComponent(); - _isDynamicObject = _source is DynamicMeshFusionSource; - } - _source.onCombineFinished += OnCombineFinished; - base.enabled = false; - } - - private void Update() - { - try - { - _updateFunc?.Invoke(); - } - catch - { - if (!_isDynamicObject) - { - base.enabled = false; - return; - } - throw; - } - } - - private void OnCollisionEnter(Collision collision) - { - if (_isDynamicObject && WakeUpWhenCollision && _parts != null) - { - WakeUp(); - } - } - - private void OnDestroy() - { - if (!base.gameObject.scene.isLoaded || !TrackingDestroy || _parts == null) - { - return; - } - foreach (ICombinedObjectPart part in _parts) - { - if (part != null && part.Root != null) - { - part.Destroy(); - } - } - } - - private void OnCombineFinished(MeshFusionSource source, IEnumerable parts) - { - _parts = parts; - _source.onCombineFinished -= OnCombineFinished; - if (!_isDynamicObject) - { - return; - } - _updateFunc = UpdateMoveTracker; - if (TrackingTarget == TrackingTarget.Rigidbody && _rigidbody != null) - { - _trackingStrategy = new RigidbodyTrackingStrategy(_rigidbody, parts.Select((ICombinedObjectPart p) => (DynamicCombinedObjectPart)p).ToArray()); - if (DisableWhenIdle) - { - _updateFunc = UpdateMoveTrackerAndCheckIdle; - } - } - else - { - _trackingStrategy = new TransformTrackingStrategy(base.transform, parts.Select((ICombinedObjectPart p) => (DynamicCombinedObjectPart)p).ToArray()); - } - base.enabled = true; - } - - private void UpdateMoveTracker() - { - _trackingStrategy.OnUpdate(); - } - - private void UpdateMoveTrackerAndCheckIdle() - { - if (_trackingStrategy.OnUpdate()) - { - _idleTime = 0f; - return; - } - _idleTime += Time.deltaTime; - if (_idleTime > MaxIdleTime) - { - _idleTime = 0f; - base.enabled = false; - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticCombinedObjectMatcher.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticCombinedObjectMatcher.cs deleted file mode 100644 index 60ea49c..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticCombinedObjectMatcher.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace NGS.MeshFusionPro; - -public class StaticCombinedObjectMatcher : CombinedObjectMatcher -{ - private RendererSettings _settings; - - private int _vertexCount; - - private int _vertexLimit; - - public StaticCombinedObjectMatcher(int vertexLimit) - { - _vertexLimit = vertexLimit; - } - - public override void StartMatching(CombinedObject combinedObject) - { - _settings = combinedObject.RendererSettings; - _vertexCount = combinedObject.VertexCount; - } - - public override bool CanAddSource(CombineSource source) - { - if (!_settings.Equals(source.RendererSettings)) - { - return false; - } - if (_vertexCount + source.CombineInfo.vertexCount > _vertexLimit) - { - return false; - } - return true; - } - - public override void SourceAdded(CombineSource source) - { - _vertexCount += source.CombineInfo.vertexCount; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticMeshFusionSource.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticMeshFusionSource.cs deleted file mode 100644 index fbd86b3..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticMeshFusionSource.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class StaticMeshFusionSource : MeshFusionSource -{ - [SerializeField] - [HideInInspector] - private MeshRenderer _renderer; - - [SerializeField] - [HideInInspector] - private MeshFilter _filter; - - [SerializeField] - [HideInInspector] - private Mesh _mesh; - - private CombineSource[] _sources; - - private CombinedObjectPart[] _parts; - - public override bool TryGetBounds(ref Bounds bounds) - { - if (_renderer != null) - { - bounds = _renderer.bounds; - return true; - } - return false; - } - - protected override void OnSourceCombinedInternal(ICombinedObject root, ICombinedObjectPart part) - { - for (int i = 0; i < _parts.Length; i++) - { - if (_parts[i] == null) - { - _parts[i] = (CombinedObjectPart)part; - return; - } - } - throw new Exception("Unexpected Behaviour"); - } - - protected override bool CheckCompatibilityAndGetComponents(out string incompatibilityReason) - { - incompatibilityReason = ""; - return CanCreateCombineSource(base.gameObject, ref incompatibilityReason, ref _renderer, ref _filter, ref _mesh); - } - - protected override void CreateSources() - { - if (_sources == null) - { - _sources = new CombineSource[_mesh.subMeshCount]; - } - if (_parts == null) - { - _parts = new CombinedObjectPart[_mesh.subMeshCount]; - } - for (int i = 0; i < _sources.Length; i++) - { - CombineSource combineSource = new CombineSource(_mesh, _renderer, i); - _sources[i] = combineSource; - } - } - - protected override IEnumerable GetCombineSources() - { - if (_sources == null) - { - yield break; - } - for (int i = 0; i < _sources.Length; i++) - { - CombineSource combineSource = _sources[i]; - if (combineSource == null) - { - break; - } - yield return combineSource; - } - } - - protected override IEnumerable GetCombinedParts() - { - if (_parts == null) - { - yield break; - } - for (int i = 0; i < _parts.Length; i++) - { - CombinedObjectPart combinedObjectPart = _parts[i]; - if (combinedObjectPart == null) - { - break; - } - yield return combinedObjectPart; - } - } - - protected override void ClearSources() - { - if (_sources != null) - { - for (int i = 0; i < _sources.Length; i++) - { - _sources[i] = null; - } - } - } - - protected override void ClearParts() - { - if (_parts != null) - { - for (int i = 0; i < _parts.Length; i++) - { - _parts[i] = null; - } - } - } - - protected override void ToggleComponents(bool enabled) - { - _renderer.enabled = enabled; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticObjectsCombiner.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticObjectsCombiner.cs deleted file mode 100644 index e1cc19a..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/StaticObjectsCombiner.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public class StaticObjectsCombiner : ObjectsCombiner -{ - private ICombinedMeshFactory _factory; - - private StaticCombinedObjectMatcher _matcher; - - private int _vertexLimit; - - public StaticObjectsCombiner(ICombinedMeshFactory factory, int vertexLimit) - { - _factory = factory; - _matcher = new StaticCombinedObjectMatcher(vertexLimit); - _vertexLimit = vertexLimit; - } - - public override void AddSource(CombineSource source) - { - if (source.CombineInfo.vertexCount < _vertexLimit) - { - base.AddSource(source); - } - } - - protected override void CombineSources(CombinedObject root, IList sources) - { - root.Combine(sources); - } - - protected override CombinedObject CreateCombinedObject(CombineSource source) - { - return CombinedObject.Create(_factory, source.RendererSettings); - } - - protected override CombinedObjectMatcher GetMatcher() - { - return _matcher; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TrackingTarget.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TrackingTarget.cs deleted file mode 100644 index 3c2276b..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TrackingTarget.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NGS.MeshFusionPro; - -public enum TrackingTarget -{ - Transform, - Rigidbody -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TransformTrackingStrategy.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TransformTrackingStrategy.cs deleted file mode 100644 index 2a5f282..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/TransformTrackingStrategy.cs +++ /dev/null @@ -1,30 +0,0 @@ -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class TransformTrackingStrategy : ISourceTrackingStrategy -{ - private Transform _transform; - - private DynamicCombinedObjectPart[] _parts; - - public TransformTrackingStrategy(Transform target, DynamicCombinedObjectPart[] parts) - { - _transform = target; - _parts = parts; - } - - public bool OnUpdate() - { - if (_transform.hasChanged) - { - for (int i = 0; i < _parts.Length; i++) - { - _parts[i].Move(_transform.localToWorldMatrix); - } - _transform.hasChanged = false; - return true; - } - return false; - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/UniversalObjectsCombiner.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/UniversalObjectsCombiner.cs deleted file mode 100644 index ae5189f..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/UniversalObjectsCombiner.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace NGS.MeshFusionPro; - -public class UniversalObjectsCombiner -{ - private StaticObjectsCombiner _staticCombiner; - - private DynamicObjectsCombiner _dynamicCombiner; - - private LODGroupsCombiner _lodCombiner; - - public event Action onStaticCombinedObjectCreated; - - public event Action onDynamicCombinedObjectCreated; - - public event Action onCombinedLODGroupCreated; - - public UniversalObjectsCombiner(ICombinedMeshFactory factory, int vertexLimit) - { - _staticCombiner = new StaticObjectsCombiner(factory, vertexLimit); - _dynamicCombiner = new DynamicObjectsCombiner(factory, vertexLimit); - _lodCombiner = new LODGroupsCombiner(factory, vertexLimit); - _staticCombiner.onCombinedObjectCreated += delegate(CombinedObject r) - { - this.onStaticCombinedObjectCreated?.Invoke(r); - }; - _dynamicCombiner.onCombinedObjectCreated += delegate(DynamicCombinedObject r) - { - this.onDynamicCombinedObjectCreated?.Invoke(r); - }; - _lodCombiner.onCombinedObjectCreated += delegate(CombinedLODGroup r) - { - this.onCombinedLODGroupCreated?.Invoke(r); - }; - } - - public void AddSource(ICombineSource source) - { - if (source is CombineSource source2) - { - _staticCombiner.AddSource(source2); - return; - } - if (source is DynamicCombineSource source3) - { - _dynamicCombiner.AddSource(source3); - return; - } - if (source is LODGroupCombineSource source4) - { - _lodCombiner.AddSource(source4); - return; - } - throw new NotImplementedException("Unknown Combine Source"); - } - - public void AddSources(IEnumerable sources) - { - foreach (ICombineSource source in sources) - { - AddSource(source); - } - } - - public void RemoveSource(ICombineSource source) - { - if (source is CombineSource source2) - { - _staticCombiner.RemoveSource(source2); - return; - } - if (source is DynamicCombineSource source3) - { - _dynamicCombiner.RemoveSource(source3); - return; - } - if (source is LODGroupCombineSource source4) - { - _lodCombiner.RemoveSource(source4); - return; - } - throw new NotImplementedException("Unknown Combine Source"); - } - - public void Combine() - { - if (_staticCombiner.ContainSources) - { - _staticCombiner.Combine(); - } - if (_dynamicCombiner.ContainSources) - { - _dynamicCombiner.Combine(); - } - if (_lodCombiner.ContainSources) - { - _lodCombiner.Combine(); - } - } -} diff --git a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/VertexBufferUtil.cs b/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/VertexBufferUtil.cs deleted file mode 100644 index e409ce5..0000000 --- a/Thronefall_1_57/Thronefall/NGS.MeshFusionPro/VertexBufferUtil.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; - -namespace NGS.MeshFusionPro; - -public static class VertexBufferUtil -{ - private static readonly Dictionary StandardAttributesMap; - - private static readonly VertexAttributeDescriptor[] LightweightAttributesLayout; - - private static List _meshAttributes; - - static VertexBufferUtil() - { - LightweightAttributesLayout = new VertexAttributeDescriptor[5] - { - new VertexAttributeDescriptor(VertexAttribute.Position, VertexAttributeFormat.Float32, 3, 0), - new VertexAttributeDescriptor(VertexAttribute.Normal, VertexAttributeFormat.SNorm8, 4), - new VertexAttributeDescriptor(VertexAttribute.Tangent, VertexAttributeFormat.SNorm8, 4), - new VertexAttributeDescriptor(VertexAttribute.TexCoord0, VertexAttributeFormat.Float16, 2), - new VertexAttributeDescriptor(VertexAttribute.TexCoord1, VertexAttributeFormat.Float16, 2) - }; - StandardAttributesMap = new Dictionary - { - { - VertexAttribute.Position, - new VertexAttributeDescriptor(VertexAttribute.Position, VertexAttributeFormat.Float32, 3, 0) - }, - { - VertexAttribute.Normal, - new VertexAttributeDescriptor(VertexAttribute.Normal) - }, - { - VertexAttribute.Tangent, - new VertexAttributeDescriptor(VertexAttribute.Tangent, VertexAttributeFormat.Float32, 4) - }, - { - VertexAttribute.TexCoord0, - new VertexAttributeDescriptor(VertexAttribute.TexCoord0, VertexAttributeFormat.Float32, 2) - }, - { - VertexAttribute.TexCoord1, - new VertexAttributeDescriptor(VertexAttribute.TexCoord1, VertexAttributeFormat.Float32, 2) - }, - { - VertexAttribute.TexCoord2, - new VertexAttributeDescriptor(VertexAttribute.TexCoord2, VertexAttributeFormat.Float32, 2) - }, - { - VertexAttribute.TexCoord3, - new VertexAttributeDescriptor(VertexAttribute.TexCoord3, VertexAttributeFormat.Float32, 2) - } - }; - _meshAttributes = new List(); - } - - public static bool IsStandardBuffer(Mesh mesh) - { - mesh.GetVertexAttributes(_meshAttributes); - for (int i = 0; i < _meshAttributes.Count; i++) - { - VertexAttributeDescriptor vertexAttributeDescriptor = _meshAttributes[i]; - VertexAttributeDescriptor vertexAttributeDescriptor2 = StandardAttributesMap[vertexAttributeDescriptor.attribute]; - if (vertexAttributeDescriptor.format != vertexAttributeDescriptor2.format) - { - return false; - } - if (vertexAttributeDescriptor.dimension != vertexAttributeDescriptor2.dimension) - { - return false; - } - } - return true; - } - - public static bool IsLightweightBuffer(Mesh mesh) - { - mesh.GetVertexAttributes(_meshAttributes); - if (_meshAttributes.Count != LightweightAttributesLayout.Length) - { - return false; - } - for (int i = 0; i < _meshAttributes.Count; i++) - { - VertexAttributeDescriptor vertexAttributeDescriptor = _meshAttributes[i]; - VertexAttributeDescriptor vertexAttributeDescriptor2 = LightweightAttributesLayout[i]; - if (vertexAttributeDescriptor.attribute != vertexAttributeDescriptor2.attribute) - { - return false; - } - if (vertexAttributeDescriptor.format != vertexAttributeDescriptor2.format) - { - return false; - } - if (vertexAttributeDescriptor.dimension != vertexAttributeDescriptor2.dimension) - { - return false; - } - } - return true; - } - - public static void ToStandardBuffer(Mesh mesh) - { - if (!IsStandardBuffer(mesh)) - { - for (int i = 0; i < _meshAttributes.Count; i++) - { - _meshAttributes[i] = StandardAttributesMap[_meshAttributes[i].attribute]; - } - mesh.SetVertexBufferParams(mesh.vertexCount, _meshAttributes.ToArray()); - } - } - - public static void ToLightweightBuffer(Mesh mesh) - { - if (!IsLightweightBuffer(mesh)) - { - mesh.SetVertexBufferParams(mesh.vertexCount, LightweightAttributesLayout); - } - } -} diff --git a/Thronefall_1_57/Thronefall/Properties/AssemblyInfo.cs b/Thronefall_1_57/Thronefall/Properties/AssemblyInfo.cs deleted file mode 100644 index bbd7eef..0000000 --- a/Thronefall_1_57/Thronefall/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyVersion("0.0.0.0")] diff --git a/Thronefall_1_57/Thronefall/Rewired.Data/UserDataStore_PlayerPrefs.cs b/Thronefall_1_57/Thronefall/Rewired.Data/UserDataStore_PlayerPrefs.cs deleted file mode 100644 index b5a933b..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Data/UserDataStore_PlayerPrefs.cs +++ /dev/null @@ -1,1358 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using Rewired.Utils.Libraries.TinyJson; -using UnityEngine; - -namespace Rewired.Data; - -public class UserDataStore_PlayerPrefs : UserDataStore -{ - private class ControllerAssignmentSaveInfo - { - public class PlayerInfo - { - public int id; - - public bool hasKeyboard; - - public bool hasMouse; - - public JoystickInfo[] joysticks; - - public int joystickCount - { - get - { - if (joysticks == null) - { - return 0; - } - return joysticks.Length; - } - } - - public int IndexOfJoystick(int joystickId) - { - for (int i = 0; i < joystickCount; i++) - { - if (joysticks[i] != null && joysticks[i].id == joystickId) - { - return i; - } - } - return -1; - } - - public bool ContainsJoystick(int joystickId) - { - return IndexOfJoystick(joystickId) >= 0; - } - } - - public class JoystickInfo - { - public Guid instanceGuid; - - public string hardwareIdentifier; - - public int id; - } - - public PlayerInfo[] players; - - public int playerCount - { - get - { - if (players == null) - { - return 0; - } - return players.Length; - } - } - - public ControllerAssignmentSaveInfo() - { - } - - public ControllerAssignmentSaveInfo(int playerCount) - { - players = new PlayerInfo[playerCount]; - for (int i = 0; i < playerCount; i++) - { - players[i] = new PlayerInfo(); - } - } - - public int IndexOfPlayer(int playerId) - { - for (int i = 0; i < playerCount; i++) - { - if (players[i] != null && players[i].id == playerId) - { - return i; - } - } - return -1; - } - - public bool ContainsPlayer(int playerId) - { - return IndexOfPlayer(playerId) >= 0; - } - } - - private class JoystickAssignmentHistoryInfo - { - public readonly Joystick joystick; - - public readonly int oldJoystickId; - - public JoystickAssignmentHistoryInfo(Joystick joystick, int oldJoystickId) - { - if (joystick == null) - { - throw new ArgumentNullException("joystick"); - } - this.joystick = joystick; - this.oldJoystickId = oldJoystickId; - } - } - - private const string thisScriptName = "UserDataStore_PlayerPrefs"; - - private const string logPrefix = "Rewired: "; - - private const string editorLoadedMessage = "\n***IMPORTANT:*** Changes made to the Rewired Input Manager configuration after the last time XML data was saved WILL NOT be used because the loaded old saved data has overwritten these values. If you change something in the Rewired Input Manager such as a Joystick Map or Input Behavior settings, you will not see these changes reflected in the current configuration. Clear PlayerPrefs using the inspector option on the UserDataStore_PlayerPrefs component."; - - private const string playerPrefsKeySuffix_controllerAssignments = "ControllerAssignments"; - - private const int controllerMapPPKeyVersion_original = 0; - - private const int controllerMapPPKeyVersion_includeDuplicateJoystickIndex = 1; - - private const int controllerMapPPKeyVersion_supportDisconnectedControllers = 2; - - private const int controllerMapPPKeyVersion_includeFormatVersion = 2; - - private const int controllerMapPPKeyVersion = 2; - - [Tooltip("Should this script be used? If disabled, nothing will be saved or loaded.")] - [SerializeField] - private bool isEnabled = true; - - [Tooltip("Should saved data be loaded on start?")] - [SerializeField] - private bool loadDataOnStart = true; - - [Tooltip("Should Player Joystick assignments be saved and loaded? This is not totally reliable for all Joysticks on all platforms. Some platforms/input sources do not provide enough information to reliably save assignments from session to session and reboot to reboot.")] - [SerializeField] - private bool loadJoystickAssignments = true; - - [Tooltip("Should Player Keyboard assignments be saved and loaded?")] - [SerializeField] - private bool loadKeyboardAssignments = true; - - [Tooltip("Should Player Mouse assignments be saved and loaded?")] - [SerializeField] - private bool loadMouseAssignments = true; - - [Tooltip("The PlayerPrefs key prefix. Change this to change how keys are stored in PlayerPrefs. Changing this will make saved data already stored with the old key no longer accessible.")] - [SerializeField] - private string playerPrefsKeyPrefix = "RewiredSaveData"; - - [NonSerialized] - private bool allowImpreciseJoystickAssignmentMatching = true; - - [NonSerialized] - private bool deferredJoystickAssignmentLoadPending; - - [NonSerialized] - private bool wasJoystickEverDetected; - - [NonSerialized] - private List __allActionIds; - - [NonSerialized] - private string __allActionIdsString; - - public bool IsEnabled - { - get - { - return isEnabled; - } - set - { - isEnabled = value; - } - } - - public bool LoadDataOnStart - { - get - { - return loadDataOnStart; - } - set - { - loadDataOnStart = value; - } - } - - public bool LoadJoystickAssignments - { - get - { - return loadJoystickAssignments; - } - set - { - loadJoystickAssignments = value; - } - } - - public bool LoadKeyboardAssignments - { - get - { - return loadKeyboardAssignments; - } - set - { - loadKeyboardAssignments = value; - } - } - - public bool LoadMouseAssignments - { - get - { - return loadMouseAssignments; - } - set - { - loadMouseAssignments = value; - } - } - - public string PlayerPrefsKeyPrefix - { - get - { - return playerPrefsKeyPrefix; - } - set - { - playerPrefsKeyPrefix = value; - } - } - - private string playerPrefsKey_controllerAssignments => string.Format("{0}_{1}", playerPrefsKeyPrefix, "ControllerAssignments"); - - private bool loadControllerAssignments - { - get - { - if (!loadKeyboardAssignments && !loadMouseAssignments) - { - return loadJoystickAssignments; - } - return true; - } - } - - private List allActionIds - { - get - { - if (__allActionIds != null) - { - return __allActionIds; - } - List list = new List(); - IList actions = ReInput.mapping.Actions; - for (int i = 0; i < actions.Count; i++) - { - list.Add(actions[i].id); - } - __allActionIds = list; - return list; - } - } - - private string allActionIdsString - { - get - { - if (!string.IsNullOrEmpty(__allActionIdsString)) - { - return __allActionIdsString; - } - StringBuilder stringBuilder = new StringBuilder(); - List list = allActionIds; - for (int i = 0; i < list.Count; i++) - { - if (i > 0) - { - stringBuilder.Append(","); - } - stringBuilder.Append(list[i]); - } - __allActionIdsString = stringBuilder.ToString(); - return __allActionIdsString; - } - } - - public override void Save() - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not save any data.", this); - } - else - { - SaveAll(); - } - } - - public override void SaveControllerData(int playerId, ControllerType controllerType, int controllerId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not save any data.", this); - } - else - { - SaveControllerDataNow(playerId, controllerType, controllerId); - } - } - - public override void SaveControllerData(ControllerType controllerType, int controllerId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not save any data.", this); - } - else - { - SaveControllerDataNow(controllerType, controllerId); - } - } - - public override void SavePlayerData(int playerId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not save any data.", this); - } - else - { - SavePlayerDataNow(playerId); - } - } - - public override void SaveInputBehavior(int playerId, int behaviorId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not save any data.", this); - } - else - { - SaveInputBehaviorNow(playerId, behaviorId); - } - } - - public override void Load() - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not load any data.", this); - } - else - { - LoadAll(); - } - } - - public override void LoadControllerData(int playerId, ControllerType controllerType, int controllerId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not load any data.", this); - } - else - { - LoadControllerDataNow(playerId, controllerType, controllerId); - } - } - - public override void LoadControllerData(ControllerType controllerType, int controllerId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not load any data.", this); - } - else - { - LoadControllerDataNow(controllerType, controllerId); - } - } - - public override void LoadPlayerData(int playerId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not load any data.", this); - } - else - { - LoadPlayerDataNow(playerId); - } - } - - public override void LoadInputBehavior(int playerId, int behaviorId) - { - if (!isEnabled) - { - Debug.LogWarning("Rewired: UserDataStore_PlayerPrefs is disabled and will not load any data.", this); - } - else - { - LoadInputBehaviorNow(playerId, behaviorId); - } - } - - protected override void OnInitialize() - { - if (loadDataOnStart) - { - Load(); - if (loadControllerAssignments && ReInput.controllers.joystickCount > 0) - { - wasJoystickEverDetected = true; - SaveControllerAssignments(); - } - } - } - - protected override void OnControllerConnected(ControllerStatusChangedEventArgs args) - { - if (isEnabled && args.controllerType == ControllerType.Joystick) - { - LoadJoystickData(args.controllerId); - if (loadDataOnStart && loadJoystickAssignments && !wasJoystickEverDetected) - { - StartCoroutine(LoadJoystickAssignmentsDeferred()); - } - if (loadJoystickAssignments && !deferredJoystickAssignmentLoadPending) - { - SaveControllerAssignments(); - } - wasJoystickEverDetected = true; - } - } - - protected override void OnControllerPreDisconnect(ControllerStatusChangedEventArgs args) - { - if (isEnabled && args.controllerType == ControllerType.Joystick) - { - SaveJoystickData(args.controllerId); - } - } - - protected override void OnControllerDisconnected(ControllerStatusChangedEventArgs args) - { - if (isEnabled && loadControllerAssignments) - { - SaveControllerAssignments(); - } - } - - public override void SaveControllerMap(int playerId, ControllerMap controllerMap) - { - if (controllerMap != null) - { - Player player = ReInput.players.GetPlayer(playerId); - if (player != null) - { - SaveControllerMap(player, controllerMap); - } - } - } - - public override ControllerMap LoadControllerMap(int playerId, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId) - { - Player player = ReInput.players.GetPlayer(playerId); - if (player == null) - { - return null; - } - return LoadControllerMap(player, controllerIdentifier, categoryId, layoutId); - } - - private int LoadAll() - { - int num = 0; - if (loadControllerAssignments && LoadControllerAssignmentsNow()) - { - num++; - } - IList allPlayers = ReInput.players.AllPlayers; - for (int i = 0; i < allPlayers.Count; i++) - { - num += LoadPlayerDataNow(allPlayers[i]); - } - return num + LoadAllJoystickCalibrationData(); - } - - private int LoadPlayerDataNow(int playerId) - { - return LoadPlayerDataNow(ReInput.players.GetPlayer(playerId)); - } - - private int LoadPlayerDataNow(Player player) - { - if (player == null) - { - return 0; - } - int num = 0; - num += LoadInputBehaviors(player.id); - num += LoadControllerMaps(player.id, ControllerType.Keyboard, 0); - num += LoadControllerMaps(player.id, ControllerType.Mouse, 0); - foreach (Joystick joystick in player.controllers.Joysticks) - { - num += LoadControllerMaps(player.id, ControllerType.Joystick, joystick.id); - } - RefreshLayoutManager(player.id); - return num; - } - - private int LoadAllJoystickCalibrationData() - { - int num = 0; - IList joysticks = ReInput.controllers.Joysticks; - for (int i = 0; i < joysticks.Count; i++) - { - num += LoadJoystickCalibrationData(joysticks[i]); - } - return num; - } - - private int LoadJoystickCalibrationData(Joystick joystick) - { - if (joystick == null) - { - return 0; - } - if (!joystick.ImportCalibrationMapFromXmlString(GetJoystickCalibrationMapXml(joystick))) - { - return 0; - } - return 1; - } - - private int LoadJoystickCalibrationData(int joystickId) - { - return LoadJoystickCalibrationData(ReInput.controllers.GetJoystick(joystickId)); - } - - private int LoadJoystickData(int joystickId) - { - int num = 0; - IList allPlayers = ReInput.players.AllPlayers; - for (int i = 0; i < allPlayers.Count; i++) - { - Player player = allPlayers[i]; - if (player.controllers.ContainsController(ControllerType.Joystick, joystickId)) - { - num += LoadControllerMaps(player.id, ControllerType.Joystick, joystickId); - RefreshLayoutManager(player.id); - } - } - return num + LoadJoystickCalibrationData(joystickId); - } - - private int LoadControllerDataNow(int playerId, ControllerType controllerType, int controllerId) - { - int num = 0 + LoadControllerMaps(playerId, controllerType, controllerId); - RefreshLayoutManager(playerId); - return num + LoadControllerDataNow(controllerType, controllerId); - } - - private int LoadControllerDataNow(ControllerType controllerType, int controllerId) - { - int num = 0; - if (controllerType == ControllerType.Joystick) - { - num += LoadJoystickCalibrationData(controllerId); - } - return num; - } - - private int LoadControllerMaps(int playerId, ControllerType controllerType, int controllerId) - { - int num = 0; - Player player = ReInput.players.GetPlayer(playerId); - if (player == null) - { - return num; - } - Controller controller = ReInput.controllers.GetController(controllerType, controllerId); - if (controller == null) - { - return num; - } - IList mapCategories = ReInput.mapping.MapCategories; - for (int i = 0; i < mapCategories.Count; i++) - { - InputMapCategory inputMapCategory = mapCategories[i]; - if (!inputMapCategory.userAssignable) - { - continue; - } - IList list = ReInput.mapping.MapLayouts(controller.type); - for (int j = 0; j < list.Count; j++) - { - InputLayout inputLayout = list[j]; - ControllerMap controllerMap = LoadControllerMap(player, controller.identifier, inputMapCategory.id, inputLayout.id); - if (controllerMap != null) - { - player.controllers.maps.AddMap(controller, controllerMap); - num++; - } - } - } - return num; - } - - private ControllerMap LoadControllerMap(Player player, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId) - { - if (player == null) - { - return null; - } - string controllerMapXml = GetControllerMapXml(player, controllerIdentifier, categoryId, layoutId); - if (string.IsNullOrEmpty(controllerMapXml)) - { - return null; - } - ControllerMap controllerMap = ControllerMap.CreateFromXml(controllerIdentifier.controllerType, controllerMapXml); - if (controllerMap == null) - { - return null; - } - List controllerMapKnownActionIds = GetControllerMapKnownActionIds(player, controllerIdentifier, categoryId, layoutId); - AddDefaultMappingsForNewActions(controllerIdentifier, controllerMap, controllerMapKnownActionIds); - return controllerMap; - } - - private int LoadInputBehaviors(int playerId) - { - Player player = ReInput.players.GetPlayer(playerId); - if (player == null) - { - return 0; - } - int num = 0; - IList inputBehaviors = ReInput.mapping.GetInputBehaviors(player.id); - for (int i = 0; i < inputBehaviors.Count; i++) - { - num += LoadInputBehaviorNow(player, inputBehaviors[i]); - } - return num; - } - - private int LoadInputBehaviorNow(int playerId, int behaviorId) - { - Player player = ReInput.players.GetPlayer(playerId); - if (player == null) - { - return 0; - } - InputBehavior inputBehavior = ReInput.mapping.GetInputBehavior(playerId, behaviorId); - if (inputBehavior == null) - { - return 0; - } - return LoadInputBehaviorNow(player, inputBehavior); - } - - private int LoadInputBehaviorNow(Player player, InputBehavior inputBehavior) - { - if (player == null || inputBehavior == null) - { - return 0; - } - string inputBehaviorXml = GetInputBehaviorXml(player, inputBehavior.id); - if (inputBehaviorXml == null || inputBehaviorXml == string.Empty) - { - return 0; - } - if (!inputBehavior.ImportXmlString(inputBehaviorXml)) - { - return 0; - } - return 1; - } - - private bool LoadControllerAssignmentsNow() - { - try - { - ControllerAssignmentSaveInfo controllerAssignmentSaveInfo = LoadControllerAssignmentData(); - if (controllerAssignmentSaveInfo == null) - { - return false; - } - if (loadKeyboardAssignments || loadMouseAssignments) - { - LoadKeyboardAndMouseAssignmentsNow(controllerAssignmentSaveInfo); - } - if (loadJoystickAssignments) - { - LoadJoystickAssignmentsNow(controllerAssignmentSaveInfo); - } - } - catch - { - } - return true; - } - - private bool LoadKeyboardAndMouseAssignmentsNow(ControllerAssignmentSaveInfo data) - { - try - { - if (data == null && (data = LoadControllerAssignmentData()) == null) - { - return false; - } - foreach (Player allPlayer in ReInput.players.AllPlayers) - { - if (data.ContainsPlayer(allPlayer.id)) - { - ControllerAssignmentSaveInfo.PlayerInfo playerInfo = data.players[data.IndexOfPlayer(allPlayer.id)]; - if (loadKeyboardAssignments) - { - allPlayer.controllers.hasKeyboard = playerInfo.hasKeyboard; - } - if (loadMouseAssignments) - { - allPlayer.controllers.hasMouse = playerInfo.hasMouse; - } - } - } - } - catch - { - } - return true; - } - - private bool LoadJoystickAssignmentsNow(ControllerAssignmentSaveInfo data) - { - try - { - if (ReInput.controllers.joystickCount == 0) - { - return false; - } - if (data == null && (data = LoadControllerAssignmentData()) == null) - { - return false; - } - foreach (Player allPlayer in ReInput.players.AllPlayers) - { - allPlayer.controllers.ClearControllersOfType(ControllerType.Joystick); - } - List list = (loadJoystickAssignments ? new List() : null); - foreach (Player allPlayer2 in ReInput.players.AllPlayers) - { - if (!data.ContainsPlayer(allPlayer2.id)) - { - continue; - } - ControllerAssignmentSaveInfo.PlayerInfo playerInfo = data.players[data.IndexOfPlayer(allPlayer2.id)]; - for (int i = 0; i < playerInfo.joystickCount; i++) - { - ControllerAssignmentSaveInfo.JoystickInfo joystickInfo2 = playerInfo.joysticks[i]; - if (joystickInfo2 == null) - { - continue; - } - Joystick joystick = FindJoystickPrecise(joystickInfo2); - if (joystick != null) - { - if (list.Find((JoystickAssignmentHistoryInfo x) => x.joystick == joystick) == null) - { - list.Add(new JoystickAssignmentHistoryInfo(joystick, joystickInfo2.id)); - } - allPlayer2.controllers.AddController(joystick, removeFromOtherPlayers: false); - } - } - } - if (allowImpreciseJoystickAssignmentMatching) - { - foreach (Player allPlayer3 in ReInput.players.AllPlayers) - { - if (!data.ContainsPlayer(allPlayer3.id)) - { - continue; - } - ControllerAssignmentSaveInfo.PlayerInfo playerInfo2 = data.players[data.IndexOfPlayer(allPlayer3.id)]; - for (int j = 0; j < playerInfo2.joystickCount; j++) - { - ControllerAssignmentSaveInfo.JoystickInfo joystickInfo = playerInfo2.joysticks[j]; - if (joystickInfo == null) - { - continue; - } - Joystick joystick2 = null; - int num = list.FindIndex((JoystickAssignmentHistoryInfo x) => x.oldJoystickId == joystickInfo.id); - if (num >= 0) - { - joystick2 = list[num].joystick; - } - else - { - if (!TryFindJoysticksImprecise(joystickInfo, out var matches)) - { - continue; - } - foreach (Joystick match in matches) - { - if (list.Find((JoystickAssignmentHistoryInfo x) => x.joystick == match) == null) - { - joystick2 = match; - break; - } - } - if (joystick2 == null) - { - continue; - } - list.Add(new JoystickAssignmentHistoryInfo(joystick2, joystickInfo.id)); - } - allPlayer3.controllers.AddController(joystick2, removeFromOtherPlayers: false); - } - } - } - } - catch - { - } - if (ReInput.configuration.autoAssignJoysticks) - { - ReInput.controllers.AutoAssignJoysticks(); - } - return true; - } - - private ControllerAssignmentSaveInfo LoadControllerAssignmentData() - { - try - { - if (!PlayerPrefs.HasKey(playerPrefsKey_controllerAssignments)) - { - return null; - } - string @string = PlayerPrefs.GetString(playerPrefsKey_controllerAssignments); - if (string.IsNullOrEmpty(@string)) - { - return null; - } - ControllerAssignmentSaveInfo controllerAssignmentSaveInfo = JsonParser.FromJson(@string); - if (controllerAssignmentSaveInfo == null || controllerAssignmentSaveInfo.playerCount == 0) - { - return null; - } - return controllerAssignmentSaveInfo; - } - catch - { - return null; - } - } - - private IEnumerator LoadJoystickAssignmentsDeferred() - { - deferredJoystickAssignmentLoadPending = true; - yield return new WaitForEndOfFrame(); - if (ReInput.isReady) - { - LoadJoystickAssignmentsNow(null); - SaveControllerAssignments(); - deferredJoystickAssignmentLoadPending = false; - } - } - - private void SaveAll() - { - IList allPlayers = ReInput.players.AllPlayers; - for (int i = 0; i < allPlayers.Count; i++) - { - SavePlayerDataNow(allPlayers[i]); - } - SaveAllJoystickCalibrationData(); - if (loadControllerAssignments) - { - SaveControllerAssignments(); - } - PlayerPrefs.Save(); - } - - private void SavePlayerDataNow(int playerId) - { - SavePlayerDataNow(ReInput.players.GetPlayer(playerId)); - PlayerPrefs.Save(); - } - - private void SavePlayerDataNow(Player player) - { - if (player != null) - { - PlayerSaveData saveData = player.GetSaveData(userAssignableMapsOnly: true); - SaveInputBehaviors(player, saveData); - SaveControllerMaps(player, saveData); - } - } - - private void SaveAllJoystickCalibrationData() - { - IList joysticks = ReInput.controllers.Joysticks; - for (int i = 0; i < joysticks.Count; i++) - { - SaveJoystickCalibrationData(joysticks[i]); - } - } - - private void SaveJoystickCalibrationData(int joystickId) - { - SaveJoystickCalibrationData(ReInput.controllers.GetJoystick(joystickId)); - } - - private void SaveJoystickCalibrationData(Joystick joystick) - { - if (joystick != null) - { - JoystickCalibrationMapSaveData calibrationMapSaveData = joystick.GetCalibrationMapSaveData(); - PlayerPrefs.SetString(GetJoystickCalibrationMapPlayerPrefsKey(joystick), calibrationMapSaveData.map.ToXmlString()); - } - } - - private void SaveJoystickData(int joystickId) - { - IList allPlayers = ReInput.players.AllPlayers; - for (int i = 0; i < allPlayers.Count; i++) - { - Player player = allPlayers[i]; - if (player.controllers.ContainsController(ControllerType.Joystick, joystickId)) - { - SaveControllerMaps(player.id, ControllerType.Joystick, joystickId); - } - } - SaveJoystickCalibrationData(joystickId); - } - - private void SaveControllerDataNow(int playerId, ControllerType controllerType, int controllerId) - { - SaveControllerMaps(playerId, controllerType, controllerId); - SaveControllerDataNow(controllerType, controllerId); - PlayerPrefs.Save(); - } - - private void SaveControllerDataNow(ControllerType controllerType, int controllerId) - { - if (controllerType == ControllerType.Joystick) - { - SaveJoystickCalibrationData(controllerId); - } - PlayerPrefs.Save(); - } - - private void SaveControllerMaps(Player player, PlayerSaveData playerSaveData) - { - foreach (ControllerMapSaveData allControllerMapSaveDatum in playerSaveData.AllControllerMapSaveData) - { - SaveControllerMap(player, allControllerMapSaveDatum.map); - } - } - - private void SaveControllerMaps(int playerId, ControllerType controllerType, int controllerId) - { - Player player = ReInput.players.GetPlayer(playerId); - if (player == null || !player.controllers.ContainsController(controllerType, controllerId)) - { - return; - } - ControllerMapSaveData[] mapSaveData = player.controllers.maps.GetMapSaveData(controllerType, controllerId, userAssignableMapsOnly: true); - if (mapSaveData != null) - { - for (int i = 0; i < mapSaveData.Length; i++) - { - SaveControllerMap(player, mapSaveData[i].map); - } - } - } - - private void SaveControllerMap(Player player, ControllerMap controllerMap) - { - PlayerPrefs.SetString(GetControllerMapPlayerPrefsKey(player, controllerMap.controller.identifier, controllerMap.categoryId, controllerMap.layoutId, 2), controllerMap.ToXmlString()); - PlayerPrefs.SetString(GetControllerMapKnownActionIdsPlayerPrefsKey(player, controllerMap.controller.identifier, controllerMap.categoryId, controllerMap.layoutId, 2), allActionIdsString); - } - - private void SaveInputBehaviors(Player player, PlayerSaveData playerSaveData) - { - if (player != null) - { - InputBehavior[] inputBehaviors = playerSaveData.inputBehaviors; - for (int i = 0; i < inputBehaviors.Length; i++) - { - SaveInputBehaviorNow(player, inputBehaviors[i]); - } - } - } - - private void SaveInputBehaviorNow(int playerId, int behaviorId) - { - Player player = ReInput.players.GetPlayer(playerId); - if (player != null) - { - InputBehavior inputBehavior = ReInput.mapping.GetInputBehavior(playerId, behaviorId); - if (inputBehavior != null) - { - SaveInputBehaviorNow(player, inputBehavior); - PlayerPrefs.Save(); - } - } - } - - private void SaveInputBehaviorNow(Player player, InputBehavior inputBehavior) - { - if (player != null && inputBehavior != null) - { - PlayerPrefs.SetString(GetInputBehaviorPlayerPrefsKey(player, inputBehavior.id), inputBehavior.ToXmlString()); - } - } - - private bool SaveControllerAssignments() - { - try - { - ControllerAssignmentSaveInfo controllerAssignmentSaveInfo = new ControllerAssignmentSaveInfo(ReInput.players.allPlayerCount); - for (int i = 0; i < ReInput.players.allPlayerCount; i++) - { - Player player = ReInput.players.AllPlayers[i]; - ControllerAssignmentSaveInfo.PlayerInfo playerInfo = new ControllerAssignmentSaveInfo.PlayerInfo(); - controllerAssignmentSaveInfo.players[i] = playerInfo; - playerInfo.id = player.id; - playerInfo.hasKeyboard = player.controllers.hasKeyboard; - playerInfo.hasMouse = player.controllers.hasMouse; - ControllerAssignmentSaveInfo.JoystickInfo[] array = (playerInfo.joysticks = new ControllerAssignmentSaveInfo.JoystickInfo[player.controllers.joystickCount]); - for (int j = 0; j < player.controllers.joystickCount; j++) - { - Joystick joystick = player.controllers.Joysticks[j]; - ControllerAssignmentSaveInfo.JoystickInfo joystickInfo = new ControllerAssignmentSaveInfo.JoystickInfo(); - joystickInfo.instanceGuid = joystick.deviceInstanceGuid; - joystickInfo.id = joystick.id; - joystickInfo.hardwareIdentifier = joystick.hardwareIdentifier; - array[j] = joystickInfo; - } - } - PlayerPrefs.SetString(playerPrefsKey_controllerAssignments, JsonWriter.ToJson(controllerAssignmentSaveInfo)); - PlayerPrefs.Save(); - } - catch - { - } - return true; - } - - private bool ControllerAssignmentSaveDataExists() - { - if (!PlayerPrefs.HasKey(playerPrefsKey_controllerAssignments)) - { - return false; - } - if (string.IsNullOrEmpty(PlayerPrefs.GetString(playerPrefsKey_controllerAssignments))) - { - return false; - } - return true; - } - - private string GetBasePlayerPrefsKey(Player player) - { - return playerPrefsKeyPrefix + "|playerName=" + player.name; - } - - private string GetControllerMapPlayerPrefsKey(Player player, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId, int ppKeyVersion) - { - return string.Concat(GetBasePlayerPrefsKey(player) + "|dataType=ControllerMap", GetControllerMapPlayerPrefsKeyCommonSuffix(player, controllerIdentifier, categoryId, layoutId, ppKeyVersion)); - } - - private string GetControllerMapKnownActionIdsPlayerPrefsKey(Player player, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId, int ppKeyVersion) - { - return string.Concat(GetBasePlayerPrefsKey(player) + "|dataType=ControllerMap_KnownActionIds", GetControllerMapPlayerPrefsKeyCommonSuffix(player, controllerIdentifier, categoryId, layoutId, ppKeyVersion)); - } - - private static string GetControllerMapPlayerPrefsKeyCommonSuffix(Player player, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId, int ppKeyVersion) - { - string text = ""; - if (ppKeyVersion >= 2) - { - text = text + "|kv=" + ppKeyVersion; - } - text = text + "|controllerMapType=" + GetControllerMapType(controllerIdentifier.controllerType).Name; - text = text + "|categoryId=" + categoryId + "|layoutId=" + layoutId; - if (ppKeyVersion >= 2) - { - text = text + "|hardwareGuid=" + controllerIdentifier.hardwareTypeGuid.ToString(); - if (controllerIdentifier.hardwareTypeGuid == Guid.Empty) - { - text = text + "|hardwareIdentifier=" + controllerIdentifier.hardwareIdentifier; - } - if (controllerIdentifier.controllerType == ControllerType.Joystick) - { - text = text + "|duplicate=" + GetDuplicateIndex(player, controllerIdentifier); - } - } - else - { - text = text + "|hardwareIdentifier=" + controllerIdentifier.hardwareIdentifier; - if (controllerIdentifier.controllerType == ControllerType.Joystick) - { - text = text + "|hardwareGuid=" + controllerIdentifier.hardwareTypeGuid.ToString(); - if (ppKeyVersion >= 1) - { - text = text + "|duplicate=" + GetDuplicateIndex(player, controllerIdentifier); - } - } - } - return text; - } - - private string GetJoystickCalibrationMapPlayerPrefsKey(Joystick joystick) - { - return string.Concat(string.Concat(string.Concat(playerPrefsKeyPrefix + "|dataType=CalibrationMap", "|controllerType=", joystick.type.ToString()), "|hardwareIdentifier=", joystick.hardwareIdentifier), "|hardwareGuid=", joystick.hardwareTypeGuid.ToString()); - } - - private string GetInputBehaviorPlayerPrefsKey(Player player, int inputBehaviorId) - { - return string.Concat(GetBasePlayerPrefsKey(player) + "|dataType=InputBehavior", "|id=", inputBehaviorId.ToString()); - } - - private string GetControllerMapXml(Player player, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId) - { - for (int num = 2; num >= 0; num--) - { - string controllerMapPlayerPrefsKey = GetControllerMapPlayerPrefsKey(player, controllerIdentifier, categoryId, layoutId, num); - if (PlayerPrefs.HasKey(controllerMapPlayerPrefsKey)) - { - return PlayerPrefs.GetString(controllerMapPlayerPrefsKey); - } - } - return null; - } - - private List GetControllerMapKnownActionIds(Player player, ControllerIdentifier controllerIdentifier, int categoryId, int layoutId) - { - List list = new List(); - string key = null; - bool flag = false; - for (int num = 2; num >= 0; num--) - { - key = GetControllerMapKnownActionIdsPlayerPrefsKey(player, controllerIdentifier, categoryId, layoutId, num); - if (PlayerPrefs.HasKey(key)) - { - flag = true; - break; - } - } - if (!flag) - { - return list; - } - string @string = PlayerPrefs.GetString(key); - if (string.IsNullOrEmpty(@string)) - { - return list; - } - string[] array = @string.Split(','); - for (int i = 0; i < array.Length; i++) - { - if (!string.IsNullOrEmpty(array[i]) && int.TryParse(array[i], out var result)) - { - list.Add(result); - } - } - return list; - } - - private string GetJoystickCalibrationMapXml(Joystick joystick) - { - string joystickCalibrationMapPlayerPrefsKey = GetJoystickCalibrationMapPlayerPrefsKey(joystick); - if (!PlayerPrefs.HasKey(joystickCalibrationMapPlayerPrefsKey)) - { - return string.Empty; - } - return PlayerPrefs.GetString(joystickCalibrationMapPlayerPrefsKey); - } - - private string GetInputBehaviorXml(Player player, int id) - { - string inputBehaviorPlayerPrefsKey = GetInputBehaviorPlayerPrefsKey(player, id); - if (!PlayerPrefs.HasKey(inputBehaviorPlayerPrefsKey)) - { - return string.Empty; - } - return PlayerPrefs.GetString(inputBehaviorPlayerPrefsKey); - } - - private void AddDefaultMappingsForNewActions(ControllerIdentifier controllerIdentifier, ControllerMap controllerMap, List knownActionIds) - { - if (controllerMap == null || knownActionIds == null || knownActionIds == null || knownActionIds.Count == 0) - { - return; - } - ControllerMap controllerMapInstance = ReInput.mapping.GetControllerMapInstance(controllerIdentifier, controllerMap.categoryId, controllerMap.layoutId); - if (controllerMapInstance == null) - { - return; - } - List list = new List(); - foreach (int allActionId in allActionIds) - { - if (!knownActionIds.Contains(allActionId)) - { - list.Add(allActionId); - } - } - if (list.Count == 0) - { - return; - } - foreach (ActionElementMap allMap in controllerMapInstance.AllMaps) - { - if (list.Contains(allMap.actionId) && !controllerMap.DoesElementAssignmentConflict(allMap)) - { - ElementAssignment elementAssignment = new ElementAssignment(controllerMap.controllerType, allMap.elementType, allMap.elementIdentifierId, allMap.axisRange, allMap.keyCode, allMap.modifierKeyFlags, allMap.actionId, allMap.axisContribution, allMap.invert); - controllerMap.CreateElementMap(elementAssignment); - } - } - } - - private Joystick FindJoystickPrecise(ControllerAssignmentSaveInfo.JoystickInfo joystickInfo) - { - if (joystickInfo == null) - { - return null; - } - if (joystickInfo.instanceGuid == Guid.Empty) - { - return null; - } - IList joysticks = ReInput.controllers.Joysticks; - for (int i = 0; i < joysticks.Count; i++) - { - if (joysticks[i].deviceInstanceGuid == joystickInfo.instanceGuid) - { - return joysticks[i]; - } - } - return null; - } - - private bool TryFindJoysticksImprecise(ControllerAssignmentSaveInfo.JoystickInfo joystickInfo, out List matches) - { - matches = null; - if (joystickInfo == null) - { - return false; - } - if (string.IsNullOrEmpty(joystickInfo.hardwareIdentifier)) - { - return false; - } - IList joysticks = ReInput.controllers.Joysticks; - for (int i = 0; i < joysticks.Count; i++) - { - if (string.Equals(joysticks[i].hardwareIdentifier, joystickInfo.hardwareIdentifier, StringComparison.OrdinalIgnoreCase)) - { - if (matches == null) - { - matches = new List(); - } - matches.Add(joysticks[i]); - } - } - return matches != null; - } - - private static int GetDuplicateIndex(Player player, ControllerIdentifier controllerIdentifier) - { - Controller controller = ReInput.controllers.GetController(controllerIdentifier); - if (controller == null) - { - return 0; - } - int num = 0; - foreach (Controller controller2 in player.controllers.Controllers) - { - if (controller2.type != controller.type) - { - continue; - } - bool flag = false; - if (controller.type == ControllerType.Joystick) - { - if ((controller2 as Joystick).hardwareTypeGuid != controller.hardwareTypeGuid) - { - continue; - } - if (controller.hardwareTypeGuid != Guid.Empty) - { - flag = true; - } - } - if (flag || !(controller2.hardwareIdentifier != controller.hardwareIdentifier)) - { - if (controller2 == controller) - { - return num; - } - num++; - } - } - return num; - } - - private void RefreshLayoutManager(int playerId) - { - ReInput.players.GetPlayer(playerId)?.controllers.maps.layoutManager.Apply(); - } - - private static Type GetControllerMapType(ControllerType controllerType) - { - switch (controllerType) - { - case ControllerType.Custom: - return typeof(CustomControllerMap); - case ControllerType.Joystick: - return typeof(JoystickMap); - case ControllerType.Keyboard: - return typeof(KeyboardMap); - case ControllerType.Mouse: - return typeof(MouseMap); - default: - Debug.LogWarning("Rewired: Unknown ControllerType " + controllerType); - return null; - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIEffect.cs b/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIEffect.cs deleted file mode 100644 index 695aa76..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIEffect.cs +++ /dev/null @@ -1,57 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -namespace Rewired.Demos.GamepadTemplateUI; - -[RequireComponent(typeof(Image))] -public class ControllerUIEffect : MonoBehaviour -{ - [SerializeField] - private Color _highlightColor = Color.white; - - private Image _image; - - private Color _color; - - private Color _origColor; - - private bool _isActive; - - private float _highlightAmount; - - private void Awake() - { - _image = GetComponent(); - _origColor = _image.color; - _color = _origColor; - } - - public void Activate(float amount) - { - amount = Mathf.Clamp01(amount); - if (!_isActive || amount != _highlightAmount) - { - _highlightAmount = amount; - _color = Color.Lerp(_origColor, _highlightColor, _highlightAmount); - _isActive = true; - RedrawImage(); - } - } - - public void Deactivate() - { - if (_isActive) - { - _color = _origColor; - _highlightAmount = 0f; - _isActive = false; - RedrawImage(); - } - } - - private void RedrawImage() - { - _image.color = _color; - _image.enabled = _isActive; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIElement.cs b/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIElement.cs deleted file mode 100644 index b59e6f8..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/ControllerUIElement.cs +++ /dev/null @@ -1,186 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -namespace Rewired.Demos.GamepadTemplateUI; - -[RequireComponent(typeof(Image))] -public class ControllerUIElement : MonoBehaviour -{ - [SerializeField] - private Color _highlightColor = Color.white; - - [SerializeField] - private ControllerUIEffect _positiveUIEffect; - - [SerializeField] - private ControllerUIEffect _negativeUIEffect; - - [SerializeField] - private Text _label; - - [SerializeField] - private Text _positiveLabel; - - [SerializeField] - private Text _negativeLabel; - - [SerializeField] - private ControllerUIElement[] _childElements = new ControllerUIElement[0]; - - private Image _image; - - private Color _color; - - private Color _origColor; - - private bool _isActive; - - private float _highlightAmount; - - private bool hasEffects - { - get - { - if (!(_positiveUIEffect != null)) - { - return _negativeUIEffect != null; - } - return true; - } - } - - private void Awake() - { - _image = GetComponent(); - _origColor = _image.color; - _color = _origColor; - ClearLabels(); - } - - public void Activate(float amount) - { - amount = Mathf.Clamp(amount, -1f, 1f); - if (hasEffects) - { - if (amount < 0f && _negativeUIEffect != null) - { - _negativeUIEffect.Activate(Mathf.Abs(amount)); - } - if (amount > 0f && _positiveUIEffect != null) - { - _positiveUIEffect.Activate(Mathf.Abs(amount)); - } - } - else - { - if (_isActive && amount == _highlightAmount) - { - return; - } - _highlightAmount = amount; - _color = Color.Lerp(_origColor, _highlightColor, _highlightAmount); - } - _isActive = true; - RedrawImage(); - if (_childElements.Length == 0) - { - return; - } - for (int i = 0; i < _childElements.Length; i++) - { - if (!(_childElements[i] == null)) - { - _childElements[i].Activate(amount); - } - } - } - - public void Deactivate() - { - if (!_isActive) - { - return; - } - _color = _origColor; - _highlightAmount = 0f; - if (_positiveUIEffect != null) - { - _positiveUIEffect.Deactivate(); - } - if (_negativeUIEffect != null) - { - _negativeUIEffect.Deactivate(); - } - _isActive = false; - RedrawImage(); - if (_childElements.Length == 0) - { - return; - } - for (int i = 0; i < _childElements.Length; i++) - { - if (!(_childElements[i] == null)) - { - _childElements[i].Deactivate(); - } - } - } - - public void SetLabel(string text, AxisRange labelType) - { - Text text2 = labelType switch - { - AxisRange.Full => _label, - AxisRange.Positive => _positiveLabel, - AxisRange.Negative => _negativeLabel, - _ => null, - }; - if (text2 != null) - { - text2.text = text; - } - if (_childElements.Length == 0) - { - return; - } - for (int i = 0; i < _childElements.Length; i++) - { - if (!(_childElements[i] == null)) - { - _childElements[i].SetLabel(text, labelType); - } - } - } - - public void ClearLabels() - { - if (_label != null) - { - _label.text = string.Empty; - } - if (_positiveLabel != null) - { - _positiveLabel.text = string.Empty; - } - if (_negativeLabel != null) - { - _negativeLabel.text = string.Empty; - } - if (_childElements.Length == 0) - { - return; - } - for (int i = 0; i < _childElements.Length; i++) - { - if (!(_childElements[i] == null)) - { - _childElements[i].ClearLabels(); - } - } - } - - private void RedrawImage() - { - _image.color = _color; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/GamepadTemplateUI.cs b/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/GamepadTemplateUI.cs deleted file mode 100644 index e56617c..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos.GamepadTemplateUI/GamepadTemplateUI.cs +++ /dev/null @@ -1,417 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace Rewired.Demos.GamepadTemplateUI; - -public class GamepadTemplateUI : MonoBehaviour -{ - private class Stick - { - private RectTransform _transform; - - private Vector2 _origPosition; - - private int _xAxisElementId = -1; - - private int _yAxisElementId = -1; - - public Vector2 position - { - get - { - if (!(_transform != null)) - { - return Vector2.zero; - } - return _transform.anchoredPosition - _origPosition; - } - set - { - if (!(_transform == null)) - { - _transform.anchoredPosition = _origPosition + value; - } - } - } - - public Stick(RectTransform transform, int xAxisElementId, int yAxisElementId) - { - if (!(transform == null)) - { - _transform = transform; - _origPosition = _transform.anchoredPosition; - _xAxisElementId = xAxisElementId; - _yAxisElementId = yAxisElementId; - } - } - - public void Reset() - { - if (!(_transform == null)) - { - _transform.anchoredPosition = _origPosition; - } - } - - public bool ContainsElement(int elementId) - { - if (_transform == null) - { - return false; - } - if (elementId != _xAxisElementId) - { - return elementId == _yAxisElementId; - } - return true; - } - - public void SetAxisPosition(int elementId, float value) - { - if (!(_transform == null)) - { - Vector2 vector = position; - if (elementId == _xAxisElementId) - { - vector.x = value; - } - else if (elementId == _yAxisElementId) - { - vector.y = value; - } - position = vector; - } - } - } - - private class UIElement - { - public int id; - - public ControllerUIElement element; - - public UIElement(int id, ControllerUIElement element) - { - this.id = id; - this.element = element; - } - } - - private const float stickRadius = 20f; - - public int playerId; - - [SerializeField] - private RectTransform leftStick; - - [SerializeField] - private RectTransform rightStick; - - [SerializeField] - private ControllerUIElement leftStickX; - - [SerializeField] - private ControllerUIElement leftStickY; - - [SerializeField] - private ControllerUIElement leftStickButton; - - [SerializeField] - private ControllerUIElement rightStickX; - - [SerializeField] - private ControllerUIElement rightStickY; - - [SerializeField] - private ControllerUIElement rightStickButton; - - [SerializeField] - private ControllerUIElement actionBottomRow1; - - [SerializeField] - private ControllerUIElement actionBottomRow2; - - [SerializeField] - private ControllerUIElement actionBottomRow3; - - [SerializeField] - private ControllerUIElement actionTopRow1; - - [SerializeField] - private ControllerUIElement actionTopRow2; - - [SerializeField] - private ControllerUIElement actionTopRow3; - - [SerializeField] - private ControllerUIElement leftShoulder; - - [SerializeField] - private ControllerUIElement leftTrigger; - - [SerializeField] - private ControllerUIElement rightShoulder; - - [SerializeField] - private ControllerUIElement rightTrigger; - - [SerializeField] - private ControllerUIElement center1; - - [SerializeField] - private ControllerUIElement center2; - - [SerializeField] - private ControllerUIElement center3; - - [SerializeField] - private ControllerUIElement dPadUp; - - [SerializeField] - private ControllerUIElement dPadRight; - - [SerializeField] - private ControllerUIElement dPadDown; - - [SerializeField] - private ControllerUIElement dPadLeft; - - private UIElement[] _uiElementsArray; - - private Dictionary _uiElements = new Dictionary(); - - private IList _tempTargetList = new List(2); - - private Stick[] _sticks; - - private Player player => ReInput.players.GetPlayer(playerId); - - private void Awake() - { - _uiElementsArray = new UIElement[23] - { - new UIElement(0, leftStickX), - new UIElement(1, leftStickY), - new UIElement(17, leftStickButton), - new UIElement(2, rightStickX), - new UIElement(3, rightStickY), - new UIElement(18, rightStickButton), - new UIElement(4, actionBottomRow1), - new UIElement(5, actionBottomRow2), - new UIElement(6, actionBottomRow3), - new UIElement(7, actionTopRow1), - new UIElement(8, actionTopRow2), - new UIElement(9, actionTopRow3), - new UIElement(14, center1), - new UIElement(15, center2), - new UIElement(16, center3), - new UIElement(19, dPadUp), - new UIElement(20, dPadRight), - new UIElement(21, dPadDown), - new UIElement(22, dPadLeft), - new UIElement(10, leftShoulder), - new UIElement(11, leftTrigger), - new UIElement(12, rightShoulder), - new UIElement(13, rightTrigger) - }; - for (int i = 0; i < _uiElementsArray.Length; i++) - { - _uiElements.Add(_uiElementsArray[i].id, _uiElementsArray[i].element); - } - _sticks = new Stick[2] - { - new Stick(leftStick, 0, 1), - new Stick(rightStick, 2, 3) - }; - ReInput.ControllerConnectedEvent += OnControllerConnected; - ReInput.ControllerDisconnectedEvent += OnControllerDisconnected; - } - - private void Start() - { - if (ReInput.isReady) - { - DrawLabels(); - } - } - - private void OnDestroy() - { - ReInput.ControllerConnectedEvent -= OnControllerConnected; - ReInput.ControllerDisconnectedEvent -= OnControllerDisconnected; - } - - private void Update() - { - if (ReInput.isReady) - { - DrawActiveElements(); - } - } - - private void DrawActiveElements() - { - for (int i = 0; i < _uiElementsArray.Length; i++) - { - _uiElementsArray[i].element.Deactivate(); - } - for (int j = 0; j < _sticks.Length; j++) - { - _sticks[j].Reset(); - } - IList actions = ReInput.mapping.Actions; - for (int k = 0; k < actions.Count; k++) - { - ActivateElements(player, actions[k].id); - } - } - - private void ActivateElements(Player player, int actionId) - { - float axis = player.GetAxis(actionId); - if (axis == 0f) - { - return; - } - IList currentInputSources = player.GetCurrentInputSources(actionId); - for (int i = 0; i < currentInputSources.Count; i++) - { - InputActionSourceData inputActionSourceData = currentInputSources[i]; - IGamepadTemplate template = inputActionSourceData.controller.GetTemplate(); - if (template == null) - { - continue; - } - template.GetElementTargets(inputActionSourceData.actionElementMap, _tempTargetList); - for (int j = 0; j < _tempTargetList.Count; j++) - { - ControllerTemplateElementTarget controllerTemplateElementTarget = _tempTargetList[j]; - int id = controllerTemplateElementTarget.element.id; - ControllerUIElement controllerUIElement = _uiElements[id]; - if (controllerTemplateElementTarget.elementType == ControllerTemplateElementType.Axis) - { - controllerUIElement.Activate(axis); - } - else if (controllerTemplateElementTarget.elementType == ControllerTemplateElementType.Button && (player.GetButton(actionId) || player.GetNegativeButton(actionId))) - { - controllerUIElement.Activate(1f); - } - GetStick(id)?.SetAxisPosition(id, axis * 20f); - } - } - } - - private void DrawLabels() - { - for (int i = 0; i < _uiElementsArray.Length; i++) - { - _uiElementsArray[i].element.ClearLabels(); - } - IList actions = ReInput.mapping.Actions; - for (int j = 0; j < actions.Count; j++) - { - DrawLabels(player, actions[j]); - } - } - - private void DrawLabels(Player player, InputAction action) - { - Controller firstControllerWithTemplate = player.controllers.GetFirstControllerWithTemplate(); - if (firstControllerWithTemplate == null) - { - return; - } - IGamepadTemplate template = firstControllerWithTemplate.GetTemplate(); - ControllerMap map = player.controllers.maps.GetMap(firstControllerWithTemplate, "Default", "Default"); - if (map != null) - { - for (int i = 0; i < _uiElementsArray.Length; i++) - { - ControllerUIElement element = _uiElementsArray[i].element; - int id = _uiElementsArray[i].id; - IControllerTemplateElement element2 = template.GetElement(id); - DrawLabel(element, action, map, template, element2); - } - } - } - - private void DrawLabel(ControllerUIElement uiElement, InputAction action, ControllerMap controllerMap, IControllerTemplate template, IControllerTemplateElement element) - { - if (element.source == null) - { - return; - } - if (element.source.type == ControllerTemplateElementSourceType.Axis) - { - IControllerTemplateAxisSource controllerTemplateAxisSource = element.source as IControllerTemplateAxisSource; - ActionElementMap firstElementMapWithElementTarget; - if (controllerTemplateAxisSource.splitAxis) - { - firstElementMapWithElementTarget = controllerMap.GetFirstElementMapWithElementTarget(controllerTemplateAxisSource.positiveTarget, action.id, skipDisabledMaps: true); - if (firstElementMapWithElementTarget != null) - { - uiElement.SetLabel(firstElementMapWithElementTarget.actionDescriptiveName, AxisRange.Positive); - } - firstElementMapWithElementTarget = controllerMap.GetFirstElementMapWithElementTarget(controllerTemplateAxisSource.negativeTarget, action.id, skipDisabledMaps: true); - if (firstElementMapWithElementTarget != null) - { - uiElement.SetLabel(firstElementMapWithElementTarget.actionDescriptiveName, AxisRange.Negative); - } - return; - } - firstElementMapWithElementTarget = controllerMap.GetFirstElementMapWithElementTarget(controllerTemplateAxisSource.fullTarget, action.id, skipDisabledMaps: true); - if (firstElementMapWithElementTarget != null) - { - uiElement.SetLabel(firstElementMapWithElementTarget.actionDescriptiveName, AxisRange.Full); - return; - } - firstElementMapWithElementTarget = controllerMap.GetFirstElementMapWithElementTarget(new ControllerElementTarget(controllerTemplateAxisSource.fullTarget) - { - axisRange = AxisRange.Positive - }, action.id, skipDisabledMaps: true); - if (firstElementMapWithElementTarget != null) - { - uiElement.SetLabel(firstElementMapWithElementTarget.actionDescriptiveName, AxisRange.Positive); - } - firstElementMapWithElementTarget = controllerMap.GetFirstElementMapWithElementTarget(new ControllerElementTarget(controllerTemplateAxisSource.fullTarget) - { - axisRange = AxisRange.Negative - }, action.id, skipDisabledMaps: true); - if (firstElementMapWithElementTarget != null) - { - uiElement.SetLabel(firstElementMapWithElementTarget.actionDescriptiveName, AxisRange.Negative); - } - } - else if (element.source.type == ControllerTemplateElementSourceType.Button) - { - IControllerTemplateButtonSource controllerTemplateButtonSource = element.source as IControllerTemplateButtonSource; - ActionElementMap firstElementMapWithElementTarget = controllerMap.GetFirstElementMapWithElementTarget(controllerTemplateButtonSource.target, action.id, skipDisabledMaps: true); - if (firstElementMapWithElementTarget != null) - { - uiElement.SetLabel(firstElementMapWithElementTarget.actionDescriptiveName, AxisRange.Full); - } - } - } - - private Stick GetStick(int elementId) - { - for (int i = 0; i < _sticks.Length; i++) - { - if (_sticks[i].ContainsElement(elementId)) - { - return _sticks[i]; - } - } - return null; - } - - private void OnControllerConnected(ControllerStatusChangedEventArgs args) - { - DrawLabels(); - } - - private void OnControllerDisconnected(ControllerStatusChangedEventArgs args) - { - DrawLabels(); - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/Bullet.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/Bullet.cs deleted file mode 100644 index bb521c8..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/Bullet.cs +++ /dev/null @@ -1,30 +0,0 @@ -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class Bullet : MonoBehaviour -{ - public float lifeTime = 3f; - - private bool die; - - private float deathTime; - - private void Start() - { - if (lifeTime > 0f) - { - deathTime = Time.time + lifeTime; - die = true; - } - } - - private void Update() - { - if (die && Time.time >= deathTime) - { - Object.Destroy(base.gameObject); - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/ControlRemappingDemo1.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/ControlRemappingDemo1.cs deleted file mode 100644 index b0e4f51..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/ControlRemappingDemo1.cs +++ /dev/null @@ -1,1797 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class ControlRemappingDemo1 : MonoBehaviour -{ - private class ControllerSelection - { - private int _id; - - private int _idPrev; - - private ControllerType _type; - - private ControllerType _typePrev; - - public int id - { - get - { - return _id; - } - set - { - _idPrev = _id; - _id = value; - } - } - - public ControllerType type - { - get - { - return _type; - } - set - { - _typePrev = _type; - _type = value; - } - } - - public int idPrev => _idPrev; - - public ControllerType typePrev => _typePrev; - - public bool hasSelection => _id >= 0; - - public ControllerSelection() - { - Clear(); - } - - public void Set(int id, ControllerType type) - { - this.id = id; - this.type = type; - } - - public void Clear() - { - _id = -1; - _idPrev = -1; - _type = ControllerType.Joystick; - _typePrev = ControllerType.Joystick; - } - } - - private class DialogHelper - { - public enum DialogType - { - None = 0, - JoystickConflict = 1, - ElementConflict = 2, - KeyConflict = 3, - DeleteAssignmentConfirmation = 10, - AssignElement = 11 - } - - private const float openBusyDelay = 0.25f; - - private const float closeBusyDelay = 0.1f; - - private DialogType _type; - - private bool _enabled; - - private float _busyTime; - - private bool _busyTimerRunning; - - private Action drawWindowDelegate; - - private GUI.WindowFunction drawWindowFunction; - - private WindowProperties windowProperties; - - private int currentActionId; - - private Action resultCallback; - - private float busyTimer - { - get - { - if (!_busyTimerRunning) - { - return 0f; - } - return _busyTime - Time.realtimeSinceStartup; - } - } - - public bool enabled - { - get - { - return _enabled; - } - set - { - if (value) - { - if (_type != 0) - { - StateChanged(0.25f); - } - } - else - { - _enabled = value; - _type = DialogType.None; - StateChanged(0.1f); - } - } - } - - public DialogType type - { - get - { - if (!_enabled) - { - return DialogType.None; - } - return _type; - } - set - { - if (value == DialogType.None) - { - _enabled = false; - StateChanged(0.1f); - } - else - { - _enabled = true; - StateChanged(0.25f); - } - _type = value; - } - } - - public bool busy => _busyTimerRunning; - - public DialogHelper() - { - drawWindowDelegate = DrawWindow; - drawWindowFunction = drawWindowDelegate.Invoke; - } - - public void StartModal(int queueActionId, DialogType type, WindowProperties windowProperties, Action resultCallback) - { - StartModal(queueActionId, type, windowProperties, resultCallback, -1f); - } - - public void StartModal(int queueActionId, DialogType type, WindowProperties windowProperties, Action resultCallback, float openBusyDelay) - { - currentActionId = queueActionId; - this.windowProperties = windowProperties; - this.type = type; - this.resultCallback = resultCallback; - if (openBusyDelay >= 0f) - { - StateChanged(openBusyDelay); - } - } - - public void Update() - { - Draw(); - UpdateTimers(); - } - - public void Draw() - { - if (_enabled) - { - bool flag = GUI.enabled; - GUI.enabled = true; - GUILayout.Window(windowProperties.windowId, windowProperties.rect, drawWindowFunction, windowProperties.title); - GUI.FocusWindow(windowProperties.windowId); - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - } - - public void DrawConfirmButton() - { - DrawConfirmButton("Confirm"); - } - - public void DrawConfirmButton(string title) - { - bool flag = GUI.enabled; - if (busy) - { - GUI.enabled = false; - } - if (GUILayout.Button(title)) - { - Confirm(UserResponse.Confirm); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - public void DrawConfirmButton(UserResponse response) - { - DrawConfirmButton(response, "Confirm"); - } - - public void DrawConfirmButton(UserResponse response, string title) - { - bool flag = GUI.enabled; - if (busy) - { - GUI.enabled = false; - } - if (GUILayout.Button(title)) - { - Confirm(response); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - public void DrawCancelButton() - { - DrawCancelButton("Cancel"); - } - - public void DrawCancelButton(string title) - { - bool flag = GUI.enabled; - if (busy) - { - GUI.enabled = false; - } - if (GUILayout.Button(title)) - { - Cancel(); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - public void Confirm() - { - Confirm(UserResponse.Confirm); - } - - public void Confirm(UserResponse response) - { - resultCallback(currentActionId, response); - Close(); - } - - public void Cancel() - { - resultCallback(currentActionId, UserResponse.Cancel); - Close(); - } - - private void DrawWindow(int windowId) - { - windowProperties.windowDrawDelegate(windowProperties.title, windowProperties.message); - } - - private void UpdateTimers() - { - if (_busyTimerRunning && busyTimer <= 0f) - { - _busyTimerRunning = false; - } - } - - private void StartBusyTimer(float time) - { - _busyTime = time + Time.realtimeSinceStartup; - _busyTimerRunning = true; - } - - private void Close() - { - Reset(); - StateChanged(0.1f); - } - - private void StateChanged(float delay) - { - StartBusyTimer(delay); - } - - private void Reset() - { - _enabled = false; - _type = DialogType.None; - currentActionId = -1; - resultCallback = null; - } - - private void ResetTimers() - { - _busyTimerRunning = false; - } - - public void FullReset() - { - Reset(); - ResetTimers(); - } - } - - private abstract class QueueEntry - { - public enum State - { - Waiting, - Confirmed, - Canceled - } - - private static int uidCounter; - - public int id { get; protected set; } - - public QueueActionType queueActionType { get; protected set; } - - public State state { get; protected set; } - - public UserResponse response { get; protected set; } - - protected static int nextId - { - get - { - int result = uidCounter; - uidCounter++; - return result; - } - } - - public QueueEntry(QueueActionType queueActionType) - { - id = nextId; - this.queueActionType = queueActionType; - } - - public void Confirm(UserResponse response) - { - state = State.Confirmed; - this.response = response; - } - - public void Cancel() - { - state = State.Canceled; - } - } - - private class JoystickAssignmentChange : QueueEntry - { - public int playerId { get; private set; } - - public int joystickId { get; private set; } - - public bool assign { get; private set; } - - public JoystickAssignmentChange(int newPlayerId, int joystickId, bool assign) - : base(QueueActionType.JoystickAssignment) - { - playerId = newPlayerId; - this.joystickId = joystickId; - this.assign = assign; - } - } - - private class ElementAssignmentChange : QueueEntry - { - public ElementAssignmentChangeType changeType { get; set; } - - public InputMapper.Context context { get; private set; } - - public ElementAssignmentChange(ElementAssignmentChangeType changeType, InputMapper.Context context) - : base(QueueActionType.ElementAssignment) - { - this.changeType = changeType; - this.context = context; - } - - public ElementAssignmentChange(ElementAssignmentChange other) - : this(other.changeType, other.context.Clone()) - { - } - } - - private class FallbackJoystickIdentification : QueueEntry - { - public int joystickId { get; private set; } - - public string joystickName { get; private set; } - - public FallbackJoystickIdentification(int joystickId, string joystickName) - : base(QueueActionType.FallbackJoystickIdentification) - { - this.joystickId = joystickId; - this.joystickName = joystickName; - } - } - - private class Calibration : QueueEntry - { - public int selectedElementIdentifierId; - - public bool recording; - - public Player player { get; private set; } - - public ControllerType controllerType { get; private set; } - - public Joystick joystick { get; private set; } - - public CalibrationMap calibrationMap { get; private set; } - - public Calibration(Player player, Joystick joystick, CalibrationMap calibrationMap) - : base(QueueActionType.Calibrate) - { - this.player = player; - this.joystick = joystick; - this.calibrationMap = calibrationMap; - selectedElementIdentifierId = -1; - } - } - - private struct WindowProperties - { - public int windowId; - - public Rect rect; - - public Action windowDrawDelegate; - - public string title; - - public string message; - } - - private enum QueueActionType - { - None, - JoystickAssignment, - ElementAssignment, - FallbackJoystickIdentification, - Calibrate - } - - private enum ElementAssignmentChangeType - { - Add, - Replace, - Remove, - ReassignOrRemove, - ConflictCheck - } - - public enum UserResponse - { - Confirm, - Cancel, - Custom1, - Custom2 - } - - private const float defaultModalWidth = 250f; - - private const float defaultModalHeight = 200f; - - private const float assignmentTimeout = 5f; - - private DialogHelper dialog; - - private InputMapper inputMapper = new InputMapper(); - - private InputMapper.ConflictFoundEventData conflictFoundEventData; - - private bool guiState; - - private bool busy; - - private bool pageGUIState; - - private Player selectedPlayer; - - private int selectedMapCategoryId; - - private ControllerSelection selectedController; - - private ControllerMap selectedMap; - - private bool showMenu; - - private bool startListening; - - private Vector2 actionScrollPos; - - private Vector2 calibrateScrollPos; - - private Queue actionQueue; - - private bool setupFinished; - - [NonSerialized] - private bool initialized; - - private bool isCompiling; - - private GUIStyle style_wordWrap; - - private GUIStyle style_centeredBox; - - private void Awake() - { - inputMapper.options.timeout = 5f; - inputMapper.options.ignoreMouseXAxis = true; - inputMapper.options.ignoreMouseYAxis = true; - Initialize(); - } - - private void OnEnable() - { - Subscribe(); - } - - private void OnDisable() - { - Unsubscribe(); - } - - private void Initialize() - { - dialog = new DialogHelper(); - actionQueue = new Queue(); - selectedController = new ControllerSelection(); - ReInput.ControllerConnectedEvent += JoystickConnected; - ReInput.ControllerPreDisconnectEvent += JoystickPreDisconnect; - ReInput.ControllerDisconnectedEvent += JoystickDisconnected; - ResetAll(); - initialized = true; - ReInput.userDataStore.Load(); - if (ReInput.unityJoystickIdentificationRequired) - { - IdentifyAllJoysticks(); - } - } - - private void Setup() - { - if (!setupFinished) - { - style_wordWrap = new GUIStyle(GUI.skin.label); - style_wordWrap.wordWrap = true; - style_centeredBox = new GUIStyle(GUI.skin.box); - style_centeredBox.alignment = TextAnchor.MiddleCenter; - setupFinished = true; - } - } - - private void Subscribe() - { - Unsubscribe(); - inputMapper.ConflictFoundEvent += OnConflictFound; - inputMapper.StoppedEvent += OnStopped; - } - - private void Unsubscribe() - { - inputMapper.RemoveAllEventListeners(); - } - - public void OnGUI() - { - if (initialized) - { - Setup(); - HandleMenuControl(); - if (!showMenu) - { - DrawInitialScreen(); - return; - } - SetGUIStateStart(); - ProcessQueue(); - DrawPage(); - ShowDialog(); - SetGUIStateEnd(); - busy = false; - } - } - - private void HandleMenuControl() - { - if (!dialog.enabled && Event.current.type == EventType.Layout && ReInput.players.GetSystemPlayer().GetButtonDown("Menu")) - { - if (showMenu) - { - ReInput.userDataStore.Save(); - Close(); - } - else - { - Open(); - } - } - } - - private void Close() - { - ClearWorkingVars(); - showMenu = false; - } - - private void Open() - { - showMenu = true; - } - - private void DrawInitialScreen() - { - ActionElementMap firstElementMapWithAction = ReInput.players.GetSystemPlayer().controllers.maps.GetFirstElementMapWithAction("Menu", skipDisabledMaps: true); - GUIContent content = ((firstElementMapWithAction == null) ? new GUIContent("There is no element assigned to open the menu!") : new GUIContent("Press " + firstElementMapWithAction.elementIdentifierName + " to open the menu.")); - GUILayout.BeginArea(GetScreenCenteredRect(300f, 50f)); - GUILayout.Box(content, style_centeredBox, GUILayout.ExpandHeight(expand: true), GUILayout.ExpandWidth(expand: true)); - GUILayout.EndArea(); - } - - private void DrawPage() - { - if (GUI.enabled != pageGUIState) - { - GUI.enabled = pageGUIState; - } - GUILayout.BeginArea(new Rect(((float)Screen.width - (float)Screen.width * 0.9f) * 0.5f, ((float)Screen.height - (float)Screen.height * 0.9f) * 0.5f, (float)Screen.width * 0.9f, (float)Screen.height * 0.9f)); - DrawPlayerSelector(); - DrawJoystickSelector(); - DrawMouseAssignment(); - DrawControllerSelector(); - DrawCalibrateButton(); - DrawMapCategories(); - actionScrollPos = GUILayout.BeginScrollView(actionScrollPos); - DrawCategoryActions(); - GUILayout.EndScrollView(); - GUILayout.EndArea(); - } - - private void DrawPlayerSelector() - { - if (ReInput.players.allPlayerCount == 0) - { - GUILayout.Label("There are no players."); - return; - } - GUILayout.Space(15f); - GUILayout.Label("Players:"); - GUILayout.BeginHorizontal(); - foreach (Player player in ReInput.players.GetPlayers(includeSystemPlayer: true)) - { - if (selectedPlayer == null) - { - selectedPlayer = player; - } - bool flag = ((player == selectedPlayer) ? true : false); - bool flag2 = GUILayout.Toggle(flag, (player.descriptiveName != string.Empty) ? player.descriptiveName : player.name, "Button", GUILayout.ExpandWidth(expand: false)); - if (flag2 != flag && flag2) - { - selectedPlayer = player; - selectedController.Clear(); - selectedMapCategoryId = -1; - } - } - GUILayout.EndHorizontal(); - } - - private void DrawMouseAssignment() - { - bool flag = GUI.enabled; - if (selectedPlayer == null) - { - GUI.enabled = false; - } - GUILayout.Space(15f); - GUILayout.Label("Assign Mouse:"); - GUILayout.BeginHorizontal(); - bool flag2 = ((selectedPlayer != null && selectedPlayer.controllers.hasMouse) ? true : false); - bool flag3 = GUILayout.Toggle(flag2, "Assign Mouse", "Button", GUILayout.ExpandWidth(expand: false)); - if (flag3 != flag2) - { - if (flag3) - { - selectedPlayer.controllers.hasMouse = true; - foreach (Player player in ReInput.players.Players) - { - if (player != selectedPlayer) - { - player.controllers.hasMouse = false; - } - } - } - else - { - selectedPlayer.controllers.hasMouse = false; - } - } - GUILayout.EndHorizontal(); - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DrawJoystickSelector() - { - bool flag = GUI.enabled; - if (selectedPlayer == null) - { - GUI.enabled = false; - } - GUILayout.Space(15f); - GUILayout.Label("Assign Joysticks:"); - GUILayout.BeginHorizontal(); - bool flag2 = ((selectedPlayer == null || selectedPlayer.controllers.joystickCount == 0) ? true : false); - bool flag3 = GUILayout.Toggle(flag2, "None", "Button", GUILayout.ExpandWidth(expand: false)); - if (flag3 != flag2) - { - selectedPlayer.controllers.ClearControllersOfType(ControllerType.Joystick); - ControllerSelectionChanged(); - } - if (selectedPlayer != null) - { - foreach (Joystick joystick in ReInput.controllers.Joysticks) - { - flag2 = selectedPlayer.controllers.ContainsController(joystick); - flag3 = GUILayout.Toggle(flag2, joystick.name, "Button", GUILayout.ExpandWidth(expand: false)); - if (flag3 != flag2) - { - EnqueueAction(new JoystickAssignmentChange(selectedPlayer.id, joystick.id, flag3)); - } - } - } - GUILayout.EndHorizontal(); - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DrawControllerSelector() - { - if (selectedPlayer == null) - { - return; - } - bool flag = GUI.enabled; - GUILayout.Space(15f); - GUILayout.Label("Controller to Map:"); - GUILayout.BeginHorizontal(); - if (!selectedController.hasSelection) - { - selectedController.Set(0, ControllerType.Keyboard); - ControllerSelectionChanged(); - } - bool flag2 = selectedController.type == ControllerType.Keyboard; - if (GUILayout.Toggle(flag2, "Keyboard", "Button", GUILayout.ExpandWidth(expand: false)) != flag2) - { - selectedController.Set(0, ControllerType.Keyboard); - ControllerSelectionChanged(); - } - if (!selectedPlayer.controllers.hasMouse) - { - GUI.enabled = false; - } - flag2 = selectedController.type == ControllerType.Mouse; - if (GUILayout.Toggle(flag2, "Mouse", "Button", GUILayout.ExpandWidth(expand: false)) != flag2) - { - selectedController.Set(0, ControllerType.Mouse); - ControllerSelectionChanged(); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - foreach (Joystick joystick in selectedPlayer.controllers.Joysticks) - { - flag2 = selectedController.type == ControllerType.Joystick && selectedController.id == joystick.id; - if (GUILayout.Toggle(flag2, joystick.name, "Button", GUILayout.ExpandWidth(expand: false)) != flag2) - { - selectedController.Set(joystick.id, ControllerType.Joystick); - ControllerSelectionChanged(); - } - } - GUILayout.EndHorizontal(); - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DrawCalibrateButton() - { - if (selectedPlayer == null) - { - return; - } - bool flag = GUI.enabled; - GUILayout.Space(10f); - Controller controller = (selectedController.hasSelection ? selectedPlayer.controllers.GetController(selectedController.type, selectedController.id) : null); - if (controller == null || selectedController.type != ControllerType.Joystick) - { - GUI.enabled = false; - GUILayout.Button("Select a controller to calibrate", GUILayout.ExpandWidth(expand: false)); - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - else if (GUILayout.Button("Calibrate " + controller.name, GUILayout.ExpandWidth(expand: false)) && controller is Joystick joystick) - { - CalibrationMap calibrationMap = joystick.calibrationMap; - if (calibrationMap != null) - { - EnqueueAction(new Calibration(selectedPlayer, joystick, calibrationMap)); - } - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DrawMapCategories() - { - if (selectedPlayer == null || !selectedController.hasSelection) - { - return; - } - bool flag = GUI.enabled; - GUILayout.Space(15f); - GUILayout.Label("Categories:"); - GUILayout.BeginHorizontal(); - foreach (InputMapCategory userAssignableMapCategory in ReInput.mapping.UserAssignableMapCategories) - { - if (!selectedPlayer.controllers.maps.ContainsMapInCategory(selectedController.type, userAssignableMapCategory.id)) - { - GUI.enabled = false; - } - else if (selectedMapCategoryId < 0) - { - selectedMapCategoryId = userAssignableMapCategory.id; - selectedMap = selectedPlayer.controllers.maps.GetFirstMapInCategory(selectedController.type, selectedController.id, userAssignableMapCategory.id); - } - bool flag2 = ((userAssignableMapCategory.id == selectedMapCategoryId) ? true : false); - if (GUILayout.Toggle(flag2, (userAssignableMapCategory.descriptiveName != string.Empty) ? userAssignableMapCategory.descriptiveName : userAssignableMapCategory.name, "Button", GUILayout.ExpandWidth(expand: false)) != flag2) - { - selectedMapCategoryId = userAssignableMapCategory.id; - selectedMap = selectedPlayer.controllers.maps.GetFirstMapInCategory(selectedController.type, selectedController.id, userAssignableMapCategory.id); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - GUILayout.EndHorizontal(); - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DrawCategoryActions() - { - if (selectedPlayer == null || selectedMapCategoryId < 0) - { - return; - } - bool flag = GUI.enabled; - if (selectedMap == null) - { - return; - } - GUILayout.Space(15f); - GUILayout.Label("Actions:"); - InputMapCategory mapCategory = ReInput.mapping.GetMapCategory(selectedMapCategoryId); - if (mapCategory == null) - { - return; - } - InputCategory actionCategory = ReInput.mapping.GetActionCategory(mapCategory.name); - if (actionCategory == null) - { - return; - } - float width = 150f; - foreach (InputAction item in ReInput.mapping.ActionsInCategory(actionCategory.id)) - { - string text = ((item.descriptiveName != string.Empty) ? item.descriptiveName : item.name); - if (item.type == InputActionType.Button) - { - GUILayout.BeginHorizontal(); - GUILayout.Label(text, GUILayout.Width(width)); - DrawAddActionMapButton(selectedPlayer.id, item, AxisRange.Positive, selectedController, selectedMap); - foreach (ActionElementMap allMap in selectedMap.AllMaps) - { - if (allMap.actionId == item.id) - { - DrawActionAssignmentButton(selectedPlayer.id, item, AxisRange.Positive, selectedController, selectedMap, allMap); - } - } - GUILayout.EndHorizontal(); - } - else - { - if (item.type != 0) - { - continue; - } - if (selectedController.type != 0) - { - GUILayout.BeginHorizontal(); - GUILayout.Label(text, GUILayout.Width(width)); - DrawAddActionMapButton(selectedPlayer.id, item, AxisRange.Full, selectedController, selectedMap); - foreach (ActionElementMap allMap2 in selectedMap.AllMaps) - { - if (allMap2.actionId == item.id && allMap2.elementType != ControllerElementType.Button && allMap2.axisType != AxisType.Split) - { - DrawActionAssignmentButton(selectedPlayer.id, item, AxisRange.Full, selectedController, selectedMap, allMap2); - DrawInvertButton(selectedPlayer.id, item, Pole.Positive, selectedController, selectedMap, allMap2); - } - } - GUILayout.EndHorizontal(); - } - string text2 = ((item.positiveDescriptiveName != string.Empty) ? item.positiveDescriptiveName : (item.descriptiveName + " +")); - GUILayout.BeginHorizontal(); - GUILayout.Label(text2, GUILayout.Width(width)); - DrawAddActionMapButton(selectedPlayer.id, item, AxisRange.Positive, selectedController, selectedMap); - foreach (ActionElementMap allMap3 in selectedMap.AllMaps) - { - if (allMap3.actionId == item.id && allMap3.axisContribution == Pole.Positive && allMap3.axisType != AxisType.Normal) - { - DrawActionAssignmentButton(selectedPlayer.id, item, AxisRange.Positive, selectedController, selectedMap, allMap3); - } - } - GUILayout.EndHorizontal(); - string text3 = ((item.negativeDescriptiveName != string.Empty) ? item.negativeDescriptiveName : (item.descriptiveName + " -")); - GUILayout.BeginHorizontal(); - GUILayout.Label(text3, GUILayout.Width(width)); - DrawAddActionMapButton(selectedPlayer.id, item, AxisRange.Negative, selectedController, selectedMap); - foreach (ActionElementMap allMap4 in selectedMap.AllMaps) - { - if (allMap4.actionId == item.id && allMap4.axisContribution == Pole.Negative && allMap4.axisType != AxisType.Normal) - { - DrawActionAssignmentButton(selectedPlayer.id, item, AxisRange.Negative, selectedController, selectedMap, allMap4); - } - } - GUILayout.EndHorizontal(); - } - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DrawActionAssignmentButton(int playerId, InputAction action, AxisRange actionRange, ControllerSelection controller, ControllerMap controllerMap, ActionElementMap elementMap) - { - if (GUILayout.Button(elementMap.elementIdentifierName, GUILayout.ExpandWidth(expand: false), GUILayout.MinWidth(30f))) - { - InputMapper.Context context = new InputMapper.Context - { - actionId = action.id, - actionRange = actionRange, - controllerMap = controllerMap, - actionElementMapToReplace = elementMap - }; - EnqueueAction(new ElementAssignmentChange(ElementAssignmentChangeType.ReassignOrRemove, context)); - startListening = true; - } - GUILayout.Space(4f); - } - - private void DrawInvertButton(int playerId, InputAction action, Pole actionAxisContribution, ControllerSelection controller, ControllerMap controllerMap, ActionElementMap elementMap) - { - bool invert = elementMap.invert; - bool flag = GUILayout.Toggle(invert, "Invert", GUILayout.ExpandWidth(expand: false)); - if (flag != invert) - { - elementMap.invert = flag; - } - GUILayout.Space(10f); - } - - private void DrawAddActionMapButton(int playerId, InputAction action, AxisRange actionRange, ControllerSelection controller, ControllerMap controllerMap) - { - if (GUILayout.Button("Add...", GUILayout.ExpandWidth(expand: false))) - { - InputMapper.Context context = new InputMapper.Context - { - actionId = action.id, - actionRange = actionRange, - controllerMap = controllerMap - }; - EnqueueAction(new ElementAssignmentChange(ElementAssignmentChangeType.Add, context)); - startListening = true; - } - GUILayout.Space(10f); - } - - private void ShowDialog() - { - dialog.Update(); - } - - private void DrawModalWindow(string title, string message) - { - if (dialog.enabled) - { - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.FlexibleSpace(); - GUILayout.BeginHorizontal(); - dialog.DrawConfirmButton("Okay"); - GUILayout.FlexibleSpace(); - dialog.DrawCancelButton(); - GUILayout.EndHorizontal(); - } - } - - private void DrawModalWindow_OkayOnly(string title, string message) - { - if (dialog.enabled) - { - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.FlexibleSpace(); - GUILayout.BeginHorizontal(); - dialog.DrawConfirmButton("Okay"); - GUILayout.EndHorizontal(); - } - } - - private void DrawElementAssignmentWindow(string title, string message) - { - if (!dialog.enabled) - { - return; - } - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.FlexibleSpace(); - if (!(actionQueue.Peek() is ElementAssignmentChange elementAssignmentChange)) - { - dialog.Cancel(); - return; - } - float num; - if (!dialog.busy) - { - if (startListening && inputMapper.status == InputMapper.Status.Idle) - { - inputMapper.Start(elementAssignmentChange.context); - startListening = false; - } - if (conflictFoundEventData != null) - { - dialog.Confirm(); - return; - } - num = inputMapper.timeRemaining; - if (num == 0f) - { - dialog.Cancel(); - return; - } - } - else - { - num = inputMapper.options.timeout; - } - GUILayout.Label("Assignment will be canceled in " + (int)Mathf.Ceil(num) + "...", style_wordWrap); - } - - private void DrawElementAssignmentProtectedConflictWindow(string title, string message) - { - if (dialog.enabled) - { - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.FlexibleSpace(); - if (!(actionQueue.Peek() is ElementAssignmentChange)) - { - dialog.Cancel(); - return; - } - GUILayout.BeginHorizontal(); - dialog.DrawConfirmButton(UserResponse.Custom1, "Add"); - GUILayout.FlexibleSpace(); - dialog.DrawCancelButton(); - GUILayout.EndHorizontal(); - } - } - - private void DrawElementAssignmentNormalConflictWindow(string title, string message) - { - if (dialog.enabled) - { - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.FlexibleSpace(); - if (!(actionQueue.Peek() is ElementAssignmentChange)) - { - dialog.Cancel(); - return; - } - GUILayout.BeginHorizontal(); - dialog.DrawConfirmButton(UserResponse.Confirm, "Replace"); - GUILayout.FlexibleSpace(); - dialog.DrawConfirmButton(UserResponse.Custom1, "Add"); - GUILayout.FlexibleSpace(); - dialog.DrawCancelButton(); - GUILayout.EndHorizontal(); - } - } - - private void DrawReassignOrRemoveElementAssignmentWindow(string title, string message) - { - if (dialog.enabled) - { - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.FlexibleSpace(); - GUILayout.BeginHorizontal(); - dialog.DrawConfirmButton("Reassign"); - GUILayout.FlexibleSpace(); - dialog.DrawCancelButton("Remove"); - GUILayout.EndHorizontal(); - } - } - - private void DrawFallbackJoystickIdentificationWindow(string title, string message) - { - if (!dialog.enabled) - { - return; - } - if (!(actionQueue.Peek() is FallbackJoystickIdentification fallbackJoystickIdentification)) - { - dialog.Cancel(); - return; - } - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.Label("Press any button or axis on \"" + fallbackJoystickIdentification.joystickName + "\" now.", style_wordWrap); - GUILayout.FlexibleSpace(); - if (GUILayout.Button("Skip")) - { - dialog.Cancel(); - } - else if (!dialog.busy && ReInput.controllers.SetUnityJoystickIdFromAnyButtonOrAxisPress(fallbackJoystickIdentification.joystickId, 0.8f, positiveAxesOnly: false)) - { - dialog.Confirm(); - } - } - - private void DrawCalibrationWindow(string title, string message) - { - if (!dialog.enabled) - { - return; - } - if (!(actionQueue.Peek() is Calibration calibration)) - { - dialog.Cancel(); - return; - } - GUILayout.Space(5f); - GUILayout.Label(message, style_wordWrap); - GUILayout.Space(20f); - GUILayout.BeginHorizontal(); - bool flag = GUI.enabled; - GUILayout.BeginVertical(GUILayout.Width(200f)); - calibrateScrollPos = GUILayout.BeginScrollView(calibrateScrollPos); - if (calibration.recording) - { - GUI.enabled = false; - } - IList axisElementIdentifiers = calibration.joystick.AxisElementIdentifiers; - for (int i = 0; i < axisElementIdentifiers.Count; i++) - { - ControllerElementIdentifier controllerElementIdentifier = axisElementIdentifiers[i]; - bool flag2 = calibration.selectedElementIdentifierId == controllerElementIdentifier.id; - bool flag3 = GUILayout.Toggle(flag2, controllerElementIdentifier.name, "Button", GUILayout.ExpandWidth(expand: false)); - if (flag2 != flag3) - { - calibration.selectedElementIdentifierId = controllerElementIdentifier.id; - } - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - GUILayout.EndScrollView(); - GUILayout.EndVertical(); - GUILayout.BeginVertical(GUILayout.Width(200f)); - if (calibration.selectedElementIdentifierId >= 0) - { - float axisRawById = calibration.joystick.GetAxisRawById(calibration.selectedElementIdentifierId); - GUILayout.Label("Raw Value: " + axisRawById); - int axisIndexById = calibration.joystick.GetAxisIndexById(calibration.selectedElementIdentifierId); - AxisCalibration axis = calibration.calibrationMap.GetAxis(axisIndexById); - GUILayout.Label("Calibrated Value: " + calibration.joystick.GetAxisById(calibration.selectedElementIdentifierId)); - GUILayout.Label("Zero: " + axis.calibratedZero); - GUILayout.Label("Min: " + axis.calibratedMin); - GUILayout.Label("Max: " + axis.calibratedMax); - GUILayout.Label("Dead Zone: " + axis.deadZone); - GUILayout.Space(15f); - bool flag4 = GUILayout.Toggle(axis.enabled, "Enabled", "Button", GUILayout.ExpandWidth(expand: false)); - if (axis.enabled != flag4) - { - axis.enabled = flag4; - } - GUILayout.Space(10f); - bool flag5 = GUILayout.Toggle(calibration.recording, "Record Min/Max", "Button", GUILayout.ExpandWidth(expand: false)); - if (flag5 != calibration.recording) - { - if (flag5) - { - axis.calibratedMax = 0f; - axis.calibratedMin = 0f; - } - calibration.recording = flag5; - } - if (calibration.recording) - { - axis.calibratedMin = Mathf.Min(axis.calibratedMin, axisRawById, axis.calibratedMin); - axis.calibratedMax = Mathf.Max(axis.calibratedMax, axisRawById, axis.calibratedMax); - GUI.enabled = false; - } - if (GUILayout.Button("Set Zero", GUILayout.ExpandWidth(expand: false))) - { - axis.calibratedZero = axisRawById; - } - if (GUILayout.Button("Set Dead Zone", GUILayout.ExpandWidth(expand: false))) - { - axis.deadZone = axisRawById; - } - bool flag6 = GUILayout.Toggle(axis.invert, "Invert", "Button", GUILayout.ExpandWidth(expand: false)); - if (axis.invert != flag6) - { - axis.invert = flag6; - } - GUILayout.Space(10f); - if (GUILayout.Button("Reset", GUILayout.ExpandWidth(expand: false))) - { - axis.Reset(); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - else - { - GUILayout.Label("Select an axis to begin."); - } - GUILayout.EndVertical(); - GUILayout.EndHorizontal(); - GUILayout.FlexibleSpace(); - if (calibration.recording) - { - GUI.enabled = false; - } - if (GUILayout.Button("Close")) - { - calibrateScrollPos = default(Vector2); - dialog.Confirm(); - } - if (GUI.enabled != flag) - { - GUI.enabled = flag; - } - } - - private void DialogResultCallback(int queueActionId, UserResponse response) - { - foreach (QueueEntry item in actionQueue) - { - if (item.id == queueActionId) - { - if (response != UserResponse.Cancel) - { - item.Confirm(response); - } - else - { - item.Cancel(); - } - break; - } - } - } - - private Rect GetScreenCenteredRect(float width, float height) - { - return new Rect((float)Screen.width * 0.5f - width * 0.5f, (float)((double)Screen.height * 0.5 - (double)(height * 0.5f)), width, height); - } - - private void EnqueueAction(QueueEntry entry) - { - if (entry != null) - { - busy = true; - GUI.enabled = false; - actionQueue.Enqueue(entry); - } - } - - private void ProcessQueue() - { - if (dialog.enabled || busy || actionQueue.Count == 0) - { - return; - } - while (actionQueue.Count > 0) - { - QueueEntry queueEntry = actionQueue.Peek(); - bool flag = false; - switch (queueEntry.queueActionType) - { - case QueueActionType.JoystickAssignment: - flag = ProcessJoystickAssignmentChange((JoystickAssignmentChange)queueEntry); - break; - case QueueActionType.ElementAssignment: - flag = ProcessElementAssignmentChange((ElementAssignmentChange)queueEntry); - break; - case QueueActionType.FallbackJoystickIdentification: - flag = ProcessFallbackJoystickIdentification((FallbackJoystickIdentification)queueEntry); - break; - case QueueActionType.Calibrate: - flag = ProcessCalibration((Calibration)queueEntry); - break; - } - if (flag) - { - actionQueue.Dequeue(); - continue; - } - break; - } - } - - private bool ProcessJoystickAssignmentChange(JoystickAssignmentChange entry) - { - if (entry.state == QueueEntry.State.Canceled) - { - return true; - } - Player player = ReInput.players.GetPlayer(entry.playerId); - if (player == null) - { - return true; - } - if (!entry.assign) - { - player.controllers.RemoveController(ControllerType.Joystick, entry.joystickId); - ControllerSelectionChanged(); - return true; - } - if (player.controllers.ContainsController(ControllerType.Joystick, entry.joystickId)) - { - return true; - } - if (!ReInput.controllers.IsJoystickAssigned(entry.joystickId) || entry.state == QueueEntry.State.Confirmed) - { - player.controllers.AddController(ControllerType.Joystick, entry.joystickId, removeFromOtherPlayers: true); - ControllerSelectionChanged(); - return true; - } - dialog.StartModal(entry.id, DialogHelper.DialogType.JoystickConflict, new WindowProperties - { - title = "Joystick Reassignment", - message = "This joystick is already assigned to another player. Do you want to reassign this joystick to " + player.descriptiveName + "?", - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawModalWindow - }, DialogResultCallback); - return false; - } - - private bool ProcessElementAssignmentChange(ElementAssignmentChange entry) - { - switch (entry.changeType) - { - case ElementAssignmentChangeType.ReassignOrRemove: - return ProcessRemoveOrReassignElementAssignment(entry); - case ElementAssignmentChangeType.Remove: - return ProcessRemoveElementAssignment(entry); - case ElementAssignmentChangeType.Add: - case ElementAssignmentChangeType.Replace: - return ProcessAddOrReplaceElementAssignment(entry); - case ElementAssignmentChangeType.ConflictCheck: - return ProcessElementAssignmentConflictCheck(entry); - default: - throw new NotImplementedException(); - } - } - - private bool ProcessRemoveOrReassignElementAssignment(ElementAssignmentChange entry) - { - if (entry.context.controllerMap == null) - { - return true; - } - if (entry.state == QueueEntry.State.Canceled) - { - ElementAssignmentChange elementAssignmentChange = new ElementAssignmentChange(entry); - elementAssignmentChange.changeType = ElementAssignmentChangeType.Remove; - actionQueue.Enqueue(elementAssignmentChange); - return true; - } - if (entry.state == QueueEntry.State.Confirmed) - { - ElementAssignmentChange elementAssignmentChange2 = new ElementAssignmentChange(entry); - elementAssignmentChange2.changeType = ElementAssignmentChangeType.Replace; - actionQueue.Enqueue(elementAssignmentChange2); - return true; - } - dialog.StartModal(entry.id, DialogHelper.DialogType.AssignElement, new WindowProperties - { - title = "Reassign or Remove", - message = "Do you want to reassign or remove this assignment?", - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawReassignOrRemoveElementAssignmentWindow - }, DialogResultCallback); - return false; - } - - private bool ProcessRemoveElementAssignment(ElementAssignmentChange entry) - { - if (entry.context.controllerMap == null) - { - return true; - } - if (entry.state == QueueEntry.State.Canceled) - { - return true; - } - if (entry.state == QueueEntry.State.Confirmed) - { - entry.context.controllerMap.DeleteElementMap(entry.context.actionElementMapToReplace.id); - return true; - } - dialog.StartModal(entry.id, DialogHelper.DialogType.DeleteAssignmentConfirmation, new WindowProperties - { - title = "Remove Assignment", - message = "Are you sure you want to remove this assignment?", - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawModalWindow - }, DialogResultCallback); - return false; - } - - private bool ProcessAddOrReplaceElementAssignment(ElementAssignmentChange entry) - { - if (entry.state == QueueEntry.State.Canceled) - { - inputMapper.Stop(); - return true; - } - if (entry.state == QueueEntry.State.Confirmed) - { - if (Event.current.type != EventType.Layout) - { - return false; - } - if (conflictFoundEventData != null) - { - ElementAssignmentChange elementAssignmentChange = new ElementAssignmentChange(entry); - elementAssignmentChange.changeType = ElementAssignmentChangeType.ConflictCheck; - actionQueue.Enqueue(elementAssignmentChange); - } - return true; - } - string text; - if (entry.context.controllerMap.controllerType != 0) - { - text = ((entry.context.controllerMap.controllerType != ControllerType.Mouse) ? "Press any button or axis to assign it to this action." : "Press any mouse button or axis to assign it to this action.\n\nTo assign mouse movement axes, move the mouse quickly in the direction you want mapped to the action. Slow movements will be ignored."); - } - else - { - text = ((Application.platform != 0 && Application.platform != RuntimePlatform.OSXPlayer) ? "Press any key to assign it to this action. You may also use the modifier keys Control, Alt, and Shift. If you wish to assign a modifier key itself to this action, press and hold the key for 1 second." : "Press any key to assign it to this action. You may also use the modifier keys Command, Control, Alt, and Shift. If you wish to assign a modifier key itself to this action, press and hold the key for 1 second."); - if (Application.isEditor) - { - text += "\n\nNOTE: Some modifier key combinations will not work in the Unity Editor, but they will work in a game build."; - } - } - dialog.StartModal(entry.id, DialogHelper.DialogType.AssignElement, new WindowProperties - { - title = "Assign", - message = text, - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawElementAssignmentWindow - }, DialogResultCallback); - return false; - } - - private bool ProcessElementAssignmentConflictCheck(ElementAssignmentChange entry) - { - if (entry.context.controllerMap == null) - { - return true; - } - if (entry.state == QueueEntry.State.Canceled) - { - inputMapper.Stop(); - return true; - } - if (conflictFoundEventData == null) - { - return true; - } - if (entry.state == QueueEntry.State.Confirmed) - { - if (entry.response == UserResponse.Confirm) - { - conflictFoundEventData.responseCallback(InputMapper.ConflictResponse.Replace); - } - else - { - if (entry.response != UserResponse.Custom1) - { - throw new NotImplementedException(); - } - conflictFoundEventData.responseCallback(InputMapper.ConflictResponse.Add); - } - return true; - } - if (conflictFoundEventData.isProtected) - { - string message = conflictFoundEventData.assignment.elementDisplayName + " is already in use and is protected from reassignment. You cannot remove the protected assignment, but you can still assign the action to this element. If you do so, the element will trigger multiple actions when activated."; - dialog.StartModal(entry.id, DialogHelper.DialogType.AssignElement, new WindowProperties - { - title = "Assignment Conflict", - message = message, - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawElementAssignmentProtectedConflictWindow - }, DialogResultCallback); - } - else - { - string message2 = conflictFoundEventData.assignment.elementDisplayName + " is already in use. You may replace the other conflicting assignments, add this assignment anyway which will leave multiple actions assigned to this element, or cancel this assignment."; - dialog.StartModal(entry.id, DialogHelper.DialogType.AssignElement, new WindowProperties - { - title = "Assignment Conflict", - message = message2, - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawElementAssignmentNormalConflictWindow - }, DialogResultCallback); - } - return false; - } - - private bool ProcessFallbackJoystickIdentification(FallbackJoystickIdentification entry) - { - if (entry.state == QueueEntry.State.Canceled) - { - return true; - } - if (entry.state == QueueEntry.State.Confirmed) - { - return true; - } - dialog.StartModal(entry.id, DialogHelper.DialogType.JoystickConflict, new WindowProperties - { - title = "Joystick Identification Required", - message = "A joystick has been attached or removed. You will need to identify each joystick by pressing a button on the controller listed below:", - rect = GetScreenCenteredRect(250f, 200f), - windowDrawDelegate = DrawFallbackJoystickIdentificationWindow - }, DialogResultCallback, 1f); - return false; - } - - private bool ProcessCalibration(Calibration entry) - { - if (entry.state == QueueEntry.State.Canceled) - { - return true; - } - if (entry.state == QueueEntry.State.Confirmed) - { - return true; - } - dialog.StartModal(entry.id, DialogHelper.DialogType.JoystickConflict, new WindowProperties - { - title = "Calibrate Controller", - message = "Select an axis to calibrate on the " + entry.joystick.name + ".", - rect = GetScreenCenteredRect(450f, 480f), - windowDrawDelegate = DrawCalibrationWindow - }, DialogResultCallback); - return false; - } - - private void PlayerSelectionChanged() - { - ClearControllerSelection(); - } - - private void ControllerSelectionChanged() - { - ClearMapSelection(); - } - - private void ClearControllerSelection() - { - selectedController.Clear(); - ClearMapSelection(); - } - - private void ClearMapSelection() - { - selectedMapCategoryId = -1; - selectedMap = null; - } - - private void ResetAll() - { - ClearWorkingVars(); - initialized = false; - showMenu = false; - } - - private void ClearWorkingVars() - { - selectedPlayer = null; - ClearMapSelection(); - selectedController.Clear(); - actionScrollPos = default(Vector2); - dialog.FullReset(); - actionQueue.Clear(); - busy = false; - startListening = false; - conflictFoundEventData = null; - inputMapper.Stop(); - } - - private void SetGUIStateStart() - { - guiState = true; - if (busy) - { - guiState = false; - } - pageGUIState = guiState && !busy && !dialog.enabled && !dialog.busy; - if (GUI.enabled != guiState) - { - GUI.enabled = guiState; - } - } - - private void SetGUIStateEnd() - { - guiState = true; - if (!GUI.enabled) - { - GUI.enabled = guiState; - } - } - - private void JoystickConnected(ControllerStatusChangedEventArgs args) - { - if (ReInput.controllers.IsControllerAssigned(args.controllerType, args.controllerId)) - { - foreach (Player allPlayer in ReInput.players.AllPlayers) - { - if (allPlayer.controllers.ContainsController(args.controllerType, args.controllerId)) - { - ReInput.userDataStore.LoadControllerData(allPlayer.id, args.controllerType, args.controllerId); - } - } - } - else - { - ReInput.userDataStore.LoadControllerData(args.controllerType, args.controllerId); - } - if (ReInput.unityJoystickIdentificationRequired) - { - IdentifyAllJoysticks(); - } - } - - private void JoystickPreDisconnect(ControllerStatusChangedEventArgs args) - { - if (selectedController.hasSelection && args.controllerType == selectedController.type && args.controllerId == selectedController.id) - { - ClearControllerSelection(); - } - if (!showMenu) - { - return; - } - if (ReInput.controllers.IsControllerAssigned(args.controllerType, args.controllerId)) - { - foreach (Player allPlayer in ReInput.players.AllPlayers) - { - if (allPlayer.controllers.ContainsController(args.controllerType, args.controllerId)) - { - ReInput.userDataStore.SaveControllerData(allPlayer.id, args.controllerType, args.controllerId); - } - } - return; - } - ReInput.userDataStore.SaveControllerData(args.controllerType, args.controllerId); - } - - private void JoystickDisconnected(ControllerStatusChangedEventArgs args) - { - if (showMenu) - { - ClearWorkingVars(); - } - if (ReInput.unityJoystickIdentificationRequired) - { - IdentifyAllJoysticks(); - } - } - - private void OnConflictFound(InputMapper.ConflictFoundEventData data) - { - conflictFoundEventData = data; - } - - private void OnStopped(InputMapper.StoppedEventData data) - { - conflictFoundEventData = null; - } - - public void IdentifyAllJoysticks() - { - if (ReInput.controllers.joystickCount == 0) - { - return; - } - ClearWorkingVars(); - Open(); - foreach (Joystick joystick in ReInput.controllers.Joysticks) - { - actionQueue.Enqueue(new FallbackJoystickIdentification(joystick.id, joystick.name)); - } - } - - protected void CheckRecompile() - { - } - - private void RecompileWindow(int windowId) - { - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo.cs deleted file mode 100644 index 2c67e86..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class CustomControllerDemo : MonoBehaviour -{ - public int playerId; - - public string controllerTag; - - public bool useUpdateCallbacks; - - private int buttonCount; - - private int axisCount; - - private float[] axisValues; - - private bool[] buttonValues; - - private TouchJoystickExample[] joysticks; - - private TouchButtonExample[] buttons; - - private CustomController controller; - - [NonSerialized] - private bool initialized; - - private void Awake() - { - ScreenOrientation screenOrientation = ScreenOrientation.LandscapeLeft; - if (SystemInfo.deviceType == DeviceType.Handheld && Screen.orientation != screenOrientation) - { - Screen.orientation = screenOrientation; - } - Initialize(); - } - - private void Initialize() - { - ReInput.InputSourceUpdateEvent += OnInputSourceUpdate; - joysticks = GetComponentsInChildren(); - buttons = GetComponentsInChildren(); - axisCount = joysticks.Length * 2; - buttonCount = buttons.Length; - axisValues = new float[axisCount]; - buttonValues = new bool[buttonCount]; - Player player = ReInput.players.GetPlayer(playerId); - controller = player.controllers.GetControllerWithTag(controllerTag); - if (controller == null) - { - Debug.LogError("A matching controller was not found for tag \"" + controllerTag + "\""); - } - if (controller.buttonCount != buttonValues.Length || controller.axisCount != axisValues.Length) - { - Debug.LogError("Controller has wrong number of elements!"); - } - if (useUpdateCallbacks && controller != null) - { - controller.SetAxisUpdateCallback(GetAxisValueCallback); - controller.SetButtonUpdateCallback(GetButtonValueCallback); - } - initialized = true; - } - - private void Update() - { - if (ReInput.isReady && !initialized) - { - Initialize(); - } - } - - private void OnInputSourceUpdate() - { - GetSourceAxisValues(); - GetSourceButtonValues(); - if (!useUpdateCallbacks) - { - SetControllerAxisValues(); - SetControllerButtonValues(); - } - } - - private void GetSourceAxisValues() - { - for (int i = 0; i < axisValues.Length; i++) - { - if (i % 2 != 0) - { - axisValues[i] = joysticks[i / 2].position.y; - } - else - { - axisValues[i] = joysticks[i / 2].position.x; - } - } - } - - private void GetSourceButtonValues() - { - for (int i = 0; i < buttonValues.Length; i++) - { - buttonValues[i] = buttons[i].isPressed; - } - } - - private void SetControllerAxisValues() - { - for (int i = 0; i < axisValues.Length; i++) - { - controller.SetAxisValue(i, axisValues[i]); - } - } - - private void SetControllerButtonValues() - { - for (int i = 0; i < buttonValues.Length; i++) - { - controller.SetButtonValue(i, buttonValues[i]); - } - } - - private float GetAxisValueCallback(int index) - { - if (index >= axisValues.Length) - { - return 0f; - } - return axisValues[index]; - } - - private bool GetButtonValueCallback(int index) - { - if (index >= buttonValues.Length) - { - return false; - } - return buttonValues[index]; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo_Player.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo_Player.cs deleted file mode 100644 index 7c4346a..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllerDemo_Player.cs +++ /dev/null @@ -1,58 +0,0 @@ -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -[RequireComponent(typeof(CharacterController))] -public class CustomControllerDemo_Player : MonoBehaviour -{ - public int playerId; - - public float speed = 1f; - - public float bulletSpeed = 20f; - - public GameObject bulletPrefab; - - private Player _player; - - private CharacterController cc; - - private Player player - { - get - { - if (_player == null) - { - _player = ReInput.players.GetPlayer(playerId); - } - return _player; - } - } - - private void Awake() - { - cc = GetComponent(); - } - - private void Update() - { - if (ReInput.isReady) - { - Vector2 vector = new Vector2(player.GetAxis("Move Horizontal"), player.GetAxis("Move Vertical")); - cc.Move(vector * speed * Time.deltaTime); - if (player.GetButtonDown("Fire")) - { - Vector3 vector2 = Vector3.Scale(new Vector3(1f, 0f, 0f), base.transform.right); - Object.Instantiate(bulletPrefab, base.transform.position + vector2, Quaternion.identity).GetComponent().velocity = new Vector3(bulletSpeed * base.transform.right.x, 0f, 0f); - } - if (player.GetButtonDown("Change Color")) - { - Renderer component = GetComponent(); - Material material = component.material; - material.color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f); - component.material = material; - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllersTiltDemo.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllersTiltDemo.cs deleted file mode 100644 index d24caf2..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/CustomControllersTiltDemo.cs +++ /dev/null @@ -1,47 +0,0 @@ -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class CustomControllersTiltDemo : MonoBehaviour -{ - public Transform target; - - public float speed = 10f; - - private CustomController controller; - - private Player player; - - private void Awake() - { - Screen.orientation = ScreenOrientation.LandscapeLeft; - player = ReInput.players.GetPlayer(0); - ReInput.InputSourceUpdateEvent += OnInputUpdate; - controller = (CustomController)player.controllers.GetControllerWithTag(ControllerType.Custom, "TiltController"); - } - - private void Update() - { - if (!(target == null)) - { - Vector3 zero = Vector3.zero; - zero.y = player.GetAxis("Tilt Vertical"); - zero.x = player.GetAxis("Tilt Horizontal"); - if (zero.sqrMagnitude > 1f) - { - zero.Normalize(); - } - zero *= Time.deltaTime; - target.Translate(zero * speed); - } - } - - private void OnInputUpdate() - { - Vector3 acceleration = Input.acceleration; - controller.SetAxisValue(0, acceleration.x); - controller.SetAxisValue(1, acceleration.y); - controller.SetAxisValue(2, acceleration.z); - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/DualShock4SpecialFeaturesExample.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/DualShock4SpecialFeaturesExample.cs deleted file mode 100644 index 838b779..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/DualShock4SpecialFeaturesExample.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System.Collections.Generic; -using Rewired.ControllerExtensions; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class DualShock4SpecialFeaturesExample : MonoBehaviour -{ - private class Touch - { - public GameObject go; - - public int touchId = -1; - } - - private const int maxTouches = 2; - - public int playerId; - - public Transform touchpadTransform; - - public GameObject lightObject; - - public Transform accelerometerTransform; - - private List touches; - - private Queue unusedTouches; - - private bool isFlashing; - - private GUIStyle textStyle; - - private Player player => ReInput.players.GetPlayer(playerId); - - private void Awake() - { - InitializeTouchObjects(); - } - - private void Update() - { - if (!ReInput.isReady) - { - return; - } - IDualShock4Extension firstDS = GetFirstDS4(player); - if (firstDS != null) - { - base.transform.rotation = firstDS.GetOrientation(); - HandleTouchpad(firstDS); - Vector3 accelerometerValue = firstDS.GetAccelerometerValue(); - accelerometerTransform.LookAt(accelerometerTransform.position + accelerometerValue); - } - if (player.GetButtonDown("CycleLight")) - { - SetRandomLightColor(); - } - if (player.GetButtonDown("ResetOrientation")) - { - ResetOrientation(); - } - if (player.GetButtonDown("ToggleLightFlash")) - { - if (isFlashing) - { - StopLightFlash(); - } - else - { - StartLightFlash(); - } - isFlashing = !isFlashing; - } - if (player.GetButtonDown("VibrateLeft")) - { - firstDS.SetVibration(0, 1f, 1f); - } - if (player.GetButtonDown("VibrateRight")) - { - firstDS.SetVibration(1, 1f, 1f); - } - } - - private void OnGUI() - { - if (textStyle == null) - { - textStyle = new GUIStyle(GUI.skin.label); - textStyle.fontSize = 20; - textStyle.wordWrap = true; - } - if (GetFirstDS4(player) != null) - { - GUILayout.BeginArea(new Rect(200f, 100f, (float)Screen.width - 400f, (float)Screen.height - 200f)); - GUILayout.Label("Rotate the Dual Shock 4 to see the model rotate in sync.", textStyle); - GUILayout.Label("Touch the touchpad to see them appear on the model.", textStyle); - ActionElementMap firstElementMapWithAction = player.controllers.maps.GetFirstElementMapWithAction(ControllerType.Joystick, "ResetOrientation", skipDisabledMaps: true); - if (firstElementMapWithAction != null) - { - GUILayout.Label("Press " + firstElementMapWithAction.elementIdentifierName + " to reset the orientation. Hold the gamepad facing the screen with sticks pointing up and press the button.", textStyle); - } - firstElementMapWithAction = player.controllers.maps.GetFirstElementMapWithAction(ControllerType.Joystick, "CycleLight", skipDisabledMaps: true); - if (firstElementMapWithAction != null) - { - GUILayout.Label("Press " + firstElementMapWithAction.elementIdentifierName + " to change the light color.", textStyle); - } - firstElementMapWithAction = player.controllers.maps.GetFirstElementMapWithAction(ControllerType.Joystick, "ToggleLightFlash", skipDisabledMaps: true); - if (firstElementMapWithAction != null) - { - GUILayout.Label("Press " + firstElementMapWithAction.elementIdentifierName + " to start or stop the light flashing.", textStyle); - } - firstElementMapWithAction = player.controllers.maps.GetFirstElementMapWithAction(ControllerType.Joystick, "VibrateLeft", skipDisabledMaps: true); - if (firstElementMapWithAction != null) - { - GUILayout.Label("Press " + firstElementMapWithAction.elementIdentifierName + " vibrate the left motor.", textStyle); - } - firstElementMapWithAction = player.controllers.maps.GetFirstElementMapWithAction(ControllerType.Joystick, "VibrateRight", skipDisabledMaps: true); - if (firstElementMapWithAction != null) - { - GUILayout.Label("Press " + firstElementMapWithAction.elementIdentifierName + " vibrate the right motor.", textStyle); - } - GUILayout.EndArea(); - } - } - - private void ResetOrientation() - { - GetFirstDS4(player)?.ResetOrientation(); - } - - private void SetRandomLightColor() - { - IDualShock4Extension firstDS = GetFirstDS4(player); - if (firstDS != null) - { - Color color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f); - firstDS.SetLightColor(color); - lightObject.GetComponent().material.color = color; - } - } - - private void StartLightFlash() - { - if (GetFirstDS4(player) is DualShock4Extension dualShock4Extension) - { - dualShock4Extension.SetLightFlash(0.5f, 0.5f); - } - } - - private void StopLightFlash() - { - if (GetFirstDS4(player) is DualShock4Extension dualShock4Extension) - { - dualShock4Extension.StopLightFlash(); - } - } - - private IDualShock4Extension GetFirstDS4(Player player) - { - foreach (Joystick joystick in player.controllers.Joysticks) - { - IDualShock4Extension extension = joystick.GetExtension(); - if (extension != null) - { - return extension; - } - } - return null; - } - - private void InitializeTouchObjects() - { - touches = new List(2); - unusedTouches = new Queue(2); - for (int i = 0; i < 2; i++) - { - Touch touch = new Touch(); - touch.go = GameObject.CreatePrimitive(PrimitiveType.Sphere); - touch.go.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); - touch.go.transform.SetParent(touchpadTransform, worldPositionStays: true); - touch.go.GetComponent().material.color = ((i == 0) ? Color.red : Color.green); - touch.go.SetActive(value: false); - unusedTouches.Enqueue(touch); - } - } - - private void HandleTouchpad(IDualShock4Extension ds4) - { - for (int num = touches.Count - 1; num >= 0; num--) - { - Touch touch = touches[num]; - if (!ds4.IsTouchingByTouchId(touch.touchId)) - { - touch.go.SetActive(value: false); - unusedTouches.Enqueue(touch); - touches.RemoveAt(num); - } - } - for (int i = 0; i < ds4.maxTouches; i++) - { - if (ds4.IsTouching(i)) - { - int touchId = ds4.GetTouchId(i); - Touch touch2 = touches.Find((Touch x) => x.touchId == touchId); - if (touch2 == null) - { - touch2 = unusedTouches.Dequeue(); - touches.Add(touch2); - } - touch2.touchId = touchId; - touch2.go.SetActive(value: true); - ds4.GetTouchPosition(i, out var position); - touch2.go.transform.localPosition = new Vector3(position.x - 0.5f, 0.5f + touch2.go.transform.localScale.y * 0.5f, position.y - 0.5f); - } - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/EightPlayersExample_Player.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/EightPlayersExample_Player.cs deleted file mode 100644 index 0ce56e1..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/EightPlayersExample_Player.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -[RequireComponent(typeof(CharacterController))] -public class EightPlayersExample_Player : MonoBehaviour -{ - public int playerId; - - public float moveSpeed = 3f; - - public float bulletSpeed = 15f; - - public GameObject bulletPrefab; - - private Player player; - - private CharacterController cc; - - private Vector3 moveVector; - - private bool fire; - - [NonSerialized] - private bool initialized; - - private void Awake() - { - cc = GetComponent(); - } - - private void Initialize() - { - player = ReInput.players.GetPlayer(playerId); - initialized = true; - } - - private void Update() - { - if (ReInput.isReady) - { - if (!initialized) - { - Initialize(); - } - GetInput(); - ProcessInput(); - } - } - - private void GetInput() - { - moveVector.x = player.GetAxis("Move Horizontal"); - moveVector.y = player.GetAxis("Move Vertical"); - fire = player.GetButtonDown("Fire"); - } - - private void ProcessInput() - { - if (moveVector.x != 0f || moveVector.y != 0f) - { - cc.Move(moveVector * moveSpeed * Time.deltaTime); - } - if (fire) - { - UnityEngine.Object.Instantiate(bulletPrefab, base.transform.position + base.transform.right, base.transform.rotation).GetComponent().AddForce(base.transform.right * bulletSpeed, ForceMode.VelocityChange); - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/FallbackJoystickIdentificationDemo.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/FallbackJoystickIdentificationDemo.cs deleted file mode 100644 index 3213b71..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/FallbackJoystickIdentificationDemo.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class FallbackJoystickIdentificationDemo : MonoBehaviour -{ - private const float windowWidth = 250f; - - private const float windowHeight = 250f; - - private const float inputDelay = 1f; - - private bool identifyRequired; - - private Queue joysticksToIdentify; - - private float nextInputAllowedTime; - - private GUIStyle style; - - private void Awake() - { - if (ReInput.unityJoystickIdentificationRequired) - { - ReInput.ControllerConnectedEvent += JoystickConnected; - ReInput.ControllerDisconnectedEvent += JoystickDisconnected; - IdentifyAllJoysticks(); - } - } - - private void JoystickConnected(ControllerStatusChangedEventArgs args) - { - IdentifyAllJoysticks(); - } - - private void JoystickDisconnected(ControllerStatusChangedEventArgs args) - { - IdentifyAllJoysticks(); - } - - public void IdentifyAllJoysticks() - { - Reset(); - if (ReInput.controllers.joystickCount != 0) - { - Joystick[] joysticks = ReInput.controllers.GetJoysticks(); - if (joysticks != null) - { - identifyRequired = true; - joysticksToIdentify = new Queue(joysticks); - SetInputDelay(); - } - } - } - - private void SetInputDelay() - { - nextInputAllowedTime = Time.time + 1f; - } - - private void OnGUI() - { - if (!identifyRequired) - { - return; - } - if (joysticksToIdentify == null || joysticksToIdentify.Count == 0) - { - Reset(); - return; - } - Rect screenRect = new Rect((float)Screen.width * 0.5f - 125f, (float)Screen.height * 0.5f - 125f, 250f, 250f); - GUILayout.Window(0, screenRect, DrawDialogWindow, "Joystick Identification Required"); - GUI.FocusWindow(0); - if (!(Time.time < nextInputAllowedTime) && ReInput.controllers.SetUnityJoystickIdFromAnyButtonOrAxisPress(joysticksToIdentify.Peek().id, 0.8f, positiveAxesOnly: false)) - { - joysticksToIdentify.Dequeue(); - SetInputDelay(); - if (joysticksToIdentify.Count == 0) - { - Reset(); - } - } - } - - private void DrawDialogWindow(int windowId) - { - if (identifyRequired) - { - if (style == null) - { - style = new GUIStyle(GUI.skin.label); - style.wordWrap = true; - } - GUILayout.Space(15f); - GUILayout.Label("A joystick has been attached or removed. You will need to identify each joystick by pressing a button on the controller listed below:", style); - Joystick joystick = joysticksToIdentify.Peek(); - GUILayout.Label("Press any button on \"" + joystick.name + "\" now.", style); - GUILayout.FlexibleSpace(); - if (GUILayout.Button("Skip")) - { - joysticksToIdentify.Dequeue(); - } - } - } - - private void Reset() - { - joysticksToIdentify = null; - identifyRequired = false; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/PlayerMouseSpriteExample.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/PlayerMouseSpriteExample.cs deleted file mode 100644 index 194fb5d..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/PlayerMouseSpriteExample.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class PlayerMouseSpriteExample : MonoBehaviour -{ - [Tooltip("The Player that will control the mouse")] - public int playerId; - - [Tooltip("The Rewired Action used for the mouse horizontal axis.")] - public string horizontalAction = "MouseX"; - - [Tooltip("The Rewired Action used for the mouse vertical axis.")] - public string verticalAction = "MouseY"; - - [Tooltip("The Rewired Action used for the mouse wheel axis.")] - public string wheelAction = "MouseWheel"; - - [Tooltip("The Rewired Action used for the mouse left button.")] - public string leftButtonAction = "MouseLeftButton"; - - [Tooltip("The Rewired Action used for the mouse right button.")] - public string rightButtonAction = "MouseRightButton"; - - [Tooltip("The Rewired Action used for the mouse middle button.")] - public string middleButtonAction = "MouseMiddleButton"; - - [Tooltip("The distance from the camera that the pointer will be drawn.")] - public float distanceFromCamera = 1f; - - [Tooltip("The scale of the sprite pointer.")] - public float spriteScale = 0.05f; - - [Tooltip("The pointer prefab.")] - public GameObject pointerPrefab; - - [Tooltip("The click effect prefab.")] - public GameObject clickEffectPrefab; - - [Tooltip("Should the hardware pointer be hidden?")] - public bool hideHardwarePointer = true; - - [NonSerialized] - private GameObject pointer; - - [NonSerialized] - private PlayerMouse mouse; - - private void Awake() - { - pointer = UnityEngine.Object.Instantiate(pointerPrefab); - pointer.transform.localScale = new Vector3(spriteScale, spriteScale, spriteScale); - if (hideHardwarePointer) - { - Cursor.visible = false; - } - mouse = PlayerMouse.Factory.Create(); - mouse.playerId = playerId; - mouse.xAxis.actionName = horizontalAction; - mouse.yAxis.actionName = verticalAction; - mouse.wheel.yAxis.actionName = wheelAction; - mouse.leftButton.actionName = leftButtonAction; - mouse.rightButton.actionName = rightButtonAction; - mouse.middleButton.actionName = middleButtonAction; - mouse.pointerSpeed = 1f; - mouse.wheel.yAxis.repeatRate = 5f; - mouse.screenPosition = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); - mouse.ScreenPositionChangedEvent += OnScreenPositionChanged; - OnScreenPositionChanged(mouse.screenPosition); - } - - private void Update() - { - if (ReInput.isReady) - { - pointer.transform.Rotate(Vector3.forward, mouse.wheel.yAxis.value * 20f); - if (mouse.leftButton.justPressed) - { - CreateClickEffect(new Color(0f, 1f, 0f, 1f)); - } - if (mouse.rightButton.justPressed) - { - CreateClickEffect(new Color(1f, 0f, 0f, 1f)); - } - if (mouse.middleButton.justPressed) - { - CreateClickEffect(new Color(1f, 1f, 0f, 1f)); - } - } - } - - private void OnDestroy() - { - if (ReInput.isReady) - { - mouse.ScreenPositionChangedEvent -= OnScreenPositionChanged; - } - } - - private void CreateClickEffect(Color color) - { - GameObject obj = UnityEngine.Object.Instantiate(clickEffectPrefab); - obj.transform.localScale = new Vector3(spriteScale, spriteScale, spriteScale); - obj.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(mouse.screenPosition.x, mouse.screenPosition.y, distanceFromCamera)); - obj.GetComponentInChildren().color = color; - UnityEngine.Object.Destroy(obj, 0.5f); - } - - private void OnScreenPositionChanged(Vector2 position) - { - Vector3 position2 = Camera.main.ScreenToWorldPoint(new Vector3(position.x, position.y, distanceFromCamera)); - pointer.transform.position = position2; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/PlayerPointerEventHandlerExample.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/PlayerPointerEventHandlerExample.cs deleted file mode 100644 index dde8871..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/PlayerPointerEventHandlerExample.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System.Collections.Generic; -using System.Text; -using Rewired.Integration.UnityUI; -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public sealed class PlayerPointerEventHandlerExample : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerUpHandler, IPointerDownHandler, IPointerClickHandler, IScrollHandler, IBeginDragHandler, IDragHandler, IEndDragHandler -{ - public Text text; - - private const int logLength = 10; - - private List log = new List(); - - private void Log(string o) - { - log.Add(o); - if (log.Count > 10) - { - log.RemoveAt(0); - } - } - - private void Update() - { - if (!(text != null)) - { - return; - } - StringBuilder stringBuilder = new StringBuilder(); - foreach (string item in log) - { - stringBuilder.AppendLine(item); - } - text.text = stringBuilder.ToString(); - } - - public void OnPointerEnter(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnPointerEnter: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData)); - } - } - - public void OnPointerExit(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnPointerExit: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData)); - } - } - - public void OnPointerUp(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnPointerUp: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData) + ", Button Index = " + playerPointerEventData.buttonIndex); - } - } - - public void OnPointerDown(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnPointerDown: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData) + ", Button Index = " + playerPointerEventData.buttonIndex); - } - } - - public void OnPointerClick(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnPointerClick: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData) + ", Button Index = " + playerPointerEventData.buttonIndex); - } - } - - public void OnScroll(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnScroll: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData)); - } - } - - public void OnBeginDrag(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnBeginDrag: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData) + ", Button Index = " + playerPointerEventData.buttonIndex); - } - } - - public void OnDrag(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnDrag: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData) + ", Button Index = " + playerPointerEventData.buttonIndex); - } - } - - public void OnEndDrag(PointerEventData eventData) - { - if (eventData is PlayerPointerEventData) - { - PlayerPointerEventData playerPointerEventData = (PlayerPointerEventData)eventData; - Log("OnEndDrag: Player = " + playerPointerEventData.playerId + ", Pointer Index = " + playerPointerEventData.inputSourceIndex + ", Source = " + GetSourceName(playerPointerEventData) + ", Button Index = " + playerPointerEventData.buttonIndex); - } - } - - private static string GetSourceName(PlayerPointerEventData playerEventData) - { - if (playerEventData.sourceType == PointerEventType.Mouse) - { - if (playerEventData.mouseSource is Behaviour) - { - return (playerEventData.mouseSource as Behaviour).name; - } - } - else if (playerEventData.sourceType == PointerEventType.Touch && playerEventData.touchSource is Behaviour) - { - return (playerEventData.touchSource as Behaviour).name; - } - return null; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_Assigner.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_Assigner.cs deleted file mode 100644 index 83c25e8..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_Assigner.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class PressAnyButtonToJoinExample_Assigner : MonoBehaviour -{ - private void Update() - { - if (ReInput.isReady) - { - AssignJoysticksToPlayers(); - } - } - - private void AssignJoysticksToPlayers() - { - IList joysticks = ReInput.controllers.Joysticks; - for (int i = 0; i < joysticks.Count; i++) - { - Joystick joystick = joysticks[i]; - if (!ReInput.controllers.IsControllerAssigned(joystick.type, joystick.id) && joystick.GetAnyButtonDown()) - { - Player player = FindPlayerWithoutJoystick(); - if (player == null) - { - return; - } - player.controllers.AddController(joystick, removeFromOtherPlayers: false); - } - } - if (DoAllPlayersHaveJoysticks()) - { - ReInput.configuration.autoAssignJoysticks = true; - base.enabled = false; - } - } - - private Player FindPlayerWithoutJoystick() - { - IList players = ReInput.players.Players; - for (int i = 0; i < players.Count; i++) - { - if (players[i].controllers.joystickCount <= 0) - { - return players[i]; - } - } - return null; - } - - private bool DoAllPlayersHaveJoysticks() - { - return FindPlayerWithoutJoystick() == null; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_GamePlayer.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_GamePlayer.cs deleted file mode 100644 index a0466ce..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/PressAnyButtonToJoinExample_GamePlayer.cs +++ /dev/null @@ -1,67 +0,0 @@ -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -[RequireComponent(typeof(CharacterController))] -public class PressAnyButtonToJoinExample_GamePlayer : MonoBehaviour -{ - public int playerId; - - public float moveSpeed = 3f; - - public float bulletSpeed = 15f; - - public GameObject bulletPrefab; - - private CharacterController cc; - - private Vector3 moveVector; - - private bool fire; - - private Player player - { - get - { - if (!ReInput.isReady) - { - return null; - } - return ReInput.players.GetPlayer(playerId); - } - } - - private void OnEnable() - { - cc = GetComponent(); - } - - private void Update() - { - if (ReInput.isReady && player != null) - { - GetInput(); - ProcessInput(); - } - } - - private void GetInput() - { - moveVector.x = player.GetAxis("Move Horizontal"); - moveVector.y = player.GetAxis("Move Vertical"); - fire = player.GetButtonDown("Fire"); - } - - private void ProcessInput() - { - if (moveVector.x != 0f || moveVector.y != 0f) - { - cc.Move(moveVector * moveSpeed * Time.deltaTime); - } - if (fire) - { - Object.Instantiate(bulletPrefab, base.transform.position + base.transform.right, base.transform.rotation).GetComponent().AddForce(base.transform.right * bulletSpeed, ForceMode.VelocityChange); - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_Assigner.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_Assigner.cs deleted file mode 100644 index 6b23589..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_Assigner.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class PressStartToJoinExample_Assigner : MonoBehaviour -{ - private class PlayerMap - { - public int rewiredPlayerId; - - public int gamePlayerId; - - public PlayerMap(int rewiredPlayerId, int gamePlayerId) - { - this.rewiredPlayerId = rewiredPlayerId; - this.gamePlayerId = gamePlayerId; - } - } - - private static PressStartToJoinExample_Assigner instance; - - public int maxPlayers = 4; - - private List playerMap; - - private int gamePlayerIdCounter; - - public static Player GetRewiredPlayer(int gamePlayerId) - { - if (!ReInput.isReady) - { - return null; - } - if (instance == null) - { - Debug.LogError("Not initialized. Do you have a PressStartToJoinPlayerSelector in your scehe?"); - return null; - } - for (int i = 0; i < instance.playerMap.Count; i++) - { - if (instance.playerMap[i].gamePlayerId == gamePlayerId) - { - return ReInput.players.GetPlayer(instance.playerMap[i].rewiredPlayerId); - } - } - return null; - } - - private void Awake() - { - playerMap = new List(); - instance = this; - } - - private void Update() - { - for (int i = 0; i < ReInput.players.playerCount; i++) - { - if (ReInput.players.GetPlayer(i).GetButtonDown("JoinGame")) - { - AssignNextPlayer(i); - } - } - } - - private void AssignNextPlayer(int rewiredPlayerId) - { - if (playerMap.Count >= maxPlayers) - { - Debug.LogError("Max player limit already reached!"); - return; - } - int nextGamePlayerId = GetNextGamePlayerId(); - playerMap.Add(new PlayerMap(rewiredPlayerId, nextGamePlayerId)); - Player player = ReInput.players.GetPlayer(rewiredPlayerId); - player.controllers.maps.SetMapsEnabled(state: false, "Assignment"); - player.controllers.maps.SetMapsEnabled(state: true, "Default"); - Debug.Log("Added Rewired Player id " + rewiredPlayerId + " to game player " + nextGamePlayerId); - } - - private int GetNextGamePlayerId() - { - return gamePlayerIdCounter++; - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_GamePlayer.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_GamePlayer.cs deleted file mode 100644 index 04ee6c4..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/PressStartToJoinExample_GamePlayer.cs +++ /dev/null @@ -1,57 +0,0 @@ -using UnityEngine; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -[RequireComponent(typeof(CharacterController))] -public class PressStartToJoinExample_GamePlayer : MonoBehaviour -{ - public int gamePlayerId; - - public float moveSpeed = 3f; - - public float bulletSpeed = 15f; - - public GameObject bulletPrefab; - - private CharacterController cc; - - private Vector3 moveVector; - - private bool fire; - - private Player player => PressStartToJoinExample_Assigner.GetRewiredPlayer(gamePlayerId); - - private void OnEnable() - { - cc = GetComponent(); - } - - private void Update() - { - if (ReInput.isReady && player != null) - { - GetInput(); - ProcessInput(); - } - } - - private void GetInput() - { - moveVector.x = player.GetAxis("Move Horizontal"); - moveVector.y = player.GetAxis("Move Vertical"); - fire = player.GetButtonDown("Fire"); - } - - private void ProcessInput() - { - if (moveVector.x != 0f || moveVector.y != 0f) - { - cc.Move(moveVector * moveSpeed * Time.deltaTime); - } - if (fire) - { - Object.Instantiate(bulletPrefab, base.transform.position + base.transform.right, base.transform.rotation).GetComponent().AddForce(base.transform.right * bulletSpeed, ForceMode.VelocityChange); - } - } -} diff --git a/Thronefall_1_57/Thronefall/Rewired.Demos/SimpleCombinedKeyboardMouseRemapping.cs b/Thronefall_1_57/Thronefall/Rewired.Demos/SimpleCombinedKeyboardMouseRemapping.cs deleted file mode 100644 index 3a2544b..0000000 --- a/Thronefall_1_57/Thronefall/Rewired.Demos/SimpleCombinedKeyboardMouseRemapping.cs +++ /dev/null @@ -1,225 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -public class SimpleCombinedKeyboardMouseRemapping : MonoBehaviour -{ - private class Row - { - public InputAction action; - - public AxisRange actionRange; - - public Button button; - - public Text text; - } - - private struct TargetMapping - { - public ControllerMap controllerMap; - - public int actionElementMapId; - } - - private const string category = "Default"; - - private const string layout = "Default"; - - private const string uiCategory = "UI"; - - private InputMapper inputMapper_keyboard = new InputMapper(); - - private InputMapper inputMapper_mouse = new InputMapper(); - - public GameObject buttonPrefab; - - public GameObject textPrefab; - - public RectTransform fieldGroupTransform; - - public RectTransform actionGroupTransform; - - public Text controllerNameUIText; - - public Text statusUIText; - - private List rows = new List(); - - private TargetMapping _replaceTargetMapping; - - private Player player => ReInput.players.GetPlayer(0); - - private void OnEnable() - { - if (ReInput.isReady) - { - inputMapper_keyboard.options.timeout = 5f; - inputMapper_mouse.options.timeout = 5f; - inputMapper_mouse.options.ignoreMouseXAxis = true; - inputMapper_mouse.options.ignoreMouseYAxis = true; - inputMapper_keyboard.options.allowButtonsOnFullAxisAssignment = false; - inputMapper_mouse.options.allowButtonsOnFullAxisAssignment = false; - inputMapper_keyboard.InputMappedEvent += OnInputMapped; - inputMapper_keyboard.StoppedEvent += OnStopped; - inputMapper_mouse.InputMappedEvent += OnInputMapped; - inputMapper_mouse.StoppedEvent += OnStopped; - InitializeUI(); - } - } - - private void OnDisable() - { - inputMapper_keyboard.Stop(); - inputMapper_mouse.Stop(); - inputMapper_keyboard.RemoveAllEventListeners(); - inputMapper_mouse.RemoveAllEventListeners(); - } - - private void RedrawUI() - { - controllerNameUIText.text = "Keyboard/Mouse"; - for (int i = 0; i < rows.Count; i++) - { - Row row = rows[i]; - InputAction action = rows[i].action; - string text = string.Empty; - int actionElementMapId = -1; - for (int j = 0; j < 2; j++) - { - ControllerType controllerType = ((j != 0) ? ControllerType.Mouse : ControllerType.Keyboard); - foreach (ActionElementMap item in player.controllers.maps.GetMap(controllerType, 0, "Default", "Default").ElementMapsWithAction(action.id)) - { - if (item.ShowInField(row.actionRange)) - { - text = item.elementIdentifierName; - actionElementMapId = item.id; - break; - } - } - if (actionElementMapId >= 0) - { - break; - } - } - row.text.text = text; - row.button.onClick.RemoveAllListeners(); - int index = i; - row.button.onClick.AddListener(delegate - { - OnInputFieldClicked(index, actionElementMapId); - }); - } - } - - private void ClearUI() - { - controllerNameUIText.text = string.Empty; - for (int i = 0; i < rows.Count; i++) - { - rows[i].text.text = string.Empty; - } - } - - private void InitializeUI() - { - foreach (Transform item in actionGroupTransform) - { - Object.Destroy(item.gameObject); - } - foreach (Transform item2 in fieldGroupTransform) - { - Object.Destroy(item2.gameObject); - } - foreach (InputAction item3 in ReInput.mapping.ActionsInCategory("Default")) - { - if (item3.type == InputActionType.Axis) - { - CreateUIRow(item3, AxisRange.Full, item3.descriptiveName); - CreateUIRow(item3, AxisRange.Positive, (!string.IsNullOrEmpty(item3.positiveDescriptiveName)) ? item3.positiveDescriptiveName : (item3.descriptiveName + " +")); - CreateUIRow(item3, AxisRange.Negative, (!string.IsNullOrEmpty(item3.negativeDescriptiveName)) ? item3.negativeDescriptiveName : (item3.descriptiveName + " -")); - } - else if (item3.type == InputActionType.Button) - { - CreateUIRow(item3, AxisRange.Positive, item3.descriptiveName); - } - } - RedrawUI(); - } - - private void CreateUIRow(InputAction action, AxisRange actionRange, string label) - { - GameObject obj = Object.Instantiate(textPrefab); - obj.transform.SetParent(actionGroupTransform); - obj.transform.SetAsLastSibling(); - obj.GetComponent().text = label; - GameObject gameObject = Object.Instantiate(buttonPrefab); - gameObject.transform.SetParent(fieldGroupTransform); - gameObject.transform.SetAsLastSibling(); - rows.Add(new Row - { - action = action, - actionRange = actionRange, - button = gameObject.GetComponent