Exemplo n.º 1
0
 public WallBeam(Point ubicationPoint)
 {
     this.gridRepository      = new GridRepository();
     this.priceAndCostHandler = new PriceAndCostHandler(gridRepository);
     this.UbicationPoint      = ubicationPoint;
     this.wallBeamBrush       = new SolidBrush(Color.Red);
 }
    /// <summary>
    /// Grabs a new collision detection sample based on the entity's current coordinates, and updates the obstacle sample accordingly.
    /// </summary>
    private void UpdateCollisionInformation()
    {
        GridRepository gridRepository = GridRepository.Instance;

        detectionSample = gridRepository.GetUnboundedGridSample(coordinates.x - 1, coordinates.y - 1, 3, 3);
        UpdateObstacleSample();
    }
Exemplo n.º 3
0
    /// <summary>
    /// Use the editor-viewable variables provided for this manager to configure the GridRepository singleton and load the map data.
    /// </summary>
    private void LoadMap()
    {
        GridRepository gridRepository = GridRepository.Instance;

        gridRepository.SetGridParameters(mapWidth, mapHeight, mapCornerX, mapCornerY);
        gridRepository.CreateGridFromMap(mapFileDirectory, mapFileName);
    }
Exemplo n.º 4
0
 public GridController(ILogger <GridController> logger, GridContext context, IWebHostEnvironment webHostEnvironment)
 {
     _logger             = logger;
     _context            = context;
     _webHostEnvironment = webHostEnvironment;
     _gridRepository     = new GridRepository(_logger, _context, webHostEnvironment);
 }
Exemplo n.º 5
0
 public DecorativeColumn(Point ubicationPoint)
 {
     this.gridRepository      = new GridRepository();
     this.priceAndCostHandler = new PriceAndCostHandler(gridRepository);
     this.UbicationPoint      = ubicationPoint;
     this.wallBeamBrush       = new SolidBrush(Color.Gold);
     this.width = 0.50f;
 }
Exemplo n.º 6
0
        public ConfigurationPrice()
        {
            this.gridRepository = new GridRepository();
            priceAndCostHandler = new PriceAndCostHandler(gridRepository);
            InitializeComponent();

            this.AccessibleName = "Precios";
            this.titleTxt.Text  = "Configuracion de Precios";
        }
    /// <summary>
    /// MONOBEHAVIOUR Start
    /// </summary>
    void Start()
    {
        GridRepository gridRepository = GridRepository.Instance;

        coordinates     = gridRepository.GridCoordinatesFromPosition(transform.position);
        detectionSample = gridRepository.GetUnboundedGridSample(coordinates.x - 1, coordinates.y - 1, 3, 3);
        obstacleSample  = new bool[3, 3];
        UpdateObstacleSample();
    }
Exemplo n.º 8
0
 public NewOpeningForm(GridRepository repository, User user)
 {
     InitializeComponent();
     this._repository            = repository;
     this.priceAndCostHandler    = new PriceAndCostHandler(this._repository);
     this.generatedDoorHandler   = new GeneratedDoorHandler();
     this.generatedWindowHandler = new GeneratedWindowHandler();
     this.user = user;
 }
Exemplo n.º 9
0
        public static bool PlayGrid(GridType type, GridRepository repository)
        {
            //logger.Trace("Downloading grid {0}", type);
            GridBoard grid = repository.GetGridByType(type);

            int awards  = grid.GetCellTypeCount(CellState.Award);
            int unknown = grid.GetCellTypeCount(CellState.Hidden);
            int empty   = grid.GetCellTypeCount(CellState.Empty);
            int items   = grid.GetCellTypeCount(CellState.Item);

            int awardsLeft = 22 - awards;

            double odds     = awardsLeft / (double)unknown;
            double itemOdds = (8 - items) / (double)unknown;

            if (lastUnknown != unknown)
            {
                logger.Info("{0} shows {1} awards, {2} empty, {3} unknown, {4} items, {5:0.00000%} item odds, {6:0.00000%} odds", type, awards, empty, unknown, items, itemOdds, odds);
                lastUnknown = unknown;
            }

            //if (odds >= .315)
            //{
            //    Cell cell = grid.GetFirstHiddenCell();

            //    logger.Trace("Buying ticket {0}", cell.TicketId);
            //    grid = repository.PurchaseGridTicket(grid, cell.TicketId);

            //    Cell newCell = grid.GetCellByTicketId(cell.TicketId);
            //    if (newCell.State == CellState.Award)
            //    {
            //        wins++;
            //        logger.Info("Ticket {0} won!", cell.TicketId);
            //    } else if (newCell.State == CellState.Empty)
            //    {
            //        losses++;
            //        logger.Info("Ticket {0} was empty.", cell.TicketId);
            //    } else
            //    {
            //        logger.Warn("Cell state for ticket {0} did not change on purchase", cell.TicketId);
            //    }
            //    rolls++;

            //    double winOdds = wins / (double)(wins + losses);
            //    logger.Info("{1} wins, {2} losses, {3} rolls, winning percentage {4:0.00%}", type, wins, losses, rolls, winOdds);

            //    return true;
            //} else
            //{
            //    logger.Info("Skipping because of bad odds");
            //}

            return(false);
        }
Exemplo n.º 10
0
 public Door(Point startPoint, Point endPoint, string sense, float width, float high, string name)
 {
     this.gridRepository      = new GridRepository();
     this.priceAndCostHandler = new PriceAndCostHandler(gridRepository);
     this.Width      = width;
     this.Height     = high;
     this.Name       = name;
     this.sense      = sense;
     this.direction  = 0;
     this.StartPoint = startPoint;
     this.EndPoint   = endPoint;
 }
Exemplo n.º 11
0
        public Wall(Point startPoint, Point endPoint)
        {
            this.gridRepository      = new GridRepository();
            this.priceAndCostHandler = new PriceAndCostHandler(gridRepository);
            SetRightSense(startPoint, endPoint);
            this.Path    = new List <Point>();
            this.wallPen = new Pen(Color.LightGreen, 4);
            this.createPath();


            this.PriceAndCost = priceAndCostHandler.GetPriceAndCostWall();
        }
Exemplo n.º 12
0
 public Window(Point startPoint, Point endPoint, string sense, float width, float high, float distanceFromGround, string name)
 {
     this.distanceFromGround  = distanceFromGround;
     this.gridRepository      = new GridRepository();
     this.priceAndCostHandler = new PriceAndCostHandler(gridRepository);
     this.blueBrush           = new SolidBrush(Color.Blue);
     this.width      = width;
     this.high       = high;
     this.name       = name;
     this.sense      = sense;
     this.StartPoint = startPoint;
     this.EndPoint   = endPoint;
 }
    /// <summary>
    /// Updates the coordinates of the entity, also updating collision detection information if necessary.
    /// </summary>
    private void UpdateCoordinates()
    {
        GridRepository gridRepository = GridRepository.Instance;

        Vector3        position            = transform.position;
        CoordinatePair adjustedCoordinates = gridRepository.GridCoordinatesFromPosition(position);

        if (!coordinates.Equals(adjustedCoordinates))
        {
            coordinates = adjustedCoordinates;
            UpdateCollisionInformation();
        }
    }
Exemplo n.º 14
0
        public override void Draw(Graphics graphic)
        {
            if (gridRepository == null)
            {
                gridRepository = new GridRepository();
            }
            Door  door       = this.gridRepository.GetDoor(this);
            float angle      = this.startAngle(StartPoint, EndPoint);
            Point fixedPoint = fixDoorPoint(StartPoint);

            graphic.FillPie(blueBrush, fixedPoint.X, fixedPoint.Y,
                            Width * MINIMUM_WIDTH_IN_PIXELS / MINIMUM_WIDTH,
                            Width * MINIMUM_WIDTH_IN_PIXELS / MINIMUM_WIDTH,
                            angle, 90f);
        }
Exemplo n.º 15
0
        public Grid(string gridName, Client client, int height, int width)
        {
            this.isDeleted         = false;
            this.gridRepository    = new GridRepository();
            this.Walls             = new List <Wall>();
            this.WallBeams         = new List <WallBeam>();
            this.DecorativeColumns = new List <DecorativeColumn>();
            this.Windows           = new List <Window>();
            this.Doors             = new List <Door>();

            this.GridName = gridName;
            this.Client   = client;
            this.Height   = height * PixelConvertor;
            this.Width    = width * PixelConvertor;
            this.PRICE_AND_COST_HANDLER   = new PriceAndCostHandler(gridRepository);
            this.GRID_HANDLER             = new GridHandler();
            this.WALLBEAM_HANDLER         = new WallBeamHandler(gridRepository);
            this.WALL_HANDLER             = new WallHandler(gridRepository);
            this.WINDOW_HANDLER           = new WindowHandler(gridRepository);
            this.DECORATIVECOLUMN_HANDLER = new DecorativeColumnHandler(gridRepository);
            this.DOOR_HANDLER             = new DoorHandler(gridRepository);
        }
Exemplo n.º 16
0
    /// <summary>
    /// MONOBEHAVIOUR Start
    /// </summary>
    void Start()
    {
        //Get the reference to the used prefab repository and initialize it
        PrefabRepository prefabRepository = GetComponent <PrefabRepository>();

        prefabRepository.InitializeDictionaries();

        //Setup the grid and load the map
        GridRepository gridRepository = GridRepository.Instance;

        gridRepository.LinkPrefabRepository(prefabRepository);
        LoadMap();

        //<TEMPORARY> Spawn a test player
        GameObject playerPrefab = prefabRepository.PrefabOfPlayer();
        GameObject player       = GameObject.Instantiate(playerPrefab, new Vector3(1.5f, 1.5f, 0), Quaternion.identity) as GameObject;

        player.GetComponent <PlayerActionController>().LinkPrefabRepository(prefabRepository);

        //<TEMPORARY> Spawn a test player
        GameObject bystanderPrefab = prefabRepository.PrefabOfBystander();
        GameObject bystander       = GameObject.Instantiate(bystanderPrefab, new Vector3(1.5f, 2.5f, 0), Quaternion.identity) as GameObject;
    }
Exemplo n.º 17
0
        public static void PlayGrids()
        {
            EvealopalousClient client     = new EvealopalousClient(username, password);
            GridRepository     repository = new GridRepository(client);

            client.Timeout = 4000; // 4 seconds bro

            while (true)
            {
                bool success = false;
                try
                {
                    success = PlayGrid(GridType.TheSlums, repository);
                } catch (TimeoutException ex)
                {
                    logger.ErrorException(ex.Message, ex);
                } catch (WebException ex)
                {
                    logger.ErrorException(ex.Message, ex);
                }

                Thread.Sleep(2000);
            }
        }
Exemplo n.º 18
0
 public WallHandler(GridRepository gridRepository)
 {
     this.gridHandler              = new GridHandler();
     this.wallRepository           = new WallRepository(gridRepository);
     this.DECORATIVECOLUMN_HANDLER = new DecorativeColumnHandler(gridRepository);
 }
Exemplo n.º 19
0
 public WallBeamHandler(GridRepository gridRepository)
 {
     this.gridHandler        = new GridHandler();
     this.wallBeamRepository = new WallBeamRepository(gridRepository);
 }
Exemplo n.º 20
0
 public Grid()
 {
     this.isDeleted              = false;
     this.gridRepository         = new GridRepository();
     this.PRICE_AND_COST_HANDLER = new PriceAndCostHandler(gridRepository);
 }
 public GridBusiness(GridRepository repos) : base(repos)
 {
     this.repos = repos;
 }
Exemplo n.º 22
0
 public DoorHandler(GridRepository gridRepository)
 {
     this.gridHandler    = new GridHandler();
     this.doorRepository = new DoorRepository(gridRepository);
 }
 public GridManagerHandler(GridRepository gridRepository)
 {
     _gridRepository = gridRepository;
     _rand           = new Random();
 }
Exemplo n.º 24
0
 public void LinkReferences(GridRepository gridRepo)
 {
     //_gridRepository = gridRepo;
 }
Exemplo n.º 25
0
 public GridManagerController(GridRepository gridRepository)
 {
     _gridManagerHandler = new GridManagerHandler(gridRepository);
 }
Exemplo n.º 26
0
 public DecorativeColumnHandler(GridRepository gridRepository)
 {
     //this.wallHandler = new WallHandler(gridRepository);
     this.wallRepository             = new WallRepository(gridRepository);
     this.decorativeColumnRepository = new DecorativeColumnRepository(gridRepository);
 }
Exemplo n.º 27
0
 public ControlPanelController(CompanyRepository companyRepository, GridRepository gridRepository)
 {
     //TODO: Add delete routes with id for copany configuration and grid parameters
     _companyHandler = new ControlPanelCompanyHandler(companyRepository);
     _gridHandler    = new ControlPanelGridHandler(gridRepository);
 }
Exemplo n.º 28
0
 public GridController(GridRepository gr, ILogger <GridController> logger)
 {
     _gr     = gr;
     _logger = logger;
 }
Exemplo n.º 29
0
        public async Task Invoke(HttpContext context, CompanyRepository companyRepository, GridRepository gridRepository)
        {
            var userId = (string)context.Items[Text.UserId];

            try
            {
                await attachConfigurationToContext <CompanyModel>(context, Text.Company, companyRepository, userId);
                await attachConfigurationToContext <GridModel>(context, Text.Grid, gridRepository, userId);
            }
            catch (Exception e)
            {
                context.Response.StatusCode = StatusCodes.Status401Unauthorized;
                await context.Response.WriteAsync(Text.Exception(e));

                return;
            }
            await _next(context);
        }
Exemplo n.º 30
0
 public WindowHandler(GridRepository gridRepository)
 {
     this.gridHandler      = new GridHandler();
     this.windowRepository = new WindowRepository(gridRepository);
 }