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++) // set bulk event handlers on all buttons -- boom! { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUibuttonEvent); } }
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], HandleUiskinimageEvent); } }
public void Setup(UILayout mylayout) { UILayout pgtable = (UILayout)mylayout.GetWidget("pagetable"); var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); pgtable.SearchWidgetClass("TBButton", dest); for (var ii = 0; ii < dest.Size; ii++) // set bulk event handlers on all buttons -- boom! { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleTableEvent); } }
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], HandleUifontdescriptionEvent); } UIWidget demo = layout.GetWidget("fontstep"); if (!demo.Equals(null)) { demo.SubscribeToEvent <WidgetEvent> (demo, HandleUifontdescriptionEvent); } }
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], HandleUimenuitemEvent); } mis = new UIMenuItemSource(); mis.AddItem(new UIMenuItem("UISelectItem1", "item1")); mis.AddItem(new UIMenuItem("UISelectItem2", "item2", "Ctrl+.")); mis.AddItem(new UIMenuItem("UISelectItem3", "item3", "Ctrl+A", "DuckButton")); mis.AddItem(new UIMenuItem("UISelectItem4", "item4", "Ctrl+O", "LogoAtomic")); }
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], HandleUicheckboxEvent); } UIWidget demochk = layout.GetWidget("democheck"); if (!demochk.Equals(null)) { demochk.SubscribeToEvent <WidgetEvent> (demochk, HandleUicheckboxEvent); } }
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], HandleUitabcontainerEvent); } UITabContainer demo = (UITabContainer)layout.GetWidget("UITabContainerDemo"); if (!demo.Equals(null)) { demo.SetCurrentPage(0); //spammy demo.SubscribeToEvent<WidgetEvent>( HandleAllTabcontainerEvent ); } }
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], HandleUisectionEvent); } UIWidget sec1 = layout.GetWidget("UISectionDemo"); if (!sec1.Equals(null)) { sec1.SubscribeToEvent <WidgetEvent> (sec1, HandleUisectionEvent); } UIWidget sec2 = layout.GetWidget("UISection2Demo"); if (!sec2.Equals(null)) { sec2.SubscribeToEvent <WidgetEvent> (sec2, HandleUisectionEvent); } }
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], HandleUiinlineselectEvent); } UIWidget demo1 = layout.GetWidget("ilsstep"); if (!demo1.Equals(null)) { demo1.SubscribeToEvent <WidgetEvent> (demo1, HandleUiinlineselectEvent); } UIWidget demo2 = layout.GetWidget("inlineselectdemo"); if (!demo2.Equals(null)) { demo2.SubscribeToEvent <WidgetEvent> (demo2, HandleUiinlineselectEvent); } }
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 }
public void Setup(UIWidget layout) { layoutomaticstr = "XGCPC"; 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], HandleUilayoutEvent); } UILayout myc = (UILayout)layout.GetWidget("uilayoutcontainer"); // get the container layout UIButton tf0 = new UIButton(); // the layout-o-matic spawner tf0.SetText("LAYOUT-O-MATIC"); tf0.SetId("go_layout_config"); UILayout lo0 = new UILayout(); lo0.SetId("target_layout"); lo0.SetLayoutConfig("-----"); lo0.Load("Scenes/simp_button.ui.txt"); lo0.AddChildBefore(tf0, lo0.GetFirstChild()); myc.AddChild(lo0); // drop it in tf0.SubscribeToEvent <WidgetEvent> (tf0, HandleUilayoutEvent); UITextField tf1 = new UITextField(); tf1.SetText("layout config XACAC"); UILayout lo1 = new UILayout(); lo1.SetLayoutConfig("XACAC"); lo1.Load("Scenes/simp_button.ui.txt"); lo1.AddChildBefore(tf1, lo1.GetFirstChild()); myc.AddChild(lo1); UITextField tf2 = new UITextField(); tf2.SetText("layout config XGCAC"); UILayout lo2 = new UILayout(); lo2.SetLayoutConfig("XGCAC"); lo2.Load("Scenes/simp_button.ui.txt"); lo2.AddChildBefore(tf2, lo2.GetFirstChild()); myc.AddChild(lo2); UITextField tf3 = new UITextField(); tf3.SetText("layout config XPCAC"); UILayout lo3 = new UILayout(); lo3.SetLayoutConfig("XPCAC"); lo3.Load("Scenes/simp_button.ui.txt"); lo3.AddChildBefore(tf3, lo3.GetFirstChild()); myc.AddChild(lo3); UITextField tf4 = new UITextField(); tf4.SetText("layout config XACGC"); UILayout lo4 = new UILayout(); lo4.SetLayoutConfig("XACGC"); lo4.Load("Scenes/simp_button.ui.txt"); lo4.AddChildBefore(tf4, lo4.GetFirstChild()); myc.AddChild(lo4); UITextField tf5 = new UITextField(); tf5.SetText("layout config XGRGC"); UILayout lo5 = new UILayout(); lo5.SetLayoutConfig("XGRGC"); lo5.Load("Scenes/simp_button.ui.txt"); lo5.AddChildBefore(tf5, lo5.GetFirstChild()); myc.AddChild(lo5); UITextField tf6 = new UITextField(); tf6.SetText("layout config XPLGC"); UILayout lo6 = new UILayout(); lo6.SetLayoutConfig("XPLGC"); lo6.Load("Scenes/simp_button.ui.txt"); lo6.AddChildBefore(tf6, lo6.GetFirstChild()); myc.AddChild(lo6); UITextField tf7 = new UITextField(); tf7.SetText("layout config XACPC"); UILayout lo7 = new UILayout(); lo7.SetLayoutConfig("XACPC"); lo7.Load("Scenes/simp_button.ui.txt"); lo7.AddChildBefore(tf7, lo7.GetFirstChild()); myc.AddChild(lo7); UITextField tf8 = new UITextField(); tf8.SetText("layout config XGLPL"); UILayout lo8 = new UILayout(); lo8.SetLayoutConfig("XGLPL"); lo8.Load("Scenes/simp_button.ui.txt"); lo8.AddChildBefore(tf8, lo8.GetFirstChild()); myc.AddChild(lo8); UITextField tf9 = new UITextField(); tf9.SetText("layout config XPCPR"); UILayout lo9 = new UILayout(); lo9.SetLayoutConfig("XPCPR"); lo9.Load("Scenes/simp_button.ui.txt"); lo9.AddChildBefore(tf9, lo9.GetFirstChild()); myc.AddChild(lo9); }
private static void HandleUilayoutEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "go_layout_config") // its LAYOUT-O-MATIC time. { AtomicMain.AppLog("UILayout action : " + widget.GetId() + " was pressed, its LAYOUT-O-MATIC time"); UIView someview = widget.GetView(); UIWindow window = new UIWindow(); window.SetSettings(UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_DEFAULT); window.SetText("LAYOUT-O-MATIC(tm)"); window.Load("Scenes/view_layout.ui.txt"); window.ResizeToFitContent(); someview.AddChild(window); UIWidget okbutt = window.GetWidget("ok"); okbutt.SubscribeToEvent <WidgetEvent> (okbutt, HandleUilayoutEvent); var lox = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); window.SearchWidgetClass("TBRadioButton", lox); for (var ii = 0; ii < lox.Size; ii++) { lox[ii].SubscribeToEvent <WidgetEvent> (lox [ii], HandleUilayoutEvent); } } if (widget.GetId() == "ok") { UIWindow mywindow = (UIWindow)AtomicMain.FindTheWindowParent(widget); if (!mywindow.Equals(null)) { mywindow.Close(); } } if (widget.GetId() == "set_ax") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(0, 'X'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_ay") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(0, 'Y'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_sza") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(1, 'A'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_szg") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(1, 'G'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_szp") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(1, 'P'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posc") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'C'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posg") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'G'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posl") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'L'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posr") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'R'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dista") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(3, 'A'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_distg") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(3, 'G'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_distp") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(3, 'P'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dpc") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(4, 'C'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dpl") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(4, 'L'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dpr") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(4, 'R'); targetl.SetLayoutConfig(layoutomaticstr); } } } } }