public MouseTracker() { InitializeComponent(); wpfPlot1.plt.PlotSignal(DataGen.RandomWalk(null, 100)); vLine = wpfPlot1.plt.PlotVLine(0, color: System.Drawing.Color.Red, lineStyle: LineStyle.Dash); hLine = wpfPlot1.plt.PlotHLine(0, color: System.Drawing.Color.Red, lineStyle: LineStyle.Dash); wpfPlot1.Render(); }
public MouseTracker() { InitializeComponent(); wpfPlot1.Plot.AddSignal(DataGen.RandomWalk(null, 100)); vLine = wpfPlot1.Plot.AddVerticalLine(0, color: System.Drawing.Color.Red, style: LineStyle.Dash); hLine = wpfPlot1.Plot.AddHorizontalLine(0, color: System.Drawing.Color.Red, style: LineStyle.Dash); wpfPlot1.Render(); }
//string MyDebug_Backup=""; void ModuleUpdatePointToLine2() { Vertex VTX = VA.GetComponent <Vertex>(); //対象となる点 HLine HLN = VB.GetComponent <HLine>(); //対象となる直線 if (VTX != null && HLN != null) { HypLine L1 = HLN.HL; HypPoint P1 = new HypPoint(VTX.XY); HypLine L2 = HTransform.GetHPerpendicularThruAPoint(L1, P1); HypPoint P2 = HTransform.GetCrossingPointOfTwoHLines(L1, L2); float error = HTransform.GetHDistanceOfTwoPoints(P1, P2) * 0.2f; //Debug.Log(error); if (0.001f < error || error < -0.001f) { //string MyDebug = ""; HypPoint P3 = HTransform.GetHMoveAlongTwoPoints(P2, P1, error); HypPoint P4 = HTransform.GetHMoveAlongTwoPoints(P1, P2, error); ////点を直線に寄せる if (!VTX.Fixed && P4.InWorld()) { //MyDebug += "P4:" + P4.GetX() + "," + P4.GetY(); VTX.XY.x = P4.GetX(); VTX.XY.y = P4.GetY(); } //直線を円に寄せる Vertex L1V1 = HLN.VA.GetComponent <Vertex>(); //動かすべき点1 Vertex L1V2 = HLN.VB.GetComponent <Vertex>(); //動かすべき点2 HypPoint PL1 = new HypPoint(L1V1.XY); HypPoint PL2 = new HypPoint(L1V2.XY); HypPoint NewPL1 = HTransform.ParallelTransform(P2, P3, PL1); HypPoint NewPL2 = HTransform.ParallelTransform(P2, P3, PL2); //NewPL1.println("NewPL1"); if (!L1V1.Fixed && NewPL1.InWorld()) { //MyDebug += "L1:" + NewPL1.GetX() + "," + NewPL1.GetY(); L1V1.XY.x = NewPL1.GetX(); L1V1.XY.y = NewPL1.GetY(); } if (!L1V2.Fixed && NewPL2.InWorld()) { //MyDebug += "L2:" + NewPL2.GetX() + "," + NewPL2.GetY(); L1V2.XY.x = NewPL2.GetX(); L1V2.XY.y = NewPL2.GetY(); } HLN.GetHLineFromTwoVertices(); //if (MyDebug != MyDebug_Backup) //{ // Debug.Log(MyDebug); // MyDebug_Backup = MyDebug; //} } } }
/// <summary> /// Add a horizontal axis line at a specific Y position /// </summary> public HLine AddHorizontalLine(double y, Color?color = null, float width = 1, LineStyle style = LineStyle.Solid, string label = null) { HLine plottable = new HLine() { Y = y, Color = color ?? settings.GetNextColor(), LineWidth = width, LineStyle = style, Label = label, }; Add(plottable); return(plottable); }
/// <summary> /// 绘制线 /// </summary> /// <param name="g"></param> /// <param name="line"></param> private void DrawLine(Graphics g, HLine line) { g.SmoothingMode = SmoothingMode.AntiAlias; using (Pen p = new Pen(line.LineColor, line.LineWidth)) { //设置起止点线帽 p.StartCap = LineCap.Round; p.EndCap = LineCap.Round; //设置连续两段的联接样式 p.LineJoin = LineJoin.Round; g.DrawCurve(p, line.PointList.ToArray()); //画平滑曲线 } }
void ModuleUpdateTangentCircleToLine() { HCircle hcircle = VA.GetComponent <HCircle>(); //対象となる円 HLine hline = VB.GetComponent <HLine>(); //対象となる直線 if (hcircle != null && hline != null) { HypCircle C1 = hcircle.GetHCR(); HypLine L1 = hline.GetHL(); HypPoint P1 = new HypPoint(hcircle.VA.GetComponent <Vertex>().XY); HypLine L2 = HTransform.GetHPerpendicularThruAPoint(L1, P1); HypPoint P2 = HTransform.GetCrossingPointOfTwoHLines(L1, L2); //P2.println("P2"); float error = (HTransform.GetHDistanceOfTwoPoints(P1, P2) - C1.HR) * 0.1f; //Debug.Log(error); if (0.001f < error || error < -0.001f) { HypPoint P3 = HTransform.GetHMoveAlongTwoPoints(P2, P1, error); HypPoint P4 = HTransform.GetHMoveAlongTwoPoints(P1, P2, error); //円の半径を変える C1.HR += error; ////円を直線に寄せる Vertex C1V = hcircle.VA.GetComponent <Vertex>(); if (!C1V.Fixed && P4.InWorld()) { C1V.XY.x = P4.GetX(); C1V.XY.y = P4.GetY(); } //直線を円に寄せる Vertex L1V1 = hline.VA.GetComponent <Vertex>(); //動かすべき点1 Vertex L1V2 = hline.VB.GetComponent <Vertex>(); //動かすべき点2 HypPoint PL1 = new HypPoint(L1V1.XY); HypPoint PL2 = new HypPoint(L1V2.XY); HypPoint NewPL1 = HTransform.ParallelTransform(P2, P3, PL1); HypPoint NewPL2 = HTransform.ParallelTransform(P2, P3, PL2); //NewPL1.println("NewPL1"); if (!L1V1.Fixed && NewPL1.InWorld()) { L1V1.XY.x = NewPL1.GetX(); L1V1.XY.y = NewPL1.GetY(); } if (!L1V2.Fixed && NewPL2.InWorld()) { L1V2.XY.x = NewPL2.GetX(); L1V2.XY.y = NewPL2.GetY(); } hline.GetHLineFromTwoVertices(); } } }
private void Form1_Load(object sender, EventArgs e) { vline = formsPlot1.plt.PlotVLine(1); hline = formsPlot1.plt.PlotHLine(1); formsPlot1.plt.PlotHSpan(10, 20, draggable: true); formsPlot1.plt.PlotVSpan(5, 10, draggable: true); Random rand = new Random(0); double[] xs = DataGen.Consecutive(100); double[] ys = DataGen.RandomWalk(rand, 100); sph = formsPlot1.plt.PlotScatterHighlight(xs, ys); formsPlot1.Render(); }
public Form1() { InitializeComponent(); // simulate 10 seconds of 48 kHz audio int sampleRate = 48_000; Random rand = new Random(0); double[] data = ScottPlot.DataGen.RandomWalk(rand, sampleRate * 10); Signal = formsPlot1.Plot.AddSignal(data, sampleRate); // markers to indicate where the mouse is HLine = formsPlot1.Plot.AddHorizontalLine(0, Color.Red, 1, ScottPlot.LineStyle.Dash); VLine = formsPlot1.Plot.AddVerticalLine(0, Color.Red, 1, ScottPlot.LineStyle.Dash); formsPlot1.Render(); }
void ModuleUpdateIsometry() { HLine HLN1 = VA.GetComponent <HLine>(); //対象となる直線1 HLine HLN2 = VB.GetComponent <HLine>(); //対象となる直線2 Vertex V11 = HLN1.VA.GetComponent <Vertex>(); Vertex V12 = HLN1.VB.GetComponent <Vertex>(); Vertex V21 = HLN2.VA.GetComponent <Vertex>(); Vertex V22 = HLN2.VB.GetComponent <Vertex>(); HypPoint P11 = new HypPoint(V11.XY); HypPoint P12 = new HypPoint(V12.XY); HypPoint P21 = new HypPoint(V21.XY); HypPoint P22 = new HypPoint(V22.XY); float Dist1 = HTransform.GetHDistanceOfTwoPoints(P11, P12); float Dist2 = HTransform.GetHDistanceOfTwoPoints(P21, P22); float Error = (Dist2 - Dist1) * 0.1f; HypPoint NewP11 = HTransform.GetHMoveAlongTwoPoints(P11, P12, -Error); HypPoint NewP12 = HTransform.GetHMoveAlongTwoPoints(P12, P11, -Error); HypPoint NewP21 = HTransform.GetHMoveAlongTwoPoints(P21, P22, Error); HypPoint NewP22 = HTransform.GetHMoveAlongTwoPoints(P22, P21, Error); if (NewP11.InWorld() && !V11.Fixed) { V11.XY.x = NewP11.GetX(); V11.XY.y = NewP11.GetY(); } if (NewP12.InWorld() && !V12.Fixed) { V12.XY.x = NewP12.GetX(); V12.XY.y = NewP12.GetY(); } if (NewP21.InWorld() && !V21.Fixed) { V21.XY.x = NewP21.GetX(); V21.XY.y = NewP21.GetY(); } if (NewP22.InWorld() && !V22.Fixed) { V22.XY.x = NewP22.GetX(); V22.XY.y = NewP22.GetY(); } }
public void Test_AxisLine_ChangesPosition() { var plt = new ScottPlot.Plot(); // start with default settings var axLine = new HLine() { position = 1.23 }; plt.Add(axLine); var bmp1 = TestTools.GetLowQualityBitmap(plt); // change the plottable axLine.position += 1; var bmp2 = TestTools.GetLowQualityBitmap(plt); // measure what changed //TestTools.SaveFig(bmp1, "1"); //TestTools.SaveFig(bmp2, "2"); Assert.AreNotEqual(ScottPlot.Tools.BitmapHash(bmp1), ScottPlot.Tools.BitmapHash(bmp2)); }
void ModuleUpdatePointToLine() { Vector2 vtx = VA.GetComponent <Vertex>().XY; //対象となる点 HLine hline = VB.GetComponent <HLine>(); //対象となる直線 if (vtx != null && hline != null) { HypLine ln = hline.HL; //直線の円データ Vector2 hlnCenter = new Vector2(ln.GetX(), ln.GetY()); //直線の円データの中心座標 Vector2 direction = vtx - hlnCenter; //円の中心から対象となる点の方向 float dist = direction.magnitude - ln.R; //誤差 if (Mathf.Abs(dist) > 0.001f) { direction.Normalize(); //Vector2 newVtx = hlnCenter + (ln.R + 0.75f * dist) * direction;//新しい点の座標 Vector2 newVtx = vtx - (0.1f * dist) * direction;//新しい点の座標 HypPoint newPt = new HypPoint(newVtx); if (!VA.GetComponent <Vertex>().Fixed&& newPt.InWorld()) { VA.GetComponent <Vertex>().XY = newVtx; } Vector2 startPos = vtx - dist * direction; //平行移動スタート点 Vector2 endPos = vtx - (0.8f * dist) * direction; //平行移動ゴール点 Vertex lineVertex1 = hline.VA.GetComponent <Vertex>(); //動かすべき点1 Vertex lineVertex2 = hline.VB.GetComponent <Vertex>(); //動かすべき点2 //new HypPoint(lineVertex1.XY).Println("LV1"); //new HypPoint(lineVertex2.XY).Println("LV2"); Vector2 XY1 = lineVertex1.XY; Vector2 XY2 = lineVertex2.XY; if (!lineVertex1.Fixed) { HypPoint HP1 = new HypPoint(XY1); HypPoint HPnew1 = HTransform.ParallelTransform(startPos, endPos, HP1);//点1を平行移動する if (HPnew1.InWorld()) { lineVertex1.XY.x = HPnew1.GetX(); lineVertex1.XY.y = HPnew1.GetY(); } else { Debug.Log("error occurs at module P2L - 1A:" + HPnew1.X + "," + HPnew1.Y + "," + HPnew1.Z); HP1.Println("HP1"); HPnew1.Println("HPnew1"); Debug.Log("dist " + dist); Debug.Log("ln.R " + ln.R); Debug.Log("direction " + direction.x + "," + direction.y); Debug.Log("hlnCenter " + hlnCenter.x + "," + hlnCenter.y); Debug.Log("startPos" + startPos.x + "," + startPos.y); Debug.Log("endPos" + endPos.x + "," + endPos.y); Debug.Log(XY1); } } if (!lineVertex2.Fixed) { HypPoint HP2 = new HypPoint(XY2); HypPoint HPnew2 = HTransform.ParallelTransform(startPos, endPos, HP2);//点2を平行移動する if (HPnew2.InWorld()) { lineVertex2.XY.x = HPnew2.GetX(); lineVertex2.XY.y = HPnew2.GetY(); } else { Debug.Log("error occurs at module P2L - 2A:" + HPnew2.X + "," + HPnew2.Y + "," + HPnew2.Z); } } hline.GetHLineFromTwoVertices(); } } }
public override string ToString() { if (Mode == MODE.ADD_POINT) { Vertex VTX = ParentObj.GetComponent <Vertex>(); return("Point," + VTX.XY.x + "," + VTX.XY.y + "," + "1" + "," + VTX.ID + "," + VTX.Fixed + "," + Active + "," + VTX.VertexName); } else if (Mode == MODE.ADD_LINE) { HLine HLN = ParentObj.GetComponent <HLine>(); int Id1 = HLN.VA.GetComponent <Vertex>().ID; int Id2 = HLN.VB.GetComponent <Vertex>().ID; return("Line," + Id1 + "," + Id2 + "," + HLN.ID + "," + Active + "," + HLN.HLineName); } else if (Mode == MODE.ADD_CIRCLE) { HCircle HCI = ParentObj.GetComponent <HCircle>(); int Id1 = HCI.VA.GetComponent <Vertex>().ID; return("Circle," + Id1 + "," + HCI.HCR.HR + "," + HCI.ID + "," + Active + "," + HCI.HCircleName); } else if (Mode == MODE.ADD_MIDPOINT) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID + "," + HMD.VB.GetComponent <Vertex>().ID + "," + HMD.VC.GetComponent <Vertex>().ID + "," + HMD.ID + "," + Active); } else if (Mode == MODE.POINT_TO_POINT) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID + "," + HMD.VB.GetComponent <Vertex>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else if (Mode == MODE.POINT_TO_LINE) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else if (Mode == MODE.POINT_TO_CIRCLE) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID + "," + HMD.VB.GetComponent <HCircle>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else if (Mode == MODE.ISOMETRY) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <HLine>().ID + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else if (Mode == MODE.PERPENDICULAR) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <HLine>().ID + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else if (Mode == MODE.TANGENT_C2L) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <HCircle>().ID + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else if (Mode == MODE.TANGENT_C2C) { HModule HMD = ParentObj.GetComponent <HModule>(); return("Module," + Mode + "," + HMD.VA.GetComponent <HCircle>().ID + "," + HMD.VB.GetComponent <HCircle>().ID + "," + "ID3" + "," + HMD.ID + "," + Active); } else { return(""); } }
private HElement GetDebugResponse(SessionData sessionData) { HMultipleElements ret = new HMultipleElements(); ret += new HText($"Current Response Count: {StringResponses.Count} ({CurrentStringResponseCacheSize * sizeof(char)} bytes)."); if (MaximumStringResponseCacheSize > 0) { ret += new HText($"Cache Fillrate: {CurrentStringResponseCacheSize} / {MaximumStringResponseCacheSize} = {((CurrentStringResponseCacheSize / MaximumStringResponseCacheSize) * 100f):0.000}%."); string request; using (StringResponseLock.LockRead()) { if (sessionData.HttpHeadVariables.TryGetValue("key", out request)) { ret += new HButton("Back to all entries", "?all=true"); ResponseCacheEntry <string> response; if (StringResponses.TryGetValue(request, out response)) { ret += new HHeadline($"Entry '{request}'", 2); ret += new HText("Requested Times: " + response.Count); ret += new HText("Response Length: " + response.Response.Length); ret += new HText("Last Requested: " + response.LastRequestedDateTime); ret += new HText("Last Updated Times: " + response.LastUpdatedDateTime); ret += new HText("Lifetime: " + response.RefreshTime); ret += new HLine(); ret += new HText("Contents:"); ret += new HText(response.Response) { Class = "code" }; } else { ret += new HText($"The requested entry '{request}' could not be found.") { Class = "error" }; } } else if (sessionData.HttpHeadVariables.ContainsKey("all")) { ret += new HTable((from e in StringResponses select new object[] { e.Key, e.Value.Count, e.Value.Response.Length, e.Value.LastRequestedDateTime, e.Value.LastUpdatedDateTime, e.Value.RefreshTime, new HLink("Show Contents", "?key=" + e.Key.EncodeUrl()) } ).OrderByDescending(e => (int)(ulong)e[1] * (int)e[2])) { TableHeader = new string[] { "Key", "Request Count", "Response Length", "Last Request Time", "Last Updated Time", "Lifetime", "Contents" } }; } else { ret += new HButton("Show all entries (might take a long time to load)", HButton.EButtonType.button, "?all=true"); } } } return(ret); }
// This is the actual window. void DialogWindow(int windowID) { float AlignX = 15; float AlignY = 20; float AlignStep = 30; float height = 28; float align = 60; float bigAlign = 72; float width = windowRect.width - 30; float halfAlign = width / 2f; if (LogObject.Mode == MODE.ADD_POINT) { Vertex VTX = Object.GetComponent <Vertex>(); if (VTX == null) { return; } Fixed = VTX.Fixed; // GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle); AlignY += AlignStep; // GUI.Label(new Rect(AlignX, AlignY, width, height), "Name ", TextStyle); ObjectName = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), ObjectName, TextFieldStyle); AlignY += AlignStep; // 1列目 GUI.Label(new Rect(AlignX, AlignY, windowRect.width - align, height), Text2, TextStyle); AlignY += AlignStep; GUI.Label(new Rect(AlignX, AlignY, width, height), "X :", TextStyle); CoordX = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), CoordX, TextFieldStyle); AlignY += AlignStep; GUI.Label(new Rect(AlignX, AlignY, width, height), "Y : ", TextStyle); CoordY = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), CoordY, TextFieldStyle); AlignY += AlignStep; // 2列目 if (Fixed) { GUI.Label(new Rect(AlignX, AlignY, width, height), "Fixed ", TextStyle); if (GUI.Button(new Rect(AlignX + bigAlign, AlignY, width - bigAlign, height), "Unfixed", ButtonStyle)) { Fixed = VTX.Fixed = false; } } else { GUI.Label(new Rect(AlignX, AlignY, width, height), "Unfixed ", TextStyle); if (GUI.Button(new Rect(AlignX + bigAlign, AlignY, width - bigAlign, height), "Fixed", ButtonStyle)) { Fixed = VTX.Fixed = true; } } AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle)) { Objects.DraggedVertex = VTX; Objects.ExecuteDeletePoint(); show = false; } AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle)) { show = false; } if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle)) { VTX.VertexName = ObjectName; VTX.XY.x = float.Parse(CoordX); VTX.XY.y = float.Parse(CoordY); show = false; } } else if (LogObject.Mode == MODE.ADD_LINE) { HLine HLN = Object.GetComponent <HLine>(); if (HLN == null) { return; } Clipped = HLN.Clipped; GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle); AlignY += AlignStep; // GUI.Label(new Rect(AlignX, AlignY, width, height), "Name ", TextStyle); ObjectName = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), ObjectName, TextFieldStyle); AlignY += AlignStep; GUI.Label(new Rect(AlignX, AlignY, width, height), Text2, TextStyle); AlignY += AlignStep; if (Clipped) { GUI.Label(new Rect(AlignX, AlignY, width, height), "Clipped", TextStyle); if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, width - halfAlign, height), "Unclipped", ButtonStyle)) { Clipped = HLN.Clipped = false; } } else { GUI.Label(new Rect(AlignX, AlignY, width, height), "Unclipped", TextStyle); if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, width - halfAlign, height), "Clipped", ButtonStyle)) { Clipped = HLN.Clipped = true; } } AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle)) { Objects.ExecuteDeleteHLine(HLN); show = false; } AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle)) { show = false; } if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle)) { HLN.HLineName = ObjectName; show = false; } } else if (LogObject.Mode == MODE.ADD_CIRCLE) { HCircle HCI = Object.GetComponent <HCircle>(); if (HCI == null) { return; } GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle); AlignY += AlignStep; GUI.Label(new Rect(AlignX, AlignY, width, height), "Name ", TextStyle); ObjectName = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), ObjectName, TextFieldStyle); AlignY += AlignStep; GUI.Label(new Rect(AlignX, AlignY, width, height), Text2, TextStyle); AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle)) { Objects.ExecuteDeleteHCircle(HCI); show = false; } AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle)) { show = false; } if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle)) { HCI.HCircleName = ObjectName; show = false; } } else { HModule HMD = Object.GetComponent <HModule>(); if (HMD != null) { GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle); AlignY += AlignStep; GUI.Label(new Rect(AlignX, AlignY, width, height), Text2, TextStyle); AlignY += AlignStep; if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle)) { Objects.ExecuteDeleteHModule(HMD); show = false; } AlignY += AlignStep; } if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle)) { show = false; } if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle)) { show = false; } } }