示例#1
0
 public void GameConditionManagerTick()
 {
     for (int i = this.activeConditions.Count - 1; i >= 0; i--)
     {
         GameCondition gameCondition = this.activeConditions[i];
         if (gameCondition.Expired)
         {
             gameCondition.End();
         }
         else
         {
             gameCondition.GameConditionTick();
         }
     }
 }
 public void GameConditionManagerTick()
 {
     for (int num = activeConditions.Count - 1; num >= 0; num--)
     {
         GameCondition gameCondition = activeConditions[num];
         if (gameCondition.Expired)
         {
             gameCondition.End();
         }
         else
         {
             gameCondition.GameConditionTick();
         }
     }
 }
 internal bool AllowEnjoyableOutsideNow(Map map, out GameConditionDef reason)
 {
     for (int i = 0; i < activeConditions.Count; i++)
     {
         GameCondition gameCondition = activeConditions[i];
         if (!gameCondition.AllowEnjoyableOutsideNow(map))
         {
             reason = gameCondition.def;
             return(false);
         }
     }
     reason = null;
     if (Parent != null)
     {
         return(Parent.AllowEnjoyableOutsideNow(map, out reason));
     }
     return(true);
 }
示例#4
0
 public override void Notify_QuestSignalReceived(Signal signal)
 {
     base.Notify_QuestSignalReceived(signal);
     if (signal.tag == inSignal && (targetWorld || mapParent != null) && gameCondition != null)
     {
         gameCondition.quest = quest;
         if (targetWorld)
         {
             Find.World.gameConditionManager.RegisterCondition(gameCondition);
         }
         else
         {
             mapParent.Map.gameConditionManager.RegisterCondition(gameCondition);
         }
         if (sendStandardLetter)
         {
             Find.LetterStack.ReceiveLetter(gameCondition.LabelCap, gameCondition.LetterText, gameCondition.def.letterDef, LookTargets.Invalid, null, quest);
         }
         gameCondition = null;
     }
 }
示例#5
0
        public void DoConditionsUI(Rect rect)
        {
            GUI.BeginGroup(rect);
            float num = 0f;

            for (int i = 0; i < this.activeConditions.Count; i++)
            {
                float width = rect.width - 15f;
                Rect  rect2 = new Rect(0f, num, width, Text.CalcHeight(this.activeConditions[i].LabelCap, width));
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleRight;
                Widgets.Label(rect2, this.activeConditions[i].LabelCap);
                GameCondition localCond = this.activeConditions[i];
                TooltipHandler.TipRegion(rect2, () => localCond.TooltipString, i * 631);
                num += rect2.height;
            }
            rect.yMin += num;
            GUI.EndGroup();
            Text.Anchor = TextAnchor.UpperLeft;
            if (this.Parent != null)
            {
                this.Parent.DoConditionsUI(rect);
            }
        }
 private static bool <CurrentWeatherCommonality> m__1(GameCondition x)
 {
     return(x.def.preventRain);
 }
示例#7
0
 public void RegisterCondition(GameCondition cond)
 {
     this.activeConditions.Add(cond);
     cond.gameConditionManager = this;
     cond.Init();
 }
示例#8
0
 protected override void SetupCondition(GameCondition condition, Map map)
 {
     base.SetupCondition(condition, map);
     ((GameCondition_ForceWeather)condition).weather = weather;
 }
        public override void GenerateIntoMap(Map map)
        {
            GameCondition cond = GameConditionMaker.MakeConditionPermanent(this.gameCondition);

            map.gameConditionManager.RegisterCondition(cond);
        }
示例#10
0
 protected virtual void SetupCondition(GameCondition condition, Map map)
 {
     condition.suppressEndMessage = true;
 }
 protected override void SetupCondition(GameCondition condition, Map map)
 {
     base.SetupCondition(condition, map);
     ((GameCondition_TemperatureOffset)condition).tempOffset = temperatureOffset;
 }
示例#12
0
 protected override void SetupCondition(GameCondition condition, Map map)
 {
     base.SetupCondition(condition, map);
     ((GameCondition_PsychicSuppression)condition).gender = gender;
 }
        // Token: 0x06000E1C RID: 3612 RVA: 0x00069B78 File Offset: 0x00067F78
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            GameConditionManager gameConditionManager = parms.target.GameConditionManager;
            int           duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f);
            GameCondition cond     = GameConditionMaker.MakeCondition(this.def.gameCondition, duration, 0);

            gameConditionManager.RegisterCondition(cond);
            Map     map = (Map)parms.target;
            IntVec3 spawnSpot;

            if (!this.TryFindSpawnSpot(map, out spawnSpot))
            {
                return(false);
            }
            Faction faction = Find.FactionManager.FirstFactionOfDef(XenomorphDefOf.RRY_Xenomorph);

            if (faction == null)
            {
                return(false);
            }
            int           @int      = Rand.Int;
            IncidentParms raidParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, map);

            raidParms.forced               = true;
            raidParms.faction              = faction;
            raidParms.raidStrategy         = RaidStrategyDefOf.ImmediateAttack;
            raidParms.raidArrivalMode      = PawnsArrivalModeDefOf.EdgeWalkIn;
            raidParms.spawnCenter          = spawnSpot;
            raidParms.generateFightersOnly = true;
            raidParms.points               = Mathf.Max(raidParms.points * IncidentWorker_PowerCut.RaidPointsFactorRange.RandomInRange, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            raidParms.pawnGroupMakerSeed   = new int?(@int);
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, raidParms, false);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, raidParms.raidArrivalMode, raidParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);

            base.SendStandardLetter();
            QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_PowerCut.RaidDelay.RandomInRange, 0);

            Find.Storyteller.incidentQueue.Add(qi);

            /*
             * DiaNode diaNode = new DiaNode(text);
             * DiaOption diaOption = new DiaOption("RefugeeChasedInitial_Accept".Translate());
             * diaOption.action = delegate ()
             * {
             *  QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_PowerCut.RaidDelay.RandomInRange, 0);
             *  Find.Storyteller.incidentQueue.Add(qi);
             * };
             * diaOption.resolveTree = true;
             * diaNode.options.Add(diaOption);
             * string text2 = "RefugeeChasedRejected".Translate(refugee.LabelShort, refugee);
             * DiaNode diaNode2 = new DiaNode(text2);
             * DiaOption diaOption2 = new DiaOption("OK".Translate());
             * diaOption2.resolveTree = true;
             * diaNode2.options.Add(diaOption2);
             * DiaOption diaOption3 = new DiaOption("RefugeeChasedInitial_Reject".Translate());
             * diaOption3.action = delegate ()
             * {
             *  Find.WorldPawns.PassToWorld(refugee, PawnDiscardDecideMode.Decide);
             * };
             * diaOption3.link = diaNode2;
             * diaNode.options.Add(diaOption3);
             * string title = "RefugeeChasedTitle".Translate(map.Parent.Label);
             * Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, faction, true, true, title));
             * Find.Archive.Add(new ArchivedDialog(diaNode.text, title, faction));
             */
            return(true);
        }