public virtual void init(Color c, Color bgColor, Board b, Transform parent) { transform.parent = parent; blockModel = Instantiate(Resources.Load <GameObject>("Prefabs/Block")).GetComponent <BlockModel>(); baseColor = c; blockModel.init(transform, baseColor); name = "Block"; onBackgroundChange(bgColor); hasEnemy = false; highlighted = false; }
Transform CreateBlock(BlockModel model) { Transform instance = Instantiate(piecePrefab); instance.gameObject.GetComponent <BlockView>().dir1 = model.dir1; instance.gameObject.GetComponent <BlockView>().dir2 = model.dir2; float ro = HexMetrics.outerRadius; float ri = HexMetrics.innerRadius; instance.localPosition = new Vector3(2f * ri * (((float)model.x) + (model.z % 2 == 0?0.0f:0.5f)), 0f, 1.5f * ro * (float)model.z); return(instance); }
public async void PostBlockNameSuccess(string resultBlock) { BlockModel = new BlockModel(); updateBlock = new UpdateBlock(); BlockName = string.Empty; await App.Current.MainPage.DisplayAlert("HMS", resultBlock, "OK"); OnPropertyChanged("BlockName"); OnPropertyChanged("BlockModel"); //await App.Current.MainPage.Navigation.PopModalAsync(true); //MessagingCenter.Send<EditBlock>((EditBlock)this, "click_profile_tab"); }
BlockWithDir GetNext(BlockWithDir prev) { HexDirection dir = prev.Dir; BlockModel block = prev.Block; int x = block.x; int z = block.z; if (dir == HexDirection.E) { x += 1; } if (dir == HexDirection.W) { x -= 1; } if (dir == HexDirection.NE) { x += (z % 2); z += 1; } if (dir == HexDirection.NW) { x += (z % 2) - 1; z += 1; } if (dir == HexDirection.SE) { x += (z % 2); z -= 1; } if (dir == HexDirection.SW) { x += (z % 2) - 1; z -= 1; } BlockModel next = grid.Get(x, z); if (next == null) { return(null); } HexDirection opp = dir.Opposite(); if (next.dir1 == opp) { return(new BlockWithDir(next, next.dir2)); } if (next.dir2 == opp) { return(new BlockWithDir(next, next.dir1)); } return(null); }
public static BlockModel GetSlopeModel(bool IsFlipX) { BlockModel NewBlockModel = new BlockModel (); // top NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(- 0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(- 0.5f, 0.5f, - 0.5f)); NewBlockModel.AddQuadIndicies (0); NewBlockModel.IsSolid[0] = false; // bottom // no change for bottom NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(- 0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(- 0.5f, -0.5f, 0.5f)); NewBlockModel.AddQuadIndicies (1); NewBlockModel.IsSolid[1] = false; // north NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(-0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(-0.5f, -0.5f, 0.5f)); NewBlockModel.AddQuadIndicies (2); NewBlockModel.IsSolid[2] = false; // east // nothing for east NewBlockModel.IsSolid[3] = false; // south NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(-0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(-0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.AddQuadIndicies (4); NewBlockModel.IsSolid[4] = false; // west // west is also the same NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, -0.5f, -0.5f)); NewBlockModel.AddQuadIndicies (5); NewBlockModel.IsSolid[5] = true; NewBlockModel.GenerateTextureMaps (16, true, true, true, false, true, true); if (IsFlipX) { NewBlockModel.FlipModel (); NewBlockModel.IsSolid[3] = true; NewBlockModel.IsSolid[5] = false; } return NewBlockModel; }
public IActionResult Block(string block) { ViewBag.Features = settings.Features; ViewBag.Setup = settings.Setup; ViewBag.Chain = chainSettings; ViewBag.BlockchainHeight = stats.SyncBlockIndex; BlockModel result = (block.ToLower() == "latest") ? indexService.GetLatestBlock() : indexService.GetBlockByHeight(int.Parse(block)); return(View(result)); }
public void Draw() { Bitmap flag = new Bitmap(fieldSize, fieldSize); Graphics flagGraphics = Graphics.FromImage(flag); BallView.DrawBall(BallModel.GetBall(), flagGraphics); BlocksView.DrawBlocks(BlockModel.GetBlocks(), flagGraphics); TankView.DrawTanks(TankModel.GetTanks(), flagGraphics); AppleView.DrawApples(AppleModel.GetApples(), flagGraphics); pictureBox.Image = flag; }
private void OnSelectedBlockItem(object sender, ItemTappedEventArgs e) { BlockModel md = (BlockModel)lv_block.SelectedItem; int cnt = Vm.BlockModelList.IndexOf(md); if (cnt >= 0) { Vm.BlockSelection(cnt); } ((ListView)sender).SelectedItem = null; }
public IActionResult GetBlock([FromQuery] SearchByHashRequest query) { if (!this.ModelState.IsValid) { return(ModelStateErrors.BuildErrorResponse(this.ModelState)); } try { uint256 blockId = uint256.Parse(query.Hash); ChainedHeader chainedHeader = this.chainIndexer.GetHeader(blockId); if (chainedHeader == null) { return(this.Ok("Block not found")); } Block block = chainedHeader.Block ?? this.blockStore.GetBlock(blockId); // In rare occasions a block that is found in the // indexer may not have been pushed to the store yet. if (block == null) { return(this.Ok("Block not found")); } if (!query.OutputJson) { return(this.Json(block)); } BlockModel blockModel = query.ShowTransactionDetails ? new BlockTransactionDetailsModel(block, chainedHeader, this.chainIndexer.Tip, this.network) : new BlockModel(block, chainedHeader, this.chainIndexer.Tip, this.network); if (this.network.Consensus.IsProofOfStake) { var posBlock = block as PosBlock; blockModel.PosBlockSignature = posBlock.BlockSignature.ToHex(this.network.Consensus.ConsensusFactory); blockModel.PosBlockTrust = new Target(chainedHeader.GetBlockTarget()).ToUInt256().ToString(); blockModel.PosChainTrust = chainedHeader.ChainWork.ToString(); // this should be similar to ChainWork } return(this.Json(blockModel)); } catch (Exception e) { this.logger.LogError("Exception occurred: {0}", e.ToString()); return(ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, e.Message, e.ToString())); } }
public static void BlockIp(BlockModel input) { var dbModel = new BlockList { BlockedIp = input.BlockedIp, Explicit = input.Explicit, Reason = input.Reason, Expiration = input.BlockType.ToLower() == "timeout" ? DateTime.UtcNow.AddDays(1).Date : DateTime.MaxValue }; DbAccess.BlockIp(dbModel); }
/// <summary> /// Adds the column. /// </summary> /// <param name="shapeModel">The shape model.</param> public static void AddColumnLeft(this ShapeModel shapeModel) { var maxRow = shapeModel.LastRow(); shapeModel.Blocks.ForEach(b => b.Column = b.Column + 1); for (var row = 0; row < maxRow; row++) { var newBlock = BlockModel.Create(1, row + 1); shapeModel.Blocks.Add(newBlock); } }
// build a simple block that starts at index [0,0] BlockModel SetUpBlockLeftBound() { BlockModel block = new BlockModel { Grid = grid, GridX = 0, GridY = 0, Left = 0, Top = 0 }; return(block); }
public void Test_BlockModel_Down_3Times() { BlockModel b = SetUpBlockLeftBound(); b.MoveDown(); b.MoveDown(); b.MoveDown(); Assert.AreEqual(b.GridY, 3); Assert.AreEqual(b.GridX, 0); Assert.AreEqual(b.Top, 34 * 3); }
public static BlockModel GetCubeModel() { BlockModel NewBlockModel = new BlockModel (); // top NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(- 0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(- 0.5f, 0.5f, - 0.5f)); NewBlockModel.AddQuadIndicies (0); // bottom NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(- 0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(- 0.5f, -0.5f, 0.5f)); NewBlockModel.AddQuadIndicies (1); // north NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(-0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(-0.5f, -0.5f, 0.5f)); NewBlockModel.AddQuadIndicies (2); // east NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f)); NewBlockModel.AddQuadIndicies (3); // south NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(-0.5f, -0.5f, -0.5f)); NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(-0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f)); NewBlockModel.AddQuadIndicies (4); // west NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, -0.5f, 0.5f)); NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, 0.5f, 0.5f)); NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, 0.5f, -0.5f)); NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, -0.5f, -0.5f)); NewBlockModel.AddQuadIndicies (5); NewBlockModel.AllSolid (); // add in uvs for (int i = 0; i < 6; i++) { //NewBlockModel.ResetBlockFace (i, 1); /*NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x + tileSize, tileSize * tilePos.y)); NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x + tileSize, tileSize * tilePos.y + tileSize)); NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x, tileSize * tilePos.y + tileSize)); NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x, tileSize * tilePos.y));*/ } NewBlockModel.GenerateTextureMapsSingleFaceCube (16); return NewBlockModel; }
public async Task <ActionResult> Index(string id, int page = 0) { try { if (string.IsNullOrEmpty(id)) { return(RedirectToAction("Index", "Home")); } var getBlock = await _blockNinjaRepository.GetBlockDataAsync(id); if (getBlock == null) { getBlock = await _bitcoinNinjaReaderRepository.GetInformationBlockAsync(id); if (getBlock == null) { return(View("_NotFound")); } await _blockNinjaRepository.WriteBlockDataAsync(getBlock); } var start = ItemsOnPage * page; int max; if (start < getBlock.TotalTransactions && start + ItemsOnPage < getBlock.TotalTransactions) { max = start + ItemsOnPage; } else { max = getBlock.TotalTransactions; } var model = new BlockModel { Block = getBlock, Count = (int)Math.Ceiling((decimal)getBlock.TotalTransactions / ItemsOnPage), CurrentPage = page, Start = start, Max = max }; return(View(model)); } catch (Exception) { return(View("_NotFound")); } }
public static ControllerModel GetsimpleController1() { // Signalgroups var sg02 = new SignalGroupModel("02", 40, 50, 250, 30, 20, 30, 60); sg02.Detectors.Add(new DetectorModel("021", DetectorRequestTypeEnum.RedNonGuaranteed, DetectorExtendingTypeEnum.HeadMax, 0, 0, 10, 360)); sg02.Detectors.Add(new DetectorModel("022", DetectorRequestTypeEnum.Red, DetectorExtendingTypeEnum.Measure, 0, 0, 10, 360)); sg02.Detectors.Add(new DetectorModel("023", DetectorRequestTypeEnum.None, DetectorExtendingTypeEnum.Measure, 0, 0, 10, 360)); var sg05 = new SignalGroupModel("05", 40, 50, 250, 30, 20, 30, 60); sg05.Detectors.Add(new DetectorModel("051", DetectorRequestTypeEnum.RedNonGuaranteed, DetectorExtendingTypeEnum.HeadMax, 0, 0, 10, 360)); sg05.Detectors.Add(new DetectorModel("052", DetectorRequestTypeEnum.Red, DetectorExtendingTypeEnum.Measure, 0, 0, 10, 360)); var sg12 = new SignalGroupModel("12", 40, 50, 250, 30, 20, 30, 60); sg12.Detectors.Add(new DetectorModel("121", DetectorRequestTypeEnum.RedNonGuaranteed, DetectorExtendingTypeEnum.HeadMax, 0, 0, 10, 360)); sg12.Detectors.Add(new DetectorModel("122", DetectorRequestTypeEnum.RedNonGuaranteed, DetectorExtendingTypeEnum.None, 0, 0, 10, 360)); var c = new ControllerModel(); c.Data.MaximumWaitingTime = 240; c.SignalGroups.Add(sg02); c.SignalGroups.Add(sg05); c.SignalGroups.Add(sg12); sg02.InterGreenTimes.Add(new InterGreenTimeModel("02", "05", 45)); sg02.InterGreenTimes.Add(new InterGreenTimeModel("02", "12", 35)); sg05.InterGreenTimes.Add(new InterGreenTimeModel("05", "02", 55)); sg05.InterGreenTimes.Add(new InterGreenTimeModel("05", "12", 25)); sg12.InterGreenTimes.Add(new InterGreenTimeModel("12", "02", 15)); sg12.InterGreenTimes.Add(new InterGreenTimeModel("12", "05", 65)); var b1 = new BlockModel("B1"); b1.AddSignalGroup("02"); var b2 = new BlockModel("B2"); b2.AddSignalGroup("05"); var b3 = new BlockModel("B3"); b3.AddSignalGroup("12"); c.BlockStructure.WaitingBlockName = "B1"; c.BlockStructure.Blocks.Add(b1); c.BlockStructure.Blocks.Add(b2); c.BlockStructure.Blocks.Add(b3); return(c); }
/// <summary> /// Build the mixed block view model /// </summary> /// <param name="blockModel">The current mixed block</param> /// <returns>Return the mixed block view model</returns> public virtual async Task <ProductsAndBannerBlockViewModel> BuildAsync(BlockModel blockModel) { var sectionBanners = _bannersViewModelBuilder.Build(blockModel); var sectionProducts = await _productViewModelBuilder.BuildAsync(blockModel); var mixedBlockViewModel = blockModel.MapTo <ProductsAndBannerBlockViewModel>(); mixedBlockViewModel.Products = sectionProducts; mixedBlockViewModel.Products.FooterLinkText = mixedBlockViewModel.ProductLinkText; mixedBlockViewModel.Banners = sectionBanners; return(mixedBlockViewModel); }
public bool TryGetBlockModel(string modelName, out BlockModel model) { string @namespace = DefaultNamespace; var split = modelName.Split(':'); if (split.Length > 1) { @namespace = split[0]; modelName = split[1]; } return(TryGetBlockModel(@namespace, modelName, out model)); }
public string execute(string sendMsg) { Util.log("执行execute", id + "心跳流程.txt"); BlockModel msgmodel = new BlockModel(); msgmodel.ID = id; msgmodel.MsgId = Util.GetTimeStamp(); msgmodel.cmd = "heartbeat"; msgmodel.SendMsg = ""; sendMessageToAndroid(msgmodel); return(""); }
/// <summary> /// Adds the column. /// </summary> /// <param name="shapeModel">The shape model.</param> public static void AddColumnRight(this ShapeModel shapeModel) { var maxRow = shapeModel.LastRow(); var maxColumns = shapeModel.LastColumn(); var newColumn = maxColumns + 1; for (var row = 0; row < maxRow; row++) { var newBlock = BlockModel.Create(newColumn, row + 1); shapeModel.Blocks.Add(newBlock); } }
public ActionResult PostBlockAccount(Guid?blockedUser, bool status) { BlockModel blockModel = new BlockModel(); blockModel.BlockedUser = blockedUser.ToString(); blockModel.BlockingUser = User.Identity.GetUserId(); blockModel.DateTime = DateTime.UtcNow; blockModel.Status = status; data.SaveBlockUser(SessionToken, blockModel); return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); }
public override Task <BlocksResponse> GetBlocks(BlockRequest request, ServerCallContext context) { var blocks = Blockchain.GetBlocks(request.PageNumber, request.ResultPerPage); BlocksResponse response = new BlocksResponse(); foreach (Block block in blocks) { BlockModel mdl = ConvertBlock(block); response.Blocks.Add(mdl); } return(Task.FromResult(response)); }
public RequestResult <BlockModel> GetBlockUser(string sessionToken, BlockModel model) { var parameters = $"/savecommonfunctionality/getblockusers/?sessionToken={sessionToken}&&blockeduser={model.BlockedUser}&&blockingUser={model.BlockingUser}"; try { return(GetAndParseData <RequestResult <BlockModel> >(null, parameters)); } catch (Exception ex) { throw ex; } }
public void PutBlock(GameTypes.PlayerType playerType, BlockModel blockModel) { var positions = new List <Vector3>(); var occupiedCells = blockModel.OccupyCells; foreach (var cell in occupiedCells) { positions.Add(new Vector3(cell.X, BLOCK_POS_Y, cell.Y)); } var materialType = PlayerTypeToMaterialType(playerType); Block.Create(materialType, positions, _blockTransform); }
BlockModel SetUpBlockRightBound() { BlockModel b = new BlockModel { Grid = grid, GridX = 4, GridY = 0, Left = 34 * 4, Top = 0 }; return(b); }
/// <summary> /// Adds the row at the bottom /// </summary> /// <param name="shapeModel">The shape model.</param> public static void AddRowBottom(this ShapeModel shapeModel) { var maxRow = shapeModel.LastRow(); var maxColumns = shapeModel.LastColumn(); var newRow = maxRow + 1; for (var col = 0; col < maxColumns; col++) { var newBlock = BlockModel.Create(col + 1, newRow); shapeModel.Blocks.Add(newBlock); } }
public BaseBlock(Vector2 top, Vector2 forward, Vector2 backward, Vector2 right, Vector2 left, Vector2 bottom, BlockModel modelIn, bool solidIn, bool transparentIn, bool aimSolidIn, BlockTypes typeIn) { UvMapTop = top / 16f; UvMapForward = forward / 16f; UvMapBackward = backward / 16f; UvMapLeft = left / 16f; UvMapRight = right / 16f; UvMapBottom = bottom / 16f; Model = modelIn; Transparent = transparentIn; Solid = solidIn; AimSolid = aimSolidIn; Type = typeIn; }
protected BlockModel GetBlock(string name) { var ctBlock = ContentType.Block.ToString(); var content = _ctx.DContents.FirstOrDefault(c => c.TypeId == ctBlock && c.Name == name); var block = new BlockModel(); if (content != null) { block.Name = content.Name; block.Title = content.Title; block.Content = content.Content; } return(block); }
public BaseBlock(Vector2 uvMapIn, BlockModel modelIn, bool solidIn, bool transparentIn, bool aimSolidIn, BlockTypes typeIn) { UvMapTop = uvMapIn / 16f; UvMapForward = uvMapIn / 16f; UvMapBackward = uvMapIn / 16f; UvMapLeft = uvMapIn / 16f; UvMapRight = uvMapIn / 16f; UvMapBottom = uvMapIn / 16f; Model = modelIn; Transparent = transparentIn; Solid = solidIn; AimSolid = aimSolidIn; Type = typeIn; }
public RequestResult <BlockModel> SaveBlockUser(string sessionToken, BlockModel model) { string parameters = $"/savecommonfunctionality/saveblockusers?sessionToken={sessionToken}"; try { var serilizedData = JsonConvert.SerializeObject(model); return(PostAndGetData <RequestResult <BlockModel> >(sessionToken, parameters, serilizedData)); } catch (Exception ex) { throw ex; } }
public List <BlockModel> Generate(int len) { if (len == 0) { return(new List <BlockModel>()); } Grid <BlockModel> grid = new Grid <BlockModel>(); List <BlockModel> ret = new List <BlockModel>(); HexDirection dir1 = (HexDirection)Random.Range(0, 6); HexDirection dir2 = (HexDirection)Random.Range(0, 6); while (dir2 == dir1) { dir2 = (HexDirection)Random.Range(0, 6); } int x = 0; int z = 0; int nx, nz; BlockModel cur = new BlockModel(x, z, dir1, dir2); grid.Add(x, z, cur); MoveNextPos(x, z, dir1, out nx, out nz); grid.Add(nx, nz, cur); // to avoid edge case ret.Add(cur); MoveNextPos(x, z, dir2, out nx, out nz); for (int i = 1; i < len; i++) { x = nx; z = nz; dir1 = dir2.Opposite(); int nbTryLeft = 25; do { dir2 = dir1; while (dir1 == dir2) { dir2 = (HexDirection)Random.Range(0, 6); } MoveNextPos(x, z, dir2, out nx, out nz); }while(grid.Exist(nx, nz) && --nbTryLeft > 0); if (nbTryLeft == 0) { return(null); } cur = new BlockModel(x, z, dir1, dir2); grid.Add(x, z, cur); ret.Add(cur); } return(ret); }
public object GetBlock(string blockHash, int verbosity = 1) { var blockId = uint256.Parse(blockHash); // Does the block exist. var chainedHeader = this.ChainIndexer.GetHeader(blockId); if (chainedHeader == null) { return(null); } var block = chainedHeader.Block ?? this.blockStore?.GetBlock(blockId); // In rare occasions a block that is found in the // indexer may not have been pushed to the store yet. if (block == null) { return(null); } if (verbosity == 0) { return(new HexModel(block.ToHex(this.Network))); } var blockModel = new BlockModel(block, chainedHeader, this.ChainIndexer.Tip, this.Network, verbosity); if (this.Network.Consensus.IsProofOfStake) { var posBlock = block as PosBlock; blockModel.PosBlockSignature = posBlock.BlockSignature.ToHex(this.Network); blockModel.PosBlockTrust = new Target(chainedHeader.GetBlockProof()).ToUInt256().ToString(); blockModel.PosChainTrust = chainedHeader.ChainWork.ToString(); // this should be similar to ChainWork if (this.stakeChain != null) { var blockStake = this.stakeChain.Get(blockId); blockModel.PosModifierv2 = blockStake?.StakeModifierV2.ToString(); blockModel.PosFlags = blockStake?.Flags == BlockFlag.BLOCK_PROOF_OF_STAKE ? "proof-of-stake" : "proof-of-work"; blockModel.PosHashProof = blockStake?.HashProof.ToString(); } } return(blockModel); }
public override void CustomBuild(BlockModel.ModelData data, Vector3 start) { Mesh mesh = null; Tile tile = Chunk.GetTile((int)start.x, (int)start.y, (int)start.z); if (tile.mesh == null) { GameObject obj = new GameObject(); MeshFilter filter = obj.AddComponent<MeshFilter>(); TileModel model = obj.AddComponent<TileModel>(); model.textureOffset = new Vector2(tile.texturePos.x * Tile.PIXEL_WIDTH, (3 - tile.texturePos.y) * Tile.PIXEL_HEIGHT); model.textureSize = new Vector2(Tile.PIXEL_WIDTH, Tile.PIXEL_HEIGHT); model.texture = (Texture2D)World.Current.tileAtlas.mainTexture; model.BuildMesh(); mesh = tile.mesh = filter.sharedMesh; DestroyImmediate(model); DestroyImmediate(filter); DestroyImmediate(obj); Debug.Log("Tile Mesh built for " + tile.Info); } else { mesh = tile.mesh; } int startIndex = data.verts.Count; Vector3 offset = new Vector3((start.x+3)*Tile.TILE_WIDTH,(start.y+2)*Tile.TILE_HEIGHT,start.z*Tile.TILE_DEPTH); foreach (Vector2 v in mesh.uv) { data.uv.Add(v); } foreach (int v in mesh.triangles) { data.tris.Add(v + startIndex); } foreach (Vector3 v in mesh.vertices) { data.verts.Add(v + offset); } }
//Song currentsong; public MusicBlock(Vector2 top, Vector2 forward, Vector2 backward, Vector2 right, Vector2 left, Vector2 bottom, BlockModel modelIn, bool solidIn, bool transparentIn, bool aimSolidIn, BlockTypes typeIn,ContentManager content) : base(top,forward,backward,right,left,bottom,modelIn,solidIn,transparentIn,aimSolidIn,typeIn) { //currentsong = content.Load<Song>("testsong"); }
public List<string> PerformBMImport(ModelImportStatus mos, Guid blockModelGUID, System.IO.Stream bmFileStream, System.IO.Stream ffFileStream, ImportDataMap importMap, double xOrigin, double yOrigin, double zOrigin, System.ComponentModel.BackgroundWorker worker, int approxNumLines, string NKDProjectID, string alias, Guid authorGuid, string connString) { this.currentWorker = worker; using (var entityObj = new NKDC(connString, null)) { // talk to the import lib to do the import DateTime startTime = DateTime.Now; int batchSize = 1000; //UpdateStatus("Creating new NKD block model", 20.0); ImportUtils.BlockImport dbIm = null; try { dbIm = new ImportUtils.BlockImport(); //ImportDataMap importMapLoaded = FormatSpecificationIO.ImportMapIO.LoadImportMap(ffFileStream); BlockModel xAdd = new BlockModel(); xAdd.OriginX = (Decimal)xOrigin; // TO-DO xAdd.OriginY = (Decimal)yOrigin; // TO-DO xAdd.OriginZ = (Decimal)zOrigin; // TO-DO xAdd.Alias = alias; // when on server, automatically pick up the author GUID and apply it to the model. if (currentWorker == null) { xAdd.AuthorContactID = authorGuid; xAdd.ResponsibleContactID = authorGuid; } xAdd.VersionUpdated = DateTime.UtcNow; xAdd.BlockModelID = blockModelGUID; xAdd.ProjectID = new Guid(NKDProjectID); // TODO - allow user to pick size entityObj.BlockModels.AddObject(xAdd); entityObj.SaveChanges(); UpdateStatus("Setting model meta data", 25.0); // add the meta data to identify all of the oclumns etc. } catch (Exception ex) { mos.AddErrorMessage("Error setting block model defintion data. " + ex.ToString()); } List<string> domains = new List<string>(); if (dbIm != null) { try { List<BlockModelMetadata> blockColumnMetaData = dbIm.SetBlockModelMetaData(blockModelGUID, importMap, connString); } catch (Exception ex) { mos.AddErrorMessage("Error setting block model meta data:\n" + ex.ToString()); } try { // add the new BM guid to the column map as a default so that it is always entered importMap.columnMap.Add(new ColumnMap("", -1, "BlockModelBlock", "BlockModelID", ImportDataMap.TEXTDATATYPE, blockModelGUID.ToString(), blockModelGUID.ToString(), ImportDataMap.UNIT_NONE)); // add the individual blocks domains = dbIm.AddBlockData(mos, bmFileStream, importMap, blockModelGUID, batchSize, UpdateStatus, approxNumLines, connString); // run this only if in wonows client (determined by the status of the worker thread at this stage) if (currentWorker != null) { List<Tuple<string, string>> doms = new List<Tuple<string, string>>(); string domainColumnName = "Domain"; foreach (string ss in domains) { doms.Add(new Tuple<string, string>(domainColumnName, ss)); } dbIm.UpdateDomains(doms, blockModelGUID); } } catch (Exception ex) { mos.AddErrorMessage("Error adding block data:\n" + ex.ToString()); } } return domains; } }
/// <summary> /// /// </summary> /// <param name="bmDataFile"></param> /// <param name="selectedFormatBMFile"></param> /// <param name="importMap"></param> /// <param name="xOrigin"></param> /// <param name="yOrigin"></param> /// <param name="zOrigin"></param> /// <param name="worker"></param> /// <param name="approxNumLines"></param> /// <param name="NKDProjectID"></param> /// <param name="units"></param> /// <param name="connString"></param> /// <returns></returns> public string PerformBMImport(string bmDataFile, string selectedFormatBMFile, ImportDataMap importMap, double xOrigin, double yOrigin, double zOrigin, System.ComponentModel.BackgroundWorker worker, int approxNumLines, string NKDProjectID, string units, string connString) { this.currentWorker = worker; UpdateStatus("Connecting to NKD", 10.0); using (var entityObj = new NKDC(connString, null)) { // talk to the import lib to do the import var query = from BlockModel in entityObj.BlockModels select new { BlockModel.BlockModelID, BlockModel.OriginX, BlockModel.OriginY, BlockModel.OriginZ, BlockModel.ProjectID }; List<string> cn = new List<string>(); //For each field in the database (or property in Linq object) BlockModel ob = new BlockModel(); foreach (PropertyInfo pi in ob.GetType().GetProperties()) { Type ty = pi.GetType(); String name = pi.Name; cn.Add(name); } DateTime startTime = DateTime.Now; int batchSize = 100; UpdateStatus("Creating new NKD block model", 20.0); ImportUtils.BlockImport dbIm = new ImportUtils.BlockImport(); Guid blockModelGUID = Guid.NewGuid(); BlockModel xAdd = new BlockModel(); xAdd.OriginX = (Decimal)xOrigin; // TO-DO xAdd.OriginY = (Decimal)yOrigin; // TO-DO xAdd.OriginZ = (Decimal)zOrigin; // TO-DO xAdd.BlockModelID = blockModelGUID; xAdd.ProjectID = new Guid(NKDProjectID); // TODO - allow user to pick size entityObj.BlockModels.AddObject(xAdd); entityObj.SaveChanges(); UpdateStatus("Setting model meta data", 25.0); // add the meta data to identify all of the oclumns etc. List<BlockModelMetadata> blockColumnMetaData = dbIm.SetBlockModelMetaData(blockModelGUID, importMap, connString); // add the new BM guid to the column map as a default so that it is always entered importMap.columnMap.Add(new ColumnMap("", -1, "BlockModelBlock", "BlockModelID", ImportDataMap.TEXTDATATYPE, blockModelGUID.ToString(), null, units)); // add the individual blocks dbIm.AddBlockData(bmDataFile, importMap, blockModelGUID, batchSize, UpdateStatus, approxNumLines, connString); //dbIm.AddBlockDataNorm(bmDataFile, importMap, blockModelGUID, batchSize, UpdateStatus, approxNumLines, blockColumnMetaData); DateTime endTime = DateTime.Now; long compVal = (endTime.Ticks - startTime.Ticks) / 1000; string message = "" + startTime.ToShortTimeString() + " Ended: " + endTime.ToShortTimeString(); long xval = compVal; return ""; } }
private void CreateCubeVertices(int x, int y, int z, BlockModel model) { bool left; bool right; bool up; bool down; bool forward; bool backward; BaseBlock currentblock = BlockMap[x, y, z]; //Get current block if (currentblock.Transparent) //Set boolean values if each face is visible or not - if it's transparent then it doesn't draw faces adjacent to blocks of the same type { up = (BlockMap[x, IntClamp(y + 1, 0, Height - 1), z] != currentblock && (y + 1) == IntClamp(y + 1, 0, Height - 1)); forward = (BlockMap[x, y, IntClamp(z + 1, 0, Size - 1)] != currentblock && (z + 1) == IntClamp(z + 1, 0, Size - 1)); left = (BlockMap[IntClamp(x - 1, 0, Size - 1), y, z] != currentblock && (x - 1) == IntClamp(x - 1, 0, Size - 1)); right = (BlockMap[IntClamp(x + 1, 0, Size - 1), y, z] != currentblock && (x + 1) == IntClamp(x + 1, 0, Size - 1)); backward = (BlockMap[x, y, IntClamp(z - 1, 0, Size - 1)] != currentblock && (z - 1) == IntClamp(z - 1, 0, Size - 1)); down = (BlockMap[x, IntClamp(y - 1, 0, Height - 1), z] != currentblock && (y - 1) == IntClamp(y - 1, 0, Height - 1)); } else //Set boolean values if each face is visible or not { up = (BlockMap[x, IntClamp(y + 1, 0, Height - 1), z].Transparent && (y + 1) == IntClamp(y + 1, 0, Height - 1)); forward = (BlockMap[x, y, IntClamp(z + 1, 0, Size - 1)].Transparent && (z + 1) == IntClamp(z + 1, 0, Size - 1)); left = (BlockMap[IntClamp(x - 1, 0, Size - 1), y, z].Transparent && (x - 1) == IntClamp(x - 1, 0, Size - 1)); right = (BlockMap[IntClamp(x + 1, 0, Size - 1), y, z].Transparent && (x + 1) == IntClamp(x + 1, 0, Size - 1)); backward = (BlockMap[x, y, IntClamp(z - 1, 0, Size - 1)].Transparent && (z - 1) == IntClamp(z - 1, 0, Size - 1)); down = (BlockMap[x, IntClamp(y - 1, 0, Height - 1), z].Transparent && (y - 1) == IntClamp(y - 1, 0, Height - 1)); } up = true; forward = true; left = true; right = true; backward = true; down = true; if (model == BlockModel.Cube) { if (up) //Fill the vertex list with VertexFormats, which take 3 floats as a position, a vector3 as a normal, and a vector2 as UV mapping for textures { LVertices.Add(new VertexFormat(x, (y + 1), z, new Vector3(0, 1, 0), currentblock.UvMapTop)); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); } if (forward) { LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward)); LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(0f, 1f / 16f))); } if (left) { LVertices.Add(new VertexFormat(x, (y + 1), z, new Vector3(-1, 0, 0), currentblock.UvMapLeft)); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(0f, 1f / 16f))); } if (right) { LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), new Vector3(1, 0, 0), currentblock.UvMapRight)); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(0f, 1f / 16f))); } if (backward) { LVertices.Add(new VertexFormat((x + 1), (y + 1), z, new Vector3(0, 0, -1), currentblock.UvMapBackward)); LVertices.Add(new VertexFormat(x, (y + 1), z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 1), z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(0f, 1f / 16f))); } if (down) { LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(0, -1, 0), currentblock.UvMapBottom)); LVertices.Add(new VertexFormat(x, y, z, new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(0f, 1f / 16f))); } } else if (model == BlockModel.Cross) { LVertices.Add(new VertexFormat(x, (y + 1), z, Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop)); LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, z, Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, z, Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), (z + 1), Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop)); LVertices.Add(new VertexFormat(x, (y + 1), z, Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 1), z, Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, z, Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop)); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, z, Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, z, Vector3.Normalize(new Vector3(1, 0, 1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 1), (z + 1), Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop)); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 1), z, Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, z, Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, (z + 1), Vector3.Normalize(new Vector3(-1, 0, -1)), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); } if (model == BlockModel.Slab) { if (up) //Fill the vertex list with VertexFormats, which take 3 floats as a position, a vector3 as a normal, and a vector2 as UV mapping for textures { LVertices.Add(new VertexFormat(x, (y + 0.2f), z, new Vector3(0, 1, 0), currentblock.UvMapTop)); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), z, new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, (y + 0.2f), (z + 1), new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), z, new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), (z + 1), new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 0.2f), (z + 1), new Vector3(0, 1, 0), currentblock.UvMapTop + new Vector2(0f, 1f / 16f))); } if (forward) { LVertices.Add(new VertexFormat(x, (y + 0.2f), (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward)); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(0, 0, 1), currentblock.UvMapForward + new Vector2(0f, 1f / 16f))); } if (left) { LVertices.Add(new VertexFormat(x, (y + 0.2f), z, new Vector3(-1, 0, 0), currentblock.UvMapLeft)); LVertices.Add(new VertexFormat(x, (y + 0.2f), (z + 1), new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 0.2f), (z + 1), new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(-1, 0, 0), currentblock.UvMapLeft + new Vector2(0f, 1f / 16f))); } if (right) { LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), (z + 1), new Vector3(1, 0, 0), currentblock.UvMapRight)); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), z, new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), z, new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(1, 0, 0), currentblock.UvMapRight + new Vector2(0f, 1f / 16f))); } if (backward) { LVertices.Add(new VertexFormat((x + 1), (y + 0.2f), z, new Vector3(0, 0, -1), currentblock.UvMapBackward)); LVertices.Add(new VertexFormat(x, (y + 0.2f), z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, (y + 0.2f), z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, z, new Vector3(0, 0, -1), currentblock.UvMapBackward + new Vector2(0f, 1f / 16f))); } if (down) { LVertices.Add(new VertexFormat(x + 1, y, z, new Vector3(0, -1, 0), currentblock.UvMapBottom)); LVertices.Add(new VertexFormat(x, y, z, new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x + 1, y, (z + 1), new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(0f, 1f / 16f))); LVertices.Add(new VertexFormat(x, y, z, new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(1f / 16f, 0f))); LVertices.Add(new VertexFormat(x, y, (z + 1), new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(1f / 16f, 1f / 16f))); LVertices.Add(new VertexFormat((x + 1), y, (z + 1), new Vector3(0, -1, 0), currentblock.UvMapBottom + new Vector2(0f, 1f / 16f))); } } }