Esempio n. 1
0
        public void initialData()
        {
            Admin newAdmin = new Admin
            {
                ID       = "AD001",
                name     = "admin",
                email    = "*****@*****.**",
                password = "******"
            };

            DB.conn.Store(newAdmin);

            //Blue Bird
            BlueBird car1 = new BlueBird
            {
                ID      = "VH001",
                type    = "Limo",
                seats   = 4,
                baseFee = 6500,
                rate    = 4000
            };

            BlueBird car2 = new BlueBird
            {
                ID      = "VH002",
                type    = "Mobilio",
                seats   = 7,
                baseFee = 7500,
                rate    = 5000
            };

            BlueBird car3 = new BlueBird
            {
                ID      = "VH003",
                type    = "Transmover",
                seats   = 7,
                baseFee = 7500,
                rate    = 5000
            };

            BlueBird car4 = new BlueBird
            {
                ID      = "VH004",
                type    = "Serena",
                seats   = 6,
                baseFee = 7000,
                rate    = 4500
            };

            DB.conn.Store(car1);
            DB.conn.Store(car2);
            DB.conn.Store(car3);
            DB.conn.Store(car4);

            //Silver Bird
            SilverBird car5 = new SilverBird
            {
                ID      = "VH005",
                type    = "Mercedes C200",
                seats   = 4,
                baseFee = 13000,
                rate    = 7000
            };

            SilverBird car6 = new SilverBird
            {
                ID      = "VH006",
                type    = "Alphard",
                seats   = 7,
                baseFee = 17000,
                rate    = 9000
            };

            DB.conn.Store(car5);
            DB.conn.Store(car6);

            // Big Bird
            BigBird car7 = new BigBird
            {
                ID      = "VH007",
                type    = "Delta Long Chasis",
                seats   = 11,
                baseFee = 1170000,
                rate    = 1500000
            };

            BigBird car8 = new BigBird
            {
                ID      = "VH008",
                type    = "Delta Bus",
                seats   = 10,
                baseFee = 1170000,
                rate    = 1500000
            };

            BigBird car9 = new BigBird
            {
                ID      = "VH009",
                type    = "Commuter Bus",
                seats   = 14,
                baseFee = 1530000,
                rate    = 2000000
            };

            BigBird car10 = new BigBird
            {
                ID      = "VH010",
                type    = "Charlie Premium",
                seats   = 10,
                baseFee = 1530000,
                rate    = 2000000
            };

            BigBird car11 = new BigBird
            {
                ID      = "VH011",
                type    = "Bravo Bus",
                seats   = 25,
                baseFee = 1920000,
                rate    = 2500000
            };

            BigBird car12 = new BigBird
            {
                ID      = "VH012",
                type    = "Bravo Premium",
                seats   = 12,
                baseFee = 2720000,
                rate    = 3700000
            };

            BigBird car13 = new BigBird
            {
                ID      = "VH013",
                type    = "Alpha Bus 37",
                seats   = 37,
                baseFee = 2670000,
                rate    = 3500000
            };

            BigBird car14 = new BigBird
            {
                ID      = "VH014",
                type    = "Alpha Bus 44",
                seats   = 44,
                baseFee = 2670000,
                rate    = 3500000
            };

            BigBird car15 = new BigBird
            {
                ID      = "VH015",
                type    = "Alpha Bus 54",
                seats   = 54,
                baseFee = 2670000,
                rate    = 3500000
            };

            BigBird car16 = new BigBird
            {
                ID      = "VH016",
                type    = "Alpha Premium",
                seats   = 12,
                baseFee = 6100000,
                rate    = 8500000
            };

            DB.conn.Store(car7);
            DB.conn.Store(car8);
            DB.conn.Store(car9);
            DB.conn.Store(car10);
            DB.conn.Store(car11);
            DB.conn.Store(car12);
            DB.conn.Store(car13);
            DB.conn.Store(car14);
            DB.conn.Store(car15);
            DB.conn.Store(car16);
        }
Esempio n. 2
0
        private Sprite DeserializeModel(string objKey, ISaveState objSave)
        {
            // Add base sprite models here, (AnimatedSprite namespace, not Model namespace)
            Sprite         sp = null;
            OnGroundState  ogs;
            ShipState      ss;
            NpcState       npcs;
            StructureState sts;

            switch (objKey)
            {
            // TODO: Should I save fired ammo state?

            case "baseShip":
                ss = (ShipState)objSave;
                BaseShip bs = new BaseShip(ss.team, ss.region, ss.location, _content, _graphics);
                bs.health          = ss.health;
                bs.actionInventory = DeserializeInventory(ss.actionInventory);
                //bs.shipInterior = DeserializeInterior(ss.interiorState); we do this after models are created
                bs.playerAboard = ss.playerAboard;
                bs.SetInteriorForId(ss.shipId);
                if (bs.playerAboard)
                {
                    bs.shipSail.playerAboard = true;
                }
                return(bs);

            case "baseTribal":
                npcs = (NpcState)objSave;
                BaseTribal bt = new BaseTribal(npcs.team, npcs.region, npcs.location, _content, _graphics);
                bt.health    = npcs.health;
                bt.inventory = DeserializeInventory(npcs.inventory);
                return(bt);

            case "baseCat":
                npcs = (NpcState)objSave;
                BaseCat bct = new BaseCat(npcs.team, npcs.region, npcs.location, _content, _graphics);
                bct.health    = npcs.health;
                bct.inventory = DeserializeInventory(npcs.inventory);
                return(bct);

            case "chicken":
                npcs = (NpcState)objSave;
                Chicken chk = new Chicken(npcs.team, npcs.region, npcs.location, _content, _graphics);
                chk.health    = npcs.health;
                chk.inventory = DeserializeInventory(npcs.inventory);
                return(chk);

            case "blueBird":
                npcs = (NpcState)objSave;
                BlueBird bbr = new BlueBird(npcs.team, npcs.region, npcs.location, _content, _graphics);
                bbr.health    = npcs.health;
                bbr.inventory = DeserializeInventory(npcs.inventory);
                return(bbr);

            case "snake":
                npcs = (NpcState)objSave;
                Snake snk = new Snake(npcs.team, npcs.region, npcs.location, _content, _graphics);
                snk.health    = npcs.health;
                snk.inventory = DeserializeInventory(npcs.inventory);
                return(snk);

            case "teePee":
                sts = (StructureState)objSave;
                TeePee tp = new TeePee(sts.team, sts.region, sts.location, _content, _graphics);
                return(tp);

            case "baseBarrel":
                ogs = (OnGroundState)objSave;
                BaseBarrel bb = new BaseBarrel(ogs.team, ogs.region, ogs.location, _content, _graphics);
                bb.drops = DeserializeInventory(ogs.inventory);
                return(bb);

            case "baseChest":
                ogs = (OnGroundState)objSave;
                BaseChest bc = new BaseChest(ogs.team, ogs.region, ogs.location, _content, _graphics);
                bc.inventory = DeserializeInventory(ogs.inventory);
                return(bc);

            case "clayFurnace":
                ogs = (OnGroundState)objSave;
                ClayFurnace cf = new ClayFurnace(ogs.team, ogs.region, ogs.location, _content, _graphics);
                return(cf);

            case "campFire":
                ogs = (OnGroundState)objSave;
                CampFire caf = new CampFire(ogs.team, ogs.region, ogs.location, _content, _graphics);
                return(caf);

            case "craftingAnvil":
                ogs = (OnGroundState)objSave;
                CraftingAnvil ca = new CraftingAnvil(ogs.team, ogs.region, ogs.location, _content, _graphics);
                return(ca);
            }
            return(sp);
        }
Esempio n. 3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            var ID          = txtID.Text;
            var serviceType = cbService.SelectedIndex;
            var vehicleType = txtType.Text;
            var seats       = Int32.Parse(nudSeats.Value.ToString());
            var baseFee     = txtBaseFee.Text;
            var rate        = txtRate.Text;

            if (serviceType == 0)
            {
                MessageBox.Show("Service Type must be selected!");
            }
            else if (vehicleType.Equals(""))
            {
                MessageBox.Show("Vehicle Type can't be empty!");
            }
            else if (seats <= 0)
            {
                MessageBox.Show("Seats must be greater than 0!");
            }
            else if (baseFee.Equals(""))
            {
                MessageBox.Show("Base Fee can't be empty!");
            }
            else if (checkDigit(baseFee) != 0)
            {
                MessageBox.Show("Base Fee must be numeric!");
            }
            else if (Int32.Parse(baseFee) <= 0)
            {
                MessageBox.Show("Base Fee must be greater than 0!");
            }
            else if (rate.Equals(""))
            {
                MessageBox.Show("Rate can't be empty!");
            }
            else if (checkDigit(rate) != 0)
            {
                MessageBox.Show("Rate must be numeric!");
            }
            else if (Int32.Parse(rate) <= 0)
            {
                MessageBox.Show("Rate must be greater than 0!");
            }
            else
            {
                if (selectedButton == 1)
                {
                    if (serviceType == 1)
                    {
                        var checkType = (from BlueBird x in DB.conn
                                         where x.type == vehicleType
                                         select x).ToList();

                        if (checkType.Count != 0)
                        {
                            MessageBox.Show("Vehicle type already exists for this service type!");
                        }
                        else
                        {
                            BlueBird newVehicle = new BlueBird
                            {
                                ID      = ID,
                                type    = vehicleType,
                                seats   = seats,
                                baseFee = Int32.Parse(baseFee),
                                rate    = Int32.Parse(rate)
                            };

                            DB.conn.Store(newVehicle);

                            MessageBox.Show("Success");
                            resetInitial();
                        }
                    }
                    else if (serviceType == 2)
                    {
                        var checkType = (from SilverBird x in DB.conn
                                         where x.type == vehicleType
                                         select x).ToList();

                        if (checkType.Count != 0)
                        {
                            MessageBox.Show("Vehicle type already exists for this service type!");
                        }
                        else
                        {
                            SilverBird newVehicle = new SilverBird
                            {
                                ID      = ID,
                                type    = vehicleType,
                                seats   = seats,
                                baseFee = Int32.Parse(baseFee),
                                rate    = Int32.Parse(rate)
                            };

                            DB.conn.Store(newVehicle);

                            MessageBox.Show("Success");
                            resetInitial();
                        }
                    }
                    else if (serviceType == 3)
                    {
                        var checkType = (from BigBird x in DB.conn
                                         where x.type == vehicleType
                                         select x).ToList();

                        if (checkType.Count != 0)
                        {
                            MessageBox.Show("Vehicle type already exists for this service type!");
                        }
                        else
                        {
                            BigBird newVehicle = new BigBird
                            {
                                ID      = ID,
                                type    = vehicleType,
                                seats   = seats,
                                baseFee = Int32.Parse(baseFee),
                                rate    = Int32.Parse(rate)
                            };

                            DB.conn.Store(newVehicle);

                            MessageBox.Show("Success");
                            resetInitial();
                        }
                    }
                }
                else if (selectedButton == 2)
                {
                    var updateVehicle = (from Vehicle x in DB.conn
                                         where x.ID == ID
                                         select x).FirstOrDefault();

                    updateVehicle.type    = vehicleType;
                    updateVehicle.seats   = seats;
                    updateVehicle.baseFee = Int32.Parse(baseFee);
                    updateVehicle.rate    = Int32.Parse(rate);

                    DB.conn.Store(updateVehicle);

                    MessageBox.Show("Success!");

                    resetInitial();
                }
            }
        }
Esempio n. 4
0
        // Creates the initial game state - this will probably be a huge method at the end of it.. TODO: find way to dynamically create items/npc/etc and place them in appropriate region
        public void CreateNewGame()
        {
            //TEMPORARY NEED TO CREATE SOME SORT OF GAME SETUP / REGION SETUP that is easily scalable
            List <Sprite> giannaLandTiles = BoundingBoxLocations.RegionMap["Gianna"].RegionLandTiles;
            List <Sprite> scLandTiles     = BoundingBoxLocations.RegionMap["SnooCat"].RegionLandTiles;
            List <Sprite> usoppLandTiles  = BoundingBoxLocations.RegionMap["Usopp"].RegionLandTiles;
            var           screenCenter    = new Vector2(_graphics.Viewport.Bounds.Width / 2, _graphics.Viewport.Bounds.Height / 2);

            ShortShip shortShip = new ShortShip(TeamType.Player, "GustoMap", new Vector2(-100, -600), _content, _graphics);

            shortShip.shipInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(shortShip.shipInterior.interiorId, shortShip.shipInterior);

            BaseShip baseShip = new BaseShip(TeamType.Player, "GustoMap", new Vector2(-300, -600), _content, _graphics);

            baseShip.shipInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(baseShip.shipInterior.interiorId, baseShip.shipInterior);

            BaseShip baseShipAI = new BaseShip(TeamType.A, "Usopp", new Vector2(500, -140), _content, _graphics);

            baseShipAI.shipInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(baseShipAI.shipInterior.interiorId, baseShipAI.shipInterior);

            TeePee teePee = new TeePee(TeamType.A, "Gianna", new Vector2(340, -850), _content, _graphics);

            teePee.structureInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(teePee.structureInterior.interiorId, teePee.structureInterior);

            BaseTribal    baseTribalLand = new BaseTribal(TeamType.A, "Gianna", giannaLandTiles[RandomEvents.rand.Next(giannaLandTiles.Count)].location, _content, _graphics);
            BaseCat       baseCatLand    = new BaseCat(TeamType.B, "SnooCat", scLandTiles[RandomEvents.rand.Next(scLandTiles.Count)].location, _content, _graphics);
            Chicken       chickenLand    = new Chicken(TeamType.Animal, "Gianna", giannaLandTiles[RandomEvents.rand.Next(giannaLandTiles.Count)].location, _content, _graphics);
            Snake         snakeLand      = new Snake(TeamType.Animal, "Usopp", usoppLandTiles[RandomEvents.rand.Next(usoppLandTiles.Count)].location, _content, _graphics);
            BlueBird      blueBird       = new BlueBird(TeamType.Animal, "Usopp", usoppLandTiles[RandomEvents.rand.Next(usoppLandTiles.Count)].location, _content, _graphics);
            Tower         tower          = new BaseTower(TeamType.B, "GustoMap", new Vector2(-1600, -1500), _content, _graphics);
            ClayFurnace   furnace        = new ClayFurnace(TeamType.Player, "GustoMap", new Vector2(180, 140), _content, _graphics);
            CraftingAnvil craftingAnvil  = new CraftingAnvil(TeamType.Player, "GustoMap", new Vector2(120, 40), _content, _graphics);
            BaseBarrel    barrelLand     = new BaseBarrel(TeamType.A, "GustoMap", new Vector2(-20, -160), _content, _graphics);
            BaseBarrel    barrelOcean    = new BaseBarrel(TeamType.A, "GustoMap", new Vector2(380, -90), _content, _graphics);
            BaseChest     chestLand      = new BaseChest(TeamType.A, "GustoMap", new Vector2(100, -120), _content, _graphics);
            CampFire      campfire       = new CampFire(TeamType.A, "GustoMap", new Vector2(70, -350), _content, _graphics);

            Shovel shovel = new Shovel(TeamType.A, "GustoMap", new Vector2(200, -330), _content, _graphics);

            shovel.onGround = true;
            Pickaxe pickaxe = new Pickaxe(TeamType.Player, "GustoMap", new Vector2(130, -430), _content, _graphics);

            pickaxe.onGround = true;
            //Pistol pistol = new Pistol(TeamType.A, "GustoMap", new Vector2(250, -300), _content, _graphics);
            //pistol.amountStacked = 1;
            //pistol.onGround = true;
            BaseCannon cannon = new BaseCannon(TeamType.A, "GustoMap", new Vector2(0, -450), _content, _graphics);

            cannon.onGround = true;
            Ballista ballista = new Ballista(TeamType.A, "GustoMap", new Vector2(-120, -550), _content, _graphics);

            ballista.onGround = true;
            CrossBow crossBow = new CrossBow(TeamType.A, "GustoMap", new Vector2(220, -350), _content, _graphics);

            crossBow.amountStacked = 1;
            crossBow.onGround      = true;
            ArrowItem arrows = new ArrowItem(TeamType.A, "GustoMap", new Vector2(210, -340), _content, _graphics);

            arrows.onGround      = true;
            arrows.amountStacked = 10;
            //PistolShotItem pistolAmmo = new PistolShotItem(TeamType.A, "GustoMap", new Vector2(220, -300), _content, _graphics);
            //pistolAmmo.amountStacked = 14;
            //pistolAmmo.onGround = true;
            CannonBallItem cannonAmmo = new CannonBallItem(TeamType.A, "GustoMap", new Vector2(200, -300), _content, _graphics);

            cannonAmmo.amountStacked = 10;
            cannonAmmo.onGround      = true;
            RustyHarpoonItem harpoonAmmo = new RustyHarpoonItem(TeamType.A, "GustoMap", new Vector2(-120, -550), _content, _graphics);

            harpoonAmmo.amountStacked = 10;
            harpoonAmmo.onGround      = true;
            Lantern lantern = new Lantern(TeamType.A, "GustoMap", new Vector2(180, -300), _content, _graphics);

            lantern.onGround = true;
            BasePlank basePlank = new BasePlank(TeamType.A, "GustoMap", new Vector2(150, -300), _content, _graphics);

            basePlank.onGround      = true;
            basePlank.amountStacked = 10;

            // Item utility is global and is accessed in main update, all items that are "dropped" or placed on the world view ground exist in this list (placable, invetory, etc)
            ItemUtility.ItemsToUpdate.Add(lantern);
            ItemUtility.ItemsToUpdate.Add(furnace);
            ItemUtility.ItemsToUpdate.Add(craftingAnvil);
            ItemUtility.ItemsToUpdate.Add(barrelLand);
            ItemUtility.ItemsToUpdate.Add(barrelOcean);
            ItemUtility.ItemsToUpdate.Add(chestLand);
            ItemUtility.ItemsToUpdate.Add(shovel);
            //ItemUtility.ItemsToUpdate.Add(pistol);
            ItemUtility.ItemsToUpdate.Add(cannon);
            ItemUtility.ItemsToUpdate.Add(ballista);
            ItemUtility.ItemsToUpdate.Add(crossBow);
            ItemUtility.ItemsToUpdate.Add(arrows);
            ItemUtility.ItemsToUpdate.Add(pickaxe);
            //ItemUtility.ItemsToUpdate.Add(pistolAmmo);
            ItemUtility.ItemsToUpdate.Add(cannonAmmo);
            ItemUtility.ItemsToUpdate.Add(harpoonAmmo);
            ItemUtility.ItemsToUpdate.Add(basePlank);
            ItemUtility.ItemsToUpdate.Add(campfire);

            UpdateOrder.Add(shortShip);
            UpdateOrder.Add(baseShip);
            UpdateOrder.Add(baseShipAI);
            UpdateOrder.Add(player);
            UpdateOrder.Add(baseTribalLand);
            UpdateOrder.Add(baseCatLand);
            UpdateOrder.Add(chickenLand);
            UpdateOrder.Add(blueBird);
            UpdateOrder.Add(snakeLand);
            UpdateOrder.Add(tower);
            UpdateOrder.Add(teePee);

            // interior set
            BaseTribal baseTribalInShip = new BaseTribal(TeamType.A, "GustoMap", Vector2.Zero, _content, _graphics);

            baseTribalInShip.npcInInterior = baseShipAI.shipInterior;
            baseShipAI.shipInterior.interiorObjects.Add(baseTribalInShip);

            ready = true;
        }