internal static void MapSelecCursorEnterPrefix(MapSelectUI __instance) { if (!GameWhoIsThere.Instance.InMyRoom) { return; } _inMapSelecCursorEnter = true; GameWhoIsThere.Instance.Reset(); _inMapSelecCursorEnterIndex = 0; var i = 0; foreach (var uiName in new[] { "firstCharaThumbnailUI", "secondCharaThumbnailUI" }) { try { InMapSelecCursorLabels[i] = Traverse.Create(__instance)?.Field(uiName) ?.Field <Text>("text")?.Value; } catch { InMapSelecCursorLabels[i] = null; } i++; } }
internal static void MapSelecCursorEnterPrefix(MapSelectUI __instance) { void SetLabel(int i, MapSelectUI.MapSelectThumbnailUI thumbUi) { InMapSelecCursorLabels[i] = null; thumbUi.SafeProc(ui => InMapSelecCursorLabels[i] = ui.text); } try { if (!GameWhoIsThere.Instance.InMyRoom) { return; } _inMapSelecCursorEnter = true; GameWhoIsThere.Instance.Reset(); _inMapSelecCursorEnterIndex = 0; if (__instance.SafeProc(inst => { SetLabel(0, inst.firstCharaThumbnailUI); SetLabel(1, inst.secondCharaThumbnailUI); })) { return; } InMapSelecCursorLabels[0] = null; InMapSelecCursorLabels[1] = null; } catch (Exception err) { Logger.LogException(err, nameof(MapSelecCursorEnterPrefix)); } }
public void Init() { toggle = GetComponent <Toggle>(); mapSelectUI = FindObjectOfType <MapSelectUI>(); mapStats.map = this; mapStats.Load(); mapUnlockConditions.map = this; mapUnlockConditions.UpdateProgressValues(); if (!PlayerPrefs.HasKey("SelectedMap")) { if (type == Type.Buildings && MapSelectUI.SelectedMap == null) { MapSelectUI.SelectedMap = this; SetToggle(true); CameraController.Instance.UpdateSkyColor(); } } else { if (type == (Type)PlayerPrefs.GetInt("SelectedMap")) { if (this.isUnlocked) { MapSelectUI.SelectedMap = this; SetToggle(true); CameraController.Instance.UpdateSkyColor(); } else { MapSelectUI.SelectedMap = mapSelectUI.DefaultMap; MapSelectUI.SelectedMap.SetToggle(true); CameraController.Instance.UpdateSkyColor(); } } } }
internal static void MapSelecCursorEnterPrefix(MapSelectUI __instance) { void SetLabel(int i, MapSelectUI.MapSelectThumbnailUI thumbUi) { InMapSelecCursorLabels[i] = null; thumbUi.SafeProc(ui => { InMapSelecCursorLabels[i] = ui.text; GeBoAPI.Instance.AutoTranslationHelper.IgnoreTextComponent(ui.text); }); } try { if (__instance == null || !TranslationHelper.Instance.CurrentCardLoadTranslationEnabled) { return; } _inMapSelecCursorEnter = true; _inMapSelecCursorEnterIndex = 0; if (__instance.SafeProc(inst => { SetLabel(0, inst.firstCharaThumbnailUI); SetLabel(1, inst.secondCharaThumbnailUI); })) { return; } InMapSelecCursorLabels[0] = null; InMapSelecCursorLabels[1] = null; } catch (Exception err) { Logger.LogException(err, nameof(MapSelecCursorEnterPrefix)); } }
internal static void ResetMapScrollPrefix(MapSelectUI __instance, int _startIndex, bool _async, bool _forceSet) { // only want initial call with (0, false, true) if (_async || !_forceSet || _startIndex != 0) { return; } var scrollData = Traverse.Create(__instance).Field <MapInfo.Param[]>("scrollData").Value; if (scrollData == null) { return; } foreach (var entry in scrollData) { if (!Instance._mapLookup.TryGetValue(entry.MapNames[0], out var translation)) { continue; } entry.MapNames[0] = translation; } }
void Start() { mapSelect = FindObjectOfType <MapSelectUI>(); }