private void AddEnableCharas(int charaNo) { string enabeledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, Const.ENABLE_CHARAS_DEFAULT); enabeledCharas = enabeledCharas + "," + charaNo.ToString(); EncryptedPlayerPrefs.SaveString(Const.KEY_ENABLE_CHARAS, enabeledCharas); }
public void OnClickButton() { if (selectItem.canSelect) { SoundController.Instance.PlaySe(SoundController.Instance.buttonSe); EncryptedPlayerPrefs.SaveInt(Const.KEY_CHARA, int.Parse(selectItem.num)); Retry(); return; } if (selectItem.canBuy) { SoundController.Instance.PlaySe(SoundController.Instance.casher); int point = EncryptedPlayerPrefs.LoadInt(Const.KEY_POINT, 0); int diff = point - selectItem.price; EncryptedPlayerPrefs.SaveInt(Const.KEY_POINT, diff); pointText.text = diff + "P"; string enabledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, "0"); enabledCharas = enabledCharas + "," + selectItem.num; EncryptedPlayerPrefs.SaveString(Const.KEY_ENABLE_CHARAS, enabledCharas); selectItem.canSelect = true; priceText.text = ("PLAY"); } }
private bool IsEnable() { string enabeledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, Const.ENABLE_CHARAS_DEFAULT); List <string> enableList = new List <string> (); enableList.AddRange(enabeledCharas.Split(',')); int charaNo = charaType + charaSeq; bool enable = enableList.Contains(charaNo.ToString()); return(enable); }
private void SetCanvasText() { int totalPoint = EncryptedPlayerPrefs.LoadInt(Const.KEY_POINT, 0); pointText.text = totalPoint + "P"; string num = selectItem.num; int price = selectItem.price; selectItem.canSelect = false; selectItem.canBuy = false; string enabeledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, "0"); string[] enables = enabeledCharas.Split(','); for (int i = 0; i < enables.Length; i++) { if (num == enables [i]) { selectItem.canSelect = true; } } if (totalPoint >= price) { selectItem.canBuy = true; } nameText.text = selectItem.charaName; if (selectItem.canSelect) { priceText.text = ("PLAY"); button.interactable = true; } else { priceText.text = (price + "P"); if (selectItem.canBuy) { button.interactable = true; } else { button.interactable = false; } } }
public string Load() => EncryptedPlayerPrefs.LoadString(NameKey, $"ゲスト{Random.Range(0, 1000):000}");