Beispiel #1
0
        public static bool LoadOnDrop(out string txt)
        {
            txt = null;
#if !NO_PEGI
            UnityEngine.Object myType = null;
            if (pegi.edit(ref myType))
            {
                txt = FileLoadUtils.LoadTextAsset(myType);
                ("Loaded " + myType.name).showNotificationIn3D_Views();

                return(true);
            }
#endif
            return(false);
        }
Beispiel #2
0
        public bool Inspect()
        {
            if (_tags == null && data.Contains("|"))
            {
                Decode(data);//.DecodeTagsFor(this);
            }
            if (_tags != null)
            {
                tag.edit_List(ref _tags, ref inspectedTag).changes(ref dirty);
            }

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

                UnityEngine.Object myType = null;

                if (pegi.edit(ref myType))
                {
                    dirty = true;
                    data  = FileLoadUtils.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);
        }
Beispiel #3
0
        public bool Inspect(ICfg target)
        {
            var changed = false;

            inspectedCfg = target;
            inspected    = this;

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

            if (added != null && target != null)
            {
                added.dataExplorer.data = target.Encode().ToString();
                added.NameForPEGI       = target.ToPegiString();
                added.comment           = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            }

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

                var selfStd = target as IKeepMyCfg;

                if (selfStd != null)
                {
                    if (icon.Save.Click("Save itself (IKeepMySTD)"))
                    {
                        selfStd.SaveStdData();
                    }
                    var slfData = selfStd.ConfigStd;
                    if (!string.IsNullOrEmpty(slfData))
                    {
                        if (icon.Load.Click("Use IKeepMySTD data to create new CFG"))
                        {
                            var ss = new SavedIstd();
                            states.Add(ss);
                            ss.dataExplorer.data = slfData;
                            ss.NameForPEGI       = "from Keep my STD";
                            ss.comment           = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                        }

                        if (icon.Refresh.Click("Load from itself (IKeepMySTD)"))
                        {
                            target.Decode(slfData);
                        }
                    }
                }
                pegi.nl();
            }

            inspectedCfg = null;

            return(changed);
        }