Beispiel #1
0
 public override void Operate()
 {
     while (true)
     {
         SwinGame.ProcessEvents();
         PGC.MasterTextBox.Clear();
         if (Pbattery != null)
         {
             if (Pbattery.PowerRemaining >= 4)
             {
                 PGC.MasterTextBox.AddLine("Press D to Drill!");
                 if (SwinGame.KeyReleased(KeyCode.DKey) && Pbattery.TakePower(PpowerAmount))
                 {
                     SwinGame.ProcessEvents();
                     DrillDown();
                 }
             }
             else
             {
                 PGC.MasterTextBox.AddLine("Not enough power provided");
             }
         }
         else
         {
             PGC.MasterTextBox.AddLine("No battery provided");
         }
         base.Operate();
         PGC.DrawEverything();
         if (SwinGame.WindowCloseRequested() || SwinGame.KeyReleased(KeyCode.EscapeKey) || SwinGame.MouseClicked(MouseButton.LeftButton))
         {
             SwinGame.ProcessEvents();
             break;
         }
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            PGC pGC = db.PGCs.Find(id);

            db.PGCs.Remove(pGC);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "PGC_ID,PGC_First_Name,PGC_Last_Name,PGC_ID_Number,PGC_Email,PGC_Contact_No,PGC_Password,PGC_Status")] PGC pGC)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pGC).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pGC));
 }
        public ActionResult Create([Bind(Include = "PGC_ID,PGC_First_Name,PGC_Last_Name,PGC_ID_Number,PGC_Email,PGC_Contact_No,PGC_Password,PGC_Status")] PGC pGC)
        {
            if (ModelState.IsValid)
            {
                db.PGCs.Add(pGC);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pGC));
        }
        // GET: PGCs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PGC pGC = db.PGCs.Find(id);

            if (pGC == null)
            {
                return(HttpNotFound());
            }
            return(View(pGC));
        }
Beispiel #6
0
        private int CountCats()
        {
            int count = 0;

            foreach (PGCategory PGC in PGSystem.CategoryList)
            {
                if ((PGC.GetFlag(EntryFlag.StaffOnly) && m_From.AccessLevel > AccessLevel.Player) ||
                    (!PGC.GetFlag(EntryFlag.StaffOnly) && ((!PGC.GetFlag(EntryFlag.Reds) && m_From.Kills < 5) || PGC.GetFlag(EntryFlag.Reds))) ||
                    (m_From.AccessLevel > AccessLevel.Player))
                {
                    count++;
                }
            }
            return(count);
        }
Beispiel #7
0
        public override void Operate()
        {
            while (true)
            {
                SwinGame.ProcessEvents();
                PGC.MasterTextBox.Clear();
                if (Pbattery != null)
                {
                    PGC.MasterTextBox.AddLine("Use Arrow keys to move");
                    PGC.MasterTextBox.AddLine("Movement costs " + PowerAmount + " out of " + Pbattery.PowerRemaining + " remaining energy");
                }
                else
                {
                    PGC.MasterTextBox.AddLine("Device is not powered to move");
                }
                base.Operate();
                PGC.DrawEverything();
                if (SwinGame.KeyReleased(KeyCode.UpKey))
                {
                    Move(Direction.Up);
                }
                else if (SwinGame.KeyReleased(KeyCode.DownKey))
                {
                    Move(Direction.Down);
                }
                else if (SwinGame.KeyReleased(KeyCode.LeftKey))
                {
                    Move(Direction.Left);
                }
                else if (SwinGame.KeyReleased(KeyCode.RightKey))
                {
                    Move(Direction.Right);
                }

                if (SwinGame.WindowCloseRequested() || SwinGame.KeyReleased(KeyCode.EscapeKey) || SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    SwinGame.ProcessEvents();
                    break;
                }
            }
        }
Beispiel #8
0
        public void DrillDown()
        {
            if (_wear > 100)
            {
                Random rnd = new Random();
                if (rnd.Next(1, 5) == 1)
                {
                    return;
                }
            }
            Speciman search = PGC.TakeSpecimanAt(GameMain.newPoint2D(Prover.Location.X, Prover.Location.Y));

            if (search != null)
            {
                Prover.AddSpeciman(search);
                _wear += 5;
            }
            else
            {
                _wear += 10;
            }
        }
Beispiel #9
0
 public override void Operate()
 {
     while (true)
     {
         SwinGame.ProcessEvents();
         PGC.MasterTextBox.Clear();
         if (Pbattery != null)
         {
             if (Pbattery.PowerRemaining != Pbattery.MaximumPower)
             {
                 PGC.MasterTextBox.AddLine("Press S to recharge " + PowerAmount);
                 if (SwinGame.KeyReleased(KeyCode.SKey))
                 {
                     Pbattery.GivePower(PpowerAmount);
                     if (Pbattery.MaximumPower == Pbattery.PowerRemaining)
                     {
                         base.DeConnectBattery();
                         PGC.MasterTextBox.Clear();
                     }
                 }
             }
             if (Pbattery != null)
             {
                 PGC.MasterTextBox.AddLine("Battery has " + Pbattery.PowerRemaining + "/" + Pbattery.MaximumPower + " remaining");
             }
         }
         else
         {
             PGC.MasterTextBox.AddLine("Device is not powered to move");
         }
         base.Operate();
         PGC.DrawEverything();
         if (SwinGame.WindowCloseRequested() || SwinGame.KeyReleased(KeyCode.EscapeKey) || SwinGame.MouseClicked(MouseButton.LeftButton))
         {
             SwinGame.ProcessEvents();
             break;
         }
     }
 }
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (FileName.EditValue.ToString() != string.Empty)
         {
             if (FileName.EditValue.ToString().Contains(".xml"))
             {
                 Address = string.Format(@"{0}\Layouts\{1}\{2}\{3}", GlobalVariables.LayoutLocation, GlobalVariables.CurrentUser, ReportName, FileName.EditValue);
             }
             else
             {
                 Address = string.Format(@"{0}\Layouts\{1}\{2}\{3}.xml", GlobalVariables.LayoutLocation, GlobalVariables.CurrentUser, ReportName, FileName.EditValue);
             }
             PGC.RestoreLayoutFromXml(Address);
             Hide();
         }
     }
     catch (Exception ex)
     {
         ProjectFunctions.SpeakError("Error While Loading Layout.\n" + ex.Message);
     }
 }
        private void Search()
        {
            bool BeyondFive = false;
            int  lowestx    = (int)Prover.Location.X;
            int  lowesty    = (int)Prover.Location.Y;
            int  highestx   = lowestx;
            int  highesty   = lowesty;
            int  currentx   = lowestx;
            int  currenty   = lowesty;

            PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(currentx, currenty));
            while (!BeyondFive)
            {
                BeyondFive = true;

                //ERROR. CODE BELOW DOESN'T WORK PROPERLY
                //right
                highestx++;
                for (int i = currentx; i < highestx; i++)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(currentx, currenty));
                    }
                    currentx = i + 1;
                }
                //up
                highesty++;
                for (int i = currenty; i < highesty; i++)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(currentx, i));
                    }
                    currenty = i + 1;
                }
                //left
                lowestx--;
                for (int i = currentx; i > lowestx; i--)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(i, currenty));
                    }
                    currentx = i - 1;
                }
                //down
                lowesty--;
                for (int i = currenty; i > lowesty; i--)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(i, currenty));
                    }
                    currenty = i - 1;
                }
            }
        }