public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.RecBuilding, false); Storage storage = go.AddOrGet <Storage>(); storage.SetDefaultStoredItemModifiers(Storage.StandardFabricatorStorage); ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Liquid; conduitConsumer.capacityTag = ElementLoader.FindElementByHash(SimHashes.Ethanol).tag; conduitConsumer.capacityKG = 20f; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump; ManualDeliveryKG manualDeliveryKg = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKg.SetStorage(storage); manualDeliveryKg.requestedItemTag = GrapeberryConfig.Id.ToTag(); manualDeliveryKg.capacity = 4f; manualDeliveryKg.refillMass = 1f; manualDeliveryKg.minimumMass = 0.5f; manualDeliveryKg.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; go.AddOrGet <ChampagneFillerWorkable>().basePriority = RELAXATION.PRIORITY.TIER5; ChampagneFiller champagneFiller = go.AddOrGet <ChampagneFiller>(); champagneFiller.specificEffect = "SodaFountain"; champagneFiller.trackingEffect = "RecentlyRecDrink"; champagneFiller.ingredientTag = GrapeberryConfig.Id.ToTag(); champagneFiller.ingredientMassPerUse = 1f; champagneFiller.ethanolMassPerUse = 5f; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.RecRoom.Id; roomTracker.requirement = RoomTracker.Requirement.Recommended; }
public static void fortuneTellerMessage(string message, float duration, Color color) { RoomTracker roomTracker = HudManager.Instance?.roomTracker; if (roomTracker != null) { GameObject gameObject = UnityEngine.Object.Instantiate(roomTracker.gameObject); gameObject.transform.SetParent(HudManager.Instance.transform); UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <RoomTracker>()); // Use local position to place it in the player's view instead of the world location gameObject.transform.localPosition = new Vector3(0, -1.8f, gameObject.transform.localPosition.z); gameObject.transform.localScale *= 1.5f; text = gameObject.GetComponent <TMPro.TMP_Text>(); text.text = message; text.color = color; HudManager.Instance.StartCoroutine(Effects.Lerp(duration, new Action <float>((p) => { if (p == 1f && text != null && text.gameObject != null) { UnityEngine.Object.Destroy(text.gameObject); } }))); } }
public Clinic(string name, int numberOFRooms) { this.clinicName = name; this.NumberOfRooms = numberOFRooms; this.roomsWithPets = new Pet[numberOfRooms]; roomTracker = new RoomTracker(numberOFRooms); }
public CustomMessage(string message, float duration) { RoomTracker roomTracker = HudManager.Instance?.roomTracker; if (roomTracker != null) { GameObject gameObject = UnityEngine.Object.Instantiate(roomTracker.gameObject); gameObject.transform.SetParent(HudManager.Instance.transform); UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <RoomTracker>()); text = gameObject.GetComponent <TMPro.TMP_Text>(); text.text = message; // Use local position to place it in the player's view instead of the world location gameObject.transform.localPosition = new Vector3(0, -1.8f, gameObject.transform.localPosition.z); customMessages.Add(this); HudManager.Instance.StartCoroutine(Effects.Lerp(duration, new Action <float>((p) => { bool even = ((int)(p * duration / 0.25f)) % 2 == 0; // Bool flips every 0.25 seconds string prefix = (even ? "<color=#FCBA03FF>" : "<color=#FF0000FF>"); text.text = prefix + message + "</color>"; if (text != null) { text.color = even ? Color.yellow : Color.red; } if (p == 1f && text != null && text.gameObject != null) { UnityEngine.Object.Destroy(text.gameObject); customMessages.Remove(this); } }))); } }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.RecBuilding, false); Storage storage = go.AddOrGet <Storage>(); storage.capacityKg = 20f; storage.SetDefaultStoredItemModifiers(Storage.StandardFabricatorStorage); ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Liquid; conduitConsumer.capacityTag = ElementLoader.FindElementByHash(SimHashes.Water).tag; conduitConsumer.capacityKG = 2f; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump; ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = new Tag("SpiceNut"); manualDeliveryKG.capacity = 10f; manualDeliveryKG.refillMass = 5f; manualDeliveryKG.minimumMass = 1f; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; go.AddOrGet <EspressoMachineWorkable>(); go.AddOrGet <EspressoMachine>(); RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.RecRoom.Id; roomTracker.requirement = RoomTracker.Requirement.Recommended; }
private void Start() { textPrompt = FindObjectOfType <TextPrompt>(); roomTracker = FindObjectOfType <RoomTracker>(); player = FindObjectOfType <Player>(); actionHandler = FindObjectOfType <ActionHandler>(); defaultValues = FindObjectOfType <DefaultValues>(); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.RecBuilding, false); go.AddOrGet <CarouselCentrifugeWorkable>(); RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.RecRoom.Id; roomTracker.requirement = RoomTracker.Requirement.Recommended; }
public override void Interact() { base.Interact(); if (GlobalFlags.IsSet(flag) || IsAlternate) { RoomTracker.MoveToRoom(room); } }
private void Awake() { inputParser = FindObjectOfType <InputParser>(); roomTracker = FindObjectOfType <RoomTracker>(); player = FindObjectOfType <Player>(); textPrompt = FindObjectOfType <TextPrompt>(); defaultValues = FindObjectOfType <DefaultValues>(); delayedActions = new List <RoomObject.EditorVariables>(); }
static void Postfix(RoomTracker __instance) { if (__instance.LastRoom == null || PlayerControl.LocalPlayer == null || !PlayerControl.LocalPlayer.Data.IsImpostor || __instance.LastRoom.RoomId == currentRoomId) { return; } currentRoomId = __instance.LastRoom.RoomId; }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <LoopingSounds>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.RanchStation, false); RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.CreaturePen.Id; roomTracker.requirement = RoomTracker.Requirement.Required; }
public static void Postfix(GameObject prefab) { if (!Settings.Instance.Agricultural.IncludeRoom) { return; } RoomTracker roomTracker = prefab.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.CreaturePen.Id; }
public override void DoPostConfigureComplete(GameObject go) { go.GetComponent <KAnimControllerBase>().initialAnim = "off"; go.GetComponent <KPrefabID>().AddTag(TagManager.Create("Bed"), false); Clinic clinic = go.AddOrGet <Clinic>(); clinic.doctorVisitInterval = 300f; clinic.workerInjuredAnims = new KAnimFile[1] { Assets.GetAnim("anim_healing_bed_kanim") }; clinic.workerDiseasedAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_med_cot_sick_kanim") }; clinic.workLayer = Grid.SceneLayer.BuildingFront; string text = "MedicalCot"; string text2 = "MedicalCotDoctored"; clinic.healthEffect = text; clinic.doctoredHealthEffect = text2; clinic.diseaseEffect = text; clinic.doctoredDiseaseEffect = text2; clinic.doctoredPlaceholderEffect = "DoctoredOffCotEffect"; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.Hospital.Id; roomTracker.requirement = RoomTracker.Requirement.CustomRecommended; roomTracker.customStatusItemID = Db.Get().BuildingStatusItems.ClinicOutsideHospital.Id; Sleepable sleepable = go.AddOrGet <Sleepable>(); sleepable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_med_cot_sick_kanim") }; DoctorChoreWorkable doctorChoreWorkable = go.AddOrGet <DoctorChoreWorkable>(); doctorChoreWorkable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_med_cot_doctor_kanim") }; doctorChoreWorkable.workTime = 45f; Ownable ownable = go.AddOrGet <Ownable>(); ownable.slotID = Db.Get().AssignableSlots.Clinic.Id; }
public override void DoPostConfigureComplete(GameObject go) { GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0); go.AddOrGet <LogicOperationalController>(); Storage storage = go.AddOrGet <Storage>(); storage.capacityKg = 50f; storage.showInUI = true; storage.storageFilters = new List <Tag> { MATERIAL_FOR_TINKER }; TinkerStation tinkerStation = go.AddOrGet <TinkerStation>(); tinkerStation.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_electricianworkdesk_kanim") }; tinkerStation.inputMaterial = MATERIAL_FOR_TINKER; tinkerStation.massPerTinker = 5f; tinkerStation.outputPrefab = TINKER_TOOLS; tinkerStation.outputTemperature = 308.15f; tinkerStation.requiredSkillPerk = ROLE_PERK; tinkerStation.choreType = Db.Get().ChoreTypes.PowerFabricate.IdHash; tinkerStation.useFilteredStorage = true; tinkerStation.fetchChoreType = Db.Get().ChoreTypes.PowerFetch.IdHash; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.PowerPlant.Id; roomTracker.requirement = RoomTracker.Requirement.Required; Prioritizable.AddRef(go); go.GetComponent <KPrefabID>().prefabInitFn += delegate(GameObject game_object) { TinkerStation component = game_object.GetComponent <TinkerStation>(); component.AttributeConverter = Db.Get().AttributeConverters.MachinerySpeed; component.AttributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.MOST_DAY_EXPERIENCE; component.SkillExperienceSkillGroup = Db.Get().SkillGroups.Technicals.Id; component.SkillExperienceMultiplier = SKILLS.MOST_DAY_EXPERIENCE; }; }
public override void DoPostConfigureComplete(GameObject go) { GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0); go.AddOrGet <LogicOperationalController>(); RanchStation.Def def = go.AddOrGetDef <RanchStation.Def>(); def.isCreatureEligibleToBeRanchedCb = ((GameObject creature_go, RanchStation.Instance ranch_station_smi) => !creature_go.GetComponent <Effects>().HasEffect("Ranched")); def.onRanchCompleteCb = delegate(GameObject creature_go) { RanchableMonitor.Instance sMI = creature_go.GetSMI <RanchableMonitor.Instance>(); RanchStation.Instance targetRanchStation = sMI.targetRanchStation; RancherChore.RancherChoreStates.Instance sMI2 = targetRanchStation.GetSMI <RancherChore.RancherChoreStates.Instance>(); GameObject go2 = targetRanchStation.GetSMI <RancherChore.RancherChoreStates.Instance>().sm.rancher.Get(sMI2); float num2 = 1f + go2.GetAttributes().Get(Db.Get().Attributes.Ranching.Id).GetTotalValue() * 0.1f; creature_go.GetComponent <Effects>().Add("Ranched", true).timeRemaining *= num2; }; def.ranchedPreAnim = "grooming_pre"; def.ranchedLoopAnim = "grooming_loop"; def.ranchedPstAnim = "grooming_pst"; def.getTargetRanchCell = delegate(RanchStation.Instance smi) { int num = Grid.InvalidCell; if (!smi.IsNullOrStopped()) { num = Grid.CellRight(Grid.PosToCell(smi.transform.GetPosition())); if (!smi.targetRanchable.IsNullOrStopped() && smi.targetRanchable.HasTag(GameTags.Creatures.Flyer)) { num = Grid.CellAbove(num); } } return(num); }; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.CreaturePen.Id; roomTracker.requirement = RoomTracker.Requirement.Required; SkillPerkMissingComplainer skillPerkMissingComplainer = go.AddOrGet <SkillPerkMissingComplainer>(); skillPerkMissingComplainer.requiredSkillPerk = Db.Get().SkillPerks.CanWrangleCreatures.Id; Prioritizable.AddRef(go); }
public override void DoPostConfigureComplete(GameObject go) { GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0); go.AddOrGet <LogicOperationalController>(); Storage storage = go.AddOrGet <Storage>(); storage.showInUI = true; ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = MATERIAL_FOR_TINKER; manualDeliveryKG.refillMass = 5f; manualDeliveryKG.capacity = 50f; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.FarmFetch.IdHash; TinkerStation tinkerStation = go.AddOrGet <TinkerStation>(); tinkerStation.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_planttender_kanim") }; tinkerStation.inputMaterial = MATERIAL_FOR_TINKER; tinkerStation.massPerTinker = 5f; tinkerStation.outputPrefab = TINKER_TOOLS; tinkerStation.outputTemperature = 308.15f; tinkerStation.requiredSkillPerk = Db.Get().SkillPerks.CanFarmTinker.Id; tinkerStation.choreType = Db.Get().ChoreTypes.FarmingFabricate.IdHash; tinkerStation.fetchChoreType = Db.Get().ChoreTypes.FarmFetch.IdHash; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.Farm.Id; roomTracker.requirement = RoomTracker.Requirement.Required; go.GetComponent <KPrefabID>().prefabInitFn += delegate(GameObject game_object) { TinkerStation component = game_object.GetComponent <TinkerStation>(); component.AttributeConverter = Db.Get().AttributeConverters.HarvestSpeed; component.AttributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.MOST_DAY_EXPERIENCE; component.SkillExperienceSkillGroup = Db.Get().SkillGroups.Farming.Id; component.SkillExperienceMultiplier = SKILLS.MOST_DAY_EXPERIENCE; }; }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <LoopingSounds>(); go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.MassageTable, false); MassageTable massageTable = go.AddOrGet <MassageTable>(); massageTable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_masseur_kanim") }; massageTable.stressModificationValue = -30f; massageTable.roomStressModificationValue = -60f; massageTable.workLayer = Grid.SceneLayer.BuildingFront; Ownable ownable = go.AddOrGet <Ownable>(); ownable.slotID = Db.Get().AssignableSlots.MassageTable.Id; ownable.canBePublic = true; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.MassageClinic.Id; roomTracker.requirement = RoomTracker.Requirement.Recommended; }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.CreatureRelocator, false); Storage storage = go.AddOrGet <Storage>(); storage.allowItemRemoval = false; storage.showDescriptor = false; storage.storageFilters = new List <Tag> { ButcherStation.ButcherableCreature }; storage.allowSettingOnlyFetchMarkedItems = false; go.AddOrGet <TreeFilterable>(); ButcherStation butcherStation = go.AddOrGet <ButcherStation>(); butcherStation.creatureEligibleTag = ButcherStation.ButcherableCreature; go.AddOrGet <LoopingSounds>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.RanchStation, false); RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.CreaturePen.Id; roomTracker.requirement = RoomTracker.Requirement.Required; }
public override void DoPostConfigureComplete(GameObject go) { Storage storage = go.AddOrGet <Storage>(); storage.showInUI = true; ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = SUPPLY_TAG; manualDeliveryKG.capacity = 10f; manualDeliveryKG.refillMass = 5f; manualDeliveryKG.minimumMass = 1f; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.DoctorFetch.IdHash; manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.Functional; DoctorStation doctorStation = go.AddOrGet <DoctorStation>(); doctorStation.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_medical_bed_kanim") }; doctorStation.workLayer = Grid.SceneLayer.BuildingFront; doctorStation.supplyTag = SUPPLY_TAG; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.Hospital.Id; roomTracker.requirement = RoomTracker.Requirement.CustomRecommended; roomTracker.customStatusItemID = Db.Get().BuildingStatusItems.ClinicOutsideHospital.Id; DoctorStationDoctorWorkable doctorStationDoctorWorkable = go.AddOrGet <DoctorStationDoctorWorkable>(); doctorStationDoctorWorkable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_medical_bed_doctor_kanim") }; doctorStationDoctorWorkable.SetWorkTime(60f); doctorStationDoctorWorkable.requiredSkillPerk = Db.Get().SkillPerks.CanAdvancedMedicine.Id; }
public override void FixedUpdate() { // 処理に自信がないので念の為tryで囲っておく try{ if (PlayerControl.LocalPlayer.isRole(RoleType.Trapper) && Trap.traps.Count != 0 && !Trap.hasTrappedPlayer() && !meetingFlag) { // トラップを踏んだプレイヤーを動けなくする foreach (var p in PlayerControl.AllPlayerControls) { foreach (var trap in Trap.traps) { if (DateTime.UtcNow.Subtract(trap.Value.placedTime).TotalSeconds < extensionTime) { continue; } if (trap.Value.isActive || p.isDead() || p.inVent || meetingFlag) { continue; } var p1 = p.transform.localPosition; Dictionary <GameObject, byte> listActivate = new Dictionary <GameObject, byte>(); var p2 = trap.Value.trap.transform.localPosition; var distance = Vector3.Distance(p1, p2); if (distance < trapRange) { TMPro.TMP_Text text; RoomTracker roomTracker = HudManager.Instance?.roomTracker; GameObject gameObject = UnityEngine.Object.Instantiate(roomTracker.gameObject); UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <RoomTracker>()); gameObject.transform.SetParent(HudManager.Instance.transform); gameObject.transform.localPosition = new Vector3(0, -1.8f, gameObject.transform.localPosition.z); gameObject.transform.localScale = Vector3.one * 2f; text = gameObject.GetComponent <TMPro.TMP_Text>(); text.text = String.Format(ModTranslation.getString("trapperGetTrapped"), p.name); HudManager.Instance.StartCoroutine(Effects.Lerp(3f, new Action <float>((p) => { if (p == 1f && text != null && text.gameObject != null) { UnityEngine.Object.Destroy(text.gameObject); } }))); MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ActivateTrap, Hazel.SendOption.Reliable, -1); writer.Write(trap.Key); writer.Write(PlayerControl.LocalPlayer.PlayerId); writer.Write(p.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.activateTrap(trap.Key, PlayerControl.LocalPlayer.PlayerId, p.PlayerId); break; } } } } if (PlayerControl.LocalPlayer.isRole(RoleType.Trapper) && Trap.hasTrappedPlayer() && !meetingFlag) { // トラップにかかっているプレイヤーを救出する foreach (var trap in Trap.traps) { if (trap.Value.trap == null || !trap.Value.isActive) { return; } Vector3 p1 = trap.Value.trap.transform.position; foreach (var player in PlayerControl.AllPlayerControls) { if (player.PlayerId == trap.Value.target.PlayerId || player.isDead() || player.inVent || player.isRole(RoleType.Trapper)) { continue; } Vector3 p2 = player.transform.position; float distance = Vector3.Distance(p1, p2); if (distance < 0.5) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DisableTrap, Hazel.SendOption.Reliable, -1); writer.Write(trap.Key); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.disableTrap(trap.Key); } } } } } catch (NullReferenceException e) { Helpers.log(e.Message); } }
public override void UpdateHoverElements(List <KSelectable> hoverObjects) { HoverTextScreen instance = HoverTextScreen.Instance; HoverTextDrawer hoverTextDrawer = instance.BeginDrawing(); hoverTextDrawer.BeginShadowBar(false); ActionName = ((!((UnityEngine.Object)currentDef != (UnityEngine.Object)null) || !currentDef.DragBuild) ? UI.TOOLS.BUILD.TOOLACTION : UI.TOOLS.BUILD.TOOLACTION_DRAG); if ((UnityEngine.Object)currentDef != (UnityEngine.Object)null && currentDef.Name != null) { ToolName = string.Format(UI.TOOLS.BUILD.NAME, currentDef.Name); } DrawTitle(instance, hoverTextDrawer); DrawInstructions(instance, hoverTextDrawer); int cell = Grid.PosToCell(Camera.main.ScreenToWorldPoint(KInputManager.GetMousePos())); int min_height = 26; int width = 8; if ((UnityEngine.Object)currentDef != (UnityEngine.Object)null) { Orientation orientation = Orientation.Neutral; if ((UnityEngine.Object)PlayerController.Instance.ActiveTool != (UnityEngine.Object)null) { Type type = PlayerController.Instance.ActiveTool.GetType(); if (typeof(BuildTool).IsAssignableFrom(type) || typeof(BaseUtilityBuildTool).IsAssignableFrom(type)) { if ((UnityEngine.Object)currentDef.BuildingComplete.GetComponent <Rotatable>() != (UnityEngine.Object)null) { hoverTextDrawer.NewLine(min_height); hoverTextDrawer.AddIndent(width); string text = UI.TOOLTIPS.HELP_ROTATE_KEY.ToString(); text = text.Replace("{Key}", GameUtil.GetActionString(Action.RotateBuilding)); hoverTextDrawer.DrawText(text, Styles_Instruction.Standard); } orientation = BuildTool.Instance.GetBuildingOrientation; string fail_reason = "Unknown reason"; Vector3 pos = Grid.CellToPosCCC(cell, Grid.SceneLayer.Building); if (!currentDef.IsValidPlaceLocation(BuildTool.Instance.visualizer, pos, orientation, out fail_reason)) { hoverTextDrawer.NewLine(min_height); hoverTextDrawer.AddIndent(width); hoverTextDrawer.DrawText(fail_reason, HoverTextStyleSettings[1]); } RoomTracker component = currentDef.BuildingComplete.GetComponent <RoomTracker>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.SufficientBuildLocation(cell)) { hoverTextDrawer.NewLine(min_height); hoverTextDrawer.AddIndent(width); hoverTextDrawer.DrawText(UI.TOOLTIPS.HELP_REQUIRES_ROOM, HoverTextStyleSettings[1]); } } } hoverTextDrawer.NewLine(min_height); hoverTextDrawer.AddIndent(width); hoverTextDrawer.DrawText(ResourceRemainingDisplayScreen.instance.GetString(), Styles_BodyText.Standard); hoverTextDrawer.EndShadowBar(); HashedString mode = SimDebugView.Instance.GetMode(); if (mode == OverlayModes.Logic.ID && hoverObjects != null) { SelectToolHoverTextCard component2 = SelectTool.Instance.GetComponent <SelectToolHoverTextCard>(); foreach (KSelectable hoverObject in hoverObjects) { LogicPorts component3 = hoverObject.GetComponent <LogicPorts>(); if ((UnityEngine.Object)component3 != (UnityEngine.Object)null && component3.TryGetPortAtCell(cell, out LogicPorts.Port port, out bool isInput)) { bool flag = component3.IsPortConnected(port.id); hoverTextDrawer.BeginShadowBar(false); int num; if (isInput) { string replacement = (!port.displayCustomName) ? UI.LOGIC_PORTS.PORT_INPUT_DEFAULT_NAME.text : port.description; num = component3.GetInputValue(port.id); hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_INPUT_HOVER_FMT.Replace("{Port}", replacement).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard); } else { string replacement2 = (!port.displayCustomName) ? UI.LOGIC_PORTS.PORT_OUTPUT_DEFAULT_NAME.text : port.description; num = component3.GetOutputValue(port.id); hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_OUTPUT_HOVER_FMT.Replace("{Port}", replacement2).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard); } hoverTextDrawer.NewLine(26); TextStyleSetting textStyleSetting = (!flag) ? component2.Styles_LogicActive.Standard : ((num != 1) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicActive.Selected); hoverTextDrawer.DrawIcon((num != 1 || !flag) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting.textColor, 18, 2); hoverTextDrawer.DrawText(port.activeDescription, textStyleSetting); hoverTextDrawer.NewLine(26); TextStyleSetting textStyleSetting2 = (!flag) ? component2.Styles_LogicStandby.Standard : ((num != 0) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicStandby.Selected); hoverTextDrawer.DrawIcon((num != 0 || !flag) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting2.textColor, 18, 2); hoverTextDrawer.DrawText(port.inactiveDescription, textStyleSetting2); hoverTextDrawer.EndShadowBar(); } LogicGate component4 = hoverObject.GetComponent <LogicGate>(); if ((UnityEngine.Object)component4 != (UnityEngine.Object)null && component4.TryGetPortAtCell(cell, out LogicGateBase.PortId port2)) { int portValue = component4.GetPortValue(port2); bool portConnected = component4.GetPortConnected(port2); LogicGate.LogicGateDescriptions.Description portDescription = component4.GetPortDescription(port2); hoverTextDrawer.BeginShadowBar(false); if (port2 == LogicGateBase.PortId.Output) { hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_MULTI_OUTPUT_HOVER_FMT.Replace("{Port}", portDescription.name).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard); } else { hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.LOGIC_MULTI_INPUT_HOVER_FMT.Replace("{Port}", portDescription.name).Replace("{Name}", hoverObject.GetProperName().ToUpper()), component2.Styles_Title.Standard); } hoverTextDrawer.NewLine(26); TextStyleSetting textStyleSetting3 = (!portConnected) ? component2.Styles_LogicActive.Standard : ((portValue != 1) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicActive.Selected); hoverTextDrawer.DrawIcon((portValue != 1 || !portConnected) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting3.textColor, 18, 2); hoverTextDrawer.DrawText(portDescription.active, textStyleSetting3); hoverTextDrawer.NewLine(26); TextStyleSetting textStyleSetting4 = (!portConnected) ? component2.Styles_LogicStandby.Standard : ((portValue != 0) ? component2.Styles_LogicSignalInactive : component2.Styles_LogicStandby.Selected); hoverTextDrawer.DrawIcon((portValue != 0 || !portConnected) ? component2.iconDash : component2.iconActiveAutomationPort, textStyleSetting4.textColor, 18, 2); hoverTextDrawer.DrawText(portDescription.inactive, textStyleSetting4); hoverTextDrawer.EndShadowBar(); } } } else if (mode == OverlayModes.Power.ID) { CircuitManager circuitManager = Game.Instance.circuitManager; ushort circuitID = circuitManager.GetCircuitID(cell); if (circuitID != 65535) { hoverTextDrawer.BeginShadowBar(false); float wattsNeededWhenActive = circuitManager.GetWattsNeededWhenActive(circuitID); wattsNeededWhenActive += currentDef.EnergyConsumptionWhenActive; float maxSafeWattageForCircuit = circuitManager.GetMaxSafeWattageForCircuit(circuitID); Color color = (!(wattsNeededWhenActive >= maxSafeWattageForCircuit)) ? Color.white : Color.red; hoverTextDrawer.AddIndent(width); hoverTextDrawer.DrawText(string.Format(UI.DETAILTABS.ENERGYGENERATOR.POTENTIAL_WATTAGE_CONSUMED, GameUtil.GetFormattedWattage(wattsNeededWhenActive, GameUtil.WattageFormatterUnit.Automatic)), Styles_BodyText.Standard, color, true); hoverTextDrawer.EndShadowBar(); } } } hoverTextDrawer.EndDrawing(); }
public override void OnDeath(PlayerControl killer = null) { // 占い師の画面では呪殺したことを分からなくするために自殺処理させているので注意すること if (impostorFlag || jackalFlag || crewFlag) { return; } if (((killer != null && killer.isCrew()) || killer.isRole(RoleType.SchrodingersCat)) && justDieOnKilledByCrew) { return; } if (killer == null) { if (becomesWhichTeamsOnExiled == exileType.Random) { int rndVal = Jackal.jackal != null?rnd.Next(0, 2) : rnd.Next(0, 1); switch (rndVal) { case 0: setCrewFlag(); break; case 1: setImpostorFlag(); break; case 2: setJackalFlag(); break; default: setCrewFlag(); break; } } else if (becomesWhichTeamsOnExiled == exileType.Crew) { setCrewFlag(); } return; } else { bool isCrewOrSchrodingersCat = killer.isCrew() || killer.isRole(RoleType.SchrodingersCat); if (killer.isImpostor()) { setImpostorFlag(); if (becomesImpostor) { DestroyableSingleton <RoleManager> .Instance.SetRole(player, RoleTypes.Impostor); } } else if (killer.isRole(RoleType.Jackal)) { setJackalFlag(); } else if (isCrewOrSchrodingersCat) { setCrewFlag(); } // EndGamePatchでゲームを終了させないために先にkillerに値を代入する if (SchrodingersCat.killsKiller && !isCrewOrSchrodingersCat) { SchrodingersCat.killer = killer; } // 蘇生する player.Revive(); // 死体を消す DeadBody[] array = UnityEngine.Object.FindObjectsOfType <DeadBody>(); for (int i = 0; i < array.Length; i++) { if (GameData.Instance.GetPlayerById(array[i].ParentId).PlayerId == player.PlayerId) { array[i].gameObject.active = false; } } if (SchrodingersCat.killsKiller && !isCrewOrSchrodingersCat) { if (PlayerControl.LocalPlayer == killer) { // 死亡までのカウントダウン TMPro.TMP_Text text; RoomTracker roomTracker = HudManager.Instance?.roomTracker; GameObject gameObject = UnityEngine.Object.Instantiate(roomTracker.gameObject); UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <RoomTracker>()); gameObject.transform.SetParent(HudManager.Instance.transform); gameObject.transform.localPosition = new Vector3(0, -1.8f, gameObject.transform.localPosition.z); gameObject.transform.localScale = Vector3.one * 3f; text = gameObject.GetComponent <TMPro.TMP_Text>(); HudManager.Instance.StartCoroutine(Effects.Lerp(15f, new Action <float>((p) => { string message = (15 - (p * 15f)).ToString("0"); bool even = ((int)(p * 15f / 0.25f)) % 2 == 0; // Bool flips every 0.25 seconds string prefix = (even ? "<color=#FCBA03FF>" : "<color=#FF0000FF>"); text.text = prefix + message + "</color>"; if (text != null) { text.color = even ? Color.yellow : Color.red; } if (p == 1f && text != null && text.gameObject != null) { if (SchrodingersCat.killer != null && SchrodingersCat.killer.isAlive()) { MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SchrodingersCatSuicide, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.schrodingersCatSuicide(); SchrodingersCat.killer = null; } UnityEngine.Object.Destroy(text.gameObject); } }))); } } } }