Inheritance: MonoBehaviour
Exemple #1
0
    public MainHub(MainGame tempGame) : base("Sprites/MainHub.png", 32, 24, "Sprites/MainHub.png", 32, 24, "colors.png", 1, 1, tempGame)
    {
        FileName = @"Screens/MainHub/MainHub.tmx";

        Map _levelData = MapParser.ReadMap(FileName);

        SpawnCollisionTiles(_levelData);
        SpawnBackgroundTiles(_levelData, true);
        SpawnObjects(_levelData);
        SpawnOverlapTiles(_levelData);

        _game       = tempGame;
        _displayTut = _game.DisplayTutorial;

        _tickets = new TicketDisplay(_game);
        AddChild(_tickets);

        _clock = new Clock();
        AddChild(_clock);

        if (_displayTut)
        {
            _c = new ConversationBox("Text/Tutorial.txt", this);
            AddChild(_c);
        }

        FirstInstance = false;

        _shopKeeper = new ShopKeeper();
        AddChild(_shopKeeper);
    }
Exemple #2
0
        public IHttpActionResult PutShopKeeper(int id, ShopKeeper shopKeeper)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != shopKeeper.ID)
            {
                return(BadRequest());
            }

            db.Entry(shopKeeper).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ShopKeeperExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        if (networkView.isMine)
        {
            myTransform        = transform;
            firePointTransform = myTransform.FindChild("FirePoint");
            menu  = GameObject.Find("MultiplayerManager").GetComponent <Menu>();
            inv   = gameObject.GetComponent <InventoryGrid>();
            sk    = gameObject.GetComponent <ShopKeeper>();
            spawn = GameObject.Find("SpawnManager").GetComponent <SpawnScript>();

            if (spawn.amIOnTheRedTeam)
            {
                iAmOnTheRedTeam = true;
            }
            if (spawn.amIOnTheBlueTeam)
            {
                iAmOnTheBlueTeam = true;
            }
        }
        else
        {
            enabled = false;
        }
        source = gameObject.GetComponent <AudioSource>();
    }
        /// <summary>
        /// Flips the player on the x-axis
        /// Can't rotate because it would put it upside down
        /// </summary>
        /// <param name="textureToFlip"></param>
        /// <param name="player"></param>
        /// <returns></returns>
        /// <seealso cref="http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Texture_to_Colors.php"/>
        /// <seealso cref="https://gamedev.stackexchange.com/questions/89567/texture2d-setdata-method-overload"/>
        /// <seealso cref="https://www.khanacademy.org/math/linear-algebra/matrix-transformations/lin-trans-examples/v/linear-transformation-examples-scaling-and-reflections"/>
        public static Texture2D FlipTexture(Texture2D textureToFlip, ShopKeeper player)
        {
            int width  = textureToFlip.Width;
            int height = textureToFlip.Height;

            Color[] colors1D = new Color[textureToFlip.Width * textureToFlip.Height];
            Color[] flipped  = new Color[(textureToFlip.Width) * textureToFlip.Height];
            textureToFlip.GetData(colors1D);
            float[,] reflectionMatrix = GenerateReflectionMatrix(3);
            for (float y = 0; y < textureToFlip.Height; y++)
            {
                for (float x = 0; x < textureToFlip.Width; x++)
                {
                    float   point  = (x) + (textureToFlip.Width) * y;
                    Vector2 newPos = calculateNewPos(x, y, reflectionMatrix, textureToFlip.Width);
                    //flipped[Convert.ToInt32(point)] = colors1D[Convert.ToInt32(point)];
                    if ((int)newPos.Y != 0)
                    {
                        if ((int)newPos.X * (int)newPos.Y != 0)
                        {
                            float reflectedpoint = (newPos.X) + (textureToFlip.Width) * newPos.Y;
                            flipped[Convert.ToInt32(point)] = colors1D[Convert.ToInt32(reflectedpoint) - 1];
                        }
                    }
                }
            }
            Texture2D newTexture = new Texture2D(textureToFlip.GraphicsDevice, textureToFlip.Width, textureToFlip.Height);

            newTexture.SetData(0, new Rectangle(0, 0, width, height), flipped, 0, textureToFlip.Width * textureToFlip.Height);
            return(newTexture);
        }
 public InputHandler(Game game, ShopKeeper player) : base(game)
 {
     this.keyboard  = new KeyboardHandler(this);
     this.mouse     = new MouseHandler();
     this.player    = player;
     this.Direction = new Vector2(0, 0);
 }
Exemple #6
0
    public void OnGUI()
    {
        /*
         * float screenWidth	= (float)Screen.width;
         * float screenHeight	= (float)Screen.height;
         *
         * float currentAspectRatio	= screenWidth/screenHeight;
         * float f16by9				= 16.0f/9.0f;
         *
         * if(currentAspectRatio < f16by9)
         * {
         *      float ph = (screenHeight - screenWidth*9.0f/16.0f)*0.5f;
         *
         *      Texture2D image = Resources.Load(Game.skillData[0].enabled) as Texture2D;
         *
         *      GUIStyle pillarStyle = new GUIStyle();
         *      pillarStyle.normal.background = image;
         *      GUI.color = new Color(0.0f,0.0f,0.0f,1.0f);
         *
         *      GUI.Box(new Rect(0,0,screenWidth,ph),"",pillarStyle);
         *      GUI.Box(new Rect(0,screenHeight-ph,screenWidth,ph),"",pillarStyle);
         *
         * }
         */

        if (currentShopKeeper != SHOPKEEPERWINDOW.NONE && Game.game.currentDialog == null)
        {
            GUI.color = Color.white;
            ShopKeeper shopKeeper = this.gameObject.GetComponent(SHOPKEEPERCOMPONENTS[(int)currentShopKeeper]) as ShopKeeper;
            shopKeeper.initializeWindows();
            shopKeeper.showShopping();
        }
    }
Exemple #7
0
        public void RequestAnticipationTest()
        {
            ShopKeeper shopKeeper = new ShopKeeper()
            {
                Name = "Mario"
            };

            _shopKeeperRepository.Insert(shopKeeper);
            _shopKeeperRepository.SaveChanges();

            Transaction transaction = new Transaction()
            {
                AcquirerApproval   = true,
                TransactionDate    = DateTime.Now,
                PassThroughValue   = 0,
                PassThroughDate    = DateTime.Now,
                TransactionValue   = 1000,
                InstalmentQuantity = 2
            };

            Transaction transaction2 = new Transaction()
            {
                AcquirerApproval   = true,
                TransactionDate    = DateTime.Now,
                PassThroughValue   = 0,
                PassThroughDate    = DateTime.Now,
                TransactionValue   = 600,
                InstalmentQuantity = 4
            };


            Transaction transaction3 = new Transaction()
            {
                AcquirerApproval   = true,
                TransactionDate    = DateTime.Now,
                PassThroughValue   = 0,
                PassThroughDate    = DateTime.Now,
                TransactionValue   = 600,
                InstalmentQuantity = 4
            };

            _context.Transactions.Add(transaction);
            _context.Transactions.Add(transaction2);
            _context.Transactions.Add(transaction3);
            _context.SaveChanges();

            RequestedTransactionsDTO dto = new RequestedTransactionsDTO()
            {
                ShopKeeperID   = shopKeeper.ShopKeeperID,
                TransactionIDs = new List <int>()
                {
                    transaction.TransactionID, transaction2.TransactionID
                }
            };

            var result = _controller.RequestAnticipation(dto) as CreatedAtActionResult;

            Assert.NotNull(result);
        }
 public static void DisplayHeader(ShopKeeper shopKeeper)
 {
     DrawShopKeep(shopKeeper.Cart.ForSale, shopKeeper.Cart.Capacity);
     ConsoleIO.WriteWithColor($"Name     : {shopKeeper.Name}\n", ConsoleColor.Cyan);
     ConsoleIO.WriteWithColor($"Distance : {shopKeeper.DistanceTraveled} miles\n", ConsoleColor.Cyan);
     ConsoleIO.WriteWithColor($"Gold     : {shopKeeper.Gold}$\n", ConsoleColor.Cyan);
     ConsoleIO.WriteWithColor("============================================\n", ConsoleColor.Cyan);
 }
        public static void UpdateCart(ShopKeeper shopKeeper)
        {
            int x = Console.GetCursorPosition().Left;
            int y = Console.GetCursorPosition().Top;

            Console.SetCursorPosition(0, 0);
            DrawShopKeep(shopKeeper.Cart.ForSale, shopKeeper.Cart.Capacity);
            Console.SetCursorPosition(x, y);
        }
 public GameScreen(Game game, ShopKeeper player) : base(game)
 {
     Rotate      = 0;
     this.game   = game;
     Direction   = new Vector2(0, 0);
     this.player = player;
     canvas      = new GameCanvas(game, player);
     canvas.Initialize();
 }
Exemple #11
0
 public MonoGamePage(Game game, ShopKeeper player) : base(game, player)
 {
     RenderRecipe       = true;
     this.CraftablePage = false;
     this.Rotate        = 0;
     this.game          = game;
     this.Direction     = new Vector2(0, 0);
     this.player        = player;
     someInventory      = player.inventory;
 }
        public static void UpdateStats(ShopKeeper shopKeeper)
        {
            int x = Console.GetCursorPosition().Left;
            int y = Console.GetCursorPosition().Top;

            Console.SetCursorPosition(0, 8);
            ConsoleIO.WriteWithColor($"Name     : {shopKeeper.Name}\n", ConsoleColor.Cyan);
            ConsoleIO.WriteWithColor($"Distance : {shopKeeper.DistanceTraveled} miles\n", ConsoleColor.Cyan);
            ConsoleIO.WriteWithColor($"Gold     : {shopKeeper.Gold}\n", ConsoleColor.Cyan);
            Console.SetCursorPosition(x, y);
        }
Exemple #13
0
        public IHttpActionResult GetShopKeeper(int id)
        {
            ShopKeeper shopKeeper = db.ShopKeepers.Find(id);

            if (shopKeeper == null)
            {
                return(NotFound());
            }

            return(Ok(shopKeeper));
        }
        //category list!
        public ActionResult CategoryIndex(int idshop)
        {
            TempData["ID"]       = idshop;
            TempData["backlist"] = idshop;
            ShopKeeper s = db1.ShopKeepers.Where(x => x.ShopID == idshop).FirstOrDefault();

            login = s.LoginId;
            ViewData["personshop"] = login;

            return(View(db1.Categories.ToList().Where(x => x.ShopID == idshop)));
        }
Exemple #15
0
    protected override void OnExecute()
    {
        ShopKeeper sk = agent.GetComponent <ShopKeeper>();

        sk.item_being_placed = Random.Range(0, 10);

        sk.stock_item_objs.transform.GetChild(sk.item_being_placed).gameObject.SetActive(true);

        GameController.total_stock--;

        EndAction();
    }
Exemple #16
0
        public IHttpActionResult PostShopKeeper(ShopKeeper shopKeeper)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ShopKeepers.Add(shopKeeper);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = shopKeeper.ID }, shopKeeper));
        }
Exemple #17
0
 public Snake(string _id, ContentManager _content, ShopKeeper _Shopkeeper, FileManager _Filemanager, JukeBox _Jukebox, float screenX, float screenY) : base(_id, _content, _Shopkeeper, _Filemanager, _Jukebox, screenX, screenY)
 {
     id = _id;
     CM = _content;
     SK = _Shopkeeper;
     FM = _Filemanager;
     JK = _Jukebox;
     screensize_width        = (int)SK.screensize_main.X;
     screensize_height       = (int)SK.screensize_main.Y;
     screensize_width_scale  = screenX;
     screensize_height_scale = screenY;
     random = new Random();
 }
 public static ShopKeeper shopkeeper;//NOTE Not the way to do this but I ran out of time
 public CollidableGameObject(Game game, WorldManager world) : base(game)
 {
     Rotation = 0;
     if (shopkeeper == null)
     {
         if (this.GetType() == typeof(ShopKeeper))
         {
             shopkeeper = (ShopKeeper)this;
         }
     }
     Position   = new Vector2(0, 0);
     Direction  = new Vector2(0, 0);
     this.world = world;
 }
Exemple #19
0
        public IHttpActionResult DeleteShopKeeper(int id)
        {
            ShopKeeper shopKeeper = db.ShopKeepers.Find(id);

            if (shopKeeper == null)
            {
                return(NotFound());
            }

            db.ShopKeepers.Remove(shopKeeper);
            db.SaveChanges();

            return(Ok(shopKeeper));
        }
Exemple #20
0
    protected override void OnExecute()
    {
        //GameController.C_points.Remove(client.current_point.gameObject);
        GameController.SK_needs_restock.Remove(agent.GetComponent <ShopKeeper>().current_place_point.gameObject);
        ShopKeeper sk = agent.GetComponent <ShopKeeper>();

        for (int i = 0; i < sk.stock_item_objs.transform.childCount; i++)
        {
            sk.stock_item_objs.transform.GetChild(i).gameObject.SetActive(false);
        }
        //sk.stock_item_objs.transform.GetChild(sk.item_being_placed).gameObject.SetActive(false);

        EndAction();
    }
Exemple #21
0
 // Use this for initialization
 void Start()
 {
     if (networkView.isMine)
     {
         shop = gameObject.GetComponent <ShopKeeper>();
         inv  = gameObject.GetComponent <InventoryGrid>();
         Transform triggerTransform = transform.FindChild("Trigger");
         HDScript    = triggerTransform.GetComponent <HealthAndDamage>();
         manaScript  = gameObject.GetComponent <Mana>();
         playerStats = gameObject.GetComponent <PlayerStats>();
         move        = gameObject.GetComponent <PointAndClickMovement>();
     }
     else
     {
         enabled = false;
     }
 }
Exemple #22
0
    protected override void OnExecute()
    {
        int c = -1;

        Vector3 where = Cashier.PickAvailableForSK(out c);
        ShopKeeper sk = agent.GetComponent <ShopKeeper>();

        if (c >= 0)
        {
            sk.target_cashier = where;
            sk.queue          = c;
        }
        else
        {
            sk.is_reclamed = false;
        }

        EndAction();
    }
 public ActionResult Create3(ShopKeeper c)
 {
     c.LoginId = Convert.ToInt32(TempData["log"]);
     c.ShopID  = Convert.ToInt32(TempData["shop"]);
     if (c.ImageFile2 != null)
     {
         c.picture = new byte[c.ImageFile2.ContentLength];
         c.ImageFile2.InputStream.Read(c.picture, 0, c.ImageFile2.ContentLength);
         var result10 = db.ShopKeepers.Add(c);
         db.SaveChanges();
         return(RedirectToAction("Create4", new { @id1 = c.ShopID }));
     }
     else
     {
         var result6 = db.ShopKeepers.Add(c);
         db.SaveChanges();
         return(RedirectToAction("Create4", new { @id1 = c.ShopID }));
     }
     return(View());
 }
    void Start()
    {
        if (networkView.isMine == true)
        {
            controller          = GetComponent <CharacterController>();
            teamSelectionScript = GameObject.Find("SpawnManager").GetComponent <CharacterSelection>();
            spawn   = GameObject.Find("SpawnManager").GetComponent <SpawnScript>();
            plstats = gameObject.GetComponent <PlayerStats>();
            inv     = gameObject.GetComponent <InventoryGrid>();
            sk      = gameObject.GetComponent <ShopKeeper>();
            menu    = GameObject.Find("MultiplayerManager").GetComponent <Menu>();

            defaultSpeed = plstats.speedStat;
            currentSpeed = defaultSpeed;
        }
        else
        {
            enabled = false;
        }
    }
Exemple #25
0
    void Awake()
    {
        int    len    = transform.name.Length;
        string strInd = transform.name.Substring(len - 7);

        index[0] = strInd[1] - 48;
        index[1] = strInd[5] - 48;

        mannequin = transform.GetChild(0).gameObject;
        mqImg     = mannequin.GetComponent <Image>();

        price = transform.GetChild(1).gameObject;
        text  = price.GetComponent <Text>();

        sk = transform.parent.gameObject.GetComponent <ShopKeeper>();
        n  = index[0] * 5 + index[1];

        try   { SetPreview(sk.inventory[n]); }
        catch (System.IndexOutOfRangeException e) {
            mannequin.SetActive(false);
            price.SetActive(false);
        }
    }
Exemple #26
0
 public MonoGameFurnace(Game game, ShopKeeper player, SpriteBatch sb) : base(game, player)
 {
     this.canvas      = new CraftingCanvas(game, this.GetType().Name);
     this.crafting    = new Furnace(player.inventory);
     this.spriteBatch = sb;
 }
Exemple #27
0
 public ScreenManager(Game game, ShopKeeper player) : base(game)
 {
     screenState = ScreenStateEnum.Game;
     this.player = player;
 }
Exemple #28
0
        public override void End()
        {
            CalloutRunning = false;
            Rage.Native.NativeFunction.Natives.CLEAR_PED_NON_CREATION_AREA();
            NativeFunction.Natives.SET_STORE_ENABLED(true);
            if (Game.LocalPlayer.Character.Exists())
            {
                if (Game.LocalPlayer.Character.IsDead)
                {
                    GameFiber.Wait(1500);
                    Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE");
                    GameFiber.Wait(3000);
                    if (ComputerPlusRunning)
                    {
                        API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Officer down. Urgent assistance required.");
                    }
                }
            }
            else
            {
                GameFiber.Wait(1500);
                Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE");
                GameFiber.Wait(3000);
                if (ComputerPlusRunning)
                {
                    API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Officer down. Urgent assistance required.");
                }
            }
            base.End();
            if (SearchArea.Exists())
            {
                SearchArea.Delete();
            }

            if (CalloutFinished)
            {
                foreach (Ped ShopKeeper in ShopKeepers)
                {
                    if (ShopKeeper.Exists())
                    {
                        ShopKeeper.Tasks.Clear(); ShopKeeper.IsPersistent = false;
                    }
                }
                foreach (Ped suspect in Suspects)
                {
                    if (suspect.Exists())
                    {
                        Suspect.IsPersistent = false;
                    }
                }
                foreach (Rage.Object MoneyBag in MoneyBags)
                {
                    if (MoneyBag.Exists())
                    {
                        MoneyBag.Detach();
                        MoneyBag.Dismiss();
                    }
                }
                if (EscapeVanDriver.Exists())
                {
                    EscapeVanDriver.IsPersistent = false;
                }
                if (EscapeVan.Exists())
                {
                    EscapeVan.Dismiss();
                }
            }
            else
            {
                foreach (Ped ShopKeeper in ShopKeepers)
                {
                    if (ShopKeeper.Exists())
                    {
                        ShopKeeper.Delete();
                    }
                }
                foreach (Rage.Object MoneyBag in MoneyBags)
                {
                    if (MoneyBag.Exists())
                    {
                        MoneyBag.Delete();
                    }
                }
                foreach (Ped suspect in Suspects)
                {
                    if (suspect.Exists())
                    {
                        suspect.Delete();
                    }
                }
                if (EscapeVan.Exists())
                {
                    EscapeVan.Delete();
                }
                if (EscapeVanDriver.Exists())
                {
                    EscapeVanDriver.Delete();
                }
            }
        }
 public void MovePlayer(GameTime gameTime, ShopKeeper player)
 {
     player.Move(speed, gameTime);
 }
 public GameCanvas(Game game, ShopKeeper player) : base(game)
 {
     this.player = player;
     ScreenText  = new List <Text>();
     buttons     = new List <Button>();
 }