public RobberMenu(int nCards) { this.Width = fWidth; this.Height = fHeight; this.Center = new Vector2(50f, 30f); this.Texture = "RobberMenu"; for (int x = 0; x < oCards.Count(); x++) { oCards[x] = new List <XNACS1Rectangle>(); oCardDisplacements[x] = new List <Vector2>(); } oButton = new XNACS1Rectangle(new Vector2(), Global.PixelSize(111), Global.PixelSize(34)); oButton.UseSpriteSheet = true; oButton.SetTextureSpriteSheet("TradeMenuButtons1", 3, 1, 0); oButton.SetTextureSpriteAnimationFrames(0, 0, 0, 0, 1, SpriteSheetAnimationMode.AnimateForward); oButton.LabelColor = Color.White; oButton.Label = "Accept"; oDiscardCount = new XNACS1Rectangle(new Vector2(), 5f, 5f); oDiscardCount.Color = new Color(0, 0, 0, 0); oDiscardCount.Label = "" + nDiscardsNeeded; oDiscardCount.LabelColor = Color.White; nDiscardsNeeded = (nCards / 2) + (nCards % 2); }
/// <summary> /// Sets the textures and sets up the indicator. /// </summary> /// <param name="side">The selection of textures for the side of the screen.</param> public void setTrapTextures(ScreenSide side) { screenSide = side; if (side == ScreenSide.Left) { // Set the bumper textures inactiveTexture = leftInactiveTexture; activeTexture = leftActiveTexture; // set the indicator textures activeIndicatorTexture = leftActivatedIndicatorTexture; deactivatingIndicatorTexture = leftDeactivatingIndicatorTexture; reactivatingIndicatorTexture = leftReactivatingIndicatorTexture; // set indicator location. indicator.CenterX = this.CenterX + leftIndicatorXOffset; } else { // Set the bumper textures inactiveTexture = rightInactiveTexture; activeTexture = rightActiveTexture; // set the indicator textures activeIndicatorTexture = rightActivatedIndicatorTexture; deactivatingIndicatorTexture = rightDeactivatingIndicatorTexture; reactivatingIndicatorTexture = rightReactivatingIndicatorTexture; // set indicator location. indicator.CenterX = this.CenterX + rightIndicatorXOffset; } Texture = inactiveTexture; indicator.SetTextureSpriteSheet(deactivatingIndicatorTexture, 24, 198); indicator.SetTextureSpriteAnimationFrames( 13, 0, 13, 0, 3, SpriteSheetAnimationMode.AnimateForwardThenStop); indicator.CenterY = this.CenterY; }
public void PositionPorts() { int nPosition = -1; int nPortType = -1; // look for port for (int x = 0; x < oIntersections.Count(); x++) { if (oIntersections[x].nPortType == -1) { continue; } if (x == 5) { if (oIntersections[5].nPortType > -1 && oIntersections[0].nPortType > -1) { nPosition = 5; nPortType = oIntersections[x].nPortType; } } else { if (oIntersections[x].nPortType > -1 && oIntersections[x + 1].nPortType > -1) { nPosition = x; nPortType = oIntersections[x].nPortType; } } } // port found if (nPosition > -1) { //oPort = new XNACS1Rectangle(oPortDisplacements[nPosition] + this.Center, Global.PixelSize(72), Global.PixelSize(72)); oPort = new XNACS1Rectangle(this.Center + oPortDisplacement, Global.PixelSize(190), Global.PixelSize(170)); //oPort.Label = "" + nPortType; oPort.UseSpriteSheet = true; oPort.SetTextureSpriteSheet("Ports2", 6, 1, 0); oPort.SetTextureSpriteAnimationFrames(nPosition, 0, nPosition, 0, 1, SpriteSheetAnimationMode.AnimateForward); oPort.Visible = true; oPortSymbol = new XNACS1Rectangle(this.Center + oPortSymbolDisplacements[nPosition], fPortSymbolWidth, fPortSymbolHeight); oPortSymbol.UseSpriteSheet = true; oPortSymbol.SetTextureSpriteSheet("PortSymbols", 6, 1, 0); oPortSymbol.SetTextureSpriteAnimationFrames(nPortType, 0, nPortType, 0, 1, SpriteSheetAnimationMode.AnimateForward); oPortSymbol.Visible = true; } }
/// <summary> /// Adds a joint a location. /// </summary> private void addJoint(Vector2 location) { XNACS1Rectangle joint = new XNACS1Rectangle( location, XNACS1Lib.XNACS1Base.World.WorldDimension.Y * .04f, XNACS1Lib.XNACS1Base.World.WorldDimension.Y * .04f); joint.SetTextureSpriteSheet(defaultJointTexture, 36, 36); joint.SetTextureSpriteAnimationFrames( 0, 0, 5, 5, 5, SpriteSheetAnimationMode.AnimateForward); joint.UseSpriteSheet = true; joint.UseSpriteSheetAnimation = true; foregroundItems.Add(joint); }
private void initialize() { ShouldTravel = true; Velocity = VelocityDirection = Vector2.Zero; wallState = WallState.Inactive; inactiveTexture = defaultInactiveTexture; activeTexture = defaultActiveTexture; addtoGameobjects(); // Set up the indicator, default left active indicator indicator = new XNACS1Rectangle(new Vector2(CenterX, CenterY), indicatorWidth, indicatorHeight); indicator.SetTextureSpriteSheet(leftDeactivatingIndicatorTexture, 24, 198); indicator.SetTextureSpriteAnimationFrames( 13, 0, 13, 0, 3, SpriteSheetAnimationMode.AnimateForwardThenStop); indicator.UseSpriteSheet = true; indicator.UseSpriteSheetAnimation = true; }
public Hex(Vector2 oCenter, int nNumber, string sType, string sLabel = null) { this.Center = oCenter + new Vector2(0f, 10f); this.nNumber = nNumber; this.Width = fWidth; this.Height = fHeight; this.sType = sType; otest = new XNACS1Rectangle(this.Center, 3f, 2f); otest.Color = new Color(0, 0, 0, 170); otest.LabelFont = "SmallHUD"; otest.LabelColor = Color.Red; otest.Visible = false; oNumber = new XNACS1Rectangle(this.Center + oNumberOffset, Global.PixelSize(28), Global.PixelSize(25)); oNumber.SetTextureSpriteSheet("ResourceNumbers2", 11, 1, 0); oNumber.UseSpriteSheet = true; oNumber.SetTextureSpriteAnimationFrames(nNumber - 2, 0, nNumber - 2, 0, 1, SpriteSheetAnimationMode.AnimateForward); oPortDisplacements[0] = new Vector2(0f, 5.0f); oPortDisplacements[1] = new Vector2(-6.1f, 3.45f); oPortDisplacements[2] = new Vector2(-6.1f, -3.45f); oPortDisplacements[3] = new Vector2(0f, -6.2f); oPortDisplacements[4] = new Vector2(6.1f, -3.45f); oPortDisplacements[5] = new Vector2(6.1f, 3.45f); oPortSymbolDisplacements[0] = new Vector2(0f, 10f); oPortSymbolDisplacements[1] = new Vector2(-10f, 5f); oPortSymbolDisplacements[2] = new Vector2(-10f, -5f); oPortSymbolDisplacements[3] = new Vector2(0f, -10f); oPortSymbolDisplacements[4] = new Vector2(10f, -5f); oPortSymbolDisplacements[5] = new Vector2(10f, 5f); switch (sType) { case "wool": this.Texture = "WoolHex2"; break; case "lumber": this.Texture = "LumberHex2"; break; case "ore": this.Texture = "OreHex2"; break; case "grain": this.Texture = "GrainHex2"; break; case "brick": this.Texture = "BrickHex2"; break; case "empty": this.Texture = "OreHex2"; this.TextureTintColor = new Color(0, 0, 0, 256); break; } }
public virtual void initializeForeground() { foregroundItems = new List <XNACS1Rectangle>(); float worldWidth = XNACS1Lib.XNACS1Base.World.WorldDimension.X; float worldHeight = XNACS1Lib.XNACS1Base.World.WorldDimension.Y; #region Side rails XNACS1Rectangle leftRail = new XNACS1Rectangle( new Vector2(worldWidth * TRACK_OFFSET_FROM_SIDE_SCREEN_RATIO, worldHeight * TRACK_CENTER_HEIGHT_SCREEN_RATIO), TRACK_WIDTH, worldHeight * TRACK_HEIGHT_SCREEN_RATIO); leftRail.SetTextureSpriteSheet( defaultLeftRailTexture, 76, 1024); leftRail.SetTextureSpriteAnimationFrames( 0, 0, 5, 0, 5, SpriteSheetAnimationMode.AnimateForward); leftRail.UseSpriteSheet = true; leftRail.UseSpriteSheetAnimation = true; foregroundItems.Add(leftRail); XNACS1Rectangle rightRail = new XNACS1Rectangle( new Vector2(worldWidth * (1 - TRACK_OFFSET_FROM_SIDE_SCREEN_RATIO), worldHeight * TRACK_CENTER_HEIGHT_SCREEN_RATIO + TRACK_RIGHT_Y_POS_OFFSET), TRACK_WIDTH, worldHeight * TRACK_HEIGHT_SCREEN_RATIO); rightRail.SetTextureSpriteSheet( defaultRightRailTexture, 76, 1024); rightRail.SetTextureSpriteAnimationFrames( 0, 0, 5, 0, 5, SpriteSheetAnimationMode.AnimateForward); rightRail.UseSpriteSheet = true; rightRail.UseSpriteSheetAnimation = true; foregroundItems.Add(rightRail); #endregion rails XNACS1Rectangle bottomBarrier = new XNACS1Rectangle( new Vector2(worldWidth / 2, worldHeight * 0.045f), worldWidth * 0.95f, worldHeight * 0.09f); bottomBarrier.SetTextureSpriteSheet( defaultBarrierTexture, 1248, 70); bottomBarrier.SetTextureSpriteAnimationFrames( 0, 0, 1, 35, 3, SpriteSheetAnimationMode.AnimateForward); bottomBarrier.UseSpriteSheet = true; bottomBarrier.UseSpriteSheetAnimation = true; foregroundItems.Add(bottomBarrier); XNACS1Rectangle boundingBox = new XNACS1Rectangle( new Vector2(worldWidth / 2, worldHeight / 2), worldWidth, worldHeight, defaultBoundingBoxTexture); foregroundItems.Add(boundingBox); // Bottom Joints addJoint(new Vector2(worldWidth * .015f, worldHeight * .025f)); addJoint(new Vector2(worldWidth * .98f, worldHeight * .025f)); // Top Joints addJoint(new Vector2(worldWidth * .015f, worldHeight * .86f)); addJoint(new Vector2(worldWidth * .98f, worldHeight * .86f)); }