Beispiel #1
0
        public static bool PEGI_Static(ISTD target)
        {
            inspectedSTD = target;

            bool changed = false;

            pegi.write("Load File:", 90);
            target.LoadOnDrop().nl();

            if (icon.Copy.Click("Copy Component Data"))
            {
                STDExtensions.copyBufferValue = target.Encode().ToString();
            }

            var comp = target as ComponentSTD;

            if (comp != null && "Clear Component".Click())
            {
                comp.Reboot();
            }


            pegi.nl();

            return(changed);
        }
Beispiel #2
0
        public StdEncoder Add(string tag, ISTD other)
        {
            if (other != null)
            {
                Add(tag, other.Encode());
            }

            return(this);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public static T TryDecodeInto <T>(this ISTD ovj, Type childType)
        {
            T val = (T)Activator.CreateInstance(childType);

            if (ovj != null)
            {
                var std = val as ISTD;

                if (std != null)
                {
                    std.Decode(ovj.Encode().ToString()); //.DecodeTagsFor(std);
                }
            }

            return(val);
        }
Beispiel #5
0
 public static ISTD SaveToResources(this ISTD s, string ResFolderPath, string InsideResPath, string filename)
 {
     StuffSaver.SaveToResources(ResFolderPath, InsideResPath, filename, s.Encode().ToString());
     return(s);
 }
Beispiel #6
0
 public static ISTD SaveToAssets(this ISTD s, string Path, string filename)
 {
     StuffSaver.Save_ToAssets_ByRelativePath(Path, filename, s.Encode().ToString());
     return(s);
 }
Beispiel #7
0
 public static ISTD SaveToPersistantPath(this ISTD s, string path, string filename)
 {
     StuffSaver.SaveToPersistantPath(path, filename, s.Encode().ToString());
     return(s);
 }