Ejemplo n.º 1
0
            public static bool Prefix(ColonistBarColonistDrawer __instance, ref Rect rect, ref Pawn colonist, ref Map pawnMap)
            {
                ColonistBar colonistBar = Find.ColonistBar;

                int group = colonistBar.Entries[0].group;

                framePosition = (Rect)groupFrameRectMethod.Invoke(__instance, new object[] { group });
                boxPosition   = new Rect(framePosition.x, framePosition.y + colonistBar.Size.y + 48, framePosition.width, 48);
                framePosition = new Rect(boxPosition.x + 6, boxPosition.y + 6, boxPosition.width - 12, boxPosition.height - 12);

                Text.Font = GameFont.Tiny;
                GUI.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);

                Widgets.ButtonImage(framePosition, frameTex, new Color(0.5f, 0.9f, 0.6f, 0.5f), new Color(0.5f, 0.9f, 0.6f, 1f));

                if (Mouse.IsOver(framePosition) && Settings.RimteractiveSettings.modEnabled)
                {
                    Widgets.DrawRectFast(boxPosition, new Color(0.9f, 0f, 0f, 0.5f), null);

                    TooltipHandler.TipRegion(framePosition, "Текущая статистика\n\nЗа первое событие:\nJohnny - 120 руб\nPain - 266 руб\nМатроскин - 488руб");

                    if (Input.GetMouseButtonDown(0))
                    {
                        if ((Time.time - lastEventTime) > 0.2f)
                        {
                            Messages.Message("[Rimteractive] [Event] X:" + framePosition.x.ToString()
                                             + " Y: " + framePosition.y.ToString()
                                             + " LastTime: " + lastEventTime.ToString()
                                             + " Delta: " + (Time.time - lastEventTime).ToString(),
                                             MessageTypeDefOf.PositiveEvent);

                            List <FloatMenuOption> list = new List <FloatMenuOption>();

                            foreach (IncidentDef incedent in DefDatabase <IncidentDef> .AllDefs)
                            {
                                list.Add(new FloatMenuOption(incedent.defName, delegate
                                {
                                    IncidentParms parms = new IncidentParms();
                                    parms.target        = Find.VisibleMap;
                                    incedent.Worker.TryExecute(parms);
                                }, MenuOptionPriority.Default, null, null, 0f, null, null));

                                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"Events.txt", true))
                                {
                                    file.WriteLine("public static RimteractiveEvent event" + incedent.defName + " = new RimteractiveEvent(\"" + incedent.defName + "\", \"" + incedent.description + "\", 0, true, false, 0f);");
                                }
                            }

                            FloatMenu floatMenu = new FloatMenu(list);
                            floatMenu.vanishIfMouseDistant = true;
                            Find.WindowStack.Add(floatMenu);

                            lastEventTime = Time.time;
                        }
                    }
                }
                return(true);
            }
Ejemplo n.º 2
0
        //fixes issue of portraits of pawns having blank portraits on first load of the game after boot
        public static void OnLoadPortraitsBugfix(ColonistBar __instance)
        {
            if (HarmonyPatches_BHair.colonistBarFirstDraw)
            {
                __instance.MarkColonistsDirty();

                List <Pawn> pawnList = __instance.GetColonistsInOrder();
                foreach (Pawn pawn in pawnList)
                {
                    pawn.Drawer.renderer.graphics.ResolveAllGraphics();
                    PortraitsCache.SetDirty(pawn);
                }

                HarmonyPatches_BHair.colonistBarFirstDraw = false;
            }
        }
        /// <summary>
        /// Gets groups that are visible on the colonist bar.
        /// </summary>
        /// <returns>Groups that are visible on the colonist bar.</returns>
        public static List <int> GetVisibleGroups(this ColonistBar colonistBar)
        {
            var entries      = GetVisibleEntriesFrom(colonistBar.Entries);
            var list         = new List <int>();
            int currentGroup = -1;

            foreach (var entry in entries)
            {
                if (currentGroup != entry.group)
                {
                    list.Add(entry.group);
                    currentGroup = entry.group;
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        static void DrawButtons()
        {
            if (Multiplayer.Client == null)
            {
                return;
            }

            ColonistBar bar = Find.ColonistBar;

            if (bar.Entries.Count == 0)
            {
                return;
            }

            int curGroup = -1;

            foreach (var entry in bar.Entries)
            {
                if (entry.map == null || curGroup == entry.group)
                {
                    continue;
                }

                float alpha = 1.0f;
                if (entry.map != Find.CurrentMap || WorldRendererUtility.WorldRenderedNow)
                {
                    alpha = 0.75f;
                }

                Rect rect      = bar.drawer.GroupFrameRect(entry.group);
                Rect button    = new Rect(rect.x - TimeControls.TimeButSize.x / 2f, rect.yMax - TimeControls.TimeButSize.y / 2f, TimeControls.TimeButSize.x, TimeControls.TimeButSize.y);
                var  asyncTime = entry.map.AsyncTime();

                if (Multiplayer.WorldComp.asyncTime)
                {
                    TimeControl.TimeControlButton(button, asyncTime, alpha);
                }
                else if (asyncTime.TickRateMultiplier(TimeSpeed.Normal) == 0f) // Blocking pause
                {
                    Widgets.DrawRectFast(button, new Color(1f, 0.5f, 0.5f, 0.4f * alpha));
                    Widgets.ButtonImage(button, TexButton.SpeedButtonTextures[0]);
                }

                curGroup = entry.group;
            }
        }
Ejemplo n.º 5
0
            public static void Listener(ColonistBar __instance, ref List <ColonistBar.Entry> ___cachedEntries, ref ColonistBarDrawLocsFinder ___drawLocsFinder,
                                        ref List <Vector2> ___cachedDrawLocs, ref float ___cachedScale)
            {
                try
                {
                    if (!Settings.hideInactiveSurrogates)
                    {
                        return;
                    }

                    List <ColonistBar.Entry> toDel = null;

                    foreach (var e in ___cachedEntries.Where(e => e.pawn.IsSurrogateAndroid(false, true)))
                    {
                        if (toDel == null)
                        {
                            toDel = new List <ColonistBar.Entry>();
                        }

                        toDel.Add(e);
                    }

                    if (toDel == null)
                    {
                        return;
                    }

                    {
                        foreach (var e in toDel)
                        {
                            ___cachedEntries.Remove(e);
                        }

                        __instance.drawer.Notify_RecachedEntries();

                        ___drawLocsFinder.CalculateDrawLocs(___cachedDrawLocs, out ___cachedScale);
                    }
                }
                catch (Exception e)
                {
                    Log.Message("[ATPP] Colonistbar.CheckRecacheEntries " + e.Message + " " + e.StackTrace);
                }
            }
Ejemplo n.º 6
0
            public static void Listener(ColonistBar __instance, ref List <ColonistBar.Entry> ___cachedEntries, ref ColonistBarDrawLocsFinder ___drawLocsFinder, ref List <Vector2> ___cachedDrawLocs, ref float ___cachedScale)
            {
                try
                {
                    if (!Settings.hideInactiveSurrogates)
                    {
                        return;
                    }

                    List <ColonistBar.Entry> toDel = null;
                    //Suppresssion de la barre du haut des surrogates non actifs
                    for (int i = 0; i < ___cachedEntries.Count; i++)
                    {
                        ColonistBar.Entry e = ___cachedEntries[i];
                        if (e.pawn.IsSurrogateAndroid(false, true))
                        {
                            if (toDel == null)
                            {
                                toDel = new List <ColonistBar.Entry>();
                            }

                            toDel.Add(e);
                        }
                    }
                    if (toDel != null)
                    {
                        for (int i = 0; i < toDel.Count; i++)
                        {
                            ColonistBar.Entry e = toDel[i];
                            ___cachedEntries.Remove(e);
                        }

                        __instance.drawer.Notify_RecachedEntries();

                        ___drawLocsFinder.CalculateDrawLocs(___cachedDrawLocs, out ___cachedScale);
                    }
                }
                catch (Exception e)
                {
                    Log.Message("[ATPP] Colonistbar.CheckRecacheEntries " + e.Message + " " + e.StackTrace);
                }
            }
Ejemplo n.º 7
0
        public static void Postfix(
            ColonistBarColonistDrawer __instance,
            Dictionary <string, string> ___pawnLabelsCache,
            Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering
            )
        {
            ColonistBar bar = Find.ColonistBar;
            //float num3 = 0; // Should relate to scale
            float num3 = 4f * bar.Scale;

            //float verticalOffset = 10f;
            //float verticalOffset = -48f;
            float verticalOffset = Settings.JobLabelVerticalOffset;

            Vector2 pos = new Vector2(rect.center.x, rect.yMax - num3 + verticalOffset);


            //GenMapUI.DrawPawnLabel(colonist, pos, 1f, rect.width + ColonistBar.BaseSpaceBetweenColonistsHorizontal - 2f, ___pawnLabelsCache, GameFont.Tiny, true, true);;
            //Rect bgRect = new Rect(pos.x - )
            DrawJobLabel(pos, colonist, rect.width + bar.SpaceBetweenColonistsHorizontal);
        }
Ejemplo n.º 8
0
        static void DrawButtons()
        {
            if (Multiplayer.Client == null)
            {
                return;
            }

            ColonistBar bar = Find.ColonistBar;

            if (bar.Entries.Count == 0 || bar.Entries.Last().group == 0)
            {
                return;
            }

            int curGroup = -1;

            foreach (var entry in bar.Entries)
            {
                if (entry.map == null || curGroup == entry.group)
                {
                    continue;
                }

                float alpha = 1.0f;
                if (entry.map != Find.CurrentMap || WorldRendererUtility.WorldRenderedNow)
                {
                    alpha = 0.75f;
                }

                Rect rect = bar.drawer.GroupFrameRect(entry.group);

                Rect button = new Rect(rect.x - TimeControls.TimeButSize.x / 2f, rect.yMax - TimeControls.TimeButSize.y / 2f, TimeControls.TimeButSize.x, TimeControls.TimeButSize.y);
                TimeControl.TimeControlButton(button, entry.map.AsyncTime(), alpha);

                curGroup = entry.group;
            }
        }
Ejemplo n.º 9
0
 public static void UpdateEntries(this ColonistBar bar, List <ColonistBar.Entry> newEntries)
 {
     _entries.Clear();
     _entries.AddRange(newEntries);
 }
Ejemplo n.º 10
0
 public static List <ColonistBar.Entry> GetEntries(this ColonistBar bar)
 {
     return(_entries);
 }
Ejemplo n.º 11
0
        static bool Prefix(ColonistBar __instance, ref bool ___entriesDirty, ref List <Map> ___tmpMaps, ref List <Pawn> ___tmpPawns, ref List <Caravan> ___tmpCaravans, ref List <ColonistBar.Entry> ___cachedEntries, ref ColonistBarDrawLocsFinder ___drawLocsFinder, ref List <Vector2> ___cachedDrawLocs, ref float ___cachedScale)
        {
            if (!___entriesDirty)
            {
                return(false);
            }
            ___entriesDirty = false;
            ___cachedEntries.Clear();
            if (Find.PlaySettings.showColonistBar)
            {
                ___tmpMaps.Clear();
                ___tmpMaps.AddRange((IEnumerable <Map>)Find.Maps);
                ___tmpMaps.SortBy <Map, bool, int>((Func <Map, bool>)(x => !x.IsPlayerHome), (Func <Map, int>)(x => x.uniqueID));
                int group = 0;
                for (int index1 = 0; index1 < ___tmpMaps.Count; ++index1)
                {
                    ___tmpPawns.Clear();
                    ___tmpPawns.AddRange(___tmpMaps[index1].mapPawns.FreeColonists);
                    List <Thing> thingList = ___tmpMaps[index1].listerThings.ThingsInGroup(ThingRequestGroup.Corpse);
                    for (int index2 = 0; index2 < thingList.Count; ++index2)
                    {
                        if (!thingList[index2].IsDessicated())
                        {
                            Pawn innerPawn = ((Corpse)thingList[index2]).InnerPawn;
                            if (innerPawn != null && innerPawn.IsColonist)
                            {
                                ___tmpPawns.Add(innerPawn);
                            }
                        }
                    }
                    List <Pawn> allPawnsSpawned = ___tmpMaps[index1].mapPawns.AllPawnsSpawned;
                    for (int index2 = 0; index2 < allPawnsSpawned.Count; ++index2)
                    {
                        Corpse carriedThing = allPawnsSpawned[index2].carryTracker.CarriedThing as Corpse;
                        if (carriedThing != null && !carriedThing.IsDessicated() && carriedThing.InnerPawn.IsColonist)
                        {
                            ___tmpPawns.Add(carriedThing.InnerPawn);
                        }
                    }
                    PlayerPawnsDisplayOrderUtility.Sort(___tmpPawns);
                    for (int index2 = 0; index2 < ___tmpPawns.Count; ++index2)
                    {
                        ___cachedEntries.Add(new ColonistBar.Entry(___tmpPawns[index2], ___tmpMaps[index1], group));
                    }
                    if (!___tmpPawns.Any <Pawn>())
                    {
                        ___cachedEntries.Add(new ColonistBar.Entry((Pawn)null, ___tmpMaps[index1], group));
                    }
                    ++group;
                }
                ___tmpCaravans.Clear();
                ___tmpCaravans.AddRange((IEnumerable <Caravan>)Find.WorldObjects.Caravans);
                ___tmpCaravans.SortBy <Caravan, int>((Func <Caravan, int>)(x => x.ID));
                for (int index1 = 0; index1 < ___tmpCaravans.Count; ++index1)
                {
                    //change from original
                    if (___tmpCaravans[index1].IsPlayerControlled && ___tmpCaravans[index1].pawns.Count != 0)
                    {
                        ___tmpPawns.Clear();
                        ___tmpPawns.AddRange((IEnumerable <Pawn>)___tmpCaravans[index1].PawnsListForReading);
                        PlayerPawnsDisplayOrderUtility.Sort(___tmpPawns);
                        for (int index2 = 0; index2 < ___tmpPawns.Count; ++index2)
                        {
                            if (___tmpPawns[index2].IsColonist)
                            {
                                ___cachedEntries.Add(new ColonistBar.Entry(___tmpPawns[index2], (Map)null, group));
                            }
                        }
                        ++group;
                    }
                }
            }
            __instance.drawer.Notify_RecachedEntries();
            ___tmpPawns.Clear();
            ___tmpMaps.Clear();
            ___tmpCaravans.Clear();
            ___drawLocsFinder.CalculateDrawLocs(___cachedDrawLocs, out ___cachedScale);

            return(false);
        }
Ejemplo n.º 12
0
        public static bool Prefix(ColonistBarColonistDrawer __instance,
                                  ref Rect rect, ref Pawn colonist, ref Map pawnMap,
                                  ref bool highlight, ref bool reordering)
        {
            ColonistBar colonistBar    = Find.ColonistBar;
            float       entryRectAlpha = colonistBar.GetEntryRectAlpha(rect);

            entryRectAlpha = ApplyEntryInAnotherMapAlphaFactor(pawnMap, entryRectAlpha);

            if (reordering)
            {
                entryRectAlpha *= 0.5f;
            }

            Color color = new Color(1f, 1f, 1f, entryRectAlpha);

            GUI.color = color;

            GUI.DrawTexture(rect, ColonistBar.BGTex);

            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;

                Texture2D moodTexture = getMoodTexture(ref colonist);
                GUI.DrawTexture(position, moodTexture);
            }

            if (highlight)
            {
                int thickness = (rect.width > 22f) ? 3 : 2;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color;
            }

            Rect rect2 = rect.ContractedBy(-2f * colonistBar.Scale);

            bool isColonistSelected = colonist.Dead ?
                                      Find.Selector.SelectedObjects.Contains(colonist.Corpse) :
                                      Find.Selector.SelectedObjects.Contains(colonist);

            if (isColonistSelected && !WorldRendererUtility.WorldRenderedNow)
            {
                Main.drawSelectionOverlayOnGUIMethod.Invoke(__instance, new object[] { colonist, rect2 });
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                Main.drawCaravanSelectionOverlayOnGUIMethod.Invoke(__instance, new object[] { colonist.GetCaravan(), rect2 });
            }

            Rect pawnTexturePosition = __instance.GetPawnTextureRect(new Vector2(rect.x, rect.y));

            GUI.DrawTexture(pawnTexturePosition, PortraitsCache.Get(colonist, ColonistBarColonistDrawer.PawnTextureSize,
                                                                    ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, entryRectAlpha * 0.8f);
            Main.drawIconsMethod.Invoke(__instance, new object[] { rect, colonist });
            GUI.color = color;

            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, (Texture)Main.deadColonistTexField.GetValue(null));
            }

            float   num2 = 4f * colonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, entryRectAlpha,
                                   rect.width + colonistBar.SpaceBetweenColonistsHorizontal - 2f,
                                   (Dictionary <string, string>)Main.pawnLabelsCacheField.GetValue(__instance),
                                   GameFont.Tiny, true, true);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;

            return(false);
        }
Ejemplo n.º 13
0
        public static void Prefix(ColonistBar __instance, ref List <ColonistBar.Entry> ___cachedEntries,
                                  ref List <Vector2> ___cachedDrawLocs)
        {
            try
            {
                if (___cachedDrawLocs.Count == ___cachedEntries.Count)
                {
                    for (int i = 0; i < ___cachedDrawLocs.Count; i++)
                    {
                        if (___cachedEntries[i].pawn == null && ___cachedEntries[i].map.Parent is MapParent_ZLevel)
                        {
                            //ZLogger.Message("Rect: " + ___cachedDrawLocs[i].x + " - " + ___cachedDrawLocs[i].y + " - "
                            //      + __instance.Size.x + " - " + __instance.Size.y);
                            Rect rect = new Rect(___cachedDrawLocs[i].x + (__instance.Size.x / 1.25f),
                                                 ___cachedDrawLocs[i].y + (__instance.Size.y / 1.25f),
                                                 __instance.Size.x / 3, __instance.Size.y / 3);
                            GUI.DrawTexture(rect, AbandonButtonTex);
                            if (Mouse.IsOver(rect))
                            {
                                if (Input.GetMouseButtonDown(0) && ___cachedEntries[i].map != null)
                                {
                                    Map map = ___cachedEntries[i].map;
                                    Find.WindowStack.Add(new Dialog_MessageBox("ZAbandonConfirmation".Translate(), "Yes".Translate(), delegate()
                                    {
                                        var comp        = map.GetComponent <MapComponentZLevel>();
                                        var pathToWrite = Path.Combine(Path.Combine(GenFilePaths.ConfigFolderPath,
                                                                                    "SavedMaps"), map.Tile + " - " + comp.Z_LevelIndex + ".xml");
                                        if (map.listerThings.AllThings.Count > 0)
                                        {
                                            BlueprintUtility.SaveEverything(pathToWrite, map, "SavedMap");
                                            ZLogger.Message("Removing map: " + map);
                                        }
                                        var parent   = map.Parent as MapParent_ZLevel;
                                        var ZTracker = ZUtils.ZTracker;
                                        parent.Abandon();
                                        ZTracker.ZLevelsTracker[map.Tile].ZLevels.Remove(comp.Z_LevelIndex);

                                        foreach (var map2 in Find.Maps)
                                        {
                                            var comp2 = map2.GetComponent <MapComponentZLevel>();
                                            if (ZTracker.ZLevelsTracker[map2.Tile] != null)
                                            {
                                                foreach (var d in ZTracker.ZLevelsTracker[map2.Tile].ZLevels)
                                                {
                                                    ZLogger.Message(map2 + ": " + d.Key + " - " + d.Value);
                                                }
                                            }
                                        }
                                    }, "No".Translate(), null, null, false, null, null));
                                }
                                else if (Input.GetMouseButtonDown(1) && ___cachedEntries[i].map != null)
                                {
                                    Map map = ___cachedEntries[i].map;
                                    Find.WindowStack.Add(new Dialog_MessageBox("ZAbandonPermanentlyConfirmation".Translate(), "Yes".Translate(), delegate()
                                    {
                                        var comp = map.GetComponent <MapComponentZLevel>();
                                        try
                                        {
                                            var pathToDelete = Path.Combine(Path.Combine(GenFilePaths.ConfigFolderPath,
                                                                                         "SavedMaps"), map.Tile + " - " + comp.Z_LevelIndex + ".xml");
                                            var file = new FileInfo(pathToDelete);
                                            file.Delete();
                                        }
                                        catch
                                        {
                                        }

                                        var parent   = map.Parent as MapParent_ZLevel;
                                        var ZTracker = ZUtils.ZTracker;
                                        parent.Abandon();
                                        ZTracker.ZLevelsTracker[map.Tile].ZLevels.Remove(comp.Z_LevelIndex);

                                        foreach (var map2 in Find.Maps)
                                        {
                                            var comp2 = map2.GetComponent <MapComponentZLevel>();
                                            if (ZTracker.ZLevelsTracker[map2.Tile] != null)
                                            {
                                                foreach (var d in ZTracker.ZLevelsTracker[map2.Tile].ZLevels)
                                                {
                                                    ZLogger.Message(map2 + ": " + d.Key + " - " + d.Value);
                                                }
                                            }
                                        }
                                    }, "No".Translate(), null, null, false, null, null));
                                }
                            }
                        }
                    }
                }
            }
            catch { };
        }
Ejemplo n.º 14
0
        public static bool Prefix(ColonistBarColonistDrawer __instance, ref Rect rect, ref Pawn colonist, ref Map pawnMap, ref bool highlight, ref bool reordering)
        {
            ColonistBar colonistBar = Find.ColonistBar;
            float       alpha       = ApplyEntryInAnotherMapAlphaFactor(pawnMap, colonistBar.GetEntryRectAlpha(rect));

            Rect pawnBackgroundSize = rect.ExpandedBy(2.5f);

            if (reordering)
            {
                alpha *= 0.5f;
            }
            Color color = new Color(1f, 1f, 1f, alpha);

            GUI.color = color;
            GUI.DrawTexture(rect, ColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = pawnBackgroundSize.ContractedBy(2f);
                float value    = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - value;
                position.height = value;


                float statValue = colonist.GetStatValue(StatDefOf.MentalBreakThreshold, true);

                float currentMoodLevel = colonist.needs.mood.CurLevel;


                // Extreme break threshold
                if (currentMoodLevel <= statValue)
                {
                    GUI.DrawTexture(position, Main.extremeBreakTex);
                }
                // Major break threshold
                else if (currentMoodLevel <= statValue + 0.15f)
                {
                    GUI.DrawTexture(position, Main.majorBreakTex);
                }
                // Minor break threshold
                else if (currentMoodLevel <= statValue + 0.3f)
                {
                    GUI.DrawTexture(position, Main.minorBreakTex);
                }
                // Neutral
                else if (currentMoodLevel <= 0.65f)
                {
                    GUI.DrawTexture(position, Main.neutralTex);
                }
                // Content
                else if (currentMoodLevel <= 0.9f)
                {
                    GUI.DrawTexture(position, Main.contentTex);
                }
                // Happy
                else
                {
                    GUI.DrawTexture(position, Main.happyTex);
                }
            }
            if (highlight)
            {
                int thickness = (rect.width > 22f) ? 3 : 2;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color;
            }
            Rect rect2 = rect.ContractedBy(-2f * colonistBar.Scale);
            bool notdeadandselected = (!colonist.Dead) ? Find.Selector.SelectedObjects.Contains(colonist) : Find.Selector.SelectedObjects.Contains(colonist.Corpse);

            if (notdeadandselected && !WorldRendererUtility.WorldRenderedNow)
            {
                Main.drawSelectionOverlayOnGUIMethod.Invoke(__instance, new object[] { colonist, rect2 });
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                Main.drawCaravanSelectionOverlayOnGUIMethod.Invoke(__instance, new object[] { colonist.GetCaravan(), rect2 });
            }
            GUI.DrawTexture(__instance.GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));

            GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);
            Main.drawIconsMethod.Invoke(__instance, new object[] { rect, colonist });
            GUI.color = color;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, (Texture)Main.deadColonistTexField.GetValue(__instance));
            }
            float   num3 = 4f * colonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num3);

            GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + colonistBar.SpaceBetweenColonistsHorizontal - 2f, (Dictionary <string, string>)Main.pawnLabelsCacheField.GetValue(__instance), GameFont.Tiny, true, true);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;

            return(false);
        }
 public static bool ShouldBeVisible(this ColonistBar colonistBar)
 {
     return(ShouldBeVisible(colonistBar.Entries));
 }
Ejemplo n.º 16
0
        static void DrawButtons()
        {
            if (Multiplayer.Client == null)
            {
                return;
            }

            ColonistBar bar = Find.ColonistBar;

            if (bar.Entries.Count == 0)
            {
                return;
            }

            int curGroup = -1;

            foreach (var entry in bar.Entries)
            {
                if (curGroup == entry.group)
                {
                    continue;
                }

                ITickable entryTickable = entry.map?.AsyncTime();
                if (entryTickable == null)
                {
                    entryTickable = Multiplayer.WorldComp;
                }

                Rect  groupBar = bar.drawer.GroupFrameRect(entry.group);
                float drawXPos = groupBar.x;
                Color bgColor  = (entryTickable.ActualRateMultiplier(TimeSpeed.Normal) == 0f) ? pauseBgColor : normalBgColor;

                if (Multiplayer.GameComp.asyncTime)
                {
                    Rect button = new Rect(drawXPos, groupBar.yMax, btnWidth, btnHeight);

                    if (entry.map != null)
                    {
                        TimeControl.TimeControlButton(button, bgColor, entryTickable);
                        drawXPos += TimeControls.TimeButSize.x;
                    }
                    else if (entryTickable.ActualRateMultiplier(TimeSpeed.Normal) == 0f)
                    {
                        TimeControl.TimeIndicateBlockingPause(button, bgColor);
                        drawXPos += TimeControls.TimeButSize.x;
                    }
                }
                else if (entryTickable.TickRateMultiplier(TimeSpeed.Normal) == 0f)
                {
                    Rect button = new Rect(drawXPos, groupBar.yMax, btnWidth, btnHeight);
                    TimeControl.TimeIndicateBlockingPause(button, bgColor);
                    drawXPos += TimeControls.TimeButSize.x;
                }

                List <FloatMenuOption> options = GetBlockingWindowOptions(entry, entryTickable);
                if (!options.NullOrEmpty())
                {
                    DrawWindowShortcuts(new Rect(drawXPos, groupBar.yMax, 70, btnHeight), bgColor, options);
                }

                curGroup = entry.group;
            }
        }
 public static List <ColonistBar.Entry> GetVisibleEntries(this ColonistBar colonistBar)
 {
     return(GetVisibleEntriesFrom(colonistBar.Entries));
 }