private void TriggerAudio(int old_value) { SpeedControlScreen instance = SpeedControlScreen.Instance; if (old_value != outputValue && (Object)instance != (Object)null && !instance.IsPaused) { GridArea visibleArea = GridVisibleArea.GetVisibleArea(); List <LogicWire> list = new List <LogicWire>(); for (int i = 0; i < wires.Count; i++) { if (visibleArea.Min <= (Vector2)wires[i].transform.GetPosition() && (Vector2)wires[i].transform.GetPosition() <= visibleArea.Max) { list.Add(wires[i]); } } if (list.Count > 0) { int index = Mathf.CeilToInt((float)(list.Count / 2)); if ((Object)list[index] != (Object)null) { Vector3 position = list[index].transform.GetPosition(); EventInstance instance2 = KFMOD.BeginOneShot(GlobalAssets.GetSound("Logic_Circuit_Toggle", false), position); instance2.setParameterValue("wireCount", (float)(wires.Count % 24)); instance2.setParameterValue("enabled", (float)outputValue); KFMOD.EndOneShot(instance2); } } } }
private void OnClick(Entry entry) { Notification nextClickedNotification = entry.NextClickedNotification; PlaySound3D(GlobalAssets.GetSound("HUD_Click_Open", false)); if (nextClickedNotification.customClickCallback != null) { nextClickedNotification.customClickCallback(nextClickedNotification.customClickData); } else { if ((UnityEngine.Object)nextClickedNotification.clickFocus != (UnityEngine.Object)null) { Vector3 position = nextClickedNotification.clickFocus.GetPosition(); position.z = -40f; CameraController.Instance.SetTargetPos(position, 8f, true); if ((UnityEngine.Object)nextClickedNotification.clickFocus.GetComponent <KSelectable>() != (UnityEngine.Object)null) { SelectTool.Instance.Select(nextClickedNotification.clickFocus.GetComponent <KSelectable>(), false); } } else if ((UnityEngine.Object)nextClickedNotification.Notifier != (UnityEngine.Object)null) { SelectTool.Instance.Select(nextClickedNotification.Notifier.GetComponent <KSelectable>(), false); } if (nextClickedNotification.Type == NotificationType.Messages) { ShowMessage((MessageNotification)nextClickedNotification); } } }
public override void InitializeStates(out BaseState default_state) { default_state = closed; base.serializable = true; closed.PlayAnim("on").Enter(delegate(StatesInstance smi) { if (smi.master.machineSound != null) { LoopingSounds component2 = smi.master.GetComponent <LoopingSounds>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { component2.StartSound(GlobalAssets.GetSound(smi.master.machineSound, false)); } } }); open.PlayAnim("working").OnAnimQueueComplete(off).Exit(delegate(StatesInstance smi) { smi.master.DropContents(); }); off.PlayAnim("off").Enter(delegate(StatesInstance smi) { if (smi.master.machineSound != null) { LoopingSounds component = smi.master.GetComponent <LoopingSounds>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { component.StopSound(GlobalAssets.GetSound(smi.master.machineSound, false)); } } }); }
public override void OnLeftClickDown(Vector3 cursor_pos) { if (!((Object)visualizer == (Object)null)) { path.Clear(); int cell = Grid.PosToCell(cursor_pos); if (Grid.IsValidCell(cell) && Grid.IsVisible(cell)) { bool valid = CheckValidPathPiece(cell); path.Add(new PathNode { cell = cell, visualizer = null, valid = valid }); CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true); } visUpdater = StartCoroutine(VisUpdater()); visualizer.GetComponent <KBatchedAnimController>().StopAndClear(); ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(1); placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false); if (placeSound != null) { buildingCount = buildingCount % 14 + 1; Vector3 pos = Grid.CellToPos(cell); EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos); if (def.AudioSize == "small") { instance.setParameterValue("tileCount", (float)buildingCount); } SoundEvent.EndOneShot(instance); } base.OnLeftClickDown(cursor_pos); } }
private void OnAbsorb(object data) { Pickupable pickupable = (Pickupable)data; if ((UnityEngine.Object)pickupable != (UnityEngine.Object)null) { PrimaryElement component = GetComponent <PrimaryElement>(); PrimaryElement primaryElement = pickupable.PrimaryElement; if ((UnityEngine.Object)primaryElement != (UnityEngine.Object)null) { float temperature = 0f; float mass = component.Mass; float mass2 = primaryElement.Mass; if (mass > 0f && mass2 > 0f) { temperature = SimUtil.CalculateFinalTemperature(mass, component.Temperature, mass2, primaryElement.Temperature); } else if (primaryElement.Mass > 0f) { temperature = primaryElement.Temperature; } component.SetMassTemperature(mass + mass2, temperature); if ((UnityEngine.Object)CameraController.Instance != (UnityEngine.Object)null) { string sound = GlobalAssets.GetSound("Ore_absorb", false); if (sound != null && CameraController.Instance.IsAudibleSound(pickupable.transform.GetPosition(), sound)) { PlaySound3D(sound); } } } } }
protected override void OnDragTool(int cell, int distFromOrigin) { if (path.Count == 0) { return; } PathNode pathNode = path[path.Count - 1]; if (pathNode.cell == cell) { return; } placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false); Vector3 pos = Grid.CellToPos(cell); EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos); if (path.Count > 1) { int num = cell; PathNode pathNode2 = path[path.Count - 2]; if (num == pathNode2.cell) { if ((Object)previousCellConnection != (Object)null) { previousCellConnection.ConnectedEvent(previousCell); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("OutletDisconnected", false)); previousCellConnection = null; } previousCell = cell; CheckForConnection(cell, def.PrefabID, string.Empty, ref previousCellConnection, false); PathNode pathNode3 = path[path.Count - 1]; Object.Destroy(pathNode3.visualizer); PathNode pathNode4 = path[path.Count - 1]; TileVisualizer.RefreshCell(pathNode4.cell, def.TileLayer, def.ReplacementLayer); path.RemoveAt(path.Count - 1); buildingCount = ((buildingCount != 1) ? (buildingCount - 1) : (buildingCount = 14)); instance.setParameterValue("tileCount", (float)buildingCount); SoundEvent.EndOneShot(instance); goto IL_029c; } } if (!path.Exists((PathNode n) => n.cell == cell)) { bool valid = CheckValidPathPiece(cell); path.Add(new PathNode { cell = cell, visualizer = null, valid = valid }); CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true); buildingCount = buildingCount % 14 + 1; instance.setParameterValue("tileCount", (float)buildingCount); SoundEvent.EndOneShot(instance); } goto IL_029c; IL_029c: visualizer.SetActive(path.Count < 2); ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(path.Count); }
public void OnSelectBuilding(GameObject button_go, BuildingDef def) { if ((UnityEngine.Object)button_go == (UnityEngine.Object)null) { Debug.Log("Button gameObject is null", base.gameObject); } else if ((UnityEngine.Object)button_go == (UnityEngine.Object)selectedBuildingGameObject) { CloseRecipe(true); } else { ignoreToolChangeMessages++; selectedBuildingGameObject = button_go; currentlySelectedToggle = button_go.GetComponent <KToggle>(); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false)); HashedString category = tagCategoryMap[def.Tag]; if (GetToggleEntryForCategory(category, out ToggleEntry toggleEntry) && toggleEntry.pendingResearchAttentions.Contains(def.Tag)) { toggleEntry.pendingResearchAttentions.Remove(def.Tag); button_go.GetComponent <PlanCategoryNotifications>().ToggleAttention(false); if (toggleEntry.pendingResearchAttentions.Count == 0) { toggleEntry.toggleInfo.toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(false); } } productInfoScreen.ClearProduct(false); ToolMenu.Instance.ClearSelection(); PrebuildTool.Instance.Activate(def, BuildableState(def)); productInfoScreen.Show(true); productInfoScreen.ConfigureScreen(def); ignoreToolChangeMessages--; } }
private void Emit(object data) { GameObject gameObject = (GameObject)data; global::Components.Cmps <MinionIdentity> liveMinionIdentities = global::Components.LiveMinionIdentities; Vector2 a = gameObject.transform.GetPosition(); for (int i = 0; i < liveMinionIdentities.Count; i++) { MinionIdentity minionIdentity = liveMinionIdentities[i]; if (minionIdentity.gameObject != gameObject.gameObject) { Vector2 b = minionIdentity.transform.GetPosition(); float num = Vector2.SqrMagnitude(a - b); if (num <= 2.25f) { minionIdentity.Trigger((int)GameHashes.Cringe, Strings.Get("STRINGS.DUPLICANTS.DISEASES.PUTRIDODOUR.CRINGE_EFFECT").String); minionIdentity.gameObject.GetSMI <ThoughtGraph.Instance>().AddThought(Db.Get().Thoughts.PutridOdour); } } } int gameCell = Grid.PosToCell(gameObject.transform.GetPosition()); float temp = Db.Get().Amounts.Temperature.Lookup(this).value; SimMessages.AddRemoveSubstance(gameCell, SimHashes.ContaminatedOxygen, CellEventLogger.Instance.ElementConsumerSimUpdate, 0.0025f, temp, DiseaseInfo.Invalid.idx, DiseaseInfo.Invalid.count); KFMOD.PlayOneShot(GlobalAssets.GetSound("Dupe_Flatulence"), base.transform.GetPosition()); }
protected override void OnPrefabInit() { base.OnPrefabInit(); remainingTileDamage = totalTileDamage; loopingSounds = base.gameObject.GetComponent <LoopingSounds>(); flyingSound = GlobalAssets.GetSound("Meteor_LP", false); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { GlobalAssets.Load(Content); List <Task> loadTasks = new List <Task>(); _spriteBatch = new SpriteBatch(GraphicsDevice); _spriteSheetLoader = new SpriteSheetLoader(this.Content); _mapManager = new MapManager(_spriteSheetLoader, _spriteBatch); loadTasks.Add(_mapManager.LoadAsync()); SpriteFont defaultFont = Content.Load <SpriteFont>("DialogueFont"); Texture2D deleteme = Content.Load <Texture2D>("EffectsSheet"); _dialogueManager = new DialogueManager(_spriteBatch, defaultFont); _factory = new EntityFactory(_graphics.GraphicsDevice, _spriteSheetLoader, _spriteBatch, _mapManager, _dialogueManager); loadTasks.Add(_factory.CreatePlayerEntity()); loadTasks.Add(_factory.CreateTestNpcEntity()); // Force synchronous wait on await calls Task.WhenAll(loadTasks).ConfigureAwait(false).GetAwaiter().GetResult(); }
private void PlayDingSound(Notification notification, int count) { if (!notificationSounds.TryGetValue(notification.Type, out string value)) { value = "Notification"; } if (!timeOfLastNotification.TryGetValue(value, out float value2)) { value2 = 0f; } float value3 = (Time.time - value2) / soundDecayTime; timeOfLastNotification[value] = Time.time; string sound; if (count > 1) { sound = GlobalAssets.GetSound(value + "_AddCount", true); if (sound == null) { sound = GlobalAssets.GetSound(value, false); } } else { sound = GlobalAssets.GetSound(value, false); } if (notification.playSound) { EventInstance instance = KFMOD.BeginOneShot(sound, Vector3.zero); instance.setParameterValue("timeSinceLast", value3); KFMOD.EndOneShot(instance); } }
public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); Worker component = behaviour.GetComponent <Worker>(); if ((UnityEngine.Object)component == (UnityEngine.Object)null) { SoundEvent.PlayOneShot(GlobalAssets.GetSound("Building_Dmg_Metal", false), position); } else { Workable workable = component.workable; if ((UnityEngine.Object)workable != (UnityEngine.Object)null) { Building component2 = workable.GetComponent <Building>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { BuildingDef def = component2.Def; string name = StringFormatter.Combine(base.name, "_", def.AudioCategory); string sound = GlobalAssets.GetSound(name, false); if (sound == null) { name = "Building_Dmg_Metal"; sound = GlobalAssets.GetSound(name, false); } if (sound != null) { SoundEvent.PlayOneShot(sound, position); } } } } }
private void OnClickCategory(ToggleInfo toggle_info) { UserData userData = (UserData)toggle_info.userData; PlanScreen.RequirementsState requirementsState = userData.requirementsState; if (requirementsState == PlanScreen.RequirementsState.Complete || requirementsState == PlanScreen.RequirementsState.Materials) { if (selectedCategory != userData.category) { selectedCategory = userData.category; KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false)); } else { selectedCategory = HashedString.Invalid; ClearSelection(); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false)); } } else { selectedCategory = HashedString.Invalid; ClearSelection(); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false)); } toggle_info.toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(false); if (onCategoryClicked != null) { onCategoryClicked(selectedCategory, userData.depth); } }
public override void OnKeyDown(KButtonEvent e) { if (e.TryConsume(Action.RotateBuilding)) { if ((Object)visualizer != (Object)null) { Rotatable component = visualizer.GetComponent <Rotatable>(); if ((Object)component != (Object)null) { KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Rotate", false)); buildingOrientation = component.Rotate(); if (Grid.IsValidBuildingCell(lastCell)) { Vector3 pos = Grid.CellToPosCCC(lastCell, Grid.SceneLayer.Building); UpdateVis(pos); } if (base.Dragging && lastDragCell != -1) { TryBuild(lastDragCell); } } } } else { base.OnKeyDown(e); } }
private void OnHoverExitNosweat() { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Mouseover", false)); nosweatButtonSelectionFrame.SetAlpha(0f); nosweatButtonHeader.color = new Color(0.309803933f, 0.34117648f, 0.384313732f, 1f); descriptionArea.text = UI.FRONTEND.MODESELECTSCREEN.BLANK_DESC; }
private void ToggleOpen(bool play_sound) { if (!anyDiscovered) { if (play_sound) { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false)); } } else if (!IsOpen) { if (play_sound) { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Open", false)); } SetOpen(true); elements.LabelText.fontSize = (float)maximizedFontSize; elements.QuantityText.fontSize = (float)maximizedFontSize; } else { if (play_sound) { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false)); } SetOpen(false); elements.LabelText.fontSize = (float)minimizedFontSize; elements.QuantityText.fontSize = (float)minimizedFontSize; } }
private void ChangePersonalPriority(IPersonalPriorityManager priority_mgr, ChoreGroup chore_group, int delta, bool wrap_around) { if (priority_mgr.IsChoreGroupDisabled(chore_group)) { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false)); } else { int personalPriority = priority_mgr.GetPersonalPriority(chore_group); personalPriority += delta; if (wrap_around) { personalPriority %= 6; if (personalPriority < 0) { personalPriority += 6; } } personalPriority = Mathf.Clamp(personalPriority, 0, 5); priority_mgr.SetPersonalPriority(chore_group, personalPriority); if (delta > 0) { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false)); } else { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false)); } } }
private void OnHoverEnterNosweat() { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Mouseover", false)); nosweatButtonSelectionFrame.SetAlpha(1f); nosweatButtonHeader.color = new Color(0.7019608f, 0.3647059f, 0.533333361f, 1f); descriptionArea.text = UI.FRONTEND.MODESELECTSCREEN.NOSWEAT_DESC; }
protected override void OnPrefabInit() { base.OnPrefabInit(); sound = GlobalAssets.GetSound(sound, false); Subscribe(1027377649, OnObjectMovementStateChangedDelegate); Singleton <CellChangeMonitor> .Instance.RegisterCellChangedHandler(base.transform, OnCellChanged, "OilFloaterMovementSound"); }
public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); int cell = Grid.PosToCell(position); GameObject gameObject = null; BuildingDef buildingDef = null; if (Grid.IsValidCell(cell)) { gameObject = Grid.Objects[cell, 1]; if ((Object)gameObject != (Object)null && (Object)gameObject.GetComponent <Ladder>() != (Object)null) { Building component = gameObject.GetComponent <BuildingComplete>(); if ((Object)component != (Object)null) { buildingDef = component.Def; } } } if ((Object)buildingDef != (Object)null) { string name = (!(buildingDef.PrefabID == "LadderFast")) ? base.name : StringFormatter.Combine(base.name, "_Plastic"); string sound = GlobalAssets.GetSound(name, false); if (sound != null) { SoundEvent.PlayOneShot(sound, position); } } }
public override void OnKeyDown(KButtonEvent e) { if (mouseOver && ConsumeMouseScroll && !e.TryConsume(Action.ZoomIn) && !e.TryConsume(Action.ZoomOut)) { goto IL_002e; } goto IL_002e; IL_002e: if (HasFocus) { if (e.TryConsume(Action.Escape)) { Game.Instance.Trigger(288942073, null); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false)); } else { base.OnKeyDown(e); if (!e.Consumed) { Action action = e.GetAction(); if (action >= Action.BUILD_MENU_START_INTERCEPT) { e.TryConsume(action); } } } } }
private void OnSelectBuilding(BuildingDef def) { PlanScreen.RequirementsState requirementsState = BuildMenu.Instance.BuildableState(def); if (requirementsState == PlanScreen.RequirementsState.Complete || requirementsState == PlanScreen.RequirementsState.Materials) { if ((UnityEngine.Object)def != (UnityEngine.Object)selectedBuilding) { selectedBuilding = def; KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false)); } else { selectedBuilding = null; ClearSelection(); CloseRecipe(true); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false)); } } else { selectedBuilding = null; ClearSelection(); CloseRecipe(true); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false)); } onBuildingSelected(selectedBuilding); }
private void PlayTone(int pitch, bool forwards) { EventInstance instance = KFMOD.BeginOneShot(GlobalAssets.GetSound("WorkChime_tone", false), Vector3.zero); instance.setParameterValue("WorkChime_pitch", (float)pitch); instance.setParameterValue("WorkChime_start", (float)(forwards ? 1 : 0)); KFMOD.EndOneShot(instance); }
private void OnDiscoveredSpaceClicked() { KFMOD.PlayOneShot(GlobalAssets.GetSound(GetSound(), false)); MusicManager.instance.PlaySong("Stinger_Surface", false); CameraController.Instance.SetTargetPos(cameraFocusPos, 8f, true); SeasonManager component = SaveGame.Instance.GetComponent <SeasonManager>(); component.ForceBeginMeteorSeasonWithShower(); }
protected void DisableProceedButton() { proceedButton.ClearOnClick(); proceedButton.isInteractable = false; proceedButton.onClick += delegate { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false)); }; }
public static void Initialize() { KSlider.DefaultSounds[0] = GlobalAssets.GetSound("Slider_Start", false); KSlider.DefaultSounds[1] = GlobalAssets.GetSound("Slider_Move", false); KSlider.DefaultSounds[2] = GlobalAssets.GetSound("Slider_End", false); KSlider.DefaultSounds[3] = GlobalAssets.GetSound("Slider_Boundary_Low", false); KSlider.DefaultSounds[4] = GlobalAssets.GetSound("Slider_Boundary_High", false); KScrollRect.DefaultSounds[KScrollRect.SoundType.OnMouseScroll] = GlobalAssets.GetSound("Mousewheel_Move", false); WidgetSoundPlayer.getSoundPath = GetSoundPath; }
protected override void OnDeactivateTool(InterfaceTool new_tool) { active = false; GridCompositor.Instance.ToggleMajor(false); HideToolTip(); ResourceRemainingDisplayScreen.instance.DeactivateDisplay(); Object.Destroy(visualizer); KMonoBehaviour.PlaySound(GlobalAssets.GetSound(GetDeactivateSound(), false)); base.OnDeactivateTool(new_tool); }
public override void OnKeyDown(KButtonEvent e) { if (e.TryConsume(Action.Escape)) { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close")); Show(show: false); e.Consumed = true; } base.OnKeyDown(e); }
private void UpdateOverlaySounds() { string soundName = currentModeInfo.mode.GetSoundName(); if (soundName != string.Empty) { soundName = GlobalAssets.GetSound(soundName, false); KMonoBehaviour.PlaySound(soundName); } }
public void DeselectAndClose() { KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Back", false)); SelectTool.Instance.Select(null, false); if (!((UnityEngine.Object)target == (UnityEngine.Object)null)) { target = null; DeactivateSideContent(); Show(false); } }