public static void Veuilayout() { if (mInstance == null) { mInstance = (VeuiEditor)EditorWindow.GetWindow(typeof(VeuiEditor)); mInstance.titleContent.text = "Visual UI Layout"; mInstance.minSize = new Vector2(700, 500); mInstance.maxSize = new Vector2(5200, 5000); mInstance.Show(); Rect tmpwr = new Rect(zpx, zpy, 500, 350); aroll = new Rollout(tmpwr); //aroll.gid = "mainroll"; //aroll.gid=regmap(tmpwr, aroll); gdata = new guidata(); gdata.ctrlist = new Dictionary <string, Ctrbox>(); pctr.Add(aroll); ash = new Scalehandle(tmpwr); apan = new VUEPanel(tmpwr); } foreach (var ctr in map) { Debug.Log(ctr); } //VeuiEditor.showpth(); }
public override void rgmap(Rect tmpr) { wr = tmpr; Rect wrtmp = new Rect(wr.x - lena, wr.y - lena, lena, lena); gidlt = VeuiEditor.regmap(wrtmp, this); wrtmp.y = wr.y + wr.height; gidlb = VeuiEditor.regmap(wrtmp, this); wrtmp.x = wr.width + wr.x; gidrb = VeuiEditor.regmap(wrtmp, this); wrtmp.y = wr.y - lena; gidrt = VeuiEditor.regmap(wrtmp, this); wrtmp = new Rect(wr.x - lena, wr.y - lena, lena, lena); wrtmp.y = wr.y + wr.height / 2 - lena / 2; gidlm = VeuiEditor.regmap(wrtmp, this); wrtmp.x = wr.width + wr.x; gidrm = VeuiEditor.regmap(wrtmp, this); wrtmp.y = wr.y - lena; wrtmp.x = wr.width / 2 + wr.x - lena / 2; gidtm = VeuiEditor.regmap(wrtmp, this); wrtmp.y = wr.y + wr.height; gidbm = VeuiEditor.regmap(wrtmp, this); }
public VUEButton(Vector2 mpos) { type = "Button"; name = "Btn"; Rect wrtmp = new Rect(mpos.x, mpos.y, dw, dh); wr = wrtmp; gid = VeuiEditor.regmap(wrtmp, this); //sh = new Scalehandle(this, wr); }
public override void urmap() { //Debug.Log("here"); VeuiEditor.unregmap(gidlt); VeuiEditor.unregmap(gidlb); VeuiEditor.unregmap(gidrb); VeuiEditor.unregmap(gidrt); VeuiEditor.unregmap(gidlm); VeuiEditor.unregmap(gidrm); VeuiEditor.unregmap(gidtm); VeuiEditor.unregmap(gidbm); //Debug.Log("outhere"); //Debug.Log(pctr); }
// public Scalehandle sh; public virtual void reciver(Event cur, string gid) { if (VeuiEditor.sel == 0 && cur.type == EventType.MouseDown) { VeuiEditor.setsel(this); dx = cur.mousePosition.x - wr.x; dy = cur.mousePosition.y - wr.y; //Debug.Log("inbutton"); } if (VeuiEditor.sel == 0 && cur.type == EventType.MouseDrag) { wr.x = VeuiEditor.postdit(cur.mousePosition.x, dx); wr.y = VeuiEditor.postdit(cur.mousePosition.y, dy); rrmap(); VeuiEditor.updatesh(); } VeuiEditor.mInstance.Repaint(); }
public override void rrmap() { calrect(); Rect wrtmp = new Rect(wr.x - lena, wr.y - lena, lena, lena); VeuiEditor.refreshmap(gidlt, wrtmp); Debug.Log(wr); wrtmp.y = wr.y + wr.height; VeuiEditor.refreshmap(gidlb, wrtmp); wrtmp.x = wr.width + wr.x; //gidrb = VeuiEditor.regmap(wrtmp, this); VeuiEditor.refreshmap(gidrb, wrtmp); wrtmp.y = wr.y - lena; //gidrt = VeuiEditor.regmap(wrtmp, this); VeuiEditor.refreshmap(gidrt, wrtmp); wrtmp = new Rect(wr.x - lena, wr.y - lena, lena, lena); wrtmp.y = wr.y + wr.height / 2 - lena / 2; //gidlm = VeuiEditor.regmap(wrtmp, this); VeuiEditor.refreshmap(gidlm, wrtmp); wrtmp.x = wr.width + wr.x; //gidrm = VeuiEditor.regmap(wrtmp, this); VeuiEditor.refreshmap(gidrm, wrtmp); wrtmp.y = wr.y - lena; wrtmp.x = wr.width / 2 + wr.x - lena / 2; //gidtm = VeuiEditor.regmap(wrtmp, this); VeuiEditor.refreshmap(gidtm, wrtmp); wrtmp.y = wr.y + wr.height; //gidbm = VeuiEditor.regmap(wrtmp, this); VeuiEditor.refreshmap(gidbm, wrtmp); }
public override void reciver(Event cur, string gid) { Debug.Log(cur.type); //if(gid==gidlt ) if (cur.type == EventType.MouseDrag) { Vector2 mpos = new Vector2(); mpos = cur.mousePosition; mpos.x = VeuiEditor.postdit(mpos.x, 0); mpos.y = VeuiEditor.postdit(mpos.y, 0); Vector2 v2a = new Vector2(wr.x, wr.y); Vector2 v2b = new Vector2(wr.x + wr.width, wr.y + wr.height); //Debug.Log(v2b); //Debug.Log(wr); //Debug.Log("00000000000000"); Rect tmpwr = wr; if (gid == gidlt) { v2a.x = (mpos.x < minx)?minx:mpos.x; v2a.x = (v2a.x < v2b.x - 3 * lena) ? v2a.x : v2b.x - 3 * lena; v2a.y = (mpos.y < miny) ? miny : mpos.y; v2a.y = (v2a.y < v2b.y - 3 * lena) ? v2a.y : v2b.y - 3 * lena; //v2b = new Vector2(minx + wr.width,miny+wr.height); } if (gid == gidlm) { v2a.x = (mpos.x < minx) ? minx : mpos.x; v2a.x = (v2a.x < v2b.x - 3 * lena) ? v2a.x : v2b.x - 3 * lena; } if (gid == gidlb) { v2a.x = (mpos.x < minx) ? minx : mpos.x; v2a.x = (v2a.x < v2b.x - 3 * lena) ? v2a.x : v2b.x - 3 * lena; v2b.y = (mpos.y < miny) ? miny : mpos.y; v2b.y = (v2b.y > v2a.y + 3 * lena) ? v2b.y : v2a.y + 3 * lena; } if (gid == gidtm) { v2a.y = (mpos.y < miny) ? miny : mpos.y; v2a.y = (v2a.y < v2b.y - 3 * lena) ? v2a.y : v2b.y - 3 * lena; } if (gid == gidbm) { v2b.y = (mpos.y < miny) ? miny : mpos.y; v2b.y = (v2b.y > v2a.y + 3 * lena) ? v2b.y : v2a.y + 3 * lena; } if (gid == gidrt) { v2b.x = (mpos.x < minx) ? minx : mpos.x; v2b.x = (v2b.x > v2a.x + 3 * lena) ? v2b.x : v2a.x + 3 * lena; v2a.y = (mpos.y < miny) ? miny : mpos.y; v2a.y = (v2a.y < v2b.y - 3 * lena) ? v2a.y : v2b.y - 3 * lena; } if (gid == gidrm) { v2b.x = (mpos.x < minx) ? minx : mpos.x; v2b.x = (v2b.x > v2a.x + 3 * lena) ? v2b.x : v2a.x + 3 * lena; } if (gid == gidrb) { v2b.x = (mpos.x < minx) ? minx : mpos.x; v2b.x = (v2b.x > v2a.x + 3 * lena) ? v2b.x : v2a.x + 3 * lena; v2b.y = (mpos.y < miny) ? miny : mpos.y; v2b.y = (v2b.y > v2a.y + 3 * lena) ? v2b.y : v2a.y + 3 * lena; } tmpwr.x = v2a.x; tmpwr.y = v2a.y; tmpwr.width = v2b.x - v2a.x; tmpwr.height = v2b.y - v2a.y; wr = tmpwr; foreach (var ctr in VeuiEditor.pctr) { ctr.updatewr(wr); } rrmap(); foreach (var ctr in VeuiEditor.pctr) { ctr.rrmap(); // Debug.Log("kkllsj"); } VeuiEditor.mInstance.Repaint(); } else if (cur.type == EventType.MouseUp || cur.type == EventType.MouseDown) { // state = 0; rrmap(); foreach (var ctr in VeuiEditor.pctr) { ctr.rrmap(); Debug.Log("kkllsj"); } } }
public override void rrmap() { VeuiEditor.refreshmap(gid, wr); }