Esempio n. 1
0
        public void NonUniqueUrlThrowsException()
        {
            using (var kernel = TestHelper.CreateKernel()) {
                using (var session = kernel.Get<ISession>()) {
                    DatabaseHelper.GenerateDatabase(session);
                    // Create a duplicate url (parent/child)
                    HomePage home2 = new HomePage() { UrlSegment = "~" };
                    Page child2 = new Page() { UrlSegment = "child" };
                    home2.AddChildren(child2);
                    session.Save(home2);

                    IContentFinder contentFinder = new ContentFinder(session);
                    Assert.Throws<System.Exception>(()=>
                        contentFinder.Find<Page>("~/child")
                    );
                }
            }
        }
Esempio n. 2
0
        public void TestFind()
        {
            using (var kernel = TestHelper.CreateKernel()) {
                using (ISession session = kernel.Get<ISession>()) {

                    DatabaseHelper.GenerateDatabase(session);
                    IContentFinder contentFinder = new ContentFinder(session);

                    Page page = contentFinder.Find<Page>("~/child/grand-child");
                    Assert.NotNull(page);
                    Assert.Equal("Grand Child", page.Title);

                    page = contentFinder.Find<Page>("~");
                    Assert.NotNull(page);
                    Assert.Equal("Parent", page.Title);
                    Assert.Null(page.Parent);
                    Assert.IsType<HomePage>(page);

                    page = contentFinder.Find<Page>("~/child/other");
                    Assert.Null(page);
                }
            }
        }
Esempio n. 3
0
        static Dialog_Exchenge()
        {
            IconSkull = ContentFinder <Texture2D> .Get("Skull");

            IconDelTex = ContentFinder <Texture2D> .Get("OCDel");
        }
Esempio n. 4
0
 static Queue()
 {
     CircleFill = ContentFinder <Texture2D> .Get("UI/Research/circle-fill");
 }
Esempio n. 5
0
        //获取多人起跳
        public static Gizmo GetMulJump(Pawn pawn)
        {
            var command_Target = new Command_CastSkillTargetingFloor
            {
                self            = pawn,
                targetingParams = JumpTP(),
                defaultLabel    = "WarframeJumpGizmo.name".Translate(),
                defaultDesc     = "WarframeJumpGizmo.desc".Translate(),
                range           = 14f,
                icon            = ContentFinder <Texture2D> .Get("Skills/Jump"),
                cooldownTime    = 60,
                hotKey          = KeyBindingDefOf.Command_ItemForbid,
                disabled        = !pawn.Drafted || pawn.stances.stunner.Stunned
            };

            command_Target.action = delegate(Pawn _, LocalTargetInfo poc)
            {
                var enumerable = Find.Selector.SelectedObjects.Where(x =>
                                                                     x is Pawn {
                    IsColonistPlayerControlled: true, Drafted: true
                } pawn3&& pawn3.IsWarframe())
                                 .Cast <Pawn>();
                foreach (var pawn2 in enumerable)
                {
                    if (OutRange(command_Target.range, pawn2, poc.Cell.ToVector3()))
                    {
                        SoundDefOf.ClickReject.PlayOneShotOnCamera();
                        return;
                    }

                    if (!poc.Cell.Walkable(pawn2.Map))
                    {
                        Messages.Message("WFCantJumpToThere".Translate(), MessageTypeDefOf.RejectInput, false);
                        return;
                    }

                    var jtype = GetJumpType(pawn2, poc.Cell);


                    if (jtype == 0)
                    {
                        var wfroof = pawn2.Map.roofGrid.RoofAt(pawn2.Position);
                        if (wfroof != null)
                        {
                            if (wfroof != RoofDefOf.RoofConstructed)
                            {
                                Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false);
                                return;
                            }

                            if (!wfroof.soundPunchThrough.NullOrUndefined())
                            {
                                wfroof.soundPunchThrough.PlayOneShot(new TargetInfo(pawn2.Position, pawn2.Map));
                                var iterator = CellRect.CenteredOn(pawn2.Position, 1).GetIterator();
                                while (!iterator.Done())
                                {
                                    Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null);
                                    iterator.MoveNext();
                                }
                            }
                        }

                        var locroof = pawn2.Map.roofGrid.RoofAt(poc.Cell);
                        if (locroof != null)
                        {
                            if (locroof != RoofDefOf.RoofConstructed)
                            {
                                Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false);
                                return;
                            }

                            if (!locroof.soundPunchThrough.NullOrUndefined())
                            {
                                locroof.soundPunchThrough.PlayOneShot(new TargetInfo(poc.Cell, pawn2.Map));
                                var iterator = CellRect.CenteredOn(poc.Cell, 1).GetIterator();
                                while (!iterator.Done())
                                {
                                    Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null);
                                    iterator.MoveNext();
                                }
                            }
                        }
                    }


                    pawn2.pather.StartPath(poc, PathEndMode.Touch);
                    pawn2.Position = poc.Cell;

                    pawn2.pather.StopDead();
                    if (pawn2.jobs.curJob != null)
                    {
                        pawn2.jobs.curDriver.Notify_PatherArrived();
                    }

                    SoundDef.Named("Warframe_Jump").PlayOneShot(pawn2);
                    pawn2.stances.stunner.StunFor((int)command_Target.cooldownTime, pawn2);
                }
            };
            command_Target.finishAction = delegate
            {
                var enumerable = Find.Selector.SelectedObjects.Where(x =>
                                                                     x is Pawn {
                    IsColonistPlayerControlled: true, Drafted: true
                } pawn3&& pawn3.IsWarframe())
                                 .Cast <Pawn>();
                foreach (var pawn2 in enumerable)
                {
                    GenDraw.DrawRadiusRing(pawn2.Position,
                                           command_Target
                                           .range); //DrawFieldEdges(WarframeStaticMethods.getCellsAround(ck1.self.Position, ck1.self.Map, ck1.range));
                }
            };
            return(command_Target);
        }
Esempio n. 6
0
        public static Material GetHairMatFor(Pawn pawn, Rot4 facing)
        {
            // Define coverage-appropriate path
            var pathAppendString = "";

            // Find maximum coverage of non-mask headwear
            var maxCoverage = Coverage.None;

            foreach (var cur in pawn.apparel.WornApparel)
            {
                if (!cur.def.apparel.hatRenderedFrontOfFace)
                {
                    var coveredGroups = cur.def.apparel.bodyPartGroups;
                    var curCoverage   = Coverage.None;

                    // Find highest current max coverage
                    if (coveredGroups.Contains(BodyPartGroupDefOf.FullHead))
                    {
                        curCoverage = Coverage.FullHead;
                    }
                    else if (coveredGroups.Contains(BodyPartGroupDefOf.UpperHead))
                    {
                        curCoverage = Coverage.UpperHead;
                    }
                    else if (coveredGroups.Contains(BodyPartGroupDefOfDSYH.Teeth))
                    {
                        curCoverage = Coverage.Jaw;
                    }

                    // Compare to stored max coverage
                    if (maxCoverage < curCoverage)
                    {
                        maxCoverage = curCoverage;
                    }
                }
            }

            // Set path appendage
            if (maxCoverage != Coverage.None)
            {
                pathAppendString = maxCoverage.ToString();
            }

            // Set hair graphics to headgear-appropriate texture
            var texPath = pawn.story.hairDef.texPath;

            if (!pathAppendString.NullOrEmpty())
            {
                // Check if the path exists
                var newTexPath = texPath + "/" + pathAppendString;
                if (!ContentFinder <Texture2D> .Get(newTexPath + "_south", false))
                {
#if DEBUG
                    Log.Warning("DSYH :: could not find texture at " + texPath);
#endif
                    if (pathAppendString != "Jaw")
                    {
                        texPath = HairDefOf.Shaved.texPath;
                    }
                }
                else
                {
                    texPath = newTexPath;
                }
            }
            return(GraphicDatabase.Get <Graphic_Multi>(texPath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor).MatAt(facing)); // Set new graphic
        }
Esempio n. 7
0
        private static T GetInner <T>(GraphicRequest req, HeadCoverage coverage)
            where T : Graphic, new()
        {
            string oldPath = req.path;
            string name    = Path.GetFileNameWithoutExtension(oldPath);

            string newPath = MergedHairPath + name + "_" + coverage;

            req.path = newPath;

            if (AllGraphics.TryGetValue(req, out Graphic graphic))
            {
                return((T)graphic);
            }

            // no graphics found, create =>
            graphic = Activator.CreateInstance <T>();

            // // Check if textures already present and readable, else create
            if (ContentFinder <Texture2D> .Get(req.path + "_back", false) != null)
            {
                graphic.Init(req);

                // graphic.MatSouth.mainTexture = ContentFinder<Texture2D>.Get(newPath + "_front");
                // graphic.MatEast.mainTexture = ContentFinder<Texture2D>.Get(newPath + "_side");
                // graphic.MatNorth.mainTexture = ContentFinder<Texture2D>.Get(newPath + "_back");
            }
            else
            {
                req.path = oldPath;
                graphic.Init(req);

                Texture2D temptexturefront = graphic.MatSouth.mainTexture as Texture2D;
                Texture2D temptextureside  = graphic.MatEast.mainTexture as Texture2D;
                Texture2D temptextureback  = graphic.MatNorth.mainTexture as Texture2D;

                Texture2D temptextureside2 = (graphic as Graphic_Multi_Four)?.MatWest.mainTexture as Texture2D;

                temptexturefront = FaceTextures.MakeReadable(temptexturefront);
                temptextureside  = FaceTextures.MakeReadable(temptextureside);
                temptextureback  = FaceTextures.MakeReadable(temptextureback);

                temptextureside2 = FaceTextures.MakeReadable(temptextureside2);

                // new mask textures
                if (coverage == HeadCoverage.UpperHead)
                {
                    _maskTexFrontBack = FaceTextures.MaskTexUppherheadFrontBack;
                    _maskTexSide      = FaceTextures.MaskTexUpperheadSide;
                }
                else
                {
                    _maskTexFrontBack = FaceTextures.MaskTexFullheadFrontBack;
                    _maskTexSide      = FaceTextures.MaskTexFullheadSide;
                }


                CutOutHair(ref temptexturefront, _maskTexFrontBack);

                CutOutHair(ref temptextureside, _maskTexSide);

                CutOutHair(ref temptextureback, _maskTexFrontBack);

                CutOutHair(ref temptextureside2, _maskTexSide);

                req.path = newPath;

                // if (!name.NullOrEmpty() && !File.Exists(req.path + "_front.png"))
                // {
                // byte[] bytes = temptexturefront.EncodeToPNG();
                // File.WriteAllBytes(req.path + "_front.png", bytes);
                // byte[] bytes2 = temptextureside.EncodeToPNG();
                // File.WriteAllBytes(req.path + "_side.png", bytes2);
                // byte[] bytes3 = temptextureback.EncodeToPNG();
                // File.WriteAllBytes(req.path + "_back.png", bytes3);
                // }
                temptexturefront.Compress(true);
                temptextureside.Compress(true);
                temptextureback.Compress(true);
                temptextureside2.Compress(true);

                temptexturefront.mipMapBias = 0.5f;
                temptextureside.mipMapBias  = 0.5f;
                temptextureback.mipMapBias  = 0.5f;
                temptextureside2.mipMapBias = 0.5f;

                temptexturefront.Apply(false, true);
                temptextureside.Apply(false, true);
                temptextureback.Apply(false, true);
                temptextureside2.Apply(false, true);

                graphic.MatSouth.mainTexture = temptexturefront;
                graphic.MatEast.mainTexture  = temptextureside;
                graphic.MatNorth.mainTexture = temptextureback;
                ((Graphic_Multi_Four)graphic).MatWest.mainTexture = temptextureside2;

                // Object.Destroy(temptexturefront);
                // Object.Destroy(temptextureside);
                // Object.Destroy(temptextureback);
            }

            AllGraphics.Add(req, graphic);

            // }
            return((T)graphic);
        }
Esempio n. 8
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            Command_Action mineMode = new Command_Action()
            {
                icon          = this.icon,
                defaultLabel  = this.defaultLabel,
                defaultDesc   = defaultDesc,
                hotKey        = KeyBindingDefOf.Misc10,
                activateSound = SoundDefOf.Click,
                action        = delegate()
                {
                    Find.WindowStack.Add(MakeModeMenu(this));
                },
            };

            // Only allow this option if stonecutting has been researched
            // The default behavior is to allow resources, but not blocks
            if (!QuarryDefOf.Stonecutting.IsFinished)
            {
                mineMode.Disable(Static.ReportGizmoLackingResearch);
            }
            yield return(mineMode);

            yield return(new Command_Toggle()
            {
                icon = Static.DesignationHaul,
                defaultLabel = Static.LabelHaulMode,
                defaultDesc = HaulDescription,
                hotKey = KeyBindingDefOf.Misc11,
                activateSound = SoundDefOf.Click,
                isActive = () => autoHaul,
                toggleAction = () => ToggleAutoHaul(),
            });

            yield return(new Command_Action
            {
                defaultLabel = Static.CommandBedSetOwnerLabel,
                icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true),
                defaultDesc = Static.CommandSetOwnerDesc,
                action = delegate
                {
                    Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this.TryGetComp <CompAssignableToPawn>()));
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            IEnumerator <Gizmo> enumerator = null;

            if (((this.def.BuildableByPlayer && this.def.passability != Traversability.Impassable && !this.def.IsDoor) || this.def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(this.def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command command2 in BuildFacilityCommandUtility.BuildFacilityCommands(this.def))
                {
                    yield return(command2);
                }
                IEnumerator <Command> enumerator2 = null;
            }
            if (forbiddable != null)
            {
                foreach (Gizmo item in forbiddable.CompGetGizmosExtra())
                {
                    yield return(item);
                }
                ;
            }
            yield break;
        }
 public bool EarPatchLeftTexExists()
 {
     return(!ContentFinder <Texture2D> .Get(this._compFace.TexPathEarLeftPatch + STR_south, false)
            .NullOrBad());
 }
        private void DrawThingRow(ref float y, float width, Thing thing, bool inventory = false)
        {
            Rect rect = new Rect(0f, y, width, 28f);

            Widgets.InfoCardButton(rect.width - 24f, y, thing);
            rect.width -= 24f;
            if (this.CanControl && (inventory || this.CanControlColonist || (this.SelPawnForGear.Spawned && !this.SelPawnForGear.Map.IsPlayerHome)))
            {
                Rect rect2 = new Rect(rect.width - 24f, y, 24f, 24f);
                TooltipHandler.TipRegion(rect2, "DropThing".Translate());
                if (Widgets.ButtonImage(rect2, ContentFinder <Texture2D> .Get("UI/Buttons/Drop", true)))
                {
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                    this.InterfaceDrop(thing);
                }
                rect.width -= 24f;
            }
            if (this.CanControlColonist)
            {
                if ((thing.def.IsNutritionGivingIngestible || thing.def.IsNonMedicalDrug) && thing.IngestibleNow && base.SelPawn.WillEat(thing, null))
                {
                    Rect rect3 = new Rect(rect.width - 24f, y, 24f, 24f);
                    TooltipHandler.TipRegion(rect3, "ConsumeThing".Translate(thing.LabelNoCount, thing));
                    if (Widgets.ButtonImage(rect3, ContentFinder <Texture2D> .Get("UI/Buttons/Ingest", true)))
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        this.InterfaceIngest(thing);
                    }
                }
                rect.width -= 24f;
            }
            Rect rect4 = rect;

            rect4.xMin = rect4.xMax - 60f;
            CaravanThingsTabUtility.DrawMass(thing, rect4);
            rect.width -= 60f;
            if (Mouse.IsOver(rect))
            {
                GUI.color = Sandy_Detailed_RPG_GearTab.HighlightColor;
                GUI.DrawTexture(rect, TexUI.HighlightTex);
            }
            if (thing.def.DrawMatSingle != null && thing.def.DrawMatSingle.mainTexture != null)
            {
                Widgets.ThingIcon(new Rect(4f, y, 28f, 28f), thing, 1f);
            }
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.color   = Sandy_Detailed_RPG_GearTab.ThingLabelColor;
            Rect    rect5   = new Rect(36f, y, rect.width - 36f, rect.height);
            string  text    = thing.LabelCap;
            Apparel apparel = thing as Apparel;

            if (apparel != null && this.SelPawnForGear.outfits != null && this.SelPawnForGear.outfits.forcedHandler.IsForced(apparel))
            {
                text = text + ", " + "ApparelForcedLower".Translate();
            }
            Text.WordWrap = false;
            Widgets.Label(rect5, text.Truncate(rect5.width, null));
            Text.WordWrap = true;
            string text2 = thing.DescriptionDetailed;

            if (thing.def.useHitPoints)
            {
                string text3 = text2;
                text2 = string.Concat(new object[]
                {
                    text3,
                    "\n",
                    thing.HitPoints,
                    " / ",
                    thing.MaxHitPoints
                });
            }
            TooltipHandler.TipRegion(rect, text2);
            y += 28f;
        }
        private void DrawThingRow1(Rect rect, Thing thing, bool inventory = false)
        {
            QualityCategory c;

            if (thing.TryGetQuality(out c))
            {
                switch (c)
                {
                case QualityCategory.Legendary:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Legendary", true));
                    break;
                }

                case QualityCategory.Masterwork:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Masterwork", true));
                    break;
                }

                case QualityCategory.Excellent:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Excellent", true));
                    break;
                }

                case QualityCategory.Good:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Good", true));
                    break;
                }

                case QualityCategory.Normal:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Normal", true));
                    break;
                }

                case QualityCategory.Poor:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Poor", true));
                    break;
                }

                case QualityCategory.Awful:
                {
                    GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("UI/Frames/RPG_Awful", true));
                    break;
                }
                }
            }
            float  mass  = thing.GetStatValue(StatDefOf.Mass, true) * (float)thing.stackCount;
            string smass = mass.ToString("G") + " kg";
            string text  = thing.LabelCap;
            Rect   rect5 = rect.ContractedBy(2f);
            float  num2  = rect5.height * ((float)thing.HitPoints / (float)thing.MaxHitPoints);

            rect5.yMin   = rect5.yMax - num2;
            rect5.height = num2;
            GUI.DrawTexture(rect5, ContentFinder <Texture2D> .Get("UI/Buttons/Sandy_Not_Tattered", true));
            if ((float)thing.HitPoints <= ((float)thing.MaxHitPoints / 2))
            {
                Rect tattered = rect5;
                GUI.DrawTexture(rect5, ContentFinder <Texture2D> .Get("UI/Buttons/Sandy_Tattered", true));
            }
            if (thing.def.DrawMatSingle != null && thing.def.DrawMatSingle.mainTexture != null)
            {
                Rect rect1 = new Rect(rect.x + 4f, rect.y + 4f, rect.width - 8f, rect.height - 8f);
                Widgets.ThingIcon(rect1, thing, 1f);
            }
            if (Mouse.IsOver(rect))
            {
                GUI.color = Sandy_Detailed_RPG_GearTab.HighlightColor;
                GUI.DrawTexture(rect, TexUI.HighlightTex);
                Widgets.InfoCardButton(rect.x, rect.y, thing);
                if (this.CanControl && (inventory || this.CanControlColonist || (this.SelPawnForGear.Spawned && !this.SelPawnForGear.Map.IsPlayerHome)))
                {
                    Rect rect2 = new Rect(rect.xMax - 24f, rect.y, 24f, 24f);
                    TooltipHandler.TipRegion(rect2, "DropThing".Translate());
                    if (Widgets.ButtonImage(rect2, ContentFinder <Texture2D> .Get("UI/Buttons/Drop", true)))
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        this.InterfaceDrop(thing);
                    }
                }
            }
            Apparel apparel = thing as Apparel;

            if (apparel != null && this.SelPawnForGear.outfits != null && apparel.WornByCorpse)
            {
                Rect rect3 = new Rect(rect.xMax - 20f, rect.yMax - 20f, 20f, 20f);
                GUI.DrawTexture(rect3, ContentFinder <Texture2D> .Get("UI/Icons/Sandy_Tainted_Icon", true));
                TooltipHandler.TipRegion(rect3, "WasWornByCorpse".Translate());
            }
            if (apparel != null && this.SelPawnForGear.outfits != null && this.SelPawnForGear.outfits.forcedHandler.IsForced(apparel))
            {
                text = text + ", " + "ApparelForcedLower".Translate();
                Rect rect4 = new Rect(rect.x, rect.yMax - 20f, 20f, 20f);
                GUI.DrawTexture(rect4, ContentFinder <Texture2D> .Get("UI/Icons/Sandy_Forced_Icon", true));
                TooltipHandler.TipRegion(rect4, "ForcedApparel".Translate());
            }
            Text.WordWrap = true;
            string text2 = thing.DescriptionDetailed;
            string text3 = text + "\n" + text2 + "\n" + smass;

            if (thing.def.useHitPoints)
            {
                string text4 = text3;
                text3 = string.Concat(new object[]
                {
                    text4,
                    "\n",
                    thing.HitPoints,
                    " / ",
                    thing.MaxHitPoints
                });
            }
            TooltipHandler.TipRegion(rect, text3);
        }
        protected override void FillTab()
        {
            Text.Font = GameFont.Small;
            Rect rect0 = new Rect(20f, 0f, 100f, 30f);

            Widgets.CheckboxLabeled(rect0, "Sandy_ViewList".Translate(), ref viewlist, false, null, null, false);
            Rect rect     = new Rect(0f, 20f, this.size.x, this.size.y - 20f);
            Rect rect2    = rect.ContractedBy(10f);
            Rect position = new Rect(rect2.x, rect2.y, rect2.width, rect2.height);

            GUI.BeginGroup(position);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
            Rect outRect  = new Rect(0f, 0f, position.width, position.height);
            Rect viewRect = new Rect(0f, 0f, position.width - 20f, this.scrollViewHeight);

            Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect, true);
            float num = 0f;

            if (!viewlist)
            {
                if (this.SelPawnForGear.RaceProps.Humanlike)
                {
                    Rect rectstat = new Rect(374f, 0f, 128f, 50f);
                    this.TryDrawMassInfo1(rectstat);
                    this.TryDrawComfyTemperatureRange1(rectstat);
                }
                else
                {
                    this.TryDrawMassInfo(ref num, viewRect.width);
                    this.TryDrawComfyTemperatureRange(ref num, viewRect.width);
                }
            }
            else if (viewlist)
            {
                this.TryDrawMassInfo(ref num, viewRect.width);
                this.TryDrawComfyTemperatureRange(ref num, viewRect.width);
            }
            if (this.ShouldShowOverallArmor(this.SelPawnForGear) && !viewlist && this.SelPawnForGear.RaceProps.Humanlike)
            {
                Rect rectarmor = new Rect(374f, 84f, 128f, 85f);
                TooltipHandler.TipRegion(rectarmor, "OverallArmor".Translate());
                Rect rectsharp = new Rect(rectarmor.x, rectarmor.y, rectarmor.width, 27f);
                this.TryDrawOverallArmor1(rectsharp, StatDefOf.ArmorRating_Sharp, "ArmorSharp".Translate(),
                                          ContentFinder <Texture2D> .Get("UI/Icons/Sandy_ArmorSharp_Icon", true));
                Rect rectblunt = new Rect(rectarmor.x, rectarmor.y + 30f, rectarmor.width, 27f);
                this.TryDrawOverallArmor1(rectblunt, StatDefOf.ArmorRating_Blunt, "ArmorBlunt".Translate(),
                                          ContentFinder <Texture2D> .Get("UI/Icons/Sandy_ArmorBlunt_Icon", true));
                Rect rectheat = new Rect(rectarmor.x, rectarmor.y + 60f, rectarmor.width, 27f);
                this.TryDrawOverallArmor1(rectheat, StatDefOf.ArmorRating_Heat, "ArmorHeat".Translate(),
                                          ContentFinder <Texture2D> .Get("UI/Icons/Sandy_ArmorHeat_Icon", true));
            }
            else if (this.ShouldShowOverallArmor(this.SelPawnForGear))
            {
                Widgets.ListSeparator(ref num, viewRect.width, "OverallArmor".Translate());
                this.TryDrawOverallArmor(ref num, viewRect.width, StatDefOf.ArmorRating_Sharp, "ArmorSharp".Translate());
                this.TryDrawOverallArmor(ref num, viewRect.width, StatDefOf.ArmorRating_Blunt, "ArmorBlunt".Translate());
                this.TryDrawOverallArmor(ref num, viewRect.width, StatDefOf.ArmorRating_Heat, "ArmorHeat".Translate());
            }
            if (this.IsVisible && this.SelPawnForGear.RaceProps.Humanlike && !viewlist)
            {
                //Hats
                Rect newRect1 = new Rect(150f, 0f, 64f, 64f);
                GUI.DrawTexture(newRect1, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                Rect tipRect1 = newRect1.ContractedBy(12f);
                TooltipHandler.TipRegion(tipRect1, "Sandy_Head".Translate());
                //Vests
                Rect newRect2 = new Rect(76f, 148f, 64f, 64f);
                GUI.DrawTexture(newRect2, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                Rect tipRect2 = newRect2.ContractedBy(12f);
                TooltipHandler.TipRegion(tipRect2, "Sandy_TorsoMiddle".Translate());
                //Shirts
                Rect newRect3 = new Rect(150f, 148f, 64f, 64f);
                GUI.DrawTexture(newRect3, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                Rect tipRect3 = newRect3.ContractedBy(12f);
                TooltipHandler.TipRegion(tipRect3, "Sandy_TorsoOnSkin".Translate());
                //Dusters
                Rect newRect4 = new Rect(224f, 148f, 64f, 64f);
                GUI.DrawTexture(newRect4, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                Rect tipRect4 = newRect4.ContractedBy(12f);
                TooltipHandler.TipRegion(tipRect4, "Sandy_TorsoShell".Translate());
                //Belts
                Rect newRect5 = new Rect(150f, 222f, 64f, 64f);
                GUI.DrawTexture(newRect5, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                Rect tipRect5 = newRect5.ContractedBy(12f);
                TooltipHandler.TipRegion(tipRect5, "Sandy_Belt".Translate());
                //Pants
                Rect newRect6 = new Rect(150f, 296f, 64f, 64f);
                GUI.DrawTexture(newRect6, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                Rect tipRect6 = newRect6.ContractedBy(12f);
                TooltipHandler.TipRegion(tipRect6, "Sandy_Pants".Translate());
                Color color = new Color(1f, 1f, 1f, 1f);
                GUI.color = color;
                //Pawn
                Rect PawnRect = new Rect(374f, 172f, 128f, 128f);
                this.DrawColonist(PawnRect, this.SelPawnForGear);
            }
            if (this.ShouldShowEquipment(this.SelPawnForGear) && !viewlist && this.SelPawnForGear.RaceProps.Humanlike)
            {
                foreach (ThingWithComps current in this.SelPawnForGear.equipment.AllEquipmentListForReading)
                {
                    if (current == this.SelPawnForGear.equipment.Primary)
                    {
                        Rect newRect = new Rect(406f, 296f, 64f, 64f);
                        GUI.DrawTexture(newRect, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRect, current, false);
                        if (this.SelPawnForGear.story.traits.HasTrait(TraitDefOf.Brawler) && this.SelPawnForGear.equipment.Primary != null && this.SelPawnForGear.equipment.Primary.def.IsRangedWeapon)
                        {
                            Rect rect6 = new Rect(newRect.x, newRect.yMax - 20f, 20f, 20f);
                            GUI.DrawTexture(rect6, ContentFinder <Texture2D> .Get("UI/Icons/Sandy_Forced_Icon", true));
                            TooltipHandler.TipRegion(rect6, "BrawlerHasRangedWeapon".Translate());
                        }
                    }
                    if (current != this.SelPawnForGear.equipment.Primary)
                    {
                        Rect newRect1 = new Rect(406f, 370f, 64f, 64f);
                        GUI.DrawTexture(newRect1, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRect1, current, false);
                        if (this.SelPawnForGear.story.traits.HasTrait(TraitDefOf.Brawler) && this.SelPawnForGear.equipment.Primary != null && current.def.IsRangedWeapon)
                        {
                            Rect rect6 = new Rect(newRect1.x, newRect1.yMax - 20f, 20f, 20f);
                            GUI.DrawTexture(rect6, ContentFinder <Texture2D> .Get("UI/Icons/Sandy_Forced_Icon", true));
                            TooltipHandler.TipRegion(rect6, "BrawlerHasRangedWeapon".Translate());
                        }
                    }
                }
            }
            else if (this.ShouldShowEquipment(this.SelPawnForGear))
            {
                Widgets.ListSeparator(ref num, viewRect.width, "Equipment".Translate());
                foreach (ThingWithComps thing in this.SelPawnForGear.equipment.AllEquipmentListForReading)
                {
                    this.DrawThingRow(ref num, viewRect.width, thing, false);
                }
            }
            if (this.ShouldShowApparel(this.SelPawnForGear) && !viewlist && this.SelPawnForGear.RaceProps.Humanlike)
            {
                foreach (Apparel current2 in this.SelPawnForGear.apparel.WornApparel)
                {
                    /*switch (current2.def.apparel)
                     * {
                     *      case ApparelProperties a when (a.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead) || a.bodyPartGroups.Contains(BodyPartGroupDefOf.FullHead)
                     *      && a.layers.Contains(ApparelLayerDefOf.Overhead)):
                     *      break;
                     * }*/
                    switch (current2.def.apparel)
                    {
                    //Head
                    case ApparelProperties a when((a.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead) || a.bodyPartGroups.Contains(BodyPartGroupDefOf.FullHead)) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Overhead)):
                        Rect newRectHe = new Rect(150f, 0f, 64f, 64f);

                        this.DrawThingRow1(newRectHe, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Eyes) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Overhead)):
                        Rect newRectEy = new Rect(224f, 0f, 64f, 64f);

                        GUI.DrawTexture(newRectEy, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectEy, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Teeth) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Overhead) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Eyes)):
                        Rect newRectTe = new Rect(76f, 0f, 64f, 64f);

                        GUI.DrawTexture(newRectTe, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectTe, current2, false);
                        break;

                    //Torso
                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && !a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Middle)):
                        Rect newRectTm = new Rect(76f, 148f, 64f, 64f);

                        this.DrawThingRow1(newRectTm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && a.layers.Contains(ApparelLayerDefOf.OnSkin) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Middle) && !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectTo = new Rect(150f, 148f, 64f, 64f);

                        this.DrawThingRow1(newRectTo, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectTs = new Rect(224f, 148f, 64f, 64f);

                        this.DrawThingRow1(newRectTs, current2, false);
                        break;

                    //Field Medic Patch
                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && a.layers.Contains(ApparelLayerDefOf.Belt)):
                        Rect newRectTb = new Rect(76f, 222f, 64f, 64f);

                        this.DrawThingRow1(newRectTb, current2, false);
                        break;

                    //Belt
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Waist) && a.layers.Contains(ApparelLayerDefOf.Belt)):
                        Rect newRectWb = new Rect(150f, 222f, 64f, 64f);

                        this.DrawThingRow1(newRectWb, current2, false);
                        break;

                    //Jetpack
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Waist) && a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectWs = new Rect(224f, 222f, 64f, 64f);

                        GUI.DrawTexture(newRectWs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectWs, current2, false);
                        break;

                    //Legs
                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) && a.layers.Contains(ApparelLayerDefOf.Middle) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Shell) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectLm = new Rect(76f, 296f, 64f, 64f);

                        GUI.DrawTexture(newRectLm, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectLm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) && !a.layers.Contains(ApparelLayerDefOf.Middle) &&
                                                  a.layers.Contains(ApparelLayerDefOf.OnSkin) && !a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectLo = new Rect(150f, 296f, 64f, 64f);

                        this.DrawThingRow1(newRectLo, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) && a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectLs = new Rect(224f, 296f, 64f, 64f);

                        GUI.DrawTexture(newRectLs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectLs, current2, false);
                        break;

                    //Feet
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Feet) && !a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Middle) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)):
                        Rect newRectFm = new Rect(76f, 370f, 64f, 64f);

                        GUI.DrawTexture(newRectFm, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectFm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Feet) && a.layers.Contains(ApparelLayerDefOf.OnSkin) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Shell) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Middle)):
                        Rect newRectFo = new Rect(150f, 370f, 64f, 64f);

                        GUI.DrawTexture(newRectFo, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectFo, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Feet) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) &&
                                                  (a.layers.Contains(ApparelLayerDefOf.Shell) || a.layers.Contains(ApparelLayerDefOf.Overhead))):
                        Rect newRectFs = new Rect(224f, 370f, 64f, 64f);

                        GUI.DrawTexture(newRectFs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectFs, current2, false);
                        break;

                    //Hands
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Middle) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectHm = new Rect(10f, 126f, 56f, 56f);

                        GUI.DrawTexture(newRectHm, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectHm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  (a.layers.Contains(ApparelLayerDefOf.Shell) || a.layers.Contains(ApparelLayerDefOf.Overhead))):
                        Rect newRectHs = new Rect(10f, 63f, 56f, 56f);

                        GUI.DrawTexture(newRectHs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectHs, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  a.layers.Contains(ApparelLayerDefOf.OnSkin) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Middle) && !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectHo = new Rect(10f, 189f, 56f, 56f);

                        GUI.DrawTexture(newRectHo, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectHo, current2, false);
                        break;

                    //Shoulders
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) && !a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Middle) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.RightHand)):
                        Rect newRectSm = new Rect(298f, 189f, 56f, 56f);

                        GUI.DrawTexture(newRectSm, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectSm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) && a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.RightHand)):
                        Rect newRectSs = new Rect(298f, 126f, 56f, 56f);

                        GUI.DrawTexture(newRectSs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectSs, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) && !a.layers.Contains(ApparelLayerDefOf.Shell) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) &&
                                                  a.layers.Contains(ApparelLayerDefOf.OnSkin) && !a.layers.Contains(ApparelLayerDefOf.Middle) &&
                                                  !a.bodyPartGroups.Contains(BodyPartGroupDefOf.RightHand)):
                        Rect newRectSo = new Rect(298f, 63f, 56f, 56f);

                        GUI.DrawTexture(newRectSo, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectSo, current2, false);
                        break;

                    //RightHand
                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.RightHand) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Middle) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectRHm = new Rect(298f, 315f, 56f, 56f);

                        GUI.DrawTexture(newRectRHm, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectRHm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.RightHand) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Shell) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectRHs = new Rect(298f, 378f, 56f, 56f);

                        GUI.DrawTexture(newRectRHs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectRHs, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.RightHand) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) &&
                                                  a.layers.Contains(ApparelLayerDefOf.OnSkin) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Middle) && !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectRHo = new Rect(298f, 252f, 56f, 56f);

                        GUI.DrawTexture(newRectRHo, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectRHo, current2, false);
                        break;

                    //LeftHand
                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Middle) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectLHm = new Rect(10f, 315f, 56f, 56f);

                        GUI.DrawTexture(newRectLHm, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectLHm, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Shell) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectLHs = new Rect(10f, 378f, 56f, 56f);

                        GUI.DrawTexture(newRectLHs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectLHs, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Hands) &&
                                                  a.layers.Contains(ApparelLayerDefOf.OnSkin) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) &&
                                                  !a.layers.Contains(ApparelLayerDefOf.Middle) && !a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectLHo = new Rect(10f, 252f, 56f, 56f);

                        GUI.DrawTexture(newRectLHo, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectLHo, current2, false);
                        break;

                    //Neck
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Neck) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Belt) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectNb = new Rect(76f, 74f, 64f, 64f);

                        GUI.DrawTexture(newRectNb, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectNb, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Neck) && !a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Shoulders) &&
                                                  a.layers.Contains(ApparelLayerDefOf.Overhead) && !a.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)):
                        Rect newRectNo = new Rect(150f, 74f, 64f, 64f);

                        GUI.DrawTexture(newRectNo, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectNo, current2, false);
                        break;

                    //Cape
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Neck) && a.layers.Contains(ApparelLayerDefOf.Shell)):
                        Rect newRectNs = new Rect(224f, 74f, 64f, 64f);

                        GUI.DrawTexture(newRectNs, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectNs, current2, false);
                        break;

                    //this part add jewelry support
                    //They currently overlape with some apparello 2 stuff
                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Neck) && (a.layers.Contains(Sandy_Gear_DefOf.Accessories))):
                        Rect newRectNa = new Rect(76f, 74f, 64f, 64f);

                        GUI.DrawTexture(newRectNa, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectNa, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(Sandy_Gear_DefOf.Ears) && (a.layers.Contains(Sandy_Gear_DefOf.Accessories))):
                        Rect newRectEa = new Rect(298f, 0f, 56f, 56f);

                        GUI.DrawTexture(newRectEa, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectEa, current2, false);
                        break;

                    case ApparelProperties a when(a.bodyPartGroups.Contains(BodyPartGroupDefOf.LeftHand) && (a.layers.Contains(Sandy_Gear_DefOf.Accessories))):
                        Rect newRectLHa = new Rect(10f, 0f, 56f, 56f);

                        GUI.DrawTexture(newRectLHa, ContentFinder <Texture2D> .Get("UI/Widgets/DesButBG", true));
                        this.DrawThingRow1(newRectLHa, current2, false);
                        break;
                    }
                }
            }
            else if (this.ShouldShowApparel(this.SelPawnForGear))
            {
                Widgets.ListSeparator(ref num, viewRect.width, "Apparel".Translate());
                foreach (Apparel thing2 in from ap in this.SelPawnForGear.apparel.WornApparel
                         orderby ap.def.apparel.bodyPartGroups[0].listOrder descending
                         select ap)
                {
                    this.DrawThingRow(ref num, viewRect.width, thing2, false);
                }
            }
            if (this.ShouldShowInventory(this.SelPawnForGear))
            {
                if (this.SelPawnForGear.RaceProps.Humanlike && !viewlist)
                {
                    num = 440f;
                }
                else if (!this.SelPawnForGear.RaceProps.Humanlike && !viewlist)
                {
                    num = 44f;
                }
                Widgets.ListSeparator(ref num, viewRect.width, "Inventory".Translate());
                Sandy_Detailed_RPG_GearTab.workingInvList.Clear();
                Sandy_Detailed_RPG_GearTab.workingInvList.AddRange(this.SelPawnForGear.inventory.innerContainer);
                for (int i = 0; i < Sandy_Detailed_RPG_GearTab.workingInvList.Count; i++)
                {
                    this.DrawThingRow(ref num, viewRect.width, Sandy_Detailed_RPG_GearTab.workingInvList[i], true);
                }
                Sandy_Detailed_RPG_GearTab.workingInvList.Clear();
            }
            if (Event.current.type == EventType.Layout)
            {
                this.scrollViewHeight = num + 30f;
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
        }
Esempio n. 13
0
 static Resources()
 {
     //MISSING
     MissingTexture = ContentFinder <Texture2D> .Get("UI/ArchitectIcons/Default/wrongsign");
 }
        // From original
        public override IEnumerable <Gizmo> GetGizmos()
        {
            // Do base gizmos
            foreach (var c in base.GetGizmos())
            {
                yield return(c);
            }

            if (gun != null)
            {
                if (this.CanSetForcedTarget && GunCompEq != null && GunCompEq.PrimaryVerb != null)
                {
                    //Command_VerbTarget_TurretWeaponBase attack = new Command_VerbTarget_TurretWeaponBase();
                    Command_VerbTarget attack = new Command_VerbTarget();
                    attack.defaultLabel = "CommandSetForceAttackTarget".Translate();
                    attack.defaultDesc  = "CommandSetForceAttackTargetDesc".Translate();
                    attack.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true);

                    attack.verb   = GunCompEq.PrimaryVerb;
                    attack.hotKey = KeyBindingDefOf.Misc4; //N
                    yield return(attack);
                }

                if (this.forcedTarget.IsValid)
                {
                    Command_Action stop = new Command_Action();
                    stop.defaultLabel = "CommandStopForceAttack".Translate();
                    stop.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                    stop.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                    stop.action = delegate
                    {
                        ResetForcedTarget();
                        SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                    };
                    if (!this.forcedTarget.IsValid)
                    {
                        stop.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                    }
                    stop.hotKey = KeyBindingDefOf.Misc5;
                    yield return(stop);
                }

                if (this.CanToggleHoldFire)
                {
                    yield return(new Command_Toggle
                    {
                        defaultLabel = "CommandHoldFire".Translate(),
                        defaultDesc = "CommandHoldFireDesc".Translate(),
                        icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                        hotKey = KeyBindingDefOf.Misc6,
                        toggleAction = delegate
                        {
                            holdFire = !holdFire;
                            if (holdFire)
                            {
                                ResetForcedTarget();
                            }
                        },
                        isActive = (() => holdFire)
                    });
                }
            }
        }
Esempio n. 15
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (Building != null || Pawn != null)
            {
                int  num  = 600000000;
                bool flag = Find.Selector.SelectedObjects.Contains(Operator);
                if (flag && (Operator.Faction == Faction.OfPlayer || (Prefs.DevMode && DebugSettings.godMode)))
                {
                    Texture2D CommandTex;
                    if (!active && !Props.iconPathToggled.NullOrEmpty())
                    {
                        CommandTex = ContentFinder <Texture2D> .Get(Props.iconPathToggled, true);

                        //	CommandTex = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_TurretModeOn", true);
                    }
                    else
                    {
                        CommandTex = ContentFinder <Texture2D> .Get(Props.iconPath, true);

                        //	CommandTex = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_TurretModeOff", true);
                    }
                    CommandTex = ContentFinder <Texture2D> .Get(Props.iconPath, true);

                    yield return(new Command_ToggleCompTurret(this)
                    {
                        icon = CommandTex,
                        defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + (active ? " turret: on." : " turret: off."),
                        defaultDesc = "Switch mode.",
                        isActive = (() => active),
                        toggleAction = delegate()
                        {
                            active = !active;
                        },
                        activateSound = SoundDef.Named("Click"),
                        groupKey = num + Props.gizmoID,

                        /*
                         * disabled = GetWearer.stances.curStance.StanceBusy,
                         * disabledReason = "Busy"
                         */
                    });
                }

                if (this.CanSetForcedTarget && active)
                {
                    num += 100;
                    Command_CompTurretVerbTarget command_VerbTarget = new Command_CompTurretVerbTarget();
                    command_VerbTarget.defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + " " + "CommandSetForceAttackTarget".Translate();
                    command_VerbTarget.defaultDesc  = "CommandSetForceAttackTargetDesc".Translate();
                    command_VerbTarget.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true);

                    command_VerbTarget.verb       = this.AttackVerb;
                    command_VerbTarget.gunTurret  = this;
                    command_VerbTarget.hotKey     = Props.hotKey;
                    command_VerbTarget.drawRadius = true;
                    command_VerbTarget.groupKey   = num + Props.gizmoID;
                    if (Operator.Spawned && this.IsMortarOrProjectileFliesOverhead && Operator.Position.Roofed(Operator.Map))
                    {
                        command_VerbTarget.Disable("CannotFire".Translate() + ": " + "Roofed".Translate().CapitalizeFirst());
                    }
                    if (Operator.Spawned && Stunned)
                    {
                        command_VerbTarget.Disable("CannotFire".Translate() + ": " + "EMPDisabled".Translate().CapitalizeFirst());
                    }

                    /*
                     * command_VerbTarget.action = delegate (LocalTargetInfo target)
                     * {
                     *      this.OrderForceTarget(target);
                     * };
                     */
                    yield return(command_VerbTarget);
                }
                if (this.forcedTarget.IsValid)
                {
                    num += 100;
                    Command_Action command_Action = new Command_Action();
                    command_Action.defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + " " + "CommandStopForceAttack".Translate();
                    command_Action.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                    command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                    command_Action.groupKey = num + Props.gizmoID;
                    command_Action.action   = delegate()
                    {
                        this.ResetForcedTarget();
                        SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                    };
                    if (!this.forcedTarget.IsValid)
                    {
                        command_Action.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                    }
                    command_Action.hotKey = KeyBindingDefOf.Misc5;
                    yield return(command_Action);
                }
                if (this.CanToggleHoldFire)
                {
                    num += 100;
                    yield return(new Command_Toggle
                    {
                        defaultLabel = "CommandHoldFire".Translate(),
                        defaultDesc = "CommandHoldFireDesc".Translate(),
                        icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                        hotKey = KeyBindingDefOf.Misc6,
                        groupKey = num + Props.gizmoID,
                        toggleAction = delegate()
                        {
                            this.holdFire = !this.holdFire;
                            if (this.holdFire)
                            {
                                this.ResetForcedTarget();
                            }
                        },
                        isActive = (() => this.holdFire)
                    });
                }
                if (this.UseAmmo)
                {
                    bool drafted = this.OperatorPawn?.Drafted ?? Operator.Faction == Faction.OfPlayerSilentFail;
                    if ((drafted && !this.Props.displayGizmoWhileDrafted) || (!drafted && !this.Props.displayGizmoWhileUndrafted))
                    {
                        yield break;
                    }

                    /*
                     * ThingWithComps gear = this.parent;
                     * foreach (Verb verb in this.GunCompEq.VerbTracker.AllVerbs)
                     * {
                     *      if (verb.verbProps.hasStandardCommand)
                     *      {
                     *              yield return this.CreateVerbTargetCommand(gear, verb);
                     *      }
                     * }
                     */

                    if (Prefs.DevMode)
                    {
                        yield return(new Command_Action
                        {
                            defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + " " + "Debug: Reload to full",

                            action = delegate()
                            {
                                this.remainingCharges = this.MaxCharges;
                            }
                        });
                    }
                }
            }
        }
Esempio n. 16
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            var leftRect  = new Rect(inRect.x, inRect.y, inRect.width * 0.65f, inRect.height);
            var rightRect = new Rect((int)(inRect.x + inRect.width * 0.65f + 30f), inRect.y, inRect.width * 0.35f - 30f,
                                     inRect.height);

            var listing_options = new Listing_Standard();

            listing_options.Begin(leftRect);

            listing_options.CheckboxLabeled("PrisonLabor_ShowNews".Translate(), ref showNews,
                                            "PrisonLabor_ShowNewsDesc".Translate());

            listing_options.GapLine();

            if (listing_options.ButtonTextLabeled("PrisonLabor_DefaultInterMode".Translate(), interactionModeList[defaultInteractionMode].LabelCap))
            {
                defaultInteractionMode = defaultInteractionMode < interactionModeList.Count - 1 ? defaultInteractionMode + 1 : 0;
            }

            listing_options.GapLine();

            listing_options.Label("PrisonLabor_AllowedWorkTypes".Translate(), -1f);
            listing_options.CheckboxLabeled("   " + "PrisonLabor_AllowAll".Translate(), ref allowAllWorktypes, "PrisonLabor_AllowAllWorkTypes".Translate());
            if (!allowAllWorktypes)
            {
                if (listing_options.ButtonTextLabeled("   " + "PrisonLabor_AllowedWorkTypesL".Translate(), "PrisonLabor_Browse".Translate()))
                {
                    Find.WindowStack.Add(new SelectWorkTypesDialog());
                }
            }
            else
            {
                listing_options.Gap();
            }

            listing_options.GapLine();

            listing_options.CheckboxLabeled("PrisonLabor_MotivationMechanics".Translate(), ref enableMotivationMechanics,
                                            "PrisonLabor_MotivationWarning".Translate());

            listing_options.GapLine();

            listing_options.CheckboxLabeled("PrisonLabor_MotivationIcons".Translate(), ref enableMotivationIcons,
                                            "PrisonLabor_MotivationIconsDesc".Translate());

            listing_options.GapLine();

            listing_options.CheckboxLabeled("PrisonLabor_CanGrowAdvanced".Translate(), ref advancedGrowing,
                                            "PrisonLabor_CanGrowAdvancedDesc".Translate());

            listing_options.GapLine();

            listing_options.CheckboxLabeled("PrisonLabor_EnableRevolts".Translate(), ref enableRevolts,
                                            "PrisonLabor_EnableRevoltsDesc".Translate());

            listing_options.GapLine();

            listing_options.CheckboxLabeled("PrisonLabor_EnableSuicide".Translate(), ref enableSuicide,
                                            "PrisonLabor_EnableSuicideDesc".Translate());

            listing_options.CheckboxLabeled("PrisonLabor_EnableFullHealRest".Translate(), ref enableFullHealRest,
                                            "PrisonLabor_EnableFullHealRestDesc".Translate());


            listing_options.GapLine();

            listing_options.CheckboxLabeled("PrisonLabor_ShowTreatmentHappiness".Translate(), ref showTreatmentHappiness,
                                            "PrisonLabor_ShowTreatmentHappinessDesc".Translate());

            listing_options.Gap();
            listing_options.Gap();
            listing_options.Gap();

            if (listing_options.ButtonTextLabeled("PrisonLabor_ButtonRemoveModFromSaveDesc".Translate(), "PrisonLabor_ButtonRemoveModFromSave".Translate()))
            {
                Find.WindowStack.Add(new SelectSaveForCleaningDialog());
            }

            listing_options.End();

            var listing_panel = new Listing_Standard();

            listing_panel.Begin(rightRect);

            var heigh_temp = rightRect.width * 0.56f;

            GUI.DrawTexture(new Rect(0, 0, rightRect.width, heigh_temp), ContentFinder <Texture2D> .Get("Preview", true));
            listing_panel.Gap(heigh_temp);
            listing_panel.Label("Prison Labor", -1f);
            listing_panel.Label("PrisonLabor_Version".Translate() + VersionUtility.versionString, -1f);

            listing_panel.GapLine();

            listing_panel.Label("PrisonLabor_Difficulty".Translate() + difficulty, -1f);

            listing_panel.GapLine();

            if (listing_panel.ButtonText("PrisonLabor_Defaults".Translate()))
            {
                PrisonLaborPrefs.RestoreToDefault();
                Init();
            }

            if (listing_panel.ButtonText("PrisonLabor_ShowNews".Translate()))
            {
                NewsWindow.ShowAll = true;
                NewsWindow.ForceShow();
            }

            if (listing_panel.ButtonText("PrisonLabor_ReplayTurorialsButton".Translate()))
            {
                ReplayTutorialsWindow.Show();
            }

            listing_panel.End();

            Apply();
        }
Esempio n. 17
0
        // Token: 0x06000089 RID: 137 RVA: 0x000059A4 File Offset: 0x00003BA4
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }

            if (Faction != Faction.OfPlayer)
            {
                yield break;
            }

            string SelectDesc = "RPThingMaker.ThingSelectDesc".Translate();

            if (MakerThingDef == null)
            {
                string NoChem = "RPThingMaker.ThingSelect".Translate();
                yield return(new Command_Action
                {
                    defaultLabel = NoChem,
                    icon = ContentFinder <Texture2D> .Get(thingTexPath),
                    defaultDesc = SelectDesc,
                    action = RPMakerSelectThing
                });
            }
            else
            {
                var IconToUse   = RPThingMakerUtility.GetRPThingIcon(MakerThingDef);
                var LabelDetail = MakerThingDef.label.CapitalizeFirst();
                LabelDetail = string.Concat(LabelDetail, " [", NumProd, "] ");
                if (TotalProdWorkTicks > 0)
                {
                    LabelDetail = LabelDetail + " (" +
                                  (int)((TotalProdWorkTicks - ProdWorkTicks) / (float)TotalProdWorkTicks * 100f) +
                                  "%)";
                }

                yield return(new Command_Action
                {
                    defaultLabel = LabelDetail,
                    icon = IconToUse,
                    defaultDesc = SelectDesc,
                    action = RPMakerSelectThing
                });
            }

            string LabelProduce     = "RPThingMaker.Production".Translate();
            string LabelProduceDesc = "RPThingMaker.ProductionDesc".Translate();

            if (isProducing)
            {
                if (MakerThingDef != null)
                {
                    if (RPThingMakerUtility.RCPProdValues(MakerThingDef, out _, out var minProd, out var maxProd,
                                                          out _))
                    {
                        LabelProduce +=
                            "RPThingMaker.ProdLabelRange".Translate(minProd.ToString(), maxProd.ToString());
                    }
                    else
                    {
                        LabelProduce += "RPThingMaker.ProdLabelERR".Translate();
                    }
                }
                else
                {
                    LabelProduce += "RPThingMaker.ProdNoThing".Translate();
                }
            }
        public override void DoWindowContents(Rect inRect)
        {
            var contentRect = new Rect(0, 0, inRect.width, inRect.height - (CloseButSize.y + 10f)).ContractedBy(10f);
//            var scrollViewVisible = new Rect(0f, titleRect.height, contentRect.width, contentRect.height - titleRect.height);
            var scrollBarVisible = totalContentHeight > contentRect.height;
            var scrollViewTotal  = new Rect(0f, 0f, contentRect.width - (scrollBarVisible ? ScrollBarWidthMargin : 0), totalContentHeight);

            Widgets.DrawHighlight(contentRect);
            Widgets.BeginScrollView(contentRect, ref scrollPosition, scrollViewTotal);
            var curY = 0f;
            var r    = new Rect(0, curY, scrollViewTotal.width, LabelHeight);

//            r=new Rect(0,curY,scrollViewTotal.width, LabelHeight);
            Widgets.CheckboxLabeled(r, "LWMDSperDSUturnOn".Translate(), ref Settings.allowPerDSUSettings); //TODO
            TooltipHandler.TipRegion(r, "LWMDSperDSUturnOnDesc".Translate());
            curY += LabelHeight + 1f;
            if (!Settings.allowPerDSUSettings)
            {
                r = new Rect(5f, curY, scrollViewTotal.width - 10f, LabelHeight);
                Widgets.Label(r, "LWMDSperDSUWarning".Translate());
                curY += LabelHeight;
            }

            Widgets.DrawLineHorizontal(0f, curY, scrollViewTotal.width);
            curY += 10f;

            // todo: make this static?
            //List<ThingDef> l=DefDatabase<ThingDef>.AllDefsListForReading.Where(ThingDef d => d.Has

            // Roll my own buttons, because dammit, I want left-justified buttons:
            //   (mirroring Widgets.ButtonTextWorker)
            GenUI.SetLabelAlign(TextAnchor.MiddleLeft);
            var bg = ContentFinder <Texture2D> .Get("UI/Widgets/ButtonBG");

            var bgmouseover = ContentFinder <Texture2D> .Get("UI/Widgets/ButtonBGMouseover");

            var bgclick = ContentFinder <Texture2D> .Get("UI/Widgets/ButtonBGClick");

            foreach (var u in Settings.allDeepStorageUnits)
            {
                r = new Rect(5f, curY, scrollViewTotal.width * 2 / 3 - 7f, LabelHeight);
                // Draw button-ish background:
                var atlas = bg;
                if (Mouse.IsOver(r))
                {
                    atlas = bgmouseover;
                    if (Input.GetMouseButton(0))
                    {
                        atlas = bgclick;
                    }
                }

                Widgets.DrawAtlas(r, atlas);
                // button text:
                Widgets.Label(r, u.label + " (defName: " + u.defName + ")");
                // button clickiness:
                if (Widgets.ButtonInvisible(r))
                {
                    Find.WindowStack.Add(new Dialog_DSU_Settings(u));
                }
                // Reset button:
                r = new Rect(scrollViewTotal.width * 2 / 3 + 2f, curY, scrollViewTotal.width / 3 - 7f, LabelHeight);
                if (IsDSUChanged(u) && Widgets.ButtonText(r, "ResetBinding".Translate()))
                {
                    ResetDSUToDefaults(u.defName);
                }
                curY += LabelHeight + 2f;
            }

            GenUI.ResetLabelAlign();
            // end buttons

            Widgets.EndScrollView();
            r = new Rect(10f, inRect.height - CloseButSize.y - 5f, inRect.width / 3, CloseButSize.y);
            if (defaultDSUValues.Count > 0 && Widgets.ButtonText(r, "LWM.ResetAllToDefault".Translate()))
            {
                Utils.Mess(Utils.DBF.Settings, "Resetting all per-building storage settings to default:");
                ResetAllToDefaults();
            }

            totalContentHeight = curY;
        }
        public static void ResetTextures()
        {
            ColonistBar.BrowseGroupsUp = ContentFinder <Texture2D> .Get("EdB/Interface/ColonistBar/BrowseGroupUp", true);

            ColonistBar.BrowseGroupsDown = ContentFinder <Texture2D> .Get("EdB/Interface/ColonistBar/BrowseGroupDown", true);
        }
Esempio n. 20
0
        private static bool DrawIconForWeapon(ThingDef weapon, KeyValuePair <String, WeaponRecord> item, Rect contentRect, Vector2 iconOffset, int buttonID)
        {
            var     iconTex  = weapon.uiIcon;
            Color   color    = getColor(weapon);
            Color   colorTwo = getColor(weapon);
            Graphic g2       = null;

            if (weapon.graphicData != null && weapon.graphicData.Graphic != null)
            {
                Graphic g = weapon.graphicData.Graphic;
                g2 = weapon.graphicData.Graphic.GetColoredVersion(g.Shader, color, colorTwo);
            }

            var iconRect = new Rect(contentRect.x + iconOffset.x, contentRect.y + iconOffset.y, IconSize, IconSize);

            if (!contentRect.Contains(iconRect))
            {
                return(false);
            }

            string label = weapon.label;

            TooltipHandler.TipRegion(iconRect, label);

            MouseoverSounds.DoRegion(iconRect, SoundDefOf.MouseoverCommand);
            if (Mouse.IsOver(iconRect))
            {
                GUI.color = iconMouseOverColor;
                GUI.DrawTexture(iconRect, ContentFinder <Texture2D> .Get("square", true));
            }
            else if (item.Value.isException == true)
            {
                GUI.color = iconMouseOverColor;
                GUI.DrawTexture(iconRect, ContentFinder <Texture2D> .Get("square", true));
            }
            else
            {
                GUI.color = iconBaseColor;
                GUI.DrawTexture(iconRect, ContentFinder <Texture2D> .Get("square", true));
            }

            Texture resolvedIcon;

            if (!weapon.uiIconPath.NullOrEmpty())
            {
                resolvedIcon = weapon.uiIcon;
            }
            else if (g2 != null)
            {
                resolvedIcon = g2.MatSingle.mainTexture;
            }
            else
            {
                resolvedIcon = new Texture();
            }

            GUI.color = color;
            GUI.DrawTexture(iconRect, resolvedIcon);
            GUI.color = Color.white;

            if (Widgets.ButtonInvisible(iconRect, true))
            {
                Event.current.button = buttonID;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 21
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (parent.Faction != Faction.OfPlayer)
            {
                yield break;
            }

            yield return(new Command_Action
            {
                defaultLabel = "burn",
                defaultDesc = "Play the burn effect.",
                icon = ContentFinder <Texture2D> .Get("Radiology/Effects/Burn", true),
                action = delegate()
                {
                    Chamber chamber = parent.Linked <Chamber>();
                    if (chamber != null && chamber.def.burnEffect != null)
                    {
                        chamber.def.burnEffect.Spawn(parent.Map, parent.Position.ToVector3());
                    }
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            yield return(new Command_Action
            {
                defaultLabel = "mutate",
                defaultDesc = "Play the mutate effect.",
                icon = ContentFinder <Texture2D> .Get("Radiology/Effects/Mutate", true),
                action = delegate()
                {
                    if (HediffDefOf.MutationFastLegs.spawnEffect != null)
                    {
                        HediffDefOf.MutationFastLegs.spawnEffect.Spawn(parent.Map, parent.Position.ToVector3());
                    }
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            yield return(new Command_Action
            {
                defaultLabel = "cancer male",
                defaultDesc = "Play the cancer male effect.",
                icon = ContentFinder <Texture2D> .Get("Radiology/Effects/Cancer", true),
                action = delegate()
                {
                    Chamber chamber = parent.Linked <Chamber>();
                    if (HediffDefOf.RadiologyCancer.spawnEffect != null)
                    {
                        HediffDefOf.RadiologyCancer.spawnEffect.Spawn(parent.Map, parent.Position.ToVector3());
                    }
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            yield return(new Command_Action
            {
                defaultLabel = "cancer female",
                defaultDesc = "Play the cancer female effect.",
                icon = ContentFinder <Texture2D> .Get("Radiology/Effects/Cancer", true),
                action = delegate()
                {
                    if (HediffDefOf.RadiologyCancer.spawnEffectFemale != null)
                    {
                        HediffDefOf.RadiologyCancer.spawnEffectFemale.Spawn(parent.Map, parent.Position.ToVector3());
                    }
                },
                hotKey = KeyBindingDefOf.Misc3
            });


            yield break;
        }
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo item in base.CompGetGizmosExtra())
            {
                yield return(item);
            }
            float          offset         = RoundedToCurrentTempModeOffset(-10f);
            Command_Action command_Action = new Command_Action();

            command_Action.action = delegate
            {
                InterfaceChangeTargetTemperature(offset);
            };
            command_Action.defaultLabel = offset.ToStringTemperatureOffset("F0");
            command_Action.defaultDesc  = "CommandLowerTempDesc".Translate();
            command_Action.hotKey       = KeyBindingDefOf.Misc5;
            command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Commands/TempLower");

            yield return(command_Action);

            float          offset2         = RoundedToCurrentTempModeOffset(-1f);
            Command_Action command_Action2 = new Command_Action();

            command_Action2.action = delegate
            {
                InterfaceChangeTargetTemperature(offset2);
            };
            command_Action2.defaultLabel = offset2.ToStringTemperatureOffset("F0");
            command_Action2.defaultDesc  = "CommandLowerTempDesc".Translate();
            command_Action2.hotKey       = KeyBindingDefOf.Misc4;
            command_Action2.icon         = ContentFinder <Texture2D> .Get("UI/Commands/TempLower");

            yield return(command_Action2);

            Command_Action command_Action3 = new Command_Action();

            command_Action3.action = delegate
            {
                targetTemperature = 21f;
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                ThrowCurrentTemperatureText();
            };
            command_Action3.defaultLabel = "CommandResetTemp".Translate();
            command_Action3.defaultDesc  = "CommandResetTempDesc".Translate();
            command_Action3.hotKey       = KeyBindingDefOf.Misc1;
            command_Action3.icon         = ContentFinder <Texture2D> .Get("UI/Commands/TempReset");

            yield return(command_Action3);

            float          offset3         = RoundedToCurrentTempModeOffset(1f);
            Command_Action command_Action4 = new Command_Action();

            command_Action4.action = delegate
            {
                InterfaceChangeTargetTemperature(offset3);
            };
            command_Action4.defaultLabel = "+" + offset3.ToStringTemperatureOffset("F0");
            command_Action4.defaultDesc  = "CommandRaiseTempDesc".Translate();
            command_Action4.hotKey       = KeyBindingDefOf.Misc2;
            command_Action4.icon         = ContentFinder <Texture2D> .Get("UI/Commands/TempRaise");

            yield return(command_Action4);

            float          offset4         = RoundedToCurrentTempModeOffset(10f);
            Command_Action command_Action5 = new Command_Action();

            command_Action5.action = delegate
            {
                InterfaceChangeTargetTemperature(offset4);
            };
            command_Action5.defaultLabel = "+" + offset4.ToStringTemperatureOffset("F0");
            command_Action5.defaultDesc  = "CommandRaiseTempDesc".Translate();
            command_Action5.hotKey       = KeyBindingDefOf.Misc3;
            command_Action5.icon         = ContentFinder <Texture2D> .Get("UI/Commands/TempRaise");

            yield return(command_Action5);
        }
Esempio n. 23
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            var enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                yield return(current);
            }

            if (Faction == Faction.OfPlayer && !Dead && !Dead)
            {
                if (compTransporterPawn.LoadingInProgressOrReadyToLaunch)
                {
                    var command_Action = new Command_Action
                    {
                        defaultLabel = "CommandLaunchGroup".Translate(),
                        defaultDesc  = "CommandLaunchGroupDesc".Translate(),
                        icon         = ContentFinder <Texture2D> .Get("UI/Icons/Commands/FlyingTarget"),
                        action       = delegate
                        {
                            if (compTransporterPawn.AnyInGroupHasAnythingLeftToLoad)
                            {
                                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(
                                                         "ConfirmSendNotCompletelyLoadedPods".Translate(
                                                             compTransporterPawn.FirstThingLeftToLoadInGroup.LabelCap
                                                             ), compLaunchablePawn.StartChoosingDestination));
                            }
                            else
                            {
                                compLaunchablePawn.StartChoosingDestination();
                            }
                        }
                    };
                    if (compLaunchablePawn.AnyInGroupIsUnderRoof)
                    {
                        command_Action.Disable("CommandLaunchGroupFailUnderRoof".Translate());
                    }

                    yield return(command_Action);
                }

                if (compTransporterPawn.LoadingInProgressOrReadyToLaunch)
                {
                    yield return(new Command_Action
                    {
                        defaultLabel = "CommandCancelLoad".Translate(),
                        defaultDesc = "CommandCancelLoadDesc".Translate(),
                        icon = CompTransporterPawn.CancelLoadCommandTex,
                        action = delegate
                        {
                            SoundDefOf.Designate_Cancel.PlayOneShotOnCamera();
                            compTransporterPawn.CancelLoad();
                        }
                    });
                }

                var command_LoadToTransporter = new Command_LoadToTransporterPawn();
                var num = 0;
                for (var i = 0; i < Find.Selector.NumSelected; i++)
                {
                    if (Find.Selector.SelectedObjectsListForReading[i] is Thing thing && thing.def == def)
                    {
                        var compLaunchable = thing.TryGetComp <CompLaunchablePawn>();
                        if (compLaunchable != null)
                        {
                            num++;
                        }
                    }
                }

                command_LoadToTransporter.defaultLabel = "CommandLoadTransporter".Translate(
                    num.ToString()
                    );
                command_LoadToTransporter.defaultDesc = "CommandLoadTransporterDesc".Translate();
                command_LoadToTransporter.icon        = CompTransporterPawn.LoadCommandTex;
                command_LoadToTransporter.transComp   = compTransporterPawn;
                var launchable = compTransporterPawn.Launchable;
                yield return(command_LoadToTransporter);
            }
        }
Esempio n. 24
0
        // Note to whoever wants to add to this method (hi jptrrs!):
        // You can just do
        // foreach (Gizmo c in base.GetGizmos())
        // {
        //    yield return c;
        // }
        // yield return [whatever you want to add];
        //
        // No need to copy this method.
        public override IEnumerable <Gizmo> GetGizmos()
        {
            // Display the original gizmos (includes the swap guest bed button via patch)
            foreach (var gizmo in base.GetGizmos())
            {
                switch (gizmo)
                {
                case Command_Toggle toggle: {
                    // Disable prisoner and medical buttons
                    if (toggle.defaultLabel == "CommandBedSetForPrisonersLabel".Translate() || toggle.defaultLabel == "CommandBedSetAsMedicalLabel".Translate())
                    {
                        gizmo.Disable();
                    }
                    break;
                }

                case Command_Action action: {
                    // Disable set owner button
                    if (action.defaultLabel == "CommandThingSetOwnerLabel".Translate())
                    {
                        action.Disable();
                    }
                    break;
                }
                }
                yield return(gizmo);
            }

            // Gizmo for drawing guest room info
            if (Find.Selector.SingleSelectedObject == this)
            {
                if (Stats.lastCalculated == 0 || Stats.room == null)
                {
                    UpdateStats();
                }
                yield return(new Gizmo_GuestBedStats(this));
            }

            // Add buttons to decrease / increase the fee
            yield return(new Command_Action
            {
                defaultLabel = "CommandBedDecreaseFeeLabel".Translate(feeStep),
                defaultDesc = "CommandBedDecreaseFeeDesc".Translate(feeStep, MoodEffect),
                icon = ContentFinder <Texture2D> .Get("UI/Commands/ChangePriceDown"),
                action = () => AdjustFee(-feeStep),
                hotKey = KeyBindingDefOf.Misc5,
                disabled = rentalFee < feeStep
            });

            yield return(new Command_Action
            {
                defaultLabel = "CommandBedIncreaseFeeLabel".Translate(feeStep),
                defaultDesc = "CommandBedIncreaseFeeDesc".Translate(feeStep, MoodEffect),
                icon = ContentFinder <Texture2D> .Get("UI/Commands/ChangePriceUp"),
                action = () => AdjustFee(feeStep),
                hotKey = KeyBindingDefOf.Misc6
            });

            // Get base def
            var defName = def.defName.ReplaceFirst("Guest", string.Empty);
            var baseDef = DefDatabase <ThingDef> .GetNamed(defName);

            // Add build copy command
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(baseDef, Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }
        }
Esempio n. 25
0
        // ===================== Gizmo =====================
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IList <Gizmo> buttonList   = new List <Gizmo>();
            int           groupKeyBase = 700000102;

            Command_Action lightModeButton = new Command_Action();

            switch (this.lightMode)
            {
            case (LightMode.Conic):
                lightModeButton.defaultLabel = "Light mode: conic.";
                lightModeButton.defaultDesc  = "In this mode, the projector patrols in a conic area in front of it.";
                break;

            case (LightMode.Automatic):
                lightModeButton.defaultLabel = "Light mode: automatic.";
                lightModeButton.defaultDesc  = "In this mode, the projector randomly lights the surroundings.";
                break;

            case (LightMode.Fixed):
                lightModeButton.defaultLabel = "Light mode: fixed.";
                lightModeButton.defaultDesc  = "In this mode, the projector lights a fixed area.";
                break;
            }
            lightModeButton.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_SwitchMode");

            lightModeButton.activateSound = SoundDef.Named("Click");
            lightModeButton.action        = new Action(SwitchLightMode);
            lightModeButton.groupKey      = groupKeyBase + 1;
            buttonList.Add(lightModeButton);

            if ((this.lightMode == LightMode.Conic) ||
                (this.lightMode == LightMode.Fixed))
            {
                Command_Action decreaseRangeButton = new Command_Action();
                decreaseRangeButton.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_DecreaseRange");

                decreaseRangeButton.defaultLabel  = "Range: " + this.projectorRangeBaseOffset;
                decreaseRangeButton.defaultDesc   = "Decrease range.";
                decreaseRangeButton.activateSound = SoundDef.Named("Click");
                decreaseRangeButton.action        = new Action(DecreaseProjectorRange);
                decreaseRangeButton.groupKey      = groupKeyBase + 2;
                buttonList.Add(decreaseRangeButton);

                Command_Action increaseRangeButton = new Command_Action();
                increaseRangeButton.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_IncreaseRange");

                increaseRangeButton.defaultLabel  = "";
                increaseRangeButton.defaultDesc   = "Increase range.";
                increaseRangeButton.activateSound = SoundDef.Named("Click");
                increaseRangeButton.action        = new Action(IncreaseProjectorRange);
                increaseRangeButton.groupKey      = groupKeyBase + 3;
                buttonList.Add(increaseRangeButton);

                float          rotation       = Mathf.Repeat(this.Rotation.AsAngle + this.projectorRotationBaseOffset, 360f);
                Command_Action turnLeftButton = new Command_Action();
                turnLeftButton.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_TurnLeft");

                turnLeftButton.defaultLabel  = "Rotation: " + rotation + "°";
                turnLeftButton.defaultDesc   = "Turn left.";
                turnLeftButton.activateSound = SoundDef.Named("Click");
                turnLeftButton.action        = new Action(AddProjectorBaseRotationLeftOffset);
                turnLeftButton.groupKey      = groupKeyBase + 4;
                buttonList.Add(turnLeftButton);

                Command_Action turnRightButton = new Command_Action();
                turnRightButton.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_TurnRight");

                turnRightButton.defaultLabel  = "";
                turnRightButton.defaultDesc   = "Turn right.";
                turnRightButton.activateSound = SoundDef.Named("Click");
                turnRightButton.action        = new Action(AddProjectorBaseRotationRightOffset);
                turnRightButton.groupKey      = groupKeyBase + 5;
                buttonList.Add(turnRightButton);
            }

            Command_Action setTargetButton = new Command_Action();

            setTargetButton.icon = ContentFinder <Texture2D> .Get("UI/Commands/Attack");

            setTargetButton.defaultLabel  = "Set target";
            setTargetButton.defaultDesc   = "Order the tower to light a specific target. Can only target unroofed hostiles in range.";
            setTargetButton.activateSound = SoundDef.Named("Click");
            setTargetButton.action        = new Action(SelectTarget);
            setTargetButton.groupKey      = groupKeyBase + 6;
            buttonList.Add(setTargetButton);

            Command_Action synchronizeButton = new Command_Action();

            synchronizeButton.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_Synchronize");

            synchronizeButton.defaultLabel  = "Group: " + this.groupId;
            synchronizeButton.defaultDesc   = "Synchronize the selected projectors and select conic mode.";
            synchronizeButton.activateSound = SoundDef.Named("Click");
            synchronizeButton.action        = new Action(SetNewTowersGroup);
            synchronizeButton.groupKey      = groupKeyBase + 7;
            buttonList.Add(synchronizeButton);

            IEnumerable <Gizmo> resultButtonList;
            IEnumerable <Gizmo> basebuttonList = base.GetGizmos();

            if (basebuttonList != null)
            {
                resultButtonList = basebuttonList.Concat(buttonList);
            }
            else
            {
                resultButtonList = buttonList;
            }
            return(resultButtonList);
        }
Esempio n. 26
0
        public override IEnumerable <Gizmo> GetGizmos()              // Modified
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            // Ammo gizmos
            if (CompAmmo != null && (PlayerControlled || Prefs.DevMode))
            {
                foreach (Command com in CompAmmo.CompGetGizmosExtra())
                {
                    if (!PlayerControlled && Prefs.DevMode && com is GizmoAmmoStatus)
                    {
                        (com as GizmoAmmoStatus).prefix = "DEV: ";
                    }

                    yield return(com);
                }
            }
            // Don't show CONTROL gizmos on enemy turrets (even with dev mode enabled)
            if (PlayerControlled)
            {
                // Fire mode gizmos
                if (CompFireModes != null)
                {
                    foreach (Command com in CompFireModes.GenerateGizmos())
                    {
                        yield return(com);
                    }
                }
                // Set forced target gizmo
                if (CanSetForcedTarget)
                {
                    var vt = new Command_VerbTarget
                    {
                        defaultLabel = "CommandSetForceAttackTarget".Translate(),
                        defaultDesc  = "CommandSetForceAttackTargetDesc".Translate(),
                        icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true),
                        verb         = GunCompEq.PrimaryVerb,
                        hotKey       = KeyBindingDefOf.Misc4
                    };
                    if (Spawned && IsMortarOrProjectileFliesOverhead && Position.Roofed(Map))
                    {
                        vt.Disable("CannotFire".Translate() + ": " + "Roofed".Translate().CapitalizeFirst());
                    }
                    yield return(vt);
                }
                // Stop forced attack gizmo
                if (forcedTarget.IsValid)
                {
                    Command_Action stop = new Command_Action();
                    stop.defaultLabel = "CommandStopForceAttack".Translate();
                    stop.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                    stop.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                    stop.action = delegate
                    {
                        ResetForcedTarget();
                        SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                    };
                    if (!this.forcedTarget.IsValid)
                    {
                        stop.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                    }
                    stop.hotKey = KeyBindingDefOf.Misc5;
                    yield return(stop);
                }
                // Toggle fire gizmo
                if (CanToggleHoldFire)
                {
                    yield return(new Command_Toggle
                    {
                        defaultLabel = "CommandHoldFire".Translate(),
                        defaultDesc = "CommandHoldFireDesc".Translate(),
                        icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                        hotKey = KeyBindingDefOf.Misc6,
                        toggleAction = delegate
                        {
                            holdFire = !holdFire;
                            if (holdFire)
                            {
                                ResetForcedTarget();
                            }
                        },
                        isActive = (() => holdFire)
                    });
                }
            }
        }
Esempio n. 27
0
 private static Texture2D LoadTexture(string key) => ContentFinder <Texture2D> .Get(Mod.Id + "/" + key);
        public static Texture2D GetGenitalIcon(this Pawn pawn)
        {
            var hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.Find((Hediff h) => h.def.defName.ToLower().Contains("v****a"));

            if (hediff == null)
            {
                return(ContentFinder <Texture2D> .Get("Genitals/Vagina00", true));
            }
            HediffComp_Menstruation comp = hediff.GetMenstruationComp();
            string icon;

            if (comp != null)
            {
                icon = comp.vagTex;
            }
            else
            {
                icon = "Genitals/V****a";
            }

            if (hediff.Severity < 0.20f)
            {
                icon += "00";                                 //micro
            }
            else if (hediff.Severity < 0.30f)
            {
                icon += "01";                                 //tight
            }
            else if (hediff.Severity < 0.40f)
            {
                icon += "02";                                 //tight
            }
            else if (hediff.Severity < 0.47f)
            {
                icon += "03";                                 //average
            }
            else if (hediff.Severity < 0.53f)
            {
                icon += "04";                                 //average
            }
            else if (hediff.Severity < 0.60f)
            {
                icon += "05";                                 //average
            }
            else if (hediff.Severity < 0.70f)
            {
                icon += "06";                                 //accomodating
            }
            else if (hediff.Severity < 0.80f)
            {
                icon += "07";                                 //accomodating
            }
            else if (hediff.Severity < 0.87f)
            {
                icon += "08";                                 //cavernous
            }
            else if (hediff.Severity < 0.94f)
            {
                icon += "09";                                 //cavernous
            }
            else if (hediff.Severity < 1.01f)
            {
                icon += "10";                                 //cavernous
            }
            else
            {
                icon += "11";                                 //abyssal
            }
            return(ContentFinder <Texture2D> .Get((icon), true));
        }
Esempio n. 29
0
        private void DrawWeaponsTurretRow(ref float y, float width, KeyValuePair <ShipWeaponSlot, Building_ShipTurret> currentWeapon)
        {
            Rect rectslotName = new Rect(10f, y, 100f, 30f);

            Widgets.Label(rectslotName, currentWeapon.Key.SlotName);

            Rect rectslotIcon = new Rect(rectslotName.xMax + 5f, y, 30f, 30f);

            if (currentWeapon.Value == null)
            {
                Widgets.DrawWindowBackground(rectslotIcon);
            }
            else
            {
                Widgets.DrawWindowBackground(rectslotIcon);
                Texture2D tex = ContentFinder <Texture2D> .Get(currentWeapon.Value.def.building.turretTopGraphicPath);

                GUI.DrawTexture(rectslotIcon, tex);
            }

            if (Mouse.IsOver(rectslotIcon))
            {
                GUI.color = ITab_ShipCargo.HighlightColor;
                GUI.DrawTexture(rectslotIcon, TexUI.HighlightTex);
            }
            GUI.color = Color.white;
            if (Widgets.ButtonInvisible(rectslotIcon))
            {
                List <FloatMenuOption> opts = new List <FloatMenuOption>();
                if (currentWeapon.Value == null)
                {
                    List <Thing> list = DropShipUtility.availableWeaponsForSlot(this.ship.Map, currentWeapon.Key);
                    list.OrderBy(x => x.Position.DistanceToSquared(this.ship.Position));
                    for (int i = 0; i < list.Count; i++)
                    {
                        Thing  weapon = list[i];
                        Action action = new Action(delegate
                        {
                            ship.TryModifyWeaponSystem(currentWeapon.Key, weapon, true);
                        });

                        FloatMenuOption newOption = new FloatMenuOption("Install".Translate() + weapon.Label, action);
                        opts.Add(newOption);
                    }
                }
                else
                {
                    Action action = new Action(delegate
                    {
                        ship.TryModifyWeaponSystem(currentWeapon.Key, currentWeapon.Value, false);
                    });
                    FloatMenuOption newOption = new FloatMenuOption("Uninstall".Translate() + currentWeapon.Value.Label, action);
                    opts.Add(newOption);
                }
                if (opts.Count < 1)
                {
                    opts.Add(new FloatMenuOption("None", null));
                }
                Find.WindowStack.Add(new FloatMenu(opts));
            }
            Rect rect3 = new Rect(rectslotIcon.xMax + 10f, y, width - rectslotName.width - rectslotIcon.width - 10f, 30f);

            if (currentWeapon.Value == null && !ship.weaponsToInstall.Any(x => x.Key == currentWeapon.Key))
            {
                Widgets.Label(rect3, "NoneInstalled".Translate());
            }
            else
            {
                ShipWeaponSlot installingSlot = ship.weaponsToInstall.FirstOrDefault(x => x.Key == currentWeapon.Key).Key;
                if (installingSlot != null)
                {
                    Widgets.Label(rect3, "InstallingShipWeapon".Translate(new object[]
                    {
                        ship.weaponsToInstall[installingSlot].LabelCap
                    }));
                }
                else
                {
                    Widgets.Label(rect3, currentWeapon.Value.def.LabelCap);
                }
            }
            y += 35f;
        }
        public static void DrawBreastIcon(this Pawn pawn, Rect rect)
        {
            var       hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("breast"));
            Texture2D breast, nipple, areola;

            if (hediff != null)
            {
                HediffComp_Breast comp = hediff.TryGetComp <HediffComp_Breast>();
                string            icon;
                if (comp != null)
                {
                    icon = comp.Props.BreastTex ?? "Breasts/Breast_Breast";
                }
                else
                {
                    icon = "Breasts/Breast_Breast";
                }
                if (hediff.Severity < 0.20f)
                {
                    icon += "_Breast00";
                }
                else if (hediff.Severity < 0.40f)
                {
                    icon += "_Breast01";
                }
                else if (hediff.Severity < 0.60f)
                {
                    icon += "_Breast02";
                }
                else if (hediff.Severity < 0.80f)
                {
                    icon += "_Breast03";
                }
                else if (hediff.Severity < 1.00f)
                {
                    icon += "_Breast04";
                }
                else
                {
                    icon += "_Breast05";
                }

                string nippleicon, areolaicon;

                nippleicon = icon + "_Nipple0" + GetNippleIndex(comp.NippleSize);
                areolaicon = icon + "_Areola0" + GetAreolaIndex(comp.AreolaSize);


                breast = ContentFinder <Texture2D> .Get(icon, false);

                areola = ContentFinder <Texture2D> .Get(areolaicon, false);

                nipple = ContentFinder <Texture2D> .Get(nippleicon, false);

                GUI.color = pawn.story.SkinColor;
                GUI.DrawTexture(rect, breast, ScaleMode.ScaleToFit);

                GUI.color = comp.NippleColor;
                GUI.DrawTexture(rect, areola, ScaleMode.ScaleToFit);

                GUI.DrawTexture(rect, nipple, ScaleMode.ScaleToFit);


                if (Configurations.Debug)
                {
                    TooltipHandler.TipRegion(rect, comp.DebugInfo());
                }
            }
            else
            {
                breast = ContentFinder <Texture2D> .Get("Breasts/Breast_Breast00", false);

                nipple = ContentFinder <Texture2D> .Get("Breasts/Breast_Breast00_Nipple00", false);

                areola = ContentFinder <Texture2D> .Get("Breasts/Breast_Breast00_Areola00", false);

                GUI.color = pawn.story.SkinColor;
                GUI.DrawTexture(rect, breast, ScaleMode.ScaleToFit);
                GUI.color = Color.white;
                GUI.DrawTexture(rect, areola, ScaleMode.ScaleToFit);
                GUI.DrawTexture(rect, nipple, ScaleMode.ScaleToFit);
            }
        }
Esempio n. 31
0
 static Building_OffWorldStargate()
 {
     UI_ACTIVATE_GATE = ContentFinder <Texture2D> .Get("UI/nuke", true);
 }
 public PasteDesignator() :
     base("MorePlanning.PlanPaste".Translate(), "MorePlanning.PlanPasteDesc".Translate(KeyBindingDefOf.Misc1.MainKeyLabel, KeyBindingDefOf.Misc2.MainKeyLabel))
 {
     icon = ContentFinder <Texture2D> .Get("UI/PlanPaste");
 }