public void Setup(UIWidget layout) { var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); layout.SearchWidgetClass("TBButton", dest); for (var ii = 0; ii < dest.Size; ii++) { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUitexturewidgetEvent); } var cache = GetSubsystem <ResourceCache>(); UITextureWidget mytexturewidget = new UITextureWidget(); mytexturewidget.SetId("UITextureWidgetDemo"); Texture2D mytex = new Texture2D(); if (!mytex.Equals(null)) { mytex = cache.GetResource <Texture2D>("Textures/planet.jpg"); mytexturewidget.SetTexture(mytex); } mytexturewidget.SubscribeToEvent <WidgetEvent> (mytexturewidget, HandleUitexturewidgetEvent); UILayoutParams lpx = new UILayoutParams(); lpx.SetWidth(256); lpx.SetHeight(256); lpx.SetMinWidth(256); lpx.SetMinHeight(256); lpx.SetMaxWidth(256); lpx.SetMaxHeight(256); mytexturewidget.SetLayoutParams(lpx); UIWidget lower = layout.GetWidget("uitexturewidgetlower"); UIWidget mysvc = layout.GetWidget("uitwcontainer"); mysvc.AddChildBefore(mytexturewidget, lower); UILayout lo1 = new UILayout(); mysvc.AddChildBefore(lo1, lower); UIButton b1 = new UIButton(); b1.SetId("uitexturewidgetch1"); b1.SetText("Change texture to new build"); lo1.AddChild(b1); b1.SubscribeToEvent <WidgetEvent> (b1, HandleUitexturewidgetEvent); UIButton b2 = new UIButton(); b2.SetId("uitexturewidgetch2"); b2.SetText("Change texture to colorwheel"); lo1.AddChild(b2); b2.SubscribeToEvent <WidgetEvent> (b2, HandleUitexturewidgetEvent); UIButton b3 = new UIButton(); b3.SetId("uitexturewidgetch3"); b3.SetText("Change texture to planet"); lo1.AddChild(b3); b3.SubscribeToEvent <WidgetEvent> (b3, HandleUitexturewidgetEvent); }
public void Setup(UIWidget layout) { var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); layout.SearchWidgetClass("TBButton", dest); for (var ii = 0; ii < dest.Size; ii++) { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUisceneviewEvent); } UISceneView mysceneview = new UISceneView(); // make a scene...view mysceneview.SetId("UISceneViewDemo"); // tag it, in case we want to get it again later mysceneview.SubscribeToEvent <WidgetEvent> (mysceneview, HandleUisceneviewEvent); var cache = GetSubsystem <ResourceCache>(); Scene myscene = new Scene(); if (!myscene.Equals(null)) { if (myscene.LoadXML((cache.GetFile("Scenes/sceneview.scene")))) { Node cameraNode = myscene.GetChild("Camera", true); Camera mycamera = cameraNode.GetComponent <Camera>(); mysceneview.SetView(myscene, mycamera); mysceneview.SetAutoUpdate(true); } } UILayoutParams lpx = new UILayoutParams(); lpx.SetWidth(640); lpx.SetHeight(320); lpx.SetMinWidth(640); lpx.SetMinHeight(320); lpx.SetMaxWidth(640); lpx.SetMaxHeight(320); mysceneview.SetLayoutParams(lpx); UIWidget lower = layout.GetWidget("uisceneviewlower"); UIWidget mysvc = layout.GetWidget("sceneviewcontainer"); mysvc.AddChildBefore(mysceneview, lower); }
public void Setup(UIWidget layout) { var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); layout.SearchWidgetClass("TBButton", dest); for (var ii = 0; ii < dest.Size; ii++) { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUiselectitemEvent); } UISelectList mylist = new UISelectList(); mylist.SetId("UISelectItemList"); // tag it, in case we want to get it again later UILayoutParams lpx = new UILayoutParams(); lpx.SetWidth(200); lpx.SetHeight(256); lpx.SetMinWidth(200); lpx.SetMinHeight(256); lpx.SetMaxWidth(200); lpx.SetMaxHeight(256); mylist.SetLayoutParams(lpx); UIWidget lower = layout.GetWidget("selectitemlower"); UIWidget mysvc = layout.GetWidget("selectitemlayout"); mysvc.AddChildBefore(mylist, lower); mylist.SubscribeToEvent <WidgetEvent> (mylist, HandleUiselectitemEvent); sis = new UISelectItemSource(); sis.AddItem(new UISelectItem("UISelectItem1", "sitem1")); sis.AddItem(new UISelectItem("UISelectItem2", "sitem2")); sis.AddItem(new UISelectItem("UISelectItem3", "sitem3", "DuckButton")); sis.AddItem(new UISelectItem("UISelectItem4", "sitem4", "LogoAtomic")); mylist.SetSource(sis); // assign this into the list }