/// <summary>
        /// Parses a string to an EAreaType
        /// </summary>
        /// <param name="parseString">The string that needs to be parsed</param>
        /// <returns>The EAreaType with the given string (EAreaType)</returns>
        private static EAreaType StringToAreaType(string parseString)
        {
            EAreaType result = new EAreaType();

            result = (EAreaType)Enum.Parse(typeof(EAreaType), parseString);
            return(result);
        }
        /// <summary>
        /// Creates a new EditScreen and set the Variables to the given Parameters (also fills the boxes with the give Parameters)
        /// </summary>
        /// <param name="AreaType">The AreaType that needs to be edited</param>
        /// <param name="Area">The Area that needs to be edited</param>
        /// <param name="Form">The ISettingsScreen form to apply eddits too</param>
        public EditScreen(EAreaType AreaType, IArea Area, ISettingsScreen Form)
        {
            InitializeComponent();

            this.AreaType = AreaType;
            this.Form     = Form;

            if (AreaType == EAreaType.Cinema)
            {
                CinemaGroup.Visible = true;
                Width = CinemaGroup.Location.X * 3 + CinemaGroup.Width;
                ApplyButton.Location = new Point(CinemaGroup.Location.X, ApplyButton.Location.Y);
                ApplyButton.Width    = CinemaGroup.Width;

                //FILLING DATA OF BOXES
                Cinema tempCinema = (Cinema)Area;
                CinemaID.Text   = "" + tempCinema.ID;
                MovieTime.Value = tempCinema.MovieTime;
            }
            else if (AreaType == EAreaType.Restaurant)
            {
                RestaurantGroup.Visible  = true;
                RestaurantGroup.Location = CinemaGroup.Location;
                Width = RestaurantGroup.Location.X * 3 + RestaurantGroup.Width;
                ApplyButton.Location = new Point(RestaurantGroup.Location.X, ApplyButton.Location.Y);
                ApplyButton.Width    = RestaurantGroup.Width;

                //FILLING DATA OF BOXES
                Restaurant tempRestaurant = (Restaurant)Area;
                RestaurantID.Text    = "" + tempRestaurant.ID;
                RestaurantTime.Value = tempRestaurant.EatingTime;
            }
            Show();
        }
Exemplo n.º 3
0
 private ContentControl GetContentControl(EAreaType areaType)
 {
     if (_pages.ContainsKey(areaType))
     {
         return(_pages[areaType]);
     }
     throw new Exception($"Control type {areaType} not found");
 }
Exemplo n.º 4
0
 public void Register(ContentControl control, EAreaType type)
 {
     if (_pages.ContainsKey(type))
     {
         throw new Exception($"Control type {type} already exist");
     }
     _pages.Add(type, control);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates an instance of ElevatorShaft with the given Parameters
 /// </summary>
 /// <param name="ID">ID of the Area</param>
 /// <param name="areaType">Type of Area</param>
 /// <param name="capacity">How many Humans can be in the Area at the same time</param>
 /// <param name="classification">The Classification of the Area</param>
 /// <param name="positionX">The horizontal point in the grid</param>
 /// <param name="positionY">The vertical point in the grid</param>
 /// <param name="width">The width of the Area</param>
 /// <param name="height">The height of the Area</param>
 public void Create(int ID, EAreaType areaType, int capacity, int classification, int positionX, int positionY, int width, int height)
 {
     this.ID        = ID;
     this.AreaType  = areaType;
     this.PositionX = positionX;
     this.PositionY = positionY;
     this.Width     = width;
     this.Height    = height;
 }
 public void Create(EAreaType areaType, int capacity, int classification, int positionX, int positionY, int width, int height, Bitmap sprite)
 {
     this.AreaType  = areaType;
     this.PositionX = positionX;
     this.PositionY = positionY;
     this.Width     = width;
     this.Height    = height;
     this.Sprite    = sprite;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Creates an instance of Reception with the given Parameters
        /// </summary>
        /// <param name="ID">ID of the Area</param>
        /// <param name="areaType">Type of Area</param>
        /// <param name="capacity">How many Humans can be in the Area at the same time</param>
        /// <param name="classification">The Classification of the Area</param>
        /// <param name="positionX">The horizontal point in the grid</param>
        /// <param name="positionY">The vertical point in the grid</param>
        /// <param name="width">The width of the Area</param>
        /// <param name="height">The height of the Area</param>
        public void Create(int ID, EAreaType areaType, int capacity, int classification, int positionX, int positionY, int width, int height)
        {
            this.ID   = ID;
            AreaType  = areaType;
            PositionX = positionX;
            PositionY = positionY;
            Width     = width;
            Height    = height;

            HotelEventManager.Register(this);
        }
Exemplo n.º 8
0
    public override void OnInspectorGUI()
    {
        _type = (EAreaType)EditorGUILayout.EnumPopup(" EObjType : ", _type);
        GUILayout.Label("Update Type in  Editor : ");
        var btn = GUILayout.Button(" Update Type ");

        if (btn)
        {
            Apply();
        }
    }
Exemplo n.º 9
0
        /// <summary>
        /// Creates an instance of Fitness with the given Parameters
        /// </summary>
        /// <param name="ID">ID of the Area</param>
        /// <param name="areaType">Type of Area</param>
        /// <param name="capacity">How many Humans can be in the Area at the same time</param>
        /// <param name="classification">The Classification of the Area</param>
        /// <param name="positionX">The horizontal point in the grid</param>
        /// <param name="positionY">The vertical point in the grid</param>
        /// <param name="width">The width of the Area</param>
        /// <param name="height">The height of the Area</param>
        public void Create(int ID, EAreaType areaType, int capacity, int classification, int positionX, int positionY, int width, int height)
        {
            this.ID   = ID;
            AreaType  = areaType;
            PositionX = positionX;
            PositionY = positionY;
            Width     = width;
            Height    = height;

            GlobalStatistics.FitnessCenters.Add(this);
        }
Exemplo n.º 10
0
        public void NavigateTo(EAreaType areaType, Object data = null)
        {
            var            eventData = new CAreaNavigateEventArgs(areaType, data);
            ContentControl control   = GetContentControl(areaType);

            if (control.DataContext is ViewModelBase vm)
            {
                vm.OnNavigated(data);
            }
            Navigate?.Invoke(this, control);
            //_navigationItems.Push(new CNavigationHistoryItem(pageType, targetId));
        }
Exemplo n.º 11
0
    /// <summary>
    /// 获取区域类型
    /// </summary>
    /// <param name="coorX">Coor x.</param>
    /// <param name="coorZ">Coor z.</param>
    static public EAreaType GetAreaType(int coorX, int coorZ)
    {
        EAreaType aType = EAreaType.Player;

        if (coorX < 0 || coorX >= GridWidthCount || coorX < 0 || coorZ >= GridHeightCount)
        {
            //--界外.
            aType = EAreaType.Out;
        }
        else if (coorZ >= GridPlayerHeightCount)
        {
            aType = EAreaType.Enemy;
        }

        return(aType);
    }
Exemplo n.º 12
0
        /// <summary>
        /// Searches the nearest facility with the given AreaType from the given Node
        /// </summary>
        /// <param name="StartingNode">The given Node</param>
        /// <param name="AreaType">The AreaType of the Node</param>
        /// <returns>The nearest facility (Node)</returns>
        public static Node NearestFacility(Node StartingNode, EAreaType AreaType)
        {
            Node CurrentNode = StartingNode;

            HashSet <Node> NearestFacilities = new HashSet <Node>();

            for (int i = 0; i < HotelNodes.GetLength(0); i++)
            {
                for (int j = 0; j < HotelNodes.GetLength(1); j++)
                {
                    if (HotelNodes[i, j].Area.AreaType == AreaType)
                    {
                        NearestFacilities.Add(HotelNodes[i, j]);
                    }
                }
            }

            Node ShortestNode       = new Node();
            int  ShortestNodeLength = int.MaxValue;

            foreach (Node location in NearestFacilities)
            {
                if (location.Area.PositionX < StartingNode.Area.PositionX && location.Area.PositionY < StartingNode.Area.PositionY)
                {
                    if ((StartingNode.Area.PositionX - location.Area.PositionX) + (StartingNode.Area.PositionY - location.Area.PositionY) < ShortestNodeLength)
                    {
                        ShortestNodeLength = (StartingNode.Area.PositionX - location.Area.PositionX) + (StartingNode.Area.PositionY - location.Area.PositionY);
                        ShortestNode       = location;
                    }
                }
                else
                {
                    if ((location.Area.PositionX - StartingNode.Area.PositionX) + (location.Area.PositionY - StartingNode.Area.PositionY) < ShortestNodeLength)
                    {
                        ShortestNodeLength = (StartingNode.Area.PositionX - location.Area.PositionX) + (StartingNode.Area.PositionY - location.Area.PositionY);
                        ShortestNode       = location;
                    }
                }
            }

            return(ShortestNode);
        }
        public void ApplyEdits(EAreaType areaType, int Value, bool IsClosing)
        {
            if (IsClosing)
            {
                Enabled = true;
            }
            else
            {
                if (areaType == EAreaType.Restaurant)
                {
                    for (int i = 0; i < GlobalStatistics.Restaurants.Count; i++)
                    {
                        if (GlobalStatistics.Restaurants[i] == RestaurantBox.SelectedItem)
                        {
                            GlobalStatistics.Restaurants[i].EatingTime = Value;
                        }
                    }
                    RestaurantBox.DataSource = null;

                    RestaurantBox.DataSource    = GlobalStatistics.Restaurants;
                    RestaurantBox.DisplayMember = "ID";
                    RestaurantBox.ValueMember   = "ID";
                }
                else if (areaType == EAreaType.Cinema)
                {
                    for (int i = 0; i < GlobalStatistics.Cinemas.Count; i++)
                    {
                        if (GlobalStatistics.Cinemas[i] == CinemasBox.SelectedItem)
                        {
                            GlobalStatistics.Cinemas[i].MovieTime = Value;
                        }
                    }
                    CinemasBox.DataSource = null;

                    CinemasBox.DataSource    = GlobalStatistics.Cinemas;
                    CinemasBox.DisplayMember = "ID";
                    CinemasBox.ValueMember   = "ID";
                }
            }
        }
Exemplo n.º 14
0
 public SGridCoordinate(int _x, int _z)
 {
     this.x         = _x;
     this.z         = _z;
     this.MAreaType = Definition.GetAreaType(_x, _z);
 }
Exemplo n.º 15
0
 public void Clean()
 {
     this.x         = -1;
     this.z         = -1;
     this.MAreaType = EAreaType.Out;
 }
Exemplo n.º 16
0
 public CAreaNavigateEventArgs(EAreaType area, Object data)
 {
     Area = area;
     Data = data;
 }
        /// <summary>
        /// Creates an instance of the given AreaType and returns it.
        /// </summary>
        /// <param name="ID">ID of the Area</param>
        /// <param name="areaType">Type of Area</param>
        /// <param name="capacity">How many Humans can be in the Area at the same time</param>
        /// <param name="classification">The Classification of the Area</param>
        /// <param name="positionX">The horizontal point in the grid</param>
        /// <param name="positionY">The vertical point in the grid</param>
        /// <param name="width">The width of the Area</param>
        /// <param name="height">The height of the Area</param>
        /// <returns>An instance of the given AreaType (IArea)</returns>
        public static IArea Create(int ID, string areaType, int capacity, int classification, int positionX, int positionY, int width, int height)
        {
            EAreaType AreaType = StringToAreaType(areaType);

            switch (AreaType)
            {
                #region Facilities
            //If the AreaType is Cinema
            case EAreaType.Cinema:
                Cinema tempCinema = new Cinema();
                tempCinema.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempCinema);

            //If the AreaType is Restaurant
            case EAreaType.Restaurant:
                Restaurant tempRestaurant = new Restaurant();
                tempRestaurant.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempRestaurant);

            //If the AreaType is Fitness
            case EAreaType.Fitness:
                Fitness tempFitness = new Fitness();
                tempFitness.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempFitness);

                #endregion

                #region MoveAble Areas
            //If the AreaType is ElevatorShaft
            case EAreaType.ElevatorShaft:
                ElevatorShaft tempElevatorShaft = new ElevatorShaft();
                tempElevatorShaft.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempElevatorShaft);

            //If the AreaType is Hallway
            case EAreaType.Hallway:
                Hallway tempHallway = new Hallway();
                tempHallway.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempHallway);

            //If the AreaType is Staircase
            case EAreaType.Staircase:
                Staircase tempStaircase = new Staircase();
                tempStaircase.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempStaircase);

                #endregion

                #region Room
            //If the AreaType is Room
            case EAreaType.Room:
                Room tempRoom = new Room();
                tempRoom.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempRoom);

                #endregion

                #region Reception
            //If the AreaType is Reception
            case EAreaType.Reception:
                Reception tempReception = new Reception();
                tempReception.Create(ID, AreaType, capacity, classification, positionX, positionY, width, height);
                return(tempReception);

                #endregion
            }
            //If the given AreaType can't be found we will return null
            return(null);
        }