示例#1
0
    void loadPrefs()
    {
        if (CustomPlayerPrefs.HasKey("selectedMaskID"))
        {
            selectedMaskID = CustomPlayerPrefs.GetInt("selectedMaskID");
            Debug.Log("prefered selectedMaskID detected");
        }
        if (CustomPlayerPrefs.HasKey("isMaskFlipped"))
        {
            isFlipped = CustomPlayerPrefs.GetBool("isMaskFlipped");
            Debug.Log("prefered isMaskFlipped detected");
        }
        if (CustomPlayerPrefs.HasKey("maskScale"))
        {
            maskScale = CustomPlayerPrefs.GetFloat("maskScale");
            Debug.Log("prefered maskScale detected");
        }
        else
        {
            maskScale = 11.2f;
        }
        if (CustomPlayerPrefs.HasKey("maskColor_R"))
        {
            float red   = CustomPlayerPrefs.GetFloat("maskColor_R");
            float green = CustomPlayerPrefs.GetFloat("maskColor_G");
            float blue  = CustomPlayerPrefs.GetFloat("maskColor_B");

            maskMat.SetColor("_Color", new Color(red, green, blue, maskMat.GetColor("_Color").a));
        }
        if (CustomPlayerPrefs.HasKey("maskAlpha"))
        {
            float alpha = CustomPlayerPrefs.GetFloat("maskAlpha");
            maskMat.SetColor("_Color", new Color(maskMat.GetColor("_Color").r, maskMat.GetColor("_Color").g, maskMat.GetColor("_Color").b, alpha));
        }
    }
示例#2
0
 void Start()
 {
     if (CustomPlayerPrefs.HasKey("eventsJSON"))
     {
         //print(CustomPlayerPrefs.GetString("eventsJSON", CustomPlayerPrefs.DEFAULT_STRING)); //test
         eventsJSON = CustomPlayerPrefs.GetObjectValue <JSON>("eventsJSON");
         string json = JsonUtility.ToJson(eventsJSON);
         print(json);
         coroutine = WaitAndSend();
         StartCoroutine(coroutine);
     }
 }