/// <inheritdoc/> public override void Play(GameObject playerObject, bool[] effectInfo) { // Also play the crystal dash cancel animation, because it is cancelled when we do a wallslide AnimationManager.CrystalDashChargeCancel.Play(playerObject, effectInfo); var playerEffects = playerObject.FindGameObjectInChildren("Effects"); // Find an existing dust object var wallSlideDustObject = playerEffects.FindGameObjectInChildren("Wall Slide Dust"); // Otherwise, create a new one from the prefab in the HeroController if (wallSlideDustObject == null) { var wallSlideDustPrefab = HeroController.instance.wallslideDustPrefab.gameObject; wallSlideDustObject = Object.Instantiate( wallSlideDustPrefab, playerEffects.transform ); // Give it a name, so we can find it later wallSlideDustObject.name = "Wall Slide Dust"; } // Disable compiler warning and enable dust emission #pragma warning disable 0618 wallSlideDustObject.GetComponent <ParticleSystem>().enableEmission = true; #pragma warning restore 0618 // Get a new audio source object relative to the player object var wallSlideAudioObject = AudioUtil.GetAudioSourceObject(playerEffects); // Again give a name, so we can destroy it later wallSlideAudioObject.name = "Wall Slide Audio"; // Get the actual audio source var wallSlideAudioSource = wallSlideAudioObject.GetComponent <AudioSource>(); // Get the wall slide clip and play it var heroAudioController = HeroController.instance.GetComponent <HeroAudioController>(); wallSlideAudioSource.clip = heroAudioController.wallslide.clip; wallSlideAudioSource.Play(); }
private void Button_AddBlcokWords_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); var txt = TextBox_InputBlcokWord.Text; if (!string.IsNullOrEmpty(txt)) { foreach (string item in ListBox_BlcokWords.Items) { if (item.Equals(txt)) { MsgBoxUtil.Information($"关键词 {txt} 已经添加过了,请勿重复添加"); return; } } ListBox_BlcokWords.Items.Add(txt); ListBox_BlcokWords.SelectedIndex = ListBox_BlcokWords.Items.Count - 1; TextBox_InputBlcokWord.Clear(); } }
private IEnumerator PlayRechargeAnimation(GameObject playerObject, clientSkin skin, GameObject playerEffects) { yield return(new WaitForSeconds(0.65f)); var shadowRechargePrefab = HeroController.instance.shadowRechargePrefab; var rechargeFsm = shadowRechargePrefab.LocateMyFSM("Recharge Effect"); // Obtain the recharge audio clip var audioPlayAction = rechargeFsm.GetAction <AudioPlay>("Burst", 0); var rechargeAudioClip = (AudioClip)audioPlayAction.oneShotClip.Value; // Get a new audio source and play the clip var rechargeAudioSourceObject = AudioUtil.GetAudioSourceObject(playerObject); var rechargeAudioSource = rechargeAudioSourceObject.GetComponent <AudioSource>(); rechargeAudioSource.clip = rechargeAudioClip; rechargeAudioSource.Play(); var rechargeObject = Object.Instantiate( shadowRechargePrefab, playerEffects.transform ); SkinManager.updateTextureInMaterialPropertyBlock(rechargeObject, skin.Knight); Object.Destroy(rechargeObject.LocateMyFSM("Recharge Effect")); rechargeObject.SetActive(true); rechargeObject.GetComponent <MeshRenderer>().enabled = true; var rechargeAnimator = rechargeObject.GetComponent <tk2dSpriteAnimator>(); rechargeAnimator.PlayFromFrame("Shadow Recharge", 0); yield return(new WaitForSeconds(rechargeAnimator.GetClipByName("Shadow Recharge").Duration)); Object.Destroy(rechargeObject); }
private void Button_RefushPersonalVehicleList_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); ListBox_PersonalVehicle.Items.Clear(); pVInfos.Clear(); Task.Run(() => { int max_slots = ReadGA <int>(1585857); for (int i = 0; i < max_slots; i++) { long hash = ReadGA <long>(1585857 + 1 + (i * 142) + 66); if (hash == 0) { continue; } string plate = ReadGAString(1585857 + 1 + (i * 142) + 1); pVInfos.Add(new PVInfo() { Index = i, Name = Vehicle.FindVehicleDisplayName(hash, true), hash = hash, plate = plate }); } foreach (var item in pVInfos) { Application.Current.Dispatcher.Invoke(() => { ListBox_PersonalVehicle.Items.Add($"[{item.plate}]\t{item.Name}"); }); } }); }
public void Handle(SimpleProto data) { if (data.Ks[0] == 0) { //使用物品声音 PlayerEntity player = SingletonManager.Get <FreeUiManager>().Contexts1.player.flagSelfEntity; if (player != null) { var uniqueId = AudioUtil.ToUseItemAudioUniqueId(data.Ins[0]); player.AudioController().PlaySimpleAudio(uniqueId, true); } } if (data.Ks[0] == 1) { //游戏开始关闭环境音 MapAmbInfo ambInfo; Wwise_IDs.GetMapAmb(data.Ins[0], out ambInfo); ambInfo.StopAmb(); } if (data.Ks[0] == 2) { //播放指定编号的音效 PlayerEntity player = SingletonManager.Get <FreeUiManager>().Contexts1.player.flagSelfEntity; if (player != null) { player.AudioController().PlaySimpleAudio((EAudioUniqueId)data.Ins[0], data.Bs[0]); } } if (data.Ks[0] == 3) { var vc = new Vector3(data.Fs[0], data.Fs[1], data.Fs[2]); //在指定位置上播放指定编号的音效 GameAudioMedia.PlayUniqueEventAudio(vc.ShiftedPosition(), (EAudioUniqueId)data.Ins[0]); } }
/// <summary> /// Play the Carefree Melody charm effect if the player has it equipped. /// </summary> /// <param name="playerEffects">The GameObject for the player effects.</param> private void PlayCarefreeEffect(GameObject playerEffects) { // Get the care free shield object from the HeroController and instantiate a copy var localCarefreeShield = HeroController.instance.carefreeShield; var carefreeShield = Object.Instantiate( localCarefreeShield, playerEffects.transform ); carefreeShield.SetActive(true); // Get the original audio source and its clip var audioSource = carefreeShield.GetComponent <AudioSource>(); var carefreeClip = audioSource.clip; // Destroy the original Object.Destroy(audioSource); // Replace it by a new one that bases volume off of distance and play the clip var newAudioObject = AudioUtil.GetAudioSourceObject(playerEffects); newAudioObject.GetComponent <AudioSource>().PlayOneShot(carefreeClip); }
private void Start() { _audioSource.volume = volumeObserver.GetVolumeBGM().Value; if (gameplayBgms.Length == 0) { LogUtil.PrintError(gameObject, GetType(), "No BGM clips defined!"); } else { AudioUtil.PlayRandomClip(GetType(), gameplayBgms, _audioSource); } if (gameOverBgm != null) { playerStats.IsGameOver() .Where(isGameOver => isGameOver) .Subscribe(_ => { AudioUtil.PlaySingleClip(GetType(), gameOverBgm, _audioSource); }) .AddTo(this); } }
private void Button_Teleport_DeleteCustom_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); int index1 = ListBox_TeleportClass.SelectedIndex; int index2 = ListBox_TeleportInfo.SelectedIndex; if (index1 == 0 && index2 != -1) { TeleportData.TeleportDataClass[index1].TeleportInfo.Remove(TeleportData.TeleportDataClass[index1].TeleportInfo[index2]); UpdateTpList(); ListBox_TeleportClass.SelectedIndex = 0; ListBox_TeleportInfo.SelectedIndex = ListBox_TeleportInfo.Items.Count - 1; TextBox_Result.Text = $"删除自定义传送坐标成功"; } else { TextBox_Result.Text = $"当前选中项为空"; } }
public void SetSwitch(int stateIndex, GameObject target) { if (stateIndex < 0) return; if (stateIndex != this.stateIndex || this.stateIndex < 0) { AKRESULT akresult; if (config.StateArr.Length > stateIndex) { akresult = AkSoundEngine.SetSwitch(config.GetConvertedGroupId(), config.GetConvertedGroupStateId(stateIndex), target); } else { AudioUtil.Logger.ErrorFormat("wise group:{0},state {1}", config.Group, stateIndex); akresult = AKRESULT.AK_Fail; } if (AudioUtil.VerifyAKResult(akresult, "AKSwitch state:{0}", config.Group)) { this.stateIndex = stateIndex; } } }
private IEnumerator Say() { // spawn a sound var sound = AudioUtil.PlayAtPositionWithPitch(transform.parent.position, SaySounds[Random.Range(0, SaySounds.Length)], Pitch, 0.1f); // lower volume sound.volume *= 0.4f; // wait var wait = Random.Range(sound.clip.length, sound.clip.length * 1.5f); if (Random.Range(0f, 10f) < 2f) { wait *= 1.5f; } yield return(new WaitForSeconds(wait)); // repeat StartCoroutine(Say()); }
public override void Play(GameObject playerObject, bool[] effectInfo) { // Get both the local player and remote player effects object var heroEffects = HeroController.instance.gameObject.FindGameObjectInChildren("Effects"); var playerEffects = playerObject.FindGameObjectInChildren("Effects"); // Play the end animation for the crystal dash trail if it exists var sdTrail = playerEffects.FindGameObjectInChildren("SD Trail"); if (sdTrail != null) { sdTrail.GetComponent <tk2dSpriteAnimator>().Play("SD Trail End"); } // Instantiate the wall hit effect and make sure to destroy it once the FSM is done var wallHitEffect = Object.Instantiate( heroEffects.FindGameObjectInChildren("Wall Hit Effect"), playerEffects.transform ); wallHitEffect.LocateMyFSM("FSM").InsertMethod("Destroy", 1, () => Object.Destroy(wallHitEffect)); var audioSourceObject = AudioUtil.GetAudioSourceObject(playerObject); var superDashFsm = HeroController.instance.gameObject.LocateMyFSM("Superdash"); var wallHitAction = superDashFsm.GetAction <AudioPlay>("Hit Wall", 4); audioSourceObject.GetComponent <AudioSource>().PlayOneShot((AudioClip)wallHitAction.oneShotClip.Value); var superDashAudio = playerObject.FindGameObjectInChildren("Superdash Audio"); if (superDashAudio != null) { superDashAudio.GetComponent <AudioSource>().Stop(); } }
public override void Play(GameObject playerObject, bool[] effectInfo) { // Get the spell control object from the local player object var localSpellControl = HeroController.instance.spellControl; // Get the AudioPlay action from the Quake Antic state var quakeAnticAudioPlay = localSpellControl.GetAction <AudioPlay>("Quake Antic", 0); var audioObject = AudioUtil.GetAudioSourceObject(playerObject); var audioSource = audioObject.GetComponent <AudioSource>(); // Lastly, we get the clip we need to play var quakeAnticClip = (AudioClip)quakeAnticAudioPlay.oneShotClip.Value; // Now we can play the clip audioSource.PlayOneShot(quakeAnticClip); // Destroy the audio object after the clip is done Object.Destroy(audioObject, quakeAnticClip.length); // Get the remote player spell control object, to which we can assign the effect var playerSpellControl = playerObject.FindGameObjectInChildren("Spells"); // Instantiate the Q Charge object from the prefab in the local spell control // Instantiate it relative to the remote player position var qCharge = Object.Instantiate( localSpellControl.gameObject.FindGameObjectInChildren("Q Charge"), playerSpellControl.transform ); qCharge.SetActive(true); // Set the name, so we can reference it later, when we need to destroy it qCharge.name = "Q Charge"; // Start the animation at the first frame qCharge.GetComponent <tk2dSpriteAnimator>().PlayFromFrame(0); }
// 将筹码移动到对应的玩家上 public void MoveToPlayer(RepeatedField <int> chips, RepeatedField <int> ps, List <GameObject> playerObjs, Func <int, int> GetPlayerPos) { bool isWinForSelf = false; gameObject.GetComponent <Image>().color = new Color(0, 0, 0, 0); chipCountObj.SetActive(false); for (int i = 0; i < ps.Count; i++) { if (ps[i] > 0) { int chip = ps[i]; GameObject playerObj = playerObjs[GetPlayerPos(i)]; for (int j = 0; j < chipFabs.Count; j++) { GameObject chipFab = chipFabs[j]; Sequence s = DOTween.Sequence(); s.AppendInterval(j * 0.1f); s.Append(chipFab.transform.DOMove(playerObj.transform.position, 0.5f)); s.AppendCallback(() => { Destroy(chipFab); }); } if (chipCount - chip > 0) { UpdateChips(chipCount - chip); } playerObj.GetComponent <PlayerControler>().Win(chips[i]); if (playerObj.GetComponent <PlayerControler>().PlayerInfo.Id == UserManager.Instance().userInfo.id) { isWinForSelf = true; } } } // 播放音乐 AudioUtil.Play(isWinForSelf?AudioUtil.Win: AudioUtil.Lose); }
public AreaEffect CreateAreaEffect(UInt64 owner, uint skillId, UInt32 id, Vector3 skillDir, Vector3 skillPos) { SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfigInfo(skillId); if (skillConfig == null || skillConfig.effect == "0") { return(null); } string resourcePath = GameConfig.SkillEffectPath + skillConfig.effect; AreaEffect effect = new AreaEffect(); effect.skillId = skillId; effect.dir = skillDir; effect.fixPosition = skillPos; effect.ID = id; effect.resPath = resourcePath; effect.Create(); // 播放声音 string soundPath = GameConfig.SoundPath + skillConfig.sound; effect.mAudioSource = AudioUtil.PlaySound(soundPath); AddEffect(effect.ID, effect); return(effect); }
public static float DisplayPitchField(float pitch, string fieldName = "Pitch") { if (!MasterAudio.UseCentsForPitch) { return(EditorGUILayout.Slider(fieldName, pitch, -3f, 3f)); } float pitchSemiTones; // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression if (pitch == 1) { pitchSemiTones = 0; } else { pitchSemiTones = AudioUtil.GetSemitonesFromPitch(pitch); } var newSemi = EditorGUILayout.Slider("Pitch Chg. Semitones", pitchSemiTones, -24f, 19f); var newPitch = AudioUtil.GetPitchFromSemitones(newSemi); return(newPitch); }
public AKRESULT Initialize() { if (IsInitialized) { return(AKRESULT.AK_Success); } if (!AkSoundEngine.IsInitialized()) { return(AKRESULT.AK_Fail); } string[] assetNames = AudioUtil.GetBankAssetNamesByFolder(null); foreach (string bankName in assetNames) { if (bankName.StartsWith("Hall_") || bankName.StartsWith("Map_")) { continue; } AKBankAtom atom = bankAtomSet.Register(bankName, AudioBank_LoadMode.Aync); bankAtomSet.DoLoadBank(atom); } IsInitialized = true; return(AKRESULT.AK_Success); }
//----------------------- // Voices //----------------------- public void PlayAVoice(AudioClip clip) { AudioUtil.PlaySFX(sfxSource, clip); }
// ReSharper disable once FunctionComplexityOverflow public override void OnInspectorGUI() { EditorGUI.indentLevel = 0; var isDirty = false; _variation = (SoundGroupVariation)target; if (MasterAudioInspectorResources.LogoTexture != null) { DTGUIHelper.ShowHeaderTexture(MasterAudioInspectorResources.LogoTexture); } var parentGroup = _variation.ParentGroup; if (parentGroup == null) { DTGUIHelper.ShowLargeBarAlert("This file cannot be edited in Project View."); return; } AudioSource previewer; EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); GUI.contentColor = DTGUIHelper.BrightButtonColor; if (GUILayout.Button(new GUIContent("Back to Group", "Select Group in Hierarchy"), EditorStyles.toolbarButton, GUILayout.Width(90))) { Selection.activeObject = _variation.transform.parent.gameObject; } GUILayout.FlexibleSpace(); if (Application.isPlaying) { // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression if (_variation.IsPlaying && _variation.VarAudio.clip != null) // wait for Resource files to load { GUI.color = Color.green; var label = "Playing ({0}%)"; if (AudioUtil.IsAudioPaused(_variation.VarAudio)) { GUI.color = Color.yellow; label = "Paused ({0}%)"; } var percentagePlayed = (int)(_variation.VarAudio.time / _variation.VarAudio.clip.length * 100); EditorGUILayout.LabelField(string.Format(label, percentagePlayed), EditorStyles.miniButtonMid, GUILayout.Height(16), GUILayout.Width(240)); _variation.frames++; isDirty = true; GUI.color = DTGUIHelper.BrightButtonColor; if (_variation.ObjectToFollow != null || _variation.ObjectToTriggerFrom != null) { if (GUILayout.Button("Select Caller", EditorStyles.miniButton, GUILayout.Width(80))) { if (_variation.ObjectToFollow != null) { Selection.activeGameObject = _variation.ObjectToFollow.gameObject; } else { Selection.activeGameObject = _variation.ObjectToTriggerFrom.gameObject; } } } } else { GUI.color = Color.red; EditorGUILayout.LabelField("Not playing", EditorStyles.miniButtonMid, GUILayout.Height(16), GUILayout.Width(240)); } } GUI.color = Color.white; GUI.contentColor = Color.white; _ma = MasterAudio.Instance; var maInScene = _ma != null; var canPreview = !DTGUIHelper.IsPrefabInProjectView(_variation); if (maInScene) { var buttonPressed = DTGUIHelper.DTFunctionButtons.None; if (canPreview) { buttonPressed = DTGUIHelper.AddVariationButtons(); } switch (buttonPressed) { case DTGUIHelper.DTFunctionButtons.Play: previewer = MasterAudioInspector.GetPreviewer(); if (Application.isPlaying) { MasterAudio.PlaySound3DAtVector3AndForget(_variation.ParentGroup.name, previewer.transform.position, 1f, null, 0f, _variation.name); } else { isDirty = true; var randPitch = GetRandomPreviewPitch(_variation); var varVol = GetRandomPreviewVolume(_variation); if (_variation.audLocation != MasterAudio.AudioLocation.FileOnInternet) { if (previewer != null) { MasterAudioInspector.StopPreviewer(); previewer.pitch = randPitch; } } var calcVolume = varVol * parentGroup.groupMasterVolume; switch (_variation.audLocation) { case MasterAudio.AudioLocation.ResourceFile: if (previewer != null) { var fileName = AudioResourceOptimizer.GetLocalizedFileName(_variation.useLocalization, _variation.resourceFileName); previewer.PlayOneShot(Resources.Load(fileName) as AudioClip, calcVolume); } break; case MasterAudio.AudioLocation.Clip: if (previewer != null) { previewer.PlayOneShot(_variation.VarAudio.clip, calcVolume); } break; case MasterAudio.AudioLocation.FileOnInternet: if (!string.IsNullOrEmpty(_variation.internetFileUrl)) { Application.OpenURL(_variation.internetFileUrl); } break; } } break; case DTGUIHelper.DTFunctionButtons.Stop: if (Application.isPlaying) { MasterAudio.StopAllOfSound(_variation.transform.parent.name); } else { if (_variation.audLocation != MasterAudio.AudioLocation.FileOnInternet) { MasterAudioInspector.StopPreviewer(); } } break; } } EditorGUILayout.EndHorizontal(); DTGUIHelper.HelpHeader("http://www.dtdevtools.com/docs/masteraudio/SoundGroupVariations.htm", "http://www.dtdevtools.com/API/masteraudio/class_dark_tonic_1_1_master_audio_1_1_sound_group_variation.html"); if (maInScene && !Application.isPlaying) { DTGUIHelper.ShowColorWarning(MasterAudio.PreviewText); } var oldLocation = _variation.audLocation; EditorGUILayout.BeginHorizontal(); if (!Application.isPlaying) { var newLocation = (MasterAudio.AudioLocation)EditorGUILayout.EnumPopup("Audio Origin", _variation.audLocation); if (newLocation != oldLocation) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Audio Origin"); _variation.audLocation = newLocation; } } else { EditorGUILayout.LabelField("Audio Origin", _variation.audLocation.ToString()); } DTGUIHelper.AddHelpIcon("http://www.dtdevtools.com/docs/masteraudio/SoundGroupVariations.htm#AudioOrigin"); EditorGUILayout.EndHorizontal(); switch (_variation.audLocation) { case MasterAudio.AudioLocation.Clip: var newClip = (AudioClip)EditorGUILayout.ObjectField("Audio Clip", _variation.VarAudio.clip, typeof(AudioClip), false); if (newClip != _variation.VarAudio.clip) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation.VarAudio, "assign Audio Clip"); _variation.VarAudio.clip = newClip; } break; case MasterAudio.AudioLocation.FileOnInternet: if (oldLocation != _variation.audLocation) { if (_variation.VarAudio.clip != null) { Debug.Log("Audio clip removed to prevent unnecessary memory usage on File On Internet Variation."); } _variation.VarAudio.clip = null; } if (!Application.isPlaying) { var newUrl = EditorGUILayout.TextField("Internet File URL", _variation.internetFileUrl); if (newUrl != _variation.internetFileUrl) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Internet File URL"); _variation.internetFileUrl = newUrl; } } else { EditorGUILayout.LabelField("Internet File URL", _variation.internetFileUrl); switch (_variation.internetFileLoadStatus) { case MasterAudio.InternetFileLoadStatus.Loading: DTGUIHelper.ShowLargeBarAlert("Attempting to download."); break; case MasterAudio.InternetFileLoadStatus.Loaded: DTGUIHelper.ShowColorWarning("Downloaded and ready to play."); break; case MasterAudio.InternetFileLoadStatus.Failed: DTGUIHelper.ShowRedError("Failed Download."); break; } } if (string.IsNullOrEmpty(_variation.internetFileUrl)) { DTGUIHelper.ShowLargeBarAlert("You have not specified a URL for the File On Internet. This Variation will not be available to play without one."); } break; case MasterAudio.AudioLocation.ResourceFile: if (oldLocation != _variation.audLocation) { if (_variation.VarAudio.clip != null) { Debug.Log("Audio clip removed to prevent unnecessary memory usage on Resource file Variation."); } _variation.VarAudio.clip = null; } EditorGUILayout.BeginVertical(); var anEvent = Event.current; GUI.color = DTGUIHelper.DragAreaColor; var dragArea = GUILayoutUtility.GetRect(0f, 20f, GUILayout.ExpandWidth(true)); GUI.Box(dragArea, "Drag Resource Audio clip here to use its name!"); GUI.color = Color.white; string newFilename; switch (anEvent.type) { case EventType.DragUpdated: case EventType.DragPerform: if (!dragArea.Contains(anEvent.mousePosition)) { break; } DragAndDrop.visualMode = DragAndDropVisualMode.Copy; if (anEvent.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); foreach (var dragged in DragAndDrop.objectReferences) { // ReSharper disable once ExpressionIsAlwaysNull var aClip = dragged as AudioClip; // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (aClip == null) { continue; } // ReSharper disable HeuristicUnreachableCode var useLocalization = false; newFilename = DTGUIHelper.GetResourcePath(aClip, ref useLocalization); if (string.IsNullOrEmpty(newFilename)) { newFilename = aClip.name; } AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Resource filename"); _variation.resourceFileName = newFilename; _variation.useLocalization = useLocalization; break; // ReSharper restore HeuristicUnreachableCode } } Event.current.Use(); break; } EditorGUILayout.EndVertical(); newFilename = EditorGUILayout.TextField("Resource Filename", _variation.resourceFileName); if (newFilename != _variation.resourceFileName) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Resource filename"); _variation.resourceFileName = newFilename; } EditorGUI.indentLevel = 1; var newLocal = EditorGUILayout.Toggle("Use Localized Folder", _variation.useLocalization); if (newLocal != _variation.useLocalization) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Use Localized Folder"); _variation.useLocalization = newLocal; } break; } EditorGUI.indentLevel = 0; var newProbability = EditorGUILayout.IntSlider("Probability to Play (%)", _variation.probabilityToPlay, 0, 100); if (newProbability != _variation.probabilityToPlay) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Probability to Play (%)"); _variation.probabilityToPlay = newProbability; } if (_variation.probabilityToPlay < 100) { DTGUIHelper.ShowLargeBarAlert("Since Probability to Play is less than 100%, you will not always hear this Variation when it's selected to play."); } var newVolume = DTGUIHelper.DisplayVolumeField(_variation.VarAudio.volume, DTGUIHelper.VolumeFieldType.None, MasterAudio.MixerWidthMode.Normal, 0f, true); if (newVolume != _variation.VarAudio.volume) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation.VarAudio, "change Volume"); _variation.VarAudio.volume = newVolume; } var newPitch = DTGUIHelper.DisplayPitchField(_variation.VarAudio.pitch); if (newPitch != _variation.VarAudio.pitch) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation.VarAudio, "change Pitch"); _variation.VarAudio.pitch = newPitch; } if (parentGroup.curVariationMode == MasterAudioGroup.VariationMode.LoopedChain) { DTGUIHelper.ShowLargeBarAlert("Loop Clip is always OFF for Looped Chain Groups"); } else { var newLoop = EditorGUILayout.Toggle("Loop Clip", _variation.VarAudio.loop); if (newLoop != _variation.VarAudio.loop) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation.VarAudio, "toggle Loop"); _variation.VarAudio.loop = newLoop; } } EditorGUILayout.BeginHorizontal(); var newWeight = EditorGUILayout.IntSlider("Voices (Weight)", _variation.weight, 0, 100); DTGUIHelper.AddHelpIcon("http://www.dtdevtools.com/docs/masteraudio/SoundGroupVariations.htm#Voices"); EditorGUILayout.EndHorizontal(); if (newWeight != _variation.weight) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Voices (Weight)"); _variation.weight = newWeight; } var newFxTailTime = EditorGUILayout.Slider("FX Tail Time", _variation.fxTailTime, 0f, 10f); if (newFxTailTime != _variation.fxTailTime) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change FX Tail Time"); _variation.fxTailTime = newFxTailTime; } var filterList = new List <string>() { MasterAudio.NoGroupName, "Low Pass", "High Pass", "Distortion", "Chorus", "Echo", "Reverb" }; EditorGUILayout.BeginHorizontal(); var newFilterIndex = EditorGUILayout.Popup("Add Filter Effect", 0, filterList.ToArray()); DTGUIHelper.AddHelpIcon("http://www.dtdevtools.com/docs/masteraudio/FilterFX.htm"); EditorGUILayout.EndHorizontal(); switch (newFilterIndex) { case 1: AddFilterComponent(typeof(AudioLowPassFilter)); break; case 2: AddFilterComponent(typeof(AudioHighPassFilter)); break; case 3: AddFilterComponent(typeof(AudioDistortionFilter)); break; case 4: AddFilterComponent(typeof(AudioChorusFilter)); break; case 5: AddFilterComponent(typeof(AudioEchoFilter)); break; case 6: AddFilterComponent(typeof(AudioReverbFilter)); break; } DTGUIHelper.StartGroupHeader(); var newUseRndPitch = EditorGUILayout.BeginToggleGroup(" Use Random Pitch", _variation.useRandomPitch); if (newUseRndPitch != _variation.useRandomPitch) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Use Random Pitch"); _variation.useRandomPitch = newUseRndPitch; } DTGUIHelper.EndGroupHeader(); if (_variation.useRandomPitch) { var newMode = (SoundGroupVariation.RandomPitchMode)EditorGUILayout.EnumPopup("Pitch Compute Mode", _variation.randomPitchMode); if (newMode != _variation.randomPitchMode) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Pitch Compute Mode"); _variation.randomPitchMode = newMode; } var newPitchMin = DTGUIHelper.DisplayPitchField(_variation.randomPitchMin, "Random Pitch Min"); if (newPitchMin != _variation.randomPitchMin) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Random Pitch Min"); _variation.randomPitchMin = newPitchMin; if (_variation.randomPitchMax <= _variation.randomPitchMin) { _variation.randomPitchMax = _variation.randomPitchMin; } } var newPitchMax = DTGUIHelper.DisplayPitchField(_variation.randomPitchMax, "Random Pitch Max"); if (newPitchMax != _variation.randomPitchMax) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Random Pitch Max"); _variation.randomPitchMax = newPitchMax; if (_variation.randomPitchMin > _variation.randomPitchMax) { _variation.randomPitchMin = _variation.randomPitchMax; } } } EditorGUILayout.EndToggleGroup(); DTGUIHelper.AddSpaceForNonU5(2); DTGUIHelper.StartGroupHeader(); var newUseRndVol = EditorGUILayout.BeginToggleGroup(" Use Random Volume", _variation.useRandomVolume); if (newUseRndVol != _variation.useRandomVolume) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Use Random Volume"); _variation.useRandomVolume = newUseRndVol; } DTGUIHelper.EndGroupHeader(); if (_variation.useRandomVolume) { var newMode = (SoundGroupVariation.RandomVolumeMode)EditorGUILayout.EnumPopup("Volume Compute Mode", _variation.randomVolumeMode); if (newMode != _variation.randomVolumeMode) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Volume Compute Mode"); _variation.randomVolumeMode = newMode; } var volMin = 0f; if (_variation.randomVolumeMode == SoundGroupVariation.RandomVolumeMode.AddToClipVolume) { volMin = -1f; } var newVolMin = DTGUIHelper.DisplayVolumeField(_variation.randomVolumeMin, DTGUIHelper.VolumeFieldType.None, MasterAudio.MixerWidthMode.Normal, volMin, true, "Random Volume Min"); if (newVolMin != _variation.randomVolumeMin) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Random Volume Min"); _variation.randomVolumeMin = newVolMin; if (_variation.randomVolumeMax <= _variation.randomVolumeMin) { _variation.randomVolumeMax = _variation.randomVolumeMin; } } var newVolMax = DTGUIHelper.DisplayVolumeField(_variation.randomVolumeMax, DTGUIHelper.VolumeFieldType.None, MasterAudio.MixerWidthMode.Normal, volMin, true, "Random Volume Max"); if (newVolMax != _variation.randomVolumeMax) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Random Volume Max"); _variation.randomVolumeMax = newVolMax; if (_variation.randomVolumeMin > _variation.randomVolumeMax) { _variation.randomVolumeMin = _variation.randomVolumeMax; } } } EditorGUILayout.EndToggleGroup(); DTGUIHelper.AddSpaceForNonU5(2); DTGUIHelper.StartGroupHeader(); var newSilence = EditorGUILayout.BeginToggleGroup(" Use Random Delay", _variation.useIntroSilence); if (newSilence != _variation.useIntroSilence) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Use Random Delay"); _variation.useIntroSilence = newSilence; } DTGUIHelper.EndGroupHeader(); if (_variation.useIntroSilence) { var newSilenceMin = EditorGUILayout.Slider("Delay Min (sec)", _variation.introSilenceMin, 0f, 100f); if (newSilenceMin != _variation.introSilenceMin) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Delay Min (sec)"); _variation.introSilenceMin = newSilenceMin; if (_variation.introSilenceMin > _variation.introSilenceMax) { _variation.introSilenceMax = newSilenceMin; } } var newSilenceMax = EditorGUILayout.Slider("Delay Max (sec)", _variation.introSilenceMax, 0f, 100f); if (newSilenceMax != _variation.introSilenceMax) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Delay Max (sec)"); _variation.introSilenceMax = newSilenceMax; if (_variation.introSilenceMax < _variation.introSilenceMin) { _variation.introSilenceMin = newSilenceMax; } } } EditorGUILayout.EndToggleGroup(); DTGUIHelper.AddSpaceForNonU5(2); DTGUIHelper.StartGroupHeader(); var newStart = EditorGUILayout.BeginToggleGroup(" Use Random Start Position", _variation.useRandomStartTime); if (newStart != _variation.useRandomStartTime) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Use Random Start Position"); _variation.useRandomStartTime = newStart; } DTGUIHelper.EndGroupHeader(); if (_variation.useRandomStartTime) { var newMin = EditorGUILayout.Slider("Start Min (%)", _variation.randomStartMinPercent, 0f, 100f); if (newMin != _variation.randomStartMinPercent) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Start Min (%)"); _variation.randomStartMinPercent = newMin; if (_variation.randomStartMaxPercent <= _variation.randomStartMinPercent) { _variation.randomStartMaxPercent = _variation.randomStartMinPercent; } } var newMax = EditorGUILayout.Slider("Start Max (%)", _variation.randomStartMaxPercent, 0f, 100f); if (newMax != _variation.randomStartMaxPercent) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Start Max (%)"); _variation.randomStartMaxPercent = newMax; if (_variation.randomStartMinPercent > _variation.randomStartMaxPercent) { _variation.randomStartMinPercent = _variation.randomStartMaxPercent; } } } EditorGUILayout.EndToggleGroup(); DTGUIHelper.AddSpaceForNonU5(2); DTGUIHelper.StartGroupHeader(); var newUseFades = EditorGUILayout.BeginToggleGroup(" Use Custom Fading", _variation.useFades); if (newUseFades != _variation.useFades) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "toggle Use Custom Fading"); _variation.useFades = newUseFades; } DTGUIHelper.EndGroupHeader(); if (_variation.useFades) { var newFadeIn = EditorGUILayout.Slider("Fade In Time (sec)", _variation.fadeInTime, 0f, 10f); if (newFadeIn != _variation.fadeInTime) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Fade In Time"); _variation.fadeInTime = newFadeIn; } if (_variation.VarAudio.loop) { DTGUIHelper.ShowColorWarning("Looped clips cannot have a custom fade out."); } else { var newFadeOut = EditorGUILayout.Slider("Fade Out time (sec)", _variation.fadeOutTime, 0f, 10f); if (newFadeOut != _variation.fadeOutTime) { AudioUndoHelper.RecordObjectPropertyForUndo(ref isDirty, _variation, "change Fade Out Time"); _variation.fadeOutTime = newFadeOut; } } } EditorGUILayout.EndToggleGroup(); if (GUI.changed || isDirty) { EditorUtility.SetDirty(target); } //DrawDefaultInspector(); }
public override void Play(GameObject playerObject, clientSkin skin, bool[] effectInfo) { // Obtain the Nail Arts FSM from the Hero Controller var nailArts = HeroController.instance.gameObject.LocateMyFSM("Nail Arts"); // Get an audio source relative to the player var audioObject = AudioUtil.GetAudioSourceObject(playerObject); var audioSource = audioObject.GetComponent <AudioSource>(); // Get the audio clip of the Great Slash var dashSlashClip = (AudioClip)nailArts.GetAction <AudioPlay>("Dash Slash", 1).oneShotClip.Value; audioSource.PlayOneShot(dashSlashClip); Object.Destroy(audioObject, dashSlashClip.length); // Get the attacks gameObject from the player object var localPlayerAttacks = HeroController.instance.gameObject.FindGameObjectInChildren("Attacks"); var playerAttacks = playerObject.FindGameObjectInChildren("Attacks"); // Get the prefab for the Dash Slash and instantiate it relative to the remote player object var dashSlashObject = localPlayerAttacks.FindGameObjectInChildren("Dash Slash"); var dashSlash = Object.Instantiate( dashSlashObject, playerAttacks.transform ); dashSlash.SetActive(true); dashSlash.layer = 22; SkinManager.updateTextureInMaterialPropertyBlock(dashSlash, skin.Knight); // Remove audio source component that exists on the dash slash object Object.Destroy(dashSlash.GetComponent <AudioSource>()); // Set the newly instantiate collider to state Init, to reset it // in case the local player was already performing it dashSlash.LocateMyFSM("Control Collider").SetState("Init"); var damage = GameSettings.DashSlashDamage; if (GameSettings.IsPvpEnabled && ShouldDoDamage && damage != 0) { // Instantiate the Hive Knight Slash var dashSlashCollider = Object.Instantiate( HKMP.PreloadedObjects["HiveKnightSlash"], dashSlash.transform ); dashSlashCollider.SetActive(true); dashSlashCollider.layer = 22; // Copy over the polygon collider points dashSlashCollider.GetComponent <PolygonCollider2D>().points = dashSlash.GetComponent <PolygonCollider2D>().points; dashSlashCollider.GetComponent <DamageHero>().damageDealt = damage; } // Get the animator, figure out the duration of the animation and destroy the object accordingly afterwards var dashSlashAnimator = dashSlash.GetComponent <tk2dSpriteAnimator>(); var dashSlashAnimationDuration = dashSlashAnimator.DefaultClip.frames.Length / dashSlashAnimator.ClipFps; Object.Destroy(dashSlash, dashSlashAnimationDuration); }
protected IEnumerator Play(GameObject playerObject, clientSkin skin, string screamClipName, string screamObjectName, int damage) { var spellControl = HeroController.instance.spellControl; var audioObject = AudioUtil.GetAudioSourceObject(playerObject); var audioSource = audioObject.GetComponent <AudioSource>(); // Get the correct scream audio clip based on the given parameter var screamClip = (AudioClip)spellControl.GetAction <AudioPlay>(screamClipName, 1).oneShotClip.Value; // And play it audioSource.PlayOneShot(screamClip); // Destroy the audio object after the clip is done Object.Destroy(audioObject, screamClip.length); var localPlayerSpells = spellControl.gameObject; var playerSpells = playerObject.FindGameObjectInChildren("Spells"); // Get the correct scream heads object and spawn it relative to the remote player var scrHeadsObject = localPlayerSpells.FindGameObjectInChildren(screamObjectName); var screamHeads = Object.Instantiate( scrHeadsObject, playerSpells.transform ); screamHeads.SetActive(true); // We don't want to deactivate this when the local player is being hit Object.Destroy(screamHeads.LocateMyFSM("Deactivate on Hit")); // For each (L, R and U) of the scream objects, we need to do a few things var objectNames = new [] { "Hit L", "Hit R", "Hit U" }; // Also store a few objects that we need to destroy later var objectsToDestroy = new List <GameObject>(); foreach (var objectName in objectNames) { var screamHitObject = screamHeads.FindGameObjectInChildren(objectName); Object.Destroy(screamHitObject.LocateMyFSM("damages_enemy")); var screamHitDamager = Object.Instantiate( new GameObject(objectName), screamHitObject.transform ); screamHitDamager.layer = 22; // Add the object to the list to destroy it later objectsToDestroy.Add(screamHitDamager); // Create a new polygon collider var screamHitDamagerPoly = screamHitDamager.AddComponent <PolygonCollider2D>(); screamHitDamagerPoly.isTrigger = true; // Obtain the original polygon collider var screamHitPoly = screamHitObject.GetComponent <PolygonCollider2D>(); // Copy over the polygon collider points screamHitDamagerPoly.points = screamHitPoly.points; // If PvP is enabled, add a DamageHero component to the damager objects if (GameSettings.IsPvpEnabled && ShouldDoDamage && damage != 0) { screamHitDamager.AddComponent <DamageHero>().damageDealt = damage; } // Delete the original polygon collider, we don't need it anymore Object.Destroy(screamHitPoly); } // Wait for the duration of the scream animation var duration = playerObject.GetComponent <tk2dSpriteAnimator>().GetClipByName("Scream 2 Get") .Duration; yield return(new WaitForSeconds(duration)); // Then destroy the leftover objects Object.Destroy(screamHeads); foreach (var gameObject in objectsToDestroy) { Object.Destroy(gameObject); } }
private void InitMenu() { if (menuList != null) { if (mGameControler.tableInfo == null) { return; } // 更新换桌按钮是否可点击(正在游戏中不能点击) bool enabled = mGameControler.tableInfo.N < 2 || !PlayerInfoUtil.IsPlaying(mGameControler.selfInfo); btChangeTable.interactable = enabled; } else { menu = GameObject.Find("Menu"); menuList = GameObject.Find("MenuList"); cardBoardObj = GameObject.Find("cardBoard"); menuPos = menuList.transform.localPosition; boardPos = cardBoardObj.transform.localPosition; // 菜单按钮的点击实现 GameObject.Find("switch").GetComponent <Button>().onClick.AddListener(() => { // 播放声音 AudioUtil.Play(AudioUtil.Click); PopMenu(true); }); // 返回按钮的点击实现 GameObject.Find("back").GetComponent <Button>().onClick.AddListener(() => { if (mGameHandle != null) { // 播放声音 AudioUtil.Play(AudioUtil.Click); mGameHandle.RoomPlayerGoneReq(); Application.LoadLevel("main"); } }); // 换桌点击实现 btChangeTable = GameObject.Find("changeTable").GetComponent <Button>(); btChangeTable.onClick.AddListener(() => { if (!PlayerInfoUtil.IsPlaying(mGameControler.selfInfo)) { // 播放声音 AudioUtil.Play(AudioUtil.Click); PopMenu(false); // 隐藏换桌加载组件 mGameControler.SetChangeTableLoadingActive(true); mGameHandle.RoomPlayerChangeTableReq(); } }); // 站起点击实现 btStandUp = GameObject.Find("standUp").GetComponent <Button>(); btStandUp.onClick.AddListener(() => { if (mGameHandle != null && mGameControler.selfInfo.Pos > 0) { // 播放声音 AudioUtil.Play(AudioUtil.Click); mGameHandle.RoomPlayerStandupReq(); PopMenu(false); } }); GameObject.Find("cardType").GetComponent <Button>().onClick.AddListener(() => { // 播放声音 AudioUtil.Play(AudioUtil.Click); PopMenu(false); PopCardBoard(true); }); menuList.SetActive(false); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { Title = Title + (Environment.Is64BitProcess ? " (x64)" : " (x86)"); multiTrackViewer1.ItemsSource = trackList; // INIT COMMAND BINDINGS CommandBinding playBinding = new CommandBinding(MediaCommands.Play); CommandBindings.Add(playBinding); playBinding.CanExecute += new CanExecuteRoutedEventHandler(playCommandBinding_CanExecute); playBinding.Executed += new ExecutedRoutedEventHandler(playCommandBinding_Executed); CommandBinding pauseBinding = new CommandBinding(MediaCommands.Pause); CommandBindings.Add(pauseBinding); pauseBinding.CanExecute += new CanExecuteRoutedEventHandler(pauseCommandBinding_CanExecute); pauseBinding.Executed += new ExecutedRoutedEventHandler(pauseCommandBinding_Executed); CommandBinding playToggleBinding = new CommandBinding(Commands.PlayToggle); CommandBindings.Add(playToggleBinding); playToggleBinding.Executed += new ExecutedRoutedEventHandler(playToggleBinding_Executed); //// INIT TRACKLIST STUFF //trackList.PropertyChanged += delegate(object sender2, PropertyChangedEventArgs e2) { // if (e2.PropertyName == "TotalLength") { // multiTrackViewer1.VirtualViewportMaxWidth = trackList.TotalLength.Ticks; // } //}; // INIT PLAYER player = new MultitrackPlayer(trackList); player.VolumeAnnounced += Player_VolumeAnnounced_VolumeMeter; player.CurrentTimeChanged += new EventHandler <ValueEventArgs <TimeSpan> >( delegate(object sender2, ValueEventArgs <TimeSpan> e2) { multiTrackViewer1.Dispatcher.BeginInvoke((Action) delegate { multiTrackViewer1.VirtualCaretOffset = e2.Value.Ticks; // autoscroll if (multiTrackViewer1.VirtualViewportInterval.To <= multiTrackViewer1.VirtualCaretOffset) { multiTrackViewer1.VirtualViewportOffset = multiTrackViewer1.VirtualCaretOffset; } }); }); player.PlaybackStateChanged += new EventHandler( delegate(object sender2, EventArgs e2) { multiTrackViewer1.Dispatcher.BeginInvoke((Action) delegate { // CommandManager must be called on the GUI-thread, else it won't do anything CommandManager.InvalidateRequerySuggested(); }); }); volumeSlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>( delegate(object sender2, RoutedPropertyChangedEventArgs <double> e2) { player.Volume = (float)e2.NewValue; }); // INIT PROGRESSBAR progressBar1.IsEnabled = false; ProgressMonitor.GlobalInstance.ProcessingStarted += new EventHandler( delegate(object sender2, EventArgs e2) { progressBar1.Dispatcher.BeginInvoke((Action) delegate { progressBar1.IsEnabled = true; progressBar1Label.Text = ProgressMonitor.GlobalInstance.StatusMessage; win7TaskBar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Normal; win7TaskBar.ProgressValue = 0; }); }); ProgressMonitor.GlobalInstance.ProcessingProgressChanged += new EventHandler <ValueEventArgs <float> >( delegate(object sender2, ValueEventArgs <float> e2) { progressBar1.Dispatcher.BeginInvoke((Action) delegate { progressBar1.Value = e2.Value; win7TaskBar.ProgressValue = e2.Value / 100; progressBar1Label.Text = ProgressMonitor.GlobalInstance.StatusMessage; }); }); ProgressMonitor.GlobalInstance.ProcessingFinished += new EventHandler( delegate(object sender2, EventArgs e2) { progressBar1.Dispatcher.BeginInvoke((Action) delegate { progressBar1.Value = 0; progressBar1.IsEnabled = false; progressBar1Label.Text = ""; win7TaskBar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None; }); }); // INIT RANDOM STUFF multiTrackViewer1.KeyUp += new KeyEventHandler(delegate(object sender2, KeyEventArgs e2) { if (e2.Key == Key.Delete) { // create temporary list to avoid concurrent modification exception var selectedAudioTracks = new List <AudioTrack>(multiTrackViewer1.SelectedItems.Cast <AudioTrack>()); // delete tracks foreach (AudioTrack audioTrack in selectedAudioTracks) { if (audioTrack != null) { // 1. delete all related matches List <Match> deleteList = new List <Match>(); // 1a find all related matches foreach (Match m in multiTrackViewer1.Matches) { if (m.Track1 == audioTrack || m.Track2 == audioTrack) { deleteList.Add(m); } } // 1b delete foreach (Match m in deleteList) { multiTrackViewer1.Matches.Remove(m); } // 2. delete track trackList.Remove(audioTrack); } } e2.Handled = true; } }); // INIT FFT int fftSize = 1024; double correlation = 0; fftAnalyzer = new FFTAnalyzer(fftSize); fftAnalyzerConsumer = 2; correlationConsumer = 1; WindowFunction fftWindow = WindowUtil.GetFunction(WindowType.BlackmanHarris, fftSize); fftAnalyzer.WindowFunction = fftWindow; fftAnalyzer.WindowAnalyzed += FftAnalyzer_WindowAnalyzed_FrequencyGraph; fftAnalyzer.WindowAnalyzed += FftAnalyzer_WindowAnalyzed_Spectrogram; player.SamplesMonitored += new EventHandler <StreamDataMonitorEventArgs>(delegate(object sender2, StreamDataMonitorEventArgs e2) { if (fftAnalyzerConsumer > 0 || correlationConsumer > 0) { float[][] uninterleaved = AudioUtil.Uninterleave(e2.Properties, e2.Buffer, e2.Offset, e2.Length, true); if (fftAnalyzerConsumer > 0) { fftAnalyzer.PutSamples(uninterleaved[0]); // put the summed up mono samples into the analyzer } if (correlationConsumer > 0) { correlation = CrossCorrelation.Correlate(uninterleaved[1], uninterleaved[2]); Dispatcher.BeginInvoke((Action) delegate { correlationMeter.Value = correlation; }); } } }); spectrogram.SpectrogramSize = fftSize / 2; }
private IEnumerator PlayAnimation(GameObject playerObject, string chargeStateName, int chargeEffectIndex) { // Get the Superdash FSM from the HeroController var superDashFsm = HeroController.instance.gameObject.LocateMyFSM("Superdash"); // Check whether the player already has a superdash charge audio object var chargeAudioObject = playerObject.FindGameObjectInChildren("Superdash Charge Audio"); if (chargeAudioObject == null) { // There is not object yet, so we create one by finding the clip in the FSM var chargeAudioPlay = superDashFsm.GetAction <AudioPlay>("Ground Charge", 3); var chargeAudioSource = chargeAudioPlay.gameObject.GameObject.Value.GetComponent <AudioSource>(); // Create a fresh AudioSource object chargeAudioObject = AudioUtil.GetAudioSourceObject(playerObject); chargeAudioObject.name = "Superdash Charge Audio"; // Copy over the audio clip chargeAudioObject.GetComponent <AudioSource>().clip = chargeAudioSource.clip; } // Play the charge sound chargeAudioObject.GetComponent <AudioSource>().Play(); var playerEffects = playerObject.FindGameObjectInChildren("Effects"); // Find the charge effect, which is the circular vortex motion around the knight when he charges var chargeEffectObject = superDashFsm.GetAction <SetMeshRenderer>(chargeStateName, chargeEffectIndex); var chargeEffect = Object.Instantiate( chargeEffectObject.gameObject.GameObject.Value, playerEffects.transform ); // Assign a name, so we can reference it later chargeEffect.name = "Charge Effect"; chargeEffect.GetComponent <MeshRenderer>().enabled = true; // Make sure it plays the animation var chargeSpriteAnimator = chargeEffect.GetComponent <tk2dSpriteAnimator>(); chargeSpriteAnimator.PlayFromFrame("SD Fx Charge", 0); // Destroy it after the duration of the animation is over Object.Destroy(chargeEffect, chargeSpriteAnimator.GetClipByName("SD Fx Charge").Duration); // Wait for the duration of the crystal dash charge yield return(new WaitForSeconds(0.8f)); // Find the bling effect in the FSM and instantiate it var blingEffectObject = superDashFsm.GetAction <ActivateGameObject>("Ground Charged", 4); var blingEffect = Object.Instantiate( blingEffectObject.gameObject.GameObject.Value, playerEffects.transform ); blingEffect.SetActive(true); // It's a short effect, so we can destroy it quickly Object.Destroy(blingEffect, 1.0f); // We are done, so we can cancel the coroutine playerObject.GetComponent <CoroutineCancelComponent>().CancelCoroutine("Crystal Dash Charge"); }
void checkMute(AudioFile file, AudioSource source) { source.mute = AudioUtil.IsMuted(file.Type); }
public override void Play(GameObject playerObject, bool[] effectInfo) { // Get the player attacks object var playerAttacks = playerObject.FindGameObjectInChildren("Attacks"); // If the art charge object exists, destroy it var artCharge = playerAttacks.FindGameObjectInChildren("Nail Art Charge"); if (artCharge != null) { Object.Destroy(artCharge); } // If we already have a charge effect, we skip creating another one if (playerAttacks.FindGameObjectInChildren("Nail Art Charged") != null) { return; } // Create a new art charged object from the prefab in the hero controller var artChargedObject = HeroController.instance.artChargedEffect; var artCharged = Object.Instantiate( artChargedObject, playerAttacks.transform ); // Give it a name, so we can reference it when it needs to be destroyed artCharged.name = "Nail Art Charged"; // Set is to active to activate the animation artCharged.SetActive(true); // Also play the animation artCharged.GetComponent <tk2dSpriteAnimator>().PlayFromFrame(0); // Create a new art charge flash object var artChargedFlashObject = HeroController.instance.artChargedFlash; var artChargedFlash = Object.Instantiate( artChargedFlashObject, playerAttacks.transform ); // Give it a name, so we can reference it when it needs to be destroyed artChargedFlash.name = "Nail Art Charged Flash"; // Set is to active to activate the flash artChargedFlash.SetActive(true); // Get a new audio source object relative to the player object var artChargedAudioObject = AudioUtil.GetAudioSourceObject(playerAttacks); // Again give a name, so we can destroy it later artChargedAudioObject.name = "Nail Art Charged Audio"; // Get the actual audio source var artChargedAudioSource = artChargedAudioObject.GetComponent <AudioSource>(); // Get the nail art ready clip and play it var heroAudioController = HeroController.instance.GetComponent <HeroAudioController>(); artChargedAudioSource.clip = heroAudioController.nailArtReady.clip; artChargedAudioSource.Play(); // Also play the one shot clip of the nail art charge complete clip artChargedAudioSource.PlayOneShot(HeroController.instance.nailArtChargeComplete); }
private IEnumerator PlayEffectInCoroutine(GameObject playerObject) { var spellControl = HeroController.instance.spellControl; // Get an audio source var audioObject = AudioUtil.GetAudioSourceObject(playerObject); var audioSource = audioObject.GetComponent <AudioSource>(); // Find the land clip and play it var q2LandClip = (AudioClip)spellControl.GetAction <AudioPlay>("Q2 Land", 1).oneShotClip.Value; audioSource.PlayOneShot(q2LandClip); // Destroy the audio object after the clip is done Object.Destroy(audioObject, q2LandClip.length); var localPlayerSpells = spellControl.gameObject; var playerSpells = playerObject.FindGameObjectInChildren("Spells"); // Destroy the existing Q Trail from the down effect Object.Destroy(playerSpells.FindGameObjectInChildren("Q Trail 2")); // Obtain the Q Slam prefab and instantiate it relative to the player object // This is the shockwave that happens when you impact the ground, // slightly larger than the Desolate Dive one var qSlamObject = localPlayerSpells.FindGameObjectInChildren("Q Slam 2"); var quakeSlam = Object.Instantiate( qSlamObject, playerSpells.transform ); quakeSlam.SetActive(true); quakeSlam.layer = 22; // If PvP is enabled add a DamageHero component to both hitbox sides var damage = GameSettings.DescendingDarkDamage; if (GameSettings.IsPvpEnabled && ShouldDoDamage && damage != 0) { quakeSlam.FindGameObjectInChildren("Hit L").AddComponent <DamageHero>().damageDealt = damage; quakeSlam.FindGameObjectInChildren("Hit R").AddComponent <DamageHero>().damageDealt = damage; } // The FSM has a Wait action of 0.75 as a fallback for when the animationTrigger is not called. // It should be called at the 8th frame in the animation, which at 20 fps means 8/20 = 0.4s yield return(new WaitForSeconds(0.4f)); // Obtain the Q Pillar prefab and instantiate it relative to the player object // This is the void-looking column when you impact the ground var qPillarObject = localPlayerSpells.FindGameObjectInChildren("Q Pillar"); var quakePillar = Object.Instantiate( qPillarObject, playerSpells.transform ); quakePillar.SetActive(true); // Obtain the Q Mega prefab and instantiate it relative to the player object // This is the void tornado like effect around the knight when you impact the ground var qMegaObject = localPlayerSpells.FindGameObjectInChildren("Q Mega"); var qMega = Object.Instantiate( qMegaObject, playerSpells.transform ); qMega.SetActive(true); // Play the Q Mega animation from the first frame qMega.GetComponent <tk2dSpriteAnimator>().PlayFromFrame(0); // Enable the correct layer var qMegaHitL = qMega.FindGameObjectInChildren("Hit L"); qMegaHitL.layer = 22; var qMegaHitR = qMega.FindGameObjectInChildren("Hit R"); qMegaHitR.layer = 22; if (GameSettings.IsPvpEnabled && ShouldDoDamage && damage != 0) { qMegaHitL.AddComponent <DamageHero>().damageDealt = damage; qMegaHitR.AddComponent <DamageHero>().damageDealt = damage; } // Wait a second yield return(new WaitForSeconds(1.0f)); // And then destroy the remaining objects from the effect Object.Destroy(quakeSlam); Object.Destroy(quakePillar); Object.Destroy(qMega); }
/// <summary> /// Plays the dash animation for the given player object with the given effect info and booleans /// denoting what kind of dash it is. /// </summary> /// <param name="playerObject">The GameObject representing the player.</param> /// <param name="effectInfo">A boolean array containing effect info.</param> /// <param name="shadowDash">Whether this dash is a shadow dash.</param> /// <param name="sharpShadow">Whether this dash is a sharp shadow dash.</param> /// <param name="dashDown">Whether this is a downwards dash.</param> protected void Play(GameObject playerObject, bool[] effectInfo, bool shadowDash, bool sharpShadow, bool dashDown) { // Obtain the dash audio clip var heroAudioController = HeroController.instance.gameObject.GetComponent <HeroAudioController>(); var dashAudioClip = heroAudioController.dash.clip; // Get a new audio source and play the clip var dashAudioSourceObject = AudioUtil.GetAudioSourceObject(playerObject); var dashAudioSource = dashAudioSourceObject.GetComponent <AudioSource>(); dashAudioSource.clip = dashAudioClip; dashAudioSource.Play(); // Destroy the audio object after the clip is finished Object.Destroy(dashAudioSourceObject, dashAudioClip.length); var playerEffects = playerObject.FindGameObjectInChildren("Effects"); // Store the transform and scale, because we need it later var playerTransform = playerObject.transform; var playerScale = playerTransform.localScale; // Check whether we are shadow dashing, because the animations differ quite a lot if (shadowDash) { // Get a fresh audio object var shadowDashAudioSourceObject = AudioUtil.GetAudioSourceObject(playerObject); var shadowDashAudioSource = shadowDashAudioSourceObject.GetComponent <AudioSource>(); // Based on the sharp shadow charm, we set the correct clip shadowDashAudioSource.clip = sharpShadow ? HeroController.instance.sharpShadowClip : HeroController.instance.shadowDashClip; // And play the clip shadowDashAudioSource.Play(); // Destroy the object after the clip is finished Object.Destroy(shadowDashAudioSourceObject, shadowDashAudioSource.clip.length); Vector3 spawnPosition; // Adjust the position based on whether we are dashing downwards if (dashDown) { spawnPosition = new Vector3( 0f, 3.5f, 0.00101f ); } else { spawnPosition = new Vector3( playerScale.x > 0 ? 5.21f : -5.21f, -0.58f, 0.00101f ); } // Instantiate the dash effect relative to the player position var dashEffectPrefab = HeroController.instance.shadowdashBurstPrefab; var dashEffect = Object.Instantiate(dashEffectPrefab); Transform dashEffectTransform = dashEffect.transform; dashEffectTransform.position = playerTransform.position + spawnPosition; dashEffectTransform.rotation = playerTransform.rotation; dashEffectTransform.localScale = playerTransform.localScale; dashEffect.SetActive(true); Object.Destroy(dashEffect, 1.0f); if (dashDown) { // If we are performing a down dash, rotate the effect dashEffect.transform.localEulerAngles = new Vector3(0f, 0f, 270f); } else { // Set the scale based on the direction the player is facing var dashEffectScale = dashEffect.transform.localScale; dashEffect.transform.localScale = new Vector3( playerScale.x > 0 ? 1.919591f : -1.919591f, dashEffectScale.y, dashEffectScale.z ); } // Find the shadow dash particles in player effects, or create them // These are the dark blobs that show in a trail behind the dash of the knight var dashParticlesPrefab = HeroController.instance.shadowdashParticlesPrefab; var dashParticles = Object.Instantiate( dashParticlesPrefab, playerEffects.transform ); // Give them a name, so we can reference them dashParticles.name = "Shadow Dash Particles"; // Enable particle system emission, so the particles spawn #pragma warning disable 0618 dashParticles.GetComponent <ParticleSystem>().enableEmission = true; #pragma warning restore 0618 // As a failsafe, destroy them after 1.5 seconds Object.Destroy(dashParticles, 1.5f); // Spawn a shadow ring // This is the circle that quickly expands from the starting location of the dash HeroController.instance.shadowRingPrefab.Spawn(playerEffects.transform); // Start a coroutine with the recharge animation, since we need to wait in it MonoBehaviourUtil.Instance.StartCoroutine(PlayRechargeAnimation(playerObject, playerEffects)); // Lastly, disable the player collider, since we are in a shadow dash // We only do this, if we don't have sharp shadow if (!sharpShadow) { playerObject.GetComponent <BoxCollider2D>().enabled = false; } } else { // Instantiate the dash burst relative to the player effects var dashBurstObject = HeroController.instance.dashBurst.gameObject; var dashBurst = Object.Instantiate( dashBurstObject, playerEffects.transform ); // Destroy the original FSM to prevent it from taking control of the animation Object.Destroy(dashBurst.LocateMyFSM("Effect Control")); dashBurst.SetActive(true); var dashBurstTransform = dashBurst.transform; // Set the position and rotation of the dash burst // These are all values from the HeroController HeroDash method if (dashDown) { dashBurstTransform.localPosition = new Vector3(-0.07f, 3.74f, 0.01f); dashBurstTransform.localEulerAngles = new Vector3(0f, 0f, 90f); } else { dashBurstTransform.localPosition = new Vector3(4.11f, -0.55f, 0.001f); dashBurstTransform.localEulerAngles = new Vector3(0f, 0f, 0f); } // Enable the mesh renderer dashBurst.GetComponent <MeshRenderer>().enabled = true; // Get the sprite animator and play the dash effect clip var dashBurstAnimator = dashBurst.GetComponent <tk2dSpriteAnimator>(); dashBurstAnimator.Play("Dash Effect"); // Destroy the object after the clip is finished Object.Destroy(dashBurst, dashBurstAnimator.GetClipByName("Dash Effect").Duration); // Find already existing dash particles object, or create a new one var dashParticlesPrefab = HeroController.instance.dashParticlesPrefab; var dashParticles = Object.Instantiate( dashParticlesPrefab, playerEffects.transform ); // Give it a name, so we can reference it later dashParticles.name = "Dash Particles"; // Start emitting the smoke cloud particles in the trail of the knight dash #pragma warning disable 0618 dashParticles.GetComponent <ParticleSystem>().enableEmission = true; #pragma warning restore 0618 // As a failsafe, destroy them after 0.75 seconds Object.Destroy(dashParticles, 0.75f); // If we are on the ground, we also spawn the dust cloud facing away from the knight if (effectInfo[0]) { var backDashEffect = HeroController.instance.backDashPrefab.Spawn( playerObject.transform.position ); backDashEffect.transform.localScale = new Vector3( playerScale.x * -1f, playerScale.y, playerScale.z ); } } }
private void Button_Read_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); ReadHeistCutData(); }
protected override void OnFrameRead(float[] frame) { currentFrameRMS = AudioUtil.CalculateRMS(frame); }
/// <summary> /// 写入抢劫任务相关数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Write_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); try { if (TextBox_Cayo_Player1.Text != "" && TextBox_Cayo_Player2.Text != "" && TextBox_Cayo_Player3.Text != "" && TextBox_Cayo_Player4.Text != "" && TextBox_Cayo_Tequila.Text != "" && TextBox_Cayo_RubyNecklace.Text != "" && TextBox_Cayo_BearerBonds.Text != "" && TextBox_Cayo_PinkDiamond.Text != "" && TextBox_Cayo_MadrazoFiles.Text != "" && TextBox_Cayo_BlackPanther.Text != "" && TextBox_Cayo_LocalBagSize.Text != "" && TextBox_Cayo_FencingFee.Text != "" && TextBox_Cayo_PavelCut.Text != "" && TextBox_Casino_Player1.Text != "" && TextBox_Casino_Player2.Text != "" && TextBox_Casino_Player3.Text != "" && TextBox_Casino_Player4.Text != "" && TextBox_Casino_Lester.Text != "" && TextBox_CasinoPotential_Money.Text != "" && TextBox_CasinoPotential_Artwork.Text != "" && TextBox_CasinoPotential_Gold.Text != "" && TextBox_CasinoPotential_Diamonds.Text != "" && TextBox_CasinoAI_1.Text != "" && TextBox_CasinoAI_2.Text != "" && TextBox_CasinoAI_3.Text != "" && TextBox_CasinoAI_4.Text != "" && TextBox_CasinoAI_5.Text != "" && TextBox_CasinoAI_6.Text != "" && TextBox_CasinoAI_7.Text != "" && TextBox_CasinoAI_8.Text != "" && TextBox_CasinoAI_9.Text != "" && TextBox_CasinoAI_10.Text != "" && TextBox_CasinoAI_11.Text != "" && TextBox_CasinoAI_12.Text != "" && TextBox_CasinoAI_13.Text != "" && TextBox_CasinoAI_14.Text != "" && TextBox_CasinoAI_15.Text != "" && TextBox_Doomsday_Player1.Text != "" && TextBox_Doomsday_Player2.Text != "" && TextBox_Doomsday_Player3.Text != "" && TextBox_Doomsday_Player4.Text != "" && TextBox_Doomsday_ActI.Text != "" && TextBox_Doomsday_ActII.Text != "" && TextBox_Doomsday_ActIII.Text != "" && TextBox_Apart_Player1.Text != "" && TextBox_Apart_Player2.Text != "" && TextBox_Apart_Player3.Text != "" && TextBox_Apart_Player4.Text != "" && TextBox_Apart_Fleeca.Text != "" && TextBox_Apart_PrisonBreak.Text != "" && TextBox_Apart_HumaneLabs.Text != "" && TextBox_Apart_SeriesA.Text != "" && TextBox_Apart_PacificStandard.Text != "") { // 佩里克岛抢劫玩家分红比例 Hacks.WriteGA <int>(1973321 + 823 + 56 + 1, Convert.ToInt32(TextBox_Cayo_Player1.Text)); Hacks.WriteGA <int>(1973321 + 823 + 56 + 2, Convert.ToInt32(TextBox_Cayo_Player2.Text)); Hacks.WriteGA <int>(1973321 + 823 + 56 + 3, Convert.ToInt32(TextBox_Cayo_Player3.Text)); Hacks.WriteGA <int>(1973321 + 823 + 56 + 4, Convert.ToInt32(TextBox_Cayo_Player4.Text)); Hacks.WriteGA <int>(262145 + 29970, Convert.ToInt32(TextBox_Cayo_Tequila.Text)); Hacks.WriteGA <int>(262145 + 29971, Convert.ToInt32(TextBox_Cayo_RubyNecklace.Text)); Hacks.WriteGA <int>(262145 + 29972, Convert.ToInt32(TextBox_Cayo_BearerBonds.Text)); Hacks.WriteGA <int>(262145 + 29973, Convert.ToInt32(TextBox_Cayo_PinkDiamond.Text)); Hacks.WriteGA <int>(262145 + 29974, Convert.ToInt32(TextBox_Cayo_MadrazoFiles.Text)); Hacks.WriteGA <int>(262145 + 29975, Convert.ToInt32(TextBox_Cayo_BlackPanther.Text)); Hacks.WriteGA <int>(262145 + 29720, Convert.ToInt32(TextBox_Cayo_LocalBagSize.Text)); Hacks.WriteGA <float>(262145 + 29979, Convert.ToSingle(TextBox_Cayo_FencingFee.Text)); Hacks.WriteGA <float>(262145 + 29980, Convert.ToSingle(TextBox_Cayo_PavelCut.Text)); ////////////////////////////////////////////////////////////////////////////////// // 赌场抢劫玩家分红比例 Hacks.WriteGA <int>(1966534 + 1497 + 736 + 92 + 1, Convert.ToInt32(TextBox_Casino_Player1.Text)); Hacks.WriteGA <int>(1966534 + 1497 + 736 + 92 + 2, Convert.ToInt32(TextBox_Casino_Player2.Text)); Hacks.WriteGA <int>(1966534 + 1497 + 736 + 92 + 3, Convert.ToInt32(TextBox_Casino_Player3.Text)); Hacks.WriteGA <int>(1966534 + 1497 + 736 + 92 + 4, Convert.ToInt32(TextBox_Casino_Player4.Text)); Hacks.WriteGA <int>(262145 + 28779, Convert.ToInt32(TextBox_Casino_Lester.Text)); Hacks.WriteGA <int>(262145 + 28793, Convert.ToInt32(TextBox_CasinoPotential_Money.Text)); Hacks.WriteGA <int>(262145 + 28794, Convert.ToInt32(TextBox_CasinoPotential_Artwork.Text)); Hacks.WriteGA <int>(262145 + 28795, Convert.ToInt32(TextBox_CasinoPotential_Gold.Text)); Hacks.WriteGA <int>(262145 + 28796, Convert.ToInt32(TextBox_CasinoPotential_Diamonds.Text)); Hacks.WriteGA <int>(262145 + 28804 + 1, Convert.ToInt32(TextBox_CasinoAI_1.Text)); Hacks.WriteGA <int>(262145 + 28804 + 2, Convert.ToInt32(TextBox_CasinoAI_2.Text)); Hacks.WriteGA <int>(262145 + 28804 + 3, Convert.ToInt32(TextBox_CasinoAI_3.Text)); Hacks.WriteGA <int>(262145 + 28804 + 4, Convert.ToInt32(TextBox_CasinoAI_4.Text)); Hacks.WriteGA <int>(262145 + 28804 + 5, Convert.ToInt32(TextBox_CasinoAI_5.Text)); Hacks.WriteGA <int>(262145 + 28804 + 6, Convert.ToInt32(TextBox_CasinoAI_6.Text)); Hacks.WriteGA <int>(262145 + 28804 + 7, Convert.ToInt32(TextBox_CasinoAI_7.Text)); Hacks.WriteGA <int>(262145 + 28804 + 8, Convert.ToInt32(TextBox_CasinoAI_8.Text)); Hacks.WriteGA <int>(262145 + 28804 + 9, Convert.ToInt32(TextBox_CasinoAI_9.Text)); Hacks.WriteGA <int>(262145 + 28804 + 10, Convert.ToInt32(TextBox_CasinoAI_10.Text)); Hacks.WriteGA <int>(262145 + 28804 + 11, Convert.ToInt32(TextBox_CasinoAI_11.Text)); Hacks.WriteGA <int>(262145 + 28804 + 12, Convert.ToInt32(TextBox_CasinoAI_12.Text)); Hacks.WriteGA <int>(262145 + 28804 + 13, Convert.ToInt32(TextBox_CasinoAI_13.Text)); Hacks.WriteGA <int>(262145 + 28804 + 14, Convert.ToInt32(TextBox_CasinoAI_14.Text)); Hacks.WriteGA <int>(262145 + 28804 + 15, Convert.ToInt32(TextBox_CasinoAI_15.Text)); ////////////////////////////////////////////////////////////////////////////////// // 末日抢劫玩家分红比例 Hacks.WriteGA <int>(1962546 + 812 + 50 + 1, Convert.ToInt32(TextBox_Doomsday_Player1.Text)); Hacks.WriteGA <int>(1962546 + 812 + 50 + 2, Convert.ToInt32(TextBox_Doomsday_Player2.Text)); Hacks.WriteGA <int>(1962546 + 812 + 50 + 3, Convert.ToInt32(TextBox_Doomsday_Player3.Text)); Hacks.WriteGA <int>(1962546 + 812 + 50 + 4, Convert.ToInt32(TextBox_Doomsday_Player4.Text)); Hacks.WriteGA <int>(262145 + 9132, Convert.ToInt32(TextBox_Doomsday_ActI.Text)); Hacks.WriteGA <int>(262145 + 9133, Convert.ToInt32(TextBox_Doomsday_ActII.Text)); Hacks.WriteGA <int>(262145 + 9134, Convert.ToInt32(TextBox_Doomsday_ActIII.Text)); ////////////////////////////////////////////////////////////////////////////////// // 公寓抢劫玩家分红比例 Hacks.WriteGA <int>(1933908 + 3008 + 1, Convert.ToInt32(TextBox_Apart_Player1.Text)); Hacks.WriteGA <int>(1933908 + 3008 + 2, Convert.ToInt32(TextBox_Apart_Player2.Text)); Hacks.WriteGA <int>(1933908 + 3008 + 3, Convert.ToInt32(TextBox_Apart_Player3.Text)); Hacks.WriteGA <int>(1933908 + 3008 + 4, Convert.ToInt32(TextBox_Apart_Player4.Text)); Hacks.WriteGA <int>(262145 + 9127, Convert.ToInt32(TextBox_Apart_Fleeca.Text)); Hacks.WriteGA <int>(262145 + 9128, Convert.ToInt32(TextBox_Apart_PrisonBreak.Text)); Hacks.WriteGA <int>(262145 + 9129, Convert.ToInt32(TextBox_Apart_HumaneLabs.Text)); Hacks.WriteGA <int>(262145 + 9130, Convert.ToInt32(TextBox_Apart_SeriesA.Text)); Hacks.WriteGA <int>(262145 + 9131, Convert.ToInt32(TextBox_Apart_PacificStandard.Text)); TextBox_Result.Text = $"数据写入成功"; } else { MessageBox.Show("部分数据写入时为空,请检查后重新写入", "警告", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { MsgBoxUtil.Exception(ex); } }