Exemple #1
0
 void IGameModeHandler.OnGameModeStart(GameModeType gameMode)
 {
     if (gameMode == GameModeType.GlobalMap)
     {
         ModGlobalMapLocation.AddGlobalMapLocations();
     }
 }
Exemple #2
0
 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();
     }
 }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        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}]");
            }
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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;
            }
        }
Exemple #7
0
 private static void Postfix(BlueprintLocation __instance, ref string __result)
 {
     __result = ModGlobalMapLocation.GetModifiedDescription(__instance, __result);
 }