예제 #1
0
        public void CreateCityManagerAndPopulateWithCitiesTest()
        {
            // Cities we want managed
            City.City city1 = new City.City(500000);
            City.City city2 = new City.City(2500000);
            City.City city3 = new City.City(40000);

            Assert.IsNotNull(city1);
            Assert.IsNotNull(city2);
            Assert.IsNotNull(city3);

            // Add them to city manager
            CityManager cityManager = new CityManager();

            // List of cities should be instantiated when a citymanager is created
            Assert.IsNotNull(cityManager);
            Assert.IsNotNull(cityManager.Cities);

            cityManager.Add(city1);
            cityManager.Add(city2);
            cityManager.Add(city3);

            Assert.AreEqual(3, cityManager.Cities.Count, "City Manager did not add cities correctly");
            Assert.AreEqual(city1, cityManager.Cities[0], "Incorrect city was added to city manager");
            Assert.AreEqual(city2, cityManager.Cities[1], "Incorrect city was added to city manager");
            Assert.AreEqual(city3, cityManager.Cities[2], "Incorrect city was added to city manager");
        }
예제 #2
0
    public void DeselectEverything()
    {
        hexGrid.DeselectAllCells();
        unitManager.DeselectAllUnits();

        terrainPanel.SetActive(false);
        if (currentSelectedCell != null)
        {
            currentSelectedCell.DeselectCell();
            currentSelectedCell = null;
        }

        if (currentSelectedCity != null)
        {
            currentSelectedCity.DeselectCity();
            currentSelectedCity = null;
        }


        if (currentSelectedUnit != null)
        {
            currentSelectedUnit.DeselectUnit();
            currentSelectedUnit = null;
        }

        civManager.UnselectAllCities();
        hexCamera.UnsetGameObjectToFollow();
    }
예제 #3
0
파일: Orders.cs 프로젝트: fire-eggs/CivOne
        private void CreateCity(int nameId)
        {
            _city = Game.AddCity(_player, nameId, _x, _y);
            if (_city != null)
            {
                if (_player.IsHuman)
                {
                    // TODO fire-eggs not showing may lose side-effects
                    //if (!Game.Animations)
                    {
                        CityView cityView = new CityView(_city, founded: true);
                        cityView.Closed  += CityFounded;
                        cityView.Skipped += CityViewed;
                        Common.AddScreen(cityView);
                        return;
                    }

                    {
                        CityManager cityManager = new CityManager(_city);
                        cityManager.Closed += CityManagerClosed;
                        Common.AddScreen(cityManager);
                        return;
                    }
                }
                if (_unit != null)
                {
                    Game.DisbandUnit(_unit);
                }
            }
            Game.UpdateResources(_city.Tile);
            EndTask();
        }
예제 #4
0
 public void return_to_game()
 {
     CityManager.update_total_people(0);
     PauseManager.pause_game(false);
     GameObject.Find("GameManager").GetComponent <BoxCollider2D>().enabled = true;
     activate_default_handler();
 }
예제 #5
0
 public GoodsInformationList()
 {
     this.cityManager = new CityManager();
     this.statistic   = new Statistic();
     this.totalGoods  = this.statistic.TotalGoods;
     this.totalLorry  = this.statistic.TotalLorry;
 }
예제 #6
0
        private void HandleMouseMove(MoisManager input)
        {
            Ray mouseRay = GetSelectionRay(input.MousePosX, input.MousePosY);

            Mogre.Pair <bool, float> intersection = mouseRay.Intersects(new Plane(Vector3.UNIT_Y, Vector3.ZERO));
            if (intersection.first && selboxShouldUpate())
            {
                Vector3 intersectionPt = mouseRay.Origin + mouseRay.Direction * intersection.second;
                Point   plotCoord      = CityManager.GetPlotCoords(intersectionPt);
                Vector3 plotCenter     = CityManager.GetPlotCenter(plotCoord);
                cursorPlane.SetPosition(plotCenter.x, plotCenter.y + 1f, plotCenter.z);

                if (mouseMode == MouseMode.PlacingBuilding && tempBuilding != null)
                {
                    tempBuilding.SetPosition(plotCoord.X, plotCoord.Y);
                }

                DebugPanel.SetDebugText(CityManager.GetPlotCoords(intersectionPt).ToString());
            }

            if (input.MouseMoveZ != 0.0f)
            {
                dist += input.MouseMoveZ * 0.002f;
                if (dist < -14.0f)
                {
                    dist = -14.0f;
                }
                if (dist > 0.0f)
                {
                    dist = 0.0f;
                }
            }
        }
예제 #7
0
    public bool remove_last_room()
    {
        if (last_room_position_stack.Count == 0)
        {
            return(false);
        }
        Vector2Int room_pos     = (Vector2Int)last_room_position_stack.Pop();
        Room       boarded_room = city.city_room_matrix[room_pos.x, room_pos.y];

        city.city_room_matrix[room_pos.x, room_pos.y] = null;
        if (boarded_room.has_person)
        {
            GameObject person_go = boarded_room.person_go_instance;
            Person     person    = person_go.GetComponent <Person>();
            if (person.desired_activity != "")                                                // not in a period of waiting for activity
            {
                PersonManager.add_notification_for_city(person.city.tilemap_position, false); // remove notification
            }
            string review_summary = "I'll go somewhere that can stick to the train schedule.";
            person.leave_review(person.city, Person.Review.One_Star);
            person.update_review_page(review_summary, (int)Person.Review.One_Star);
            DestroyImmediate(person_go); // otherwise get error from coroutine
            CityManager.update_total_people(-1);
        }
        else if (boarded_room.booked)// person has not arrived yet, but the room is booked. Don't remove this room.
        {
            return(false);
        }
        DestroyImmediate(boarded_room.inner_door_container);
        DestroyImmediate(boarded_room.outer_door_container);
        roomba[boarded_room.id] = null;
        city.city_tilemap.SetTile((Vector3Int)room_pos, city.boarded_up_tile);
        current_capacity -= 1;
        return(true);
    }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    CityManager obj      = new CityManager();
                    City[]      cityList = obj.GetCities();

                    dpFromCity.Items.Add("None");
                    foreach (City c in cityList)
                    {
                        ListItem item = new ListItem(c.Name, c.CityId.ToString());
                        dpFromCity.Items.Add(item);
                    }
                    dpFromCity.DataBind();

                    dpToCity.Items.Add("None");
                    foreach (City c in cityList)
                    {
                        ListItem item = new ListItem(c.Name, c.CityId.ToString());
                        dpToCity.Items.Add(item);
                    }
                    dpToCity.DataBind();
                }
                catch (CityManagerException ex)
                {
                    lblError.Text = ex.Message;
                }
            }
        }
예제 #9
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }
        bool Updating = false;
        City oCity    = null;

        if (CityID > 0)
        {
            oCity    = CityManager.GetCityByID(CityID);
            Updating = oCity != null;
        }
        if (!Updating)
        {
            oCity = new City();
        }

        oCity.CountryID = this.ddlCountryID.SelectedValue.ToInt();
        oCity.CityName  = this.txtCityName.Text;
        oCity.Status    = this.chkStatus.Checked;
        bool bSuccess = Updating ? CityManager.UpdateCity(oCity) : CityManager.InsertCity(oCity);

        if (bSuccess)
        {
            Redirect("/city-list?s=1");
        }
        else
        {
            base.Warn("error.save");
        }
    }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            CityManager cityManager = new CityManager();

            GridView1.DataSource = cityManager;
            GridView1.DataBind();
        }
예제 #11
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwCities.SelectedItems != null && lvwCities.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            City        objCity;
                            frmCityProp objFrmProp;

                            objCity                       = CityManager.GetItem(Convert.ToInt32(lvwCities.SelectedItems[0].Name));
                            objFrmProp                    = new frmCityProp(objCity, objCurUser);
                            objFrmProp.MdiParent          = this.MdiParent;
                            objFrmProp.Entry_DataChanged += new frmCityProp.CityUpdateHandler(Entry_DataChanged);
                            objFrmProp.Show();
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #12
0
    public void mark_exit_track()
    {
        bool north_exit_visible = CityManager.is_exit_route_shown(RouteManager.Orientation.North);
        bool east_exit_visible  = CityManager.is_exit_route_shown(RouteManager.Orientation.East);
        bool west_exit_visible  = CityManager.is_exit_route_shown(RouteManager.Orientation.West);
        bool south_exit_visible = CityManager.is_exit_route_shown(RouteManager.Orientation.South);
        List <List <int[]> > train_action_coord = new List <List <int[]> >();
        List <string>        train_hint_list    = new List <string>();

        if (north_exit_visible)
        {
            train_hint_list.Add("north exit");
            train_action_coord.Add(TrackManager.exit_track_map[RouteManager.Orientation.North]);
        }
        if (east_exit_visible)
        {
            train_hint_list.Add("east exit");
            train_action_coord.Add(TrackManager.exit_track_map[RouteManager.Orientation.East]);
        }
        if (west_exit_visible)
        {
            train_action_coord.Add(TrackManager.exit_track_map[RouteManager.Orientation.West]);
            train_hint_list.Add("west exit");
        }
        if (south_exit_visible)
        {
            train_action_coord.Add(TrackManager.exit_track_map[RouteManager.Orientation.South]);
            train_hint_list.Add("south exit");
        }
        game_manager.mark_tile_as_eligible(train_action_coord, train_hint_list, gameObject, true);
    }
예제 #13
0
        //Vue complexe utilisant le modèle OrderDetailsViewModel
        //Permet d'afficher le nom du restaurant de la commande, le numéro de la commande, les plats choisis (bug, 1 seul plat est affiché),
        //la quantité par plats, le prix unitaire d'un plat, l'heure de livraison...
        public ActionResult OrderDetails()
        {
            List <OrderDetailsViewModel> listeOrderDetails = new List <OrderDetailsViewModel>();
            OrderDetailsViewModel        orderDetails      = new OrderDetailsViewModel();

            int idCustomer     = HttpContext.Session.GetInt32("IdCustomer").GetValueOrDefault();
            int idOrder        = HttpContext.Session.GetInt32("IdOrder").GetValueOrDefault();
            int idRestaurant   = HttpContext.Session.GetInt32("IdRestaurant").GetValueOrDefault();
            int idDeliveryTime = HttpContext.Session.GetInt32("Id_Delivery_time").GetValueOrDefault();

            OrderManager.UpdateOrderDeliveryTime(idOrder, idDeliveryTime);

            List <DTO.Order_Dish> listeOrder_Dishes = Order_DishManager.GetAllOrder_Dish(idOrder);

            DTO.Customer   customer   = CustomerManager.GetCustomer(idCustomer);
            DTO.Order      order      = OrderManager.GetOrder(idOrder);
            DTO.Restaurant restaurant = RestaurantManager.GetRestaurant(idRestaurant);


            orderDetails.Customers      = customer;
            orderDetails.Orders         = order;
            orderDetails.Restaurants    = restaurant;
            orderDetails.Cities         = CityManager.GetCity(customer.FK_idCity);
            orderDetails.Delivery_Times = Delivery_TimeManager.GetDelivery_Time(idDeliveryTime);

            foreach (DTO.Order_Dish od in listeOrder_Dishes)
            {
                orderDetails.Order_Dishes = od;
                orderDetails.Dishes       = DishManager.GetDish(od.FK_idDish);
            }

            listeOrderDetails.Add(orderDetails);
            return(View(listeOrderDetails));
        }
예제 #14
0
        public ActionResult Edit(int id)
        {
            var model = CustomerManager.Get(id);

            ViewBag.allCities = CityManager.GetAllEntities().OrderBy(c => c.Naziv);
            return(View(model));
        }
예제 #15
0
파일: Enemy.cs 프로젝트: GarethIW/LD33
 public virtual void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     attackSound = GetComponent<AudioSource>();
     enemyRigidBody = GetComponent<Rigidbody>();
     theCity = GameObject.FindGameObjectWithTag("City").GetComponent<CityManager>();
 }
예제 #16
0
 public DepotInfoList()
 {
     this.cityManager = new CityManager();
     this.statistic   = new Statistic();
     this.totalGoods  = this.statistic.TotalGoods;
     this.totalLorry  = this.statistic.TotalLorry;
 }
예제 #17
0
    public static object GetCities(DataTableAjaxPostModel model)
    {
        var cols = new List <string>()
        {
            "LOWER(TRIM(cm.city_name))", "LOWER(TRIM(sm.state_name))", "LOWER(TRIM(cm.doc_count))"
        };
        // Initialization.
        DataTableData <CityModel> result = new DataTableData <CityModel>();

        try
        {
            // Initialization.
            string draw     = model.draw.ToString();
            int    startRec = model.start;
            int    pageSize = model.length;

            var c_order = "";
            foreach (var o in model.order)
            {
                var columnName = cols[o.column];
                c_order += string.IsNullOrWhiteSpace(c_order) ? columnName + " " + o.dir : ", " + columnName + " " + o.dir;
            }
            if (!string.IsNullOrWhiteSpace(c_order))
            {
                c_order = " order by " + c_order;
            }

            var c_search = "";
            foreach (var s in model.columns)
            {
                if (!string.IsNullOrWhiteSpace(s.search.value) && s.searchable)
                {
                    var i          = model.columns.IndexOf(s);
                    var columnName = cols[i];
                    c_search += i == 1 ? " and " + columnName + " like '%" + s.search.value.Trim().ToLower() + "%'" : " and " + columnName + " like '%" + s.search.value + "%'";
                }
            }
            var cities = new CityManager().GetAllCitiesPaginated(startRec, pageSize, c_order, c_search);

            var cityList = cities.Data;
            foreach (var city in cityList)
            {
                city.Link = "<a href='javascript:void(0);' style='margin-right:10px' class='edit-city' data-id='" + city.Id + "'>Edit</a><a href='javascript:void(0);' style='margin-left:10px' class='delete-city' data-id='" + city.Id + "'>Delete</a>";
            }

            int recFilter = cities.Data.Count;

            result.draw            = Convert.ToInt32(draw);
            result.recordsTotal    = cities.TotalCount;
            result.recordsFiltered = cities.TotalCount;
            result.data            = cityList;
        }
        catch (Exception ex)
        {
            // Info
            Console.Write(ex);
        }
        // Return info.
        return(result);
    }
        private void LoadCity()
        {
            List <City> city = CityManager.GetAll();

            CityGridView.DataSource = city;
            CityGridView.DataBind();
        }
예제 #19
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwCities.SelectedItems != null && lvwCities.SelectedItems.Count != 0)
                {
                    if (!IsList)
                    {
                        if (objUIRights.DeleteRight)
                        {
                            DialogResult dr = new DialogResult();
                            dr = MessageBox.Show("Do You Really Want to Delete Record ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                            if (dr == DialogResult.Yes)
                            {
                                City objCity = new City();
                                objCity = CityManager.GetItem(Convert.ToInt32(lvwCities.SelectedItems[0].Name));
                                CityManager.Delete(objCity);
                                lvwCities.Items.Remove(lvwCities.SelectedItems[0]);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void InitializeData()
        {
            DateTime fiveDaysLater = new DateTime();
            DateTime now           = new DateTime();

            now           = fiveDaysLater = DateTime.Now;
            fiveDaysLater = fiveDaysLater.AddDays(5);
            WeatherManager weatherManager = new WeatherManager(new WeatherDataContext());
            CityManager    cityManager    = new CityManager(new WeatherDataContext());
            var            cities         = cityManager.GetObservedCities();
            Dictionary <string, List <ForecastEntity> > entities = new Dictionary <string, List <ForecastEntity> >();

            foreach (var city in cities)
            {
                entities.Add(city.Name, weatherManager.GetForecasts(city, now, fiveDaysLater));
            }
            var labels = new List <string>();

            MinTemperatures = new ChartValues <double>();
            MaxTemperatures = new ChartValues <double>();
            foreach (var entity in entities)
            {
                MinTemperatures.Add(entity.Value.Min(x => x.WeatherMain.TemperatureMin));
                MaxTemperatures.Add(entity.Value.Max(x => x.WeatherMain.TemperatureMax));
                labels.Add(entity.Key);
            }
            Cities = labels.ToArray();
        }
예제 #21
0
        static void Main(string[] args)
        {
            var cityDbManager = new CityManager(Configuration);


            // Méthode qui montre toutes les cities présentes dans la BD
            Console.WriteLine("--GET ALL CITIES--");
            var cities = cityDbManager.GetAllCities();

            foreach (var city in cities)
            {
                Console.WriteLine(city.ToString());
                Console.WriteLine("Tip top");
            }

            /*
             * //Add City
             * Console.WriteLine("--NEW CITY--");
             * var newCity = cityDbManager.AddCity(new City { Name = "Monthey"});
             * Console.WriteLine($"ID : {newCity.IdCity} Name : {newCity.Name}");
             * cities = cityDbManager.GetAllCities();
             * foreach (var city in cities)
             * {
             *  Console.WriteLine($"ID : {city.IdCity} Name : {city.Name}");
             * }
             */
        }
예제 #22
0
    /// <summary>
    /// Calculate bonus points based on cards built on current/left/right cities.
    /// </summary>
    /// <param name="bonusCard">The card giving the bonus.</param>
    /// <param name="leftCity">The left player's city.</param>
    /// <param name="rightCity">The right player's city.</param>
    /// <returns>The amount of points earned.</returns>
    public int CalculateCardBonus(BonusCard bonusCard, CityManager leftCity, CityManager rightCity)
    {
        List <Card> cardsToCheck = new List <Card>();
        int         bonusPoints  = 0;

        if (bonusCard.CheckSelf)
        {
            cardsToCheck.AddRange(this.GetAllBuildings(bonusCard.BonusCardType));
        }
        if (bonusCard.CheckLeft)
        {
            cardsToCheck.AddRange(leftCity.GetAllBuildings(bonusCard.BonusCardType));
        }
        if (bonusCard.CheckRight)
        {
            cardsToCheck.AddRange(rightCity.GetAllBuildings(bonusCard.BonusCardType));
        }

        foreach (Card c in cardsToCheck)
        {
            foreach (Card.CardType bonusType in bonusCard.BonusCardType)
            {
                bonusPoints += GetBonusPoints(bonusType, c, bonusCard);
            }
        }

        return(bonusPoints);
    }
예제 #23
0
    // Start is called before the first frame update
    void Awake()
    {
        //numberPlayers = PlayerPrefs.GetInt("NumberPlayers");
        isThereAI           = PlayerPrefs.GetInt("IAPlayer") > 0;
        turnsToPlay         = PlayerPrefs.GetInt("Turns");
        numberPlayers       = 2;
        players             = new Player[numberPlayers];
        initialPositions    = new Tuple <int, int> [numberPlayers];
        initialPositions[0] = new Tuple <int, int>(0, 0);
        //initialPositions[1] = new Tuple<int, int>(gridCreator.Width - 2, gridCreator.Height - 2);
        //initialPositions[1] = new Tuple<int, int>(gridCreator.Width - 1, gridCreator.Height - 2);
        initialPositions[1] = new Tuple <int, int>(9, 9);
        //initialPositions[1] = new Tuple<int, int>(1, 1);
        gridCreator.CreateGrid();
        for (int i = 0; i < numberPlayers; ++i)
        {
            UnitManager unitManager = Instantiate(Resources.Load("UnitManager", typeof(UnitManager))) as UnitManager;
            unitManager.PlayerID = i;
            CityManager cityManager = Instantiate(Resources.Load("CityManager", typeof(CityManager))) as CityManager;
            cityManager.PlayerID = i;
            TechnologyManager technologyManager = new TechnologyManager();

            players[i] = new Player(unitManager, cityManager, technologyManager);
            players[i].SetGrid(gridCreator.HexGrid);
            players[i].InstantiateInitialUnits(initialPositions[i]);
        }
        //unitManager.InstantiateIntialUnits();
        scoreManager = new ScoreManager(players);
        //scoreEvent.AddListener(scoreManager.OnScoreEvent);
        if (IsThereAI)
        {
            aiPlayer = new AIPlayer(players[1], this, unitStats);
        }
    }
예제 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    //CSPRBUG18.1 - Implementing Custom Collection
                    //Cities - Custom Collection also Sorted with needed Interfaces
                    CityManager obj    = new CityManager();
                    Cities      cities = obj.GetSortedCities();

                    //CSPRBUG18.1 - Iterating through the Custom Collection
                    dpFromCity.Items.Add("None");
                    foreach (City c in cities)
                    {
                        ListItem item = new ListItem(c.Name, c.CityId.ToString());
                        dpFromCity.Items.Add(item);
                    }
                    dpFromCity.DataBind();

                    //CSPRBUG18.1 - Iterating through the Custom Collection
                    dpToCity.Items.Add("None");
                    foreach (City c in cities)
                    {
                        ListItem item = new ListItem(c.Name, c.CityId.ToString());
                        dpToCity.Items.Add(item);
                    }
                    dpToCity.DataBind();
                }
                catch (CityManagerException ex)
                {
                    lblError.Text = ex.Message;
                }
            }
        }
예제 #25
0
        public void GetAll_AllCitiesCanListed()
        {
            ICityService cityService = new CityManager(_mockCityDal.Object);
            List <City>  cities      = cityService.GetAll().Data;

            Assert.AreEqual(3, cities.Count);
        }
예제 #26
0
        private void FillData()
        {
            if (!String.IsNullOrEmpty(queryStringIdStr))
            {
                CityManager _CityManager = new CityManager();
                var         obj          = _CityManager.GetCity(queryStringId);
                if (obj != null)
                {
                    txtCity.Text = obj.Name;

                    if (obj.StateId.HasValue)
                    {
                        ddlState.Items.FindByValue(obj.StateId.Value.ToString()).Selected = true;
                    }

                    Operation = (String)GetGlobalResourceObject("HCMResource", "UpdateExisting");
                }
                else
                {
                    Operation = (String)GetGlobalResourceObject("HCMResource", "AddNew");
                }
            }
            else
            {
                Operation = (String)GetGlobalResourceObject("HCMResource", "AddNew");
            }
        }
예제 #27
0
 private void HandleLeftMouseReleased(MoisManager input)
 {
     if (mouseMode == MouseMode.Selection && CityManager.SelectionIsValid())
     {
         Mogre.Pair <bool, Point> result = getPlotCoordsFromScreenPoint(MousePosition(input));
         if (result.first)
         {
             CityManager.UpdateSelectionBox(result.second);
         }
         UpdateSelectionBox();
         CityManager.MakeSelection();
         CityManager.ClearSelection();
         selectionBox.SetVisible(false);
     }
     if ((canZone() || canUnzone()) && CityManager.ScratchZoneIsValid())
     {
         Mogre.Pair <bool, Point> result = getPlotCoordsFromScreenPoint(MousePosition(input));
         if (result.first)
         {
             CityManager.UpdateScratchZoneBox(result.second);
         }
         UpdateScratchZoneBox();
         CityManager.MakeZone();
         CityManager.ClearScratchZone();
         scratchZone.SetVisible(false);
     }
 }
예제 #28
0
        /// <summary>
        /// Start up the state
        /// </summary>
        /// <param name="_mgr">State manager for this state</param>
        /// <returns></returns>
        public override bool Startup(StateManager _mgr)
        {
            // store reference to the state manager
            StateMgr = _mgr;

            // get reference to the ogre manager
            OgreManager engine = StateMgr.Engine;

            //Instantiate everything
            WeatherMgr = new WeatherManager();
            CityManager.SetGameMgr(this);

            //Initialize everythings
            createScene(engine);
            createUI();
            createCommands();
            //Initialize the City Manager (that's everything right?)
            CityManager.Init(0, 0);

            CompositorManager.Singleton.AddCompositor(engine.Window.GetViewport(0), "Bloom");
            CompositorManager.Singleton.AddCompositor(engine.Window.GetViewport(0), "Radial Blur");

            // OK
            return(true);
        }
예제 #29
0
        /// <summary>
        /// Purpose of this method is to obtain valid
        /// user data for number of cities with associated
        /// population and maximum number of clinics
        /// </summary>
        public void UserInputNumberOfCities()
        {
            // Number of cities
            Console.WriteLine("Enter the number of cities: ");
            string inputNumberOfCities = Console.ReadLine();
            int    numberOfCities;
            bool   isNumberOfCitiesValid = int.TryParse(inputNumberOfCities, out numberOfCities);

            numOfCities = numberOfCities;

            if (isNumberOfCitiesValid)
            {
                // Build each city and map to a population
                CityManager cityManager = BuildPopulationOfCities(numberOfCities);

                // Number of max clinics
                int numberOfClinics = UserInputNumberOfClinics();

                // Now for the heavy lifting
                var maxPopulationPerClinic = DistributeClinicsOverCities(cityManager, numberOfClinics);

                Console.WriteLine("The maximum number of people each immunization clinic can hold is: " + maxPopulationPerClinic);
                Console.WriteLine("Press any key to continue...");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Number of cities must be an integer only!");
            }
        }
예제 #30
0
    private void Start()
    {
        NextTurnModal    = ModalPanelObj.GetComponent <NextTurnModal>();
        PopupText        = PopupPanelObj.GetComponent <PopupText>();
        BuildingManager  = BuildingMangerObj.GetComponent <BuildingManager>();
        CityManager      = CityManagerObj.GetComponent <CityManager>();
        GuiManager       = GuiManagerObj.GetComponent <GuiManager>();
        GameEventManager = GameEventManagerObj.GetComponent <GameEventManager>();
        MissionManager   = MissionManagerObj.GetComponent <MissionManager>();
        GridManager      = GridManagerObj.GetComponent <GridManager>();

        Time   = TimeObject;
        Text   = TextObject;
        Expiry = ExpiryObject;

        TransitionAnimationPanel = _transitionAnimationPanel;
        Camera = _camera;

        foreach (var g in GoodsObjects)
        {
            if (g == null)
            {
                continue;
            }
            var e = (Good)Enum.Parse(typeof(Good), g.name);
            Goods.Add(e, g);
        }
    }
예제 #31
0
        static void Main(string[] args)
        {
            var restaurantsManager = new RestaurantManager(Configuration);

            var restaurants = restaurantsManager.GetRestaurants();

            foreach (var restaurant in restaurants)
            {
                Console.WriteLine(restaurant.ToString());
            }



            var cityManager = new CityManager(Configuration);

            var cities = cityManager.GetCities();

            foreach (var city in cities)
            {
                Console.WriteLine(city.ToString());
            }



            var orderManager = new OrderManager(Configuration);

            var order = orderManager.GetOrder(14);

            double chiffre = (order.ShippingDate.TimeOfDay.TotalMinutes - DateTime.Now.TimeOfDay.TotalMinutes);

            Console.WriteLine(chiffre);
        }
예제 #32
0
 void Awake()
 {
     stuckTimerCount = 0;
     city = GameObject.FindObjectOfType<CityManager>();
     controller = GetComponent<CarController> ();
     player = GameObject.FindGameObjectWithTag("Player").transform;
     GetComponentInChildren<UnityStandardAssets.Vehicles.Car.CarAIControl>().SetTarget(player);
 }
        protected CallDriverModel CreateCallDriverModel(string userName)
        {
            CallDriverModel cdm = new CallDriverModel();
            CityManager cm = new CityManager();
            List<Street> streets = cm.GetStreets();

            cdm.Name = userName ?? string.Empty;
            cdm.StreetList = streets.Select(s => new SelectListItem { Text = s.Name , Value = s.Id.ToString() }).ToList();

            return cdm;
        }
예제 #34
0
 private void UpdateManagers()
 {
     cityManager = this.gameObject.GetComponent<CityManager>();
     environmentManager = this.gameObject.GetComponent<EnvironmentManager>();
     financeManager = this.gameObject.GetComponent<FinanceManager>();
     legislationManager = this.gameObject.GetComponent<LegislationManager>();
     popularityManager = this.gameObject.GetComponent<PopularityManager>();
     powerPlantManager = this.gameObject.GetComponent<PowerPlantManager>();
     researchDevelopmentManager = this.gameObject.GetComponent<ResearchDevelopmentManager>();
     resourceManager = this.gameObject.GetComponent<ResourceManager>();
     management = true;
     ++count;
 }
예제 #35
0
        public string addToQueue(int driverId , int regionId)
        {
            //Clients.All.hello(data);
            DriverManager dm = new DriverManager();
            CityManager cm = new CityManager();
            Region region = cm.GetRegionsById(regionId);
            Driver driver = dm.GetById(driverId);
            DriverWorkModel driver_wm = new DriverWorkModel(driver, Status.Online, region);
            driver_wm.SignalR_id = Context.ConnectionId;
            QueueController queueController = new QueueController();

            if (!queueController.HasSuchDriver(driver_wm))
            {
                queueController.AddToQueue(driver_wm);
                Groups.Add(driver_wm.SignalR_id, "Drivers");
                 return "queue count:" + queueController.GetConunt();
            }
            return "this driver is alredy added in queue";
        }
예제 #36
0
    // Use this for initialization
    public override void Start()
    {
        Instance = this;

        theCity = GameObject.FindGameObjectWithTag("City").GetComponent<CityManager>();

        player = GameObject.FindGameObjectWithTag("Player");

        kaiju = player.GetComponent<Kaiju>();

        cityWidth = theCity.getWidth();

        float x = theCity.gameObject.transform.position.x;

        if (x < 1)
        {
            // just incase this is 0 and messes with the math.
            x = 1;
        }

        float z = theCity.gameObject.transform.position.z;

        if (z < 1)
        {
            // just incase this is 0 and messes with the math.
            z = 1;
        }

        //X of City * width in tiles * width of tiles.

        cityBoundary.x = x + theCity.getWidth() * 2;

        cityBoundary.z = z + theCity.getDepth() * 2;

        StartCoroutine("Spawn");

        base.Start();
    }
예제 #37
0
    // Use this for initialization
    void Awake()
    {
        instance = this;

        city = new List<CityCube[]>();
        level = new byte[width];

        ll = new Vector3(-width / 2f + 0.5f, -height / 2f + 0.5f);

        BuildCity();
    }
예제 #38
0
 // Use this for initialization
 void Start()
 {
     _cityManager = new CityManager();
 }
 public static List<SelectListItem> GetStreets()
 {
     CityManager cm = new CityManager();
     List<Street> streets = cm.GetStreets();
     return streets.Select(s => new SelectListItem { Text = s.Name, Value = s.Name.ToString() }).ToList();
 }
예제 #40
0
	// Use this for initialization
	void Start () {
		instance = this;
		cityFlags = new bool[]{false, false, false};
	}