示例#1
0
 public static T LoadFromResources <T>(this T s, string subFolder, string file) where T : ISTD, new()
 {
     if (s == null)
     {
         s = new T();
     }
     s.Decode(StuffLoader.LoadStoryFromResource(subFolder, file));
     return(s);
 }
示例#2
0
 public static T LoadSavedProgress <T>(this T s, string Folder, string fileName) where T : ISTD, new()
 {
     if (s == null)
     {
         s = new T();
     }
     s.Decode(StuffLoader.Load(Application.persistentDataPath + Folder.AddPreSlashIfNotEmpty().AddPostSlashIfNone() + fileName + StuffSaver.fileType));
     return(s);
 }
示例#3
0
 public static T LoadFromAssets <T>(this T s, string fullPath, string name) where T : ISTD, new()
 {
     if (s == null)
     {
         s = new T();
     }
     s.Decode(StuffLoader.LoadStoryFromAssets(fullPath, name));
     return(s);
 }
示例#4
0
        public bool PEGI(ISTD target)
        {
            bool changed = false;

            inspectedSTD = target;
            inspected    = this;

            var aded = "Saved CFGs:".edit_List(states, ref inspectedState, true, ref changed);

            if (aded != null && target != null)
            {
                aded.dataExplorer.data = target.Encode().ToString();
                aded.NameForPEGI       = target.ToPEGIstring();
                aded.comment           = DateTime.Now.ToString();
            }

            if (inspectedState == -1)
            {
                UnityEngine.Object myType = null;
                if ("From File:".edit(65, ref myType))
                {
                    aded = new SavedISTD();
                    aded.dataExplorer.data = StuffLoader.LoadTextAsset(myType);
                    aded.NameForPEGI       = myType.name;
                    aded.comment           = DateTime.Now.ToString();
                    states.Add(aded);
                }

                var selfSTD = target as IKeepMySTD;

                if (selfSTD != null)
                {
                    if (icon.Save.Click("Save On itself"))
                    {
                        selfSTD.Save_STDdata(); //Config_STD = selfSTD.Encode().ToString();
                    }
                    var slfData = selfSTD.Config_STD;
                    if (slfData != null && slfData.Length > 0 && icon.Load.Click("Load from itself"))
                    {
                        target.Decode(slfData); //.DecodeTagsFor(target);
                    }
                }
                pegi.nl();
            }

            inspectedSTD = null;

            return(changed);
        }
示例#5
0
        public static bool LoadOnDrop <T>(this T obj) where T : ISTD
        {
#if PEGI
            UnityEngine.Object myType = null;
            if (pegi.edit(ref myType))
            {
                obj.Decode(StuffLoader.LoadTextAsset(myType));

                ("Loaded " + myType.name).showNotification();

                return(true);
            }
#endif
            return(false);
        }
示例#6
0
        public bool PEGI()
        {
            if (tags == null && data.Contains("|"))
            {
                Decode(data);//.DecodeTagsFor(this);
            }
            if (tags != null)
            {
                dirty |= tag.edit_List(tags, ref inspectedTag, true);
            }

            if (inspectedTag == -1)
            {
                dirty |= "data".edit(40, ref data);

                UnityEngine.Object myType = null;

                if (pegi.edit(ref myType))
                {
                    dirty = true;
                    data  = StuffLoader.LoadTextAsset(myType);
                }

                if (dirty)
                {
                    if (icon.Refresh.Click("Update data string from tags"))
                    {
                        UpdateData();
                    }

                    if (icon.Load.Click("Load from data String").nl())
                    {
                        tags = null;
                        Decode(data);//.DecodeTagsFor(this);
                        dirty = false;
                    }
                }
            }


            pegi.nl();

            return(dirty);
        }
示例#7
0
 public static ISTD LoadFromPersistantPath(this ISTD s, string path, string filename)
 {
     s.Decode(StuffLoader.LoadFromPersistantPath(path, filename));
     return(s);
 }