コード例 #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
ファイル: 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);
 }
コード例 #3
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);
                }
            }
コード例 #4
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;
                }));
            }