public void drawVoxel(QuarterViewDrawer view, DrawContextEx dc, Location loc, Point pt)
 {
     if (World.world[loc] == null)
     {
         ResourceUtil.emptyChip.drawShape(dc.surface, pt, Color.Red);
     }
 }
Esempio n. 2
0
            public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
            {
                if (loc.z != currentLoc.z)
                {
                    return;
                }

                if (anchor != UNPLACED && loc.inBetween(anchor, currentLoc))
                {
                    Location loc1 = base.location1;
                    Location loc2 = base.location2;
                    //contrib.sprites[contrib.getIndex(loc1.x,loc.x,loc2.x), contrib.getIndex(loc1.y,loc.y,loc2.y)]
                    if (loc1.x == loc.x)
                    {
                        contrib.sprites[Direction.WEST.index / 2].drawAlpha(canvas.surface, pt);
                    }
                    if (loc1.y == loc.y)
                    {
                        contrib.sprites[Direction.NORTH.index / 2].drawAlpha(canvas.surface, pt);
                    }
                    if (loc2.x == loc.x)
                    {
                        contrib.sprites[Direction.EAST.index / 2].drawAlpha(canvas.surface, pt);
                    }
                    if (loc2.y == loc.y)
                    {
                        contrib.sprites[Direction.SOUTH.index / 2].drawAlpha(canvas.surface, pt);
                    }
                }
            }
 public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
 {
     if (Cube.createExclusive(baseLoc, alphaSprites.size).contains(loc))
     {
         alphaSprites.getSprite(loc - baseLoc).drawAlpha(canvas.surface, pt);
     }
 }
Esempio n. 4
0
        public override void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
        {
            if (base.currentPos != loc)
            {
                return;
            }
            if (!contribution.canBeBuilt(loc))
            {
                return;
            }

            int         x;
            RoadPattern rp = TrafficVoxel.get(loc).road.pattern;

            if (rp.hasRoad(Direction.NORTH))
            {
                x = 0;
            }
            else
            {
                x = 1;
            }

            contribution.sprites[color, x].drawAlpha(canvas.surface, pt);
        }
Esempio n. 5
0
 public void drawVoxel(QuarterViewDrawer view, DrawContextEx dc, Location loc, Point pt)
 {
     if (baseLoc == loc)
     {
         strategy.drawVoxel(view, dc, loc, pt);
     }
 }
 public void drawBefore(QuarterViewDrawer view, DrawContextEx canvas)
 {
     if (anchor != UNPLACED && isPlacing && isPassage)
     {
         canvas.tag = canBuildPassageway(anchor, location);
     }
 }
Esempio n. 7
0
 public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
 {
     if (loc != anchor)
     {
         return;
     }
     if (anchor.Equals(currentPos))
     {
         cursors[0].draw(canvas.surface, pt);
     }
     else
     {
         //HalfDividedVoxel v = World.world[loc] as HalfDividedVoxel;
         int n, m, l;
         n = remover?5:1;
         m = front.isParallelToX?0:1;
         l = (currentSide == PlaceSide.Back)?0:2;
         cursors[n + m + l].draw(canvas.surface, pt);
         if (!remover)
         {
             contrib.getSprite(front, currentSide, contrib.currentColor).drawAlpha(canvas.surface, pt);
             Sprite hls = contrib.getHighLightSprite(front, currentSide, contrib.currentHighlight);
             if (hls != null)
             {
                 hls.drawAlpha(canvas.surface, pt);
             }
         }
     }
 }
Esempio n. 8
0
 public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
 {
     if (currentCube.contains(loc))
     {
         alphaSprites.getSprite(loc - this.location).drawAlpha(canvas.surface, pt);
     }
 }
Esempio n. 9
0
        //
        // MapOverlay implementation
        //
        public void drawVoxel(QuarterViewDrawer view, DrawContextEx context, Location loc, Point pt)
        {
            JunctionRailRoad jrr = JunctionRailRoad.get(loc);

            if (jrr == null)
            {
                return;
            }

            // draw an arrow that indicates the direction to go
            JunctionRoute go; bool isSimple = true;

            Junction j = controller.getJunction(loc);

            if (j == null)
            {
                go = JunctionRoute.Straight;
            }
            else
            {
                go = j.defaultRoute;
                if (j.advancedRules.Count != 0)
                {
                    isSimple = false;
                }
            }

            // draw an arrow.
            pt.Y -= 2;
            jrr.getDirection(go).drawArrow(context.surface, pt, !isSimple);
        }
Esempio n. 10
0
 public void drawVoxel(QuarterViewDrawer view, DrawContextEx dc, Location loc, Point pt)
 {
     if (World.world[loc] is MountainVoxel)
     {
         ResourceUtil.emptyChip.drawAlpha(dc.surface, new Point(pt.X, pt.Y - 16));
         TerraceVoxel.image.drawAlpha(dc.surface, pt);
     }
 }
Esempio n. 11
0
        public void drawAfter(QuarterViewDrawer view, DrawContextEx canvas)
        {
            // determine the rect
            Rectangle r  = _rect;
            Point     pt = view.origin;

            r.Offset(-pt.X, -pt.Y);

            canvas.graphics.DrawRectangle(pen, r);
        }
        public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
        {
            object tag = canvas.tag;

            if (tag != null && (bool)tag && loc.inBetween(anchor, location))
            {
                PassagewayRail.getFloatingSprite(anchor.getDirectionTo(location))
                .drawAlpha(canvas.surface, pt);
            }
        }
Esempio n. 13
0
 public void drawVoxel(QuarterViewDrawer view, DrawContextEx dc, Location loc, Point pt)
 {
     if (loc == baseLoc)
     {
         RailPattern.get(currentDirection, currentDirection.opposite)
         .drawAlpha(dc.surface, pt);
         currentType.getSprite(currentDirection)
         .drawAlpha(dc.surface, pt);
     }
 }
Esempio n. 14
0
 public void drawBefore(QuarterViewDrawer view, DrawContextEx surface)
 {
     if (anchor != UNPLACED && currentLoc != UNPLACED)
     {
         // compute the route
         route = contrib.computeRoute(anchor, currentLoc);
     }
     else
     {
         route = null;
     }
 }
Esempio n. 15
0
            public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
            {
                if (loc.z != currentLoc.z)
                {
                    return;
                }

                if (route != null && route.Contains(loc))
                {
                    contrib.getSprite((Dir)route[loc]).drawAlpha(canvas.surface, pt);
                }
            }
Esempio n. 16
0
        public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
        {
            if (loc.z != currentLoc.z)
            {
                return;
            }

            if (anchor != UNPLACED && loc.inBetween(anchor, currentLoc))
            {
                spriteBuilder().drawAlpha(canvas.surface, pt);
            }
        }
Esempio n. 17
0
 public void drawBefore(QuarterViewDrawer view, DrawContextEx canvas)
 {
     if (anchor != UNPLACED && isPlacing)
     {
         int cost;
         canvas.tag = SingleRailRoad.comupteRoute(anchor, currentPos, out cost);
         if (canvas.tag != null)
         {
             Debug.WriteLine(((IDictionary)canvas.tag).Count);
         }
     }
 }
Esempio n. 18
0
            public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
            {
                //if( loc.z != currentLoc.z )	return;

                if (anchor != UNPLACED && loc.inBetween(anchor, currentPos))
                {
                    Location  loc1 = base.location1;
                    Location  loc2 = base.location2;
                    Direction side = base.currentSide;
                    //contrib.sprites[contrib.getIndex(loc1.x,loc.x,loc2.x), contrib.getIndex(loc1.y,loc.y,loc2.y)]
                    contrib.sprites[currentSide.index / 2].drawAlpha(canvas.surface, pt);
                }
            }
Esempio n. 19
0
        public override void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
        {
            if (base.currentPos != loc)
            {
                return;
            }

            ElectricPole e = ElectricPole.get(loc);

            if (e != null)
            {
                ResourceUtil.emptyChip.drawShape(canvas.surface, pt, Color.Red);
            }
        }
Esempio n. 20
0
            public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
            {
                if (loc.z != currentLoc.z)
                {
                    return;
                }

                if (anchor != UNPLACED && loc.inBetween(anchor, currentLoc))
                {
                    Location loc1 = base.location1;
                    Location loc2 = base.location2;
                    contrib.sprites[contrib.getSpriteIndex(loc.x, loc.y, loc1.x, loc1.y, loc2.x, loc2.y)]
                    .drawAlpha(canvas.surface, pt);
                }
            }
        public void drawAfter(QuarterViewDrawer view, DrawContextEx dc)
        {
            Train tr = this.selectedTrain;

            if (tr == null || !tr.head.state.isInside)
            {
                return;
            }

            // draw an arrow that indicates the direction of the train
            CarState.Inside ci = tr.head.state.asInside();

            Point pt = view.fromXYZToClient(ci.location);

            pt.Y -= 12;

            ci.direction.drawArrow(dc.surface, pt);
        }
            public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
            {
                if (loc.z != anchor.z)
                {
                    return;
                }

                if (anchor != UNPLACED && loc.inBetween(anchor, currentLoc))
                {
                    if (owner.isPlacing)
                    {
                        LandPropertyVoxel.sprite.drawAlpha(canvas.surface, pt);
                    }
                    else
                    {
                        ResourceUtil.emptyChip.drawAlpha(canvas.surface, pt);
                    }
                }
            }
Esempio n. 23
0
        public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
        {
            IDictionary dic = (IDictionary)canvas.tag;

            if (dic != null)
            {
                RailPattern rp = (RailPattern)dic[loc];
                if (rp != null)
                {
                    for (int j = World.world.getGroundLevel(loc); j < loc.z; j++)
                    {
                        // TODO: ground level handling
                        BridgePierVoxel.defaultSprite.drawAlpha(
                            canvas.surface,
                            view.fromXYZToClient(loc.x, loc.y, j));
                    }

                    rp.drawAlpha(canvas.surface, pt);
                }
            }
        }
        public void drawAfter(QuarterViewDrawer view, DrawContextEx dc)
        {
            if (!isPlacing)
            {
                return;
            }
            Location loc = lastMouse;

            if (loc == world.Location.UNPLACED)
            {
                return;
            }
            if (!SlopeRailRoad.canCreateSlope(loc, direction))
            {
                return;
            }

            Surface canvas = dc.surface;

            int Z = loc.z;

            for (int i = 0; i < 4; i++)
            {
                if (i == 2)
                {
                    loc.z++;
                }

                for (int j = World.world.getGroundLevel(loc); j < Z; j++)
                {
                    // TODO: ground level handling
                    BridgePierVoxel.defaultSprite.drawAlpha(
                        canvas, view.fromXYZToClient(loc.x, loc.y, j));
                }

                RailPattern.getSlope(direction, i).drawAlpha(
                    canvas, view.fromXYZToClient(loc));
                loc += direction;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Recreates the offscreen drawing surface.
        /// </summary>
        /// <param name="forceRecreate">
        /// Set this flag to true to force the release of the surface.
        /// This is useful when you absolutely wants a fresh surface
        /// (such as when the current surface is lost)
        /// </param>
        private void recreateDrawBuffer(Size size, bool forceRecreate)
        {
            if (offscreenBuffer != null)
            {
                if (size == offscreenBuffer.size && !forceRecreate)
                {
                    return;                     // no need for re-allocation
                }
                drawContext.Dispose();
                drawContext = null;
                offscreenBuffer.Dispose();
                offscreenBuffer = null;
            }

            if (size.Width > 0 && size.Height > 0)
            {
                offscreenBuffer = directDraw.createOffscreenSurface(size);
                drawContext     = new DrawContextEx(offscreenBuffer);
            }

            onUpdateAllVoxels();
        }
Esempio n. 26
0
        public void drawVoxel(QuarterViewDrawer view, DrawContextEx canvas, Location loc, Point pt)
        {
            if (loc.z != currentLoc.z)
            {
                return;
            }

            if (anchor != UNPLACED && loc.inBetween(anchor, currentLoc))
            {
                byte[] tree = contrib.createRandomTrees();

                if (contrib.ground != null)
                {
                    contrib.ground.draw(canvas.surface, pt);
                }
                for (int i = 0; i < tree.Length; i += 3)
                {
                    contrib.sprites[tree[i + 2]].draw(canvas.surface,
                                                      new Point(pt.X + tree[i + 0], pt.Y + tree[i + 1]));
                }
            }
        }
Esempio n. 27
0
 public void drawAfter(QuarterViewDrawer view, DrawContextEx surface)
 {
 }
Esempio n. 28
0
 public void drawBefore(QuarterViewDrawer view, DrawContextEx surface)
 {
 }
Esempio n. 29
0
 public void drawBefore(QuarterViewDrawer view, DrawContextEx context)
 {
 }
Esempio n. 30
0
 public void drawAfter(QuarterViewDrawer view, DrawContextEx context)
 {
 }