public T Remove() { T lastElement = TheBox.Last(); TheBox.RemoveAt(TheBox.Count - 1); return(lastElement); }
public bool IsVisible(System.Drawing.Rectangle bounds, TheBox.MapViewer.Maps map) { if ( m_Spawn.Map != (int) map ) return false; if ( m_Spawn.X >= bounds.Left && m_Spawn.X <= bounds.Right && m_Spawn.Y >= bounds.Top && m_Spawn.Y <= bounds.Bottom ) return true; else return false; }
void Start() { theBox = GameObject.Find("TheBox"); boxScript = theBox.GetComponent <TheBox>(); obstract = GameObject.Find("Main"); obScript = obstract.GetComponent <RandomApae>(); apaeLaughterSound.Play(0); boxScript.isAlive(true); }
public void Draw(System.Drawing.Graphics g, TheBox.MapViewer.MapViewInfo ViewInfo) { System.Drawing.Point c = ViewInfo.MapToControl( new System.Drawing.Point( m_Spawn.X, m_Spawn.Y ) ); int x1 = c.X - 3; int x2 = c.X + 3; int y1 = c.Y - 3; int y2 = c.Y + 3; Color color = Pandora.Profile.Travel.SpawnColor; Pen pen = new Pen( color ); g.DrawLine( pen, x1, y1, x2, y2 ); g.DrawLine( pen, x1, y2, x2, y1 ); g.DrawLine( pen, c.X, y1, c.X, y2 ); g.DrawLine( pen, x1, c.Y, x2, c.Y ); pen.Dispose(); }
private void pictureBox1_Paint(object sender, PaintEventArgs e) { var G = e.Graphics; G.Clear(Color.Black); G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; G.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; G.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; if (TheBOM == null) { return; } Font F = new Font("Panton", 16); Font F2 = new Font("Panton ExtraBold", 26); int count = TheBOM.GetPartCount(new List <string>() { }); int solderedcount = TheBOM.GetSolderedPartCount(new List <string>() { }); string disp = String.Format("{0}/{1}", solderedcount, count); G.DrawString(disp, F, Brushes.White, 2, 2); G.DrawString(SolderTool.GetCurrentPartName(), F2, Brushes.White, 2, pictureBox1.Height - F2.Height); if (ActiveDes != null) { string txt = String.Format("{0} {1} - {2}", ActiveEntry.DispName, ActiveDes.OriginalName, ActiveDes.NameOnBoard); G.DrawString(txt, F, Brushes.Pink, 2, 20); } G.TranslateTransform(10, 10); float S = (float)Math.Min(pictureBox1.Width / (TheBox.Width() - 20), pictureBox1.Height / (TheBox.Height() - 20)); if (TopView) { G.ScaleTransform(S * 0.8f, -S * 0.8f); G.TranslateTransform((float)-TheBox.TopLeft.X, (float)-TheBox.TopLeft.Y - (float)TheBox.Height()); } else { G.ScaleTransform(-S * 0.8f, -S * 0.8f); G.TranslateTransform((float)(-TheBox.TopLeft.X - TheBox.Width()), (float)-TheBox.TopLeft.Y - (float)TheBox.Height()); } RenderLayerSets(G, S, BoardSide.Both, BoardLayer.Outline, Color.Gray); if (TopView) { RenderLayerSets(G, S, BoardSide.Top, BoardLayer.SolderMask, Color.FromArgb(20, 255, 255, 50), false); RenderLayerSets(G, S, BoardSide.Top, BoardLayer.Silk, Color.FromArgb(100, 255, 255, 255)); } else { RenderLayerSets(G, S, BoardSide.Bottom, BoardLayer.SolderMask, Color.FromArgb(20, 255, 255, 50), false); RenderLayerSets(G, S, BoardSide.Bottom, BoardLayer.Silk, Color.FromArgb(100, 255, 255, 255)); } int i = 0; if (ActiveDes != null) { G.DrawLine(Pens.Gray, (float)ToolX, (float)TheBox.TopLeft.Y, (float)ToolX, (float)TheBox.BottomRight.Y); G.DrawLine(Pens.Gray, (float)TheBox.TopLeft.X, (float)ToolY, (float)TheBox.BottomRight.X, (float)ToolY); } var PL = SolderTool.GetPartList(); foreach (var v in PL) { bool Current = SolderTool.GetCurrentPart() == i; foreach (var r in v.RefDes) { DrawMarker(G, r, v.Soldered, S, Current, ActiveDes == r); } i++; } }
internal void Load(string basefile) { Text = Path.GetFileNameWithoutExtension(basefile); string fn = Path.GetFileName(basefile); string basefolder = Path.GetDirectoryName(basefile); string name = fn.Split('_')[0]; string BOMFile = ""; string PnPFile = ""; string gerberFile = ""; var L = Directory.GetFiles(basefolder, name + "_*.*"); SolderFile = ""; foreach (var file in L) { if (file.EndsWith("_BOM.csv")) { BOMFile = file; } if (file.EndsWith("_gerbers.zip")) { gerberFile = file; } if (file.EndsWith("_PNP.csv")) { PnPFile = file; } if (file.EndsWith("_soldered.txt")) { SolderFile = file; } } LayerSets.Add(new LayerSet() { Side = BoardSide.Both, Layer = BoardLayer.Outline }); LayerSets.Add(new LayerSet() { Side = BoardSide.Top, Layer = BoardLayer.SolderMask }); LayerSets.Add(new LayerSet() { Side = BoardSide.Top, Layer = BoardLayer.Silk }); LayerSets.Add(new LayerSet() { Side = BoardSide.Bottom, Layer = BoardLayer.SolderMask }); LayerSets.Add(new LayerSet() { Side = BoardSide.Bottom, Layer = BoardLayer.Silk }); if (BOMFile.Length > 0 && PnPFile.Length > 0 && gerberFile.Length > 0) { BOM B = new BOM(); B.LoadJLC(BOMFile, PnPFile); TheBOM = B; if (SolderFile.Length > 0) { solderedlist = File.ReadAllLines(SolderFile).ToList(); foreach (var a in B.DeviceTree) { foreach (var v in a.Value.Values) { if (solderedlist.Contains(v.Combined())) { v.Soldered = true; } } } } else { SolderFile = Path.Combine(basefolder, name + "_soldered.txt"); SaveSolderedList(); } GerberLibrary.GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); List <string> res = new List <string>(); Dictionary <string, MemoryStream> Files = new Dictionary <string, MemoryStream>(); using (Ionic.Zip.ZipFile zip1 = Ionic.Zip.ZipFile.Read(gerberFile)) { foreach (ZipEntry e in zip1) { MemoryStream MS = new MemoryStream(); if (e.IsDirectory == false) { e.Extract(MS); MS.Seek(0, SeekOrigin.Begin); Files[e.FileName] = MS; } } } string[] FileNames = Files.Keys.ToArray(); List <string> outlinefiles = new List <string>(); List <string> topsilkfiles = new List <string>(); List <string> bottomsilkfiles = new List <string>(); foreach (var F in FileNames) { BoardSide BS = BoardSide.Unknown; BoardLayer BL = BoardLayer.Unknown; Files[F].Seek(0, SeekOrigin.Begin); if (Gerber.FindFileTypeFromStream(new StreamReader(Files[F]), F) == BoardFileType.Gerber) { Gerber.DetermineBoardSideAndLayer(F, out BS, out BL); foreach (var l in LayerSets) { if (l.Side == BS && l.Layer == BL) { l.Files.Add(F); Files[F].Seek(0, SeekOrigin.Begin); var pls = PolyLineSet.LoadGerberFileFromStream(new StandardConsoleLog(), new StreamReader(Files[F]), F, true, false, new GerberParserState() { PreCombinePolygons = false }); l.Gerbs.Add(pls); } } } } TheBox.Reset(); foreach (var a in LayerSets[0].Gerbs) { TheBox.AddBox(a.BoundingBox); } } }
/// <summary> /// User selected a specific skill /// </summary> private void Skills_SkillSelected(object sender, TheBox.Data.SkillEventArgs e) { Pandora.Profile.General.AllSkills = false; Pandora.Profile.General.SkillName = e.Text; Pandora.Profile.General.Skill = e.Skill; lnkSkill.Text = e.Text; }
private void Start() { Box = this; }
public void Add(T element) { TheBox.Add(element); }
/// <summary> /// Creates a RecentHuesMenu that can /// </summary> /// <param name="list"></param> public RecentHuesMenu( TheBox.Common.RecentIntList list ) { m_List = list; m_List.ListChanged +=new EventHandler(m_List_ListChanged); MakeMenu(); }
public void Add(T element) { TheBox.Push(element); }
/// <summary> /// Button send preview /// </summary> private void bPreview_SendCommand(object sender, TheBox.SendCommandEventArgs e) { string cmd = ""; if ( e.UsePrefix ) cmd += Pandora.Profile.General.CommandPrefix; cmd += e.Command; MessageBox.Show( string.Format( Pandora.Localization.TextProvider[ "ButtonMenuEditor.PreviewMsg" ], cmd ) ); }
/// <summary> /// Sets the correct username and password for an outgoing BoxMessage /// </summary> /// <param name="msg">The BoxMessage that needs authentication values set</param> public void FillBoxMessage( TheBox.BoxServer.BoxMessage msg ) { msg.Username = m_Username; msg.Password = m_Password; }
public static void SwitchTheBox(bool State) { if (FxTheBox == null) { Debug.WriteLine("Switch box true"); IntPtr hFxTheBox = GetProcAddress(hHookMod, "TheBox"); FxTheBox = (TheBox)Marshal.GetDelegateForFunctionPointer(hFxTheBox, typeof(TheBox)); } if (!State) { Debug.WriteLine("Switch box false"); FxTheBox(false, 0x9C04180B); foreach (var pid in ProccessIds) { Debug.WriteLine("PID: " + pid); Render.DefaultSource.Instance.PushTextNormal("Resume " + pid); var hProcess = OpenProcess(ProcessAccess.All, false, pid); if (hProcess != IntPtr.Zero) { NtResumeProcess(hProcess); } else { Debug.WriteLine("Failed to open process (ID " + pid + ")"); } } ProccessIds.Clear(); /*var pids = new uint[arrSz]; * var a = FxTheBox(false, 0x9C04180B, pids); * * if (arrSz == 0) { * Debug.WriteLine("PIDS empty???"); * } * * foreach (var pid in pids) { * Debug.WriteLine("PID: " + pid); * var hProcess = OpenProcess(ProcessAccessFlags.All, false, pid); * if (hProcess != IntPtr.Zero) { * NtResumeProcess(hProcess); * } else { * Debug.WriteLine("Failed to open process (ID " + pid + ")"); * } * /*var hThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, pid); * if (hThread != IntPtr.Zero) { * uint sCount; * do { * sCount = ResumeThread(hThread); * unchecked { * if (sCount == ((uint)-1)) { * Debug.WriteLine("Failed to open thread (ID " + pid + ")"); * continue; * } * } * } while (sCount != 0); * } else { * Debug.WriteLine("Failed to open thread (ID " + pid + ")"); * }* * }*/ } else { FxTheBox(true, 0x9C04180B); } }
public T Remove() { return(TheBox.Pop()); }
protected override void SolveInstance(IGH_DataAccess DA) { try { //Retrieve parameters GH_Structure <GH_Curve> c0 = new GH_Structure <GH_Curve>(); GH_Structure <GH_Curve> c1 = new GH_Structure <GH_Curve>(); Mesh mesh0 = new Mesh(); Mesh mesh1 = new Mesh(); int sideDivisions = 2; double planeWidth = 0.01; int divisions = 2; bool cornerType = true; double parallel = 0.0; bool screws = true; DA.GetDataTree <GH_Curve>(0, out c0); DA.GetDataTree <GH_Curve>(1, out c1); DA.GetData(2, ref mesh0); DA.GetData(3, ref mesh1); DA.GetData(4, ref sideDivisions); DA.GetData(5, ref planeWidth); DA.GetData(6, ref divisions); DA.GetData(7, ref cornerType); DA.GetData(8, ref parallel); DA.GetData(9, ref screws); //Use curves as input if (c0.DataCount > 0 && (c0.DataCount == c1.DataCount)) { List <Polyline> outlines0 = new List <Polyline>(); List <Polyline> outlines1 = new List <Polyline>(); var c0Enumerator = c0.GetEnumerator(); var c1Enumerator = c1.GetEnumerator(); while (c0Enumerator.MoveNext() && c1Enumerator.MoveNext()) { Object curve0 = c0Enumerator.Current; Object curve1 = c1Enumerator.Current; } int n = c0.DataCount; foreach (GH_Curve ghc in c0.AllData(true)) { ghc.Value.TryGetPolyline(out Polyline p); outlines0.Add(p); } foreach (GH_Curve ghc in c1.AllData(true)) { ghc.Value.TryGetPolyline(out Polyline p); outlines1.Add(p); } //2.0 Setup theBox class TheBox[] boxes = new TheBox[n]; Plane[][] sidePlanes = new Plane[n][]; Plane[][] topPlanes = new Plane[n][]; Polyline[][][] midOutlines0 = new Polyline[n][][]; Polyline[][][] sideOutlines0 = new Polyline[n][][]; Polyline[][][] sideOutlines1 = new Polyline[n][][]; Plane[][][] edgePlanes = new Plane[n][][]; for (int i = 0; i < n; i++) { boxes[i] = new TheBox(outlines0[i], outlines1[i], planeWidth, new List <double> { 0.25, 0.75 }, cornerType, parallel, divisions, i); boxes[i].ConstructPlanes(); sidePlanes[i] = boxes[i].sidePlanes; topPlanes[i] = boxes[i].topPlanes; boxes[i].ConstructOutlines(); sideOutlines0[i] = boxes[i].sideOutlines0; sideOutlines1[i] = boxes[i].sideOutlines1; midOutlines0[i] = boxes[i].midOutlines0; if (sideDivisions > 1) { boxes[i].ConstructJointsEdgeJoints(sideDivisions, -20); edgePlanes[i] = boxes[i].sidePlanesR90SideJoints; } } DA.SetDataTree(1, NGonsCore.GrasshopperUtil.IE2(sidePlanes)); DA.SetDataTree(2, NGonsCore.GrasshopperUtil.IE2(topPlanes)); DA.SetDataTree(3, NGonsCore.GrasshopperUtil.IE3(sideOutlines0)); DA.SetDataTree(4, NGonsCore.GrasshopperUtil.IE3(sideOutlines1)); DA.SetDataTree(5, NGonsCore.GrasshopperUtil.IE3(midOutlines0)); DA.SetDataTree(6, NGonsCore.GrasshopperUtil.IE3(edgePlanes)); //Use meshes as input with its adjacency } else if (mesh0.Ngons.Count == mesh1.Ngons.Count) { int n = mesh0.Ngons.Count; Mesh[] meshBoxes = mesh0.ProjectPairsMesh(mesh1, 1); DA.SetDataList(0, meshBoxes); //1.0 Get top and side polylines from boxes Polyline[][] meshBoxesOutlinesTop = new Polyline[n][]; Polyline[][] meshBoxesOutlinesSide = new Polyline[n][]; for (int i = 0; i < n; i++) { Polyline[] outlines = meshBoxes[i].GetPolylines(); meshBoxesOutlinesSide[i] = new Polyline[outlines.Length - 2]; Array.Copy(outlines, meshBoxesOutlinesSide[i], outlines.Length - 2); meshBoxesOutlinesTop[i] = new Polyline[2] { outlines[outlines.Length - 1], outlines[outlines.Length - 2] }; } //2.0 Setup theBox class TheBox[] boxes = new TheBox[n]; Plane[][] sidePlanes = new Plane[n][]; Plane[][] topPlanes = new Plane[n][]; Polyline[][][] midOutlines0 = new Polyline[n][][]; Polyline[][][] sideOutlines0 = new Polyline[n][][]; Polyline[][][] misOutlinesJoints = new Polyline[n][][]; //Repesent mid panels with finger joints List <Polyline>[][] sideOutlinesJoints0 = new List <Polyline> [n][]; //n - number of sides List <Polyline>[][] sideOutlinesJoints1 = new List <Polyline> [n][]; //n - number of sides for (int i = 0; i < n; i++) { boxes[i] = new TheBox(meshBoxesOutlinesTop[i][0], meshBoxesOutlinesTop[i][1], planeWidth, new List <double> { 0.5 }, cornerType, parallel, divisions + 1, i); boxes[i].ConstructPlanes(); boxes[i].ConstructOutlines(); boxes[i].ConstructJoints(); boxes[i].ConstructJointsLines(); sidePlanes[i] = boxes[i].sidePlanes; topPlanes[i] = boxes[i].topPlanes; sideOutlines0[i] = boxes[i].sideOutlines0; midOutlines0[i] = boxes[i].midOutlines0; misOutlinesJoints[i] = boxes[i].misOutlinesJoints; sideOutlinesJoints0[i] = boxes[i].sideOutlinesJoints0; sideOutlinesJoints1[i] = boxes[i].sideOutlinesJoints1; } //3.0 Setup neighbours if (screws) { int[][] e = mesh0.GetNGonsTopoBoundaries(); HashSet <int> allE = mesh0.GetAllNGonEdges(e); int[] allEArray = allE.ToArray(); int[][] eNgons = mesh0.GetNgonsConnectedToNGonsEdges(allE); int[][] ne = mesh0.GetNGonFacesEdges(e); List <Line>[][] screws_ = new List <Line> [n][];//n - number of sides //Loop through ngons for (int i = 0; i < n; i++) { screws_[i] = new List <Line> [ne[i].Length]; //Loop through negon edges for (int j = 0; j < ne[i].Length; j++) { screws_[i][j] = new List <Line>(); //if not naked if (mesh0.TopologyEdges.GetConnectedFaces(ne[i][j]).Length > 1) { //Get currnet ngon line // int prev = NGonsCore.MathUtil.Wrap(j-1,ne[i].Length); Line ln0 = boxes[i].jointLines[j][0]; Line ln0_ = boxes[i].jointLines[j][1]; ////Get neighbour ngon line //First get edge ngons int eID = Array.IndexOf(allEArray, ne[i][j]); int[] currentNGons = eNgons[eID]; int neiN = (currentNGons[0] == i) ? currentNGons[1] : currentNGons[0];//neighbour ngon //Local edge id of neighbour polygon int neiEID = Array.IndexOf(ne[neiN], ne[i][j]); //int prevNei = NGonsCore.MathUtil.Wrap(j+1,ne[neiN].Length); Line ln1 = boxes[neiN].jointLines[neiEID][0]; Line ln1_ = boxes[neiN].jointLines[neiEID][1]; // Polyline polyline = new Polyline(){boxes[i].c0,ln0.PointAt(0.5),boxes[neiN].c0 }; //Polyline polyline = new Polyline(){ln0.PointAt(0.5),0.5*(ln0.PointAt(0.5)+ln1.PointAt(0.5)) }; Point3d[] intp0 = NGonsCore.PointUtil.InterpolatePoints(ln0.PointAt(0.2), ln0.PointAt(0.8), 0); Point3d[] intp1 = NGonsCore.PointUtil.InterpolatePoints(ln1.PointAt(0.8), ln1.PointAt(0.2), 0); Point3d[] intp0_ = NGonsCore.PointUtil.InterpolatePoints(ln0_.PointAt(0.2), ln0_.PointAt(0.8), 0); Point3d[] intp1_ = NGonsCore.PointUtil.InterpolatePoints(ln1_.PointAt(0.8), ln1_.PointAt(0.2), 0); for (int k = 0; k < intp0.Length; k++) { Vector3d vec = intp0[k] - intp1[k]; vec.Unitize(); vec *= 0.01; Line joint = new Line(intp0[k] + vec, 0.5 * (intp0[k] + intp1[k])); screws_[i][j].Add(joint); } for (int k = 0; k < intp0.Length; k++) { Vector3d vec = intp0_[k] - intp1_[k]; vec.Unitize(); vec *= 0.01; Line joint = new Line(intp0_[k] + vec, 0.5 * (intp0_[k] + intp1_[k])); screws_[i][j].Add(joint); } } } } DA.SetDataTree(6, NGonsCore.GrasshopperUtil.IE3(screws_, 0)); }//if screws DA.SetDataTree(1, NGonsCore.GrasshopperUtil.IE2(sidePlanes, 0)); DA.SetDataTree(2, NGonsCore.GrasshopperUtil.IE2(topPlanes, 0)); DA.SetDataTree(3, NGonsCore.GrasshopperUtil.IE3(misOutlinesJoints, 0)); DA.SetDataTree(4, NGonsCore.GrasshopperUtil.IE3(sideOutlinesJoints0, 0)); DA.SetDataTree(5, NGonsCore.GrasshopperUtil.IE3(sideOutlinesJoints1, 0)); } }catch (Exception e) { Rhino.RhinoApp.WriteLine(e.ToString()); } }
protected override void SolveInstance(IGH_DataAccess DA) { //Retrieve parameters GH_Structure <GH_Curve> c0 = new GH_Structure <GH_Curve>(); GH_Structure <GH_Curve> c1 = new GH_Structure <GH_Curve>(); Mesh mesh0 = new Mesh(); Mesh mesh1 = new Mesh(); double planeWidth = 0.01; int divisions = 2; bool cornerType = true; double parallel = 0.0; bool screws = true; DA.GetDataTree <GH_Curve>(0, out c0); DA.GetDataTree <GH_Curve>(1, out c1); DA.GetData(2, ref mesh0); DA.GetData(3, ref mesh1); DA.GetData(4, ref planeWidth); DA.GetData(5, ref divisions); DA.GetData(6, ref cornerType); DA.GetData(7, ref parallel); DA.GetData(8, ref screws); //Use curves as input if (c0.DataCount > 0 && (c0.DataCount == c1.DataCount)) { List <Polyline> outlines0 = new List <Polyline>(); List <Polyline> outlines1 = new List <Polyline>(); var c0Enumerator = c0.GetEnumerator(); var c1Enumerator = c1.GetEnumerator(); while (c0Enumerator.MoveNext() && c1Enumerator.MoveNext()) { Object curve0 = c0Enumerator.Current; Object curve1 = c1Enumerator.Current; } int n = c0.DataCount; foreach (GH_Curve ghc in c0.AllData(true)) { ghc.Value.TryGetPolyline(out Polyline p); outlines0.Add(p); } foreach (GH_Curve ghc in c1.AllData(true)) { ghc.Value.TryGetPolyline(out Polyline p); outlines1.Add(p); } //2.0 Setup theBox class TheBox[] boxes = new TheBox[n]; Plane[][] sidePlanes = new Plane[n][]; Plane[][] topPlanes = new Plane[n][]; Polyline[][][] midOutlines0 = new Polyline[n][][]; Polyline[][][] sideOutlines0 = new Polyline[n][][]; for (int i = 0; i < n; i++) { boxes[i] = new TheBox(outlines0[i], outlines1[i], planeWidth, new List <double> { 0.5 }, cornerType, parallel, divisions, i); boxes[i].ConstructPlanes(); sidePlanes[i] = boxes[i].sidePlanes; topPlanes[i] = boxes[i].topPlanes; boxes[i].ConstructOutlines(); sideOutlines0[i] = boxes[i].sideOutlines0; midOutlines0[i] = boxes[i].midOutlines0; } DA.SetDataTree(1, NGonsCore.GrasshopperUtil.IE2(sidePlanes)); DA.SetDataTree(2, NGonsCore.GrasshopperUtil.IE2(topPlanes)); DA.SetDataTree(3, NGonsCore.GrasshopperUtil.IE3(sideOutlines0)); DA.SetDataTree(4, NGonsCore.GrasshopperUtil.IE3(midOutlines0)); //Use meshes as input with its adjacency } else { //mesh0.Append(mesh1); Mesh[] meshBoxes = mesh0.ProjectPairsMesh(mesh1, 1); DA.SetDataList(0, meshBoxes); int n = meshBoxes.Length; } }