Esempio n. 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);
        }
Esempio n. 2
0
        public override bool Inspect()
        {
            var changed = false;

            InspectionTabs();

            changed |= base.Inspect().nl();

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

                    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) || StdExtensions.LoadOnDrop(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".write(PEGI_Styles.ListLabel);
                pegi.nl();

                changed |= TriggerGroup.all.Inspect <UnNullableCfg <TriggerGroup>, TriggerGroup>(ref inspectedTriggerGroup);

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

            pegi.nl();

            return(changed);
        }