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 }