Beispiel #1
0
 private static void LoadPresetsPostfix(UI_ColorPresets.ColorInfo ___colorInfo)
 {
     if (___colorInfo.select < 0 || ___colorInfo.select > 3)
     {
         ___colorInfo.select = 0;
     }
 }
    public void LoadPresets()
    {
        string path = this.saveDir + "ColorPresets.json";

        if (!File.Exists(path))
        {
            TextAsset textAsset = CommonLib.LoadAsset <TextAsset>("custom/colorsample.unity3d", "ColorPresets", false, string.Empty);
            if (!Object.op_Inequality((Object)null, (Object)textAsset))
            {
                return;
            }
            this.colorInfo = (UI_ColorPresets.ColorInfo)JsonUtility.FromJson <UI_ColorPresets.ColorInfo>(textAsset.get_text());
            AssetBundleManager.UnloadAssetBundle("custom/colorsample.unity3d", true, (string)null, false);
            this.SavePresets();
        }
        else
        {
            this.colorInfo = (UI_ColorPresets.ColorInfo)JsonUtility.FromJson <UI_ColorPresets.ColorInfo>(File.ReadAllText(path));
            if (this.colorInfo.lstColorSample.Count != 0)
            {
                return;
            }
            TextAsset textAsset = CommonLib.LoadAsset <TextAsset>("custom/colorsample.unity3d", "ColorPresets", false, string.Empty);
            if (!Object.op_Inequality((Object)null, (Object)textAsset))
            {
                return;
            }
            UI_ColorPresets.ColorInfo colorInfo = (UI_ColorPresets.ColorInfo)JsonUtility.FromJson <UI_ColorPresets.ColorInfo>(textAsset.get_text());
            AssetBundleManager.UnloadAssetBundle("custom/colorsample.unity3d", true, (string)null, false);
            this.colorInfo.lstColorSample = new List <Color>((IEnumerable <Color>)colorInfo.lstColorSample);
            this.SavePresets();
        }
    }