public ActionResult DeleteConfirmed(int id)
        {
            Taken taken = db.Takens.Find(id);

            db.Takens.Remove(taken);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Code,Acid,Section,Result,Year")] Taken taken)
 {
     if (ModelState.IsValid)
     {
         db.Entry(taken).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(taken));
 }
        public ActionResult Create([Bind(Include = "Id,Code,Acid,Section,Result,Year")] Taken taken)
        {
            if (ModelState.IsValid)
            {
                db.Takens.Add(taken);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(taken));
        }
Example #4
0
        public void OnTick()
        {
            if (nmovement)
            {
                this.target = FindTarget();
            }
            else
            {
                this.target = FindTargetClosest();
            }

            if (this.target == null)
            {
                return;
            }
            if (!nmovement)
            {
                Taken.TryAdd(this.target, player);             //Don't add if we are not moving.
            }
            if (!swalk)
            {
                MO.Unwalkable = UNWALKABLE;
            }
            else
            {
                MO.Unwalkable = null;
            }

            neighbour = actions.FindValidNeighbour(target, false, MO.Unwalkable);
            if (neighbour == null)
            {
                ClearTarget();
                return;
            }

            busy = true;
            var map = player.functions.AsyncMoveToLocation(neighbour.location, token, MO); // Make it move over the block a litte bit.

            map.Offset = CalculateOffset(target, neighbour.location);

            if (nmovement)
            {
                PathReached(map.Offset);
                return;
            }

            map.Completed += areaMap => PathReached(map.Offset);
            map.Cancelled += (areaMap, cuboid) => {
                this.busy = false;
                ClearTarget();
            };

            map.Start();
        }
Example #5
0
 public void Take(int sum)
 {
     if (this.sum >= sum)
     {
         this.sum -= sum;
         Taken?.Invoke(this, new AccountEventArgs($"You've taken {sum} from conto", sum));
     }
     else
     {
         Taken?.Invoke(this, new AccountEventArgs($"You can't take {sum} from conto", sum));
     }
 }
        // GET: Admins/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Taken taken = db.Takens.Find(id);

            if (taken == null)
            {
                return(HttpNotFound());
            }
            return(View(taken));
        }
Example #7
0
 private void ClearTarget()
 {
     if (this.target != null)
     {
         IPlayer obj;
         Taken.TryRemove(target, out obj);
         this.target = null;
     }
     if (this.targets != null && this.targets.Length > 0)
     {
         IPlayer obj;
         for (int i = 0; i < targets.Length; i++)
         {
             Taken.TryRemove(targets[i], out obj);
         }
         targets = null;
     }
 }
Example #8
0
        private ILocation FindTarget()
        {
            var h = (int)totalRadius.start.y + totalRadius.height;

            for (int x = totalRadius.start.x; x < totalRadius.start.x + totalRadius.xSize + 1; x++)
            {
                for (int z = totalRadius.start.z; z < totalRadius.start.z + totalRadius.zSize + 1; z++)
                {
                    if (Taken.ContainsKey(new Location(x, h, z)) || player.world.GetBlockId(x, h, z) != 0 || player.status.entity.location.Distance(new Position(x + 0.5f, h, z + 0.5f)) > MAX_RANGE)
                    {
                        continue;
                    }

                    return(new Location(x, h, z));
                }
            }

            return(null);
        }
Example #9
0
        private ILocation[] FindSurroundingTargets()
        {
            var h = (int)totalRadius.start.y + totalRadius.height;
            List <ILocation> list = new List <ILocation>();

            for (int x = totalRadius.start.x; x < totalRadius.start.x + totalRadius.xSize + 1; x++)
            {
                for (int z = totalRadius.start.z; z < totalRadius.start.z + totalRadius.zSize + 1; z++)
                {
                    //Check if the block is valid for mining.
                    if (Taken.ContainsKey(new Location(x, h, z)) || player.world.GetBlockId(x, h, z) != 0 || player.status.entity.location.Distance(new Position(x, h, z)) > REACH)
                    {
                        continue;
                    }

                    list.Add(new Location(x, h, z));
                }
            }

            return(list.ToArray());
        }
Example #10
0
        private ILocation FindTargetClosest()
        {
            var h = (int)totalRadius.start.y + totalRadius.height;

            List <ILocation> locations = new List <ILocation>();

            for (int x = totalRadius.start.x; x < totalRadius.start.x + totalRadius.xSize + 1; x++)
            {
                for (int z = totalRadius.start.z; z < totalRadius.start.z + totalRadius.zSize + 1; z++)
                {
                    if (Taken.ContainsKey(new Location(x, h, z)) || player.world.GetBlockId(x, h, z) != 0)
                    {
                        continue;
                    }

                    locations.Add(new Location(x, h, z));
                }
            }

            return(locations.OrderBy(x => x.Distance(player.status.entity.location.ToLocation(-1))).FirstOrDefault());
        }
Example #11
0
        public VisualizedWord CalculateWordAppearence(IWeightedWord word, int itemIndex)
        {
            var fontSize = CalculateRelativeValue(Arguments.FontSizeRange, word.Weight);
            var opacity  = CalculateRelativeValue(Arguments.OpacityRange, word.Weight);
            var size     = Arguments.WordSizeCalculator(word.Text, fontSize);
            var visWord  = new VisualizedWord(word)
            {
                FontSize = fontSize,
                Opacity  = opacity,
                Size     = size
            };

            //Startpunkt in der Mitte ermitteln
            var basePoint = new Point
            {
                X = Arguments.PanelSize.Width / 2 - size.Width / 2,
                Y = Arguments.PanelSize.Height / 2 - size.Height / 2
            };
            Rect  rect;
            Point desiredPoint;

            do
            {
                desiredPoint = CalculateSpiralPoint(Radius, Phi, basePoint);
                rect         = new Rect(desiredPoint, size);
                Phi         += Rad(PhiIncreaseDegree * DegreeIncreaseCorrection);
            } while (!IsRadiusOutOfBounds && (IsRectOutOfBounds(rect) || Taken.Any(rect1 => rect.IntersectsWith(rect1))));
            // Radius Out Of Bounds is kill criterial

            Taken.Add(rect);

            visWord.Position = desiredPoint;

            if (!IsRadiusOutOfBounds)
            {
                return(visWord);
            }
            CanAddWords = false;
            return(null);
        }
Example #12
0
        public VisualizedWord CalculateWordAppearence(IWeightedWord word, int itemIndex /*, VisualizedWord preDecessors*/)
        {
            //Ausdehnung
            var size = Arguments.WordSizeCalculator(word.Text, CalculateRelativeValue(Arguments.FontSizeRange, word.Weight));



            //Startpunkt ermitteln
            var p = new Point();

            if (itemIndex == 0)   //vll auch (0,0), später!
            {
                p.X = 0;
                p.Y = 0;
                pos = 0;
            }
            else
            {
                p = GetSpiralPoint(pos /*, radius = 2*/);
            }


            //mach' ein Rechteck d'raus
            var rectangle = new System.Windows.Rect()
            {
                Location = p,
                Size     = size
            };
            var rectgeom = rectangle;//geometrisch

            //bis Platz gefunden
            var found   = false;
            var nofound = false;

            var offsetvector = new System.Windows.Vector(
                Arguments.PanelSize.Width / 2,
                Arguments.PanelSize.Height / 2
                );

            //Kollisionserkennung: über Vorgänger iterieren
            //Teste Position (x,y) ist frei für Wort mit Größe size
            var intersect = new Rect();
            var tau       = 2 * Math.PI;
            var itemCnt   = 0;

            rectgeom.Offset(offsetvector);
            while (!((itemIndex <= 0) || found))
            {
                nofound = false;
                foreach (Rect r in Taken)
                {
                    var f = this.RectIntersectsRect(rectangle, r);
                    if (f)   // darf ich benutzen, anliegende kanten werden als intersected bewertet
                    {
                        nofound = true;
                    }
                }
                if (nofound ||
                    rectgeom.Left < 0 || rectgeom.Left >= Arguments.PanelSize.Width ||
                    rectgeom.Top < 0 || rectgeom.Top >= Arguments.PanelSize.Height ||
                    rectgeom.Right < 0 || rectgeom.Right >= Arguments.PanelSize.Width ||
                    rectgeom.Bottom < 0 || rectgeom.Bottom >= Arguments.PanelSize.Height
                    )
                {
                    nofound = true;
                }
                // Platz belegt
                // neue Postion anhand Fläche bestimmen, min Schritte von 3,6°

                if (nofound)
                {
                    itemCnt++;
                    Cnt++;
                    var a = (this.Area(intersect) / this.Area(rectgeom));
                    pos += tau / Sectors + a;
                    //var a = 0.2 + (this.Area(intersect) / this.Area(rectgeom));
                    //pos += tau / Sectors * a;
                    p = GetSpiralPoint(pos);//this.Radius
                    //p.X -= (Arguments.WordMargin.Left );
                    //p.Y -= (Arguments.WordMargin.Top );
                    //rectangle.Width += Arguments.WordMargin.Left + Arguments.WordMargin.Right;
                    //rectangle.Height += Arguments.WordMargin.Top + Arguments.WordMargin.Bottom;
                    rectangle.Location = p;
                    rectgeom           = rectangle;
                    rectgeom.Offset(offsetvector);
                    //nofound = false;
                }
                else
                {
                    found   = true;
                    itemCnt = 0;
                    if (itemIndex > 44)
                    {
                        ;
                    }
                }
                if (itemCnt > Sectors * 2)
                {
                    break;
                }
            }

            //bzw. of Position (x,y) bis Position (x+size.Width,y+size.Height) frei/leer ist
            //wenn nicht, neue Position anhand Spirale a(r,phi) => a(x,y)

            //var durch = 0;
            //foreach (Rect r in Taken)
            //{
            //    Console.Write(durch);
            //    Console.Write(":");
            //    Console.Write(r.TopLeft);
            //    Console.Write("-");
            //    Console.Write(r.TopRight);
            //    Console.Write("\r\n");
            //    durch++;
            //};

            // raise flag to stop new Words
            if (
                (StopAfterWords >= 1 && itemIndex >= (StopAfterWords - 1)) ||
                !this.RectIntersectsRect(rectgeom, new Rect(new Point(0, 0), new System.Windows.Size(Arguments.PanelSize.Width, Arguments.PanelSize.Height)))
                )
            {
                CanAddWords = false;
            }

            //rechtecke für nächsten Durchlauf speichern
            if (!rectangle.IsEmpty || CanAddWords)
            {
                Taken.Add(rectangle);

                var vergl = new Range(Arguments.FontSizeRange.Min, Arguments.FontSizeRange.Max /*, 0.5*/).CalculateRelativeValue(Arguments.FontSizeRange, word.Weight);
                return(new VisualizedWord(word)
                {
                    Size = new Size(rectangle.Width, rectangle.Height),
                    //FontSize = Convert.ToInt32((Arguments.FontSizeRange.Min / Arguments.FontSizeRange.Max * word.Weight % Arguments.FontSizeRange.Max + Arguments.FontSizeRange.Min) / 0.5) * 0.5,
                    //FontSize = Arguments.FontSizeRange.CalculateRelativeValue(Arguments.FontSizeRange, word.Weight/*, 0.5, 1*/),
                    FontSize = CalculateRelativeValue(Arguments.FontSizeRange, word.Weight, 0.5, 1),
                    Position = new Point(rectangle.Top, rectangle.Left),
                    //Opacity = (Arguments.OpacityRange.Min / Arguments.OpacityRange.Max * word.Weight % 150 + Arguments.OpacityRange.Min) / 150 //CalculateRelativeValue(Arguments.OpacityRange, word.Weight, double Step)
                    Opacity = this.CalculateRelativeValue(Arguments.OpacityRange, word.Weight, 0.1, 1)
                              //Opacity = Arguments.OpacityRange.CalculateRelativeValue(Arguments.OpacityRange, word.Weight/*, 0.1, 1*/)
                }
                       );
            }
            else
            {
                return(new VisualizedWord(word));
            }
        }
Example #13
0
 public override string ToString()
 {
     return("This Space is On Row: " + Row + " and has Space Number: " + Number + " has a Taken Status of " + Taken.ToString());
 }