コード例 #1
0
ファイル: Need_Joy.cs プロジェクト: KraigXu/GameProject
        public override string GetTipString()
        {
            string text  = base.GetTipString();
            string text2 = tolerances.TolerancesString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + "\n\n" + text2;
            }
            if (pawn.MapHeld != null)
            {
                ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(pawn);
                text += "\n\n" + "CurrentExpectationsAndRecreation".Translate(expectationDef.label, expectationDef.joyToleranceDropPerDay.ToStringPercent(), expectationDef.joyKindsNeeded);
                text  = text + "\n\n" + JoyUtility.JoyKindsOnMapString(pawn.MapHeld);
            }
            else
            {
                Caravan caravan = pawn.GetCaravan();
                if (caravan != null)
                {
                    float num = caravan.needs.GetCurrentJoyGainPerTick(pawn) * 2500f;
                    if (num > 0f)
                    {
                        text += "\n\n" + "GainingJoyBecauseCaravanNotMoving".Translate() + ": +" + num.ToStringPercent() + "/" + "LetterHour".Translate();
                    }
                }
            }
            return(text);
        }
コード例 #2
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(p);

            if (expectationDef == null)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(expectationDef.thoughtStage));
        }
コード例 #3
0
        public override string GetExplanation()
        {
            Map            map            = this.BadMap();
            int            value          = JoyUtility.JoyKindsOnMapCount(map);
            string         label          = map.info.parent.Label;
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(map);
            int            joyKindsNeeded = expectationDef.joyKindsNeeded;
            string         value2         = "AvailableRecreationTypes".Translate() + ":\n\n" + JoyUtility.JoyKindsOnMapString(map);
            string         value3         = "MissingRecreationTypes".Translate() + ":\n\n" + JoyUtility.JoyKindsNotOnMapString(map);

            return("NeedJoySourceDesc".Translate(value, label, expectationDef.label, joyKindsNeeded, value2, value3));
        }
コード例 #4
0
        private bool NeedJoySource(Map map)
        {
            if (!map.IsPlayerHome)
            {
                return(false);
            }
            if (!map.mapPawns.AnyColonistSpawned)
            {
                return(false);
            }
            int num            = JoyUtility.JoyKindsOnMapCount(map);
            int joyKindsNeeded = ExpectationsUtility.CurrentExpectationFor(map).joyKindsNeeded;

            return(num < joyKindsNeeded);
        }
コード例 #5
0
 public static ExpectationDef CurrentExpectationFor(Pawn p)
 {
     if (Current.ProgramState != ProgramState.Playing)
     {
         return(null);
     }
     if (p.Faction != Faction.OfPlayer && !p.IsPrisonerOfColony)
     {
         return(ExpectationDefOf.ExtremelyLow);
     }
     if (p.MapHeld != null)
     {
         return(ExpectationsUtility.CurrentExpectationFor(p.MapHeld));
     }
     return(ExpectationDefOf.VeryLow);
 }
コード例 #6
0
        public override string GetTipString()
        {
            string text  = base.GetTipString();
            string text2 = this.tolerances.TolerancesString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + "\n\n" + text2;
            }
            Map mapHeld = this.pawn.MapHeld;

            if (mapHeld != null)
            {
                ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(this.pawn);
                text = text + "\n\n" + "CurrentExpectationsAndRecreation".Translate(new object[]
                {
                    expectationDef.label,
                    expectationDef.joyToleranceDropPerDay.ToStringPercent(),
                    expectationDef.joyKindsNeeded
                });
                text = text + "\n\n" + JoyUtility.JoyKindsOnMapString(this.pawn.MapHeld);
            }
            else
            {
                Caravan caravan = this.pawn.GetCaravan();
                if (caravan != null)
                {
                    float num = caravan.needs.GetCurrentJoyGainPerTick(this.pawn) * 2500f;
                    if (num > 0f)
                    {
                        string text3 = text;
                        text = string.Concat(new string[]
                        {
                            text3,
                            "\n\n",
                            "GainingJoyBecauseCaravanNotMoving".Translate(),
                            ": +",
                            num.ToStringPercent(),
                            "/",
                            "LetterHour".Translate()
                        });
                    }
                }
            }
            return(text);
        }
コード例 #7
0
ファイル: JoyToleranceSet.cs プロジェクト: potsh/RimWorld
        public void NeedInterval(Pawn pawn)
        {
            float num = ExpectationsUtility.CurrentExpectationFor(pawn).joyToleranceDropPerDay * 150f / 60000f;

            for (int i = 0; i < tolerances.Count; i++)
            {
                float num2 = tolerances[i];
                num2 -= num;
                if (num2 < 0f)
                {
                    num2 = 0f;
                }
                tolerances[i] = num2;
                if (bored[i] && num2 < 0.3f)
                {
                    bored[i] = false;
                }
            }
        }
コード例 #8
0
        public static ExpectationDef CurrentExpectationFor(Pawn p)
        {
            ExpectationDef result;

            if (Current.ProgramState != ProgramState.Playing)
            {
                result = null;
            }
            else if (p.Faction != Faction.OfPlayer)
            {
                result = ExpectationDefOf.ExtremelyLow;
            }
            else if (p.MapHeld != null)
            {
                result = ExpectationsUtility.CurrentExpectationFor(p.MapHeld);
            }
            else
            {
                result = ExpectationDefOf.VeryLow;
            }
            return(result);
        }