protected override void ProcessRecord() { Name = "new name"; var outputVar = new SomeCustomClass { Name = Name, Description = Description } WriteObject(outputVar); }
protected override void ProcessRecord() { var SomeCustomObject = new SomeCustomClass { Name = "some name", Description = "some description" }; WriteObject(SomeCustomObject); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); var customMenuStyle = new OdinMenuStyle { BorderPadding = 0f, AlignTriangleLeft = true, TriangleSize = 16f, TrianglePadding = 0f, Offset = 20f, Height = 23, IconPadding = 0f, BorderAlpha = 0.323f }; tree.DefaultMenuStyle = customMenuStyle; tree.Config.DrawSearchToolbar = true; // Adds the custom menu style to the tree, so that you can play around with it. // Once you are happy, you can press Copy C# Snippet copy its settings and paste it in code. // And remove the "Menu Style" menu item from the tree. tree.AddObjectAtPath("Configuración de la ventana", tree.DefaultMenuStyle) .AddThumbnailIcons(); for (int i = 0; i < 5; i++) { var customObject = new SomeCustomClass() { Name = i.ToString() }; var customMenuItem = new MyCustomMenuItem(tree, customObject); tree.AddMenuItemAtPath("Jugadores", customMenuItem); } tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Tree", "Plugins", typeof(ScriptableObject), true, false) .AddThumbnailIcons() .SortMenuItemsByName(); tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Flat", "Plugins", typeof(ScriptableObject), true, true) .AddThumbnailIcons(true) .SortMenuItemsByName(); tree.AddAllAssetsAtPath("Only Configs has Icons", "Plugins/Sirenix", true, false) .Where(x => x.ObjectInstance as ScriptableObject) .AddThumbnailIcons(); return(tree); }
public void GettingSettingAndDeletingWorks() { // AppVeyor Chutzpah engine adjustment if (Bridge.ClientTest.Utilities.BrowserHelper.IsPhantomJs()) { Assert.True(true, "Not running WeapMap tests as not supported in PhantomJS. See https://github.com/ariya/phantomjs/issues/13652"); return; } var someValue = new SomeCustomClass { SomeProperty = 456 }; var someKey = new SomeCustomClass(); var someOtherKey = new SomeCustomClass(); Assert.AreEqual(someKey, someOtherKey, "Keys sanity check"); //sanity check var amap = new WeakMap(); amap.Set(someKey, someValue); Assert.True(amap.Has(someKey), "Has someKey"); Assert.False(amap.Has(someOtherKey), "Does not have someOtherKey"); var v = amap.Get(someKey); Assert.NotNull(v, "Get not null"); var typedV = v as SomeCustomClass; Assert.NotNull(typedV, "Get not null SomeCustomClass"); Assert.AreEqual(typedV.SomeProperty, 456, "Check SomeProperty"); Assert.AreEqual(someValue, v, "Check references"); Assert.True(amap.Delete(someKey), "Delete someKey"); Assert.False(amap.Delete(someKey), "Another delete someKey"); Assert.False(amap.Has(someKey), "Check if has deleted someKey"); Assert.AreEqual(Script.Undefined, amap.Get(someKey), "Get deleted someKey"); }
public MyCustomMenuItem(OdinMenuTree tree, SomeCustomClass instance) : base(tree, instance.Name, instance) { this.instance = instance; }