public override void PostGameStart() { if (Find.GameInitData.startedFromEntry) { Find.MusicManagerPlay.disabled = true; Find.WindowStack.Notify_GameStartDialogOpened(); DiaNode diaNode = new DiaNode(text.NullOrEmpty() ? textKey.TranslateSimple() : text); DiaOption diaOption = new DiaOption(); diaOption.resolveTree = true; diaOption.clickSound = null; diaNode.options.Add(diaOption); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode); dialog_NodeTree.soundClose = ((closeSound != null) ? closeSound : SoundDefOf.GameStartSting); dialog_NodeTree.closeAction = delegate { Find.MusicManagerPlay.ForceSilenceFor(7f); Find.MusicManagerPlay.disabled = false; Find.WindowStack.Notify_GameStartDialogClosed(); Find.TickManager.CurTimeSpeed = TimeSpeed.Normal; TutorSystem.Notify_Event("GameStartDialogClosed"); }; Find.WindowStack.Add(dialog_NodeTree); Find.Archive.Add(new ArchivedDialog(diaNode.text)); } }
private FloatMenuOption EnterOption(Pawn pawn, bool first) { FloatMenuOption option = new FloatMenuOption("CheckInsideLuke".Translate(), null); if (!GenRadial.RadialDistinctThingsAround(parent.Position, parent.Map, CollectThingsRadius, false).Where(x => x.Faction == Faction.OfPlayer).Any()) { return(option); } option.action = delegate { DiaOption diaOption = new DiaOption("CheckInsideLuke_OK".Translate()); diaOption.resolveTree = true; diaOption.action = () => DoEnter(first); DiaOption diaOption2 = new DiaOption("CheckInsideLuke_NO".Translate()); diaOption2.resolveTree = true; DiaNode diaNode = new DiaNode("CheckInsideLuke_Info".Translate(CollectThingsRadius)); diaNode.options.Add(diaOption); diaNode.options.Add(diaOption2); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode, delayInteractivity: true); Find.WindowStack.Add(dialog_NodeTree); }; return(option); }
public static void EndGameDialogMessage(string msg, bool allowKeepPlaying, Color screenFillColor) { DiaNode diaNode = new DiaNode(msg); if (allowKeepPlaying) { DiaOption diaOption = new DiaOption("GameOverKeepPlaying".Translate()); diaOption.resolveTree = true; diaNode.options.Add(diaOption); } DiaOption diaOption2 = new DiaOption("GameOverMainMenu".Translate()); diaOption2.action = delegate { GenScene.GoToMainMenu(); }; diaOption2.resolveTree = true; diaNode.options.Add(diaOption2); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode, true, false, null); dialog_NodeTree.screenFillColor = screenFillColor; dialog_NodeTree.silenceAmbientSound = !allowKeepPlaying; dialog_NodeTree.closeOnAccept = allowKeepPlaying; dialog_NodeTree.closeOnCancel = allowKeepPlaying; Find.WindowStack.Add(dialog_NodeTree); Find.Archive.Add(new ArchivedDialog(diaNode.text, null, null)); }
private void EndQuestAndGenerateRewards() { float rewardValue = 0; foreach (var item in items) { if (item != null && !item.Destroyed) { rewardValue += item.stackCount * item.MarketValue; item.Destroy(); } } rewardValue *= Rand.Range(0.8f, 1.2f); GenerateRewards(GetQuestThingFilter(), new FloatRange(rewardValue, rewardValue), new IntRange(3, 8), null, null); DiaNode node = new DiaNode("Quest_DarkNetCaptureMaterials_SignalDialog".Translate(GetRewardsString())); DiaOption option = new DiaOption("OK"); option.action = delegate { signalSended = true; Site.ForceReform(Site); }; node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public override void OpenCommunications(Pawn negotiator) { Dialog_NodeTree dialog = new Dialog_NodeTree(ExtortionCommunication_Dialogs.MakeExtortionRootNode(pw), false, false, "ProblemHackerExtortionDialogTitle".Translate()); Find.WindowStack.Add(dialog); FindExt.DynamicCommManagerFor(pw.rootMap).RemoveCommunication(this); }
public override void OpenCommunications(Pawn negotiator) { Dialog_NodeTree dialog = new Dialog_NodeTree(MakeAnswerWeakContactAttemptRootNode(negotiator), false, false, "PH_WCA_RootTitle".Translate()); Find.WindowStack.Add(dialog); FindExt.DynamicCommManagerFor(pw.rootMap).RemoveCommunication(this); }
public override void OpenCommunications(Pawn negotiator) { Dialog_NodeTree dialog = new Dialog_NodeTree(ContactHackedAllyBase_Dialogs.MakeContactHackedAllyBaseRootNode(pw), false, false, "ProblemHackerContactHackedAllyBaseTitle".Translate(pw.alliedBase.Name)); Find.WindowStack.Add(dialog); FindExt.DynamicCommManagerFor(pw.rootMap).RemoveCommunication(this); }
/// <summary> /// Show a help screen 10s after start /// </summary> /// <param name="forceShow"></param> private void DoStartupScreen(bool forceShow = false) { if (wasHelpTextShown && !forceShow) { return; } if (showHelpTextCounter < showHelpAfterStartCounterMax && !forceShow) { showHelpTextCounter++; return; } // First info message => Letter if (!wasHelpTextShown && !forceShow) { wasHelpTextShown = true; DoStartUpInfoMessage(); return; } if (!wasHelpTextShown || forceShow) { wasHelpTextShown = true; StringBuilder dialogText = new StringBuilder(); dialogText.Append(translationHelp_prt1.Translate()); dialogText.AppendLine().AppendLine(); dialogText.Append(translationHelp_prt2.Translate()); dialogText.AppendLine().AppendLine(); dialogText.Append(translationHelp_prt3.Translate()); dialogText.AppendLine().AppendLine(); dialogText.Append(translationHelp_prt4.Translate()); Find.MusicManagerPlay.disabled = true; DiaNode diaNode = new DiaNode(dialogText.ToString()); DiaOption diaOption = new DiaOption() { resolveTree = true, //action = () => //{ // //Find.TickManager.curTimeSpeed = TimeSpeed.Paused; // //Find.MusicManagerMap.ForceSilenceFor(7f); // //Find.MusicManagerMap.disabled = false; //}, clickSound = null, }; diaNode.options.Add(diaOption); Dialog_NodeTree dialogNodeTree = new Dialog_NodeTree(diaNode) { //forcePause = true //soundClose = SoundDef.Named("GameStartSting") }; Find.WindowStack.Add(dialogNodeTree); Find.MusicManagerPlay.disabled = false; } }
public void DoLose(bool anyHelp = false) { settlement.Quest.EndQuest(null, QuestRim.EndCondition.Fail); bool defeated = true; DiaNode node = null; if (anyHelp) { node = new DiaNode("AttackedFriendlySettlementDefendLoseWithHelp".Translate()); } else { node = new DiaNode("AttackedFriendlySettlementLoseWithoutHelp".Translate()); float liveChance = 0.20f * (int)settlement.Faction.def.techLevel; if (liveChance > Rand.Value) { defeated = false; } Find.WorldObjects.Remove(settlement); } if (defeated) { var factionSettlement = Find.WorldObjects.SettlementAt(settlement.Tile); if (factionSettlement != null) { Find.WorldObjects.Remove(factionSettlement); if (!HasAnySettlement(settlement.Faction)) { settlement.Faction.defeated = true; } } if (!settlement.Faction.defeated) { settlement.Faction.TryAffectGoodwillWith(Faction.OfPlayer, -(5 * (int)OffensiveFaction?.def.techLevel)); } } else { if (!settlement.Faction.defeated) { settlement.Faction.TryAffectGoodwillWith(Faction.OfPlayer, -(5 * (int)OffensiveFaction?.def.techLevel)); } } DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
private void MakeDialog(string text) { DiaNode node = new DiaNode(text); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
private void ShowHelp() { DiaNode node = new DiaNode("DoomsdayEnterSiteHelp".Translate()); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
private void ShowInfo() { DiaNode node = new DiaNode("Quest_SuppressionRebellion_Dia".Translate(Faction.Name)); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public void HiveActiveDialogMessage(Faction f, int phase, string msg, int daysLeft) { DiaNode diaNode = new DiaNode(msg.Translate(f, phase, daysLeft)); DiaOption diaOption = new DiaOption("OK"); diaOption.resolveTree = true; diaNode.options.Add(diaOption); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode, true, false, null); Find.WindowStack.Add(dialog_NodeTree); Find.Archive.Add(new ArchivedDialog(diaNode.text, null, null)); }
private void ShowInfo() { DiaNode node = new DiaNode("Quest_DarkNetKillInformator_Info".Translate(Informator.Name.ToStringFull)); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public void NewGameDialogMessage(Faction f, string msg) { DiaNode diaNode = new DiaNode(msg.Translate(f)); DiaOption diaOption = new DiaOption("OK"); diaOption.resolveTree = true; diaNode.options.Add(diaOption); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode, true, false, null); Find.WindowStack.Add(dialog_NodeTree); Find.Archive.Add(new ArchivedDialog(diaNode.text, null, null)); }
private void ShowDialog() { DiaNode node = new DiaNode("Quest_DarkNetCaptureMaterials_Info".Translate()); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public static PersistentDialog CreateInstance(Map map, Dialog_NodeTree dialog) { Type target = bindings.TryGetValue(dialog.GetType()); if (target == null) { Log.Warning($"Unknow Window Type {target}"); return(null); } return((PersistentDialog)Activator.CreateInstance(target, map, dialog)); }
public override void PostMapGenerate(Map map) { base.PostMapGenerate(map); DiaNode node = new DiaNode("Quest_Archotech_567H_GetResources_Dialog".Translate()); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public override void DoAction(FactionInteraction interaction, Pawn speaker, Pawn defendant) { var war = interaction.FirstWarWithPlayer(); if (war != null) { Messages.Message("CommOption_SubscribeScout_CantSub".Translate(), MessageTypeDefOf.NeutralEvent); return; } bool subAlready = ScoutingComp.ScoutAlready(interaction.Faction, out ScoutingComp outComp); StringBuilder builder = new StringBuilder(); builder.Append("CommOption_SubscribeScout_SubTitle".Translate()); DiaOption diaOption = new DiaOption("CommOption_SubscribeScout_SubButton".Translate()); if (subAlready) { builder.Append("CommOption_SubscribeScout_SubAlready".Translate(outComp.GetDays())); diaOption.Disable("CommOption_SubscribeScout_SubAlreadyOption".Translate()); } else if (interaction.Faction.PlayerGoodwill < 80) { diaOption.Disable("CommOption_SubscribeScout_SubGoodWillOption".Translate()); } diaOption.action = delegate { if (!subAlready) { ScoutingComp.GiveScoutingComp(interaction.Faction, 2, 14, 5); } }; diaOption.resolveTree = true; DiaOption diaOption2 = new DiaOption("CommOption_ExitNode".Translate()); diaOption2.resolveTree = true; DiaNode diaNode = new DiaNode(builder.ToString()); diaNode.options.Add(diaOption); diaNode.options.Add(diaOption2); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode, delayInteractivity: true); Find.WindowStack.Add(dialog_NodeTree); }
private void ShowHelp() { HelpShowed = true; DiaNode node = new DiaNode("AttackedFriendlySettlementDefendHelp".Translate()); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public override IEnumerable <Gizmo> GetGizmos(QuestSite site) { foreach (var gizmo in base.GetGizmos(site)) { yield return(gizmo); } if (!signalSended && site.HasMap) { yield return(new Command_Action { defaultLabel = "Quest_Archotech_567H_GetResources_SignalLabel".Translate(), defaultDesc = "Quest_Archotech_567H_GetResources_SignalDescription".Translate(), icon = ContentFinder <Texture2D> .Get("Quests/send-signal"), action = delegate { signalSended = true; DiaNode node = new DiaNode("Quest_Archotech_567H_GetResources_SignalDialog".Translate()); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); List <Pawn> pawns = site.Map.mapPawns.AllPawnsSpawned.Where(p => p.Faction == Faction && !p.Downed && !p.Dead).ToList(); LordJob lordJob = new LordJob_AssaultColony(Faction, canKidnap: false, canTimeoutOrFlee: false, canSteal: false); Lord lord = LordMaker.MakeNewLord(Faction, lordJob, site.Map); lord.numPawnsLostViolently = int.MaxValue; foreach (var p in pawns) { Lord lastLord = p.GetLord(); if (lastLord != null) { site.Map.lordManager.RemoveLord(lastLord); } p.ClearMind(); lord.AddPawn(p); } } }); } }
public void ShowHint() { if (HintShown) { return; } DiaNode node = new DiaNode(Translator.Translate("DefusingInfo")); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); HintShown = true; }
public override void PostMapGenerate(Map map) { base.PostMapGenerate(map); MapGeneratorHandler.GenerateMap(MapDefOfLocal.BaseX1, map, out List <Pawn> pawns, true, true, true, false, true, true, true, Find.FactionManager.FirstFactionOfDef(MoreEvents.FactionDefOfLocal.Pirate)); var mutantsFaction = Find.FactionManager.FirstFactionOfDef(MoreEvents.FactionDefOfLocal.Mutants); if (mutantsFaction == null) { Log.Warning("Mutants is null."); } foreach (var p in pawns) { if (p.RaceProps.Animal) { p.GetLord()?.Notify_PawnLost(p, PawnLostCondition.Undefined, null); p.SetFaction(mutantsFaction); LordJob_AnimalDefendPointAggresive lordJob = new LordJob_AnimalDefendPointAggresive(p.Faction, p.Position); Lord lord = LordMaker.MakeNewLord(p.Faction, lordJob, map); lord.numPawnsLostViolently = int.MaxValue; lord.AddPawn(p); } } DiaNode node = new DiaNode("Quest_Laboratory_Info1".Translate()); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); UnlimitedTime = true; DoDestroyDestroyable(); }
public void EndGameDialogMessage(string msg, Color screenFillColor) { DiaNode diaNode = new DiaNode(msg); DiaOption diaOption2 = new DiaOption("END"); diaOption2.action = delegate { GenScene.GoToMainMenu(); }; diaOption2.resolveTree = true; diaNode.options.Add(diaOption2); Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode, delayInteractivity: true); dialog_NodeTree.screenFillColor = screenFillColor; dialog_NodeTree.silenceAmbientSound = false; dialog_NodeTree.closeOnAccept = false; dialog_NodeTree.closeOnCancel = false; Find.WindowStack.Add(dialog_NodeTree); Find.Archive.Add(new ArchivedDialog(diaNode.text)); }
public void DoVictory() { settlement.AttackRepelled = true; TransferColonists(false); int savedPawns = friendlyPawnsBeforeAttack - friendlyPawns.Where(p => p != null && p.Dead).Count(); if (savedPawns <= 0) { DoLose(true); return; } settlement.Quest.EndQuest(null, QuestRim.EndCondition.Success); settlement.Faction.TryAffectGoodwillWith(Faction.OfPlayer, 2 + savedPawns); FloatRange value = (RewardMarketValueRange * (int)settlement.Faction.def.techLevel); int pawnsValue = savedPawns * 50; value.min += pawnsValue; value.max += pawnsValue; List <Thing> rewards = GenerateRewards(value); StringBuilder builder = new StringBuilder(); foreach (var thing in rewards) { builder.Append($"\n- {thing.LabelCap}"); GenDrop.TryDropSpawn(thing, settlement.Map.Center, settlement.Map, ThingPlaceMode.Near, out Thing t); } DiaNode node = new DiaNode("AttackedFriendlySettlementDefendVictory".Translate(settlement.Faction, savedPawns, builder.ToString())); DiaOption option = new DiaOption("OK"); node.options.Add(option); option.resolveTree = true; var dialog = new Dialog_NodeTree(node); Find.WindowStack.Add(dialog); }
public void ResolveNegotiations(Pawn playerNegotiator, Pawn otherNegotiator) { if (Rand.Chance(0.95f)) { QualityCategory qualityCategory = QualityUtility.GenerateQualityCreatedByPawn(playerNegotiator.skills.GetSkill(SkillDefOf.Social).Level, false); int num = 0; string text = ""; switch (qualityCategory) { case QualityCategory.Awful: num = -5; text = TranslatorFormattedStringExtensions.Translate("RD_DiplomacyAwful", playerNegotiator.Label, this.requestingFaction.Name, num); //"The flailing diplomatic "strategy" of {0} seemed chiefly to involve wild swings between aggression and panic, peppered liberally with lewd insults involving the negotiator for {1}'s antecedents. Your already strained relations have, understandably, worsened ({2} to relations)."; break; case QualityCategory.Poor: num = -1; text = TranslatorFormattedStringExtensions.Translate("RD_DiplomacyPoor" //"The chief negotiation tactic employed by {0} seemed to be staring bored at the wall. This did little to diffuse tensions and engender a feeling of respect ({2} to relations))"; , playerNegotiator.Label, this.requestingFaction.Name, num); break; case QualityCategory.Normal: case QualityCategory.Good: num = 8; text = TranslatorFormattedStringExtensions.Translate("RD_DiplomacyNormalGood" //"{0}'s negotiation adequately dealt with some minor disputes you have with {1}. Your relations have improved by {2}."; , playerNegotiator.Label, this.requestingFaction.Name, num); break; case QualityCategory.Excellent: num = 16; text = TranslatorFormattedStringExtensions.Translate("RD_DiplomacyExcellent" //"{0}'s easy, but unyielding manner dealt well with a number of the negotiator for {1}'s concerns. Your relations have improved by {2}"; , playerNegotiator.Label, this.requestingFaction.Name, num); break; case QualityCategory.Masterwork: case QualityCategory.Legendary: num = 32; text = TranslatorFormattedStringExtensions.Translate("RD_DiplomacyMasterWorkLegendary" //"{0} made diplomacy look as easy as breathing, with an almost magical ability to make {1}'s negotiator see your perspective. Your relations have undergone a substantial improvement of {2}."; , playerNegotiator.Label, this.requestingFaction.Name, num); break; } DiaNode diaNode = new DiaNode(text); DiaOption diaOption = new DiaOption("OK".Translate()); diaOption.resolveTree = true; diaNode.options.Add(diaOption); Dialog_NodeTree window = new Dialog_NodeTree(diaNode, false, false, null); Find.WindowStack.Add(window); this.facOriginalRelationship += num; this.active = false; ThingComp comp = this.Negotiator.GetComp <CompNegotiator>(); if (comp != null) { this.Negotiator.AllComps.Remove(comp); } } else { DiaNode diaNode2 = new DiaNode("RD_NegotiationsTrap".Translate()); //"The negotiations are a trap!" DiaOption diaOption2 = new DiaOption("OK".Translate()); diaOption2.resolveTree = true; diaNode2.options.Add(diaOption2); Dialog_NodeTree window2 = new Dialog_NodeTree(diaNode2, false, false, null); Find.WindowStack.Add(window2); this.requestingFaction.TryAffectGoodwillWith(Faction.OfPlayer, -101); } }