Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }