private void darkButton1_Click(object sender, EventArgs e)
        {
            // save descriptor
            if (toolMode == 0)
            {
                SoundDescriptor overwrite = allSounds.FirstOrDefault(x => x.Name == selectedNode.Text);

                if (overwrite != null)
                {
                    overwrite.RelativeVolume = trackBar1.Value;
                }
                else
                {
                    SoundDescriptor s = new SoundDescriptor();
                    s.Name           = selectedNode.Text;
                    s.RelativeVolume = trackBar1.Value;

                    okEntries.Add(s.Name);
                    badEntries.Remove(s.Name);

                    selectedNode.Icon = (Bitmap)Properties.Resources.Checkmark_16x;
                    darkTreeView1.Invalidate();

                    allSounds.Add(s);
                }

                string json = JsonConvert.SerializeObject(allSounds);

                using (StreamWriter writer = new StreamWriter("../../../SimplexRpgEngine3/SoundsDescriptor.json"))
                {
                    writer.WriteLine(json);
                    writer.Close();
                }
            }
        }
Exemple #2
0
        public SoundDescriptor Duplicate(
            ISoundDescriptorGetter item,
            FormKey formKey,
            TranslationCrystal?copyMask)
        {
            var newRec = new SoundDescriptor(formKey);

            newRec.DeepCopyIn(item, default(ErrorMaskBuilder?), copyMask);
            return(newRec);
        }
Exemple #3
0
        public SoundDocument(SoundDescriptor sound, DocumentView dView)
            : base(sound.FilePath, dView)
        {
            Text       = sound.Name;
            Descriptor = sound;
            Player     = new SoundPlayer(Descriptor.FilePath);

            initControls();
            addControls();
        }
Exemple #4
0
        public SoundDescriptor DeepCopy(
            ISoundDescriptorGetter item,
            SoundDescriptor.TranslationMask?copyMask = null)
        {
            SoundDescriptor ret = (SoundDescriptor)((SoundDescriptorCommon)((ISoundDescriptorGetter)item).CommonInstance() !).GetNew();

            ((SoundDescriptorSetterTranslationCommon)((ISoundDescriptorGetter)ret).CommonSetterTranslationInstance() !).DeepCopyIn(
                item: ret,
                rhs: item,
                errorMask: null,
                copyMask: copyMask?.GetCrystal(),
                deepCopy: true);
            return(ret);
        }
Exemple #5
0
    public void PlaySound(string soundName)
    {
        SoundDescriptor soundDescriptor = GetSound(soundName);

        if (soundDescriptor == null)
        {
            return;
        }

        if (fxEnabled && soundDescriptor.sound)
        {
            AudioSource.PlayClipAtPoint(soundDescriptor.sound, Camera.main.transform.position, Mathf.Clamp(fxVolume * soundDescriptor.soundMultiplier, 0.05f, 1f));
        }
    }
Exemple #6
0
        public SoundDescriptor DeepCopy(
            ISoundDescriptorGetter item,
            out SoundDescriptor.ErrorMask errorMask,
            SoundDescriptor.TranslationMask?copyMask = null)
        {
            var             errorMaskBuilder = new ErrorMaskBuilder();
            SoundDescriptor ret = (SoundDescriptor)((SoundDescriptorCommon)((ISoundDescriptorGetter)item).CommonInstance() !).GetNew();

            ((SoundDescriptorSetterTranslationCommon)((ISoundDescriptorGetter)ret).CommonSetterTranslationInstance() !).DeepCopyIn(
                ret,
                item,
                errorMask: errorMaskBuilder,
                copyMask: copyMask?.GetCrystal(),
                deepCopy: true);
            errorMask = SoundDescriptor.ErrorMask.Factory(errorMaskBuilder);
            return(ret);
        }
    // Token: 0x06001030 RID: 4144
    public void OnRecieveDamage(Damage damage)
    {
        if (RandomizerBonusSkill.Invincible)
        {
            return;
        }
        if (damage.Amount < 9000f || damage.Type != DamageType.Water)
        {
            if (this.IsImmortal)
            {
                return;
            }
            if (!this.Sein.Controller.CanMove)
            {
                return;
            }
            if (damage.Type == DamageType.SpiritFlameSplatter || damage.Type == DamageType.LevelUp)
            {
                return;
            }
        }
        damage.SetAmount(Mathf.Round(damage.Amount * Randomizer.DamageModifier));
        bool flag  = this.m_invincibleTimeRemaining > 0f;
        bool flag2 = this.m_invincibleToEnemiesTimeRemaining > 0f;

        if (this.Sein.Abilities.Stomp && this.Sein.Abilities.Stomp.Logic.CurrentState == this.Sein.Abilities.Stomp.State.StompDown)
        {
            flag = true;
        }
        if (!this.Sein.gameObject.activeInHierarchy)
        {
            return;
        }
        if (flag && damage.Amount < 100f && damage.Type != DamageType.Drowning)
        {
            damage.SetAmount(0f);
        }
        if (flag2 && damage.Amount < 100f && (damage.Type == DamageType.Enemy || damage.Type == DamageType.Projectile || damage.Type == DamageType.SlugSpike))
        {
            damage.SetAmount(0f);
        }
        if (damage.Amount == 0f)
        {
            return;
        }
        if (damage.Amount < 100f)
        {
            DifficultyMode difficulty = DifficultyController.Instance.Difficulty;
            if (difficulty != DifficultyMode.Easy)
            {
                if (difficulty == DifficultyMode.Hard)
                {
                    damage.SetAmount(damage.Amount * 2f);
                    if (damage.Amount < 8f)
                    {
                        damage.SetAmount(8f);
                    }
                }
            }
            else if (damage.Type != DamageType.Lava && damage.Type != DamageType.Spikes)
            {
                damage.SetAmount(damage.Amount / 2f);
            }
            else
            {
                int num = Mathf.RoundToInt(damage.Amount / 4f);
                if (num > 3)
                {
                    num = Mathf.FloorToInt((float)(num - 3) * 0.5f) + 3;
                }
                damage.SetAmount((float)(num * 4));
            }
        }
        if (Randomizer.OHKO)
        {
            damage.SetAmount(damage.Amount * 100f);
        }
        UI.Vignette.SeinHurt.Restart();
        SoundDescriptor soundForDamage = ((damage.Amount >= this.BadlyHurtAmount) ? this.SeinBadlyHurtSound : this.SeinHurtSound).GetSoundForDamage(damage);

        if (soundForDamage != null)
        {
            SoundPlayer soundPlayer = Sound.Play(soundForDamage, this.PlatformMovement.Position, null);
            if (soundPlayer)
            {
                soundPlayer.AttachTo = this.Sein.PlatformBehaviour.transform;
            }
        }
        int num2 = Mathf.CeilToInt(damage.Amount / 4f);

        damage.SetAmount((float)num2);
        if (damage.Amount < 1000f && this.Sein.PlayerAbilities.UltraDefense.HasAbility)
        {
            damage.SetAmount((float)Mathf.RoundToInt((float)num2 * 0.8f));
        }
        Attacking.DamageDisplayText.Create(damage, this.Sein.transform);
        damage.SetAmount((float)(num2 * 4));
        if (damage.Amount < 1000f && this.Sein.PlayerAbilities.UltraDefense.HasAbility)
        {
            damage.SetAmount((float)(Mathf.FloorToInt((float)(num2 * 2) * 0.8f) * 2));
        }
        int num3 = Mathf.RoundToInt(damage.Amount);

        if ((float)num3 >= this.HealthController.Amount)
        {
            this.Sein.Mortality.Health.TakeDamage(num3);
            this.OnKill(damage);
            return;
        }
        this.Sein.Mortality.Health.TakeDamage(num3);
        if (damage.Type != DamageType.Drowning)
        {
            this.MakeInvincible(1f);
            base.StartCoroutine(this.FlashSprite());
            if (this.HurtEffect)
            {
                GameObject expr_3BA = (GameObject)InstantiateUtility.Instantiate(this.HurtEffect);
                expr_3BA.transform.position = base.transform.position;
                Vector3 vector = this.PlatformMovement.LocalSpeed.normalized + damage.Force.normalized;
                float   z      = Mathf.Atan2(vector.y, vector.x) * 57.29578f;
                expr_3BA.transform.rotation = Quaternion.Euler(0f, 0f, z);
            }
            base.Active = true;
            if (this.Sein.Abilities.GrabWall)
            {
                this.Sein.Abilities.GrabWall.Exit();
            }
            if (this.Sein.Abilities.Dash)
            {
                this.Sein.Abilities.Dash.Exit();
            }
            this.PlatformMovement.LocalSpeed = ((damage.Force.x <= 0f) ? new Vector2(-this.HurtSpeed.x, this.HurtSpeed.y) : this.HurtSpeed);
            this.m_hurtTimeRemaining         = this.HurtDuration;
            this.Sein.PlatformBehaviour.Visuals.Animation.Play(this.HurtAnimation, 140, new Func <bool>(this.ShouldHurtAnimationKeepPlaying));
            return;
        }
        base.StartCoroutine(this.FlashSprite());
    }
 /// <summary>
 /// Funkcja stopujaca zadany dzwiek krokow
 /// </summary>
 /// <param name="steps">Dzwiek krokow do zastopowania</param>
 public static void StopSteps(SoundDescriptor steps)
 {
     //ustawienie opcji looping na false - dzwiek nie jest juz ciagly
     //zostanie usuniety w funkcji UpdateSoundList
     steps.Looping = false;
 }
 /// <summary>
 /// Funkcja grajaca dzwiek krokow i zwracajaca obiekt z dzwiekiem
 /// do manualnej modyfikacji przez klienta
 /// </summary>
 /// <returns>Obiekt z dzwiekiem krokow</returns>
 public static SoundDescriptor StartSteps(SoundTypes sound, Vector3 position)
 {
     String soundName = nameFinder.FindSound(sound); //znalezienie sciezki
     SoundDescriptor soundDesc =
         new SoundDescriptor(soundCard, soundName, position, true);
     soundDesc.Play();
     soundList.Add(soundDesc);
     return soundDesc;
 }
 /// <summary>
 /// Funkcja grajaca zadany dzwiek w przestrzeni 3D
 /// </summary>
 /// <param name="sound">Typ wyliczeniowy z typem dzwieko</param>
 /// <param name="position">Wektor z pozycja w przestrzeni 3D</param>
 public static void PlaySound(SoundTypes sound, Vector3 position)
 {
     String soundName = nameFinder.FindSound(sound); //znalezienie sciezki
     SoundDescriptor soundDesc =
         new SoundDescriptor(soundCard, soundName, position, false);
     soundDesc.Play();
     soundList.Add(soundDesc);
 }
Exemple #11
0
 public override object GetNew()
 {
     return(SoundDescriptor.GetNew());
 }
 public SoundDocumentInfo(SoundDescriptor sound)
 {
     Sound = sound;
 }
    public static void OnStartSound(IntPtr actionFactorySound)
    {
        SoundDescriptor sound = null;

        unsafe
        {
            PKFxManagerImpl.SNativeSoundDescriptor *desc = (PKFxManagerImpl.SNativeSoundDescriptor *)actionFactorySound.ToPointer();
            sound = new SoundDescriptor(*desc);
        }

        if (m_OnStartSoundDelegate != null)
        {
            m_OnStartSoundDelegate(sound);
            return;
        }

        string soundPath = PKFxSettings.UnityPackFxPath + "/" + sound.m_Path;

        AudioClip clip = null;

        if (m_Sounds.ContainsKey(soundPath) == true)
        {
            clip = m_Sounds[soundPath];
        }
        if (clip != null)
        {
            if (m_SpawnedSoundRoot == null)
            {
                m_SpawnedSoundRoot = new GameObject("PopcornFX Sounds");
                m_SpawnedSoundRoot.transform.position = Vector3.zero;
                m_SpawnedSoundRoot.isStatic           = true;
            }

            GameObject soundGo = new GameObject("FxSound");
            if (soundGo != null)
            {
                soundGo.transform.parent   = m_SpawnedSoundRoot.transform;
                soundGo.transform.position = sound.m_WorldPosition;
                AudioSource soundSource = soundGo.AddComponent <AudioSource>();
                if (soundSource != null)
                {
                    soundSource.clip = clip;
                    soundSource.Play();
                    soundSource.volume       = sound.m_Volume;
                    soundSource.time         = sound.m_StartTimeOffsetInSeconds;
                    soundSource.spatialBlend = 1.0f;
                    if (sound.m_PlayTimeInSeconds != 0.0f)
                    {
                        GameObject.Destroy(soundSource, sound.m_PlayTimeInSeconds);
                    }
                    else
                    {
                        m_SpawnedSound.Add(soundSource);
                    }
                }
            }
        }
        else
        {
            Debug.LogError("[PKFX] Could not load sound layer " + soundPath);
        }
    }