/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void importButton_Click(object sender, System.EventArgs e) { using (OpenFileDialog d = new OpenFileDialog()) { d.Filter = Tools.DSPExtensions.SupportedImportFormatFilter; if (d.ShowDialog() == DialogResult.OK) { var newFileName = Path.GetFileNameWithoutExtension(d.FileName) + ".hps"; var newFilePath = "audio\\" + newFileName; if (MEX.ImageResource.FileExists(newFilePath)) { MessageBox.Show("A file with that name already exists"); } else { var temp = Path.GetTempFileName(); var dsp = Tools.DSPExtensions.FromFile(d.FileName); HPS.SaveDSPAsHPS(dsp, temp); MEX.ImageResource.AddFile(newFilePath, temp); MEX.BackgroundMusic.Add(new MEXMusic() { FileName = newFileName, Label = Path.GetFileNameWithoutExtension(d.FileName) }); } } } }
void Start() { foreach (UIBarScript HPS in HPScriptList) { HPS.UpdateValue(50, 100); } }
// Update is called once per frame void UpdateBar() { //get the string in the input boxes //convert to int int HP = 1; int MaxHP = 23; //for every UIScript_HP update it. foreach (UIBarScript HPS in HPScriptList) { HPS.UpdateValue(HP, MaxHP); } }
void Update() { if (golpes >= 3) { PlayerPrefs.SetInt("life", life); PlayerPrefs.SetInt("lifeE", lifeEnemy); int temp = Random.Range(11, 13); PlayerPrefs.SetInt("scene", Application.loadedLevel); Application.LoadLevel(temp); } if (life <= 0) { PlayerPrefs.SetInt("scene", Application.loadedLevel); Application.LoadLevel("GameOver"); } if (lifeEnemy <= 0) { PlayerPrefs.SetInt("scene", Application.loadedLevel); Application.LoadLevel("fimGeral"); } idleBlue.GetComponent <Animator>().SetInteger("teste", 0); idleRed.GetComponent <Animator>().SetInteger("teste", 0); if (Input.anyKeyDown) { if (barra.gameObject.transform.position.x >= limite.gameObject.transform.position.x - 20 && barra.gameObject.transform.position.x <= limite.gameObject.transform.position.x + 46) { lifeEnemy -= 10; golpes++; idleBlue.GetComponent <Animator>().SetInteger("teste", Random.Range(1, 3)); idleRed.GetComponent <Animator>().SetInteger("teste", 1); foreach (UIBarScript HPS in HPScriptList) { HPS.UpdateValue(lifeEnemy, 100); } } else { life -= 10; idleRed.GetComponent <Animator>().SetInteger("teste", Random.Range(2, 4)); idleBlue.GetComponent <Animator>().SetInteger("teste", 3); foreach (UIBarScript HPS in HPScriptListPlayer) { HPS.UpdateValue(life, 100); } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonExport_Click(object sender, System.EventArgs e) { if (mxListBox1.SelectedItem is MEXMusic music) { using (SaveFileDialog d = new SaveFileDialog()) { d.Filter = DSP.SupportedExportFilter; if (d.ShowDialog() == DialogResult.OK) { var data = MEX.ImageResource.GetFile("audio\\" + music.FileName); HPS.ToDSP(data).ExportFormat(d.FileName); } } } }
// Update is called once per frame void UpdateBar() { //get the string in the input boxes string StrHP = gameObject.transform.FindChild("HP").gameObject.GetComponent <InputField>().text; string StrMaxHP = gameObject.transform.FindChild("MaxHP").gameObject.GetComponent <InputField>().text; //convert to int int HP = int.Parse(StrHP); int MaxHP = int.Parse(StrMaxHP); //for every UIScript_HP update it. foreach (UIBarScript HPS in HPScriptList) { HPS.UpdateValue(HP, MaxHP); } }
void Start() { if (PlayerPrefs.GetInt("lifeE") != 100) { lifeEnemy = PlayerPrefs.GetInt("lifeE"); foreach (UIBarScript HPS in HPScriptList) { HPS.UpdateValue(lifeEnemy, 100); } } if (PlayerPrefs.GetInt("life") != 100) { life = PlayerPrefs.GetInt("life"); foreach (UIBarScript HPS in HPScriptListPlayer) { HPS.UpdateValue(life, 100); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void replaceButton_Click(object sender, System.EventArgs e) { if (mxListBox1.SelectedItem is MEXMusic music) { using (OpenFileDialog d = new OpenFileDialog()) { d.Filter = DSP.SupportedImportFilter; if (d.ShowDialog() == DialogResult.OK) { var temp = Path.GetTempFileName(); var dsp = new DSP(d.FileName); HPS.SaveDSPAsHPS(dsp, temp); MEX.ImageResource.AddFile("audio\\" + music.FileName, temp); } } } }
/// <summary> /// /// </summary> /// <param name="entry"></param> private void AddEditor(MEXPlaylistEntry entry) { var panel = new PlaylistEntry(entry); panel.Dock = DockStyle.Top; // self deletion panel.Deleted += (sender, args) => { if (sender is PlaylistEntry e) { panel1.Controls.Remove(e); e.Dispose(); _playList.Entries.Remove(e.Entry); } }; panel.Played += (sender, args) => { if (_player.IsPlaying) { _player.Stop(); } else { var music = ((PlaylistEntry)sender).SelectedMusic; var data = MEX.ImageResource.GetFile("audio\\" + music.FileName); if (data != null) { _player.Stop(); _player.LoadDSP(HPS.ToDSP(data), ApplicationSettings.DefaultDevice); _player.Position = TimeSpan.Zero; _player.Play(); } } }; panel1.Controls.Add(panel); panel.BringToFront(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mxListBox1_SelectedObjectChanged(object sender, System.EventArgs e) { if (mxListBox1.SelectedItem is MEXMusic music) { var data = MEX.ImageResource.GetFile("audio\\" + music.FileName); if (data != null) { soundPlayer.NowPlaying = music.ToString(); soundPlayer.DSP = HPS.ToDSP(data); } else { soundPlayer.NowPlaying = ""; soundPlayer.DSP = null; } if (mxPropertyGrid1 != null) { mxPropertyGrid1.SelectedObject = music; } } }
public override Dictionary <string, string> GetCharacterDisplayCalculationValues() { Dictionary <string, string> dict = new Dictionary <string, string>(); dict["Miss"] = Miss.ToString("P2") + "*" + SEStats.Miss.ToString("P2") + " after special effects"; dict["Dodge"] = Dodge.ToString("P2") + " : " + BasicStats.DodgeRating.ToString("F0") + "*" + SEStats.DodgeRating.ToString("F0") + " Rating - " + SEStats.Dodge.ToString("P2") + " after special effects"; dict["Parry"] = Parry.ToString("P2") + " : " + BasicStats.ParryRating.ToString("F0") + "*" + SEStats.ParryRating.ToString("F0") + " Rating - " + SEStats.Parry.ToString("P2") + " after special effects"; dict["Armor Damage Reduction"] = ArmorDamageReduction.ToString("P2"); dict["Magic Damage Reduction"] = MagicDamageReduction.ToString("P2") + string.Format("*Arcane: {0:0}\r\n", BasicStats.ArcaneResistance) + string.Format("Fire: {0:0}\r\n", BasicStats.FireResistance) + string.Format("Frost: {0:0}\r\n", BasicStats.FrostResistance) + string.Format("Nature: {0:0}\r\n", BasicStats.NatureResistance) + string.Format("Shadow: {0:0}", BasicStats.ShadowResistance); dict["Total Avoidance"] = (Miss + Parry + Dodge).ToString("P2"); // Another duplicate math location. dict["Health"] = BasicStats.Health.ToString("F0") + "*" + SEStats.Health.ToString("F0") + " after special effects"; dict["Armor"] = BasicStats.Armor.ToString("F0") + "*" + SEStats.Armor.ToString("F0") + " after special effects"; dict["Strength"] = BasicStats.Strength.ToString("F0") + "*" + SEStats.Strength.ToString("F0") + " after special effects"; dict["Agility"] = BasicStats.Agility.ToString("F0") + "*" + SEStats.Agility.ToString("F0") + " after special effects"; dict["Stamina"] = BasicStats.Stamina.ToString("F0") + "*" + SEStats.Stamina.ToString("F0") + " after special effects"; dict["Hit Rating"] = BasicStats.HitRating.ToString("F0") + "*" + SEStats.HitRating.ToString("F0") + " after special effects"; dict["Haste Rating"] = BasicStats.HasteRating.ToString("F0") + "*" + SEStats.HasteRating.ToString("F0") + " after special effects"; dict["Crit Rating"] = BasicStats.CritRating.ToString("F0") + "*" + SEStats.CritRating.ToString("F0") + " after special effects"; dict["Physical Crit"] = BasicStats.PhysicalCrit.ToString("P2") + "*" + SEStats.PhysicalCrit.ToString("F0") + " after special effects"; dict["Expertise"] = Expertise.ToString("F0") + "*" + SEStats.Expertise.ToString("F0") + " after special effects"; dict["Attack Power"] = BasicStats.AttackPower.ToString("F0") + "*" + SEStats.AttackPower.ToString("F0") + " after special effects including Vengeance"; dict["Mastery"] = BasicStats.Mastery.ToString("F2") + String.Format(" ({0:0.00} %)*", (BasicStats.Mastery * 6.25f)) + BasicStats.MasteryRating.ToString("F0") + " Rating - " + SEStats.MasteryRating.ToString("F0") + " after special effects"; dict["DPS"] = DPS.ToString("F0") + "* At Max Vengeance"; dict["Rotation Time"] = String.Format("{0:0.00} sec", RotationTime); dict["Total Threat"] = TotalThreat.ToString("F0"); #region Ability Costs dict["Blood"] = Blood.ToString("F0"); dict["Frost"] = Frost.ToString("F0"); dict["Unholy"] = Unholy.ToString("F0"); dict["Death"] = Death.ToString("F0"); dict["Runic Power"] = RP.ToString("F0"); dict["RE Runes"] = FreeRERunes.ToString("F0"); #endregion dict["Overall Points"] = OverallPoints.ToString("F1"); dict["Mitigation Points"] = String.Format("{0:0.0}*" + "{1:000000.0} Crit Mitigation" + "\r\n{2:000000.0} Avoidance Mitigation" + "\r\n{3:000000.0} Armor Mitigation" + "\r\n{4:000000.0} Damage Taken Mitigation" + "\r\n{5:000000.0} Impedence Mitigation" + "\r\n{6:000000.0} Health Restoration Mitigation", Mitigation, CritMitigation, AvoidanceMitigation, ArmorMitigation, DamageTakenMitigation, ImpedenceMitigation, HealsMitigation); dict["Survival Points"] = String.Format("{0:0.0}*" + "{1:000000.0} Physical Survival" + "\r\n{2:000000.0} Bleed Survival" + "\r\n{3:000000.0} Magic Survival", Survivability, PhysicalSurvival, BleedSurvival, MagicSurvival); dict["Burst Points"] = String.Format("{0:0.0}", Burst * BurstWeight); // Modified Burst dict["Recovery Points"] = String.Format("{0:0.0}", Recovery * RecoveryWeight); // Modified Burst dict["Threat Points"] = String.Format("{0:0.0}", Threat * ThreatWeight); // Modified Threat dict["Target Miss"] = (TargetMiss).ToString("P1"); dict["Target Dodge"] = (TargetDodge).ToString("P1"); dict["Target Parry"] = (TargetParry).ToString("P1"); dict["DTPS"] = DTPS.ToString("F2"); dict["HPS"] = HPS.ToString("F2"); dict["DPS Avoided"] = AvoidanceMitigation.ToString("F0"); dict["DPS Reduced By Armor"] = ArmorMitigation.ToString("F0"); dict["Death Strike"] = TotalDShealed.ToString("F0") + "*" + DSCount.ToString("F0") + " Death Strikes Healing for " + DSHeal.ToString("F0") + " avg " + DSOverHeal.ToString("F0") + " avg Overheal"; dict["Blood Shield"] = TotalBShield.ToString("F0") + "*" + BShield.ToString("F0") + " average shield size"; return(dict); }
private bool GpiSetCurrentPosition(HPS hps, Point point) { return(true); }
private bool GpiBeginPath(HPS hps, long v) { return(true); }
/// <summary> /// Merges damage, heals and spells from a pet into this participant. /// Tanking is not merged. /// All data will be prefixed with "pet:" to distinguish it from the owner. e.g. "pet:slash" vs "slash" /// </summary> public void MergePet(FightParticipant pet) { foreach (var at in pet.AttackTypes) { at.Type = "pet:" + at.Type; //owner.AttackTypes.Add(hit); var match = AttackTypes.FirstOrDefault(x => x.Type == at.Type); if (match != null) { match.Merge(at); } else { AttackTypes.Add(at); } } foreach (var spell in pet.Spells.Where(x => x.Type == "hit")) { spell.Name = "pet:" + spell.Name; var match = Spells.FirstOrDefault(x => x.Type == spell.Type && x.Name == spell.Name); if (match != null) { match.Merge(spell); } else { Spells.Add(spell); } } OutboundHitCount += pet.OutboundHitCount; OutboundHitSum += pet.OutboundHitSum; OutboundMissCount += pet.OutboundMissCount; // merges DPS and HPS intervals (but not TankDPS or InboundHPS) for (var i = 0; i < pet.DPS.Count; i++) { while (DPS.Count <= i) { DPS.Add(0); } DPS[i] += pet.DPS[i]; } for (var i = 0; i < pet.HPS.Count; i++) { while (HPS.Count <= i) { HPS.Add(0); } HPS[i] += pet.HPS[i]; } // removing the pet has the downside of hiding pet tanking //Participants.Remove(pet); // clear the damage on the pet but keep it for tanking stats pet.OutboundHitCount = 0; pet.OutboundHitSum = 0; pet.OutboundMissCount = 0; pet.AttackTypes.Clear(); //pet.Spells.Clear(); pet.Spells.RemoveAll(x => x.Type == "hit"); // leave heals on pet so it shows on the healer list pet.DPS.Clear(); pet.HPS.Clear(); }
private void btnCalculate_Click(object sender, EventArgs e) { int samplingRate = Convert.ToInt32(nudSamplingRate.Value); float freq = (float)nudFreq.Value; int pcmDataLength = (int)nudSampleCount.Value / 2; float[] pcm = new float[pcmDataLength]; var wave = PitchUtils.CreateSineWave(pcm, pcmDataLength, samplingRate, freq, 1.0f, 0); var stopwatch = new Stopwatch(); float[] fft = new FFT(WindowType.Rectangle, cbParallel.Checked).Calculate(pcm); var zcrDetector = new ZCR(samplingRate, cbParallel.Checked); stopwatch.Restart(); float zcr = zcrDetector.Detect(pcm, fft); stopwatch.Stop(); tbZCR.Text = zcr.ToString(); tbZCRTime.Text = stopwatch.ElapsedTicks.ToString(); var autocorrelDetector = new AutocorrelationDetector(samplingRate, cbParallel.Checked); stopwatch.Restart(); float autocorrel = autocorrelDetector.Detect(pcm, fft); stopwatch.Stop(); tbAutocorrel.Text = autocorrel.ToString(); tbAutocorrelationTime.Text = stopwatch.ElapsedTicks.ToString(); var tracker = new PitchTracker(); tracker.SampleRate = samplingRate; stopwatch.Restart(); tracker.ProcessBuffer(pcm); float autocorrelNew = tracker.CurrentPitchRecord.Pitch; stopwatch.Stop(); tbAutocorrelNew.Text = autocorrelNew.ToString(); tbAutocorrelationNewTime.Text = stopwatch.ElapsedTicks.ToString(); var hpsDetector = new HPS(samplingRate, cbParallel.Checked, 1); stopwatch.Restart(); float hps = hpsDetector.Detect(pcm, fft); stopwatch.Stop(); tbHPS.Text = hps.ToString(); tbHPSTime.Text = stopwatch.ElapsedTicks.ToString(); var maxLikehoodDetector = new MaximumLikehoodDetector(samplingRate, cbParallel.Checked); stopwatch.Restart(); fft = new FFT(WindowType.Rectangle, cbParallel.Checked).Calculate(pcm); float maxLikehood = maxLikehoodDetector.Detect(pcm, fft); stopwatch.Stop(); tbMaxLikehood.Text = maxLikehood.ToString(); tbMaxLikehoodTime.Text = stopwatch.ElapsedTicks.ToString(); }
/// <summary> /// Merge data from another participant into this participant. /// </summary> public void Merge(FightParticipant p, int intervalOffset = 0, int timeOffset = 0) { OutboundMissCount += p.OutboundMissCount; OutboundHitCount += p.OutboundHitCount; OutboundHitSum += p.OutboundHitSum; OutboundStrikeCount += p.OutboundStrikeCount; InboundMissCount += p.InboundMissCount; InboundHitCount += p.InboundHitCount; InboundHitSum += p.InboundHitSum; InboundMeleeCount += p.InboundMeleeCount; InboundMeleeSum += p.InboundMeleeSum; InboundRiposteSum += p.InboundRiposteSum; //InboundSpellCount += p.InboundSpellCount; //InboundSpellSum += p.InboundSpellSum; InboundStrikeCount += p.InboundStrikeCount; OutboundHealSum += p.OutboundHealSum; InboundHealSum += p.InboundHealSum; InboundFullHealSum += p.InboundFullHealSum; DeathCount += p.DeathCount; // merge intervals starting at 'intervalOffset' base for (var i = 0; i < p.DPS.Count; i++) { while (DPS.Count <= intervalOffset + i) { DPS.Add(0); } DPS[intervalOffset + i] += p.DPS[i]; } for (var i = 0; i < p.TankDPS.Count; i++) { while (TankDPS.Count <= intervalOffset + i) { TankDPS.Add(0); } TankDPS[intervalOffset + i] += p.TankDPS[i]; } for (var i = 0; i < p.HPS.Count; i++) { while (HPS.Count <= intervalOffset + i) { HPS.Add(0); } HPS[intervalOffset + i] += p.HPS[i]; } for (var i = 0; i < p.InboundHPS.Count; i++) { while (InboundHPS.Count <= intervalOffset + i) { InboundHPS.Add(0); } InboundHPS[intervalOffset + i] += p.InboundHPS[i]; } foreach (var at in p.AttackTypes) { var _at = AttackTypes.FirstOrDefault(x => x.Type == at.Type); if (_at == null) { _at = new FightHit(); _at.Type = at.Type; AttackTypes.Add(_at); } _at.Merge(at); } foreach (var dt in p.DefenseTypes) { var _dt = DefenseTypes.FirstOrDefault(x => x.Type == dt.Type); if (_dt == null) { _dt = new FightMiss(); _dt.Type = dt.Type; DefenseTypes.Add(_dt); } _dt.Merge(dt); } foreach (var h in p.Heals) { var _h = Heals.FirstOrDefault(x => x.Target == h.Target); if (_h == null) { _h = new FightHeal(); _h.Target = h.Target; Heals.Add(_h); } _h.Merge(h); } foreach (var s in p.Spells) { var _s = Spells.FirstOrDefault(x => x.Name == s.Name && x.Type == s.Type); if (_s == null) { _s = new FightSpell(); _s.Type = s.Type; _s.Name = s.Name; //_s.Times = // todo Spells.Add(_s); } _s.Merge(s); } // disabled - merging buffs will create duplicates if fights overlap and include the same buff // it would be better to recreate buffs after merging p.Buffs.Clear(); // >= 0 avoids any pre fight buffs //foreach (var b in p.Buffs.Where(x => x.Time >= 0)) //{ // if (timeOffset == 0) // Buffs.Add(b); // else // Buffs.Add(new FightBuff { Name = b.Name, Time = b.Time + timeOffset }); //} }
public void AddHeal(LogHealEvent heal, int interval = -1) { if (FirstAction == null) { FirstAction = heal.Timestamp; } LastAction = heal.Timestamp; // promised heals appear as self heals // we may want to ignore them for self healing stats //var promised = heal.Source == Name && heal.Target == Name && heal.Spell != null && heal.Spell.StartsWith("Promised"); //if (heal.Source == Name && heal.Target == Name) //{ // SelfHealSum += heal.Amount; //} if (heal.Source == Name) { OutboundHealSum += heal.Amount; OutboundFullHealSum += heal.FullAmount; var h = Heals.FirstOrDefault(x => x.Target == heal.Target); if (h == null) { h = new FightHeal(); h.Target = heal.Target; Heals.Add(h); } h.HitCount += 1; h.HitSum += heal.Amount; h.FullHitSum += heal.FullAmount; // should we label unknown heals as lifetap or unknown? var spell = AddSpell(heal.Spell ?? "Lifetap", "heal"); spell.HitCount += 1; spell.HitSum += heal.Amount; spell.FullHitSum += heal.FullAmount; if (heal.Mod.HasFlag(LogEventMod.Critical)) { spell.CritCount += 1; spell.CritSum += heal.Amount; } if (heal.Mod.HasFlag(LogEventMod.Twincast)) { spell.TwinCount += 1; } if (interval >= 0) { while (HPS.Count <= interval) { HPS.Add(0); } HPS[interval] += heal.Amount; } } if (heal.Target == Name) { InboundHealSum += heal.Amount; InboundFullHealSum += heal.FullAmount; if (interval >= 0) { while (InboundHPS.Count <= interval) { InboundHPS.Add(0); } InboundHPS[interval] += heal.Amount; } } }
private bool GpiPolyLine(HPS hps, long v, Point[] points) { return(true); }
private bool GpiEndPath(HPS hps) { return(true); }
private void GpiStrokePath(HPS hps, long v1, long v2) { }