void IGameModeHandler.OnGameModeStart(GameModeType gameMode) { if (gameMode == GameModeType.GlobalMap) { ModGlobalMapLocation.AddGlobalMapLocations(); } }
internal static void PostHandleHoverchange(GlobalMapLocation location, bool isHover) { // The hover ring is our highlight so reinstate it when the mouse moves out of the location if (!isHover) { ModGlobalMapLocation.FindByAssetGuid(location.Blueprint.AssetGuid)?.UpdateGlobalMapLocation(); } }
internal static string GetModifiedDescription(BlueprintLocation bpLocation, string result) { ModGlobalMapLocation mapLocation = GlobalMapLocations.FirstOrDefault(location => location.AssetGuid == bpLocation.AssetGuid); if (mapLocation != null && !mapLocation.IsDeleted && mapLocation.IsVisible) { return(result + "\n\n" + $"<b>Notes\n</b> <i>{mapLocation.Notes}</i>"); } else { return(result); } }
internal static void CustomizeGlobalMapLocation(GlobalMapLocation location) { ModGlobalMapLocation mapLocation = ModGlobalMapLocation.FindOrCreateByAssetGuid(location.Blueprint.AssetGuid); if (mapLocation != null) { mapLocation.UpdateGlobalMapLocation(); Game.Instance.UI.Common.UISound.Play(UISoundType.ButtonClick); } else { Log.Error($"Could not findOrCreate location name=[{location.Blueprint.GetName(false)}] guid=[{location.Blueprint.AssetGuid}]"); } }
internal static ModGlobalMapLocation FindOrCreateByAssetGuid(string assetGuid) { var modLocation = GlobalMapLocations.FirstOrDefault(location => location.AssetGuid == assetGuid); if (modLocation == null) { GlobalMapLocation mapLocation = GlobalMapLocation.Instances.FirstOrDefault(map => map.Blueprint.AssetGuid == assetGuid); if (mapLocation != null) { modLocation = new ModGlobalMapLocation(mapLocation); } else { Log.Write($"Cannot find GlobalMapLocation for assetGuid=[{assetGuid}]"); } } return(modLocation); }
void IWarningNotificationUIHandler.HandleWarning(WarningNotificationType warningType, bool addToLog) { switch (warningType) { case WarningNotificationType.GameLoaded: Log.Write($"Load request from [{warningType.ToString()}] event"); LoadState(); // Game does not send a GameMode event on first load, // this must be checked and handled here! if (Game.Instance.CurrentMode == GameModeType.GlobalMap) { ModGlobalMapLocation.AddGlobalMapLocations(); } break; case WarningNotificationType.GameSaved: case WarningNotificationType.GameSavedAuto: case WarningNotificationType.GameSavedQuick: Log.Write($"Save request from [{warningType.ToString()}] event"); SaveState(); break; } }
private static void Postfix(BlueprintLocation __instance, ref string __result) { __result = ModGlobalMapLocation.GetModifiedDescription(__instance, __result); }