FairyGUI.Window.CenterOn C# (CSharp) Method

CenterOn() public method

Make the window be center of the screen.
public CenterOn ( GRoot r, bool restraint ) : void
r GRoot
restraint bool Add relations to ensure keeping center on screen size changed.
return void
        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);
            }
        }

Usage Example

示例#1
0
 static int CenterOn(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.Window obj  = (FairyGUI.Window)ToLua.CheckObject(L, 1, typeof(FairyGUI.Window));
         FairyGUI.GRoot  arg0 = (FairyGUI.GRoot)ToLua.CheckObject(L, 2, typeof(FairyGUI.GRoot));
         bool            arg1 = LuaDLL.luaL_checkboolean(L, 3);
         obj.CenterOn(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
All Usage Examples Of FairyGUI.Window::CenterOn