Ejemplo n.º 1
0
    private void Import()
    {
        if (soundScriptable == null)
        {
            soundScriptable = ScriptableObject.CreateInstance <SoundScriptable>();
        }
        SoundScriptable scriptable = AssetDatabase.LoadAssetAtPath <SoundScriptable>(ASSET_PATH);

        if (scriptable == null)
        {
            Debug.Log("ScriptableObjectがnullです");
            return;
        }
        soundScriptable.Copy(scriptable);
        soundScriptable = scriptable;

        bgmList.Clear();
        bgmActiveList.Clear();
        for (int i = 0; i < soundScriptable.bgmDatas.Count; i++)
        {
            bgmList.Add(soundScriptable.bgmDatas[i]);
            bgmActiveList.Add(false);
        }
        seList.Clear();
        seActiveList.Clear();
        for (int i = 0; i < soundScriptable.seDatas.Count; i++)
        {
            seList.Add(soundScriptable.seDatas[i]);
            seActiveList.Add(false);
        }
    }
Ejemplo n.º 2
0
    private void Export()
    {
        soundScriptable = AssetDatabase.LoadAssetAtPath <SoundScriptable>(ASSET_PATH);
        if (soundScriptable == null)
        {
            soundScriptable = ScriptableObject.CreateInstance <SoundScriptable>();
        }
        // 新規の場合はディレクトリ作成
        if (!AssetDatabase.Contains(soundScriptable as UnityEngine.Object))
        {
            string directory = System.IO.Path.GetDirectoryName(ASSET_PATH);
            if (!System.IO.Directory.Exists(directory))
            {
                System.IO.Directory.CreateDirectory(directory);
            }
            // アセット作成
            AssetDatabase.CreateAsset(soundScriptable, ASSET_PATH);
            soundScriptable.Copy(soundScriptable);
            //ScriptableObjectを設定
            SetScriptable();

            // 更新通知
            EditorUtility.SetDirty(soundScriptable);
            // 保存
            AssetDatabase.SaveAssets();
            // エディタを最新の状態にする
            AssetDatabase.Refresh();
        }
        else
        {
            ok_or_canselWindow = CreateInstance <OK_Or_CancelWindow>();
            ok_or_canselWindow.ShowUtility();
            ok_or_canselWindow.SetOKAction(() =>
            {
                soundScriptable.Copy(soundScriptable);
                //ScriptableObjectを設定
                SetScriptable();

                // 更新通知
                EditorUtility.SetDirty(soundScriptable);
                // 保存
                AssetDatabase.SaveAssets();
                // エディタを最新の状態にする
                AssetDatabase.Refresh();
                ok_or_canselWindow.Close();
                ok_or_canselWindow = null;
                Layout();
            });
            ok_or_canselWindow.SetCancelAction(() =>
            {
                ok_or_canselWindow.Close();
                ok_or_canselWindow = null;
                Layout();
            });
        }
    }
Ejemplo n.º 3
0
 public void Init()
 {
     soundScriptable = AssetDatabase.LoadAssetAtPath <SoundScriptable>(ASSET_PATH);
     defaultColor    = GUI.backgroundColor;
     bgmActiveList.Clear();
     for (int i = 0; i < bgmList.Count; i++)
     {
         bgmActiveList.Add(false);
     }
     if (soundScriptable == null)
     {
         Import();
     }
     EditorStartUp();
 }
Ejemplo n.º 4
0
    public IEnumerator ReadAsset()
    {
        ResourceRequest request = Resources.LoadAsync <SoundScriptable>("EachChapterVoice");

        while (!request.isDone)
        {
            yield return(null);
        }
        if (request.asset != null)
        {
            soundScriptable = request.asset as SoundScriptable;
        }
        if (soundScriptable == null)
        {
            yield return(StartCoroutine(ReadAsset()));
        }

        isInitialized = true;
    }
Ejemplo n.º 5
0
 public void Copy(SoundScriptable data)
 {
     intValue = data.IntValue;
 }
Ejemplo n.º 6
0
    public void Stop(string name)
    {
        SoundScriptable s = Array.Find(scriptableSounds, sound => sound.naming == name);

        s.source.Stop();
    }