Beispiel #1
0
        public JObject Serialize(object userToSerialize)
        {
            JObject jUser = (JObject)JToken.FromObject(userToSerialize);

            jUser.Add("gender", GenderUtility.GenderToString(((User)userToSerialize).Gender));
            return(jUser);
        }
Beispiel #2
0
        static RS()
        {
            PregnantIcon = ContentFinder <Texture2D> .Get("UI/Icons/Animal/Pregnant", true);

            BondIcon = ContentFinder <Texture2D> .Get("UI/Icons/Animal/Bond", true);

            MaleIcon      = GenderUtility.GetIcon(Gender.Male);
            FemaleIcon    = GenderUtility.GetIcon(Gender.Female);
            SlaughterIcon = ContentFinder <Texture2D> .Get("UI/Icons/Animal/Slaughter", true);

            TrainedIcon = ContentFinder <Texture2D> .Get("UI/Icons/Trainables/Obedience", true);

            YoungIcon = ContentFinder <Texture2D> .Get("UI/Icons/LifeStage/Young", true);

            AdultIcon = ContentFinder <Texture2D> .Get("UI/Icons/LifeStage/Adult", true);


            OutputDirectionIcon = ContentFinder <Texture2D> .Get("NR_AutoMachineTool/UI/OutputDirection", true);

            ForbidIcon = ContentFinder <Texture2D> .Get("NR_AutoMachineTool/UI/Forbid", true);

            PlayIcon = ContentFinder <Texture2D> .Get("NR_AutoMachineTool/UI/Play", true);

            DeleteX = ContentFinder <Texture2D> .Get("UI/Buttons/Delete", true);
        }
Beispiel #3
0
 // ===================== Other functions =====================
 public void Notify_BecameHostileToColony()
 {
     if (this.healingPawns.Count > 0)
     {
         string        letterText            = "";
         StringBuilder pawnKeptAsGuestString = new StringBuilder();
         if (this.healingPawns.Count == 1)
         {
             string hisHerIts = GenderUtility.GetPossessive(this.healingPawns.First().pawn.gender);
             string himHerIt  = GenderUtility.GetObjective(this.healingPawns.First().pawn.gender);
             letterText = "-- Comlink with MiningCo. --\n\n"
                          + "\"A friend of yours is being healed in our medibay. I think we will keep " + himHerIt + " aboard as... \"guest\" for " + hisHerIts + " own safety.\n"
                          + "It is really dangerous down there, you know, and there are lot of menial - ehr, I mean \"interresting\" - tasks to do aboard an orbital station to keep " + himHerIt + " occupied.\n\n"
                          + "MiningCo. medibay officer out.\"\n\n"
                          + "-- End of transmission --\n\n"
                          + "The following colonist is kept as \"guest\" aboard the orbital station until you pay a compensation: " + this.healingPawns.First().pawn.Name.ToStringShort + ".";
         }
         else
         {
             letterText = "-- Comlink with MiningCo. --\n\n"
                          + "\"Some friends of yours are being healed in our medibay. I think we will keep them aboard as... \"guests\" for their own safety.\n"
                          + "It is really dangerous down there, you know, and there are lot of menial - ehr, I mean \"interresting\" - tasks to do aboard an orbital station to keep them occupied.\n\n"
                          + "MiningCo. medibay officer out.\"\n\n"
                          + "-- End of transmission --\n\n"
                          + "The following colonists are kept as \"guests\" aboard the orbital station until you pay a compensation: ";
             for (int pawnIndex = 0; pawnIndex < this.healingPawns.Count; pawnIndex++)
             {
                 pawnKeptAsGuestString.AppendWithComma(this.healingPawns[pawnIndex].pawn.Name.ToStringShort);
             }
             pawnKeptAsGuestString.Append(".");
             letterText += pawnKeptAsGuestString.ToString();
         }
         Find.LetterStack.ReceiveLetter("Orbital \"guests\"", letterText, LetterDefOf.NeutralEvent);
     }
 }
Beispiel #4
0
        static RS()
        {
            PregnantIcon = ContentFinder <Texture2D> .Get("UI/Icons/Animal/Pregnant", true);

            BondIcon = ContentFinder <Texture2D> .Get("UI/Icons/Animal/Bond", true);

            MaleIcon      = GenderUtility.GetIcon(Gender.Male);
            FemaleIcon    = GenderUtility.GetIcon(Gender.Female);
            SlaughterIcon = ContentFinder <Texture2D> .Get("UI/Icons/Animal/Slaughter", true);

            TrainedIcon = ContentFinder <Texture2D> .Get("UI/Icons/Trainables/Obedience", true);

            YoungIcon = ContentFinder <Texture2D> .Get("UI/Icons/LifeStage/Young", true);

            AdultIcon = ContentFinder <Texture2D> .Get("UI/Icons/LifeStage/Adult", true);


            OutputDirectionIcon = ContentFinder <Texture2D> .Get("PRFUi/OutputDirection", true);

            ForbidIcon = ContentFinder <Texture2D> .Get("PRFUi/Forbid", true);

            PlayIcon = ContentFinder <Texture2D> .Get("PRFUi/Play", true);

            DeleteX = ContentFinder <Texture2D> .Get("UI/Buttons/Delete", true);

            Arrow = ContentFinder <Texture2D> .Get("UI/Overlays/Arrow", true);

            // Initialize graphics for SpecialSculptures:
            foreach (var s in ProjectRimFactory.Common.
                     ProjectRimFactory_ModComponent.availableSpecialSculptures)
            {
                s.Init();
            }
        }
Beispiel #5
0
        public object DeSerialize(JObject jUser)
        {
            User user = new User();

            user        = jUser.ToObject <User>();
            user.Gender = GenderUtility.StringToGender((string)jUser["gender"]);
            return(user);
        }
        //this changes the text displayed in the bottom-left info panel when you select the item
        public override string GetInspectString()
        {
            StringBuilder builder = new StringBuilder(base.GetInspectString());

            builder.AppendLine("QE_GenomeSequencerDescription_Race".Translate() + ": " + pawnKindDef.race.LabelCap);
            builder.AppendLine("QE_GenomeSequencerDescription_Gender".Translate() + ": " + GenderUtility.GetLabel(gender, pawnKindDef.race.race.Animal).CapitalizeFirst());

            if (hediffInfos != null)
            {
                if (hediffInfos.Count > 0)
                {
                    builder.AppendLine("QE_GenomeSequencerDescription_Hediffs".Translate() + ": " + hediffInfos.Count);
                }
            }

            return(builder.ToString().TrimEndNewlines());
        }
        /// <summary>
        /// This helper function appends the data stored in the genome sequence to the item description in-game.
        /// </summary>
        public string CustomDescriptionString(string baseDescription)
        {
            StringBuilder builder = new StringBuilder();

            if (IsValidTemplate())
            {
                builder.AppendLine(baseDescription);
                builder.AppendLine();
                builder.AppendLine();

                builder.AppendLine("QE_GenomeSequencerDescription_Name".Translate() + ": " + sourceName);
                builder.AppendLine("QE_GenomeSequencerDescription_Race".Translate() + ": " + pawnKindDef.race.LabelCap);
                builder.AppendLine("QE_GenomeSequencerDescription_Gender".Translate() + ": " + GenderUtility.GetLabel(gender, pawnKindDef.race.race.Animal).CapitalizeFirst());

                if (hair != null && hair.texPath != null)
                {
                    builder.AppendLine("QE_GenomeSequencerDescription_Hair".Translate() + ": " + hair.ToString());
                }

                //Traits
                if (traits.Count > 0)
                {
                    builder.AppendLine("QE_GenomeSequencerDescription_Traits".Translate());
                    foreach (ExposedTraitEntry traitEntry in traits)
                    {
                        builder.AppendLine("    " + traitEntry.def.DataAtDegree(traitEntry.degree).label.CapitalizeFirst());
                    }
                }

                //Hediffs
                HediffInfo.GenerateDescForHediffList(ref builder, hediffInfos);
            }
            else
            {
                builder.AppendLine("QE_BlankGenomeTemplateDescription".Translate());
            }

            return(builder.ToString().TrimEndNewlines());
        }
Beispiel #8
0
        public bool SendPawnBackToMap(Pawn pawn, Map map)
        {
            IntVec3 dropSpot        = IntVec3.Invalid;
            bool    dropSpotIsValid = false;

            // Check orbital relay is powered on.
            Building_OrbitalRelay orbitalRelay = Util_OrbitalRelay.GetOrbitalRelay(map);

            if (orbitalRelay == null)
            {
                return(false);
            }
            if (orbitalRelay.powerComp.PowerOn == false)
            {
                return(false);
            }
            // Look for an available landing pad.
            Building_LandingPad landingPad = Util_LandingPad.GetBestAvailableLandingPad(map);

            if (landingPad == null)
            {
                return(false);
            }
            // Get a nearby drop spot.
            dropSpotIsValid = DropCellFinder.TryFindDropSpotNear(landingPad.Position, map, out dropSpot, false, false);

            if (dropSpot.IsValid)
            {
                string hisHerIts = GenderUtility.GetPossessive(pawn.gender);
                string heSheIt   = GenderUtility.GetPronoun(pawn.gender);
                string himHerIt  = GenderUtility.GetObjective(pawn.gender);

                // Restore needs level.
                pawn.needs.food.ForceSetLevel(Rand.Range(0.75f, 1f));
                pawn.needs.rest.ForceSetLevel(Rand.Range(0.75f, 1f));
                pawn.needs.joy.ForceSetLevel(Rand.Range(0.5f, 0.8f));
                pawn.needs.comfort.ForceSetLevel(Rand.Range(0.6f, 0.9f));
                pawn.needs.space.ForceSetLevel(Rand.Range(0.1f, 0.3f)); // Drop-pod is very small.

                ActiveDropPodInfo dropPodInfo = new ActiveDropPodInfo();
                bool healingSuccessful        = (Rand.Value < 0.98f);
                if (healingSuccessful)
                {
                    string orbitalHealingFailedText = "-- Comlink with MiningCo. --\n\n"
                                                      + "\"Healing of " + pawn.NameStringShort + " is now finished. Everything went fine during the treatment.\n"
                                                      + "We just launched " + hisHerIts + " drop pod toward your colony.\n\n"
                                                      + "I hope you are satisfied of our services.\n\n"
                                                      + "MiningCo. medibay officer out.\"\n\n"
                                                      + "-- End of transmission --";
                    Find.LetterStack.ReceiveLetter("Orbital healing finished", orbitalHealingFailedText, LetterDefOf.PositiveEvent, new TargetInfo(dropSpot, map));
                }
                else
                {
                    // Dying pawn with heart attack.
                    string orbitalHealingSuccessfulText = "-- Comlink with MiningCo. --\n\n"
                                                          + "\"Though we did our best to heal " + pawn.NameStringShort + ", it seems " + hisHerIts + " metabolism was disturbed by the last injection.\n\n"
                                                          + "I am affraid that we need to immediately send " + himHerIt + " back to you as our rules strictly forbid civilian bodies storage.\n\n"
                                                          + "Please accept those silvers as a compensation.\n\n"
                                                          + "MiningCo. medibay officer out.\"\n\n"
                                                          + "-- End of transmission --";
                    Find.LetterStack.ReceiveLetter("Orbital healing interrupted", orbitalHealingSuccessfulText, LetterDefOf.NegativeEvent, new TargetInfo(dropSpot, map));
                    pawn.health.AddHediff(HediffDef.Named("HeartAttack"));
                    pawn.health.AddHediff(HediffDefOf.Anesthetic);
                    Thing compensation = ThingMaker.MakeThing(ThingDefOf.Silver);
                    compensation.stackCount = Mathf.RoundToInt(0.5f * Util_Spaceship.orbitalHealingCost);
                    dropPodInfo.innerContainer.TryAdd(compensation);
                }
                dropPodInfo.innerContainer.TryAdd(pawn);
                dropPodInfo.leaveSlag = true;
                DropPodUtility.MakeDropPodAt(dropSpot, map, dropPodInfo);
                return(true);
            }
            return(false);
        }
 private static Texture2D female() => GenderUtility.GetIcon(Gender.Female);
 private static Texture2D other() => GenderUtility.GetIcon(Gender.None);
Beispiel #11
0
        public void drawGender(Rect rect)
        {
            var displayedNameArray = Enum.GetValues(typeof(Gender)).Cast <Gender>().ToList().Select((gender) => GenderUtility.GetLabel(gender)).ToArray();

            drawButton(rect, GenderUtility.GetLabel(RandomSettings.PawnFilter.Gender), typeof(Gender), displayedNameArray, genderCallback, false);
        }