public override ContextMenu GetContextMenu()
        {
            FieldBinding    radioBinding = new FieldBinding((object)this, "contains");
            EditorGroupMenu contextMenu  = base.GetContextMenu() as EditorGroupMenu;

            contextMenu.InitializeGroups(new EditorGroup(typeof(PhysicsObject)), radioBinding);
            return((ContextMenu)contextMenu);
        }
        public void InitializeGroups(
            EditorGroup group,
            FieldBinding radioBinding  = null,
            EditorGroup scriptingGroup = null)
        {
            ++EditorGroupMenu.deep;
            this._text      = group.Name;
            this.itemSize.x = (float)(this._text.Length * 8 + 16);
            foreach (EditorGroup subGroup in group.SubGroups)
            {
                EditorGroupMenu editorGroupMenu = new EditorGroupMenu((IContextListener)this);
                editorGroupMenu.fancy = this.fancy;
                editorGroupMenu.InitializeGroups(subGroup, radioBinding);
                if (!editorGroupMenu.greyOut)
                {
                    this.greyOut = false;
                }
                if (!editorGroupMenu.willOnlineGrayout)
                {
                    this.willOnlineGrayout = false;
                }
                this.AddItem((ContextMenu)editorGroupMenu);
            }
            if (scriptingGroup != null)
            {
                EditorGroupMenu editorGroupMenu = new EditorGroupMenu((IContextListener)this);
                editorGroupMenu.InitializeGroups(scriptingGroup, radioBinding);
                if (!editorGroupMenu.greyOut)
                {
                    this.greyOut = false;
                }
                if (!editorGroupMenu.willOnlineGrayout)
                {
                    this.willOnlineGrayout = false;
                }
                this.AddItem((ContextMenu)editorGroupMenu);
            }
            foreach (Thing allThing in group.AllThings)
            {
                IReadOnlyPropertyBag bag = ContentProperties.GetBag(allThing.GetType());
                if (Main.isDemo && bag.GetOrDefault <bool>("isInDemo", false))
                {
                    this.greyOut = false;
                }
                if (bag.GetOrDefault <bool>("isOnlineCapable", true))
                {
                    this.greyOut           = false;
                    this.willOnlineGrayout = false;
                }
                switch (allThing)
                {
                case BackgroundTile _:
                case ForegroundTile _:
                case SubBackgroundTile _:
                    ContextBackgroundTile contextBackgroundTile = new ContextBackgroundTile(allThing, (IContextListener)this);
                    contextBackgroundTile.contextThing = allThing;
                    this.AddItem((ContextMenu)contextBackgroundTile);
                    continue;

                default:
                    if (radioBinding != null)
                    {
                        if (radioBinding.value is IList)
                        {
                            if (radioBinding.value is List <TypeProbPair> )
                            {
                                ContextSlider contextSlider = new ContextSlider(allThing.editorName, (IContextListener)this, radioBinding, 0.05f, myType: allThing.GetType());
                                contextSlider.greyOut      = Main.isDemo && !bag.GetOrDefault <bool>("isInDemo", false);
                                contextSlider.contextThing = allThing;
                                if (!bag.Contains("isOnlineCapable") || bag.Get <bool>("isOnlineCapable"))
                                {
                                    this.willOnlineGrayout = false;
                                }
                                this.AddItem((ContextMenu)contextSlider);
                                continue;
                            }
                            ContextCheckBox contextCheckBox = new ContextCheckBox(allThing.editorName, (IContextListener)this, radioBinding, allThing.GetType());
                            contextCheckBox.greyOut      = Main.isDemo && !bag.GetOrDefault <bool>("isInDemo", false);
                            contextCheckBox.contextThing = allThing;
                            if (!bag.Contains("isOnlineCapable") || bag.Get <bool>("isOnlineCapable"))
                            {
                                this.willOnlineGrayout = false;
                            }
                            this.AddItem((ContextMenu)contextCheckBox);
                            continue;
                        }
                        ContextRadio contextRadio = new ContextRadio(allThing.editorName, false, (object)allThing.GetType(), (IContextListener)this, radioBinding);
                        contextRadio.greyOut      = Main.isDemo && !bag.GetOrDefault <bool>("isInDemo", false);
                        contextRadio.contextThing = allThing;
                        if (!bag.Contains("isOnlineCapable") || bag.Get <bool>("isOnlineCapable"))
                        {
                            this.willOnlineGrayout = false;
                        }
                        this.AddItem((ContextMenu)contextRadio);
                        continue;
                    }
                    ContextObject contextObject = new ContextObject(allThing, (IContextListener)this);
                    contextObject.contextThing = allThing;
                    this.AddItem((ContextMenu)contextObject);
                    continue;
                }
            }
            --EditorGroupMenu.deep;
            if (EditorGroupMenu.deep != 0)
            {
                return;
            }
            this.UpdateGrayout();
        }