public ComputerBrain(Types vType, Deelnemer vDeelnemer, PointTypes vPointType)
 {
     SetDeelNemer(vDeelnemer);
     SetTroefType(vType);
     SetPointType(vPointType);
     InitializeTroefKaarten();
     kaartenGespeeld = new List<Kaart>();
 }
示例#2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            PointTypes pointTypes = await db.PointTypes.FindAsync(id);

            db.PointTypes.Remove(pointTypes);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#3
0
 public ProgressPoint(ProgressPoint copy_)
 {
     ProgressName = copy_.ProgressName;
     TypeID       = copy_.TypeID;
     StringValue  = copy_.StringValue;
     BoolValue    = copy_.BoolValue;
     IntValue     = copy_.IntValue;
     FloatValue   = copy_.FloatValue;
     compare      = copy_.compare;
 }
示例#4
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,ShortName")] PointTypes pointTypes)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pointTypes).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(pointTypes));
        }
示例#5
0
 /// <summary>
 /// Inicjalizuje właściwości obiektu gry.
 /// </summary>
 /// <param name="pointType">Typ punktów reprezentujący instancję obiektu gry w levelu.</param>
 /// <param name="points">Lista punktów, które reprezentują widzialną część obiektu gry.</param>
 public GameObject(PointTypes pointType = PointTypes.Empty, List <Vector2Int> points = null)
 {
     PointType = pointType;
     if (points == null)
     {
         Points = new List <Vector2Int>();
     }
     else
     {
         Points = points;
     }
 }
示例#6
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,ShortName")] PointTypes pointTypes)
        {
            if (ModelState.IsValid)
            {
                db.PointTypes.Add(pointTypes);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(pointTypes));
        }
示例#7
0
 public Point(int idPoint, int?idParent, string pointName, PointTypes pointType, AIIS aiis)
 {
     children   = new List <Point>();
     parameters = new List <Parameter>();
     type       = pointType;
     name       = pointName;
     id         = idPoint;
     parentID   = idParent;
     loaded     = false;
     leaf       = false;
     this.aiis  = aiis;
     LoadParameters();
 }
示例#8
0
        // GET: Guides/PointTypes/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PointTypes pointTypes = await db.PointTypes.FindAsync(id);

            if (pointTypes == null)
            {
                return(HttpNotFound());
            }
            return(View(pointTypes));
        }
示例#9
0
    //editor contructor
    public Beat(JsonData beatData)
    {
        PlotName   = (string)beatData["PlotName"];
        BeatName   = (string)beatData["BeatName"];
        BeatNumber = (int)beatData["BeatNumber"];

        Points = new List <ProgressPoint>();

        for (int i = 0; i < beatData["Point"].Count; ++i)
        {
            string        boolName = (string)beatData["Point"][i]["Name"];
            PointTypes    type     = (PointTypes)(int)beatData["Point"][i]["Type"];
            ProgressPoint point    = new ProgressPoint(boolName, type);
            Points.Add(point);
        }
    }
示例#10
0
        public Point GetAncestor(PointTypes ancestorType)
        {
            /* Database version
             * string sql = string.Format(@"
             * declare @look_id int
             * set @look_id={0};
             *
             * with tree(id_point, id_parent,pointname,point_type,lvl)
             * as(
             * select p.ID_Point,p.ID_Parent,p.PointName,p.Point_Type, 1 lvl
             * from points p
             * where p.ID_Point=@look_id
             * union all
             * select p2.ID_Point,p2.ID_Parent,p2.PointName,p2.Point_Type, tree.lvl+1
             * from tree inner join points p2 on tree.ID_Parent=p2.ID_Point)
             *
             * select top id_point from tree
             * where point_type={1}
             * order by lvl desc", id, (int)type);
             * int result = DataModel.GetIntValue(sql, 30);
             */
            Point      current   = this;
            PointTypes criterion = type;
            bool       found     = false;

            while (!aiis.Roots.Contains(current))
            {
                criterion = current.ParentPoint.Type;
                if (criterion == ancestorType)
                {
                    found = true;
                    break;
                }
                else
                {
                    current = current.ParentPoint;
                }
            }
            if (found)
            {
                return(current.ParentPoint);
            }
            else
            {
                return(null);
            }
        }
示例#11
0
        /// <summary>
        /// This method will decide how much points will the player get
        /// </summary>
        /// <param name="player">The player who gets the point</param>
        /// <param name="point_types"> The type of point</param>
        private void GetPoints(Player player, PointTypes point_types)
        {
            switch (point_types)
            {
            case PointTypes.DestroyWall:
                player.Score += 100;
                break;

            case PointTypes.PickUpPowerUps:
                player.Score += 200;
                break;

            default:
            case PointTypes.KillOtherPlayer:
                player.Score += 2000;
                break;
            }
        }
 public void SetPointType(PointTypes vPointType)
 {
     this.pointType = vPointType;
 }
示例#13
0
 /// <summary>
 /// Modification the point type (<see cref="PlotFormat.PointType"/>).
 /// </summary>
 public void ModPointType(string SubKey, PointTypes PointType)
 {
     this.ModPointType(new[] { SubKey }, new[] { PointType });
 }
示例#14
0
 public ProgressPoint(string eventName, PointTypes type)
 {
     ProgressName = eventName;
     TypeID       = type;
     StringValue  = "";
 }
示例#15
0
 public PreviewPoint(int x, int y, PointTypes type) : this(x, y)
 {
     PointType = type;
 }
示例#16
0
 private bool TryParsePointType(string text, out PointType pointType)
 {
     return(PointTypes.TryGetValue(text, out pointType));
 }
示例#17
0
 public PreviewPoint(PreviewPoint pointToClone)
 {
     _x         = pointToClone.X;
     _y         = pointToClone.Y;
     _pointType = pointToClone.PointType;
 }
示例#18
0
 public PlotFormat WithPointType(PointTypes pointType)
 {
     return(new PlotFormat(baseLineFormat: this, pointType: pointType));
 }
        void RadShapeEditorControl_MouseDown(object sender, MouseEventArgs e)
        {
            this.Cursor = Cursors.Cross;
            mouseDown   = true;
            downPoint   = new Point(e.X, e.Y);
            Point scaledTranslatedDownPoint = new Point(
                (int)Math.Round((downPoint.X) / Math.Pow(zoomFactor, 2)) + xOverflowOffset,
                (int)Math.Round((downPoint.Y) / Math.Pow(zoomFactor, 2)) + yOverflowOffset);

            curPoint = downPoint;
            point    = null;
            //find the point underneath the mouse
            foreach (ShapePoint pos1 in points)
            {
                if (pos1.IsVisible(scaledTranslatedDownPoint.X, scaledTranslatedDownPoint.Y, (int)Math.Round(8 * zoomFactor)))
                {
                    pointType = PointTypes.Point;
                    point     = pos1;
                    break;
                }
                else if (pos1.Bezier)
                {
                    if (pos1.ControlPoint1.IsVisible(scaledTranslatedDownPoint.X, scaledTranslatedDownPoint.Y, (int)Math.Round(8 * zoomFactor)))
                    {
                        pointType = PointTypes.ControlPoint;
                        point     = pos1.ControlPoint1;
                        break;
                    }
                    else if (pos1.ControlPoint2.IsVisible(scaledTranslatedDownPoint.X, scaledTranslatedDownPoint.Y, (int)Math.Round(8 * zoomFactor)))
                    {
                        pointType = PointTypes.ControlPoint;
                        point     = pos1.ControlPoint2;
                        break;
                    }
                }
            }

            if (isSymmetricPointMode)
            {
                if (point == null)
                {
                    isSymmetricPointMode = false;
                    return;
                }
                //use the currently selected node as a reference point to make the previously selected node symmetric to it
                referencePoint = point;
                //get the size of the drawable area and compute the coordinates of the new point
                Rectangle r    = dimension;
                int       midy = r.Top + r.Height / 2;
                int       midx = r.Left + r.Width / 2;

                if (isVerticalSymmetry)
                {
                    newSymmetricPoint.Y = referencePoint.Y + 2 * (midy - point.Y);
                }
                else
                {
                    newSymmetricPoint.X = referencePoint.X + 2 * (midx - point.X);
                }

                isSymmetricPointMode = false;
                Refresh();
                return;
            }

            if (point == null)
            {
                for (int i = 0; i < points.Count; i++)
                {
                    ShapePoint pos1 = points[i];
                    ShapePoint pos2 = i < points.Count - 1 ? points[i + 1] : points[0];

                    if (pos1.IsVisible(pos2, new Point(scaledTranslatedDownPoint.X, scaledTranslatedDownPoint.Y), 3))
                    {
                        pointType = PointTypes.Line;
                        point     = pos1;
                        break;
                    }
                }
            }

            if (point != null)
            {
                propertyGrid.SelectedObject = point;
            }
            else
            {
                propertyGrid.SelectedObject = null;
            }

            Refresh();
            //in case the mouse was clicked outside of any point, unselect all points (and their control points)
            if (e.Button == MouseButtons.Left)
            {
                if (point == null || !point.Selected)
                {
                    foreach (ShapePoint pos in points)
                    {
                        pos.Selected = false;
                        pos.ControlPoint1.Selected = false;
                        pos.ControlPoint2.Selected = false;
                    }
                }
            }

            if (point != null)
            {
                mouseDown = false;
            }

            if (e.Button == MouseButtons.Right && point != null)
            {
                if (pointType == PointTypes.Point && point is ShapePoint)
                {
                    menuItemAnchorLeft.Checked   = (point.Anchor & AnchorStyles.Left) != 0;
                    menuItemAnchorRight.Checked  = (point.Anchor & AnchorStyles.Right) != 0;
                    menuItemAnchorTop.Checked    = (point.Anchor & AnchorStyles.Top) != 0;
                    menuItemAnchorBottom.Checked = (point.Anchor & AnchorStyles.Bottom) != 0;

                    if (this.points.Count <= 2)
                    {
                        menuItemRemoveLine.Enabled  = false;
                        menuItemRemovePoint.Enabled = false;
                    }

                    menuItemLocked.Checked = point.Locked;

                    if ((point as ShapePoint).Bezier)
                    {
                        contextMenuPoint.Items[1].Text = "Convert to Line";
                    }
                    else
                    {
                        contextMenuPoint.Items[1].Text = "Convert to Bezier Curve";
                    }

                    contextMenuPoint.Show(PointToScreen(new Point(e.X, e.Y)));
                }
                else if (pointType == PointTypes.Line)
                {
                    if ((point as ShapePoint).Bezier)
                    {
                        contextMenuLine.Items[1].Text = "Convert to Line";
                    }
                    else
                    {
                        contextMenuLine.Items[1].Text = "Convert to Bezier Curve";
                    }

                    contextMenuLine.Show(PointToScreen(new Point(e.X, e.Y)));
                }
            }
        }
示例#20
0
文件: Game.cs 项目: szanuj/snake
        /// <summary>
        /// Aktualizuje stan gry.
        /// </summary>
        /// <param name="checkInput">Określa, czy metoda ma obłsużyć wejście.</param>
        public void Update(bool checkInput)
        {
            bool       updateDirection = false;
            Directions newDirection    = Directions.Up;

            if (checkInput)
            {
                // Obsługa wejścia.
                switch (currentKey)
                {
                case ConsoleKey.UpArrow:
                    updateDirection = true;
                    newDirection    = Directions.Up;
                    break;

                case ConsoleKey.DownArrow:
                    updateDirection = true;
                    newDirection    = Directions.Down;
                    break;

                case ConsoleKey.LeftArrow:
                    updateDirection = true;
                    newDirection    = Directions.Left;
                    break;

                case ConsoleKey.RightArrow:
                    updateDirection = true;
                    newDirection    = Directions.Right;
                    break;

                default:
                    break;
                }
            }
            // Aktualizacja obiektów gry.
            foreach (GameObject gameObject in gameObjects)
            {
                // Aktualizacja węży.
                if (gameObject is Snake)
                {
                    Snake snake = gameObject as Snake;
                    // Obsługa zmiany kierunku.
                    if (updateDirection)
                    {
                        Vector2Int zero = new Vector2Int(0, 0);
                        if (ConvertDirection.ToVector2Int(newDirection) + ConvertDirection.ToVector2Int(snake.Direction) != zero)
                        {
                            snake.UpdatedDirection       = newDirection;
                            snake.DirectionUpdateWaiting = true;
                        }
                    }
                    // Obsługa zmiany kierunku, ruchu, zebrania bonusu i kolizji.
                    double secondsPerMove = (1D / snake.Speed);
                    int    timesToMove    = (int)(snake.speedTimer.TimeElapsed.TotalSeconds / secondsPerMove);
                    if (timesToMove > 0)
                    {
                        snake.UpdateDirection();
                        snake.speedTimer.SubtractTimeElapsed(TimeSpan.FromSeconds(timesToMove * secondsPerMove));
                        for (int i = 0; i < timesToMove; i++)
                        {
                            Vector2Int futureHead = snake.Points[0] + ConvertDirection.ToVector2Int(snake.Direction);
                            if (futureHead.X >= 0 && futureHead.Y >= 0 && futureHead.X < level.Size.X && futureHead.Y < level.Size.Y)
                            {
                                PointTypes pointType = level.GetPointType(futureHead);
                                if (pointType == PointTypes.Empty)
                                {
                                    // Zwykły ruch.
                                    snake.Move();
                                    level.UpdateLevel(gameObjects);
                                }
                                else if (pointType == PointTypes.Bonus)
                                {
                                    // Ruch z zebraniem bonusu i urośnięciem węża.
                                    Bonuses bonuses = level.WhatObjectIsHere(futureHead, gameObjects) as Bonuses;
                                    snake.Move(true);
                                    bonuses.DeleteBonus(futureHead);
                                    level.UpdateLevel(gameObjects);
                                    bonuses.SpawnBonus(level.PickAnEmptyPoint());
                                    level.UpdateLevel(gameObjects);
                                    Score++;
                                    scoreBar.UpdateScores(Score);
                                }
                                else
                                {
                                    // Kolizja z wężem.
                                    InGame = false;
                                }
                            }
                            else
                            {
                                // Kolizja z granicą levelu.
                                InGame = false;
                            }
                        }
                    }
                }
            }
        }
示例#21
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);


            var refer  = property.FindPropertyRelative("ProgressName");
            var refer2 = property.FindPropertyRelative("TypeID");

            var labelRect = new Rect(position.x, position.y, InspectorValues.LabelWidth, position.height);

            EditorGUI.LabelField(labelRect, property.name);


            //this is defining the sizes of the rectangles for the editor
            var propStartPos = labelRect.position.x + labelRect.width;

            if (position.width > InspectorValues.MinRectWidth)
            {
                propStartPos += (position.width - InspectorValues.MinRectWidth) / InspectorValues.WidthScaler;
            }

            var toggleRect = new Rect(propStartPos, position.y, ToggleWidth, EditorGUIUtility.singleLineHeight);
            var eventRect  = new Rect(toggleRect.position.x + toggleRect.width, position.y, position.width - (toggleRect.position.x + toggleRect.width) + 14, EditorGUIUtility.singleLineHeight);

            //var enumRect = new Rect(propStartPos, position.y, 40, EditorGUIUtility.singleLineHeight);

            refer.stringValue = EditorGUI.TextField(eventRect, refer.stringValue);
            PointTypes ty = (PointTypes)EditorGUI.EnumPopup(toggleRect, (PointTypes)refer2.enumValueIndex);

            refer2.enumValueIndex = (int)ty;
            //ref2.boolValue = EditorGUI.ToggleLeft(toggleRect, "Value", ref2.boolValue);

            switch (ty)
            {
            case PointTypes.Flag:
                var refboo = property.FindPropertyRelative("BoolValue");
                toggleRect.y    += EditorGUIUtility.singleLineHeight + 2;
                refboo.boolValue = EditorGUI.ToggleLeft(toggleRect, "Value", refboo.boolValue);
                break;

            case PointTypes.Float:
                var refflo = property.FindPropertyRelative("FloatValue");

                eventRect.y      += EditorGUIUtility.singleLineHeight + 2;
                refflo.floatValue = EditorGUI.FloatField(eventRect, refflo.floatValue);

                var compare = property.FindPropertyRelative("compare");
                toggleRect.y += EditorGUIUtility.singleLineHeight + 2;
                ValueCompare com = (ValueCompare)EditorGUI.EnumPopup(toggleRect, (ValueCompare)compare.enumValueIndex);
                compare.enumValueIndex = (int)com;
                break;

            case PointTypes.Integer:
                var refint = property.FindPropertyRelative("IntValue");

                eventRect.y    += EditorGUIUtility.singleLineHeight + 2;
                refint.intValue = EditorGUI.IntField(eventRect, refint.intValue);

                var compare2 = property.FindPropertyRelative("compare");
                toggleRect.y += EditorGUIUtility.singleLineHeight + 2;
                ValueCompare com2 = (ValueCompare)EditorGUI.EnumPopup(toggleRect, (ValueCompare)compare2.enumValueIndex);
                compare2.enumValueIndex = (int)com2;
                break;

            case PointTypes.String:
                var refst = property.FindPropertyRelative("StringValue");
                eventRect.y      += EditorGUIUtility.singleLineHeight + 2;
                refst.stringValue = EditorGUI.TextField(eventRect, refst.stringValue);
                break;

            default:
                break;
            }


            EditorGUI.EndProperty();
        }