void InstansiateSfx()
    {
        GUI.FocusControl(null);
        if (sfxLibrary.ContainsID(uuid))
        {
            Debug.Log("uuid already exists!");
            return;
        }
        SfxList se = Editor.CreateInstance <SfxList>();

        se.name      = uuid;
        se.uuid      = uuid;
        se.entryName = uuid;
        se.repColor  = repColor;
        string path = "Assets/LibraryData/Songlists/" + uuid + ".asset";

        AssetDatabase.CreateAsset(se, path);
        sfxLibrary.InsertEntry(se, 0);
        Undo.RecordObject(sfxLibrary, "Added sfx");
        EditorUtility.SetDirty(sfxLibrary);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();

        currentEntryList = sfxLibrary.GetRepresentations("", filterStr);
        uuid             = "";
        selMusic         = 0;
        SelectMusic();
    }
 void SelectMusic()
 {
     if (selMusic == -1)
     {
         // Nothing selected
         if (soundType == 0)
         {
             musicValues.ResetValues();
         }
         else
         {
             sfxValues.ResetValues();
         }
     }
     else
     {
         // Something selected
         selMusic = Mathf.Min(currentEntryList.Length - 1, selMusic);
         if (soundType == 0)
         {
             MusicList me = (MusicList)musicLibrary.GetEntryByIndex(selMusic);
             musicValues.CopyValues(me);
         }
         else
         {
             SfxList se = (SfxList)sfxLibrary.GetEntryByIndex(selMusic);
             sfxValues.CopyValues(se);
         }
     }
 }
 /// <summary>
 /// Constructor for the editor window.
 /// </summary>
 /// <param name="entries"></param>
 /// <param name="container"></param>
 public SonglistEditorWindow(ScrObjLibraryVariable entries, MusicList container, ScrObjLibraryVariable entries2, SfxList container2)
 {
     musicLibrary = entries;
     musicValues  = container;
     sfxLibrary   = entries2;
     sfxValues    = container2;
     LoadLibrary();
 }
Exemplo n.º 4
0
 public void Stop(SfxList inSfx)
 {
     if (!_sfxMap.ContainsKey(inSfx))
     {
         throw new WarningException($"you have to assign the sfx machine in the system before use it!");
         return;
     }
     _sfxMap[inSfx].Stop();
 }
Exemplo n.º 5
0
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        SfxList ml = (SfxList)other;

        sfxClips = new List <SfxEntry>();
        for (int i = 0; i < ml.sfxClips.Count; i++)
        {
            sfxClips.Add(ml.sfxClips[i]);
        }
    }
Exemplo n.º 6
0
 public void Play(SfxList inSfx, bool stopOther = true, float pitchMultiplier = 1f)
 {
     if (!_sfxMap.ContainsKey(inSfx))
     {
         throw new WarningException($"you have to assign the sfx machine in the system before use it!");
         return;
     }
     if (stopOther)
     {
         StopAllSounds();
     }
     _sfxMap[inSfx].Play(pitchMultiplier);
 }
 void SaveSelectedMusic()
 {
     if (soundType == 0)
     {
         MusicList me = (MusicList)musicLibrary.GetEntryByIndex(selMusic);
         me.CopyValues(musicValues);
         Undo.RecordObject(me, "Updated music list");
         EditorUtility.SetDirty(me);
     }
     else
     {
         SfxList se = (SfxList)sfxLibrary.GetEntryByIndex(selMusic);
         se.CopyValues(sfxValues);
         Undo.RecordObject(se, "Updated sfx list");
         EditorUtility.SetDirty(se);
     }
 }
    void DeleteSfx()
    {
        GUI.FocusControl(null);
        SfxList se   = (SfxList)sfxLibrary.GetEntryByIndex(selMusic);
        string  path = "Assets/LibraryData/Songlists/" + se.uuid + ".asset";

        sfxLibrary.RemoveEntryByIndex(selMusic);
        Undo.RecordObject(sfxLibrary, "Deleted sfx list");
        EditorUtility.SetDirty(sfxLibrary);
        bool res = AssetDatabase.MoveAssetToTrash(path);

        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();

        currentEntryList = sfxLibrary.GetRepresentations("", filterStr);

        if (res)
        {
            Debug.Log("Removed sfx: " + se.uuid);
            selMusic = -1;
        }
    }