예제 #1
0
        public virtual bool Inspect()
        {
            var changed = pegi.toggleDefaultInspector(this);

            pegi.nl();

            if (inspectedTriggerGroup == -1)
            {
                #region Paste Options

                if ("Paste Options".foldout().nl())
                {
                    if (_replaceReceived != null)
                    {
                        var current = TriggerGroup.all.GetIfExists(_replaceReceived.IndexForPEGI);
                        var hint    = (current != null)
                            ? "{0} [ Old: {1} => New: {2} triggers ] ".F(_replaceReceived.NameForPEGI, current.Count,
                                                                         _replaceReceived.Count)
                            : _replaceReceived.NameForPEGI;

                        if (hint.enter(ref _inspectReplacementOption))
                        {
                            _replaceReceived.Nested_Inspect();
                        }
                        else
                        {
                            if (icon.Done.ClickUnFocus())
                            {
                                TriggerGroup.all[_replaceReceived.IndexForPEGI] = _replaceReceived;
                                _replaceReceived = null;
                            }

                            if (icon.Close.ClickUnFocus())
                            {
                                _replaceReceived = null;
                            }
                        }
                    }
                    else
                    {
                        var tmp = "";
                        if ("Paste Messaged STD data".edit(140, ref tmp) || CfgExtensions.DropStringObject(out tmp))
                        {
                            var group = new TriggerGroup();
                            group.DecodeFromExternal(tmp);

                            var current = TriggerGroup.all.GetIfExists(group.IndexForPEGI);

                            if (current == null)
                            {
                                TriggerGroup.all[group.IndexForPEGI] = group;
                            }
                            else
                            {
                                _replaceReceived = group;
                                if (!_replaceReceived.NameForPEGI.SameAs(current.NameForPEGI))
                                {
                                    _replaceReceived.NameForPEGI += " replaces {0}".F(current.NameForPEGI);
                                }
                            }
                        }
                    }

                    pegi.nl();
                }

                #endregion

                "Trigger Groups".nl(PEGI_Styles.ListLabel);
            }

            ExtensionsForGenericCountless.Inspect <UnNullableCfg <TriggerGroup>, TriggerGroup>(TriggerGroup.all, ref inspectedTriggerGroup).changes(ref changed);

            if (inspectedTriggerGroup == -1)
            {
                "At Index: ".edit(60, ref tmpIndex);
                if (tmpIndex >= 0 && TriggerGroup.all.TryGet(tmpIndex) == null && icon.Add.ClickUnFocus("Create New Group"))
                {
                    TriggerGroup.all[tmpIndex].NameForPEGI = "Group " + tmpIndex;
                    tmpIndex++;
                }
                pegi.nl();

                "Adding a group will also try to load it".writeHint();
                pegi.nl();
            }

            pegi.nl();



            return(changed);
        }
예제 #2
0
        public bool Inspect()
        {
            var changed = false;

            var newBook = "Books ".edit_List(ref all, ref _inspectedBook, ref changed);

            if (newBook != null)
            {
                newBook.authorName = Shortcuts.users.current.Name;
            }

            if (_inspectedBook == -1)
            {
                #region Paste Options

                if (_replaceReceived != null)
                {
                    if (_replaceReceived.NameForPEGI.enter(ref _inspectReplacementOption))
                    {
                        _replaceReceived.Nested_Inspect();
                    }
                    else
                    {
                        if (icon.Done.ClickUnFocus())
                        {
                            var el = all.GetByIGotName(_replaceReceived);
                            if (el != null)
                            {
                                all[all.IndexOf(el)] = _replaceReceived;
                            }
                            else
                            {
                                all.Add(_replaceReceived);
                            }

                            _replaceReceived = null;
                        }

                        if (icon.Close.ClickUnFocus())
                        {
                            _replaceReceived = null;
                        }
                    }
                }
                else
                {
                    string tmp = "";
                    if ("Paste Messaged Book".edit(140, ref tmp) || CfgExtensions.DropStringObject(out tmp))
                    {
                        var book = new NodeBook();
                        book.DecodeFromExternal(tmp);
                        if (all.GetByIGotName(book.NameForPEGI) == null)
                        {
                            all.Add(book);
                        }
                        else
                        {
                            _replaceReceived = book;
                        }
                    }
                }
                pegi.nl();

                #endregion
            }
            return(changed);
        }