Decompiled source of TSTerrainGenerator v1.0.0
plugins/TSTerrainGenerator.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Bounce.Mathematics; using Bounce.Singletons; using DataModel; using HarmonyLib; using Newtonsoft.Json; using Runtime.Scripts; using TMPro; using TSTerrainGenerator.Core; using TSTerrainGenerator.TaleSpire; using TSTerrainGenerator.UI; using TaleSpire.Ui; using Unity.Collections; using Unity.Mathematics; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.TextCore.LowLevel; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TSTerrainGenerator")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+aeb9f6e955584a8fe535b73b564fecfb4c398f25")] [assembly: AssemblyProduct("TSTerrainGenerator")] [assembly: AssemblyTitle("TSTerrainGenerator")] [assembly: AssemblyVersion("1.0.0.0")] namespace TSTerrainGenerator { [BepInPlugin("com.g4ndja.talespire.terraingenerator", "TSTerrainGenerator", "1.0.0")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.g4ndja.talespire.terraingenerator"; public const string PluginName = "TSTerrainGenerator"; public const string PluginVersion = "1.0.0"; public const string StorageFolderName = "TSTerrainGenerator"; private static readonly ConcurrentQueue<Action> MainThreadQueue = new ConcurrentQueue<Action>(); private ConfigEntry<UiLanguage> _uiLanguage; private ConfigEntry<KeyCode> _toggleHotkey; private ConfigEntry<DockSide> _dockSide; private string _settingsFilePath; private TerrainGenSettings _settings; private TerrainPaintOverlay _paintOverlay; private Sprite _tabIcon; private FloatingWindowHost _windowHost; private float _nextMountCheckTime; public static Plugin Instance { get; private set; } internal static ManualLogSource LogSource { get; private set; } public static void EnqueueMainThread(Action action) { if (action != null) { MainThreadQueue.Enqueue(action); } } private void Awake() { //IL_01fc: Unknown result type (might be due to invalid IL or missing references) Instance = this; LogSource = ((BaseUnityPlugin)this).Logger; InjectionFlagHelper.Initialize((BaseUnityPlugin)(object)this, ((BaseUnityPlugin)this).Logger); _uiLanguage = ((BaseUnityPlugin)this).Config.Bind<UiLanguage>("General", "Language", UiLanguage.English, "In-game UI language (English by default, or Russian). Can also be switched anytime in the mod header."); _toggleHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleHotkey", (KeyCode)277, "Hotkey to open or close the procedural terrain generator window."); _dockSide = ((BaseUnityPlugin)this).Config.Bind<DockSide>("Interface", "DockSide", DockSide.Right, "Side of TaleSpire's built-in border dock (Right or Left) for the generator icon."); Loc.Current = _uiLanguage.Value; string text = Path.Combine(Paths.ConfigPath, "TSTerrainGenerator"); Directory.CreateDirectory(text); _settingsFilePath = Path.Combine(text, "terrain_settings.json"); _settings = LoadOrCreateSettings(); _settings.Language = _uiLanguage.Value; _paintOverlay = new TerrainPaintOverlay(_settings.GridWidth2x2, _settings.GridDepth2x2); _tabIcon = FloatingWindowHost.CreateTerrainDockIconSprite(); _windowHost = new FloatingWindowHost(_settings, _paintOverlay, _tabIcon, ((BaseUnityPlugin)this).Logger, () => _dockSide.Value, SaveSettings, ToggleUiLanguage); _dockSide.SettingChanged += delegate { EnqueueMainThread(delegate { _windowHost.EnsureMounted(); }); }; _uiLanguage.SettingChanged += delegate { EnqueueMainThread(delegate { Loc.Current = _uiLanguage.Value; if (_settings != null) { _settings.Language = _uiLanguage.Value; } _windowHost?.RefreshLanguage(); }); }; GUIManager.OnGUIManagerInitalized += OnGuiManagerInitialized; SceneManager.sceneLoaded += OnSceneLoaded; if (SingletonBehaviour<GUIManager>.HasInstance && SingletonBehaviour<GUIManager>.Instance.HasInitalized) { _windowHost.EnsureMounted(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} v{1} loaded. Language={2}, Hotkey={3}, Dock={4}.", "TSTerrainGenerator", "1.0.0", _uiLanguage.Value, _toggleHotkey.Value, _dockSide.Value)); } private void OnDestroy() { GUIManager.OnGUIManagerInitalized -= OnGuiManagerInitialized; SceneManager.sceneLoaded -= OnSceneLoaded; _windowHost?.Shutdown(); InjectionFlagHelper.Shutdown(); } private void OnGuiManagerInitialized() { EnqueueMainThread(delegate { _windowHost.EnsureMounted(); }); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { _nextMountCheckTime = Time.unscaledTime + 0.25f; } private void Update() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Action result; while (MainThreadQueue.TryDequeue(out result)) { try { result?.Invoke(); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Main-thread callback failed: {arg}"); } } TaleSpireTerrainBridge.Tick(((BaseUnityPlugin)this).Logger); if (Time.unscaledTime >= _nextMountCheckTime) { _nextMountCheckTime = Time.unscaledTime + 1f; if (!_windowHost.IsMounted && SingletonBehaviour<GUIManager>.HasInstance && SingletonBehaviour<GUIManager>.Instance.HasInitalized) { _windowHost.EnsureMounted(); } } bool flag = IsAnyInputFieldFocused(); bool flag2 = IsModifierHeld(); if (!flag && !flag2 && (int)_toggleHotkey.Value != 0 && Input.GetKeyDown(_toggleHotkey.Value)) { _windowHost.Toggle(); } if (Input.GetKeyDown((KeyCode)27) && _windowHost != null && !flag) { _windowHost.HandleEscape(); } } private TerrainGenSettings LoadOrCreateSettings() { try { if (File.Exists(_settingsFilePath)) { TerrainGenSettings terrainGenSettings = JsonConvert.DeserializeObject<TerrainGenSettings>(File.ReadAllText(_settingsFilePath)); if (terrainGenSettings != null) { terrainGenSettings.ClampAndValidate(); return terrainGenSettings; } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to load terrain settings from '" + _settingsFilePath + "': " + ex.Message)); } TerrainGenSettings terrainGenSettings2 = new TerrainGenSettings(); terrainGenSettings2.ClampAndValidate(); return terrainGenSettings2; } private void ToggleUiLanguage() { UiLanguage uiLanguage = (Loc.Current = ((Loc.Current == UiLanguage.English) ? UiLanguage.Russian : UiLanguage.English)); if (_settings != null) { _settings.Language = uiLanguage; } if (_uiLanguage != null && _uiLanguage.Value != uiLanguage) { _uiLanguage.Value = uiLanguage; } else { _windowHost?.RefreshLanguage(); } SaveSettings(); } private void SaveSettings() { try { _settings.ClampAndValidate(); string contents = JsonConvert.SerializeObject((object)_settings, (Formatting)1); File.WriteAllText(_settingsFilePath, contents); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to save terrain settings: " + ex.Message)); } } private static bool IsModifierHeld() { if (!Input.GetKey((KeyCode)306) && !Input.GetKey((KeyCode)305) && !Input.GetKey((KeyCode)308) && !Input.GetKey((KeyCode)307) && !Input.GetKey((KeyCode)310)) { return Input.GetKey((KeyCode)309); } return true; } private static bool IsAnyInputFieldFocused() { if (InputFieldManager.IsInputFieldActive()) { return true; } try { EventSystem current = EventSystem.current; GameObject val = ((current != null) ? current.currentSelectedGameObject : null); if ((Object)(object)val != (Object)null && ((Object)(object)val.GetComponent<TMP_InputField>() != (Object)null || (Object)(object)val.GetComponent<InputField>() != (Object)null)) { return true; } } catch { } return false; } } } namespace TSTerrainGenerator.UI { public sealed class ExpandedMapModalView : MonoBehaviour { public static readonly Vector2 DefaultWindowSize = new Vector2(960f, 760f); public static readonly Vector2 MinWindowSize = new Vector2(700f, 540f); public static readonly Vector2 MaxWindowSize = new Vector2(1500f, 980f); private TerrainGenSettings _settings; private TerrainPaintOverlay _paintOverlay; private ManualLogSource _logger; private Action _onCloseRequested; private Action _onPaintOverlayMutated; private Action<PreviewRenderMode> _onPreviewModeChanged; private Action _onGenerateOnBoardRequested; private Action _onSettingsMutated; private Action _onToggleLanguage; private TerrainGenerationResult _currentResult; private Texture2D _sharedTexture; private Texture2D _ownedPreviewTexture; private ScrollRect _paletteScroll; private bool _uiBuilt; private bool _suppressCallbacks; private bool _rebuildDirty; private float _nextRebuildTime; private PaintToolMode _activeTool; private PreviewRenderMode _previewMode; private BiomeId _selectedPaintBiome; private WaterBrushType _activeWaterType = WaterBrushType.River; private short _lakeTargetStep = short.MinValue; private PropCategory _selectedPropCategory; private float _brushRadiusCells = 3f; private float _brushStrength01 = 0.6f; private float _flattenTargetNorm01 = 0.5f; private bool _flattenAutoPickOnClick = true; private TextMeshProUGUI _zoomPercentLabel; private StyledButton _prevModeReliefBtn; private StyledButton _prevModeHeightBtn; private StyledButton _prevModeBiomeBtn; private StyledButton _showPropsPreviewBtn; private StyledButton _undoBtn; private StyledButton _redoBtn; private readonly Dictionary<PaintToolMode, StyledButton> _toolButtons = new Dictionary<PaintToolMode, StyledButton>(); private readonly Dictionary<PaintToolMode, Image> _toolAccentStrips = new Dictionary<PaintToolMode, Image>(); private GameObject _roadStyleCard; private readonly Dictionary<RoadType, StyledButton> _roadTypeButtons = new Dictionary<RoadType, StyledButton>(); private readonly Dictionary<RoadMaterial, StyledButton> _roadMaterialButtons = new Dictionary<RoadMaterial, StyledButton>(); private TextMeshProUGUI _roadMaterialDescLabel; private GameObject _waterTypeCard; private readonly Dictionary<WaterBrushType, StyledButton> _waterTypeButtons = new Dictionary<WaterBrushType, StyledButton>(); private LabeledSliderControl _editorShoreBlendSlider; private StyledButton _editorShoreTilesToggleBtn; private GameObject _biomePickerCard; private readonly Dictionary<BiomeId, StyledButton> _biomeSwatchButtons = new Dictionary<BiomeId, StyledButton>(); private TextMeshProUGUI _selectedBiomeLabel; private GameObject _propPickerCard; private readonly Dictionary<PropCategory, StyledButton> _propCategoryButtons = new Dictionary<PropCategory, StyledButton>(); private TextMeshProUGUI _propLimitReadoutLabel; private LabeledSliderControl _radiusSlider; private LabeledSliderControl _strengthSlider; private GameObject _flattenOptionsGroup; private LabeledSliderControl _flattenTargetSlider; private StyledButton _flattenAutoPickBtn; private TextMeshProUGUI _editsSummaryLabel; private StyledButton _clearHeightsBtn; private StyledButton _clearBiomesBtn; private StyledButton _clearWaterBtn; private StyledButton _clearRoadsBtn; private StyledButton _clearPropsBtn; private StyledButton _clearAllBtn; private StyledButton _generateOnBoardBtn; private TextMeshProUGUI _buildStatusLabel; private InteractiveMapCanvas _mapCanvas; private TextMeshProUGUI _cursorInfoLabel; public PaintToolMode ActiveTool => _activeTool; public PreviewRenderMode PreviewMode => _previewMode; public WaterBrushType ActiveWaterType => _activeWaterType; public PropCategory SelectedPropCategory => _selectedPropCategory; public InteractiveMapCanvas MapCanvas => _mapCanvas; public void Initialize(TerrainGenSettings settings, TerrainPaintOverlay paintOverlay, ManualLogSource logger, Action onCloseRequested, Action onPaintOverlayMutated, Action<PreviewRenderMode> onPreviewModeChanged = null, Action onGenerateOnBoardRequested = null, Action onSettingsMutated = null, Action onToggleLanguage = null) { _settings = settings ?? new TerrainGenSettings(); _paintOverlay = paintOverlay ?? new TerrainPaintOverlay(_settings.GridWidth2x2, _settings.GridDepth2x2); _logger = logger; _onCloseRequested = onCloseRequested; _onPaintOverlayMutated = onPaintOverlayMutated; _onPreviewModeChanged = onPreviewModeChanged; _onGenerateOnBoardRequested = onGenerateOnBoardRequested; _onSettingsMutated = onSettingsMutated; _onToggleLanguage = onToggleLanguage; if (!_uiBuilt) { BuildUi(); } SyncAllControls(); } public void RebuildForLanguageChange() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (!_uiBuilt) { return; } RectTransform component = ((Component)this).GetComponent<RectTransform>(); if (!((Object)(object)component == (Object)null)) { float zoom = (((Object)(object)_mapCanvas != (Object)null) ? _mapCanvas.Zoom : 1f); Vector2 panOffset = (((Object)(object)_mapCanvas != (Object)null) ? _mapCanvas.PanOffset : Vector2.zero); float verticalNormalizedPosition = (((Object)(object)_paletteScroll != (Object)null) ? _paletteScroll.verticalNormalizedPosition : 1f); if ((Object)(object)_mapCanvas != (Object)null) { _mapCanvas.OnStrokeBegin -= HandleStrokeBegin; _mapCanvas.OnStrokeSegment -= HandleStrokeSegment; _mapCanvas.OnStrokeEnd -= HandleStrokeEnd; _mapCanvas.OnHoverCellChanged -= HandleHoverCellChanged; _mapCanvas.OnZoomChanged -= HandleZoomChanged; _mapCanvas = null; } _toolButtons.Clear(); _toolAccentStrips.Clear(); _roadTypeButtons.Clear(); _roadMaterialButtons.Clear(); _waterTypeButtons.Clear(); _biomeSwatchButtons.Clear(); _propCategoryButtons.Clear(); for (int num = ((Transform)component).childCount - 1; num >= 0; num--) { Transform child = ((Transform)component).GetChild(num); child.SetParent((Transform)null, false); Object.Destroy((Object)(object)((Component)child).gameObject); } BuildUi(); if (_currentResult != null && (Object)(object)_mapCanvas != (Object)null) { Texture2D tex = _sharedTexture ?? RenderOwnedPreviewTexture(_currentResult, _previewMode); _mapCanvas.SetTexture(tex, _currentResult.Width2x2, _currentResult.Depth2x2); _mapCanvas.RestoreViewState(zoom, panOffset); } SyncAllControls(); SyncSettingsUI(); UpdateCursorInfoBar(-1, -1, isInside: false); UpdateBoardStatusIfIdle(); LayoutRebuilder.ForceRebuildLayoutImmediate(component); if ((Object)(object)_paletteScroll != (Object)null) { _paletteScroll.verticalNormalizedPosition = verticalNormalizedPosition; } } } public void SyncSettingsUI() { if (!_uiBuilt || _settings == null) { return; } bool suppressCallbacks = _suppressCallbacks; _suppressCallbacks = true; try { SyncRoadStyleVisuals(); SyncWaterSettingsVisuals(); SyncShowPropsToggleVisual(); SyncPropLimitReadout(); RefreshFlattenTargetLabel(); } finally { _suppressCallbacks = suppressCallbacks; } } public void OnModalOpened(TerrainGenerationResult currentResult, Texture2D sharedTexture = null, PreviewRenderMode? previewMode = null, PaintToolMode? initialTool = null) { if (!_uiBuilt) { BuildUi(); } ((Component)this).transform.SetAsLastSibling(); if (initialTool.HasValue) { SetActiveTool(initialTool.Value); } SyncSettingsUI(); RefreshFromTerrain(currentResult, sharedTexture, previewMode); UpdateBoardStatusIfIdle(); } public void RefreshFromTerrain(TerrainGenerationResult result, Texture2D sharedTexture = null, PreviewRenderMode? previewMode = null) { if (!_uiBuilt) { BuildUi(); } _currentResult = result; _sharedTexture = sharedTexture; if (previewMode.HasValue) { _previewMode = previewMode.Value; UpdatePreviewModeHighlights(); } if (_currentResult != null && (Object)(object)_mapCanvas != (Object)null) { Texture2D tex = _sharedTexture ?? RenderOwnedPreviewTexture(_currentResult, _previewMode); _mapCanvas.SetTexture(tex, _currentResult.Width2x2, _currentResult.Depth2x2); } SyncOverlayButtonsAndSummary(); SyncSettingsUI(); UpdateCursorInfoBar(((Object)(object)_mapCanvas != (Object)null && _mapCanvas.IsPointerInside) ? _mapCanvas.HoverGridX : (-1), ((Object)(object)_mapCanvas != (Object)null && _mapCanvas.IsPointerInside) ? _mapCanvas.HoverGridZ : (-1), (Object)(object)_mapCanvas != (Object)null && _mapCanvas.IsPointerInside && _mapCanvas.HoverGridX >= 0); } public void SetActiveTool(PaintToolMode tool) { _activeTool = tool; SyncToolSelectionVisuals(); } public void SetPreviewMode(PreviewRenderMode mode, bool notifyCallback = true) { _previewMode = mode; UpdatePreviewModeHighlights(); if (notifyCallback && _onPreviewModeChanged != null) { _onPreviewModeChanged(mode); } else if (_currentResult != null && (Object)(object)_sharedTexture == (Object)null && (Object)(object)_mapCanvas != (Object)null) { Texture2D tex = RenderOwnedPreviewTexture(_currentResult, _previewMode); _mapCanvas.SetTexture(tex, _currentResult.Width2x2, _currentResult.Depth2x2); } } public void SetStatus(string text, Color color) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_buildStatusLabel == (Object)null)) { ((TMP_Text)_buildStatusLabel).text = text ?? string.Empty; ((Graphic)_buildStatusLabel).color = color; } } private void OnDisable() { if (_rebuildDirty) { _rebuildDirty = false; TriggerOverlayRebuildNow(); } } private void OnDestroy() { if ((Object)(object)_mapCanvas != (Object)null) { _mapCanvas.OnStrokeBegin -= HandleStrokeBegin; _mapCanvas.OnStrokeSegment -= HandleStrokeSegment; _mapCanvas.OnStrokeEnd -= HandleStrokeEnd; _mapCanvas.OnHoverCellChanged -= HandleHoverCellChanged; _mapCanvas.OnZoomChanged -= HandleZoomChanged; } if ((Object)(object)_ownedPreviewTexture != (Object)null) { Object.Destroy((Object)(object)_ownedPreviewTexture); _ownedPreviewTexture = null; } } private void Update() { if (_rebuildDirty && Time.unscaledTime >= _nextRebuildTime) { _rebuildDirty = false; TriggerOverlayRebuildNow(); } HandleEditorHotkeys(); } private void HandleEditorHotkeys() { if (!((Component)this).gameObject.activeInHierarchy || IsAnyInputFocused()) { return; } bool flag = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305); bool flag2 = Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); if (flag && Input.GetKeyDown((KeyCode)122)) { if (flag2) { HandleRedoClicked(); } else { HandleUndoClicked(); } } else if (flag && Input.GetKeyDown((KeyCode)121)) { HandleRedoClicked(); } else if (!flag) { float num = ((_brushRadiusCells < 3f) ? 0.5f : 1f); if (Input.GetKeyDown((KeyCode)91)) { SetBrushRadius(_brushRadiusCells - ((_brushRadiusCells <= 3f) ? 0.5f : 1f)); } else if (Input.GetKeyDown((KeyCode)93)) { SetBrushRadius(_brushRadiusCells + num); } } } private void SetBrushRadius(float radiusCells) { float num = Mathf.Clamp(Mathf.Round(radiusCells * 2f) * 0.5f, 1f, 16f); if (!(Mathf.Abs(num - _brushRadiusCells) < 0.01f)) { _brushRadiusCells = num; if (_radiusSlider != null) { bool suppressCallbacks = _suppressCallbacks; _suppressCallbacks = true; _radiusSlider.Slider.SetValueWithoutNotify(_brushRadiusCells); ((TMP_Text)_radiusSlider.ValueLabel).text = FormatRadiusLabel(_brushRadiusCells); _suppressCallbacks = suppressCallbacks; } UpdateCanvasBrushPreview(); } } private void BuildUi() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown _uiBuilt = true; RectTransform component = ((Component)this).GetComponent<RectTransform>(); UiFactory.AddBackground(((Component)this).gameObject, UiTheme.WindowBg); UiFactory.AddBorder(((Component)this).gameObject, UiTheme.BorderGold, 1.5f); UiFactory.AddVerticalLayout(((Component)this).gameObject, 5f, new RectOffset(6, 6, 6, 6), (TextAnchor)0); BuildTopToolbar(component); BuildWorkspaceBody(component); BuildResizeCorner(component); } private void BuildTopToolbar(RectTransform parent) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateRect("EditorTopToolbar", (Transform)(object)parent); UiFactory.AddBackground(((Component)val).gameObject, UiTheme.TitleBarBg); UiFactory.AddBorder(((Component)val).gameObject, UiTheme.BorderSubtle); UiFactory.FixHeight(((Component)val).gameObject, 32f); UiFactory.AddHorizontalLayout(((Component)val).gameObject, 3f, new RectOffset(8, 6, 3, 3), (TextAnchor)3); ((Component)val).gameObject.AddComponent<WindowDragHandle>().TargetWindow = ((Component)this).GetComponent<RectTransform>(); UiFactory.SetLayout(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("TERRAIN MAP EDITOR — ZOOM & BRUSHES", "КАРТА-РЕДАКТОР ЛАНДШАФТА — УВЕЛИЧЕНИЕ И КИСТИ"), 11.5f, UiTheme.TextPrimary, bold: true, (TextAlignmentOptions)4097, wrap: false, "EditorWindowTitle")).gameObject, 80f, -1f, 1f, 24f, 24f, 0f); UiFactory.FixSize(UiFactory.CreateButton((Transform)(object)val, "−", UiTheme.BtnDefault, UiTheme.TextPrimary, 13f, delegate { _mapCanvas?.ZoomOut(); }, bold: true, (TextAlignmentOptions)514, "ZoomOutBtn").GameObject, 22f, 24f); _zoomPercentLabel = UiFactory.CreateLabel((Transform)(object)val, "100%", 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)514, wrap: false, "ZoomPercentLabel"); UiFactory.FixSize(((Component)_zoomPercentLabel).gameObject, 38f, 24f); UiFactory.FixSize(UiFactory.CreateButton((Transform)(object)val, "+", UiTheme.BtnDefault, UiTheme.TextPrimary, 13f, delegate { _mapCanvas?.ZoomIn(); }, bold: true, (TextAlignmentOptions)514, "ZoomInBtn").GameObject, 22f, 24f); UiFactory.FixSize(UiFactory.CreateButton((Transform)(object)val, Loc.Tr("Reset View", "Сброс вида"), UiTheme.BtnSubtle, UiTheme.TextSecondary, 9.5f, delegate { _mapCanvas?.ResetView(); }, bold: false, (TextAlignmentOptions)514, "ResetViewBtn").GameObject, 68f, 24f); CreateToolbarSeparator((Transform)(object)val); _prevModeReliefBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("Relief + Biomes", "Рельеф + Биомы"), UiTheme.BtnActiveTab, UiTheme.Gold, 9.5f, delegate { SetPreviewMode(PreviewRenderMode.BiomeAndRelief); }, bold: true, (TextAlignmentOptions)514, "ModeReliefBtn"); UiFactory.FixSize(_prevModeReliefBtn.GameObject, 96f, 24f); _prevModeHeightBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("Height", "Высоты"), UiTheme.BtnSubtle, UiTheme.TextSecondary, 9.5f, delegate { SetPreviewMode(PreviewRenderMode.Heightmap); }, bold: false, (TextAlignmentOptions)514, "ModeHeightBtn"); UiFactory.FixSize(_prevModeHeightBtn.GameObject, 48f, 24f); _prevModeBiomeBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("Biomes", "Биомы"), UiTheme.BtnSubtle, UiTheme.TextSecondary, 9.5f, delegate { SetPreviewMode(PreviewRenderMode.BiomeMask); }, bold: false, (TextAlignmentOptions)514, "ModeBiomeBtn"); UiFactory.FixSize(_prevModeBiomeBtn.GameObject, 48f, 24f); _showPropsPreviewBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("[✓] Props", "[✓] Детали"), UiTheme.BtnActiveTab, UiTheme.Gold, 9.5f, delegate { if (!_suppressCallbacks && _settings != null) { _settings.ShowPropsOnPreview = !_settings.ShowPropsOnPreview; SyncShowPropsToggleVisual(); NotifySettingsMutated(); } }, bold: true, (TextAlignmentOptions)514, "TogglePropsPreviewBtn"); UiFactory.FixSize(_showPropsPreviewBtn.GameObject, 72f, 24f); CreateToolbarSeparator((Transform)(object)val); _undoBtn = UiFactory.CreateButton((Transform)(object)val, "↩", UiTheme.BtnDefault, UiTheme.TextPrimary, 12.5f, HandleUndoClicked, bold: true, (TextAlignmentOptions)514, "PaintUndoBtn"); UiFactory.FixSize(_undoBtn.GameObject, 24f, 24f); _redoBtn = UiFactory.CreateButton((Transform)(object)val, "↪", UiTheme.BtnDefault, UiTheme.TextPrimary, 12.5f, HandleRedoClicked, bold: true, (TextAlignmentOptions)514, "PaintRedoBtn"); UiFactory.FixSize(_redoBtn.GameObject, 24f, 24f); CreateToolbarSeparator((Transform)(object)val); string text = (Loc.IsEn ? "\ud83c\udf10 <b><color=#F0C362>EN</color></b> <color=#8A95AA>| RU</color>" : "\ud83c\udf10 <color=#8A95AA>EN |</color> <b><color=#F0C362>RU</color></b>"); StyledButton styledButton = UiFactory.CreateButton((Transform)(object)val, text, UiTheme.BtnActiveTab, UiTheme.TextPrimary, 10f, HandleLanguageToggleClicked, bold: false, (TextAlignmentOptions)514, "EditorLangSwitchBtn"); UiFactory.AddBorder(styledButton.GameObject, UiTheme.BorderGold); UiFactory.FixSize(styledButton.GameObject, 70f, 24f); UiFactory.FixSize(UiFactory.CreateButton((Transform)(object)val, "✕", UiTheme.BtnDanger, UiTheme.TextPrimary, 13f, delegate { _onCloseRequested?.Invoke(); }, bold: true, (TextAlignmentOptions)514, "EditorCloseBtn").GameObject, 26f, 24f); } private void HandleLanguageToggleClicked() { if (_onToggleLanguage != null) { _onToggleLanguage(); return; } Loc.Current = (Loc.IsEn ? UiLanguage.Russian : UiLanguage.English); if (_settings != null) { _settings.Language = Loc.Current; } RebuildForLanguageChange(); } private static void CreateToolbarSeparator(Transform parent) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = UiFactory.CreateRect("ToolbarSep", parent); UiFactory.AddBackground(((Component)obj).gameObject, UiTheme.BorderSubtle, raycastTarget: false); UiFactory.FixSize(((Component)obj).gameObject, 1f, 18f); } private void BuildWorkspaceBody(RectTransform parent) { RectTransform val = UiFactory.CreateRect("WorkspaceBody", (Transform)(object)parent); UiFactory.SetLayout(((Component)val).gameObject, -1f, -1f, 1f, 240f, -1f, 1f); UiFactory.AddHorizontalLayout(((Component)val).gameObject, 6f, null, (TextAnchor)0, expandWidth: false, expandHeight: true); BuildLeftToolPalette(val); BuildRightMapWorkspace(val); } private void BuildLeftToolPalette(RectTransform parent) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown RectTransform val = UiFactory.CreateRect("LeftToolPalette", (Transform)(object)parent); UiFactory.AddBackground(((Component)val).gameObject, UiTheme.SidebarBg, raycastTarget: false); UiFactory.AddBorder(((Component)val).gameObject, UiTheme.BorderSubtle); UiFactory.SetLayout(((Component)val).gameObject, 268f, 268f, 0f, -1f, -1f, 1f); UiFactory.AddVerticalLayout(((Component)val).gameObject, 4f, new RectOffset(3, 3, 3, 3), (TextAnchor)0); RectTransform obj = UiFactory.CreateRect("PaletteScrollHost", (Transform)(object)val); UiFactory.SetLayout(((Component)obj).gameObject, -1f, -1f, 1f, 140f, -1f, 1f); UiFactory.Stretch(((Component)(_paletteScroll = UiFactory.CreateVerticalScrollView((Transform)(object)obj, out var contentRect, "ToolPaletteScroll"))).GetComponent<RectTransform>()); BuildToolsCard(contentRect); BuildRoadStyleSubPanel(contentRect); BuildWaterTypeSubPanel(contentRect); BuildBiomePickerSubPanel(contentRect); BuildPropPickerSubPanel(contentRect); BuildBrushParamsCard(contentRect); BuildClearLayersCard(contentRect); BuildPinnedQuickBuildCard(val); } private void BuildToolsCard(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) RectTransform parent2 = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 3f, new RectOffset(6, 6, 5, 5), "ToolsCard"); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)parent2, Loc.Tr("BRUSH TOOL", "ИНСТРУМЕНТ КИСТИ"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 15f); AddToolToggleButton((Transform)(object)parent2, PaintToolMode.None, Loc.Tr("\ud83d\udc41 Inspect / Pan", "\ud83d\udc41 Просмотр / Навигация"), fullWidth: true); AddToolPairRow((Transform)(object)parent2, PaintToolMode.HeightRaise, Loc.Tr("⬆ Raise", "⬆ Поднять"), PaintToolMode.HeightLower, Loc.Tr("⬇ Lower", "⬇ Опустить"), "ToolRow_Height1"); AddToolPairRow((Transform)(object)parent2, PaintToolMode.HeightFlatten, Loc.Tr("═ Flatten", "═ Выровнять"), PaintToolMode.HeightSmooth, Loc.Tr("〰 Smooth", "〰 Сгладить"), "ToolRow_Height2"); AddToolPairRow((Transform)(object)parent2, PaintToolMode.BiomePaint, Loc.Tr("\ud83c\udf3f Paint Biome", "\ud83c\udf3f Кисть биома"), PaintToolMode.BiomeErase, Loc.Tr("\ud83e\uddf9 Erase Biome", "\ud83e\uddf9 Стереть биом"), "ToolRow_Biome"); AddToolPairRow((Transform)(object)parent2, PaintToolMode.WaterPaint, Loc.Tr("\ud83c\udf0a Paint Water", "\ud83c\udf0a Нарисовать воду"), PaintToolMode.WaterErase, Loc.Tr("✖ Erase Water", "✖ Стереть воду"), "ToolRow_Water"); AddToolPairRow((Transform)(object)parent2, PaintToolMode.RoadPaint, Loc.Tr("\ud83d\udee3 Paint Road", "\ud83d\udee3 Нарисовать дорогу"), PaintToolMode.RoadErase, Loc.Tr("✖ Erase Road", "✖ Стереть дорогу"), "ToolRow_Road"); AddToolPairRow((Transform)(object)parent2, PaintToolMode.PropPaint, Loc.Tr("\ud83c\udf32 Paint Props", "\ud83c\udf32 Кисть деталей"), PaintToolMode.PropErase, Loc.Tr("✖ Erase Props", "✖ Стереть детали"), "ToolRow_Props"); } private void AddToolPairRow(Transform parent, PaintToolMode leftMode, string leftLabel, PaintToolMode rightMode, string rightLabel, string rowName) { RectTransform val = UiFactory.CreateRect(rowName, parent); UiFactory.AddHorizontalLayout(((Component)val).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val).gameObject, 22f); AddToolToggleButton((Transform)(object)val, leftMode, leftLabel, fullWidth: false); AddToolToggleButton((Transform)(object)val, rightMode, rightLabel, fullWidth: false); } private void AddToolToggleButton(Transform parent, PaintToolMode mode, string label, bool fullWidth) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) StyledButton styledButton = UiFactory.CreateButton(parent, label, UiTheme.BtnSubtle, UiTheme.TextPrimary, fullWidth ? 10.5f : 9.5f, delegate { SetActiveTool(mode); }, bold: false, (TextAlignmentOptions)4097, $"ToolBtn_{mode}"); if (fullWidth) { UiFactory.FixHeight(styledButton.GameObject, 22f); } else { UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); } RectTransform obj = UiFactory.CreateRect("AccentStrip", styledButton.GameObject.transform); obj.anchorMin = new Vector2(0f, 0f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(2f, 0f); obj.sizeDelta = new Vector2(3f, -6f); Image value = UiFactory.AddBackground(((Component)obj).gameObject, GetCurrentToolBrushColor(mode), raycastTarget: false); ((TMP_Text)styledButton.Label).rectTransform.offsetMin = new Vector2(8f, 1f); ((TMP_Text)styledButton.Label).rectTransform.offsetMax = new Vector2(-3f, -1f); _toolButtons[mode] = styledButton; _toolAccentStrips[mode] = value; } private void BuildRoadStyleSubPanel(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 4f, new RectOffset(6, 6, 5, 5), "RoadStyleSubPanel"); _roadStyleCard = ((Component)val).gameObject; UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("ROAD TYPE (PRESETS)", "ТИП ДОРОГИ (ПРЕСЕТЫ)"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 14f); RectTransform val2 = UiFactory.CreateRect("RoadTypeRow1", (Transform)(object)val); UiFactory.AddHorizontalLayout(((Component)val2).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val2).gameObject, 22f); AddRoadTypeButton((Transform)(object)val2, RoadType.Trail, Loc.Tr("Trail", "Тропинка"), fullWidth: false); AddRoadTypeButton((Transform)(object)val2, RoadType.CountryRoad, Loc.Tr("Country Road", "Просёлочная"), fullWidth: false); AddRoadTypeButton((Transform)(object)val, RoadType.IntercityHighway, Loc.Tr("King's Highway", "Межгородской тракт"), fullWidth: true); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("MEDIEVAL MATERIAL (2×2)", "СРЕДНЕВЕКОВЫЙ МАТЕРИАЛ (2×2)"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 14f); IReadOnlyList<RoadMaterialDef> allMaterials = RoadCatalog.AllMaterials; RectTransform val3 = null; for (int i = 0; i < allMaterials.Count; i++) { if (i % 2 == 0) { val3 = UiFactory.CreateRect($"EditorRoadMatRow_{i / 2}", (Transform)(object)val); UiFactory.AddHorizontalLayout(((Component)val3).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val3).gameObject, 22f); } RoadMaterialDef roadMaterialDef = allMaterials[i]; RoadMaterial matId = roadMaterialDef.Id; StyledButton styledButton = UiFactory.CreateButton((Transform)(object)val3, roadMaterialDef.NameRu, UiTheme.BtnSubtle, UiTheme.TextPrimary, 9.5f, delegate { if (!_suppressCallbacks && _settings != null) { _settings.RoadMaterial = matId; SyncRoadStyleVisuals(); NotifySettingsMutated(); } }, bold: true, (TextAlignmentOptions)4097, $"EditorRoadMatBtn_{matId}"); UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); RectTransform obj = UiFactory.CreateRect("Swatch", styledButton.GameObject.transform); obj.anchorMin = new Vector2(0f, 0f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(2f, 0f); obj.sizeDelta = new Vector2(4f, -6f); UiFactory.AddBackground(((Component)obj).gameObject, ToUnityColor(roadMaterialDef.PreviewColor), raycastTarget: false); ((TMP_Text)styledButton.Label).rectTransform.offsetMin = new Vector2(9f, 1f); ((TMP_Text)styledButton.Label).rectTransform.offsetMax = new Vector2(-3f, -1f); _roadMaterialButtons[matId] = styledButton; } _roadMaterialDescLabel = UiFactory.CreateLabel((Transform)(object)val, string.Empty, 9.5f, UiTheme.TextSecondary, bold: false, (TextAlignmentOptions)257, wrap: true, "EditorRoadMatDesc"); UiFactory.FixHeight(((Component)_roadMaterialDescLabel).gameObject, 28f); } private void AddRoadTypeButton(Transform parent, RoadType roadType, string label, bool fullWidth) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) StyledButton styledButton = UiFactory.CreateButton(parent, label, UiTheme.BtnSubtle, UiTheme.TextPrimary, 9.5f, delegate { if (!_suppressCallbacks && _settings != null) { _settings.ApplyRoadTypePreset(roadType); SyncRoadStyleVisuals(); NotifySettingsMutated(); } }, bold: true, (TextAlignmentOptions)514, $"EditorRoadTypeBtn_{roadType}"); if (fullWidth) { UiFactory.FixHeight(styledButton.GameObject, 22f); } else { UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); } _roadTypeButtons[roadType] = styledButton; } private void BuildWaterTypeSubPanel(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 4f, new RectOffset(6, 6, 5, 5), "WaterTypeSubPanel"); _waterTypeCard = ((Component)val).gameObject; UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("WATER BODY TYPE", "ТИП ВОДОЁМА"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 14f); RectTransform val2 = UiFactory.CreateRect("WaterTypeRow", (Transform)(object)val); UiFactory.AddHorizontalLayout(((Component)val2).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val2).gameObject, 22f); AddWaterTypeButton((Transform)(object)val2, WaterBrushType.Stream, Loc.Tr("Stream", "Ручей"), 1.5f); AddWaterTypeButton((Transform)(object)val2, WaterBrushType.River, Loc.Tr("River", "Река"), 3f); AddWaterTypeButton((Transform)(object)val2, WaterBrushType.Lake, Loc.Tr("Lake", "Озеро"), 6f); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("Stream & River: carve a valley with sloped banks • Lake: level basin + lily pads", "Ручей и Река: прорезают долину с пологими берегами • Озеро: ровная котловина + кувшинки"), 9.5f, UiTheme.TextSecondary, bold: false, (TextAlignmentOptions)257, wrap: true, "WaterBrushHint")).gameObject, 30f); _editorShoreBlendSlider = UiFactory.CreateLabeledSlider((Transform)(object)val, Loc.Tr("Bank / Beach Width", "Ширина берега / пляжа"), 1f, 14f, (_settings != null) ? ((float)_settings.ShoreBlendCells) : 5f, wholeNumbers: true, delegate(float v) { int num = Mathf.RoundToInt(v); return Loc.Tr($"{num} cells ({num * 2} u.)", $"{num} яч. ({num * 2} ед.)"); }, delegate(float v) { if (!_suppressCallbacks && _settings != null) { _settings.ShoreBlendCells = Mathf.RoundToInt(v); NotifySettingsMutated(); } }, 1f); TightenSliderValueWidth(_editorShoreBlendSlider, 74f, 86f); _editorShoreTilesToggleBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("[✓] Sand / gravel along water", "[✓] Песок / галька у воды"), UiTheme.BtnActiveTab, UiTheme.Gold, 9.5f, delegate { if (!_suppressCallbacks && _settings != null) { _settings.BlendShorelineTiles = !_settings.BlendShorelineTiles; SyncWaterSettingsVisuals(); NotifySettingsMutated(); } }, bold: false, (TextAlignmentOptions)4097, "EditorShoreTilesBtn"); UiFactory.FixHeight(_editorShoreTilesToggleBtn.GameObject, 22f); } private void AddWaterTypeButton(Transform parent, WaterBrushType waterType, string label, float defaultRadius) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) StyledButton styledButton = UiFactory.CreateButton(parent, label, UiTheme.BtnSubtle, UiTheme.TextPrimary, 10f, delegate { _activeWaterType = waterType; SyncWaterTypeVisuals(); UpdateToolAccentStrip(PaintToolMode.WaterPaint); SetBrushRadius(defaultRadius); UpdateCanvasBrushPreview(); }, bold: true, (TextAlignmentOptions)514, $"WaterTypeBtn_{waterType}"); UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); RectTransform obj = UiFactory.CreateRect("WaterSwatch", styledButton.GameObject.transform); obj.anchorMin = new Vector2(0f, 0f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(2f, 0f); obj.sizeDelta = new Vector2(3f, -6f); UiFactory.AddBackground(((Component)obj).gameObject, InteractiveMapCanvas.GetToolBrushColor(PaintToolMode.WaterPaint, _selectedPaintBiome, _selectedPropCategory, waterType), raycastTarget: false); ((TMP_Text)styledButton.Label).rectTransform.offsetMin = new Vector2(7f, 1f); _waterTypeButtons[waterType] = styledButton; } private void BuildBiomePickerSubPanel(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 4f, new RectOffset(6, 6, 5, 5), "BiomeSwatchCard"); _biomePickerCard = ((Component)val).gameObject; UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr($"BRUSH BIOME ({BiomeCatalog.AllBiomes.Count})", $"БИОМ КИСТИ ({BiomeCatalog.AllBiomes.Count})"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 14f); BuildCompactBiomeSwatchGrid((Transform)(object)val); _selectedBiomeLabel = UiFactory.CreateLabel((Transform)(object)val, string.Empty, 9.5f, UiTheme.TextSecondary, bold: false, (TextAlignmentOptions)4097, wrap: false, "SelectedBiomeInfo"); UiFactory.FixHeight(((Component)_selectedBiomeLabel).gameObject, 15f); } private void BuildCompactBiomeSwatchGrid(Transform parent) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) IReadOnlyList<BiomeDefinition> allBiomes = BiomeCatalog.AllBiomes; RectTransform val = null; for (int i = 0; i < allBiomes.Count; i++) { if (i % 2 == 0) { val = UiFactory.CreateRect($"PaintBiomeRow_{i / 2}", parent); UiFactory.AddHorizontalLayout(((Component)val).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val).gameObject, 22f); } BiomeDefinition biomeDefinition = allBiomes[i]; BiomeId id = biomeDefinition.Id; StyledButton styledButton = UiFactory.CreateButton((Transform)(object)val, biomeDefinition.ShortNameRu, UiTheme.BtnSubtle, UiTheme.TextPrimary, 9.5f, delegate { _selectedPaintBiome = id; SyncBiomeSwatchVisuals(); UpdateToolAccentStrip(PaintToolMode.BiomePaint); UpdateCanvasBrushPreview(); }, bold: true, (TextAlignmentOptions)4097, $"PaintBiomeBtn_{id}"); UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); RectTransform obj = UiFactory.CreateRect("Swatch", styledButton.GameObject.transform); obj.anchorMin = new Vector2(0f, 0f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(2f, 0f); obj.sizeDelta = new Vector2(4f, -6f); UiFactory.AddBackground(((Component)obj).gameObject, ToUnityColor(biomeDefinition.AccentColor), raycastTarget: false); ((TMP_Text)styledButton.Label).rectTransform.offsetMin = new Vector2(9f, 1f); ((TMP_Text)styledButton.Label).rectTransform.offsetMax = new Vector2(-3f, -1f); _biomeSwatchButtons[id] = styledButton; } if (allBiomes.Count % 2 == 1 && (Object)(object)val != (Object)null) { UiFactory.SetLayout(((Component)UiFactory.CreateRect("PaintBiomeSpacer", (Transform)(object)val)).gameObject, -1f, -1f, 1f, 22f, 22f, 0f); } } private void BuildPropPickerSubPanel(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 4f, new RectOffset(6, 6, 5, 5), "PropPickerSubPanel"); _propPickerCard = ((Component)val).gameObject; UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("DETAIL CATEGORY", "ТИП ДЕТАЛЕЙ"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 14f); AddPropCategoryButton((Transform)(object)val, PropCategory.AllBiome, Loc.Tr("All (Biome Auto)", "Все (биом)"), fullWidth: true); RectTransform val2 = UiFactory.CreateRect("PropCatRow1", (Transform)(object)val); UiFactory.AddHorizontalLayout(((Component)val2).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val2).gameObject, 22f); AddPropCategoryButton((Transform)(object)val2, PropCategory.Trees, Loc.Tr("Trees", "Деревья"), fullWidth: false); AddPropCategoryButton((Transform)(object)val2, PropCategory.Grass, Loc.Tr("Grass / Flora", "Трава / Флора"), fullWidth: false); RectTransform val3 = UiFactory.CreateRect("PropCatRow2", (Transform)(object)val); UiFactory.AddHorizontalLayout(((Component)val3).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val3).gameObject, 22f); AddPropCategoryButton((Transform)(object)val3, PropCategory.Rocks, Loc.Tr("Rocks", "Камни"), fullWidth: false); AddPropCategoryButton((Transform)(object)val3, PropCategory.Debris, Loc.Tr("Logs / Debris", "Мусор / Декор"), fullWidth: false); _propLimitReadoutLabel = UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("Cap: ≤3 obj./tile", "Лимит: ≤3 об./тайл"), 9.5f, UiTheme.Emerald, bold: false, (TextAlignmentOptions)257, wrap: true, "PropLimitReadout"); UiFactory.FixHeight(((Component)_propLimitReadoutLabel).gameObject, 26f); } private void AddPropCategoryButton(Transform parent, PropCategory category, string label, bool fullWidth) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) StyledButton styledButton = UiFactory.CreateButton(parent, label, UiTheme.BtnSubtle, UiTheme.TextPrimary, 9.5f, delegate { _selectedPropCategory = category; SyncPropCategoryVisuals(); UpdateToolAccentStrip(PaintToolMode.PropPaint); UpdateCanvasBrushPreview(); }, bold: true, (TextAlignmentOptions)4097, $"PropCatBtn_{category}"); if (fullWidth) { UiFactory.FixHeight(styledButton.GameObject, 22f); } else { UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); } RectTransform obj = UiFactory.CreateRect("Swatch", styledButton.GameObject.transform); obj.anchorMin = new Vector2(0f, 0f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(2f, 0f); obj.sizeDelta = new Vector2(4f, -6f); UiFactory.AddBackground(((Component)obj).gameObject, ToUnityColor(PropCatalog.GetCategoryPreviewColor(category)), raycastTarget: false); ((TMP_Text)styledButton.Label).rectTransform.offsetMin = new Vector2(9f, 1f); ((TMP_Text)styledButton.Label).rectTransform.offsetMax = new Vector2(-3f, -1f); _propCategoryButtons[category] = styledButton; } private void BuildBrushParamsCard(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) RectTransform parent2 = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 4f, new RectOffset(6, 6, 5, 5), "BrushParamsCard"); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)parent2, Loc.Tr("BRUSH PARAMETERS", "ПАРАМЕТРЫ КИСТИ"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 15f); _radiusSlider = UiFactory.CreateLabeledSlider((Transform)(object)parent2, Loc.Tr("Brush Radius", "Радиус кисти"), 1f, 16f, _brushRadiusCells, wholeNumbers: false, (float v) => FormatRadiusLabel(Mathf.Round(v * 2f) * 0.5f), delegate(float v) { if (!_suppressCallbacks) { _brushRadiusCells = Mathf.Clamp(Mathf.Round(v * 2f) * 0.5f, 1f, 16f); UpdateCanvasBrushPreview(); } }, 0.5f); TightenSliderValueWidth(_radiusSlider, 84f, 96f); _strengthSlider = UiFactory.CreateLabeledSlider((Transform)(object)parent2, Loc.Tr("Strength / Falloff", "Сила / Мягкость"), 0.1f, 1f, _brushStrength01, wholeNumbers: false, (float v) => $"{Mathf.RoundToInt(v * 100f)}%", delegate(float v) { if (!_suppressCallbacks) { _brushStrength01 = Mathf.Clamp(v, 0.1f, 1f); } }, 0.05f); TightenSliderValueWidth(_strengthSlider, 52f, 60f); RectTransform val = UiFactory.CreateRect("FlattenOptionsGroup", (Transform)(object)parent2); _flattenOptionsGroup = ((Component)val).gameObject; UiFactory.AddVerticalLayout(_flattenOptionsGroup, 4f, null, (TextAnchor)0); _flattenTargetSlider = UiFactory.CreateLabeledSlider((Transform)(object)val, Loc.Tr("Target Height", "Целевая высота"), 0f, 1f, _flattenTargetNorm01, wholeNumbers: false, FormatFlattenTargetLabel, delegate(float v) { if (!_suppressCallbacks) { _flattenTargetNorm01 = Mathf.Clamp01(v); } }, 0.05f); TightenSliderValueWidth(_flattenTargetSlider, 84f, 96f); _flattenAutoPickBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("[✓] Sample height on click", "[✓] Брать высоту по клику"), UiTheme.BtnActiveTab, UiTheme.Gold, 10f, delegate { _flattenAutoPickOnClick = !_flattenAutoPickOnClick; SyncFlattenAutoPickVisual(); }, bold: false, (TextAlignmentOptions)4097, "FlattenAutoPickBtn"); UiFactory.FixHeight(_flattenAutoPickBtn.GameObject, 22f); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)parent2, Loc.Tr("Keys: [ / ] radius • Ctrl+Z / Y", "Клавиши: [ / ] радиус • Ctrl+Z / Y"), 9.5f, UiTheme.TextMuted, bold: false, (TextAlignmentOptions)4097, wrap: false, "HotkeyHint")).gameObject, 14f); } private void BuildClearLayersCard(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) RectTransform parent2 = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 3f, new RectOffset(6, 6, 5, 5), "ClearLayersCard"); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)parent2, Loc.Tr("CLEAR PAINTED LAYERS", "СБРОС РУЧНЫХ СЛОЁВ"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 15f); _editsSummaryLabel = UiFactory.CreateLabel((Transform)(object)parent2, Loc.Tr("No manual edits", "Ручных правок нет"), 9.5f, UiTheme.TextMuted, bold: false, (TextAlignmentOptions)257, wrap: true, "EditsSummaryLabel"); UiFactory.FixHeight(((Component)_editsSummaryLabel).gameObject, 24f); RectTransform val = UiFactory.CreateRect("ClearRow1", (Transform)(object)parent2); UiFactory.AddHorizontalLayout(((Component)val).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val).gameObject, 22f); _clearHeightsBtn = CreateClearLayerBtn((Transform)(object)val, Loc.Tr("Heights", "Высоты"), HandleClearHeightsClicked, bold: false, "ClearHeightsBtn"); _clearBiomesBtn = CreateClearLayerBtn((Transform)(object)val, Loc.Tr("Biomes", "Биомы"), HandleClearBiomesClicked, bold: false, "ClearBiomesBtn"); RectTransform val2 = UiFactory.CreateRect("ClearRow2", (Transform)(object)parent2); UiFactory.AddHorizontalLayout(((Component)val2).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val2).gameObject, 22f); _clearWaterBtn = CreateClearLayerBtn((Transform)(object)val2, Loc.Tr("Water", "Вода"), HandleClearWaterClicked, bold: false, "ClearWaterBtn"); _clearRoadsBtn = CreateClearLayerBtn((Transform)(object)val2, Loc.Tr("Roads", "Дороги"), HandleClearRoadsClicked, bold: false, "ClearRoadsBtn"); RectTransform val3 = UiFactory.CreateRect("ClearRow3", (Transform)(object)parent2); UiFactory.AddHorizontalLayout(((Component)val3).gameObject, 3f, null, (TextAnchor)3, expandWidth: true); UiFactory.FixHeight(((Component)val3).gameObject, 22f); _clearPropsBtn = CreateClearLayerBtn((Transform)(object)val3, Loc.Tr("Props", "Детали"), HandleClearPropsClicked, bold: false, "ClearPropsBtn"); _clearAllBtn = CreateClearLayerBtn((Transform)(object)val3, Loc.Tr("Clear All", "Сбросить всё"), HandleClearAllClicked, bold: true, "ClearAllBtn", UiTheme.BtnDanger); } private static StyledButton CreateClearLayerBtn(Transform parent, string text, Action onClick, bool bold, string name, Color? bg = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) StyledButton styledButton = UiFactory.CreateButton(parent, text, (Color)(((??)bg) ?? UiTheme.BtnSubtle), UiTheme.TextPrimary, 9.5f, onClick, bold, (TextAlignmentOptions)514, name); UiFactory.SetLayout(styledButton.GameObject, -1f, -1f, 1f, 22f, 22f, 0f); return styledButton; } private void BuildPinnedQuickBuildCard(RectTransform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateCard((Transform)(object)parent, UiTheme.CardBg, 3f, new RectOffset(6, 6, 5, 5), "QuickBuildCard"); UiFactory.SetLayout(((Component)val).gameObject, -1f, -1f, 1f, -1f, -1f, 0f); UiFactory.FixHeight(((Component)UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("QUICK BUILD", "БЫСТРАЯ ПОСТРОЙКА"), 10.5f, UiTheme.Gold, bold: true, (TextAlignmentOptions)4097)).gameObject, 14f); _generateOnBoardBtn = UiFactory.CreateButton((Transform)(object)val, Loc.Tr("⚡ GENERATE ON BOARD", "⚡ СГЕНЕРИРОВАТЬ НА СТОЛ"), UiTheme.BtnPrimaryGreen, UiTheme.TextPrimary, 11f, HandleGenerateOnBoardClicked, bold: true, (TextAlignmentOptions)514, "EditorGenerateBtn"); UiFactory.AddBorder(_generateOnBoardBtn.GameObject, UiTheme.BorderGold); UiFactory.FixHeight(_generateOnBoardBtn.GameObject, 28f); _buildStatusLabel = UiFactory.CreateLabel((Transform)(object)val, Loc.Tr("Ready to edit.", "Готово к редактированию."), 9.5f, UiTheme.TextSecondary, bold: false, (TextAlignmentOptions)257, wrap: true, "EditorStatusLabel"); ((TMP_Text)_buildStatusLabel).enableAutoSizing = true; ((TMP_Text)_buildStatusLabel).fontSizeMin = 7.8f; ((TMP_Text)_buildStatusLabel).fontSizeMax = 9.5f; ((TMP_Text)_buildStatusLabel).overflowMode = (TextOverflowModes)0; UiFactory.FixHeight(((Component)_buildStatusLabel).gameObject, 36f); } private static void CreateCardinalCompassBadge(RectTransform frame, string text, bool isNorth, Vector2 anchor, Vector2 offset) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = UiFactory.CreateRect("CompassBadge_" + text, (Transform)(object)frame); obj.anchorMin = anchor; obj.anchorMax = anchor; obj.pivot = anchor; obj.anchoredPosition = offset; obj.sizeDelta = new Vector2(18f, 15f); UiFactory.AddBackground(((Component)obj).gameObject, new Color(0.05f, 0.07f, 0.11f, 0.8f), raycastTarget: false); UiFactory.AddBorder(((Component)obj).gameObject, UiTheme.BorderSubtle); UiFactory.Stretch(((TMP_Text)UiFactory.CreateLabel((Transform)(object)obj, text, 9f, isNorth ? UiTheme.Gold : UiTheme.TextSecondary, bold: true, (TextAlignmentOptions)514, wrap: false)).rectTransform); } private void BuildRightMapWorkspace(RectTransform parent) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiFactory.CreateRect("RightMapWorkspace", (Transform)(object)parent); UiFactory.SetLayout(((Component)val).gameObject, 340f, -1f, 1f, 220f, -1f, 1f); UiFactory.AddVerticalLayout(((Component)val).gameObject, 4f, null, (TextAnchor)0); RectTransform val2 = UiFactory.CreateRect("MapViewportFrame", (Transform)(object)val); UiFactory.AddBackground(((Component)val2).gameObject, new Color(0.03f, 0.038f, 0.055f, 1f), raycastTarget: false); UiFactory.AddBorder(((Component)val2).gameObject, UiTheme.BorderSubtle); UiFactory.SetLayout(((Component)val2).gameObject, -1f, -1f, 1f, 180f, -1f, 1f); RectTransform val3 = UiFactory.CreateRect("InteractiveMapCanvas", (Transform)(object)val2); UiFactory.Stretch(val3, 1f, 1f, 1f, 1f); _mapCanvas = ((Component)val3).gameObject.AddComponent<InteractiveMapCanvas>(); _mapCanvas.EnsureInitialized(); CreateCardinalCompassBadge(val2, Loc.Tr("N", "С"), isNorth: true, new Vector2(0.5f, 1f), new Vector2(0f, -4f)); CreateCardinalCompassBadge(val2, Loc.Tr("S", "Ю"), isNorth: false, new Vector2(0.5f, 0f), new Vector2(0f, 4f)); CreateCardinalCompassBadge(val2, Loc.Tr("W", "З"), isNorth: false, new Vector2(0f, 0.5f), new Vector2(4f, 0f)); CreateCardinalCompassBadge(val2, Loc.Tr("E", "В"), isNorth: false, new Vector2(1f, 0.5f), new Vector2(-4f, 0f)); _mapCanvas.OnStrokeBegin += HandleStrokeBegin; _mapCanvas.OnStrokeSegment += HandleStrokeSegment; _mapCanvas.OnStrokeEnd += HandleStrokeEnd; _mapCanvas.OnHoverCellChanged += HandleHoverCellChanged; _mapCanvas.OnZoomChanged += HandleZoomChanged; RectTransform val4 = UiFactory.CreateRect("BottomInfoBar", (Transform)(object)val); UiFactory.AddBackground(((Component)val4).gameObject, UiTheme.TitleBarBg, raycastTarget: false); UiFactory.AddBorder(((Component)val4).gameObject, UiTheme.BorderSubtle); UiFactory.FixHeight(((Component)val4).gameObject, 22f); UiFactory.AddHorizontalLayout(((Component)val4).gameObject, 8f, new RectOffset(8, 8, 2, 2), (TextAnchor)3); _cursorInfoLabel = UiFactory.CreateLabel((Transform)(object)val4, Loc.Tr("Hover over the map to inspect cell details.", "Наведите курсор на карту для просмотра параметров ячейки."), 10f, UiTheme.TextPrimary, bold: false, (TextAlignmentOptions)4097, wrap: false, "CursorInfoLabel"); UiFactory.SetLayout(((Component)_cursorInfoLabel).gameObject, 140f, -1f, 1f, 18f, 18f, 0f); UiFactory.SetLayout(((Component)UiFactory.CreateLabel((Transform)(object)val4, Loc.Tr("LMB: paint • RMB/MMB: pan • Wheel: zoom", "ЛКМ: рисовать • ПКМ/СКМ: двигать • Колесо: зум"), 9.5f, UiTheme.TextMuted, bold: false, (TextAlignmentOptions)4100, wrap: false, "ControlsHintLabel")).gameObject, 210f, 262f, 0f, 18f, 18f, 0f); } private void BuildResizeCorner(RectTransform rootRt) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = UiFactory.CreateRect("EditorResizeGrip", (Transform)(object)rootRt); ((Component)obj).gameObject.AddComponent<LayoutElement>().ignoreLayout = true; obj.anchorMin = new Vector2(1f, 0f); obj.anchorMax = new Vector2(1f, 0f); obj.pivot = new Vector2(1f, 0f); obj.anchoredPosition = new Vector2(-2f, 2f); obj.sizeDelta = new Vector2(18f, 18f); UiFactory.AddBackground(((Component)obj).gameObject, new Color(0.85f, 0.65f, 0.28f, 0.24f)); UiFactory.Stretch(((TMP_Text)UiFactory.CreateLabel((Transform)(object)obj, "◢", 10.5f, UiTheme.Gold, bold: false, (TextAlignmentOptions)1028, wrap: false)).rectTransform, 0f, 0f, 2f); WindowResizeHandle windowResizeHandle = ((Component)obj).gameObject.AddComponent<WindowResizeHandle>(); windowResizeHandle.TargetWindow = rootRt; windowResizeHandle.MinSize = MinWindowSize; windowResizeHandle.MaxSize = MaxWindowSize; } private void HandleStrokeBegin(int gx, int gz) { if (_paintOverlay == null || _settings == null || _activeTool == PaintToolMode.None) { return; } _paintOverlay.EnsureSize(_settings.GridWidth2x2, _settings.GridDepth2x2); bool flag = false; if (_activeTool == PaintToolMode.RoadPaint && !_settings.EnableRoads) { _settings.EnableRoads = true; flag = true; } else if (_activeTool == PaintToolMode.PropPaint && !_settings.EnableProps) { _settings.EnableProps = true; flag = true; } if (_activeTool == PaintToolMode.HeightFlatten && _flattenAutoPickOnClick && _currentResult != null && gx >= 0 && gx < _currentResult.Width2x2 && gz >= 0 && gz < _currentResult.Depth2x2) { _flattenTargetNorm01 = Mathf.Clamp01(_currentResult.NormalizedHeightGrid[gx, gz]); SyncFlattenTargetSlider(); } if (_activeTool == PaintToolMode.WaterPaint) { if (_activeWaterType == WaterBrushType.Lake && _currentResult != null && gx >= 0 && gx < _currentResult.Width2x2 && gz >= 0 && gz < _currentResult.Depth2x2) { ref TerrainCell2x2 reference = ref _currentResult.Cells[gx, gz]; _lakeTargetStep = ((reference.IsWater && reference.WaterKind == WaterBodyKind.Lake) ? ((short)Math.Max(0, reference.ElevationStep)) : short.MinValue); } else { _lakeTargetStep = short.MinValue; } } _paintOverlay.PushUndoSnapshot(); float[,] baseNormalizedHeight = ((_currentResult != null) ? _currentResult.BaseNormalizedHeightGrid : null); bool flag2 = _paintOverlay.ApplyBrush(_activeTool, gx, gz, _brushRadiusCells, _brushStrength01, _selectedPaintBiome, _flattenTargetNorm01, baseNormalizedHeight, _activeWaterType, _lakeTargetStep, _selectedPropCategory); if (flag) { SyncSettingsUI(); if (_onSettingsMutated != null) { _onSettingsMutated(); } else { RequestOverlayRebuild(immediate: true); } SyncOverlayButtonsAndSummary(); } else if (flag2) { RequestOverlayRebuild(immediate: true); } else { SyncOverlayButtonsAndSummary(); } } private void HandleStrokeSegment(int x0, int z0, int x1, int z1) { if (_paintOverlay != null && _settings != null && _activeTool != PaintToolMode.None) { float[,] baseNormalizedHeight = ((_currentResult != null) ? _currentResult.BaseNormalizedHeightGrid : null); if (_paintOverlay.ApplyBrushLine(_activeTool, x0, z0, x1, z1, _brushRadiusCells, _brushStrength01, _selectedPaintBiome, _flattenTargetNorm01, baseNormalizedHeight, skipStartPoint: true, _activeWaterType, _lakeTargetStep, _selectedPropCategory)) { int num = _settings.GridWidth2x2 * _settings.GridDepth2x2; RequestOverlayRebuild(num <= 4096); } } } private void HandleStrokeEnd() { if (_rebuildDirty) { _rebuildDirty = false; TriggerOverlayRebuildNow(); } else { SyncOverlayButtonsAndSummary(); } } private void HandleHoverCellChanged(int gx, int gz, bool isInside) { UpdateCursorInfoBar(gx, gz, isInside); } private void HandleZoomChanged(float zoom) { if ((Object)(object)_zoomPercentLabel != (Object)null) { ((TMP_Text)_zoomPercentLabel).text = $"{Mathf.RoundToInt(zoom * 100f)}%"; } if ((Object)(object)_mapCanvas != (Object)null) { bool isInside = _mapCanvas.IsPointerInside && _mapCanvas.HoverGridX >= 0; UpdateCursorInfoBar(_mapCanvas.HoverGridX, _mapCanvas.HoverGridZ, isInside); } } private void HandleUndoClicked() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.CanUndo && _paintOverlay.Undo()) { RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr($"Stroke undone (remaining: {_paintOverlay.UndoCount}).", $"Отмена штриха (осталось: {_paintOverlay.UndoCount})."), UiTheme.TextSecondary); } } private void HandleRedoClicked() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.CanRedo && _paintOverlay.Redo()) { RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr($"Stroke redone (redos: {_paintOverlay.RedoCount}).", $"Повтор штриха (повторов: {_paintOverlay.RedoCount})."), UiTheme.TextSecondary); } } private void HandleClearHeightsClicked() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.HasHeightEdits) { _paintOverlay.ClearHeights(); RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr("Manual height layer cleared.", "Ручной слой высот сброшен."), UiTheme.Gold); } } private void HandleClearBiomesClicked() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.HasBiomeEdits) { _paintOverlay.ClearBiomes(); RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr("Manual biome layer cleared.", "Ручной слой биомов сброшен."), UiTheme.Gold); } } private void HandleClearWaterClicked() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.HasWaterEdits) { _paintOverlay.ClearWater(); RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr("Manual water layer cleared.", "Ручной слой воды сброшен."), UiTheme.Gold); } } private void HandleClearRoadsClicked() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.HasRoadEdits) { _paintOverlay.ClearRoads(); RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr("Manual road layer cleared.", "Ручной слой дорог сброшен."), UiTheme.Gold); } } private void HandleClearPropsClicked() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.HasPropEdits) { _paintOverlay.ClearProps(); RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr("Manual props layer cleared.", "Ручной слой деталей сброшен."), UiTheme.Gold); } } private void HandleClearAllClicked() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_paintOverlay != null && _paintOverlay.HasAnyEdits) { _paintOverlay.ClearAll(); RequestOverlayRebuild(immediate: true); SetStatus(Loc.Tr("All manual brush edits cleared.", "Все ручные правки кисти сброшены."), UiTheme.Gold); } } private void HandleGenerateOnBoardClicked() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (_rebuildDirty) { _rebuildDirty = false; TriggerOverlayRebuildNow(); } if (_onGenerateOnBoardRequested != null) { _onGenerateOnBoardRequested(); SetStatus(Loc.Tr("Terrain generation sent to TaleSpire board.", "Запрос генерации отправлен на доску TaleSpire."), UiTheme.Emerald); return; } if (_currentResult == null && _settings != null) { _currentResult = TerrainGeneratorEngine.Generate(_settings, _paintOverlay); } string statusMessage; if (_currentResult == null) { SetStatus(Loc.Tr("No terrain data to generate.", "Нет данных рельефа для генерации."), UiTheme.Amber); } else if (TaleSpireTerrainBridge.TryPlaceTerrainOnBoard(_currentResult, _settings, _logger, out statusMessage)) { SetStatus(statusMessage, UiTheme.Emerald); } else { SetStatus(statusMessage, UiTheme.Amber); } } private void NotifySettingsMutated() { if (_onSettingsMutated != null) { _onSettingsMutated(); } else { RequestOverlayRebuild(immediate: true); } } private void RequestOverlayRebuild(bool immediate) { if (immediate) { _rebuildDirty = false; TriggerOverlayRebuildNow(); return; } _rebuildDirty = true; if (Time.unscaledTime >= _nextRebuildTime) { _nextRebuildTime = Time.unscaledTime + 0.045f; _rebuildDirty = false; TriggerOverlayRebuildNow(); } } private void TriggerOverlayRebuildNow() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (_onPaintOverlayMutated != null) { _onPaintOverlayMutated(); SyncOverlayButtonsAndSummary(); } else { if (_settings == null) { return; } try { TerrainGenerationResult result = TerrainGeneratorEngine.Generate(_settings, _paintOverlay); RefreshFromTerrain(result, null, _previewMode); } catch (Exception ex) { ManualLogSource logger = _logger; if (logger != null) { logger.LogError((object)$"ExpandedMapModalView terrain rebuild failed: {ex}"); } SetStatus(Loc.Tr("Rebuild error: " + ex.Message, "Ошибка пересчёта: " + ex.Message), UiTheme.Amber); } } } private Texture2D RenderOwnedPreviewTexture(TerrainGenerationResult result, PreviewRenderMode mode) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) int width2x = result.Width2x2; int depth2x = result.Depth2x2; if ((Object)(object)_ownedPreviewTexture == (Object)null || ((Texture)_ownedPreviewTexture).width != width2x || ((Texture)_ownedPreviewTexture).height != depth2x) { if ((Object)(object)_ownedPreviewTexture != (Object)null) { Object.Destroy((Object)(object)_ownedPreviewTexture); } _ownedPreviewTexture = new Texture2D(width2x, depth2x, (TextureFormat)4, false) { name = "TSTerrainGenerator_ModalPreviewTex", filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; } RgbColor[] array = result.RenderPreviewPixels(mode); Color32[] array2 = (Color32[])(object)new Color32[array.Length]; for (int i = 0; i < array.Length; i++) { RgbColor rgbColor = array[i]; array2[i] = new Color32(rgbColor.R, rgbColor.G, rgbColor.B, byte.MaxValue); } _ownedPreviewTexture.SetPixels32(array2); _ownedPreviewTexture.Apply(false, false); return _ownedPreviewTexture; } private void SyncAllControls() { SyncToolSelectionVisuals(); SyncRoadStyleVisuals(); SyncWaterTypeVisuals(); SyncBiomeSwatchVisuals(); SyncPropCategoryVisuals(); SyncPropLimitReadout(); SyncShowPropsToggleVisual(); SyncFlattenTargetSlider(); SyncFlattenAutoPickVisual(); UpdatePreviewModeHighlights(); SyncOverlayButtonsAndSummary(); if ((Object)(object)_zoomPercentLabel != (Object)null && (Object)(object)_mapCanvas != (Object)null) { ((TMP_Text)_zoomPercentLabel).text = $"{_mapCanvas.ZoomPercent}%"; } } private void SyncToolSelectionVisuals() { foreach (KeyValuePair<PaintToolMode, StyledButton> toolButton in _toolButtons) { bool flag = toolButton.Key == _activeTool; HighlightToggleBtn(toolButton.Value, flag); ((TMP_Text)toolButton.Value.Label).font = (flag ? UiTheme.BoldFont : UiTheme.RegularFont); } if ((Object)(object)_roadStyleCard != (Object)null) { _roadStyleCard.SetActive(_activeTool == PaintToolMode.RoadPaint || _activeTool == PaintToolMode.RoadErase); } if ((Object)(object)_waterTypeCard != (Object)null) { _waterTypeCard.SetActive(_activeTool == PaintToolMode.WaterPaint || _activeTool == PaintToolMode.WaterErase); } if ((Object)(object)_biomePickerCard != (Object)null) { _biomePickerCard.SetActive(_activeTool == PaintToolMode.BiomePaint); } if ((Object)(object)_propPickerCard != (Object)null) { _propPickerCard.SetActive(_activeTool == PaintToolMode.PropPaint); } if ((Object)(object)_flattenOptionsGroup != (Object)null) { _flattenOptionsGroup.SetActive(_activeTool == PaintToolMode.HeightFlatten); } UpdateCanvasBrushPreview(); } private void SyncRoadStyleVisuals() { if (_settings == null) { return; } foreach (KeyValuePair<RoadType, StyledButton> roadTypeButton in _roadTypeButtons) { HighlightToggleBtn(roadTypeButton.Value, roadTypeButton.Key == _settings.RoadType); } foreach (KeyValuePair<RoadMaterial, StyledButton> roadMaterialButton in _roadMaterialButtons) { HighlightToggleBtn(roadMaterialButton.Value, roadMaterialButton.Key == _settings.RoadMaterial); } if ((Object)(object)_roadMaterialDescLabel != (Object)null) { RoadMaterialDef material = RoadCatalog.GetMaterial(_settings.RoadMaterial); ((TMP_Text)_roadMaterialDescLabel).text = material.NameRu + ": " + material.TilesSummaryRu; } } private void SyncWaterTypeVisuals() { foreach (KeyValuePair<WaterBrushType, StyledButton> waterTypeButton in _waterTypeButtons) { HighlightToggleBtn(waterTypeButton.Value, waterTypeButton.Key == _activeWaterType); } SyncWaterSettingsVisuals(); } private void SyncWaterSettingsVisuals() { if (_settings != null) { if (_editorShoreBlendSlider != null) { _editorShoreBlendSlider.Slider.SetValueWithoutNotify((float)_settings.ShoreBlendCells); ((TMP_Text)_editorShoreBlendSlider.ValueLabel).text = Loc.Tr($"{_settings.ShoreBlendCells} cells ({_settings.ShoreBlendCells * 2} u.)", $"{_settings.ShoreBlendCells} яч. ({_settings.ShoreBlendCells * 2} ед.)"); } if (_editorShoreTilesToggleBtn != null) { ((TMP_Text)_editorShoreTilesToggleBtn.Label).text = (_settings.BlendShorelineTiles ? Loc.Tr("[✓] Sand / gravel along water", "[✓] Песок / галька у воды") : Loc.Tr("[ ] No shoreline tiles", "[ ] Без прибрежных тайлов")); HighlightToggleBtn(_editorShoreTilesToggleBtn, _settings.BlendShorelineTiles); } } } private void SyncBiomeSwatchVisuals() { foreach (KeyValuePair<BiomeId, StyledButton> biomeSwatchButton in _biomeSwatchButtons) { HighlightToggleBtn(biomeSwatchButton.Value, biomeSwatchButton.Key == _selectedPaintBiome); } if ((Object)(object)_selectedBiomeLabel != (Object)null) { BiomeDefinition biome = BiomeCatalog.GetBiome(_selectedPaintBiome); ((TMP_Text)_selectedBiomeLabel).text = Loc.Tr("Selected: " + biome.NameRu, "Выбран: " + biome.NameRu); } } private void SyncPropCategoryVisuals() { foreach (KeyValuePair<PropCategory, StyledButton> propCategoryButton in _propCategoryButtons) { HighlightToggleBtn(propCategoryButton.Value, propCategoryButton.Key == _selectedPropCategory); } } private void SyncPropLimitReadout() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_propLimitReadoutLabel == (Object)null) && _settings != null) { int maxPropsPerCell = _settings.MaxPropsPerCell; if (maxPropsPerCell <= 3) { ((TMP_Text)_propLimitReadoutLabel).text = Loc.Tr($"Cap: ≤{maxPropsPerCell} obj./tile (safe)", $"Лимит: ≤{maxPropsPerCell} об./тайл (безопасно)"); ((Graphic)_propLimitReadoutLabel).color = UiTheme.Emerald; } else { ((TMP_Text)_propLimitReadoutLabel).text = Loc.Tr($"⚠ Cap: ≤{maxPropsPerCell} obj./tile — at your own risk!", $"⚠ Лимит: ≤{maxPropsPerCell} об./тайл — на свой страх и риск!"); ((Graphic)_propLimitReadoutLabel).color = (Color)((maxPropsPerCell >= 6) ? new Color(1f, 0.42f, 0.34f, 1f) : UiTheme.Amber); } } } private void SyncShowPropsToggleVisual() { if (_showPropsPreviewBtn != null && _settings != null) { bool showPropsOnPreview = _settings.ShowPropsOnPreview; ((TMP_Text)_showPropsPreviewBtn.Label).text = (showPropsOnPreview ? Loc.Tr("[✓] Props", "[✓] Детали") : Loc.Tr("[ ] Props", "[ ] Детали")); HighlightToggleBtn(_showPropsPreviewBtn, showPropsOnPreview); } } private void SyncFlattenTargetSlider() { if (_flattenTargetSlider != null) { bool suppressCallbacks = _suppressCallbacks; _suppressCallbacks = true; _flattenTargetSlider.Slider.SetValueWithoutNotify(_flattenTargetNorm01); ((TMP_Text)_flattenTargetSlider.ValueLabel).text = FormatFlattenTargetLabel(_flattenTargetNorm01); _suppressCallbacks = suppressCallbacks; } } private void RefreshFlattenTargetLabel() { if (_flattenTargetSlider != null) { ((TMP_Text)_flattenTargetSlider.ValueLabel).text = FormatFlattenTargetLabel(_flattenTargetNorm01); } } private void SyncFlattenAutoPickVisual() { if (_flattenAutoPickBtn != null) { ((TMP_Text)_flattenAutoPickBtn.Label).text = (_flattenAutoPickOnClick ? Loc.Tr("[✓] Sample height on click", "[✓] Брать высоту по клику") : Loc.Tr("[ ] Sample height on click", "[ ] Брать высоту по клику")); HighlightToggleBtn(_flattenAutoPickBtn, _flattenAutoPickOnClick); } } private void UpdatePreviewModeHighlights() { HighlightToggleBtn(_prevModeReliefBtn, _previewMode == PreviewRenderMode.BiomeAndRelief); HighlightToggleBtn(_prevModeHeightBtn, _previewMode == PreviewRenderMode.Heightmap); HighlightToggleBtn(_prevModeBiomeBtn, _previewMode == PreviewRenderMode.BiomeMask); } private void SyncOverlayButtonsAndSummary() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) bool interactable = _paintOverlay != null && _paintOverlay.CanUndo; bool interactable2 = _paintOverlay != null && _paintOverlay.CanRedo; bool flag = _paintOverlay != null && _paintOverlay.HasHeightEdits; bool flag2 = _paintOverlay != null && _paintOverlay.HasBiomeEdits; bool flag3 = _paintOverlay != null && _paintOverlay.HasWaterEdits; bool flag4 = _paintOverlay != null && _paintOverlay.HasRoadEdits; bool flag5 = _paintOverlay != null && _paintOverlay.HasPropEdits; bool flag6 = _paintOverlay != null && _paintOverlay.HasAnyEdits; int num = (flag ? _paintOverlay.GetModifiedHeightCellCount() : 0); int num2 = (flag2 ? _paintOverlay.GetBiomeOverrideCellCount() : 0); int num3 = (flag3 ? _paintOverlay.GetPaintedWaterCellCount() : 0); int num4 = (flag4 ? _paintOverlay.GetPaintedRoadCellCount() : 0); int num5 = (flag5 ? _paintOverlay.GetPaintedPropCellCount() : 0); SetButtonInteractable(_undoBtn, interactable, UiTheme.BtnDefault); SetButtonInteractable(_redoBtn, interactable2, UiTheme.BtnDefault); UpdateClearButton(_clearHeightsBtn, Loc.Tr("Heights", "Высоты"), num, flag, UiTheme.BtnDefault); UpdateClearButton(_clearBiomesBtn, Loc.Tr("Biomes", "Биомы"), num2, flag2, UiTheme.BtnDefault); UpdateClearButton(_clearWaterBtn, Loc.Tr("Water", "Вода"), num3, flag3, UiTheme.BtnDefault); UpdateClearButton(_clearRoadsBtn, Loc.Tr("Roads", "Дороги"), num4, flag4, UiTheme.BtnDefault); UpdateClearButton(_clearPropsBtn, Loc.Tr("Props", "Детали"), num5, flag5, UiTheme.BtnDefault); SetButtonInteractable(_clearAllBtn, flag6, flag6 ? UiTheme.BtnDanger : UiTheme.BtnSubtle); if ((Object)(object)_editsSummaryLabel != (Object)null) { if (!flag6) { ((TMP_Text)_editsSummaryLabel).text = Loc.Tr("No manual edits", "Ручных правок нет"); ((Graphic)_editsSummaryLabel).color = UiTheme.TextMuted; return; } ((TMP_Text)_editsSummaryLabel).text = Loc.Tr($"Hgt:{num} • Bio:{num2} • Wat:{num3} • Rd:{num4} • Prp:{num5}", $"Выс:{num} • Биом:{num2} • Вода:{num3} • Дор:{num4} • Дет:{num5}"); ((Graphic)_editsSummaryLabel).color = UiTheme.Gold; } } private static void UpdateClearButton(StyledButton btn, string baseLabel, int count, bool active, Color activeBg) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (btn != null) { ((TMP_Text)btn.Label).text = ((count > 0) ? $"{baseLabel} ({count})" : baseLabel); SetButtonInteractable(btn, active, active ? activeBg : UiTheme.BtnSubtle); } } private void UpdateToolAccentStrip(PaintToolMode mode) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (_toolAccentStrips.TryGetValue(mode, out var value) && (Object)(object)value != (Object)null) { ((Graphic)value).color = GetCurrentToolBrushColor(mode); } } private void UpdateCanvasBrushPreview() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_mapCanvas == (Object)null)) { _mapCanvas.SetBrushPreview(_activeTool, _brushRadiusCells, GetCurrentToolBrushColor(_activeTool)); } } private Color GetCurrentToolBrushColor(PaintToolMode mode) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) return InteractiveMapCanvas.GetToolBrushColor(mode, _selectedPaintBiome, _selectedPropCategory, _activeWaterType); } private void UpdateCursorInfoBar(int gx, int gz, bool isInside) { if ((Object)(object)_cursorInfoLabel == (Object)null) { return; } int num = (((Object)(object)_mapCanvas != (Object)null) ? _mapCanvas.ZoomPercent : 100); if (!isInside || _currentResult == null || gx < 0 || gx >= _currentResult.Width2x2 || gz < 0 || gz >= _currentResult.Depth2x2) { if (_currentResult != null) { ((TMP_Text)_cursorInfoLabel).text = Loc.Tr($"Map {_currentResult.Width2x2}×{_currentResult.Depth2x2} ({_currentResult.WorldWidthUnits:0}×{_currentResult.WorldDepthUnits:0} u.) | " + $"Water: {_currentResult.WaterCellCount} | Roads: {_currentResult.RoadCellCount} | " + $"Props: {_currentResult.TotalPropCount} | Zoom: {num}%", $"Карта {_currentResult.Width2x2}×{_currentResult.Depth2x2} ({_currentResult.WorldWidthUnits:0}×{_currentResult.WorldDepthUnits:0} ед.) | " + $"Вода: {_currentResult.WaterCellCount} | Дор: {_currentResult.RoadCellCount} | " + $"Детали: {_currentResult.TotalPropCount} | Зум: {num}%"); } else { ((TMP_Text)_cursorInfoLabel).text = Loc.Tr($"Zoom: {num}%", $"Зум: {num}%"); } return; } ref TerrainCell2x2 reference = ref _currentResult.Cells[gx, gz]; int num2 = gx * 2; int num3 = gz * 2; string text2; if (reference.IsWater) { string text = ((reference.WaterKind != WaterBodyKind.None) ? TerrainPaintOverlay.GetWaterBodyKindNameRu(reference.WaterKind) : (reference.IsManualWater ? Loc.Tr("Water (manual)", "Вода (ручн.)") : Loc.Tr("Water", "Вода"))); text2 = ((reference.WaterDepthSteps > 0) ? Loc.Tr($"{text} (bed −{reference.WaterDepthSteps} sl.)", $"{text} (дно −{reference.WaterDepthSteps} сл.)") : text); } else { string shortNameRu = BiomeCatalog.GetBiome(reference.ResolvedBiome).ShortNameRu; text2 = (reference.IsShoreline ? Loc.Tr(shortNameRu + " (shore)", shortNameRu + " (берег)") : shortNameRu); } string text3 = string.Empty; if (reference.IsRoad) { string roadMaterialShortNameRu = RoadCatalog.GetRoadMaterialShortNameRu(reference.RoadMaterial); text3 = (reference.IsManualRoad ? Loc.Tr(" | Road (manual, " + roadMaterialShortNameRu + ")", " | Дорога (ручн., " + roadMaterialShortNameRu + ")") : Loc.Tr(" | Road (auto, " + roadMaterialShortNameRu + ")", " | Дорога (авто, " + roadMaterialShortNameRu + ")")); } else if (reference.IsRoadShoulder) { text3 = Loc.Tr(" | Verge", " | Обочина"); } int num4 = ((_currentResult.CellPropCount != null) ? _currentResult.CellPropCount[gx, gz] : 0); ((TMP_Text)_cursorInfoLabel).text = Loc.Tr($"X:{num2} Z:{num3} (2×2: {gx},{gz}) | Hgt: {reference.WorldY:0.0} ({reference.ElevationStep} sl.) | {text2}{text3} | Props: {num4} | Zoom: {num}%", $"X:{num2} Z:{num3} (2×2: {gx},{gz}) | Выс: {reference.WorldY:0.0} ({reference.ElevationStep} сл.) | {text2}{text3} | Детали: {num4} | Зум: {num}%"); } private void UpdateBoardStatusIfIdle() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (TaleSpireTerrainBridge.IsInBoardAndGm(out var statusMessage)) { SetStatus(statusMessage, UiTheme.TextSecondary); } else { SetStatus(statusMessage, UiTheme.Amber); } } private string FormatFlattenTargetLabel(float norm01) { int num = Mathf.RoundToInt(norm01 * 100f); if (_settings != null && _settings.MaxElevationSteps > 0) { int num2 = Mathf.RoundToInt(norm01 * (float)_settings.MaxElevationSteps); return Loc.Tr($"{num}% ({num2} sl.)", $"{num}% ({num2} сл.)"); } return $"{num}%"; } private static string FormatRadiusLabel(float radiusCells) { float num = Mathf.Round(radiusCells); if (Mathf.Abs(radiusCells - num) < 0.05f) { int num2 = Mathf.RoundToInt(num); return Loc.Tr($"{num2} cells ({num2 * 2} u.)", $"{num2} яч. ({num2 * 2} ед.)"); } return Loc.Tr($"{radiusCells:0.0} cells ({radiusCells * 2f:0.#} u.)", $"{radiusCells:0.0} яч. ({radiusCells * 2f:0.#} ед.)"); } private static void TightenSliderValueWidth(LabeledSliderControl ctrl, float minW, float prefW) { if (!((Object)(object)ctrl?.ValueLabel == (Object)null)) { UiFactory.SetLayout(((Component)ctrl.ValueLabel).gameObject, minW, prefW, 0f); } } private static void HighlightToggleBtn(StyledButton btn, bool active) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (btn != null) { UiFactory.ApplyButtonColor(btn.Button, active ? UiTheme.BtnActiveTab : UiTheme.BtnSubtle); ((Graphic)btn.Label).color = (active ? UiTheme.Gold : UiTheme.TextSecondary); } } private static void SetButtonInteractable(StyledButton btn, bool interactable, Color baseColor) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)btn?.Button == (Object)null)) { ((Selectable)btn.Button).interactable = interactable; UiFactory.ApplyButtonColor(btn.Button, baseColor, forceInstant: true); ((Graphic)btn.Label).color = (interactable ? UiTheme.TextPrimary : UiTheme.TextMuted); } } private static Color ToUnityColor(RgbColor c) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) return new Color((float)(int)c.R / 255f, (float)(int)c.G / 255f, (float)(int)c.B / 255f, 1f); } private static bool IsAnyInputFocused() { try { EventSystem current = EventSystem.current; GameObject val = ((current != null) ? current.currentSelectedGameObject : null); if ((Object)(object)val != (Object)null && ((Object)(object)val.GetComponent<TMP_InputField>() != (Object)null || (Object)(object)val.GetComponent<InputField>() != (Object)null)) { return true; } } catch { } return false; } } public sealed cl