예제 #1
0
    // Update is called once per frame
    //private void Update () {

    //}


    //Get the storage information
    //ストレージの情報を取得する
    public void GetInfo()
    {
        XDebug.Clear();
        //XDebug.Log("Application.dataPath = " + Application.dataPath);                         //ゲームデータのフォルダーパスを返します(読み取り専用)
        XDebug.Log("Application.persistentDataPath = " + Application.persistentDataPath);       //永続的なデータディレクトリのパスを返します(読み取り専用)
        //XDebug.Log("Application.streamingAssetsPath = " + Application.streamingAssetsPath);   //StreamingAssets フォルダーへのパスが含まれています(読み取り専用)
        //XDebug.Log("Application.temporaryCachePath = " + Application.temporaryCachePath);     //一時的なデータ、キャッシュのディレクトリパスを返します(読み取り専用)値はデータを保存できる一時的なディレクトリパスです。

#if !UNITY_EDITOR && UNITY_ANDROID
        XDebug.Log("----------------------------");
        XDebug.Log("IsExternalStorageEmulated = " + AndroidPlugin.IsExternalStorageEmulated());
        XDebug.Log("IsExternalStorageRemovable = " + AndroidPlugin.IsExternalStorageRemovable());
        XDebug.Log("IsExternalStorageMounted = " + AndroidPlugin.IsExternalStorageMounted());
        XDebug.Log("IsExternalStorageMountedReadOnly = " + AndroidPlugin.IsExternalStorageMountedReadOnly());
        XDebug.Log("IsExternalStorageMountedReadWrite = " + AndroidPlugin.IsExternalStorageMountedReadWrite());
        XDebug.Log("GetExternalStorageState = " + AndroidPlugin.GetExternalStorageState());
        XDebug.Log("GetExternalStorageDirectory = " + AndroidPlugin.GetExternalStorageDirectory());
        XDebug.Log("GetExternalStorageDirectoryAlarms = " + AndroidPlugin.GetExternalStorageDirectoryAlarms());
        XDebug.Log("GetExternalStorageDirectoryDCIM = " + AndroidPlugin.GetExternalStorageDirectoryDCIM());
        XDebug.Log("GetExternalStorageDirectoryDocuments = " + AndroidPlugin.GetExternalStorageDirectoryDocuments());
        XDebug.Log("GetExternalStorageDirectoryDownloads = " + AndroidPlugin.GetExternalStorageDirectoryDownloads());
        XDebug.Log("GetExternalStorageDirectoryMovies = " + AndroidPlugin.GetExternalStorageDirectoryMovies());
        XDebug.Log("GetExternalStorageDirectoryMusic = " + AndroidPlugin.GetExternalStorageDirectoryMusic());
        XDebug.Log("GetExternalStorageDirectoryNotifications = " + AndroidPlugin.GetExternalStorageDirectoryNotifications());
        XDebug.Log("GetExternalStorageDirectoryPictures = " + AndroidPlugin.GetExternalStorageDirectoryPictures());
        XDebug.Log("GetExternalStorageDirectoryPodcasts = " + AndroidPlugin.GetExternalStorageDirectoryPodcasts());
        XDebug.Log("GetExternalStorageDirectoryRingtones = " + AndroidPlugin.GetExternalStorageDirectoryRingtones());
#endif
    }
    //スイッチ選択ダイアログのコールバックハンドラ
    private void ReceiveSwitches(string message)
    {
#if UNITY_EDITOR
        Debug.Log("ReceiveSwitches : message = " + message);
#endif
        ShowToast(message);

        XDebug.Clear(); //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
        XDebug.Log("(ReceiveSwitches : message)");
        XDebug.Log(message, 3);

        string   str = "";
        string[] arr = message.Split('\n');
        for (int i = 0; i < arr.Length; i++)
        {
            switchChecks[i] = arr[i].EndsWith("true");
            if (switchChecks[i])
            {
                str += switchItems[i] + "がドSになりました!\n";
            }
        }

        XPlayerPrefs.SetArray(gameObject.name + SWITCH_PREF, switchChecks); //配列で保存
        StartCoroutine(DelayedToast(str.Trim(), 3));                        //少し遅れてトースト表示
    }
    //Android Switch Dialog -> Callback handler
    private void ReceiveSwitches(string message)
    {
#if UNITY_EDITOR
        Debug.Log("ReceiveSwitches : message = " + message);
#endif
        ShowToast(message);

        //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
        XDebug.Clear();
        XDebug.Log("(ReceiveSwitches : message)");
        XDebug.Log(message, 3);

        string   str = "";
        string[] arr = message.Split('\n');
        for (int i = 0; i < arr.Length; i++)
        {
            switchChecks[i] = arr[i].EndsWith("true");
            if (switchChecks[i])
            {
                str += switchItems[i] + " entered the party.\n";
            }
        }

        XPlayerPrefs.SetArray(gameObject.name + SWITCH_PREF, switchChecks); //Save array values (PlayerPrefs)
        StartCoroutine(DelayedToast(str.Trim(), 3));                        //Show Android Toast with delay
    }
    const string SWITCH_PREF = "_switches";     //PlayerPrefs 保存用

    //スイッチ選択ダイアログ
    public void TestDialogSwitch()
    {
        if (switchChecks == null)                                                                              //保存されているものがあれば読み込む(無ければ全オフで新規生成)
        {
            switchChecks = XPlayerPrefs.GetArray(gameObject.name + SWITCH_PREF, new bool[switchItems.Length]); //※配列は保存されている長さになるので注意
        }
        XDebug.Clear();                                                                                        //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
        XDebug.Log("(PlayerPrefs or init)");
        XDebug.Log(switchChecks.Select(e => e.ToString()).Aggregate((s, a) => s + ", " + a), 3);

#if UNITY_EDITOR
        Debug.Log("TestDialogSwitch called");
#elif UNITY_ANDROID
        string[] keys = (switchKeyToggle != null && !switchKeyToggle.isOn) ? null : switchKeys;
        AndroidPlugin.ShowSwitchDialog("嫁のブレンド・S 設定", "ドSのオン・オフができます。", switchItems, keys, switchChecks, 0, gameObject.name, "ReceiveSwitches", "これでいい", "やめる");
#endif
    }
    const string SWITCH_PREF = "_switches";     //add name (PlayerPrefs)

    //Android Switch Dialog Demo
    public void TestDialogSwitch()
    {
        if (switchChecks == null)
        {
            switchChecks = XPlayerPrefs.GetArray(gameObject.name + SWITCH_PREF, new bool[switchItems.Length]);  //(*) Note that the array will be the saved length
        }
        //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
        XDebug.Clear();
        XDebug.Log("(PlayerPrefs or init)");
        XDebug.Log(switchChecks.Select(e => e.ToString()).Aggregate((s, a) => s + ", " + a), 3);

#if UNITY_EDITOR
        Debug.Log("TestDialogSwitch called");
#elif UNITY_ANDROID
        string[] keys = (switchKeyToggle != null && !switchKeyToggle.isOn) ? null : switchKeys;
        AndroidPlugin.ShowSwitchDialog("This is Switch Dialog Demo", "Switch the Party Character", switchItems, keys, switchChecks, 0, gameObject.name, "ReceiveSwitches", "OK", "Cancel");
#endif
    }
예제 #6
0
    const string JSON_PREF = "_json";   //For save JSON parameters

    //Call Android Custom Dialog
    //http://fantom1x.blog130.fc2.com/blog-entry-282.html#fantomPlugin_CustomDialogItems
    public void OpenDialog()
    {
        if (toggleJson != null && toggleJson.isOn)  //JSON format
        {
#if UNITY_ANDROID
            Data data = new Data();
            XPlayerPrefs.GetObjectOverwrite(gameObject.name + JSON_PREF, ref data); //Default value when there is no saved data.

            //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
            XDebug.Clear();
            XDebug.Log("(PlayerPrefs or init)");
            XDebug.Log(data, 3);

            DivisorItem divisorItem = new DivisorItem(1);
            TextItem    textItem    = new TextItem("You can make various settings.");
            TextItem    textItem1   = new TextItem("Switch the Party Character");

            SwitchItem switchItem  = new SwitchItem("UnityChan", "utc", data.utc);
            SwitchItem switchItem2 = new SwitchItem("PronamaChan", "pronama", data.pronama);
            SwitchItem switchItem3 = new SwitchItem("QueryChan", "query", data.query);

            TextItem textItem2 = new TextItem("Select a Servant");

            ToggleItem toggleItem = new ToggleItem(
                new String[] { "Saber", "Rancer", "Caster" },
                "servant",
                new String[] { "saber", "rancer", "caster" },
                data.servant);

            TextItem textItem3 = new TextItem("Sound Setting");

            Dictionary <string, int> vols;
            if (volumeController != null)
            {
                vols = volumeController.GetVolumes();
            }
            else
            {
                vols = new Dictionary <string, int>()
                {
                    { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 }
                }
            };

            SliderItem sliderItem  = new SliderItem("Master", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem1 = new SliderItem("Music", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem2 = new SliderItem("Voice", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem3 = new SliderItem("Effect", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume");

            TextItem   textItem4   = new TextItem("All saved settings will be deleted when Reset.", Color.red);
            SwitchItem switchItem4 = new SwitchItem("Reset Setting", "reset", false, Color.blue);

            DialogItem[] items = new DialogItem[] {
                textItem, divisorItem,
                textItem1, switchItem, switchItem2, switchItem3, divisorItem,
                textItem2, toggleItem, divisorItem,
                textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem,
                switchItem4, textItem4, divisorItem,
            };
#endif
#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidPlugin.ShowCustomDialog("This is Custom Dialog Demo", "", items, gameObject.name, "OnReceiveResult", true, "Apply", "Cancel");
#endif
        }
        else  //"key=value" format
        {
#if UNITY_ANDROID
            //'Param' class is basically the same as Dictionary prepared for easy handling of value type conversion and default value.
            Param pref = Param.GetPlayerPrefs(gameObject.name, new Param());  //When there is no saved data, it is newly generated (elements are empty).

            //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
            XDebug.Clear();
            XDebug.Log("(PlayerPrefs or init)");
            XDebug.Log(pref, 3);

            DivisorItem divisorItem = new DivisorItem(1);
            TextItem    textItem    = new TextItem("You can make various settings.");
            TextItem    textItem1   = new TextItem("Switch the Party Character", AndroidColor.WHITE, XColor.ToIntARGB("#ff1493"), "center"); //(*) All color formats are the same (only trying on various tests)

            SwitchItem switchItem  = new SwitchItem("UnityChan", "utc", pref.GetBool("utc", false));
            SwitchItem switchItem2 = new SwitchItem("PronamaChan", "pronama", pref.GetBool("pronama", false));
            SwitchItem switchItem3 = new SwitchItem("QueryChan", "query", pref.GetBool("query", false));

            TextItem textItem2 = new TextItem("Select a Servant", XColor.ToColor("#fff"), XColor.ToColor("0x1e90ff"), "center");  //(*) All color formats are the same (only trying on various tests)

            ToggleItem toggleItem = new ToggleItem(
                new String[] { "Saber", "Rancer", "Caster" },
                "servant",
                new String[] { "saber", "rancer", "caster" },
                pref.GetString("servant", "saber"));

            TextItem textItem3 = new TextItem("Sound Setting", XColor.ToIntARGB(Color.white), XColor.ToIntARGB(0x3c, 0xb3, 0x71), "center");//"#3cb371" (*) All color formats are the same (only trying on various tests)

            Dictionary <string, int> vols;
            if (volumeController != null)
            {
                vols = volumeController.GetVolumes();
            }
            else
            {
                vols = new Dictionary <string, int>()
                {
                    { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 }
                }
            };

            SliderItem sliderItem  = new SliderItem("Master", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem1 = new SliderItem("Music", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem2 = new SliderItem("Voice", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem3 = new SliderItem("Effect", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume");

            TextItem   textItem4   = new TextItem("All saved settings will be deleted when Reset.", Color.red);
            SwitchItem switchItem4 = new SwitchItem("Reset Setting", "reset", false, Color.blue);

            DialogItem[] items = new DialogItem[] {
                textItem, divisorItem,
                textItem1, switchItem, switchItem2, switchItem3, divisorItem,
                textItem2, toggleItem, divisorItem,
                textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem,
                switchItem4, textItem4, divisorItem,
            };
#endif
#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidPlugin.ShowCustomDialog("This is Custom Dialog Demo", "", items, gameObject.name, "OnReceiveResult", false, "Apply", "Cancel");
#endif
        }
    }
예제 #7
0
    //When "OK", the setting completion callback handler
    //http://fantom1x.blog130.fc2.com/blog-entry-282.html#fantomPlugin_CustomDialog_result
    private void OnReceiveResult(string message)
    {
        //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
        XDebug.Clear();
        XDebug.Log("(OnReceiveResult message)");
        XDebug.Log(message, 3);

        if (!string.IsNullOrEmpty(message))
        {
            Dictionary <string, int> vols = volumeController.GetVolumes(); //For save volume

            if (toggleJson != null && toggleJson.isOn)                     //JSON format
            {
                Data data = JsonUtility.FromJson <Data>(message);
                XDebug.Log("(Parse to Data [from JSON])");
                XDebug.Log(data, 3);

                if (data.reset)  //Execute setting reset
                {
                    PlayerPrefs.DeleteKey(gameObject.name + JSON_PREF);
                    volumeController.ResetVolumes();     //Return to initial state

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast("The setting was Reset");
#endif
                }
                else  //Update and save values
                {
                    //Update volume setting (*) if used Slider change callback "PreviewVolume()", it is applied in real-time, so it is not necessary.
                    vols["master"] = data.master;
                    vols["bgm"]    = data.bgm;
                    vols["voice"]  = data.voice;
                    vols["se"]     = data.se;

                    //Save parameters (PlayerPrefs)
                    XPlayerPrefs.SetObject(gameObject.name + JSON_PREF, data);
                    volumeController.SetPrefs(vols);
                    PlayerPrefs.Save();

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast(message);
#endif
                }
            }
            else  //"key=value" format
            {
                Param pref = Param.Parse(message);
                XDebug.Log("(Parse to Param [from key=value])");
                XDebug.Log(pref, 3);

                if (pref["reset"].ToLower() == "true")  //Execute setting reset
                {
                    PlayerPrefs.DeleteKey(gameObject.name);
                    volumeController.ResetVolumes();     //Return to initial state

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast("The setting was Reset");
#endif
                }
                else  //Update and save values
                {
                    //Update volume setting (*) if used Slider change callback "PreviewVolume()", it is applied in real-time, so it is not necessary.
                    foreach (var key in vols.Keys.ToArray())
                    {
                        vols[key] = int.Parse(pref[key]);
                        pref.Remove(key);   //Remove unnecessary parameters for saving
                    }
                    pref.Remove("reset");   //Remove unnecessary parameters for saving

                    //Save parameters (PlayerPrefs)
                    if (pref.Count > 0)
                    {
                        Param.SetPlayerPrefs(gameObject.name, pref);
                    }
                    volumeController.SetPrefs(vols);
                    PlayerPrefs.Save();

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast(message);
#endif
                }
            }
        }
    }
예제 #8
0
 public void ClearLog()
 {
     XDebug.Clear();
 }
예제 #9
0
    const string JSON_PREF = "_json";   //JSON とは保存データを分ける


    public void OpenDialog()
    {
        if (toggleJson != null && toggleJson.isOn)  //JSON 形式
        {
#if UNITY_ANDROID
            Data data = new Data();
            XPlayerPrefs.GetObjectOverwrite(gameObject.name + JSON_PREF, ref data); //保存されたデータがないときはデフォ値となる

            XDebug.Clear();                                                         //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
            XDebug.Log("(PlayerPrefs or init)");
            XDebug.Log(data, 3);

            DivisorItem divisorItem = new DivisorItem(1);
            TextItem    textItem    = new TextItem("あんなことやこんなことを設定できます。");
            TextItem    textItem1   = new TextItem("嫁のブレンド・S");

            SwitchItem switchItem  = new SwitchItem("ユニティちゃん", "utc", data.utc);
            SwitchItem switchItem2 = new SwitchItem("プロ生ちゃん", "pronama", data.pronama);
            SwitchItem switchItem3 = new SwitchItem("クエリちゃん", "query", data.query);

            TextItem textItem2 = new TextItem("あなたの属性");

            ToggleItem toggleItem = new ToggleItem(
                new String[] { "ツンデレ", "ヤンデレ", "しょびっち" },
                "zokusei",
                new String[] { "tsundere", "yandere", "syobicchi" },
                data.zokusei);

            TextItem textItem3 = new TextItem("サウンド設定");

            Dictionary <string, int> vols;
            if (volumeController != null)
            {
                vols = volumeController.GetVolumes();
            }
            else
            {
                vols = new Dictionary <string, int>()
                {
                    { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 }
                }
            };

            SliderItem sliderItem  = new SliderItem("マスター", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem1 = new SliderItem("音楽", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem2 = new SliderItem("ボイス", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem3 = new SliderItem("効果音", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume");

            TextItem   textItem4   = new TextItem("リセットすると保存された設定が全て消去されます", Color.red);
            SwitchItem switchItem4 = new SwitchItem("設定のリセット", "reset", false, Color.blue);

            DialogItem[] items = new DialogItem[] {
                textItem, divisorItem,
                textItem1, switchItem, switchItem2, switchItem3, divisorItem,
                textItem2, toggleItem, divisorItem,
                textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem,
                switchItem4, textItem4, divisorItem,
            };
#endif
#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidPlugin.ShowCustomDialog("設定いろいろ", "", items, gameObject.name, "OnReceiveResult", true, "決定", "キャンセル");
#endif
        }
        else  //キーと値ペアの形式
        {
#if UNITY_ANDROID
            //Param は基本的に Dictionary と同じもので、値の型変換とデフォルト値を簡単に扱うために用意したラッパー的なクラスと考えて良い
            Param pref = Param.GetPlayerPrefs(gameObject.name, new Param()); //保存されたデータがないときは新規に生成(中身は空)

            XDebug.Clear();                                                  //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
            XDebug.Log("(PlayerPrefs or init)");
            XDebug.Log(pref, 3);

            DivisorItem divisorItem = new DivisorItem(1);
            TextItem    textItem    = new TextItem("あんなことやこんなことを設定できます。");
            TextItem    textItem1   = new TextItem("嫁のブレンド・S", AndroidColor.WHITE, XColor.ToIntARGB("#ff1493"), "center"); //※色の形式はどれでも同じです(テストで色々試してるだけ)

            SwitchItem switchItem  = new SwitchItem("ユニティちゃん", "utc", pref.GetBool("utc", false));
            SwitchItem switchItem2 = new SwitchItem("プロ生ちゃん", "pronama", pref.GetBool("pronama", false));
            SwitchItem switchItem3 = new SwitchItem("クエリちゃん", "query", pref.GetBool("query", false));

            TextItem textItem2 = new TextItem("あなたの属性", XColor.ToColor("#fff"), XColor.ToColor("0x1e90ff"), "center");  //※色の形式はどれでも同じです(テストで色々試してるだけ)

            ToggleItem toggleItem = new ToggleItem(
                new String[] { "ツンデレ", "ヤンデレ", "しょびっち" },
                "zokusei",
                new String[] { "tsundere", "yandere", "syobicchi" },
                pref.GetString("zokusei", "tsundere"));

            TextItem textItem3 = new TextItem("サウンド設定", XColor.ToIntARGB(Color.white), XColor.ToIntARGB(0x3c, 0xb3, 0x71), "center");//"#3cb371" ※色の形式はどれでも同じです(テストで色々試してるだけ)

            Dictionary <string, int> vols;
            if (volumeController != null)
            {
                vols = volumeController.GetVolumes();
            }
            else
            {
                vols = new Dictionary <string, int>()
                {
                    { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 }
                }
            };

            SliderItem sliderItem  = new SliderItem("マスター", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem1 = new SliderItem("音楽", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem2 = new SliderItem("ボイス", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume");
            SliderItem sliderItem3 = new SliderItem("効果音", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume");

            TextItem   textItem4   = new TextItem("リセットすると保存された設定が全て消去されます", Color.red);
            SwitchItem switchItem4 = new SwitchItem("設定のリセット", "reset", false, Color.blue);

            DialogItem[] items = new DialogItem[] {
                textItem, divisorItem,
                textItem1, switchItem, switchItem2, switchItem3, divisorItem,
                textItem2, toggleItem, divisorItem,
                textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem,
                switchItem4, textItem4, divisorItem,
            };
#endif
#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidPlugin.ShowCustomDialog("設定いろいろ", "", items, gameObject.name, "OnReceiveResult", false, "決定", "キャンセル");
#endif
        }
    }
예제 #10
0
    //設定完了(「OK」時)のコールバックハンドラ
    private void OnReceiveResult(string message)
    {
        XDebug.Clear(); //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
        XDebug.Log("(OnReceiveResult message)");
        XDebug.Log(message, 3);

        if (!string.IsNullOrEmpty(message))
        {
            Dictionary <string, int> vols = volumeController.GetVolumes(); //音量の保存用

            if (toggleJson != null && toggleJson.isOn)                     //JSON 形式
            {
                Data data = JsonUtility.FromJson <Data>(message);
                XDebug.Log("(Parse to Data [from JSON])");
                XDebug.Log(data, 3);

                if (data.reset)  //設定のリセットを実行
                {
                    PlayerPrefs.DeleteKey(gameObject.name + JSON_PREF);
                    volumeController.ResetVolumes();     //初期状態に戻す

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast("設定がリセットされました");
#endif
                }
                else  //値の更新と保存
                {
                    //音量設定の更新(※スライダーの変化コールバック:PreviewVolume() をしている場合は、リアルタイムで反映されているので無くても可)。
                    vols["master"] = data.master;
                    vols["bgm"]    = data.bgm;
                    vols["voice"]  = data.voice;
                    vols["se"]     = data.se;

                    //PlayerPrefs の更新
                    XPlayerPrefs.SetObject(gameObject.name + JSON_PREF, data);
                    volumeController.SetPrefs(vols);
                    PlayerPrefs.Save();

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast(message);
#endif
                }
            }
            else  //キーと値ペアの形式
            {
                Param pref = Param.Parse(message);
                XDebug.Log("(Parse to Param [from key=value])");
                XDebug.Log(pref, 3);

                if (pref["reset"].ToLower() == "true")  //設定のリセットを実行(※値は文字列)
                {
                    PlayerPrefs.DeleteKey(gameObject.name);
                    volumeController.ResetVolumes();     //初期状態に戻す

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast("設定がリセットされました");
#endif
                }
                else  //値の更新と保存
                {
                    //音量設定の更新(※スライダーの変化コールバック:PreviewVolume() をしている場合は、リアルタイムで反映されているので無くても可)。
                    foreach (var key in vols.Keys.ToArray())
                    {
                        vols[key] = int.Parse(pref[key]);
                        pref.Remove(key);   //保存に不要なパラメタを削除
                    }
                    pref.Remove("reset");   //保存に不要なパラメタを削除

                    //PlayerPrefs の更新
                    if (pref.Count > 0)
                    {
                        Param.SetPlayerPrefs(gameObject.name, pref);
                    }
                    volumeController.SetPrefs(vols);
                    PlayerPrefs.Save();

#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidPlugin.ShowToast(message);
#endif
                }
            }
        }
    }