コード例 #1
0
ファイル: StarmapMod.cs プロジェクト: daheise/Galaxy-at-War
    private static void HighlightSystem(StarmapSystemRenderer __result, bool wasVisited, Color color, bool resize)
    {
        var blackMarketIsActive = __result.blackMarketObj.gameObject.activeInHierarchy;
        var fpAvailableIsActive = __result.flashpointAvailableObj.gameObject.activeInHierarchy;
        var fpActiveIsActive    = __result.flashpointActiveObj.gameObject.activeInHierarchy;

        __result.Init(__result.system, color, __result.CanTravel, wasVisited);
        if (fpAvailableIsActive)
        {
            __result.flashpointAvailableObj.SetActive(true);
        }
        if (fpActiveIsActive)
        {
            __result.flashpointActiveObj.SetActive(true);
        }
        if (blackMarketIsActive)
        {
            __result.blackMarketObj.gameObject.SetActive(true);
        }
        if (resize)
        {
            selectedScale(__result)   = 10;
            deselectedScale(__result) = 8;
        }
        else
        {
            selectedScale(__result)   = 4;
            deselectedScale(__result) = 4;
        }
    }
コード例 #2
0
        static void Postfix(SGNavigationScreen __instance, SimGameState ___simState)
        {
            foreach (MapMarker marker in Main.settings.mapMarkers.Values)
            {
                StarmapSystemRenderer systemRenderer = ___simState.Starmap.Screen.GetSystemRenderer(marker.systemName);
                GameObject            prefab         = null;
                if (marker.marker.useHmAnimation)
                {
                    systemRenderer.SetFlashpointMiniCampaign(true);
                    prefab = systemRenderer.flashpointMiniCampaignLocal;
                }
                else
                {
                    systemRenderer.SetFlashpointAvailable(true);
                    prefab = systemRenderer.flashpointAvailableLocal;
                }

                if (marker.marker.swapColour)
                {
                    foreach (ParticleSystem componentsInChild in prefab.GetComponentsInChildren <ParticleSystem>())
                    {
                        //Main.modLog.LogMessage(" " + componentsInChild.name + ": pr");
                        var   main      = componentsInChild.main;
                        var   colorGrad = main.startColor;
                        Color color     = marker.marker.GetColor(componentsInChild.name, colorGrad.colorMax.a);
                        colorGrad.colorMax = color;
                        main.startColor    = colorGrad;
                    }
                }
            }
        }
コード例 #3
0
ファイル: StarmapMod.cs プロジェクト: daheise/Galaxy-at-War
 private static void MakeSystemNormal(StarmapSystemRenderer __result, bool wasVisited)
 {
     __result.Init(__result.system, __result.systemColor, __result.CanTravel, wasVisited);
     __result.transform.localScale = Vector3.one;
     selectedScale(__result)       = 6;
     deselectedScale(__result)     = 4;
     __result.starOuter.gameObject.SetActive(wasVisited);
 }
コード例 #4
0
ファイル: Patch.cs プロジェクト: wmtorode/InnerSphereMap
 static void Prefix(StarmapSystemRenderer __instance, ref bool state)
 {
     try {
         state = false;
     }
     catch (Exception e) {
         Logger.LogError(e);
     }
 }
コード例 #5
0
        public static void Postfix(StarmapSystemRenderer __instance)
        {
            var collider = __instance?.gameObject?.GetComponent <BoxCollider>();

            if (collider == null)
            {
                return;
            }

            var size = new Vector3(Main.Settings.StarHitboxSize, Main.Settings.StarHitboxSize, 0.1f);

            collider.size = size;
        }
コード例 #6
0
        public static bool Prefix(StarmapSystemRenderer systemRenderer, StarmapSystemRenderer ___currSystem)
        {
            if (systemRenderer == null && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
            {
                Main.HBSLog.Log("Skipping SetSelectedSystemRenderer with systemRenderer null while shift held");
                return(false);
            }

            if (systemRenderer != null && systemRenderer != ___currSystem &&
                (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
            {
                ShiftClickMove.NextSelectIsShiftClick = true;
            }

            return(true);
        }
コード例 #7
0
            public static void Postfix(StarmapSystemRenderer __result)
            {
                try
                {
                    if (Globals.WarStatusTracker == null || Globals.Sim.IsCampaign && !Globals.Sim.CompanyTags.Contains("story_complete"))
                    {
                        return;
                    }

                    //Make sure that Flashpoint systems have priority display.
                    var flashpoints  = Globals.Sim.AvailableFlashpoints;
                    var isFlashpoint = flashpoints.Any(fp => fp.CurSystem == __result.system.System);
                    if (!isFlashpoint)
                    {
                        var VisitedStarSystems = Globals.Sim.VisitedStarSystems;
                        var wasVisited         = VisitedStarSystems.Contains(__result.name);
                        if (Globals.WarStatusTracker.HomeContestedStrings.Contains(__result.name))
                        {
                            HighlightSystem(__result, wasVisited, Color.magenta, true);
                        }
                        else if (Globals.WarStatusTracker.LostSystems.Contains(__result.name))
                        {
                            HighlightSystem(__result, wasVisited, Color.yellow, false);
                        }
                        else if (Globals.WarStatusTracker.PirateHighlight.Contains(__result.name))
                        {
                            HighlightSystem(__result, wasVisited, Color.red, false);
                        }
                        else if (__result.systemColor == Color.magenta || __result.systemColor == Color.yellow)
                        {
                            MakeSystemNormal(__result, wasVisited);
                        }

                        // force locals space to white
                        if (ReferenceEquals(FactionEnumeration.GetFactionByName("NoFaction"), __result.system.System.OwnerValue) ||
                            ReferenceEquals(FactionEnumeration.GetFactionByName("Locals"), __result.system.System.OwnerValue))
                        {
                            __result.Init(__result.system, Color.white, __result.CanTravel, Globals.Sim.VisitedStarSystems.Contains(__result.name));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Error(ex);
                }
            }
コード例 #8
0
            public static void Postfix(StarmapSystemRenderer __result)
            {
                try
                {
                    if (Globals.WarStatusTracker == null || Globals.Sim.IsCampaign && !Globals.Sim.CompanyTags.Contains("story_complete"))
                    {
                        return;
                    }

                    //Make sure that Flashpoint systems have priority display.
                    var flashpoints  = Globals.Sim.AvailableFlashpoints;
                    var isFlashpoint = flashpoints.Any(x => x.CurSystem.Name == __result.name);

                    //Mod.timer.Restart();
                    if (Globals.WarStatusTracker != null && !isFlashpoint)
                    {
                        var VisitedStarSystems = Globals.Sim.VisitedStarSystems;
                        var wasVisited         = VisitedStarSystems.Contains(__result.name);

                        if (Globals.WarStatusTracker.HomeContendedStrings.Contains(__result.name))
                        {
                            HighlightSystem(__result, wasVisited, Color.magenta, true);
                        }
                        else if (Globals.WarStatusTracker.LostSystems.Contains(__result.name))
                        {
                            HighlightSystem(__result, wasVisited, Color.yellow, false);
                        }
                        else if (Globals.WarStatusTracker.PirateHighlight.Contains(__result.name))
                        {
                            HighlightSystem(__result, wasVisited, Color.red, false);
                        }
                        else if (__result.systemColor == Color.magenta || __result.systemColor == Color.yellow)
                        {
                            MakeSystemNormal(__result, wasVisited);
                        }
                    }

                    //LogDebug(Mod.timer.ElapsedTicks);
                }
                catch (Exception ex)
                {
                    Error(ex);
                }
            }
コード例 #9
0
            public static bool Prefix(
                StarmapRenderer __instance,
                StarSystemNode node,
                StarmapSystemRenderer renderer)
            {
                return(HarmonyManager.PrefixLogExceptions(() =>
                {
                    bool flag = __instance.starmap.CanTravelToNode(node, false);
                    RGBColor <float> color = new RGBColor <float>(1, 1, 1);

                    VisitedColors visitedColors = HarmonyManager.Settings.VisitedColors;

                    switch (CurrentMapType)
                    {
                    case MapType.None:
                        return true;

                    case MapType.Difficulty:
                        color = GetDifficultyColor(__instance, node);
                        break;

                    case MapType.Visited:
                        color = __instance.starmap.HasStarSystemBeenVisited(node)
                                        ? visitedColors.VisitedColor
                                        : visitedColors.NotVisitedColor;
                        break;

                    case MapType.MaxContracts:
                        color = GetDifficultyColor((int)node.System.CurMaxContracts);
                        break;

                    default:
                        throw new InvalidEnumArgumentException("'CurrentMapType' has invalid value. This should never happen. Please report this as a bug.");
                    }
                    if (renderer.Init(node, flag ? color.FromRGBColor() : __instance.unavailableColor, flag))
                    {
                        __instance.RefreshBorders();
                    }

                    // Don't call the original method, we've replaced it.
                    return false;
                }));
            }
コード例 #10
0
ファイル: StarmapMod.cs プロジェクト: daheise/Galaxy-at-War
        public static void Postfix(StarmapRenderer __instance, StarmapSystemRenderer __result)
        {
            try
            {
                if (Core.WarStatus == null || sim.IsCampaign && !sim.CompanyTags.Contains("story_complete"))
                {
                    return;
                }

                //Core.timer.Restart();
                if (Core.WarStatus != null)
                {
                    List <string> VisitedStarSystems = (List <string>)Traverse.Create(sim).Field("VisitedStarSystems").GetValue();
                    var           wasVisited         = VisitedStarSystems.Contains(__result.name);

                    if (Core.WarStatus.HomeContendedStrings.Contains(__result.name))
                    {
                        HighlightSystem(__result, wasVisited, Color.magenta, true);
                    }
                    else if (Core.WarStatus.LostSystems.Contains(__result.name))
                    {
                        HighlightSystem(__result, wasVisited, Color.yellow, false);
                    }
                    else if (Core.WarStatus.PirateHighlight.Contains(__result.name))
                    {
                        HighlightSystem(__result, wasVisited, Color.red, false);
                    }
                    else if (__result.systemColor == Color.magenta || __result.systemColor == Color.yellow)
                    {
                        MakeSystemNormal(__result, wasVisited);
                    }
                }

                //LogDebug(Core.timer.ElapsedTicks);
            }
            catch (Exception ex)
            {
                LogDebug(ex.ToString());
            }
        }
コード例 #11
0
        static void Postfix(SGNavigationScreen __instance, Flashpoint flashpoint, ref StarmapSystemRenderer __result)
        {
            if (flashpoint.CurStatus == Flashpoint.Status.AVAILABLE || flashpoint.CurStatus == Flashpoint.Status.SELECTED_ENROUTE)
            {
                GameObject prefab = null;
                if (flashpoint.Def.isHeavyMetalCampaign)
                {
                    if (__result.flashpointMiniCampaignLocal != null)
                    {
                        prefab = __result.flashpointMiniCampaignLocal;
                    }
                }
                else
                {
                    if (__result.flashpointAvailableLocal != null)
                    {
                        prefab = __result.flashpointAvailableLocal;
                    }
                }

                if (prefab != null)
                {
                    FpMarker marker = FlashPointController.Instance.findMarker(flashpoint.Def.Description.Id);
                    if (marker != null && marker.swapColour)
                    {
                        foreach (ParticleSystem componentsInChild in prefab.GetComponentsInChildren <ParticleSystem>())
                        {
                            //Main.modLog.LogMessage(" " + componentsInChild.name + ": pr");
                            var   main      = componentsInChild.main;
                            var   colorGrad = main.startColor;
                            Color color     = marker.GetColor(componentsInChild.name, colorGrad.colorMax.a);
                            colorGrad.colorMax = color;
                            main.startColor    = colorGrad;
                        }
                    }
                }
            }
        }