// Only used for HUD public ISprite CreateArrowItem(SpriteBatch spriteBatch, Vector2 startingPos) { IItem add = new ArrowItem(spriteBatch, textures["arrow"], startingPos, new Vector2(0, 1)); RoomItems.Instance.AddItem(add); return(add); }
public float update() { //큐의 카운트가 0이고 진행도가 1이상이면 재생중인 모든 시퀀스가 끝났다는 이야기 if (AIQueue.Count == 0 && prog >= 1f) { return(0); } if (bPlay == false) { return(0); } result = Mathf.Lerp(currentItem.start, currentItem.end, prog); prog += Time.deltaTime / currentItem.duration; if (prog >= 1f) { if (AIQueue.Count == 0) { Stop(); } else { currentItem = AIQueue.Dequeue(); prog = 0f; } } return(result); }
//시퀀스 추가 public void Append(ArrowItem item) { //화살표 방향은 반드시 시계방향으로만 돌아야 하므로 끝점이 시작점보다 작으면 //끝점에 360을 더해 한바퀴를 돌려줌. if (item.start > item.end) { item.end += 360f; } AIQueue.Enqueue(item); }
public void PlotTest() { plotSurface.Clear(); // can plot different types. ArrayList l = new ArrayList(); l.Add((int)2); l.Add((double)1.0); l.Add((float)3.0); l.Add((int)5.0); LinePlot lp1 = new LinePlot(new double[] { 4.0, 3.0, 5.0, 8.0 }); lp1.Pen = new Pen(Color.LightBlue); lp1.Pen.Width = 2.0f; //lp.AbscissaData = new StartStep( 0.0, 2.0 ); LinePlot lp2 = new LinePlot(new double[] { 2.0, 1.0, 4.0, 5.0 }); lp2.Pen = new Pen(Color.LightBlue); lp2.Pen.Width = 2.0f; FilledRegion fr = new FilledRegion(lp1, lp2); plotSurface.Add(fr); plotSurface.Add(new Grid()); plotSurface.Add(lp1); plotSurface.Add(lp2); ArrowItem a = new ArrowItem(new PointD(2, 4), -50.0f, "Arrow"); a.HeadOffset = 5; a.ArrowColor = Color.Red; a.TextColor = Color.Purple; plotSurface.Add(a); MarkerItem m = new MarkerItem(new Marker(Marker.MarkerType.TriangleDown, 8, Color.ForestGreen), 1.38, 2.9); plotSurface.Add(m); plotSurface.XAxis1.TicksCrossAxis = true; ((LinearAxis)plotSurface.XAxis1).LargeTickValue = -4.1; ((LinearAxis)plotSurface.XAxis1).AutoScaleText = true; ((LinearAxis)plotSurface.XAxis1).TicksIndependentOfPhysicalExtent = true; //plotSurface.XAxis1.Label = "Hello world"; plotSurface.Refresh(); }
//애니메이션 시작 public void Start() { if (bPlay == true) { return; } if (AIQueue.Count == 0) { return; } currentItem = AIQueue.Dequeue(); prog = 0f; bPlay = true; }
public void AppendAngle(float eulerAngle) { ArrowItem item; //임시로 duration설정 차후 수정 if (currentItem != null) { item = new ArrowItem(currentItem.end, eulerAngle, 1f); } else { item = new ArrowItem(0f, eulerAngle, 1f); } Append(item); }
// Use this for initialization new void Start() { base.Start(); displayName = "Arrow"; lootTables = new Item[1][]; lootTables[0] = new Item[1]; lootTables[0][0] = new ArrowItem(1); lootFrequencyTables = new int[1][]; lootFrequencyTables[0] = new int[1]; lootFrequencyTables[0][0] = 100; numberOfItemsDropped = new int[1]; numberOfItemsDropped[0] = 1; }
private void checkBox8_CheckedChanged(object sender, EventArgs e) { CheckBox cbx = (CheckBox)sender; if (cbx.Checked == true) { a = new ArrowItem(new PointD(2, 4), 360 - (30 - 90), "Arrow"); //a.HeadOffset = 5; a.ArrowColor = Color.Red; a.TextColor = Color.Purple; this.myPlot.Add(a); } else { if (a != null) { this.myPlot.Remove(a, false); } } myPlot.Refresh(); }
private static void Prefix(ArrowItem __instance, GameObject collider, Vector3 collisionPoint) { // Must hit the target if (collider.name != "OBJ_BullseyeTarget_Prefab") { return; } // must be level 0 or 1 (1 or 2 in game) int archerylevel = GameManager.GetSkillArchery().GetCurrentTierNumber(); if (archerylevel > 1) { return; } // Must be standing a decent distance away var timeInAir = Time.time - __instance.m_ReleaseTime; if (timeInAir < 0.25) { return; } // Must hit the paper bullseye (not the outer rim) if (collisionPoint.x < 1646.7 || collisionPoint.x > 1647.2) { return; } if (collisionPoint.y < 43.9 || collisionPoint.y > 44.7) { return; } if (collisionPoint.z < 1827.9 || collisionPoint.z > 1828.6) { return; } GameManager.GetSkillsManager().IncrementPointsAndNotify(SkillType.Archery, 1, SkillsManager.PointAssignmentMode.AssignOnlyInSandbox); }
public ArrowItem(ArrowItem other) : base(other) { }
public void CreatePlot(InteractivePlotSurface2D plotSurface) { plotSurface.Clear(); // can plot different types. ArrayList l = new ArrayList(); l.Add((int)2); l.Add((double)1.0); l.Add((float)3.0); l.Add((int)5.0); LinePlot lp1 = new LinePlot(new double[] { 4.0, 3.0, 5.0, 8.0 }); lp1.Pen = new Pen(Color.LightBlue); lp1.Pen.Width = 2.0f; //lp.AbscissaData = new StartStep( 0.0, 2.0 ); LinePlot lp2 = new LinePlot(new double[] { 2.0, 1.0, 4.0, 5.0 }); lp2.Pen = new Pen(Color.LightBlue); lp2.Pen.Width = 2.0f; FilledRegion fr = new FilledRegion(lp1, lp2); plotSurface.Add(fr); plotSurface.Add(new Grid()); plotSurface.Add(lp1); plotSurface.Add(lp2); ArrowItem a = new ArrowItem(new PointD(2, 4), -50.0f, "Arrow"); a.HeadOffset = 5; a.ArrowColor = Color.Red; a.TextColor = Color.Purple; plotSurface.Add(a); MarkerItem m = new MarkerItem(new Marker(Marker.MarkerType.TriangleDown, 8, Color.ForestGreen), 1.38, 2.9); plotSurface.Add(m); plotSurface.XAxis1.TicksCrossAxis = true; ((LinearAxis)plotSurface.XAxis1).LargeTickValue = -4.1; ((LinearAxis)plotSurface.XAxis1).AutoScaleText = true; ((LinearAxis)plotSurface.XAxis1).TicksIndependentOfPhysicalExtent = true; //plotSurface.XAxis1.Label = "Hello world"; plotSurface.Refresh(); /* * plotSurface.AutoScaleTitle = false; * plotSurface.AutoScaleAutoGeneratedAxes = true; * * plotSurface.Title = "My Title"; * * double[] a = { 0, 2, 1, 4, double.NaN, double.NaN, 5, 8, 7, 9 }; * LinePlot lp = new LinePlot(); * lp.DataSource = a; * lp.Label = "My Label"; * * plotSurface.Add( lp ); * * plotSurface.Legend = new Legend(); * plotSurface.Legend.AutoScaleText = false; * plotSurface.Legend.NeverShiftAxes = true; * plotSurface.Legend.HorizontalEdgePlacement = Legend.Placement.Inside; * plotSurface.Legend.VerticalEdgePlacement = Legend.Placement.Inside; * plotSurface.Legend.XOffset = -10; * plotSurface.Legend.YOffset = 10; * //plotSurface.AddAxesConstraint( new AxesConstraint.EqualSpacing() ); * * ((LinearAxis)plotSurface.XAxis1).Offset = 10.0; * ((LinearAxis)plotSurface.XAxis1).Scale = 27.0; * //((LinearAxis)plotSurface.XAxis1).TicksIndependentOfPhysicalExtent = true; * //((LinearAxis)plotSurface.YAxis1).TicksIndependentOfPhysicalExtent = true; * * AxesConstraint.AxisPosition c1 = * new Florence.AxesConstraint.AxisPosition( PlotSurface2D.YAxisPosition.Left, 100.0f ); * * AxesConstraint.AspectRatio c2 = * new AxesConstraint.AspectRatio( 5.0f, PlotSurface2D.YAxisPosition.Left ); * * plotSurface.AddAxesConstraint( c1 ); * plotSurface.AddAxesConstraint( c2 ); * * plotSurface.Refresh(); */ }
// Start is called before the first frame update void Start() { RandomMap map; EventManager eventManager; if (PlayerController.eventManager == null || PlayerController.map == null) { map = new RandomMap(); map.createMap(10); eventManager = new EventManager(map); PlayerController.eventManager = eventManager; PlayerController.map = map; } else { map = PlayerController.map; eventManager = PlayerController.eventManager; } for (int i = 0; i < map.hexagons.Count; i++) { for (int j = 0; j < map.hexagons[i].hexItems.Count; j++) { Vector3Int pos = new Vector3Int(map.hexagons[i].hexItems[j].posX, map.hexagons[i].hexItems[j].posY, 0); if (tilemap.GetTile(pos) == null) { tilemap.SetTile(pos, roundTile); } } GameObject hexbg = Instantiate(hexBgPrefab); hexbg.GetComponent <Transform>().SetParent(tilemap.transform, true); hexbg.GetComponent <Transform>().position = map.hexagons[i].hexBgPosition; hexbg.GetComponent <SpriteRenderer>().sprite = hexBgs[map.hexagons[i].bgIndex]; } for (int i = 0; i < map.arrow.arrowItems.Count; i++) { ArrowItem arrowItem = map.arrow.arrowItems[i]; Vector3Int pos = new Vector3Int(arrowItem.posX, arrowItem.posY, 0); if (tilemap.GetTile(pos) == null) { Tile t = ScriptableObject.CreateInstance <Tile>(); string d = arrowItem.direction; //Debug.Log(arrowItem.direction); switch (arrowItem.direction) { case "rightUp": t = arrRightUp; break; case "right": t = arrRight; break; case "rightDown": t = arrRightDown; break; case "leftRight": t = arrLeftRight; break; case "rightLeft": t = arrRightLeft; break; case "leftUp": t = arrLeftUp; break; case "leftDown": t = arrLeftDown; break; } tilemap.SetTile(pos, t); } } for (int i = 0; i < eventManager.allEvents.Count; i++) { float eventPosX = eventManager.allEvents[i].posX; float eventPosY = (float)(eventManager.allEvents[i].posY / 2 * 1.73); int eventType = eventManager.allEvents[i].eventType; //Debug.Log(eventType); int index = 0; switch (eventType) { case 1: index = 0; break; case 2: index = 1; break; case 3: index = 2; break; case 4: index = 3; break; case 5: index = 4; break; case 9: index = 5; break; } GameObject eventObj = Instantiate(eventPrefabs[index]); eventObj.GetComponent <Transform>().SetParent(tilemap.transform, true); eventObj.GetComponent <Transform>().position = new Vector3(eventPosX, eventPosY, 0); } //PlayerController.Save(); }
public void handlePoints() { /* * 2 * 1 3 * 6 4 * 5 * * * -2 1 rightUp * 0 2 right * 1 1 * 1 -1 * 0 -2 right * -2 1 rightdown * * */ for (int i = 0; i < centerPoints.Count; i++) { int cenX = centerPoints[i].x; int cenY = centerPoints[i].y; ArrowItem arrowItem1 = new ArrowItem(cenX - 2, cenY + 1, "rightUp"); ArrowItem arrowItem2 = new ArrowItem(cenX, cenY + 2, "right"); ArrowItem arrowItem3 = new ArrowItem(cenX + 1, cenY + 1, "rightDown"); ArrowItem arrowItem4 = new ArrowItem(cenX + 1, cenY - 1, "rightUp"); if (i + 1 < centerPoints.Count) { int checkX = centerPoints[i + 1].x; if (checkX == centerPoints[i].x) { checkX = centerPoints[i + 2].x; } for (int k = 0; k < centerPoints.Count; k++) { if (checkX == centerPoints[k].x) { //比较centerPoints[i].y 和centerPoints[k].y //小 3为 leftright //大 4为 rightleft if (centerPoints[i].y - centerPoints[k].y == -2) { arrowItem3 = new ArrowItem(cenX + 1, cenY + 1, "leftRight"); } else if (centerPoints[i].y - centerPoints[k].y == -6) { arrowItem3 = new ArrowItem(cenX + 1, cenY + 1, "leftUp"); } if (centerPoints[i].y - centerPoints[k].y == 2) { arrowItem4 = new ArrowItem(cenX + 1, cenY - 1, "rightLeft"); break; } else if (centerPoints[i].y - centerPoints[k].y == 6) { arrowItem4 = new ArrowItem(cenX + 1, cenY - 1, "leftDown"); break; } } } } ArrowItem arrowItem5 = new ArrowItem(cenX, cenY - 2, "right"); ArrowItem arrowItem6 = new ArrowItem(cenX - 2, cenY - 1, "rightDown"); arrowItems.Add(arrowItem1); arrowItems.Add(arrowItem2); arrowItems.Add(arrowItem3); arrowItems.Add(arrowItem4); arrowItems.Add(arrowItem5); arrowItems.Add(arrowItem6); } }
public PlotDataset() { infoText = ""; infoText += "Stock Dataset Sample. Demonstrates - \n"; infoText += " * CandlePlot, FilledRegion, LinePlot and ArrowItem IDrawables \n"; infoText += " * DateTime axes \n"; infoText += " * Horizontal Drag Interaction - try dragging (and Ctrl-dragging) the plot surface \n"; infoText += " * Axis Drag Interaction - try dragging in the horizontal and vertical Axis areas"; plotSurface.Clear(); // [NOTIMP] plotSurface.DateTimeToolTip = true; // obtain stock information from xml file DataSet ds = new DataSet(); System.IO.Stream file = Assembly.GetExecutingAssembly().GetManifestResourceStream("SwfTest.Resources.asx_jbh.xml"); ds.ReadXml(file, System.Data.XmlReadMode.ReadSchema); DataTable dt = ds.Tables[0]; // DataView dv = new DataView( dt ); // create CandlePlot. CandlePlot cp = new CandlePlot(); cp.DataSource = dt; cp.AbscissaData = "Date"; cp.OpenData = "Open"; cp.LowData = "Low"; cp.HighData = "High"; cp.CloseData = "Close"; cp.BearishColor = Color.Red; cp.BullishColor = Color.Green; cp.Style = CandlePlot.Styles.Filled; // calculate 10 day moving average and 2*sd line ArrayList av10 = new ArrayList(); ArrayList sd2_10 = new ArrayList(); ArrayList sd_2_10 = new ArrayList(); ArrayList dates = new ArrayList(); for (int i = 0; i < dt.Rows.Count - 10; ++i) { float sum = 0.0f; for (int j = 0; j < 10; ++j) { sum += (float)dt.Rows[i + j]["Close"]; } float average = sum / 10.0f; av10.Add(average); sum = 0.0f; for (int j = 0; j < 10; ++j) { sum += ((float)dt.Rows[i + j]["Close"] - average) * ((float)dt.Rows[i + j]["Close"] - average); } sum /= 10.0f; sum = 2.0f * (float)Math.Sqrt(sum); sd2_10.Add(average + sum); sd_2_10.Add(average - sum); dates.Add((DateTime)dt.Rows[i + 10]["Date"]); } // and a line plot of close values. LinePlot av = new LinePlot(); av.OrdinateData = av10; av.AbscissaData = dates; av.Color = Color.LightGray; av.Pen.Width = 2.0f; LinePlot top = new LinePlot(); top.OrdinateData = sd2_10; top.AbscissaData = dates; top.Color = Color.LightSteelBlue; top.Pen.Width = 2.0f; LinePlot bottom = new LinePlot(); bottom.OrdinateData = sd_2_10; bottom.AbscissaData = dates; bottom.Color = Color.LightSteelBlue; bottom.Pen.Width = 2.0f; FilledRegion fr = new FilledRegion(top, bottom); fr.RectangleBrush = new RectangleBrushes.Vertical(Color.FromArgb(255, 255, 240), Color.FromArgb(240, 255, 255)); plotSurface.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; plotSurface.Add(fr); plotSurface.Add(new Grid()); plotSurface.Add(av); plotSurface.Add(top); plotSurface.Add(bottom); plotSurface.Add(cp); // now make an arrow... ArrowItem arrow = new ArrowItem(new PointD(((DateTime)dt.Rows[60]["Date"]).Ticks, 2.28), -80, "An interesting flat bit"); arrow.ArrowColor = Color.DarkBlue; arrow.PhysicalLength = 50; plotSurface.Add(arrow); plotSurface.Title = "AU:JBH"; plotSurface.XAxis1.Label = "Date / Time"; plotSurface.XAxis1.WorldMin += plotSurface.XAxis1.WorldLength / 4.0; plotSurface.XAxis1.WorldMax -= plotSurface.XAxis1.WorldLength / 2.0; plotSurface.YAxis1.Label = "Price [$]"; plotSurface.XAxis1 = new TradingDateTimeAxis(plotSurface.XAxis1); plotSurface.AddInteraction(new PlotDrag(true, false)); plotSurface.AddInteraction(new AxisDrag()); // make sure plot surface colors are as we expect - the wave example changes them. plotSurface.PlotBackColor = Color.White; plotSurface.XAxis1.Color = Color.Black; plotSurface.YAxis1.Color = Color.Black; plotSurface.Refresh(); }
// Creates the initial game state - this will probably be a huge method at the end of it.. TODO: find way to dynamically create items/npc/etc and place them in appropriate region public void CreateNewGame() { //TEMPORARY NEED TO CREATE SOME SORT OF GAME SETUP / REGION SETUP that is easily scalable List <Sprite> giannaLandTiles = BoundingBoxLocations.RegionMap["Gianna"].RegionLandTiles; List <Sprite> scLandTiles = BoundingBoxLocations.RegionMap["SnooCat"].RegionLandTiles; List <Sprite> usoppLandTiles = BoundingBoxLocations.RegionMap["Usopp"].RegionLandTiles; var screenCenter = new Vector2(_graphics.Viewport.Bounds.Width / 2, _graphics.Viewport.Bounds.Height / 2); ShortShip shortShip = new ShortShip(TeamType.Player, "GustoMap", new Vector2(-100, -600), _content, _graphics); shortShip.shipInterior.interiorId = Guid.NewGuid(); BoundingBoxLocations.interiorMap.Add(shortShip.shipInterior.interiorId, shortShip.shipInterior); BaseShip baseShip = new BaseShip(TeamType.Player, "GustoMap", new Vector2(-300, -600), _content, _graphics); baseShip.shipInterior.interiorId = Guid.NewGuid(); BoundingBoxLocations.interiorMap.Add(baseShip.shipInterior.interiorId, baseShip.shipInterior); BaseShip baseShipAI = new BaseShip(TeamType.A, "Usopp", new Vector2(500, -140), _content, _graphics); baseShipAI.shipInterior.interiorId = Guid.NewGuid(); BoundingBoxLocations.interiorMap.Add(baseShipAI.shipInterior.interiorId, baseShipAI.shipInterior); TeePee teePee = new TeePee(TeamType.A, "Gianna", new Vector2(340, -850), _content, _graphics); teePee.structureInterior.interiorId = Guid.NewGuid(); BoundingBoxLocations.interiorMap.Add(teePee.structureInterior.interiorId, teePee.structureInterior); BaseTribal baseTribalLand = new BaseTribal(TeamType.A, "Gianna", giannaLandTiles[RandomEvents.rand.Next(giannaLandTiles.Count)].location, _content, _graphics); BaseCat baseCatLand = new BaseCat(TeamType.B, "SnooCat", scLandTiles[RandomEvents.rand.Next(scLandTiles.Count)].location, _content, _graphics); Chicken chickenLand = new Chicken(TeamType.Animal, "Gianna", giannaLandTiles[RandomEvents.rand.Next(giannaLandTiles.Count)].location, _content, _graphics); Snake snakeLand = new Snake(TeamType.Animal, "Usopp", usoppLandTiles[RandomEvents.rand.Next(usoppLandTiles.Count)].location, _content, _graphics); BlueBird blueBird = new BlueBird(TeamType.Animal, "Usopp", usoppLandTiles[RandomEvents.rand.Next(usoppLandTiles.Count)].location, _content, _graphics); Tower tower = new BaseTower(TeamType.B, "GustoMap", new Vector2(-1600, -1500), _content, _graphics); ClayFurnace furnace = new ClayFurnace(TeamType.Player, "GustoMap", new Vector2(180, 140), _content, _graphics); CraftingAnvil craftingAnvil = new CraftingAnvil(TeamType.Player, "GustoMap", new Vector2(120, 40), _content, _graphics); BaseBarrel barrelLand = new BaseBarrel(TeamType.A, "GustoMap", new Vector2(-20, -160), _content, _graphics); BaseBarrel barrelOcean = new BaseBarrel(TeamType.A, "GustoMap", new Vector2(380, -90), _content, _graphics); BaseChest chestLand = new BaseChest(TeamType.A, "GustoMap", new Vector2(100, -120), _content, _graphics); CampFire campfire = new CampFire(TeamType.A, "GustoMap", new Vector2(70, -350), _content, _graphics); Shovel shovel = new Shovel(TeamType.A, "GustoMap", new Vector2(200, -330), _content, _graphics); shovel.onGround = true; Pickaxe pickaxe = new Pickaxe(TeamType.Player, "GustoMap", new Vector2(130, -430), _content, _graphics); pickaxe.onGround = true; //Pistol pistol = new Pistol(TeamType.A, "GustoMap", new Vector2(250, -300), _content, _graphics); //pistol.amountStacked = 1; //pistol.onGround = true; BaseCannon cannon = new BaseCannon(TeamType.A, "GustoMap", new Vector2(0, -450), _content, _graphics); cannon.onGround = true; Ballista ballista = new Ballista(TeamType.A, "GustoMap", new Vector2(-120, -550), _content, _graphics); ballista.onGround = true; CrossBow crossBow = new CrossBow(TeamType.A, "GustoMap", new Vector2(220, -350), _content, _graphics); crossBow.amountStacked = 1; crossBow.onGround = true; ArrowItem arrows = new ArrowItem(TeamType.A, "GustoMap", new Vector2(210, -340), _content, _graphics); arrows.onGround = true; arrows.amountStacked = 10; //PistolShotItem pistolAmmo = new PistolShotItem(TeamType.A, "GustoMap", new Vector2(220, -300), _content, _graphics); //pistolAmmo.amountStacked = 14; //pistolAmmo.onGround = true; CannonBallItem cannonAmmo = new CannonBallItem(TeamType.A, "GustoMap", new Vector2(200, -300), _content, _graphics); cannonAmmo.amountStacked = 10; cannonAmmo.onGround = true; RustyHarpoonItem harpoonAmmo = new RustyHarpoonItem(TeamType.A, "GustoMap", new Vector2(-120, -550), _content, _graphics); harpoonAmmo.amountStacked = 10; harpoonAmmo.onGround = true; Lantern lantern = new Lantern(TeamType.A, "GustoMap", new Vector2(180, -300), _content, _graphics); lantern.onGround = true; BasePlank basePlank = new BasePlank(TeamType.A, "GustoMap", new Vector2(150, -300), _content, _graphics); basePlank.onGround = true; basePlank.amountStacked = 10; // Item utility is global and is accessed in main update, all items that are "dropped" or placed on the world view ground exist in this list (placable, invetory, etc) ItemUtility.ItemsToUpdate.Add(lantern); ItemUtility.ItemsToUpdate.Add(furnace); ItemUtility.ItemsToUpdate.Add(craftingAnvil); ItemUtility.ItemsToUpdate.Add(barrelLand); ItemUtility.ItemsToUpdate.Add(barrelOcean); ItemUtility.ItemsToUpdate.Add(chestLand); ItemUtility.ItemsToUpdate.Add(shovel); //ItemUtility.ItemsToUpdate.Add(pistol); ItemUtility.ItemsToUpdate.Add(cannon); ItemUtility.ItemsToUpdate.Add(ballista); ItemUtility.ItemsToUpdate.Add(crossBow); ItemUtility.ItemsToUpdate.Add(arrows); ItemUtility.ItemsToUpdate.Add(pickaxe); //ItemUtility.ItemsToUpdate.Add(pistolAmmo); ItemUtility.ItemsToUpdate.Add(cannonAmmo); ItemUtility.ItemsToUpdate.Add(harpoonAmmo); ItemUtility.ItemsToUpdate.Add(basePlank); ItemUtility.ItemsToUpdate.Add(campfire); UpdateOrder.Add(shortShip); UpdateOrder.Add(baseShip); UpdateOrder.Add(baseShipAI); UpdateOrder.Add(player); UpdateOrder.Add(baseTribalLand); UpdateOrder.Add(baseCatLand); UpdateOrder.Add(chickenLand); UpdateOrder.Add(blueBird); UpdateOrder.Add(snakeLand); UpdateOrder.Add(tower); UpdateOrder.Add(teePee); // interior set BaseTribal baseTribalInShip = new BaseTribal(TeamType.A, "GustoMap", Vector2.Zero, _content, _graphics); baseTribalInShip.npcInInterior = baseShipAI.shipInterior; baseShipAI.shipInterior.interiorObjects.Add(baseTribalInShip); ready = true; }
public ComboDemo() : base("A demo that combines bar charts with line graphs, curve filling, text items, etc.", "Combo Demo", DemoType.General, DemoType.Line) { GraphPane myPane = base.GraphPane; // Set the titles and axis labels myPane.Title = "Wacky Widget Company\nProduction Report"; myPane.XAxis.Title = "Time, Days\n(Since Plant Construction Startup)"; myPane.YAxis.Title = "Widget Production\n(units/hour)"; LineItem curve; // Set up curve "Larry" double[] x = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 }; double[] y = { 20, 10, 50, 25, 35, 75, 90, 40, 33, 50 }; // Use green, with circle symbols curve = myPane.AddCurve("Larry", x, y, Color.Green, SymbolType.Circle); curve.Line.Width = 1.5F; // Fill the area under the curve with a white-green gradient curve.Line.Fill = new Fill(Color.White, Color.FromArgb(60, 190, 50), 90F); // Make it a smooth line curve.Line.IsSmooth = true; curve.Line.SmoothTension = 0.6F; // Fill the symbols with white curve.Symbol.Fill = new Fill(Color.White); curve.Symbol.Size = 10; // Second curve is "moe" double[] x3 = { 150, 250, 400, 520, 780, 940 }; double[] y3 = { 5.2, 49.0, 33.8, 88.57, 99.9, 36.8 }; // Use a red color with triangle symbols curve = myPane.AddCurve("Moe", x3, y3, Color.FromArgb(200, 55, 135), SymbolType.Triangle); curve.Line.Width = 1.5F; // Fill the area under the curve with semi-transparent pink using the alpha value curve.Line.Fill = new Fill(Color.White, Color.FromArgb(160, 230, 145, 205), 90F); // Fill the symbols with white curve.Symbol.Fill = new Fill(Color.White); curve.Symbol.Size = 10; // Third Curve is a bar, called "Wheezy" double[] x4 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 }; double[] y4 = { 30, 45, 53, 60, 75, 83, 84, 79, 71, 57 }; BarItem bar = myPane.AddBar("Wheezy", x4, y4, Color.SteelBlue); // Fill the bars with a RosyBrown-White-RosyBrown gradient bar.Bar.Fill = new Fill(Color.RosyBrown, Color.White, Color.RosyBrown); // Fourth curve is a bar double[] x2 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 }; double[] y2 = { 10, 15, 17, 20, 25, 27, 29, 26, 24, 18 }; bar = myPane.AddBar("Curly", x2, y2, Color.RoyalBlue); // Fill the bars with a RoyalBlue-White-RoyalBlue gradient bar.Bar.Fill = new Fill(Color.RoyalBlue, Color.White, Color.RoyalBlue); // Fill the pane background with a gradient myPane.PaneFill = new Fill(Color.WhiteSmoke, Color.Lavender, 0F); // Fill the axis background with a gradient myPane.AxisFill = new Fill(Color.FromArgb(255, 255, 245), Color.FromArgb(255, 255, 190), 90F); // Make each cluster 100 user scale units wide. This is needed because the X Axis // type is Linear rather than Text or Ordinal myPane.ClusterScaleWidth = 100; // Bars are stacked myPane.BarType = BarType.Stack; // Enable the X and Y axis grids myPane.XAxis.IsShowGrid = true; myPane.YAxis.IsShowGrid = true; // Manually set the scale maximums according to user preference myPane.XAxis.Max = 1200; myPane.YAxis.Max = 120; // Add a text item to decorate the graph TextItem text = new TextItem("First Prod\n21-Oct-93", 175F, 80.0F); // Align the text such that the Bottom-Center is at (175, 80) in user scale coordinates text.Location.AlignH = AlignH.Center; text.Location.AlignV = AlignV.Bottom; text.FontSpec.Fill = new Fill(Color.White, Color.PowderBlue, 45F); text.FontSpec.StringAlignment = StringAlignment.Near; myPane.GraphItemList.Add(text); // Add an arrow pointer for the above text item ArrowItem arrow = new ArrowItem(Color.Black, 12F, 175F, 77F, 100F, 45F); arrow.Location.CoordinateFrame = CoordType.AxisXYScale; myPane.GraphItemList.Add(arrow); // Add a another text item to to point out a graph feature text = new TextItem("Upgrade", 700F, 50.0F); // rotate the text 90 degrees text.FontSpec.Angle = 90; // Align the text such that the Right-Center is at (700, 50) in user scale coordinates text.Location.AlignH = AlignH.Right; text.Location.AlignV = AlignV.Center; // Disable the border and background fill options for the text text.FontSpec.Fill.IsVisible = false; text.FontSpec.Border.IsVisible = false; myPane.GraphItemList.Add(text); // Add an arrow pointer for the above text item arrow = new ArrowItem(Color.Black, 15, 700, 53, 700, 80); arrow.Location.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 2.0F; myPane.GraphItemList.Add(arrow); // Add a text "Confidential" stamp to the graph text = new TextItem("Confidential", 0.85F, -0.03F); // use AxisFraction coordinates so the text is placed relative to the AxisRect text.Location.CoordinateFrame = CoordType.AxisFraction; // rotate the text 15 degrees text.FontSpec.Angle = 15.0F; // Text will be red, bold, and 16 point text.FontSpec.FontColor = Color.Red; text.FontSpec.IsBold = true; text.FontSpec.Size = 16; // Disable the border and background fill options for the text text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; // Align the text such the the Left-Bottom corner is at the specified coordinates text.Location.AlignH = AlignH.Left; text.Location.AlignV = AlignV.Bottom; myPane.GraphItemList.Add(text); // Add a BoxItem to show a colored band behind the graph data BoxItem box = new BoxItem(new RectangleF(0, 110, 1200, 10), Color.Empty, Color.FromArgb(225, 245, 225)); box.Location.CoordinateFrame = CoordType.AxisXYScale; // Align the left-top of the box to (0, 110) box.Location.AlignH = AlignH.Left; box.Location.AlignV = AlignV.Top; // place the box behind the axis items, so the grid is drawn on top of it box.ZOrder = ZOrder.E_BehindAxis; myPane.GraphItemList.Add(box); // Add some text inside the above box to indicate "Peak Range" TextItem myText = new TextItem("Peak Range", 1170, 105); myText.Location.CoordinateFrame = CoordType.AxisXYScale; myText.Location.AlignH = AlignH.Right; myText.Location.AlignV = AlignV.Center; myText.FontSpec.IsItalic = true; myText.FontSpec.IsBold = false; myText.FontSpec.Fill.IsVisible = false; myText.FontSpec.Border.IsVisible = false; myPane.GraphItemList.Add(myText); base.ZedGraphControl.AxisChange(); }
public TradingSample() : base() { infoText = ""; infoText += "Stock Dataset Sample. Demonstrates - \n"; infoText += " * CandlePlot, FilledRegion, LinePlot and ArrowItem IDrawables \n"; infoText += " * DateTime axes \n"; infoText += " * Horizontal Drag Interaction - try dragging the plot surface \n"; infoText += " * Axis Drag Interaction - try dragging in the horizontal and vertical Axis areas"; plotCanvas.Clear(); // [NOTIMP] plotCanvas.DateTimeToolTip = true; // obtain stock information from xml file DataSet ds = new DataSet(); System.IO.Stream file = Assembly.GetExecutingAssembly().GetManifestResourceStream("Samples.Resources.asx_jbh.xml"); ds.ReadXml(file, System.Data.XmlReadMode.ReadSchema); DataTable dt = ds.Tables[0]; // DataView dv = new DataView( dt ); // create CandlePlot. CandlePlot cp = new CandlePlot(); cp.DataSource = dt; cp.AbscissaData = "Date"; cp.OpenData = "Open"; cp.LowData = "Low"; cp.HighData = "High"; cp.CloseData = "Close"; cp.BearishColor = Colors.Red; cp.BullishColor = Colors.Green; cp.Style = CandlePlot.Styles.Filled; // calculate 10 day moving average and 2*sd line ArrayList av10 = new ArrayList(); ArrayList sd2_10 = new ArrayList(); ArrayList sd_2_10 = new ArrayList(); ArrayList dates = new ArrayList(); for (int i = 0; i < dt.Rows.Count - 10; ++i) { float sum = 0.0f; for (int j = 0; j < 10; ++j) { sum += (float)dt.Rows[i + j]["Close"]; } float average = sum / 10.0f; av10.Add(average); sum = 0.0f; for (int j = 0; j < 10; ++j) { sum += ((float)dt.Rows[i + j]["Close"] - average) * ((float)dt.Rows[i + j]["Close"] - average); } sum /= 10.0f; sum = 2.0f * (float)Math.Sqrt(sum); sd2_10.Add(average + sum); sd_2_10.Add(average - sum); dates.Add((DateTime)dt.Rows[i + 10]["Date"]); } // and a line plot of close values. LinePlot av = new LinePlot(); av.OrdinateData = av10; av.AbscissaData = dates; av.LineColor = Colors.DarkGray; av.LineWidth = 2.0; LinePlot top = new LinePlot(); top.OrdinateData = sd2_10; top.AbscissaData = dates; top.LineColor = Colors.LightBlue; top.LineWidth = 2.0; LinePlot bottom = new LinePlot(); bottom.OrdinateData = sd_2_10; bottom.AbscissaData = dates; bottom.LineColor = Colors.LightBlue; bottom.LineWidth = 2.0; FilledRegion fr = new FilledRegion(top, bottom); fr.FillColor = Colors.LightGreen; // Note: order of adding FilledRegion, Plots, etc is important for visibility plotCanvas.Add(fr); plotCanvas.Add(new Grid()); plotCanvas.Add(av); plotCanvas.Add(top); plotCanvas.Add(bottom); plotCanvas.Add(cp); // now make an arrow... ArrowItem arrow = new ArrowItem(new Point(((DateTime)dt.Rows[60]["Date"]).Ticks, 2.28), -80, "An interesting flat bit"); arrow.ArrowColor = Colors.DarkBlue; arrow.PhysicalLength = 50; plotCanvas.Add(arrow); plotCanvas.Title = "Stock Prices"; plotCanvas.XAxis1.Label = "Date / Time"; plotCanvas.XAxis1.WorldMin += plotCanvas.XAxis1.WorldLength / 4.0; plotCanvas.XAxis1.WorldMax -= plotCanvas.XAxis1.WorldLength / 2.0; plotCanvas.YAxis1.Label = "Price [$]"; plotCanvas.XAxis1 = new TradingDateTimeAxis(plotCanvas.XAxis1); plotCanvas.PlotBackColor = Colors.White; plotCanvas.XAxis1.LineColor = Colors.Black; plotCanvas.YAxis1.LineColor = Colors.Black; PackStart(plotCanvas.Canvas, true); Label la = new Label(infoText); PackStart(la); }
public void Add(ArrowItem annotation) { throw new NotImplementedException(); }
private void btnVistaPrevia_Click(object sender, System.EventArgs e) { int j = 0; int k = 0; double[] x = new double[12]; double[] y = new double[12]; double[] x1 = new double[12]; double[] y1 = new double[12]; crvInfAgregados.Visible = true; dsInfAgregados1.Clear(); // cryRepAgregados1.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape; cryRepAgregados1.SetDataSource(dsInfAgregados1); sqlDAInfAgregados.SelectCommand.Parameters["@IdObra"].Value = cmbIdObra.SelectedValue.ToString(); sqlDAInfAgregados.SelectCommand.Parameters["@FolioIni"].Value = (chbTodos.Checked ? " " : txtFolioIni.Text); sqlDAInfAgregados.SelectCommand.Parameters["@FolioFin"].Value = (chbTodos.Checked ? "zzzzz" : txtFolioIni.Text); sqlDAInfAgregados.Fill(dsInfAgregados1, "AgregadosRep"); //sqlDAInfAgregadosMal.SelectCommand.Parameters["@IdFolioIni"].Value = txtFolioIni.Text; //sqlDAInfAgregadosMal.SelectCommand.Parameters["@IdFolioFin"].Value = txtFolioFin.Text; //sqlDAInfAgregadosMal.Fill(dsInfAgregados1, "AgregadosMal"); sqlDAFirmas.Fill(dsFirmas1, "Firmas"); sqlDANorma.Fill(dsInfAgregados1, "Normas"); cryRepAgregados1.SetDataSource(dsInfAgregados1); cryRepAgregados1.SetParameterValue("@F1", dsFirmas1.Tables[0].Rows[0][1].ToString()); cryRepAgregados1.SetParameterValue("@F2", dsFirmas1.Tables[0].Rows[1][1].ToString()); cryRepAgregados1.SetParameterValue("@F3", dsFirmas1.Tables[0].Rows[2][1].ToString()); cryRepAgregados1.SetParameterValue("@F4", dsFirmas1.Tables[0].Rows[3][1].ToString()); cryRepAgregados1.SetParameterValue("@F5", dsFirmas1.Tables[0].Rows[4][1].ToString()); cryRepAgregados1.SetParameterValue("@C1", dsFirmas1.Tables[0].Rows[0][2].ToString()); cryRepAgregados1.SetParameterValue("@C2", dsFirmas1.Tables[0].Rows[1][2].ToString()); cryRepAgregados1.SetParameterValue("@C3", dsFirmas1.Tables[0].Rows[2][2].ToString()); cryRepAgregados1.SetParameterValue("@C4", dsFirmas1.Tables[0].Rows[3][2].ToString()); cryRepAgregados1.SetParameterValue("@C5", dsFirmas1.Tables[0].Rows[4][2].ToString()); cryRepAgregados1.SetParameterValue("@Finura", dsInfAgregados1.Tables["AgregadosRep"].Rows[0][21].ToString(), "Subreport2"); cryRepAgregados1.SetParameterValue("@Material", dsInfAgregados1.Tables["AgregadosRep"].Rows[0][6].ToString(), "Subreport2"); cryRepAgregados1.SetParameterValue("@Tamaño", txtTamaño.Text, "Subreport2"); cryRepAgregados1.SetParameterValue("@Duplicado", chbDuplicado.Checked); cryRepAgregados1.SetParameterValue("@Leyenda", chbLeyenda.Checked); cryRepAgregados1.SetParameterValue("@LabLey", chbLab.Checked); cryRepAgregados1.SetParameterValue("@Ineco", chbLab1.Checked); cryRepAgregados1.SetParameterValue("@Respaldo", chbRespaldo.Checked); memGraphics.CreateDoubleBuffer(this.CreateGraphics(), this.ClientRectangle.Width, this.ClientRectangle.Height); myPane = new GraphPane(new Rectangle(10, 10, 10, 10), "", "", ""); SetSize(); int ejex; double MaxX = 0; CurveItem curve; string folio; int rens; for (int m = 0; m < dsInfAgregados1.Tables["AgregadosRep"].Rows.Count; m++) { sqlDAInfAgregadosMal.SelectCommand.Parameters["@IdFolioIni"].Value = dsInfAgregados1.Tables["AgregadosRep"].Rows[m][0].ToString().Trim(); sqlDAInfAgregadosMal.SelectCommand.Parameters["@IdFolioFin"].Value = dsInfAgregados1.Tables["AgregadosRep"].Rows[m][0].ToString().Trim(); sqlDAInfAgregadosMal.Fill(dsInfAgregados1, "AgregadosMal"); folio = "Folio = '" + dsInfAgregados1.Tables["AgregadosRep"].Rows[m][0].ToString().Trim() + "'"; DataRow[] filas; filas = dsInfAgregados1.Tables["AgregadosMal"].Select(folio); rens = filas.Length; int Material = (filas[0][6].ToString() == "Arena" ? 1 : 2); if (Material == 1) { ejex = 4; MaxX = 25; } else { ejex = 2; MaxX = 40; } //Curva que pasa string acotacion = "Pasa"; for (k = 0; k < 12; k++) { x[k] = y[k] = 0; } k = 0; for (j = 11; j > 1 - 1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][7].ToString() != "") { x[k] = double.Parse(filas[j][ejex].ToString()); y[k++] = double.Parse(filas[j][7].ToString()); } } curve = myPane.AddCurve(acotacion, x, y, Color.Blue, SymbolType.Circle); curve.Line.Width = 2.0F; curve.Line.Style = DashStyle.Dash; curve.Symbol.PenWidth = 6.0F; curve.Symbol.Fill = new Fill(Color.Blue); //Limite inferior acotacion = "Li"; for (k = 0; k < 12; k++) { x1[k] = y1[k] = 0; } k = 0; for (j = 11; j > 1 - 1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][8].ToString() != "") { x1[k] = double.Parse(filas[j][ejex].ToString()); y1[k++] = double.Parse(filas[j][8].ToString()); } } curve = myPane.AddCurve(acotacion, x1, y1, Color.Red, SymbolType.Diamond); curve.Line.Width = 2.0F; curve.Symbol.Fill = new Fill(Color.Red); curve.Symbol.PenWidth = 6.0F; //Limite superior acotacion = "Ls"; for (k = 0; k < 12; k++) { x1[k] = y1[k] = 0; } k = 0; for (j = 11; j > 1 - 1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][9].ToString() != "") { x1[k] = double.Parse(filas[j][ejex].ToString()); y1[k++] = double.Parse(filas[j][9].ToString()); } } curve = myPane.AddCurve(acotacion, x1, y1, Color.DarkGreen, SymbolType.Triangle); curve.Line.Width = 2.0F; curve.Symbol.PenWidth = 6.0F; curve.Symbol.Fill = new Fill(Color.DarkGreen); acotacion = "Pasa"; for (k = 0; k < 12; k++) { x[k] = y[k] = 0; } k = 0; for (j = 11; j > 1 - 1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][5].ToString() != "") { ArrowItem arrow = new ArrowItem(Color.Gray, 0, float.Parse(filas[j][ejex].ToString()), 0, float.Parse(filas[j][ejex].ToString()), 100); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 0F; myPane.ArrowList.Add(arrow); } } // myPane.XAxis.ScaledMinorTic(0); // myPane.XAxis.IsMinorInsideTic = false; // myPane.XAxis.TicSize = 0; // myPane.XAxis.IsShowGrid = false; // myPane.XAxis.IsInsideTic = false; // myPane.XAxis.ScaleFontSpec.Angle = 0; // myPane.XAxis.NumDec = 0; // myPane.XAxis.Min = 1; // myPane.XAxis.Max = MaxX; //// MessageBox.Show(myPane.XAxis.ScaleFormat.ToString()); //esta buena // myPane.XAxis.Type = AxisType.Log; //// myPane.XAxis.PickLogScale(); // myPane.XAxis.ScaleFormat = "{0:d###.##}"; // myPane.XAxis.IsShowTitle = false; // myPane.XAxis.ScaleFontSpec.FontColor = Color.White; // myPane.YAxis.IsShowGrid = true; // myPane.YAxis.ScaleFontSpec.Angle = 90; // myPane.YAxis.Min = 0; // myPane.YAxis.Max = 100; // myPane.Legend.IsVisible = false; // myPane.PaneFill = new Fill( Color.White, Color.White, 0F ); // myPane.AxisChange( this.CreateGraphics() ); // pictureBox1.Image = Image.FromHbitmap(myPane.Image.GetHbitmap()); // MemoryStream ms = new MemoryStream(); // pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); // byte[] arrImage = ms.GetBuffer(); // ms.Close(); // myPane.Image.Dispose(); // pictureBox1.Image.Dispose(); // dsInfAgregados1.Grafica.AddGraficaRow(txtFolioIni.Text,arrImage); guardagrafica(dsInfAgregados1.Tables["AgregadosRep"].Rows[m][0].ToString().Trim(), MaxX); myPane = new GraphPane(new Rectangle(10, 10, 10, 10), "", "", ""); SetSize(); } crvInfAgregados.ReportSource = cryRepAgregados1; //crvInfAgregados.RefreshReport(); }
private void btnVistaPrevia_Click(object sender, System.EventArgs e) { int j = 0; int k = 0; crvInfAsfaltico.Visible = true; CryRepAsfalto1.SetDataSource(dsInfAsfaltico1); dsInfAsfaltico1.Clear(); dsFirmas1.Clear(); sqlDAInfAsfaltico.SelectCommand.Parameters["@IdObra"].Value = cmbIdObra.SelectedValue.ToString(); sqlDAInfAsfaltico.SelectCommand.Parameters["@FolioIni"].Value = (chbTodos.Checked ? " " : txtFolioIni.Text); sqlDAInfAsfaltico.SelectCommand.Parameters["@FolioFin"].Value = (chbTodos.Checked ? "zzzzz" : txtFolioIni.Text); sqlDAInfAsfaltico.Fill(dsInfAsfaltico1, "AsfalticoRep"); sqlDAFirmas.Fill(dsFirmas1, "Firmas"); sqlDANorma.SelectCommand.Parameters["@IdNorma"].Value = 15; sqlDANorma.Fill(dsInfAsfaltico1, "Normas"); CryRepAsfalto1.SetParameterValue("@F1", dsFirmas1.Tables[0].Rows[0][1].ToString()); CryRepAsfalto1.SetParameterValue("@F2", dsFirmas1.Tables[0].Rows[1][1].ToString()); CryRepAsfalto1.SetParameterValue("@F3", dsFirmas1.Tables[0].Rows[2][1].ToString()); CryRepAsfalto1.SetParameterValue("@F4", dsFirmas1.Tables[0].Rows[3][1].ToString()); CryRepAsfalto1.SetParameterValue("@F5", dsFirmas1.Tables[0].Rows[4][1].ToString()); CryRepAsfalto1.SetParameterValue("@C1", dsFirmas1.Tables[0].Rows[0][2].ToString()); CryRepAsfalto1.SetParameterValue("@C2", dsFirmas1.Tables[0].Rows[1][2].ToString()); CryRepAsfalto1.SetParameterValue("@C3", dsFirmas1.Tables[0].Rows[2][2].ToString()); CryRepAsfalto1.SetParameterValue("@C4", dsFirmas1.Tables[0].Rows[3][2].ToString()); CryRepAsfalto1.SetParameterValue("@C5", dsFirmas1.Tables[0].Rows[4][2].ToString()); CryRepAsfalto1.SetParameterValue("@Lab", chbLab.Checked); CryRepAsfalto1.SetParameterValue("@Duplicado", chbDuplicado.Checked); CryRepAsfalto1.SetParameterValue("@Leyenda", chbLeyenda.Checked); CryRepAsfalto1.SetParameterValue("@Respaldo", chbRespaldo.Checked); int ejex, rens = 0; memGraphics.CreateDoubleBuffer(this.CreateGraphics(), this.ClientRectangle.Width, this.ClientRectangle.Height); myPane = new GraphPane(new Rectangle(10, 10, 10, 10), "", "", ""); SetSize(); TextItem texe = new TextItem(); double MaxX = 0, MinX = 0; CurveItem curve; ejex = 2; string folio; for (int m = 0; m < dsInfAsfaltico1.Tables["AsfalticoREP"].Rows.Count; m++) { sqlDAInfAsfalticoMal.SelectCommand.Parameters["@FolioIni"].Value = dsInfAsfaltico1.Tables["AsfalticoREP"].Rows[m][0].ToString().Trim(); sqlDAInfAsfalticoMal.SelectCommand.Parameters["@FolioFin"].Value = dsInfAsfaltico1.Tables["AsfalticoREP"].Rows[m][0].ToString().Trim(); sqlDAInfAsfalticoMal.Fill(dsInfAsfaltico1, "AsfalticoMal"); folio = "Folio = '" + dsInfAsfaltico1.Tables["AsfalticoREP"].Rows[m][0].ToString().Trim() + "'"; DataRow[] filas; filas = dsInfAsfaltico1.Tables["AsfalticoMal"].Select(folio); rens = filas.Length; double[] x = new double[rens]; double[] y = new double[rens]; double[] x1 = new double[rens]; double[] y1 = new double[rens]; MaxX = double.Parse(filas[0][2].ToString()); MinX = double.Parse(filas[rens - 1][2].ToString()); //Curva que pasa string acotacion = "Pasa"; for (k = 0; k < rens; k++) { x[k] = y[k] = 0; } k = 0; for (j = (rens - 1); j > -1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][5].ToString() != "") { x[k] = double.Parse(filas[j][ejex].ToString()); y[k++] = double.Parse(filas[j][5].ToString()); } } curve = myPane.AddCurve(acotacion, x, y, Color.Blue, SymbolType.Triangle); curve.Line.Width = 1.0F; curve.Line.Style = DashStyle.Solid; curve.Symbol.PenWidth = 3.0F; curve.Symbol.Fill = new Fill(Color.Blue); //Limite inferior acotacion = "Proyecto"; for (k = 0; k < rens; k++) { x1[k] = y1[k] = 0; } k = 0; for (j = rens - 1; j > -1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][6].ToString() != "") { x1[k] = double.Parse(filas[j][ejex].ToString()); y1[k++] = double.Parse(filas[j][6].ToString()); } } curve = myPane.AddCurve(acotacion, x1, y1, Color.Red, SymbolType.Star); curve.Line.Width = 1.0F; curve.Line.Style = DashStyle.Solid; curve.Symbol.PenWidth = 6.0F; curve.Symbol.Fill = new Fill(Color.Red); //Limite superior acotacion = "L1"; for (k = 0; k < rens; k++) { x1[k] = y1[k] = 0; } k = 0; for (j = (rens - 1); j > -1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][3].ToString() != "0") { x1[k] = double.Parse(filas[j][ejex].ToString()); y1[k++] = double.Parse(filas[j][3].ToString()); } } curve = myPane.AddCurve(acotacion, x1, y1, Color.DarkGreen, SymbolType.Empty); curve.Line.Width = 1.0F; curve.Symbol.IsVisible = false; //Limite inferior acotacion = "L2"; for (k = 0; k < rens; k++) { x1[k] = y1[k] = 0; } k = 0; for (j = (rens - 1); j > -1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][4].ToString() != "0.00") { x1[k] = double.Parse(filas[j][ejex].ToString()); y1[k++] = double.Parse(filas[j][4].ToString()); } } curve = myPane.AddCurve(acotacion, x1, y1, Color.Brown, SymbolType.Empty); curve.Line.Width = 1.0F; curve.Symbol.IsVisible = false; int si = -3; string acota = ""; acotacion = "Pasa"; for (k = 0; k < rens; k++) { x[k] = y[k] = 0; } k = 0; for (j = (rens - 1); j > -1; j--) { if (filas[j][ejex].ToString() != "" && filas[j][3].ToString() != "") { ArrowItem arrow = new ArrowItem(Color.Gray, 0, float.Parse(filas[j][ejex].ToString()), 0, float.Parse(filas[j][ejex].ToString()), 100); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 0.0F; //if (filas[j][ejex].ToString() == "0.425") // arrow.PenWidth = 3.0F; //if (float.Parse(filas[j][ejex].ToString()) == 4.75) // arrow.PenWidth = 3.0F; // filas = dsInfAsfaltico1.Tables["AsfalticoMal"].Select(folio); acota = dsInfAsfaltico1.Tables["AsfalticoMal"].Rows[j][ejex].ToString().Trim(); int lacota = acota.Length - 1; acota = (acota.Substring(lacota, 1) == "0" ? acota.Substring(0, lacota) : acota); myPane.ArrowList.Add(arrow); texe = new TextItem(acota, float.Parse(dsInfAsfaltico1.Tables["AsfalticoMal"].Rows[j][ejex].ToString()), si); // si = (si == -2 ? -6 : -2); texe.FontSpec.IsBold = true; texe.FontSpec.FrameColor = Color.White; texe.FontSpec.Size = 10; texe.FontSpec.Family = "Times New Roman"; // texe.FontSpec.Angle = 270; myPane.TextList.Add(texe); //texe = new TextItem(dsInfAsfaltico1.Tables["AsfalticoMal"].Rows[j][ejex + 1].ToString(), float.Parse(dsInfAsfaltico1.Tables["AsfalticoMal"].Rows[j][ejex].ToString()), 105); //texe.FontSpec.IsBold = false; //texe.FontSpec.FrameColor = Color.White; //texe.FontSpec.Size = 9; //texe.FontSpec.Family = "Times New Roman"; //myPane.TextList.Add(texe); } } guardagrafica(dsInfAsfaltico1.Tables["AsfalticoREP"].Rows[m][0].ToString().Trim(), MinX, MaxX); myPane = new GraphPane(new Rectangle(10, 10, 10, 10), "", "", ""); SetSize(); } //myPane.XAxis.IsMinorInsideTic = false; //myPane.XAxis.IsShowGrid = true; //myPane.XAxis.ScaleFontSpec.Angle = 0; //myPane.XAxis.Min = MinX; //myPane.XAxis.Max = MaxX; //myPane.XAxis.Type = AxisType.Log; //myPane.XAxis.ScaleFormat = "{0:d###.##}"; //myPane.XAxis.ScaleFontSpec.FontColor = Color.White; //myPane.XAxis.Title = "MALLA NÚMERO"; //myPane.YAxis.IsShowGrid = true; //myPane.YAxis.ScaleFontSpec.Angle = 90; //myPane.YAxis.Min = 0; //myPane.YAxis.Max = 100; //myPane.YAxis.Title = "% QUE PASA"; //myPane.Legend.IsVisible = false; //myPane.Title = "GRAFICA DE COMPOSICION GRANULOMETRICA"; //myPane.PaneFill = new Fill( Color.White, Color.White, 0F ); //myPane.AxisChange( this.CreateGraphics() ); //pictureBox1.Image = Image.FromHbitmap(myPane.Image.GetHbitmap()); //MemoryStream ms = new MemoryStream(); //pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); //byte[] arrImage = ms.GetBuffer(); //ms.Close(); //myPane.Image.Dispose(); //pictureBox1.Image.Dispose(); //dsInfAsfaltico1.Grafica.AddGraficaRow(txtFolioIni.Text,arrImage); // CryRepAsfalto1.SetParameterValue("@MaxX", MaxX); crvInfAsfaltico.ReportSource = CryRepAsfalto1; //crvInfAsfaltico.RefreshReport(); }
private void guardagrafica(double res, int hoja, int cual, double mayor) { float resus = float.Parse(res.ToString()); double super = Math.Truncate(((mayor / 10) + 1) * 10); super = (super < 15 ? 15 : super); float superior = float.Parse(super.ToString()); if (cual == 1) { ArrowItem arrow = new ArrowItem(Color.Gray, 0, resus, 0, resus, superior); // ArrowItem arrow = new ArrowItem(Color.Red, superior, resus, 0, resus, superior); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 3F; myPane.ArrowList.Add(arrow); } myPane.XAxis.IsMinorInsideTic = true; myPane.XAxis.TicSize = float.Parse((res * 0.1).ToString()); myPane.XAxis.IsShowGrid = true; myPane.XAxis.IsInsideTic = true; myPane.XAxis.ScaleFontSpec.Angle = 0; myPane.XAxis.NumDec = 0; myPane.XAxis.Step = float.Parse((res * 0.1).ToString()); myPane.XAxis.ScaleFontSpec.Size = 10; myPane.XAxis.Min = res * 0.15; //cambiar myPane.XAxis.Max = res * 12 * 0.15; myPane.XAxis.Type = AxisType.Linear; myPane.XAxis.StepAuto = true; // myPane1.XAxis.MinorStepAuto = true; myPane.XAxis.TitleFontSpec.Family = "Times New Roman"; myPane.XAxis.TitleFontSpec.Size = 8; myPane.XAxis.IsShowTitle = false; myPane.XAxis.ScaleFontSpec.FontColor = Color.Black; myPane.XAxis.IsMinorTic = true; myPane.YAxis.IsMinorInsideTic = true; myPane.XAxis.IsInsideTic = true; myPane.YAxis.IsShowGrid = true; myPane.YAxis.ScaleFontSpec.Angle = 90; myPane.YAxis.ScaleFontSpec.Size = 8; myPane.YAxis.Min = 0; myPane.YAxis.Max = super; myPane.YAxis.TicSize = 10; myPane.YAxis.TitleFontSpec.Family = "Times New Roman"; myPane.YAxis.ScaleFontSpec.Family = "Times New Roman"; myPane.Legend.IsVisible = true; myPane.Legend.Location = LegendLoc.InsideTopRight; myPane.Legend.FontSpec.Size = 8; myPane.PaneFill = new Fill(Color.White, Color.White, 2F); myPane.AxisChange(this.CreateGraphics()); pictureBox3.Image = Image.FromHbitmap(myPane.Image.GetHbitmap()); pictureBox3.BorderStyle = BorderStyle.None; MemoryStream ms1 = new MemoryStream(); pictureBox3.Image.Save(ms1, System.Drawing.Imaging.ImageFormat.Bmp); byte[] arrImage1 = ms1.GetBuffer(); ms1.Close(); myPane.Image.Dispose(); pictureBox3.Image.Dispose(); if (cual == 1) { dsAnalBlock1.Gra1.AddGra1Row(hoja, arrImage1); } else { dsAnalBlock1.Gra2.AddGra2Row(hoja, arrImage1); } }
private void btnVistaPrevia_Click(object sender, EventArgs e) { crvInfProd.Visible = true; dsGrupos1.GraGrupos.Clear(); dsGrupos1.GraPersonal.Clear(); dsGrupos1.Vivienda.Clear(); dsGrupos1.Grupos.Clear(); dsGrupos1.Grafica.Clear(); dsGrupos1.GraDuracionI.Clear(); dsGrupos1.GraDuracionF.Clear(); dsGrupos1.GraPromedio.Clear(); dsGrupos1.GraDias.Clear(); dsGraduracion1.Clear(); int s = System.Globalization.CultureInfo.CurrentUICulture.Calendar.GetWeekOfYear(dtpIni.Value, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); int a = dtpIni.Value.Year; s = (a == 2019 ? s + 1 : s); if (s == 53 && a != 2020) { s = 1; a = a + 1; } if (s > 53) { s = 1; a = a + 1; } sqlDASFestivo.SelectCommand.Parameters["@Año"].Value = a; sqlDASFestivo.SelectCommand.Parameters["@Si"].Value = s; sqlDASFestivo.SelectCommand.Parameters["@Sf"].Value = s + 25; sqlDASFestivo.Fill(dsSFestivo1, "SFestivo"); cryGraGrupos1.SetDataSource(dsGrupos1); cryGraGrupos1.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait; sqlDAGrupo.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDAGrupo.Fill(dsGrupos1, "Grupos"); sqlDAGraGrupos.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDAGraGrupos.SelectCommand.Parameters["@Mes"].Value = s; sqlDAGraGrupos.SelectCommand.Parameters["@Año"].Value = a; sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 1; sqlDAGraGrupos.Fill(dsGrupos1, "GraGrupos"); sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 0; sqlDAGraGrupos.Fill(dsGrupos1, "GraPersonal"); sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 2; sqlDAGraGrupos.Fill(dsGrupos1, "GraPromedio"); sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 3; sqlDAGraGrupos.Fill(dsGrupos1, "GraDias"); sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 4; sqlDAGraGrupos.Fill(dsGrupos1, "GraDias"); sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 5; sqlDAGraGrupos.Fill(dsGrupos1, "GraDias"); sqlDAGraGrupos.SelectCommand.Parameters["@Cual"].Value = 6; sqlDAGraGrupos.Fill(dsGrupos1, "GraDias"); sqlDAVivienda.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDAVivienda.SelectCommand.Parameters["@Mes"].Value = s; sqlDAVivienda.SelectCommand.Parameters["@Año"].Value = a; sqlDAVivienda.Fill(dsGrupos1, "Vivienda"); sqlDAVivIni.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDAVivIni.SelectCommand.Parameters["@Mes"].Value = s; sqlDAVivIni.SelectCommand.Parameters["@Año"].Value = a; sqlDAVivIni.Fill(dsGrupos1, "Vivienda"); sqlDADuracion.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDADuracion.SelectCommand.Parameters["@Primero"].Value = 0; sqlDADuracion.Fill(dsGrupos1, "GraduracionI"); sqlDADuracion.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDADuracion.SelectCommand.Parameters["@Primero"].Value = 1; sqlDADuracion.Fill(dsGrupos1, "GraduracionF"); sqlDADuracion.SelectCommand.Parameters["@IdGrupo"].Value = cmbIdGrupo.SelectedValue; sqlDADuracion.SelectCommand.Parameters["@Primero"].Value = 2; sqlDADuracion.Fill(dsGraduracion1, "GraduracionF"); myPane = new GraphPane(new Rectangle(10, 10, 10, 10), " ", "", ""); SetSize(); CurveItem curve; double[] eex; eex = new double[26]; double[] neey; neey = new double[26]; for (int m = 0; m < dsGrupos1.GraGrupos.Rows.Count; m++) { for (int i = 0; i <= 25; i++) { neey[i] = double.Parse(dsGrupos1.Tables["GraGrupos"].Rows[m][i + 1].ToString()); eex[i] = double.Parse((s + i).ToString()); } if (m == 0) { curve = myPane.AddCurve(dsGrupos1.Tables["GraGrupos"].Rows[m][28].ToString() + " " + dsGrupos1.Tables["GraDuracionF"].Rows[m]["Ubicacion"].ToString(), eex, neey, Color.Maroon, SymbolType.Square); curve.Symbol.Fill = new Fill(Color.Maroon); curve.Line.Width = 2.5F; for (int jj = 25; jj >= 0; jj--) { if (neey[jj] <= 0.01) { curve.Points.Remove(jj); } else { jj = -1; } } } if (m == 1) { curve = myPane.AddCurve(dsGrupos1.Tables["GraGrupos"].Rows[m][28].ToString() + " " + dsGrupos1.Tables["GraDuracionF"].Rows[m]["Ubicacion"].ToString(), eex, neey, Color.Green, SymbolType.Diamond); curve.Symbol.Fill = new Fill(Color.Green); curve.Line.Width = 2.5F; //for (int jj = 25; jj >= 0; jj--) // if (neey[jj] <= 0.01) // curve.Points.Remove(jj); } if (m == 2) { curve = myPane.AddCurve(dsGrupos1.Tables["GraGrupos"].Rows[m][28].ToString() + " " + dsGrupos1.Tables["GraDuracionF"].Rows[m]["Ubicacion"].ToString(), eex, neey, Color.Olive, SymbolType.Circle); curve.Line.Width = 3.5F; curve.Symbol.Fill = new Fill(Color.Olive); //for (int jj = 25; jj >= 0; jj--) // if (neey[jj] <= 0.01) // curve.Points.Remove(jj); } if (m == 3) { curve = myPane.AddCurve(dsGrupos1.Tables["GraGrupos"].Rows[m][28].ToString() + " " + dsGrupos1.Tables["GraDuracionF"].Rows[m]["Ubicacion"].ToString(), eex, neey, Color.Navy, SymbolType.TriangleDown); curve.Symbol.Fill = new Fill(Color.Navy); curve.Line.Width = 2.5F; //for (int jj = 25; jj >= 0; jj--) // if (neey[jj] <= 0.01) // curve.Points.Remove(jj); } if (m == 4) { curve = myPane.AddCurve(dsGrupos1.Tables["GraGrupos"].Rows[m][28].ToString() + " " + dsGrupos1.Tables["GraDuracionF"].Rows[m]["Ubicacion"].ToString(), eex, neey, Color.Purple, SymbolType.TriangleDown); curve.Symbol.Fill = new Fill(Color.Purple); curve.Line.Width = 2.5F; //for (int jj = 25; jj >= 0; jj--) // if (neey[jj] <= 0.01) // curve.Points.Remove(jj); } } float x1 = float.Parse(s.ToString()); float y1 = 10; float size = 5; TextItem texe = new TextItem(); ArrowItem arrow = new ArrowItem(Color.Red, size, x1, y1, x1 + 25, y1); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 0F; myPane.ArrowList.Add(arrow); y1 = 10; arrow = new ArrowItem(Color.Red, size, x1, y1, x1 + 25, y1); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 0F; myPane.ArrowList.Add(arrow); y1 = 15; arrow = new ArrowItem(Color.Red, size, x1, y1, x1 + 25, y1); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 0F; myPane.ArrowList.Add(arrow); y1 = 20; arrow = new ArrowItem(Color.Red, size, x1, y1, x1 + 25, y1); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 0F; myPane.ArrowList.Add(arrow); double año = a; int semIni = (a * 52) + s - 104936; int semFin = semIni + 25; for (int m = 0; m < dsGraduracion1.GraDuracionF.Rows.Count; m++) { int semana = int.Parse(dsGraduracion1.GraDuracionF.Rows[m][4].ToString()); int años = int.Parse(dsGraduracion1.GraDuracionF.Rows[m][3].ToString()); int vigencia = (años * 52) + semana - 104936; if (semIni <= vigencia && vigencia <= semFin) { size = 3; x1 = float.Parse((vigencia - semIni + 1).ToString()); y1 = 0; arrow = new ArrowItem(Color.Violet, size, x1, y1, x1, y1 + 35); arrow.CoordinateFrame = CoordType.AxisXYScale; arrow.PenWidth = 5F; myPane.ArrowList.Add(arrow); texe = new TextItem(dsGraduracion1.GraDuracionF.Rows[m][1].ToString(), x1, 2); texe.FontSpec.IsBold = false; texe.FontSpec.Size = 8; texe.FontSpec.Family = "Times New Roman"; myPane.TextList.Add(texe); } } guardagrafica(s); cryGraGrupos1.SetParameterValue("Grupo", "Laboratorio " + string.Format("{0:0.#}", dsGrupos1.Grupo.Rows[cmbIdGrupo.SelectedIndex][0])); cryGraGrupos1.SetParameterValue("Año", a); cryGraGrupos1.SetParameterValue("Semana", s); for (int i = 0; i < 26; i++) { if (s == 53 && a != 2020) { s = 1; a = a + 1; } if (s > 53) { s = 1; a = a + 1; } string param = "SFes" + i.ToString().Trim(); int Sfes = 0; for (int j = 0; j < dsSFestivo1.SFestivo.Rows.Count; j++) { if (dsSFestivo1.SFestivo.Rows[j][0].ToString() == a.ToString() && dsSFestivo1.SFestivo.Rows[j][1].ToString() == s.ToString()) { Sfes = 1; } } cryGraGrupos1.SetParameterValue(param, Sfes); s = s + 1; } crvInfProd.ReportSource = cryGraGrupos1; }
public UseBowCommand(IPlayer player, ArrowItem arrow) { PlayerCharacter = player; Arrow = arrow; }
public static void PlotDataSet(PlotSurface2D plotSurface) { plotSurface.Clear(); //plotSurface.DateTimeToolTip = true; // obtain stock information from xml file DataSet ds = new DataSet(); System.IO.Stream file = Alt.IO.VirtualFile.OpenRead("AltData/NPlot/asx_jbh.xml"); ds.ReadXml(file, XmlReadMode.ReadSchema); DataTable dt = ds.Tables[0]; //NoNeed DataView dv = new DataView( dt ); // create CandlePlot. CandlePlot cp = new CandlePlot(); cp.DataSource = dt; cp.AbscissaData = "Date"; cp.OpenData = "Open"; cp.LowData = "Low"; cp.HighData = "High"; cp.CloseData = "Close"; cp.BearishColor = Alt.Sketch.Color.Red; cp.BullishColor = Alt.Sketch.Color.Green; cp.Style = CandlePlot.Styles.Filled; // calculate 10 day moving average and 2*sd line ArrayList av10 = new ArrayList(); ArrayList sd2_10 = new ArrayList(); ArrayList sd_2_10 = new ArrayList(); ArrayList dates = new ArrayList(); for (int i = 0; i < dt.Rows.Count - 10; ++i) { float sum = 0.0f; for (int j = 0; j < 10; ++j) { sum += (float)dt.Rows[i + j]["Close"]; } float average = sum / 10.0f; av10.Add(average); sum = 0.0f; for (int j = 0; j < 10; ++j) { sum += ((float)dt.Rows[i + j]["Close"] - average) * ((float)dt.Rows[i + j]["Close"] - average); } sum /= 10.0f; sum = 2.0f * (float)Math.Sqrt(sum); sd2_10.Add(average + sum); sd_2_10.Add(average - sum); dates.Add((DateTime)dt.Rows[i + 10]["Date"]); } // and a line plot of close values. LinePlot av = new LinePlot(); av.OrdinateData = av10; av.AbscissaData = dates; av.Color = Alt.Sketch.Color.LightGray; av.Pen.Width = 2.0f; LinePlot top = new LinePlot(); top.OrdinateData = sd2_10; top.AbscissaData = dates; top.Color = Alt.Sketch.Color.LightSteelBlue; top.Pen.Width = 2.0f; LinePlot bottom = new LinePlot(); bottom.OrdinateData = sd_2_10; bottom.AbscissaData = dates; bottom.Color = Alt.Sketch.Color.LightSteelBlue; bottom.Pen.Width = 2.0f; FilledRegion fr = new FilledRegion(top, bottom); //fr.RectangleBrush = new RectangleBrushes.Vertical( Color.FloralWhite, Color.GhostWhite ); fr.RectangleBrush = new RectangleBrushes.Vertical(Alt.Sketch.Color.FromArgb(255, 255, 240), Alt.Sketch.Color.FromArgb(240, 255, 255)); plotSurface.SmoothingMode = SmoothingMode.AntiAlias; plotSurface.Add(fr); plotSurface.Add(new Grid()); plotSurface.Add(av); plotSurface.Add(top); plotSurface.Add(bottom); plotSurface.Add(cp); // now make an arrow... ArrowItem arrow = new ArrowItem(new PointD(((DateTime)dt.Rows[60]["Date"]).Ticks, 2.28), -80, "An interesting flat bit"); arrow.ArrowColor = Alt.Sketch.Color.DarkBlue; arrow.PhysicalLength = 50; //plotSurface.Add( arrow ); plotSurface.Title = "AU:JBH"; plotSurface.XAxis1.Label = "Date / Time"; plotSurface.XAxis1.WorldMin += plotSurface.XAxis1.WorldLength / 4.0; plotSurface.XAxis1.WorldMax -= plotSurface.XAxis1.WorldLength / 2.0; plotSurface.YAxis1.Label = "Price [$]"; plotSurface.XAxis1 = new TradingDateTimeAxis(plotSurface.XAxis1); }
private void listBox1_SelectedValueChanged(object sender, EventArgs e) { ListBoxDateWrapper dateWrapper = (ListBoxDateWrapper)listBox1.SelectedItem; List <DexTimelineEntry> entries = DexcomHistoryService.GetDexTimelineEntries(dateWrapper.Value).ToList(); entries.Sort((x, y) => x.Timestamp.CompareTo(y.Timestamp)); List <DexTimelineEntry> glucoseEvents = entries.FindAll(x => x.GlucoseSpecified); List <DexTimelineEntry> events = entries.FindAll(x => x.InsulinSpecified || x.CarbsSpecified || x.EventTypeSpecified || x.MeterGlucoseSpecified || x.SessionStateSpecified); plotSurface2D1.Clear(); if (glucoseEvents.Count == 0) { plotSurface2D1.Refresh(); plotSurface2D1.Update(); return; } plotSurface2D1.XAxis1 = new DateTimeAxis(dateWrapper.Value.Date, dateWrapper.Value.Date.AddHours(24)); plotSurface2D1.YAxis1 = new LinearAxis(0, 400); DateTime[] xValues; double[] yValues; xValues = new DateTime[glucoseEvents.Count]; yValues = new double[glucoseEvents.Count]; for (int i = 0; i < glucoseEvents.Count; i++) { xValues[i] = glucoseEvents[i].Timestamp; yValues[i] = (double)glucoseEvents[i].Glucose.Value; } DateTime lastEvent = DateTime.MaxValue; double angle = 90.0; foreach (DexTimelineEntry theEvent in events) { string msg = "???"; if (theEvent.CarbsSpecified) { msg = String.Format("{0} BE", theEvent.Carbs.Value / 12); } else if (theEvent.InsulinSpecified) { msg = String.Format("{0} IE", theEvent.Insulin.Value); } else if (theEvent.SessionStateSpecified) { msg = theEvent.SessionState.Value.ToString(); } else if (theEvent.ExerciseEventSpecified) { msg = String.Format("{0} Exercise", theEvent.ExerciseEvent.Value); } else if (theEvent.HealthEventSpecified) { msg = theEvent.HealthEvent.ToString(); } else if (theEvent.MeterGlucoseSpecified) { msg = String.Format("Calibration: {0}", theEvent.MeterGlucose.Value); } if ((theEvent.Timestamp - lastEvent).TotalMinutes < 10) { angle += 10; } PointD pt = new PointD(theEvent.Timestamp.Ticks, GuessYValue(glucoseEvents, theEvent.Timestamp)); ArrowItem annotation = new ArrowItem(pt, angle, msg); angle += 5; plotSurface2D1.Add(annotation); } LinePlot glucosePlot = new LinePlot(yValues, xValues); plotSurface2D1.Add(glucosePlot); plotSurface2D1.Refresh(); plotSurface2D1.Update(); /*chart1.ChartAreas[0].AxisX.Minimum = dateWrapper.Value.Date.ToOADate(); * chart1.ChartAreas[0].AxisX.Maximum = (dateWrapper.Value.Date + new TimeSpan(24, 0, 0)).ToOADate(); * chart1.Series.Clear(); * chart1.Annotations.Clear(); * * Series glucoseSeries = new Series(); * glucoseSeries.ChartType = SeriesChartType.Line; * glucoseSeries.XValueType = ChartValueType.Time; * chart1.Series.Add(glucoseSeries); * Series eventSeries = new Series(); * eventSeries.ChartType = SeriesChartType.Point; * eventSeries.XValueType = ChartValueType.Time; * chart1.Series.Add(eventSeries); * DataPoint lastDataPoint = new DataPoint(0, 200); * foreach (DexTimelineEntry dte in entries) * { * if (dte.Glucose != null) * { * lastDataPoint = new DataPoint(); * lastDataPoint.XValue = dte.Timestamp.ToOADate(); * lastDataPoint.YValues = new double[] { dte.Glucose.Value }; * glucoseSeries.Points.Add(lastDataPoint); * } * if (dte.Insulin != null) * { * DataPoint eventPoint = new DataPoint(); * eventPoint.XValue = dte.Timestamp.ToOADate(); * eventPoint.YValues = lastDataPoint.YValues; * eventSeries.Points.Add(eventPoint); * CalloutAnnotation insulinAnnotation = new CalloutAnnotation(); * insulinAnnotation.Text = String.Format("{0} IE", dte.Insulin); * insulinAnnotation.AnchorDataPoint = eventPoint; * chart1.Annotations.Add(insulinAnnotation); * } * if (dte.Carbs != null) * { * DataPoint eventPoint = new DataPoint(); * eventPoint.XValue = dte.Timestamp.ToOADate(); * eventPoint.YValues = lastDataPoint.YValues; * eventSeries.Points.Add(eventPoint); * CalloutAnnotation insulinAnnotation = new CalloutAnnotation(); * insulinAnnotation.Text = String.Format("{0} BE", dte.Carbs / 12); * insulinAnnotation.AnchorDataPoint = eventPoint; * chart1.Annotations.Add(insulinAnnotation); * } * if (dte.EventType != null) * { * DataPoint eventPoint = new DataPoint(); * eventPoint.XValue = dte.Timestamp.ToOADate(); * eventPoint.YValues = lastDataPoint.YValues; * eventSeries.Points.Add(eventPoint); * switch (dte.EventType) * { * case moe.yo3explorer.azusa.dex.Schema.Enums.EventType.Exercise: * CalloutAnnotation exerciseAnnotation = new CalloutAnnotation(); * exerciseAnnotation.Text = String.Format(dte.ExerciseEvent.Value.ToString()); * exerciseAnnotation.AnchorDataPoint = eventPoint; * chart1.Annotations.Add(exerciseAnnotation); * break; * case moe.yo3explorer.azusa.dex.Schema.Enums.EventType.Health: * CalloutAnnotation healthAnnotation = new CalloutAnnotation(); * healthAnnotation.Text = String.Format(dte.HealthEvent.Value.ToString()); * healthAnnotation.AnchorDataPoint = eventPoint; * chart1.Annotations.Add(healthAnnotation); * break; * } * } * if (dte.MeterGlucose != null) * { * DataPoint eventPoint = new DataPoint(); * eventPoint.XValue = dte.Timestamp.ToOADate(); * eventPoint.YValues = new double[] { dte.MeterGlucose.Value }; * eventSeries.Points.Add(eventPoint); * CalloutAnnotation calibrationAnnotation = new CalloutAnnotation(); * calibrationAnnotation.Text = String.Format("Kalibration: {0}", dte.MeterGlucose); * calibrationAnnotation.AnchorDataPoint = eventPoint; * chart1.Annotations.Add(calibrationAnnotation); * } * if (dte.SessionState != null && lastDataPoint != null) * { * DataPoint eventPoint = new DataPoint(); * eventPoint.XValue = dte.Timestamp.ToOADate(); * eventPoint.YValues = lastDataPoint.YValues; * eventSeries.Points.Add(eventPoint); * CalloutAnnotation sessionStateAnnotation = new CalloutAnnotation(); * sessionStateAnnotation.Text = String.Format(dte.SessionState.Value.ToString()); * sessionStateAnnotation.AnchorDataPoint = lastDataPoint; * chart1.Annotations.Add(sessionStateAnnotation); * } * }*/ toolStripButton1.Enabled = listBox1.SelectedIndex > 0; toolStripButton2.Enabled = listBox1.SelectedIndex < listBox1.Items.Count - 1; toolStripTextBox1.Text = ((ListBoxDateWrapper)listBox1.SelectedItem).Value.ToShortDateString(); }
private static void FindInteractiveObject() { Debug.Log("FindInteractiveObject"); float maxRange = 2; int layerMask1 = 138383360; RaycastHit hitInfo; bool flag1 = Physics.Raycast(GameManager.GetMainCamera().transform.position, GameManager.GetMainCamera().transform.forward, out hitInfo, maxRange, layerMask1); Debug.Log("flag1 = " + flag1 + ", collision = " + (hitInfo.collider == null ? "null" : hitInfo.collider.name + ", " + hitInfo.collider.GetInstanceID())); if (!flag1) { flag1 = Physics.Raycast(GameManager.GetWeaponCamera().transform.position, GameManager.GetWeaponCamera().transform.forward, out hitInfo, maxRange, layerMask1); Debug.Log("flag1 = " + flag1 + ", collision = " + (hitInfo.collider == null ? "null" : hitInfo.collider.name)); if (flag1 && (UnityEngine.Object)Utils.GetTopParentWithLayer(hitInfo.collider.gameObject, 23) == (UnityEngine.Object)hitInfo.collider.gameObject) { flag1 = false; } } if (!flag1) { layerMask1 |= 16777216; flag1 = Physics.Raycast(GameManager.GetMainCamera().transform.position, GameManager.GetMainCamera().transform.forward, out hitInfo, maxRange, layerMask1); Debug.Log("flag1 = " + flag1 + ", collision = " + (hitInfo.collider == null ? "null" : hitInfo.collider.name)); } if (!flag1) { flag1 = Physics.Raycast(GameManager.GetWeaponCamera().transform.position, GameManager.GetWeaponCamera().transform.forward, out hitInfo, maxRange, layerMask1); Debug.Log("flag1 = " + flag1 + ", collision = " + (hitInfo.collider == null ? "null" : hitInfo.collider.name)); if (flag1 && (UnityEngine.Object)Utils.GetTopParentWithLayer(hitInfo.collider.gameObject, 23) == (UnityEngine.Object)hitInfo.collider.gameObject) { flag1 = false; } } if (!flag1) { Debug.Log("Exit 1: null"); return; } GameObject child1 = (GameObject)null; float distance = hitInfo.distance; GearItem gearItem = (GearItem)null; if (hitInfo.collider.gameObject.layer == 15) { if ((bool)((UnityEngine.Object)hitInfo.collider.transform.gameObject.GetComponent <Container>())) { child1 = hitInfo.collider.transform.gameObject.GetComponent <Container>().gameObject; } else { for (Transform parent = hitInfo.collider.transform.parent; (UnityEngine.Object)parent != (UnityEngine.Object)null; parent = parent.parent) { gearItem = parent.gameObject.GetComponent <GearItem>(); if ((UnityEngine.Object)gearItem != (UnityEngine.Object)null) { child1 = gearItem.gameObject; break; } } if ((UnityEngine.Object)child1 == (UnityEngine.Object)null) { Debug.Log("Exit2: null"); return; } } } else { child1 = hitInfo.transform.gameObject; gearItem = child1.GetComponent <GearItem>(); } //this.m_LocationOfLastInteractHit = hitInfo.point; if ((bool)((UnityEngine.Object)gearItem)) { if (gearItem.m_InPlayerInventory) { Debug.Log("Exit3: null"); return; } if (gearItem.m_NonInteractive) { Debug.Log("Exit4: null"); return; } } Rigidbody component1 = child1.GetComponent <Rigidbody>(); if ((UnityEngine.Object)component1 != (UnityEngine.Object)null) { if ((double)component1.velocity.sqrMagnitude > 25.0) { Debug.Log("Exit5: null"); return; } ArrowItem component2 = child1.GetComponent <ArrowItem>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null && component2.InFlight(true)) { Debug.Log("Exit6: null"); return; } } int layerMask2 = (Utils.m_PhysicalCollisionLayerMask | 131072 | 1048576 | 134217728 | 16777216 | 32768) & -67108865; bool flag2 = Physics.Raycast(GameManager.GetMainCamera().transform.position, GameManager.GetMainCamera().transform.forward, out hitInfo, maxRange, layerMask2); if (!flag2) { flag2 = Physics.Raycast(GameManager.GetWeaponCamera().transform.position, GameManager.GetWeaponCamera().transform.forward, out hitInfo, maxRange, layerMask2); if (flag2 && (UnityEngine.Object)Utils.GetTopParentWithLayer(hitInfo.collider.gameObject, 23) == (UnityEngine.Object)hitInfo.collider.gameObject) { flag2 = false; } } if (!flag2) { Debug.Log("Exit7: null"); return; } if ((bool)((UnityEngine.Object)hitInfo.collider) && (bool)((UnityEngine.Object)hitInfo.transform.gameObject) && ((bool)((UnityEngine.Object)hitInfo.transform.gameObject.GetComponent <GearItem>()) && !hitInfo.transform.gameObject.GetComponent <GearItem>().m_InPlayerInventory) && child1.layer == 21) { child1 = hitInfo.transform.gameObject; } if ((double)hitInfo.distance > (double)distance) { Debug.Log("Exit8: " + Utils.GetTopParentWithLayer(child1, child1.layer)); return; } GameObject gameObject = hitInfo.transform.gameObject; if ((UnityEngine.Object)gameObject == (UnityEngine.Object)child1) { if (child1.layer == 27) { BaseAi componentInParent = child1.GetComponentInParent <BaseAi>(); if ((bool)((UnityEngine.Object)componentInParent)) { Debug.Log("Exit9: " + componentInParent.gameObject); return; } Debug.Log("Exit10: " + Utils.GetTopParentWithLayer(child1, child1.transform.parent.gameObject.layer)); return; } if (child1.layer != 18) { Debug.Log("Exit11: " + Utils.GetTopParentWithLayer(child1, child1.layer)); return; } for (int index = 0; index < child1.transform.childCount; ++index) { Transform child2 = child1.transform.GetChild(index); if ((UnityEngine.Object)child2 != (UnityEngine.Object)null && child2.gameObject.activeInHierarchy) { MeshCollider[] componentsInChildren = child2.GetComponentsInChildren <MeshCollider>(false); if (componentsInChildren != null && componentsInChildren.Length > 0) { Debug.Log("Exit12: null"); return; } } } Debug.Log("Exit13: " + Utils.GetTopParentWithLayer(child1, child1.layer)); return; } foreach (UnityEngine.Object componentsInChild in child1.GetComponentsInChildren <Transform>()) { if (componentsInChild == (UnityEngine.Object)gameObject.transform) { Debug.Log("Exit14: " + Utils.GetTopParentWithLayer(child1, child1.layer)); return; } } if (gameObject.gameObject.layer == 24) { Debug.Log("Exit15: " + Utils.GetTopParentWithLayer(child1, child1.layer)); return; } Debug.Log("Exit16: null"); return; }