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 override ContextMenu GetContextMenu() { EditorGroupMenu contextMenu = base.GetContextMenu() as EditorGroupMenu; contextMenu.AddItem((ContextMenu) new ContextSlider("Angle", (IContextListener)null, new FieldBinding((object)this, "fireDirection", max: 360f), 1f)); contextMenu.AddItem((ContextMenu) new ContextSlider("Power", (IContextListener)null, new FieldBinding((object)this, "firePower", 1f, 20f))); return((ContextMenu)contextMenu); }
public override ContextMenu GetContextMenu() { EditorGroupMenu contextMenu = base.GetContextMenu() as EditorGroupMenu; contextMenu.AddItem((ContextMenu) new ContextRadio("Up", this.direction == 0, (object)0, (IContextListener)null, new FieldBinding((object)this, "direction"))); contextMenu.AddItem((ContextMenu) new ContextRadio("Down", this.direction == 1, (object)1, (IContextListener)null, new FieldBinding((object)this, "direction"))); contextMenu.AddItem((ContextMenu) new ContextRadio("Left", this.direction == 2, (object)2, (IContextListener)null, new FieldBinding((object)this, "direction"))); contextMenu.AddItem((ContextMenu) new ContextRadio("Right", this.direction == 3, (object)3, (IContextListener)null, new FieldBinding((object)this, "direction"))); return((ContextMenu)contextMenu); }
public void InitializeTeams(FieldBinding radioBinding) { this.AddItem((ContextMenu) new ContextRadio("None", false, (object)0, (IContextListener)this, radioBinding)); EditorGroupMenu editorGroupMenu = (EditorGroupMenu)null; int num1 = 0; if (Teams.all.Count > 10) { editorGroupMenu = new EditorGroupMenu((IContextListener)this); editorGroupMenu.text = "Hats " + (object)num1; } int num2 = 0; for (int index = 0; index < Teams.all.Count; ++index) { if (index >= 4) { ContextRadio contextRadio = new ContextRadio(Teams.all[index].name, false, (object)index, (IContextListener)this, radioBinding); if (editorGroupMenu != null) { editorGroupMenu.AddItem((ContextMenu)contextRadio); } else { this.AddItem((ContextMenu)contextRadio); } ++num2; if (num2 == 10) { ++num1; num2 = 0; this.AddItem((ContextMenu)editorGroupMenu); editorGroupMenu = new EditorGroupMenu((IContextListener)this); editorGroupMenu.text = "Hats " + (object)num1; } } } if (editorGroupMenu == null || num2 <= 0) { return; } this.AddItem((ContextMenu)editorGroupMenu); }
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(); }