private Guid UpdateStatusItem(StatusItem item, bool show, Guid current_handle, KSelectable ksel) { Guid result = current_handle; if (show != (current_handle != Guid.Empty)) { if (show) { result = ksel.AddStatusItem(item, base.master); } else { result = ksel.RemoveStatusItem(current_handle, false); } } return(result); }
// 本体 internal void UpdateHoverElements(List <KSelectable> hoverObjects) { if (__this.iconWarning == null) { __this.ConfigureHoverScreen(); } if (OverlayScreen.Instance == null || !Grid.IsValidCell(cellPos)) { return; } HoverTextDrawer hoverTextDrawer = HoverTextScreen.Instance.BeginDrawing(); __private_accessor.overlayValidHoverObjects.Clear(); foreach (KSelectable kselectable in hoverObjects) { if (__private_accessor.ShouldShowSelectableInCurrentOverlay(kselectable)) { __private_accessor.overlayValidHoverObjects.Add(kselectable); } } __this.currentSelectedSelectableIndex = -1; if (SelectToolHoverTextCard.highlightedObjects.Count > 0) { SelectToolHoverTextCard.highlightedObjects.Clear(); } if (CurrentMode == OverlayModes.Temperature.ID && Game.Instance.temperatureOverlayMode == Game.TemperatureOverlayModes.HeatFlow) { HeatflowCard(hoverTextDrawer); } else if (CurrentMode == OverlayModes.Decor.ID) { DecorCard(hoverTextDrawer); } else if (CurrentMode == OverlayModes.Rooms.ID) { RoomCard(hoverTextDrawer); } else if (CurrentMode == OverlayModes.Light.ID) { LightingCard(hoverTextDrawer); } else if (CurrentMode == OverlayModes.Logic.ID) { LogicCard(hoverTextDrawer, hoverObjects); } int numOfSelectableCard = 0; // kを使いたいのでforeachではなくfor for (int k = 0; k < __private_accessor.overlayValidHoverObjects.Count; k++) { KSelectable kselectable3 = __private_accessor.overlayValidHoverObjects[k]; if (kselectable3 == null) { continue; } if (kselectable3.GetComponent <CellSelectionObject>() != null) { continue; } // if ((!(OverlayScreen.Instance != null) || !(OverlayScreen.Instance.mode != OverlayModes.None.ID) || (kselectable3.gameObject.layer & __private_accessor.maskOverlay) == 0) && isVisible) if (!isVisible) { continue; } if (!(OverlayScreen.Instance != null) || !(OverlayScreen.Instance.mode != OverlayModes.None.ID) || (kselectable3.gameObject.layer & __private_accessor.maskOverlay) == 0) { } else { continue; } bool selected = SelectTool.Instance.selected == kselectable3; if (selected) { __this.currentSelectedSelectableIndex = k; } numOfSelectableCard++; ItemCard(hoverTextDrawer, kselectable3, selected); } __this.recentNumberOfDisplayedSelectables = numOfSelectableCard + 1; if (displayMiscCard) { MiscCard(hoverTextDrawer); } else if (!isVisible) { hoverTextDrawer.BeginShadowBar(false); hoverTextDrawer.DrawIcon(__this.iconWarning, 18); hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.UNKNOWN, __this.Styles_BodyText.Standard); hoverTextDrawer.EndShadowBar(); } hoverTextDrawer.EndDrawing(); }
protected override void OnPrefabInit() { base.OnPrefabInit(); _selectable = GetComponent <KSelectable>(); }
protected override void OnSpawn() { base.OnSpawn(); KBatchedAnimController component = GetComponent <KBatchedAnimController>(); Rotatable component2 = GetComponent <Rotatable>(); if ((Object)component != (Object)null && (Object)component2 == (Object)null) { component.Offset = Def.GetVisualizerOffset() + Def.placementPivot; } KBoxCollider2D component3 = GetComponent <KBoxCollider2D>(); if ((Object)component3 != (Object)null) { Vector3 visualizerOffset = Def.GetVisualizerOffset(); component3.offset += new Vector2(visualizerOffset.x, visualizerOffset.y); } int cell = Grid.PosToCell(base.transform.GetPosition()); if (Def.IsFoundation) { int[] placementCells = base.PlacementCells; foreach (int num in placementCells) { Grid.Foundation[num] = true; Game.Instance.roomProber.SolidChangedEvent(num, false); } } Vector3 position = Grid.CellToPosCBC(cell, Def.SceneLayer); base.transform.SetPosition(position); PrimaryElement component4 = GetComponent <PrimaryElement>(); if ((Object)component4 != (Object)null && component4.Mass == 0f) { component4.Mass = Def.Mass[0]; } Def.MarkArea(cell, base.Orientation, Def.ObjectLayer, base.gameObject); if (Def.IsTilePiece) { Def.MarkArea(cell, base.Orientation, Def.TileLayer, base.gameObject); Def.RunOnArea(cell, base.Orientation, delegate(int c) { TileVisualizer.RefreshCell(c, Def.TileLayer, Def.ReplacementLayer); }); } RegisterBlockTileRenderer(); if (Def.PreventIdleTraversalPastBuilding) { for (int j = 0; j < base.PlacementCells.Length; j++) { Grid.PreventIdleTraversal[base.PlacementCells[j]] = true; } } KSelectable component5 = GetComponent <KSelectable>(); if ((Object)component5 != (Object)null) { component5.SetStatusIndicatorOffset(Def.placementPivot); } Components.BuildingCompletes.Add(this); BuildingConfigManager.Instance.AddBuildingCompleteKComponents(base.gameObject, Def.Tag); hasSpawnedKComponents = true; scenePartitionerEntry = GameScenePartitioner.Instance.Add(base.name, this, GetExtents(), GameScenePartitioner.Instance.completeBuildings, null); Attributes attributes = this.GetAttributes(); if (attributes != null) { Deconstructable component6 = GetComponent <Deconstructable>(); if ((Object)component6 != (Object)null) { for (int k = 1; k < component6.constructionElements.Length; k++) { Tag tag = component6.constructionElements[k]; Element element = ElementLoader.GetElement(tag); if (element != null) { foreach (AttributeModifier attributeModifier in element.attributeModifiers) { attributes.Add(attributeModifier); } } else { GameObject gameObject = Assets.TryGetPrefab(tag); if ((Object)gameObject != (Object)null) { PrefabAttributeModifiers component7 = gameObject.GetComponent <PrefabAttributeModifiers>(); if ((Object)component7 != (Object)null) { foreach (AttributeModifier descriptor in component7.descriptors) { attributes.Add(descriptor); } } } } } } } }
public GameObject CreateBuildingComplete(GameObject go, BuildingDef def) { go.name = def.PrefabID + "Complete"; go.transform.SetPosition(new Vector3(0f, 0f, Grid.GetLayerZ(def.SceneLayer))); KSelectable component = go.GetComponent <KSelectable>(); component.SetName(def.Name); PrimaryElement component2 = go.GetComponent <PrimaryElement>(); component2.MassPerUnit = 0f; for (int i = 0; i < def.Mass.Length; i++) { component2.MassPerUnit += def.Mass[i]; } component2.Temperature = 273.15f; BuildingHP buildingHP = go.AddOrGet <BuildingHP>(); if (def.Invincible) { buildingHP.invincible = true; } buildingHP.SetHitPoints(def.HitPoints); if (def.Repairable) { UpdateComponentRequirement <Repairable>(go, true); } int defaultLayer = go.layer = LayerMask.NameToLayer("Default"); Building component3 = go.GetComponent <BuildingComplete>(); component3.Def = def; if (def.InputConduitType != 0 || def.OutputConduitType != 0) { go.AddComponent <BuildingConduitEndpoints>(); } if (!Add2DComponents(def, go, null, false, -1)) { Debug.Log(def.Name + " is not yet a 2d building!"); } UpdateComponentRequirement <EnergyConsumer>(go, def.RequiresPowerInput); Rotatable rotatable = UpdateComponentRequirement <Rotatable>(go, def.PermittedRotations != PermittedRotations.Unrotatable); if ((bool)rotatable) { rotatable.permittedRotations = def.PermittedRotations; } if (def.Breakable) { go.AddComponent <Breakable>(); } ConduitConsumer conduitConsumer = UpdateComponentRequirement <ConduitConsumer>(go, def.InputConduitType == ConduitType.Gas || def.InputConduitType == ConduitType.Liquid); if ((Object)conduitConsumer != (Object)null) { conduitConsumer.SetConduitData(def.InputConduitType); } bool required = def.RequiresPowerInput || def.InputConduitType == ConduitType.Gas || def.InputConduitType == ConduitType.Liquid; RequireInputs requireInputs = UpdateComponentRequirement <RequireInputs>(go, required); if ((Object)requireInputs != (Object)null) { requireInputs.SetRequirements(def.RequiresPowerInput, def.InputConduitType == ConduitType.Gas || def.InputConduitType == ConduitType.Liquid); } UpdateComponentRequirement <RequireOutputs>(go, def.OutputConduitType != ConduitType.None); UpdateComponentRequirement <Operational>(go, !def.isUtility); if (def.Floodable) { go.AddComponent <Floodable>(); } if (def.Disinfectable) { go.AddOrGet <AutoDisinfectable>(); go.AddOrGet <Disinfectable>(); } if (def.Overheatable) { Overheatable overheatable = go.AddComponent <Overheatable>(); overheatable.baseOverheatTemp = def.OverheatTemperature; overheatable.baseFatalTemp = def.FatalHot; } if (def.Entombable) { go.AddComponent <Structure>(); } if (def.RequiresPowerInput) { GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0); go.AddOrGet <LogicOperationalController>(); } UpdateComponentRequirement <BuildingCellVisualizer>(go, def.CheckRequiresBuildingCellVisualizer()); if (def.BaseDecor != 0f) { DecorProvider decorProvider = UpdateComponentRequirement <DecorProvider>(go, true); decorProvider.baseDecor = def.BaseDecor; decorProvider.baseRadius = def.BaseDecorRadius; } if (def.AttachmentSlotTag != Tag.Invalid) { AttachableBuilding attachableBuilding = UpdateComponentRequirement <AttachableBuilding>(go, true); attachableBuilding.attachableToTag = def.AttachmentSlotTag; } KPrefabID kPrefabID = AddID(go, def.PrefabID); kPrefabID.defaultLayer = defaultLayer; Assets.AddPrefab(kPrefabID); go.PreInit(); return(go); }
private static void Prefix(ElementConsumer __instance, ref System.Guid ___statusHandle, KSelectable ___selectable) { if (__instance.showInStatusPanel && ___statusHandle != System.Guid.Empty) { ___selectable.RemoveStatusItem(___statusHandle); ___statusHandle = System.Guid.Empty; } }
private static void ExportSelectable(KSelectable selectable) => Instance.intermediateSelectable = selectable;
public void SelectAndFocus(Vector3 pos, KSelectable selectable) { SelectAndFocus(pos, selectable, Vector3.zero); }
public void SelectNextFrame(KSelectable new_selected, bool skipSound = false) { delayedNextSelection = new_selected; delayedSkipSound = skipSound; StartCoroutine(DoSelectNextFrame()); }
public void SelectAndFocus(Vector3 pos, KSelectable selectable, Vector3 offset) { Focus(pos, selectable, offset); Select(selectable, false); }
private void CreateStatusItems() { Func <string, object, string> resolveStringCallback = delegate(string str, object data) { Workable workable3 = (Workable)data; if ((UnityEngine.Object)workable3 != (UnityEngine.Object)null) { str = str.Replace("{Target}", workable3.GetComponent <KSelectable>().GetName()); } return(str); }; Func <string, object, string> resolveStringCallback2 = delegate(string str, object data) { Workable workable2 = (Workable)data; if ((UnityEngine.Object)workable2 != (UnityEngine.Object)null) { str = str.Replace("{Target}", workable2.GetComponent <KSelectable>().GetName()); ComplexFabricatorWorkable complexFabricatorWorkable = workable2 as ComplexFabricatorWorkable; if ((UnityEngine.Object)complexFabricatorWorkable != (UnityEngine.Object)null) { ComplexRecipe currentWorkingOrder = complexFabricatorWorkable.CurrentWorkingOrder; if (currentWorkingOrder != null) { str = str.Replace("{Item}", currentWorkingOrder.FirstResult.ProperName()); } } } return(str); }; BedUnreachable = CreateStatusItem("BedUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); BedUnreachable.AddNotification(null, null, null, 0f); DailyRationLimitReached = CreateStatusItem("DailyRationLimitReached", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); DailyRationLimitReached.AddNotification(null, null, null, 0f); HoldingBreath = CreateStatusItem("HoldingBreath", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Hungry = CreateStatusItem("Hungry", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Unhappy = CreateStatusItem("Unhappy", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Unhappy.AddNotification(null, null, null, 0f); NervousBreakdown = CreateStatusItem("NervousBreakdown", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); NervousBreakdown.AddNotification(null, null, null, 0f); NoRationsAvailable = CreateStatusItem("NoRationsAvailable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); PendingPacification = CreateStatusItem("PendingPacification", "DUPLICANTS", "status_item_pending_pacification", StatusItem.IconType.Custom, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); QuarantineAreaUnassigned = CreateStatusItem("QuarantineAreaUnassigned", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); QuarantineAreaUnassigned.AddNotification(null, null, null, 0f); QuarantineAreaUnreachable = CreateStatusItem("QuarantineAreaUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); QuarantineAreaUnreachable.AddNotification(null, null, null, 0f); Quarantined = CreateStatusItem("Quarantined", "DUPLICANTS", "status_item_quarantined", StatusItem.IconType.Custom, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); RationsUnreachable = CreateStatusItem("RationsUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); RationsUnreachable.AddNotification(null, null, null, 0f); RationsNotPermitted = CreateStatusItem("RationsNotPermitted", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); RationsNotPermitted.AddNotification(null, null, null, 0f); Rotten = CreateStatusItem("Rotten", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Starving = CreateStatusItem("Starving", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); Starving.AddNotification(null, null, null, 0f); Suffocating = CreateStatusItem("Suffocating", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.DuplicantThreatening, false, OverlayModes.None.ID, true, 2); Suffocating.AddNotification(null, null, null, 0f); Tired = CreateStatusItem("Tired", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Idle = CreateStatusItem("Idle", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Idle.AddNotification(null, null, null, 0f); Pacified = CreateStatusItem("Pacified", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Dead = CreateStatusItem("Dead", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Dead.resolveStringCallback = delegate(string str, object data) { Death death = (Death)data; return(str.Replace("{Death}", death.Name)); }; MoveToSuitNotRequired = CreateStatusItem("MoveToSuitNotRequired", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); DroppingUnusedInventory = CreateStatusItem("DroppingUnusedInventory", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); MovingToSafeArea = CreateStatusItem("MovingToSafeArea", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); ToiletUnreachable = CreateStatusItem("ToiletUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); ToiletUnreachable.AddNotification(null, null, null, 0f); NoUsableToilets = CreateStatusItem("NoUsableToilets", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); NoUsableToilets.AddNotification(null, null, null, 0f); NoToilets = CreateStatusItem("NoToilets", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); NoToilets.AddNotification(null, null, null, 0f); BreathingO2 = CreateStatusItem("BreathingO2", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 130); BreathingO2.resolveStringCallback = delegate(string str, object data) { OxygenBreather oxygenBreather2 = (OxygenBreather)data; float averageRate = Game.Instance.accumulators.GetAverageRate(oxygenBreather2.O2Accumulator); return(str.Replace("{ConsumptionRate}", GameUtil.GetFormattedMass(0f - averageRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"))); }; EmittingCO2 = CreateStatusItem("EmittingCO2", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 130); EmittingCO2.resolveStringCallback = delegate(string str, object data) { OxygenBreather oxygenBreather = (OxygenBreather)data; return(str.Replace("{EmittingRate}", GameUtil.GetFormattedMass(oxygenBreather.CO2EmitRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"))); }; Vomiting = CreateStatusItem("Vomiting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Coughing = CreateStatusItem("Coughing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); LowOxygen = CreateStatusItem("LowOxygen", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); LowOxygen.AddNotification(null, null, null, 0f); RedAlert = CreateStatusItem("RedAlert", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Sleeping = CreateStatusItem("Sleeping", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Sleeping.resolveTooltipCallback = delegate(string str, object data) { if (data is SleepChore.StatesInstance) { SleepChore.StatesInstance statesInstance2 = (SleepChore.StatesInstance)data; string stateChangeNoiseSource = statesInstance2.stateChangeNoiseSource; if (!string.IsNullOrEmpty(stateChangeNoiseSource)) { string text5 = DUPLICANTS.STATUSITEMS.SLEEPING.TOOLTIP; text5 = text5.Replace("{Disturber}", stateChangeNoiseSource); str += text5; } } return(str); }; SleepingInterruptedByNoise = CreateStatusItem("SleepingInterruptedByNoise", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); SleepingInterruptedByLight = CreateStatusItem("SleepingInterruptedByLight", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Eating = CreateStatusItem("Eating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Eating.resolveStringCallback = resolveStringCallback; Digging = CreateStatusItem("Digging", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Cleaning = CreateStatusItem("Cleaning", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Cleaning.resolveStringCallback = resolveStringCallback; PickingUp = CreateStatusItem("PickingUp", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); PickingUp.resolveStringCallback = resolveStringCallback; Mopping = CreateStatusItem("Mopping", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Cooking = CreateStatusItem("Cooking", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Cooking.resolveStringCallback = resolveStringCallback2; Mushing = CreateStatusItem("Mushing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Mushing.resolveStringCallback = resolveStringCallback2; Researching = CreateStatusItem("Researching", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Researching.resolveStringCallback = delegate(string str, object data) { TechInstance activeResearch = Research.Instance.GetActiveResearch(); if (activeResearch != null) { return(str.Replace("{Tech}", activeResearch.tech.Name)); } return(str); }; Tinkering = CreateStatusItem("Tinkering", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Tinkering.resolveStringCallback = delegate(string str, object data) { Tinkerable tinkerable = (Tinkerable)data; if ((UnityEngine.Object)tinkerable != (UnityEngine.Object)null) { return(string.Format(str, tinkerable.tinkerMaterialTag.ProperName())); } return(str); }; Storing = CreateStatusItem("Storing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Storing.resolveStringCallback = delegate(string str, object data) { Workable workable = (Workable)data; if ((UnityEngine.Object)workable != (UnityEngine.Object)null && (UnityEngine.Object)workable.worker != (UnityEngine.Object)null) { KSelectable component = workable.GetComponent <KSelectable>(); if ((bool)component) { str = str.Replace("{Target}", component.GetName()); } Pickupable pickupable = workable.worker.workCompleteData as Pickupable; if ((UnityEngine.Object)workable.worker != (UnityEngine.Object)null && (bool)pickupable) { KSelectable component2 = pickupable.GetComponent <KSelectable>(); if ((bool)component2) { str = str.Replace("{Item}", component2.GetName()); } } } return(str); }; Building = CreateStatusItem("Building", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Building.resolveStringCallback = resolveStringCallback; Equipping = CreateStatusItem("Equipping", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Equipping.resolveStringCallback = resolveStringCallback; WarmingUp = CreateStatusItem("WarmingUp", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); WarmingUp.resolveStringCallback = resolveStringCallback; GeneratingPower = CreateStatusItem("GeneratingPower", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); GeneratingPower.resolveStringCallback = resolveStringCallback; Harvesting = CreateStatusItem("Harvesting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Harvesting.resolveStringCallback = resolveStringCallback; Uprooting = CreateStatusItem("Uprooting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Uprooting.resolveStringCallback = resolveStringCallback; Emptying = CreateStatusItem("Emptying", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Emptying.resolveStringCallback = resolveStringCallback; Toggling = CreateStatusItem("Toggling", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Toggling.resolveStringCallback = resolveStringCallback; Deconstructing = CreateStatusItem("Deconstructing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Deconstructing.resolveStringCallback = resolveStringCallback; Disinfecting = CreateStatusItem("Disinfecting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Disinfecting.resolveStringCallback = resolveStringCallback; Upgrading = CreateStatusItem("Upgrading", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Upgrading.resolveStringCallback = resolveStringCallback; Fabricating = CreateStatusItem("Fabricating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Fabricating.resolveStringCallback = resolveStringCallback2; Processing = CreateStatusItem("Processing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Processing.resolveStringCallback = resolveStringCallback2; Clearing = CreateStatusItem("Clearing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Clearing.resolveStringCallback = resolveStringCallback; GeneratingPower = CreateStatusItem("GeneratingPower", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); GeneratingPower.resolveStringCallback = resolveStringCallback; Cold = CreateStatusItem("Cold", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Cold.resolveTooltipCallback = delegate(string str, object data) { str = str.Replace("{StressModification}", GameUtil.GetFormattedPercent(Db.Get().effects.Get("ColdAir").SelfModifiers[0].Value, GameUtil.TimeSlice.PerCycle)); float dtu_s2 = ((ExternalTemperatureMonitor.Instance)data).temperatureTransferer.average_kilowatts_exchanged.GetWeightedAverage * 1000f; str = str.Replace("{currentTransferWattage}", GameUtil.GetFormattedHeatEnergyRate(dtu_s2, GameUtil.HeatEnergyFormatterUnit.Automatic)); AttributeInstance attributeInstance3 = ((ExternalTemperatureMonitor.Instance)data).attributes.Get("ThermalConductivityBarrier"); string text3 = "<b>" + attributeInstance3.GetFormattedValue() + "</b>"; for (int j = 0; j != attributeInstance3.Modifiers.Count; j++) { AttributeModifier attributeModifier2 = attributeInstance3.Modifiers[j]; text3 += "\n"; string text4 = text3; text3 = text4 + " • " + attributeModifier2.GetDescription() + " <b>" + attributeModifier2.GetFormattedString(attributeInstance3.gameObject) + "</b>"; } str = str.Replace("{conductivityBarrier}", text3); return(str); }; Hot = CreateStatusItem("Hot", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); Hot.resolveTooltipCallback = delegate(string str, object data) { str = str.Replace("{StressModification}", GameUtil.GetFormattedPercent(Db.Get().effects.Get("WarmAir").SelfModifiers[0].Value, GameUtil.TimeSlice.PerCycle)); float dtu_s = ((ExternalTemperatureMonitor.Instance)data).temperatureTransferer.average_kilowatts_exchanged.GetWeightedAverage * 1000f; str = str.Replace("{currentTransferWattage}", GameUtil.GetFormattedHeatEnergyRate(dtu_s, GameUtil.HeatEnergyFormatterUnit.Automatic)); AttributeInstance attributeInstance2 = ((ExternalTemperatureMonitor.Instance)data).attributes.Get("ThermalConductivityBarrier"); string text = "<b>" + attributeInstance2.GetFormattedValue() + "</b>"; for (int i = 0; i != attributeInstance2.Modifiers.Count; i++) { AttributeModifier attributeModifier = attributeInstance2.Modifiers[i]; text += "\n"; string text2 = text; text = text2 + " • " + attributeModifier.GetDescription() + " <b>" + attributeModifier.GetFormattedString(attributeInstance2.gameObject) + "</b>"; } str = str.Replace("{conductivityBarrier}", text); return(str); }; BodyRegulatingHeating = CreateStatusItem("BodyRegulatingHeating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); BodyRegulatingHeating.resolveStringCallback = delegate(string str, object data) { WarmBlooded.StatesInstance statesInstance = (WarmBlooded.StatesInstance)data; return(str.Replace("{TempDelta}", GameUtil.GetFormattedTemperature(statesInstance.TemperatureDelta, GameUtil.TimeSlice.PerSecond, GameUtil.TemperatureInterpretation.Relative, true, false))); }; BodyRegulatingCooling = CreateStatusItem("BodyRegulatingCooling", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); BodyRegulatingCooling.resolveStringCallback = BodyRegulatingHeating.resolveStringCallback; EntombedChore = CreateStatusItem("EntombedChore", "DUPLICANTS", "status_item_entombed", StatusItem.IconType.Custom, NotificationType.DuplicantThreatening, false, OverlayModes.None.ID, true, 2); EntombedChore.AddNotification(null, null, null, 0f); EarlyMorning = CreateStatusItem("EarlyMorning", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); NightTime = CreateStatusItem("NightTime", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); PoorDecor = CreateStatusItem("PoorDecor", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); PoorQualityOfLife = CreateStatusItem("PoorQualityOfLife", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); PoorFoodQuality = CreateStatusItem("PoorFoodQuality", DUPLICANTS.STATUSITEMS.POOR_FOOD_QUALITY.NAME, DUPLICANTS.STATUSITEMS.POOR_FOOD_QUALITY.TOOLTIP, string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, 2); GoodFoodQuality = CreateStatusItem("GoodFoodQuality", DUPLICANTS.STATUSITEMS.GOOD_FOOD_QUALITY.NAME, DUPLICANTS.STATUSITEMS.GOOD_FOOD_QUALITY.TOOLTIP, string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, 2); Arting = CreateStatusItem("Arting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Arting.resolveStringCallback = resolveStringCallback; SevereWounds = CreateStatusItem("SevereWounds", "DUPLICANTS", "status_item_broken", StatusItem.IconType.Custom, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); SevereWounds.AddNotification(null, null, null, 0f); Incapacitated = CreateStatusItem("Incapacitated", "DUPLICANTS", "status_item_broken", StatusItem.IconType.Custom, NotificationType.DuplicantThreatening, false, OverlayModes.None.ID, true, 2); Incapacitated.AddNotification(null, null, null, 0f); Incapacitated.resolveStringCallback = delegate(string str, object data) { IncapacitationMonitor.Instance instance = (IncapacitationMonitor.Instance)data; float bleedLifeTime = instance.GetBleedLifeTime(instance); str = str.Replace("{CauseOfIncapacitation}", instance.GetCauseOfIncapacitation().Name); return(str.Replace("{TimeUntilDeath}", GameUtil.GetFormattedTime(bleedLifeTime))); }; Relocating = CreateStatusItem("Relocating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Relocating.resolveStringCallback = resolveStringCallback; Fighting = CreateStatusItem("Fighting", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); Fighting.AddNotification(null, null, null, 0f); Fleeing = CreateStatusItem("Fleeing", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); Fleeing.AddNotification(null, null, null, 0f); Stressed = CreateStatusItem("Stressed", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Stressed.AddNotification(null, null, null, 0f); LashingOut = CreateStatusItem("LashingOut", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2); LashingOut.AddNotification(null, null, null, 0f); LowImmunity = CreateStatusItem("LowImmunity", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2); LowImmunity.AddNotification(null, null, null, 0f); Studying = CreateStatusItem("Studying", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2); Socializing = CreateStatusItem("Socializing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2); Dancing = CreateStatusItem("Dancing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2); Gaming = CreateStatusItem("Gaming", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2); Mingling = CreateStatusItem("Mingling", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2); ContactWithGerms = CreateStatusItem("ContactWithGerms", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, true, OverlayModes.Disease.ID, true, 2); ContactWithGerms.resolveStringCallback = delegate(string str, object data) { GermExposureMonitor.ExposureStatusData exposureStatusData4 = (GermExposureMonitor.ExposureStatusData)data; string name2 = Db.Get().Sicknesses.Get(exposureStatusData4.exposure_type.sickness_id).Name; str = str.Replace("{Sickness}", name2); return(str); }; ContactWithGerms.statusItemClickCallback = delegate(object data) { GermExposureMonitor.ExposureStatusData exposureStatusData3 = (GermExposureMonitor.ExposureStatusData)data; Vector3 lastExposurePosition2 = exposureStatusData3.owner.GetLastExposurePosition(exposureStatusData3.exposure_type.germ_id); CameraController.Instance.CameraGoTo(lastExposurePosition2, 2f, true); if (OverlayScreen.Instance.mode == OverlayModes.None.ID) { OverlayScreen.Instance.ToggleOverlay(OverlayModes.Disease.ID, true); } }; ExposedToGerms = CreateStatusItem("ExposedToGerms", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, true, OverlayModes.Disease.ID, true, 2); ExposedToGerms.resolveStringCallback = delegate(string str, object data) { GermExposureMonitor.ExposureStatusData exposureStatusData2 = (GermExposureMonitor.ExposureStatusData)data; string name = Db.Get().Sicknesses.Get(exposureStatusData2.exposure_type.sickness_id).Name; AttributeInstance attributeInstance = Db.Get().Attributes.GermResistance.Lookup(exposureStatusData2.owner.gameObject); string lastDiseaseSource = exposureStatusData2.owner.GetLastDiseaseSource(exposureStatusData2.exposure_type.germ_id); GermExposureMonitor.Instance sMI = exposureStatusData2.owner.GetSMI <GermExposureMonitor.Instance>(); float num = (float)exposureStatusData2.exposure_type.base_resistance + GERM_EXPOSURE.EXPOSURE_TIER_RESISTANCE_BONUSES[0]; float totalValue = attributeInstance.GetTotalValue(); float resistanceToExposureType = sMI.GetResistanceToExposureType(exposureStatusData2.exposure_type, -1f); float contractionChance = GermExposureMonitor.GetContractionChance(resistanceToExposureType); float exposureTier = sMI.GetExposureTier(exposureStatusData2.exposure_type.germ_id); float num2 = GERM_EXPOSURE.EXPOSURE_TIER_RESISTANCE_BONUSES[(int)exposureTier - 1] - GERM_EXPOSURE.EXPOSURE_TIER_RESISTANCE_BONUSES[0]; str = str.Replace("{Severity}", DUPLICANTS.STATUSITEMS.EXPOSEDTOGERMS.EXPOSURE_TIERS[(int)exposureTier - 1]); str = str.Replace("{Sickness}", name); str = str.Replace("{Source}", lastDiseaseSource); str = str.Replace("{Base}", GameUtil.GetFormattedSimple(num, GameUtil.TimeSlice.None, null)); str = str.Replace("{Dupe}", GameUtil.GetFormattedSimple(totalValue, GameUtil.TimeSlice.None, null)); str = str.Replace("{Total}", GameUtil.GetFormattedSimple(resistanceToExposureType, GameUtil.TimeSlice.None, null)); str = str.Replace("{ExposureLevelBonus}", GameUtil.GetFormattedSimple(num2, GameUtil.TimeSlice.None, null)); str = str.Replace("{Chance}", GameUtil.GetFormattedPercent(contractionChance * 100f, GameUtil.TimeSlice.None)); return(str); }; ExposedToGerms.statusItemClickCallback = delegate(object data) { GermExposureMonitor.ExposureStatusData exposureStatusData = (GermExposureMonitor.ExposureStatusData)data; Vector3 lastExposurePosition = exposureStatusData.owner.GetLastExposurePosition(exposureStatusData.exposure_type.germ_id); CameraController.Instance.CameraGoTo(lastExposurePosition, 2f, true); if (OverlayScreen.Instance.mode == OverlayModes.None.ID) { OverlayScreen.Instance.ToggleOverlay(OverlayModes.Disease.ID, true); } }; LightWorkEfficiencyBonus = CreateStatusItem("LightWorkEfficiencyBonus", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2); }
public void AddSelectable(KSelectable selectable) { this.selectable = selectable; }
public Notification CreateDamageNotification() { KSelectable component = GetComponent <KSelectable>(); return(new Notification(BUILDING.STATUSITEMS.ANGERDAMAGE.NOTIFICATION, NotificationType.BadMinor, HashedString.Invalid, (List <Notification> notificationList, object data) => BUILDING.STATUSITEMS.ANGERDAMAGE.NOTIFICATION_TOOLTIP + notificationList.ReduceMessages(false), component.GetProperName(), false, 0f, null, null, null)); }
protected override void OnPrefabInit() { base.OnPrefabInit(); selectable = GetComponent <KSelectable>(); Subscribe(-905833192, OnCopySettingsDelegate); }