Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public StdEncoder Add(string tag, ISTD other)
        {
            if (other != null)
            {
                Add(tag, other.Encode());
            }

            return(this);
        }
Exemplo n.º 3
0
        public static bool Decode_ifNotNull(this ISTD istd, string data)
        {
            if (istd != null)
            {
                istd.Decode(data);
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        public static void UpdatePrefab(this ISTD s, GameObject go)
        {
            var iK = s as IKeepMySTD;

            if (iK != null)
            {
                iK.Save_STDdata();
            }

            go.UpdatePrefab();
        }
Exemplo n.º 5
0
        public StdEncoder Add(string tag, ISTD other, ISTD_SerializeNestedReferences referencesKeeper)
        {
            var prevKeeper = keeper;

            keeper = referencesKeeper;

            Add(tag, other);

            keeper = prevKeeper;
            return(this);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        /* public static bool PEGI_Static(iSTD target)
         * {
         *   return iSTD_ExplorerData.PEGI_Static(target);
         * }*/

        public bool PEGI()
        {
            UnityEngine.Object obj = ConnectSTD == null ? null : ConnectSTD as UnityEngine.Object;
            if ("Target Obj: ".edit(60, ref obj) && obj != null)
            {
                ConnectSTD = obj as ISTD;
            }


            MonoBehaviour mono = ConnectSTD == null ? null : ConnectSTD as MonoBehaviour;

            if ("Target Obj: ".edit(60, ref mono).nl() && mono != null)
            {
                ConnectSTD = mono as ISTD;
            }


            return(data.PEGI(ConnectSTD));
        }
Exemplo n.º 9
0
 public static ISTD SaveToResources(this ISTD s, string ResFolderPath, string InsideResPath, string filename)
 {
     StuffSaver.SaveToResources(ResFolderPath, InsideResPath, filename, s.Encode().ToString());
     return(s);
 }
Exemplo n.º 10
0
 public static ISTD SaveToAssets(this ISTD s, string Path, string filename)
 {
     StuffSaver.Save_ToAssets_ByRelativePath(Path, filename, s.Encode().ToString());
     return(s);
 }
Exemplo n.º 11
0
 public static ISTD LoadFromPersistantPath(this ISTD s, string path, string filename)
 {
     s.Decode(StuffLoader.LoadFromPersistantPath(path, filename));
     return(s);
 }
Exemplo n.º 12
0
 public static ISTD SaveToPersistantPath(this ISTD s, string path, string filename)
 {
     StuffSaver.SaveToPersistantPath(path, filename, s.Encode().ToString());
     return(s);
 }