public UIMenuItem AddItem(string text) { int xs = 0; foreach (var i in Sub) { xs += (int)i.WidW + 5; // i.WidW = UISys.Skin().SmallFont.Width(i.Name) + 5; //i.WidH = 25; } UIMenuItem ni = new UIMenuItem(text, null, true) { WidX = (int)0, WidW = UISys.Skin().SmallFont.Width(text) + 10, WidH = 22 }; UIPanel np = new UIPanel(10 + xs, 2, (int)ni.WidW, 22, "", this); np.Flat = true; np.AddWidget(ni); return(ni); }
private void Init() { //服务模块初始化 NetSvc netSvc = GetComponent <NetSvc>(); netSvc.InitSvc(); ResSvc res = GetComponent <ResSvc>(); res.InitSvc(); AudioSvc audio = GetComponent <AudioSvc>(); audio.InitSvc(); TimerSvc timerSvc = GetComponent <TimerSvc>(); timerSvc.InitSvc(); //业务系统初始化 UISys uiSys = GetComponent <UISys>(); uiSys.InitSys(); BattleSys battleSys = GetComponent <BattleSys>(); battleSys.InitSys(); //dynamicWnd.SetWndState(); //进入登录场景并加载相应UI uiSys.EnterLogin(); }
public UIMenuItem AddItem(string text) { int ys = 15; if (subp != null) { foreach (var i in Sub[0].Sub) { ys += 25; } } UIMenuItem ni = new UIMenuItem(text, subp, false) { WidY = ys, WidW = UISys.Skin().SmallFont.Width(text) + 5, WidH = 25 }; if (ni.WidY < 25) { ni.WidY = 25; } AppResize(App.AppInfo.W, App.AppInfo.H); return(ni); }
public int DrawItem(UIItem i, int y, int lc = 0) { int dx = lc * 25 + 15; if ((WidY + y) > WidY) { if (sy < 0) { sy = y; } } if ((WidY + y) < WidY + WidH) { ey = y; } UISys.Skin().DrawBoxText((int)WidX + dx, (int)WidY + y, i.Name); UIPatch p = new UIPatch { X = (int)WidX + dx - 8, Y = (int)WidY + y + 4, W = (int)WidW, H = (int)25, Action = () => { Select(i); } }; AddPatch(p); return(y + 25); }
public override void OnMouseDown(UIMouseButton b) { lx = VInput.MX; ly = VInput.MY; State = ButState.Press; UISys.Skin().ClickSound(); }
public override void Draw() { UISys.Skin().DrawBox((int)WidX, (int)WidY, (int)WidW, (int)WidH); string nt = Name; if (CarrotOn && CarrotDraw) { if (Name.Length == 0) { nt = "|"; } else { if (Name.Length == 1) { if (CarrotPos == 0) { nt = "|" + nt; } else { nt = nt + "|"; } } else { nt = nt.Substring(0, CarrotPos) + "|" + nt.Substring(CarrotPos); } } } UISys.Skin().DrawBoxText((int)WidX + 3, (int)WidY + 3, nt); }
private void Del() { if (Name.Length == 0) { UISys.Skin().EOESound(); return; } if (Name.Length == 1) { UISys.Skin().TypeSound(); Name = ""; CarrotPos = 0; return; } if (CarrotPos < Name.Length) { Name = Name.Substring(0, CarrotPos - 1) + Name.Substring(CarrotPos); CarrotPos--; UISys.Skin().TypeSound(); } else { Name = Name.Substring(0, Name.Length - 1); CarrotPos--; UISys.Skin().TypeSound(); } if (CarrotPos < 0) { CarrotPos = 0; } }
private void Add(string k) { UISys.Skin().TypeSound(); if (Name.Length == 0) { Name = k; CarrotPos = 1; return; } if (CarrotPos == Name.Length) { Name += k; CarrotPos++; return; } if (Name.Length == 1 && CarrotPos == 1) { Name += k; CarrotPos++; return; } if (CarrotPos == 0) { Name = k + Name; CarrotPos++; return; } Name = Name.Substring(0, CarrotPos) + k + Name.Substring(CarrotPos); CarrotPos++; }
public override void AppResize(int w, int h) { int ys = 10; int mw = -5; if (Sub.Count > 0) { if (Sub[0].Sub.Count > 0) { foreach (var i in Sub[0].Sub) { var sw = UISys.Skin().SmallFont.Width(i.Name) + 5; if (sw > mw) { mw = sw; } i.WidY = ys; ys += 25; } } } if (subp != null) { subp.WidH = ys; subp.WidW = mw; } base.Resized(); }
public override void Draw() { UISys.Skin().DrawWindow(this); // UISys.Skin().DrawRect((int)WidX + (int)WidW - 15, (int)WidY + (int)WidH - 15, 15, 15,DragCol); // UISys.Skin().DrawRect((int)WidX, (int)WidY+UISys.Skin().TitleHeight + 1, 10, (int)WidH - UISys.Skin().TitleHeight - 2,DragCol); // UISys.Skin().DrawRect((int)WidX, (int)WidY+(int)WidH - 10, (int)WidW - 15, 10,DragCol); // UISys.Skin().DrawRect((int)WidX + (int)WidW - 10, (int)WidY + UISys.Skin().TitleHeight + 1, 10, (int)WidH - UISys.Skin().TitleHeight - 16,DragCol); }
public override void Draw() { if (Img == null) { return; } UISys.Skin().DrawImg((int)WidX, (int)WidY, (int)WidW, (int)WidH, Img); }
public override void InitSys() { base.InitSys(); Instance = this; PECommon.Log("Init LoginSys..."); EnterLogin(); }
public UIWindow(int x, int y, int w, int h, string title, UIWidget top = null) : base(x, y, w, h, title, top) { titleDrag = new UIDragZone(0, 0, (int)WidW, UISys.Skin().TitleHeight, this); sizeDrag = new UIDragZone((int)WidW - 15, (int)WidH - 15, 15, 15, this); botDrag = new UIDragZone(0, (int)WidH - 10, (int)WidW - 15, 10, this); rightDrag = new UIDragZone((int)WidW - 10, UISys.Skin().TitleHeight + 1, 10, (int)WidH - 15 - UISys.Skin().TitleHeight, this); leftDrag = new UIDragZone(0, UISys.Skin().TitleHeight + 1, 10, (int)WidH - UISys.Skin().TitleHeight - 2, this); EnableScissorTest = true; }
public override void Draw() { if (over == false) { UISys.Skin().DrawText((int)WidX, (int)WidY, Name, new OpenTK.Vector4(0.2f, 0.2f, 0.2f, 1.0f)); } else { UISys.Skin().DrawText((int)WidX, (int)WidY, Name, new OpenTK.Vector4(0.95f, 0.95f, 0.95f, 1.0f)); } }
public override void AppResize(int w, int h) { int xs = 0; foreach (var i in Sub) { i.WidW = UISys.Skin().SmallFont.Width(i.Sub[0].Name) + 5; i.WidH = 25; i.WidX = 10 + xs; xs += UISys.Skin().SmallFont.Width(i.Sub[0].Name) + 5; } }
public override void Resized() { titleDrag.WidW = WidW; sizeDrag.LocX = WidW - 15; sizeDrag.LocY = WidH - 15; botDrag.WidW = WidW - 15; botDrag.LocY = WidH - 10; rightDrag.LocX = WidW - 10; rightDrag.WidH = WidH - 15 - UISys.Skin().TitleHeight; leftDrag.WidH = WidH - UISys.Skin().TitleHeight - 2; //Console.WriteLine("Resized!"); }
void Awake() { m_View = this; cachedGo = gameObject; InitPrefabTable(); //记录下原始值 if (m_UICamera != null) { m_originalCullingMask = m_UICamera.cullingMask; m_UICameraComp = m_UICamera.GetComponent <UICamera>(); } }
public override void KeyBackSpace() { if (Name.Length > 1) { //Name = Name.Substring(0, Name.Length - 1); Del(); } else { UISys.Skin().EOESound(); Name = ""; } }
public override void Draw() { if (State == ButState.Press) { if (Dragged != null) { Dragged(VInput.MX - lx, VInput.MY - ly); lx = VInput.MX; ly = VInput.MY; } } UISys.Skin().DrawButton(this); }
static int RecoveryUICameraCullingMask(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); obj.RecoveryUICameraCullingMask(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ActiveTouch(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); obj.ActiveTouch(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int DisableUICamera(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); obj.DisableUICamera(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int DestroyUIByName(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); string arg0 = ToLua.CheckString(L, 2); obj.DestroyUIByName(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ChangeUICameraCullingMask(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.ChangeUICameraCullingMask(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override void Draw() { VFontRenderer.Draw(UISys.Skin().SmallFont, Name, WidX + 5, WidY + 5, new OpenTK.Vector4(1, 1, 1, 1)); if (WinOver == false) { VPen.Rect(WidX, WidY, WidW, 50, new OpenTK.Vector4(0, 0, 0.5f, 0.1f)); } else { VPen.Rect(WidX, WidY, WidW, 50, new OpenTK.Vector4(0, 0, 0.5f, 0.35f)); if (StarEngine.Input.VInput.MB[0] == false && UISys.ActiveWindow.Docked == false) { DockWin(); } } }
static int CreateUIByName(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); string arg0 = ToLua.CheckString(L, 2); UIComponentBase o = obj.CreateUIByName(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetVisableByUIName(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); UISys obj = (UISys)ToLua.CheckObject(L, 1, typeof(UISys)); string arg0 = ToLua.CheckString(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); obj.SetVisableByUIName(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_m_UICameraComp(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UISys obj = (UISys)o; UICamera ret = obj.m_UICameraComp; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_UICameraComp on a nil value" : e.Message)); } }
static int set_m_UICameraComp(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UISys obj = (UISys)o; UICamera arg0 = (UICamera)ToLua.CheckUnityObject(L, 2, typeof(UICamera)); obj.m_UICameraComp = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_UICameraComp on a nil value" : e.Message)); } }
public override void Draw() { Patches.Clear(); UISys.Skin().DrawBox((int)WidX, (int)WidY, (int)WidW, (int)WidH); UISys.Skin().DrawBoxText((int)(WidX + WidW / 2 - UISys.Skin().SmallFont.Width(Name) / 2), (int)WidY + 8, Name); int oy = Scroll.Current; int dy = 25 - oy; sy = -1; ey = -1; foreach (var i in ItemRoot.Sub) { dy = DrawItem(i, dy); } Scroll.Max = (dy + oy); Scroll.ViewH = (ey - sy); Scroll.Rebuild(); }