private void __mousedown() { _down = true; Stage.inst.onMouseUp.Add(__mouseup); if (_mode == ButtonMode.Common) { SetState(DOWN); } if (linkedPopup != null) { if (linkedPopup is Window) { ((Window)linkedPopup).ToggleStatus(); } else { GRoot r = this.root; if (r != null) { r.TogglePopup(linkedPopup, this); } } } }
void __showSubMenu(object param) { if (contentPane.isDisposed) { return; } GObject item = (GObject)param; GRoot r = contentPane.root; if (r == null) { return; } if (_expandingItem != null) { if (_expandingItem == item) { return; } CloseSubMenu(null); } PopupMenu popup = item.data as PopupMenu; if (popup == null) { return; } ShowSubMenu(item); }
/// <summary> /// /// </summary> /// <param name="target"></param> /// <param name="dir"></param> /// <param name="parentMenu"></param> public void Show(GObject target, PopupDirection dir, PopupMenu parentMenu) { GRoot r = target != null ? target.root : GRoot.inst; r.ShowPopup(this.contentPane, (target is GRoot) ? null : target, dir); _parentMenu = parentMenu; }
protected void ShowDropdown() { if (_itemsUpdated) { _itemsUpdated = false; _list.RemoveChildrenToPool(); int cnt = _items.Length; for (int i = 0; i < cnt; i++) { GObject item = _list.AddItemFromPool(); item.text = _items[i]; item.name = i < _values.Length ? _values[i] : string.Empty; } _list.ResizeToFit(visibleItemCount); } _list.selectedIndex = -1; _dropdownObject.width = this.width; GRoot r = this.root; if (r != null) { r.TogglePopup(_dropdownObject, this, true); } if (_dropdownObject.parent != null) { _dropdownObject.displayObject.onRemovedFromStage.Add(__popupWinClosed); SetState(GButton.DOWN); } }
/// <summary> /// Make the window be center of the screen. /// </summary> /// <param name="r"></param> /// <param name="restraint">Add relations to ensure keeping center on screen size changed.</param> public void CenterOn(GRoot r, bool restraint) { this.SetXY((int)((r.width - this.width) / 2), (int)((r.height - this.height) / 2)); if (restraint) { this.AddRelation(r, RelationType.Center_Center); this.AddRelation(r, RelationType.Middle_Middle); } }
private void __rollOut() { GRoot r = this.root; if (r != null) { r.HideTooltips(); } }
private void __rollOver() { GRoot r = this.root; if (r != null) { r.ShowTooltips(tooltips); } }
public void HideImmediately() { GRoot r = (parent is GRoot) ? (GRoot)parent : null; if (r == null) { r = GRoot.inst; } r.HideWindowImmediately(this); }
public void BringToFront() { GRoot r = this.root; if (r == null) { r = GRoot.inst; } r.ShowWindow(this); }
public void Show(GObject target, object downward) { GRoot r = target != null ? target.root : null; if (r == null) { r = GRoot.inst; } r.ShowPopup(this.contentPane, target, downward); }
public static GRoot Instantiate() { GRoot r = new GRoot(); if (inst == null) { inst = r; } Stage.inst.AddChild(r.displayObject); return(r); }
/// <summary> /// Transforms a point from the GRoot coordinate to local coordinates system. /// </summary> /// <param name="pt"></param> /// <param name="r"></param> /// <returns></returns> public Vector2 RootToLocal(Vector2 pt, GRoot r) { if (r == null || r == GRoot.inst) { //fast pt.x *= GRoot.contentScaleFactor; pt.y *= GRoot.contentScaleFactor; } else { pt = r.LocalToGlobal(pt); } return(displayObject.GlobalToLocal(pt)); }
/// <summary> /// Transforms a point from the local coordinate system to GRoot coordinates. /// </summary> /// <param name="pt"></param> /// <param name="r"></param> /// <returns></returns> public Vector2 LocalToRoot(Vector2 pt, GRoot r) { pt = displayObject.LocalToGlobal(pt); if (r == null || r == GRoot.inst) { //fast pt.x /= GRoot.contentScaleFactor; pt.y /= GRoot.contentScaleFactor; } else { return(r.GlobalToLocal(pt)); } return(pt); }
public void RequestFocus() { GRoot r = this.root; if (r != null) { GObject p = this; while (p != null && !p._focusable) { p = p.parent; } if (p != null) { r.focus = p; } } }
private void __clickItem(EventContext context) { GButton item = ((GObject)context.data).asButton; if (item == null) { return; } if (item.grayed) { _list.selectedIndex = -1; return; } Controller c = item.GetController("checked"); if (c != null && c.selectedIndex != 0) { if (c.selectedIndex == 1) { c.selectedIndex = 2; } else { c.selectedIndex = 1; } } GRoot r = (GRoot)_contentPane.parent; r.HidePopup(this.contentPane); if (item.data is EventCallback0) { ((EventCallback0)item.data)(); } else if (item.data is EventCallback1) { ((EventCallback1)item.data)(context); } }
static int ShowPopup(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1); FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2); obj.ShowPopup(arg0); return(0); } else if (count == 3) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1); FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2); FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 3); obj.ShowPopup(arg0, arg1); return(0); } else if (count == 4) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1); FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2); FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 3); object arg2 = ToLua.ToVarObject(L, 4); obj.ShowPopup(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GRoot.ShowPopup")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int TogglePopup(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GRoot), typeof(FairyGUI.GObject))) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.ToObject(L, 1); FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.ToObject(L, 2); obj.TogglePopup(arg0); return(0); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GRoot), typeof(FairyGUI.GObject), typeof(FairyGUI.GObject))) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.ToObject(L, 1); FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.ToObject(L, 2); FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.ToObject(L, 3); obj.TogglePopup(arg0, arg1); return(0); } else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GRoot), typeof(FairyGUI.GObject), typeof(FairyGUI.GObject), typeof(object))) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.ToObject(L, 1); FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.ToObject(L, 2); FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.ToObject(L, 3); object arg2 = ToLua.ToVarObject(L, 4); obj.TogglePopup(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GRoot.TogglePopup")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetContentScaleFactor(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.SetContentScaleFactor(arg0); return(0); } else if (count == 3) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); obj.SetContentScaleFactor(arg0, arg1); return(0); } else if (count == 4) { FairyGUI.GRoot obj = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); FairyGUI.UIContentScaler.ScreenMatchMode arg2 = (FairyGUI.UIContentScaler.ScreenMatchMode)ToLua.CheckObject(L, 4, typeof(FairyGUI.UIContentScaler.ScreenMatchMode)); obj.SetContentScaleFactor(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GRoot.SetContentScaleFactor")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int _CreateFairyGUI_GRoot(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { FairyGUI.GRoot obj = new FairyGUI.GRoot(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.GRoot.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void __rollOut(EventContext context) { if (_expandingItem == null) { return; } Timers.inst.Remove(_showSubMenu); GRoot r = contentPane.root; if (r != null) { PopupMenu popup = (PopupMenu)_expandingItem.data; Vector2 pt = popup.contentPane.GlobalToLocal(context.inputEvent.position); if (pt.x >= 0 && pt.y >= 0 && pt.x < popup.contentPane.width && pt.y < popup.contentPane.height) { return; } } CloseSubMenu(null); }
static public int SetContentScaleFactor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 3) { FairyGUI.GRoot self = (FairyGUI.GRoot)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.SetContentScaleFactor(a1, a2); pushValue(l, true); return(1); } else if (argc == 4) { FairyGUI.GRoot self = (FairyGUI.GRoot)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); FairyGUI.UIContentScaler.ScreenMatchMode a3; checkEnum(l, 4, out a3); self.SetContentScaleFactor(a1, a2, a3); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// /// </summary> /// <param name="r"></param> public void ShowOn(GRoot r) { r.ShowWindow(this); }
public static GRoot Instantiate() { GRoot r = new GRoot(); if (inst == null) inst = r; Stage.inst.AddChild(r.displayObject); return r; }
/// <summary> /// /// </summary> /// <param name="r"></param> public void ShowOn(GRoot r) { //r.ShowWindow(this); OnGetGlobalIndex(); r.ShowWindow(this, _global_index); }
/// <summary> /// /// </summary> /// <param name="target"></param> /// <param name="downward"></param> public void Show(GObject target, object downward) { GRoot r = target != null ? target.root : GRoot.inst; r.ShowPopup(this.contentPane, (target is GRoot) ? null : target, downward); }
/// <summary> /// Transforms a point from the GRoot coordinate to local coordinates system. /// </summary> /// <param name="pt"></param> /// <param name="r"></param> /// <returns></returns> public Vector2 RootToLocal(Vector2 pt, GRoot r) { if (r == null || r == GRoot.inst) { //fast pt.x *= GRoot.contentScaleFactor; pt.y *= GRoot.contentScaleFactor; } else pt = r.LocalToGlobal(pt); return GlobalToLocal(pt); }
/// <summary> /// Transforms a point from the local coordinate system to GRoot coordinates. /// </summary> /// <param name="pt"></param> /// <param name="r"></param> /// <returns></returns> public Vector2 LocalToRoot(Vector2 pt, GRoot r) { pt = LocalToGlobal(pt); if (r == null || r == GRoot.inst) { //fast pt.x /= GRoot.contentScaleFactor; pt.y /= GRoot.contentScaleFactor; } else return r.GlobalToLocal(pt); return pt; }
public static void ClearInst() { inst.Dispose(); _inst = null; }