Esempio n. 1
0
    public void CreateStructureBlockButton(StructureBlockData block)
    {
        PlaceableBlockPrefab.cost   = block.cost;
        PlaceableBlockPrefab.name   = block.name;
        PlaceableBlockPrefab.sprite = block.sprite;
        BlockCreate structureBlock = Instantiate(PlaceableBlockPrefab, StructureBlockPanel.transform);

        placeableItemButtons.Add(structureBlock);
    }
Esempio n. 2
0
    public void CreateTurretButton(TurretData turret)
    {
        PlaceableBlockPrefab.cost   = turret.cost;
        PlaceableBlockPrefab.name   = turret.name;
        PlaceableBlockPrefab.sprite = turret.sprite;
        BlockCreate create = Instantiate(PlaceableBlockPrefab, TurretPanel.transform);

        create.transform.position = create.transform.position;
        placeableItemButtons.Add(create);
    }
Esempio n. 3
0
        public bool CheckIfExitLocationIsValid(BlockCreate model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = ctx.Maps.Single(m => m.ID == model.MapID);

                bool locationValid   = CheckIfExitIsAtEdgeOfMap(model.PosX, model.PosY, entity.SizeX, entity.SizeY);
                bool directionValid  = CheckIfDirectionIsValid(model.PosX, model.PosY, model.ExitDirection, entity.SizeX, entity.SizeY);
                bool spotNotOccupied = CheckForExistingExits(model.ID, model.PosX, model.PosY, model.ExitDirection, entity);

                return(locationValid && directionValid && spotNotOccupied);
            }
        }
Esempio n. 4
0
        public async Task <BlockCreateResult> BlockCreateSendAsync(string wallet, RaiAddress account, RaiAddress destination, RaiUnits.RaiRaw balance, RaiUnits.RaiRaw amount, string previous)
        {
            var action = new BlockCreate {
                Type          = BlockType.send,
                Wallet        = wallet,
                AccountNumber = account,
                Destination   = destination,
                Balance       = balance,
                Amount        = amount,
                Previous      = previous
            };
            var handler = new ActionHandler <BlockCreate, BlockCreateResult>(_node);

            return(await handler.Handle(action));
        }
Esempio n. 5
0
    public void CreateStructureBlockButtons(List <StructureBlockData> sblocks)
    {
        foreach (Transform child in StructureBlockPanel.transform)
        {
            Destroy(child.gameObject);
        }

        foreach (StructureBlockData sb in sblocks)
        {
            PlaceableBlockPrefab.cost   = sb.cost;
            PlaceableBlockPrefab.name   = sb.name;
            PlaceableBlockPrefab.sprite = sb.sprite;
            BlockCreate structureBlock = Instantiate(PlaceableBlockPrefab, StructureBlockPanel.transform);
            placeableItemButtons.Add(structureBlock);
        }
    }
Esempio n. 6
0
    public void CreateTurretButtons(List <TurretData> turrets)
    {
        foreach (Transform child in TurretPanel.transform)
        {
            Destroy(child.gameObject);
        }

        foreach (TurretData t in turrets)
        {
            PlaceableBlockPrefab.cost   = t.cost;
            PlaceableBlockPrefab.name   = t.name;
            PlaceableBlockPrefab.sprite = t.sprite;
            BlockCreate turret = Instantiate(PlaceableBlockPrefab, TurretPanel.transform);
            turret.transform.position = turret.transform.position;
            placeableItemButtons.Add(turret);
        }
    }
Esempio n. 7
0
        private bool ExitValidation(BlockCreate model)
        {
            bool idValid       = true;
            bool locationValid = true;

            if (!_bvSvc.Value.CheckIfExitLocationIsValid(model))
            {
                ModelState.AddModelError("", "Exit blocks must be positioned at the edge of the map and face a wall that does not already contain an exit.");
                idValid = false;
            }
            if (!_bvSvc.Value.CheckIfExitIdIsValid(model.ExitToID, model.MapID))
            {
                var mapSvc = CreateMapService();
                ModelState.AddModelError("", "Please enter an ExitToID that matches an existing map other than the current one.");
                ModelState.AddModelError("", $"Available Map IDs to exit to: | {mapSvc.GetExitMapIDAvailabilityExcludingCurrentID(model.MapID)}");
                locationValid = false;
            }
            return(idValid && locationValid);
        }
Esempio n. 8
0
 public async Task <BlockCreateResult> BlockCreateSendAsync(BlockCreate createBlockAction)
 => await Handle <BlockCreate, BlockCreateResult>(createBlockAction);