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

            return(false);
        }
Exemplo n.º 2
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.º 3
0
 public static ISTD LoadFromPersistantPath(this ISTD s, string path, string filename)
 {
     s.Decode(StuffLoader.LoadFromPersistantPath(path, filename));
     return(s);
 }