public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol) { foreach (IntVec3 current in from cur in Find.CurrentMap.AllCells where Find.CurrentMap.roofGrid.RoofAt(c: cur) != null && Find.CurrentMap.roofGrid.RoofAt(c: cur).isThickRoof select cur) { CellRenderer.RenderCell(c: current); } }
public void Render() { if (Filled()) { if (visual == null) { visual = renderer.RenderCell(bounds); } } else { if (visual != null) { renderer.RemoveCell(visual); visual = null; } for (var i = 0; i < children.Length; i++) { if (children[i] != null) { children[i].Render(); } } } }
public void DrawDebugPowerNetGrid() { if (!DebugViewSettings.drawPowerNetGrid) { return; } if (Current.ProgramState != ProgramState.Playing) { return; } if (this.map != Find.CurrentMap) { return; } Rand.PushState(); foreach (IntVec3 current in Find.CameraDriver.CurrentViewRect.ClipInsideMap(this.map)) { PowerNet powerNet = this.netGrid[this.map.cellIndices.CellToIndex(current)]; if (powerNet != null) { Rand.Seed = powerNet.GetHashCode(); CellRenderer.RenderCell(current, Rand.Value); } } Rand.PopState(); }
public static void DebugDraw() { if (DebugViewSettings.drawInfestationChance) { if (InfestationCellFinder.tmpCachedInfestationChanceCellColors == null) { InfestationCellFinder.tmpCachedInfestationChanceCellColors = new List <Pair <IntVec3, float> >(); } if (Time.frameCount % 8 == 0) { InfestationCellFinder.tmpCachedInfestationChanceCellColors.Clear(); Map currentMap = Find.CurrentMap; CellRect cellRect = Find.CameraDriver.CurrentViewRect; cellRect.ClipInsideMap(currentMap); cellRect = cellRect.ExpandedBy(1); InfestationCellFinder.CalculateTraversalDistancesToUnroofed(currentMap); InfestationCellFinder.CalculateClosedAreaSizeGrid(currentMap); InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(currentMap); float num = 0.001f; for (int i = 0; i < currentMap.Size.z; i++) { for (int j = 0; j < currentMap.Size.x; j++) { IntVec3 cell = new IntVec3(j, 0, i); float scoreAt = InfestationCellFinder.GetScoreAt(cell, currentMap); if (scoreAt > num) { num = scoreAt; } } } for (int k = 0; k < currentMap.Size.z; k++) { for (int l = 0; l < currentMap.Size.x; l++) { IntVec3 intVec = new IntVec3(l, 0, k); if (cellRect.Contains(intVec)) { float scoreAt2 = InfestationCellFinder.GetScoreAt(intVec, currentMap); if (scoreAt2 > 7.5f) { float second = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2); InfestationCellFinder.tmpCachedInfestationChanceCellColors.Add(new Pair <IntVec3, float>(intVec, second)); } } } } } for (int m = 0; m < InfestationCellFinder.tmpCachedInfestationChanceCellColors.Count; m++) { IntVec3 first = InfestationCellFinder.tmpCachedInfestationChanceCellColors[m].First; float second2 = InfestationCellFinder.tmpCachedInfestationChanceCellColors[m].Second; CellRenderer.RenderCell(first, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, second2), false)); } } else { InfestationCellFinder.tmpCachedInfestationChanceCellColors = null; } }
public static void DrawDebug() { if (!DebugViewSettings.drawDoorsDebug) { return; } CellRect currentViewRect = Find.CameraDriver.CurrentViewRect; List <Thing> list = Find.CurrentMap.listerThings.ThingsInGroup(ThingRequestGroup.BuildingArtificial); for (int i = 0; i < list.Count; i++) { if (currentViewRect.Contains(list[i].Position)) { Building_Door building_Door = list[i] as Building_Door; if (building_Door != null) { Color col; if (building_Door.FreePassage) { col = new Color(0f, 1f, 0f, 0.5f); } else { col = new Color(1f, 0f, 0f, 0.5f); } CellRenderer.RenderCell(building_Door.Position, SolidColorMaterials.SimpleSolidColorMaterial(col, false)); } } } }
public static void DrawCellRectUpdate(CellRect cellRect) { foreach (IntVec3 item in cellRect) { CellRenderer.RenderCell(item); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { Map visibleMap = Find.CurrentMap; //:: was VisibleMap; uncertain if replacement correct foreach (IntVec3 current in from cur in visibleMap.AllCells where visibleMap.roofGrid.RoofAt(cur) != null && visibleMap.roofGrid.RoofAt(cur).isThickRoof&& !visibleMap.fogGrid.IsFogged(cur) select cur) { CellRenderer.RenderCell(current); } }
public static void DrawCellRectUpdate(CellRect cellRect) { CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { CellRenderer.RenderCell(iterator.Current, 0.5f); iterator.MoveNext(); } }
public static void DebugDrawInteractionCells() { if (Find.CurrentMap != null && DebugViewSettings.drawInteractionCells) { foreach (object selectedObject in Find.Selector.SelectedObjects) { Thing thing = selectedObject as Thing; if (thing != null) { CellRenderer.RenderCell(thing.InteractionCell); } } } }
public void DebugDrawMouseover() { int num = Mathf.RoundToInt(Time.realtimeSinceStartup * 2f) % 2; if (RimShipMod.mod.settings.debugDrawRegions) { Color color; if (!this.valid) { color = Color.red; } else if (this.DebugIsNew) { color = Color.yellow; } else { color = Color.green; } GenDraw.DrawFieldEdges(this.Cells.ToList <IntVec3>(), color); foreach (WaterRegion region in this.Neighbors) { GenDraw.DrawFieldEdges(region.Cells.ToList <IntVec3>(), Color.grey); } if (RimShipMod.mod.settings.debugDrawRegionLinks) { foreach (WaterRegionLink regionLink in this.links) { if (num == 1) { foreach (IntVec3 c in regionLink.span.Cells) { CellRenderer.RenderCell(c, DebugSolidColorMats.MaterialOf(Color.magenta)); } } } } if (RimShipMod.mod.settings.debugDrawRegionThings) { foreach (Thing thing in this.listerThings.AllThings) { CellRenderer.RenderSpot(thing.TrueCenter(), (float)(thing.thingIDNumber % 256) / 256f); } } } }
public static void DebugDrawInteractionCells() { Map visibleMap = Find.VisibleMap; if (visibleMap != null && DebugViewSettings.drawInteractionCells) { foreach (object selectedObject in Find.Selector.SelectedObjects) { Thing thing = selectedObject as Thing; if (thing != null) { CellRenderer.RenderCell(thing.InteractionCell, 0.5f); } } } }
private void gridCategories_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { try { if (e.RowIndex >= 0 && (e.ColumnIndex == colName.Index || e.ColumnIndex == colNumber.Index)) { _cellRenderer.RenderCell(gridCategories[e.ColumnIndex, e.RowIndex], e, txtFilter.Text); e.Handled = true; } } catch (Exception ex) { MainForm.ShowExceptionMessage(ex); } }
public void DrawDebugPowerNetGrid() { if (DebugViewSettings.drawPowerNetGrid && Current.ProgramState == ProgramState.Playing && map == Find.CurrentMap) { Rand.PushState(); foreach (IntVec3 item in Find.CameraDriver.CurrentViewRect.ClipInsideMap(map)) { PowerNet powerNet = netGrid[map.cellIndices.CellToIndex(item)]; if (powerNet != null) { Rand.Seed = powerNet.GetHashCode(); CellRenderer.RenderCell(item, Rand.Value); } } Rand.PopState(); } }
public static void SelectedUpdate(this Designator_Place @this) { GenDraw.DrawNoBuildEdgeLines(); if (!ArchitectCategoryTab.InfoRect.Contains(UI.MousePositionOnUIInverted)) { IntVec3 intVec = UI.MouseCell(); if (@this.PlacingDef is TerrainDef) { GenUI.RenderMouseoverBracket(); return; } Color ghostCol; if (@this.CanDesignateCell(intVec).Accepted) { ghostCol = new Color(0.5f, 1f, 0.6f, 0.4f); } else { ghostCol = new Color(1f, 0f, 0f, 0.4f); } DrawGhost(@this, ghostCol); if (@this.CanDesignateCell(intVec).Accepted&& @this.PlacingDef.specialDisplayRadius > 0.01f) { GenDraw.DrawRadiusRing(UI.MouseCell(), @this.PlacingDef.specialDisplayRadius); if ((@this.PlacingDef as ThingDef)?.building?.turretGunDef?.Verbs?.FirstOrDefault()?.requireLineOfSight == true) { var map = Find.VisibleMap; float range = ((ThingDef)@this.PlacingDef).building.turretGunDef.Verbs[0].range; foreach (var cell in GenRadial.RadialCellsAround(intVec, range, false)) { if (GenSight.LineOfSight(intVec, cell, map, true) != GenSight.LineOfSight(cell, intVec, map, true)) { CellRenderer.RenderCell(cell, 0f); } if (GenSight.LineOfSight(intVec, cell, map, true)) { CellRenderer.RenderCell(cell, 0.6f); continue; } } } } GenDraw.DrawInteractionCell((ThingDef)@this.PlacingDef, intVec, placingRotGet(@this)); } }
public static void DebugDrawInteractionCells() { if (Find.CurrentMap == null) { return; } if (DebugViewSettings.drawInteractionCells) { foreach (object obj in Find.Selector.SelectedObjects) { Thing thing = obj as Thing; if (thing != null) { CellRenderer.RenderCell(thing.InteractionCell, 0.5f); } } } }
private void DrawDebugPowerNets() { if (Current.ProgramState == ProgramState.Playing && Find.CurrentMap == map) { int num = 0; foreach (PowerNet allNet in allNets) { foreach (CompPower item in allNet.transmitters.Concat(allNet.connectors)) { foreach (IntVec3 item2 in GenAdj.CellsOccupiedBy(item.parent)) { CellRenderer.RenderCell(item2, (float)num * 0.44f); } } num++; } } }
public static void DebugDraw() { if (!DebugViewSettings.drawStealDebug) { StealAIDebugDrawer.debugDrawLord = null; return; } Lord lord = StealAIDebugDrawer.debugDrawLord; StealAIDebugDrawer.debugDrawLord = StealAIDebugDrawer.FindHostileLord(); if (StealAIDebugDrawer.debugDrawLord == null) { return; } StealAIDebugDrawer.CheckInitDebugDrawGrid(); float num = StealAIUtility.StartStealingMarketValueThreshold(StealAIDebugDrawer.debugDrawLord); if (lord != StealAIDebugDrawer.debugDrawLord) { foreach (IntVec3 intVec in Find.CurrentMap.AllCells) { StealAIDebugDrawer.debugDrawGrid[intVec] = (StealAIDebugDrawer.TotalMarketValueAround(intVec, Find.CurrentMap, StealAIDebugDrawer.debugDrawLord.ownedPawns.Count) > num); } } foreach (IntVec3 c in Find.CurrentMap.AllCells) { if (StealAIDebugDrawer.debugDrawGrid[c]) { CellRenderer.RenderCell(c, 0.5f); } } StealAIDebugDrawer.tmpToSteal.Clear(); for (int i = 0; i < StealAIDebugDrawer.debugDrawLord.ownedPawns.Count; i++) { Pawn pawn = StealAIDebugDrawer.debugDrawLord.ownedPawns[i]; Thing thing; if (StealAIUtility.TryFindBestItemToSteal(pawn.Position, pawn.Map, 7f, out thing, pawn, StealAIDebugDrawer.tmpToSteal)) { GenDraw.DrawLineBetween(pawn.TrueCenter(), thing.TrueCenter()); StealAIDebugDrawer.tmpToSteal.Add(thing); } } StealAIDebugDrawer.tmpToSteal.Clear(); }
public static void DebugDraw() { if (!DebugViewSettings.drawStealDebug) { debugDrawLord = null; return; } Lord lord = debugDrawLord; debugDrawLord = FindHostileLord(); if (debugDrawLord == null) { return; } CheckInitDebugDrawGrid(); float num = StealAIUtility.StartStealingMarketValueThreshold(debugDrawLord); if (lord != debugDrawLord) { foreach (IntVec3 allCell in Find.CurrentMap.AllCells) { debugDrawGrid[allCell] = TotalMarketValueAround(allCell, Find.CurrentMap, debugDrawLord.ownedPawns.Count) > num; } } foreach (IntVec3 allCell2 in Find.CurrentMap.AllCells) { if (debugDrawGrid[allCell2]) { CellRenderer.RenderCell(allCell2); } } tmpToSteal.Clear(); for (int i = 0; i < debugDrawLord.ownedPawns.Count; i++) { Pawn pawn = debugDrawLord.ownedPawns[i]; if (StealAIUtility.TryFindBestItemToSteal(pawn.Position, pawn.Map, 7f, out var item, pawn, tmpToSteal)) { GenDraw.DrawLineBetween(pawn.TrueCenter(), item.TrueCenter()); tmpToSteal.Add(item); } } tmpToSteal.Clear(); }
public static void DebugDraw() { if (DebugViewSettings.drawInfestationChance) { Map visibleMap = Find.VisibleMap; CellRect cellRect = Find.CameraDriver.CurrentViewRect; cellRect.ClipInsideMap(visibleMap); cellRect = cellRect.ExpandedBy(1); InfestationCellFinder.CalculateTraversalDistancesToUnroofed(visibleMap); InfestationCellFinder.CalculateClosedAreaSizeGrid(visibleMap); InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(visibleMap); float num = 0.001f; for (int i = 0; i < visibleMap.Size.z; i++) { for (int j = 0; j < visibleMap.Size.x; j++) { IntVec3 cell = new IntVec3(j, 0, i); float scoreAt = InfestationCellFinder.GetScoreAt(cell, visibleMap); if (scoreAt > num) { num = scoreAt; } } } for (int k = 0; k < visibleMap.Size.z; k++) { for (int l = 0; l < visibleMap.Size.x; l++) { IntVec3 intVec = new IntVec3(l, 0, k); if (cellRect.Contains(intVec)) { float scoreAt2 = InfestationCellFinder.GetScoreAt(intVec, visibleMap); if (scoreAt2 > 0f) { float a = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2); CellRenderer.RenderCell(intVec, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, a), false)); } } } } } }
private void DrawDebugPowerNets() { if (Current.ProgramState != ProgramState.Playing) { return; } int num = 0; foreach (ShieldNet current in this.allNets) { foreach (CompShield current2 in current.transmitters.Concat(current.connectors)) { foreach (IntVec3 current3 in GenAdj.CellsOccupiedBy(current2.parent)) { CellRenderer.RenderCell(current3, (float)num * 0.44f); } } num++; } }
private void DrawDebugPowerNets() { if (Current.ProgramState == ProgramState.Playing) { if (Find.CurrentMap == this.map) { int num = 0; foreach (PowerNet powerNet in this.allNets) { foreach (CompPower compPower in powerNet.transmitters.Concat(powerNet.connectors)) { foreach (IntVec3 c in GenAdj.CellsOccupiedBy(compPower.parent)) { CellRenderer.RenderCell(c, (float)num * 0.44f); } } num++; } } } }
private void DrawDebugSteamNets() { if (Current.ProgramState != ProgramState.Playing) { return; } if (Find.CurrentMap != map) { return; } int num = 0; foreach (SteamNet steamNet in allNets) { foreach (CompSteam CompSteam in steamNet.transmitters.Concat(steamNet.connectors)) { foreach (IntVec3 c in GenAdj.CellsOccupiedBy(CompSteam.parent)) { CellRenderer.RenderCell(c, num * 0.44f); } } num++; } }
public static void DrawDebug() { if (!DebugViewSettings.drawDoorsDebug) { return; } var visibleRect = Find.CameraDriver.CurrentViewRect; var buildings = Find.CurrentMap.listerThings.ThingsInGroup(ThingRequestGroup.BuildingArtificial); for (int i = 0; i < buildings.Count; i++) { if (!visibleRect.Contains(buildings[i].Position)) { continue; } var door = buildings[i] as Building_Door; if (door != null) { Color color; if (door.FreePassage) { color = new Color(0f, 1f, 0f, 0.5f); } else { color = new Color(1f, 0f, 0f, 0.5f); } CellRenderer.RenderCell(door.Position, SolidColorMaterials.SimpleSolidColorMaterial(color)); } } }
public static void DebugDraw() { if (DebugViewSettings.drawInfestationChance) { if (tmpCachedInfestationChanceCellColors == null) { tmpCachedInfestationChanceCellColors = new List <Pair <IntVec3, float> >(); } if (Time.frameCount % 8 == 0) { tmpCachedInfestationChanceCellColors.Clear(); Map currentMap = Find.CurrentMap; CellRect currentViewRect = Find.CameraDriver.CurrentViewRect; currentViewRect.ClipInsideMap(currentMap); currentViewRect = currentViewRect.ExpandedBy(1); CalculateTraversalDistancesToUnroofed(currentMap); CalculateClosedAreaSizeGrid(currentMap); CalculateDistanceToColonyBuildingGrid(currentMap); float num = 0.001f; int num2 = 0; while (true) { int num3 = num2; IntVec3 size = currentMap.Size; if (num3 >= size.z) { break; } int num4 = 0; while (true) { int num5 = num4; IntVec3 size2 = currentMap.Size; if (num5 >= size2.x) { break; } IntVec3 cell = new IntVec3(num4, 0, num2); float scoreAt = GetScoreAt(cell, currentMap); if (scoreAt > num) { num = scoreAt; } num4++; } num2++; } int num6 = 0; while (true) { int num7 = num6; IntVec3 size3 = currentMap.Size; if (num7 >= size3.z) { break; } int num8 = 0; while (true) { int num9 = num8; IntVec3 size4 = currentMap.Size; if (num9 >= size4.x) { break; } IntVec3 intVec = new IntVec3(num8, 0, num6); if (currentViewRect.Contains(intVec)) { float scoreAt2 = GetScoreAt(intVec, currentMap); if (!(scoreAt2 <= 7.5f)) { float second = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2); tmpCachedInfestationChanceCellColors.Add(new Pair <IntVec3, float>(intVec, second)); } } num8++; } num6++; } } for (int i = 0; i < tmpCachedInfestationChanceCellColors.Count; i++) { IntVec3 first = tmpCachedInfestationChanceCellColors[i].First; float second2 = tmpCachedInfestationChanceCellColors[i].Second; CellRenderer.RenderCell(first, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, second2))); } } else { tmpCachedInfestationChanceCellColors = null; } }
public static void DebugDraw() { if (DebugViewSettings.drawInfestationChance) { Map visibleMap = Find.VisibleMap; CellRect cellRect = Find.CameraDriver.CurrentViewRect; cellRect.ClipInsideMap(visibleMap); cellRect = cellRect.ExpandedBy(1); InfestationCellFinder.CalculateTraversalDistancesToUnroofed(visibleMap); InfestationCellFinder.CalculateClosedAreaSizeGrid(visibleMap); InfestationCellFinder.CalculateDistanceToColonyBuildingGrid(visibleMap); float num = 0.001f; int num2 = 0; while (true) { int num3 = num2; IntVec3 size = visibleMap.Size; if (num3 < size.z) { int num4 = 0; while (true) { int num5 = num4; IntVec3 size2 = visibleMap.Size; if (num5 < size2.x) { IntVec3 cell = new IntVec3(num4, 0, num2); float scoreAt = InfestationCellFinder.GetScoreAt(cell, visibleMap); if (scoreAt > num) { num = scoreAt; } num4++; continue; } break; } num2++; continue; } break; } int num6 = 0; while (true) { int num7 = num6; IntVec3 size3 = visibleMap.Size; if (num7 < size3.z) { int num8 = 0; while (true) { int num9 = num8; IntVec3 size4 = visibleMap.Size; if (num9 < size4.x) { IntVec3 intVec = new IntVec3(num8, 0, num6); if (cellRect.Contains(intVec)) { float scoreAt2 = InfestationCellFinder.GetScoreAt(intVec, visibleMap); if (!(scoreAt2 <= 0.0)) { float a = GenMath.LerpDouble(7.5f, num, 0f, 1f, scoreAt2); CellRenderer.RenderCell(intVec, SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0f, 1f, a), false)); } } num8++; continue; } break; } num6++; continue; } break; } } }