public void Activate()
    {
        gameObject.SetActive(true);
        BigInteger prizeTickets = ArcadeManager.ReadArcadeStatus().ArcadePrizeStatus.Tickets;

        prizeText.text = GameOperations.BigIntToString(prizeTickets);
    }
    public void Activate()
    {
        pawnStatus   = PawnManager.ReadPawnStatus();
        arcadeStatus = ArcadeManager.ReadArcadeStatus();
        printers     = new List <TicketPrinter>();
        for (int i = 0; i < pawnStatus.Printers.Count; i++)
        {
            if (pawnStatus.Printers[i].IsActive)
            {
                printers.Add(pawnStatus.Printers[i]);
                ValidatePrinter(pawnStatus.Printers[i]);
            }
        }
        walletText.text = GameOperations.BigIntToString(pawnStatus.Money);

        UpdateFromReturn();
        // Temp until Scroll
        for (int i = 0; i < ticketPrinterUIs.Count; i++)
        {
            ticketPrinterUIs[i].ActivePrinter = pawnStatus.Printers[i];
            ticketPrinterUIs[i].Populate();
        }

        gameObject.SetActive(true);
        buyPopUp.SetActive(false);
        upgradePopUp.SetActive(false);

        GetComponent <PrinterTrader>().CloseTradeInPopUp();
    }
示例#3
0
    // New Segments are being added too close to the head. Figure out when it should start moving
    public void AddBodySegment()
    {
        GameObject newPiece = Instantiate(bodySegment, tailSegment.transform.position, UnityEngine.Quaternion.identity);

        newPiece.transform.SetParent(transform);
        SNKPlayerBodySegment newSegment = newPiece.GetComponent <SNKPlayerBodySegment>();
        SNKPlayerBodySegment prevTail   = tailSegment;

        // Set the previously last body segment before the tail to be ahead of the newest body segment
        prevTail.Behind  = newSegment;
        newSegment.Ahead = prevTail;

        if (prevTail != headSegment)
        {
            prevTail.GetComponent <SpriteRenderer>().sprite = GameOperations.LoadSpriteFromPath("Sprites/ArcadeCabinets/SNK/CenterSegment3");
        }

        // Set the tail segment to be the new segment
        tailSegment          = newSegment;
        newSegment.BodyIndex = bodyLength++;

        health.IncrementMaxHealth(healthPerSegment);

        // update speed
        Speed *= 1.01f;
    }
示例#4
0
    private void ApplyLuck()
    {
        BigInteger amtToAdd = 0;

        amtToAdd += BatchSize;
        // calculate how many to add, given luck (Better way to do this?????)
        if (BatchSize < 100)
        {
            // at low sizes
            int random = UnityEngine.Random.Range(0, 100);
            if (random < Luck)
            {
                amtToAdd *= 2;
            }
        }
        else
        {
            // at large sizes
            int percentage = UnityEngine.Random.Range(0, Luck) + 100;
            amtToAdd *= percentage;
            amtToAdd /= 100;
        }

        Debug.Log("Luck was applied, you should have gotten " + GameOperations.BigIntToString(amtToAdd));
        TicketsPrinted += amtToAdd;
    }
        public async Task <ActionResult <Session> > Create()
        {
            UserModel user = await userManager.GetUserAsync(HttpContext.User);

            if (user?.UserId == null)
            {
                return(StatusCode(StatusCodes.Status403Forbidden));
            }

            Session session = SessionFactory.Create(user);

            await sessionService.Create(session);

            Game game = new Game {
                Id = session.Id
            };

            Board board = BoardFactory.New(session.Id);

            GameOperations.AddPlayer(game, user.UserId);


            await gameService.Create(game);

            await boardService.Create(board);

            user.AddSession(session);
            await userManager.UpdateAsync(user);

            return(CreatedAtRoute("GetSession", new { id = session.Id }, session));
        }
示例#6
0
 private Sprite GetTicketSprite(CabinetStatus status)
 {
     if (status is DebugCabinetStatus)
     {
         return(GameOperations.LoadSpriteFromPath("Sprites/Currency/Tickets/DebugTicket"));
     }
     if (status is QMGCabinetStatus)
     {
         return(GameOperations.LoadSpriteFromPath("Sprites/Currency/Tickets/QMGTicket"));
     }
     if (status is KNGCabinetStatus)
     {
         return(GameOperations.LoadSpriteFromPath("Sprites/Currency/Tickets/KNGTicket"));
     }
     if (status is BRDCabinetStatus)
     {
         return(GameOperations.LoadSpriteFromPath("Sprites/Currency/Tickets/BRDTicket"));
     }
     if (status is SNKCabinetStatus)
     {
         return(GameOperations.LoadSpriteFromPath("Sprites/Currency/Tickets/SNKTicket"));
     }
     // This is bad if this happens double check.
     return(null);
 }
 public void Activate()
 {
     gameObject.SetActive(true);
     closePopUp();
     pawnStatus     = PawnManager.ReadPawnStatus();
     arcadeStatus   = ArcadeManager.ReadArcadeStatus();
     moneyText.text = GameOperations.BigIntToString(pawnStatus.Money);
 }
 public void Repopulate()
 {
     for (int i = 0; i < ticketPrinterUIs.Count; i++)
     {
         ticketPrinterUIs[i].Populate();
     }
     walletText.text = GameOperations.BigIntToString(pawnStatus.Money);
 }
    public void Populate(int number, int currentLevel, int maxLevel)
    {
        // display number
        valueText.text = GameOperations.BigIntToString(new BigInteger(number));

        // do scaling for the slider
        slider.value = ((float)currentLevel) / ((float)maxLevel);
    }
    public void initializePopUp()
    {
        // calculate the money to receive
        calculateMoneyToReceive();

        popUp.SetActive(true);
        descriptionText.text = "Best I Can Do Is:\n$" + GameOperations.BigIntToString(moneyToReceive);
    }
示例#11
0
        static void Main(string[] args)
        {
            Customer customer = new Customer();

            customer.CustomerId        = 1;
            customer.CustomerFırstName = "ALI";
            customer.CustomerLastName  = "VELI";
            customer.CustomerNıckName  = "ALI-1";
            customer.CustomerCıty      = "ARTVIN";
            customer.CustomerAge       = 20;
            Customer customer1 = new Customer();

            customer1.CustomerId        = 2;
            customer1.CustomerFırstName = "AHMET";
            customer1.CustomerLastName  = "MEHMET";
            customer1.CustomerNıckName  = "AHMET-1";
            customer1.CustomerCıty      = "KARS";
            customer1.CustomerAge       = 38;

            Customer customer2 = new Customer();

            customer.CustomerId        = 3;
            customer.CustomerFırstName = "HASAN";
            customer.CustomerLastName  = "HUSEYIN";
            customer.CustomerNıckName  = "HASAN-1";
            customer.CustomerCıty      = "ANTALYA";
            customer.CustomerAge       = 16;

            Game game = new Game();

            game.GameId    = 111;
            game.GameName  = "GAME-1";
            game.GamePrice = 0;

            Game game1 = new Game();

            game1.GameId    = 222;
            game1.GameName  = "GAME-2";
            game1.GamePrice = 1;

            Game game2 = new Game();

            game2.GameId    = 333;
            game2.GameName  = "GAME-3";
            game2.GamePrice = 2;

            CustomerOperations customerOperations = new CustomerOperations();

            customerOperations.CustomerAdd(customer);
            customerOperations.CustomerDelete(customer1);
            customerOperations.CustomerUpdate(customer2);

            GameOperations gameOperatıons = new GameOperations();

            gameOperatıons.GameAdd(game);
            gameOperatıons.GameDelete(game1);
            gameOperatıons.GameUpdate(game2);
        }
 public void populate()
 {
     gameObject.SetActive(true);
     image.sprite    = Resources.Load <Sprite>(activeConvert.sprite);
     nameText.text   = activeConvert.gameName;
     inputText.text  = GameOperations.BigIntToString(activeConvert.inputAmount);
     outputText.text = GameOperations.BigIntToString(activeConvert.outputAmount);
     countText.text  = GameOperations.BigIntToString(activeConvert.getCount());
 }
示例#13
0
    public void SelfCollide(SNKPlayerBodySegment collidedSegment)
    {
        // TODO: Implement breaking off part that collides.
        // Set Ahead of the collided to the tail
        // for loop through body and destroy gameobjects
        // make sure length if correct.

        /*
         * isSelfColliding = true;
         * tailSegment = collidedSegment.Ahead;
         * tailSegment.Behind = null;
         * int segementsLost = bodyLength - collidedSegment.BodyIndex;
         * tailSegment.GetComponent<SpriteRenderer>().sprite = GameOperations.LoadSpriteFromPath("Sprites/ArcadeCabinets/SNK/TailSegment");
         * int segmentNum = collidedSegment.BodyIndex;
         * SNKPlayerBodySegment nextSegment = collidedSegment;
         * if (!isDeleting)
         * {
         *  isDeleting = true;
         *  for (int i = segmentNum; i < bodyLength; i++)
         *  {
         *      SNKPlayerBodySegment currentSegment = nextSegment;
         *      nextSegment = currentSegment.Behind;
         *      GameObject.Destroy(currentSegment.gameObject, 1f);
         *  }
         *
         *  bodyLength = tailSegment.BodyIndex + 1;
         *
         *  health.IncrementMaxHealth(-healthPerSegment * segementsLost);
         *  isSelfColliding = false;
         * }
         * isDeleting = false;
         */

        isSelfColliding = true;

        // Sever connections between last remaining segment and collided segment.
        if (collidedSegment.Ahead == null)
        {
            isSelfColliding = false;
            return;
        }
        tailSegment        = collidedSegment.Ahead;
        tailSegment.Behind = null;
        tailSegment.GetComponent <SpriteRenderer>().sprite = GameOperations.LoadSpriteFromPath("Sprites/ArcadeCabinets/SNK/TailSegment3");
        collidedSegment.Ahead = null;

        int oldLength = bodyLength;

        MoveToTrash(collidedSegment);

        int segmentsLost = oldLength - bodyLength;

        health.IncrementMaxHealth(-healthPerSegment * segmentsLost);

        isSelfColliding = false;
    }
示例#14
0
        public void StrikerstrikeTest()
        {
            GameOperations target = new GameOperations();
            Player         player = new Player()
            {
                name = "Player 1", points = 0, foulCount = 2
            };

            target.Strikerstrike(player);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
示例#15
0
 public virtual void populate()
 {
     image.sprite   = GameOperations.LoadSpriteFromPath(activeUpgrade.sprite);
     nameText.text  = activeUpgrade.upgradeName;
     priceText.text = GameOperations.BigIntToString(activeUpgrade.price.value) + " Tickets";
     levelText.text = activeUpgrade.currentLevel + " / " + activeUpgrade.maxLevel;
     if (activeUpgrade.currentLevel == activeUpgrade.maxLevel)
     {
         priceText.gameObject.SetActive(false);
     }
     gameObject.SetActive(true);
 }
示例#16
0
    public static void WriteArcadeStatus()
    {
        if (arcadeStatus == null)
        {
            arcadeStatus = new ArcadeStatus();
        }
        System.IO.Directory.CreateDirectory(Application.dataPath + "/SaveData");
        string unencrypted = "ArcadeStatus.json\n" + JsonUtility.ToJson(arcadeStatus, true);
        string encrypted   = GameOperations.EncryptDecrypt(unencrypted);

        System.IO.File.WriteAllText(arcadeStatusPath, unencrypted);
        System.IO.File.WriteAllText(encryptedArcadeStatusPath, encrypted);
    }
示例#17
0
 /**
  * Update only the image: a PrizeUpgradeUI does not display the upgrade name,
  * price, or level.
  */
 public override void populate()
 {
     image.sprite = GameOperations.LoadSpriteFromPath(activeUpgrade.sprite);
     if (activeUpgrade.currentLevel == 0)
     {
         image.color = tintColor;
     }
     else
     {
         image.color = Color.white;
     }
     gameObject.SetActive(true);
 }
示例#18
0
        public void MultistrikeTest()
        {
            GameOperations target = new GameOperations();
            Player         player = new Player()
            {
                name = "Player 1", points = 10, foulCount = 2
            };
            int coins         = 10;
            int coinsExpected = 8;

            target.Multistrike(player, ref coins);
            Assert.AreEqual(coinsExpected, coins);
        }
示例#19
0
        public void DefunctCoinTest()
        {
            GameOperations target = new GameOperations();
            Player         player = new Player()
            {
                name = "Player 1", points = 10, foulCount = 2
            };
            int coins         = 5;
            int coinsExpected = 4;

            target.DefunctCoin(player, ref coins);
            Assert.AreEqual(coinsExpected, coins);
        }
示例#20
0
    // Update is called once per frame
    private void UpdateHealthBar()
    {
        barUI.value = GameOperations.BigIntDivideToFloat(currentHealth, maxHealth);

        Color gradColor = gradient.Evaluate(barUI.value);

        fill.color = gradColor;

        Color backColor = new Color(gradColor.r * .7f, gradColor.g * .7f, gradColor.b * .7f);

        background.color = backColor;

        HealthText.text = GameOperations.BigIntToString(currentHealth);
    }
        public static object Main(string operation, params object[] args)
        {
            if (Runtime.Trigger == TriggerType.Verification)
            {
                if (ContractOwner.Length == 20)
                {
                    // if param ContractOwner is script hash
                    //return Runtime.CheckWitness(ContractOwner);
                    return(false);
                }
                else if (ContractOwner.Length == 33)
                {
                    // if param ContractOwner is public key
                    byte[] signature = operation.AsByteArray();
                    return(VerifySignature(signature, ContractOwner));
                }
            }
            else if (Runtime.Trigger == TriggerType.VerificationR)
            {
                return(true);
            }
            else if (Runtime.Trigger == TriggerType.Application)
            {
                var result = AdminOperations.HandleAdminOperation(operation, args);
                if (result.IsComplete)
                {
                    return(result.Value);
                }

                result = NepOperations.HandleNepOperation(operation, args);
                if (result.IsComplete)
                {
                    return(result.Value);
                }

                result = TokenOperations.HandleTokenOperation(operation, args);
                if (result.IsComplete)
                {
                    return(result.Value);
                }

                result = GameOperations.HandleGameOperation(operation, args);
                if (result.IsComplete)
                {
                    return(result.Value);
                }
            }

            return(false);
        }
示例#22
0
        public void RedstrikeTest()
        {
            GameOperations target = new GameOperations();
            Player         player = new Player()
            {
                name = "Player 1", points = 0, foulCount = 2
            };
            int  coins                    = 9;
            int  coinsExpected            = 9;
            bool isRedCoinPresent         = false;
            bool isRedCoinPresentExpected = false;

            target.Redstrike(player, ref coins, ref isRedCoinPresent);
            Assert.AreEqual(coinsExpected, coins);
            Assert.AreEqual(isRedCoinPresentExpected, isRedCoinPresent);
        }
示例#23
0
        public void CheckPointsTest()
        {
            GameOperations target  = new GameOperations();
            Player         player1 = new Player()
            {
                name = "Player 1", points = -4, foulCount = 0
            };
            Player player2 = new Player()
            {
                name = "Player 2", points = 3, foulCount = 0
            };
            bool expected = false;
            bool actual;

            actual = target.CheckPoints(player1, player2);
            Assert.AreEqual(expected, actual);
        }
    public void InitializePopUp()
    {
        convertPopUp.SetActive(true);

        // calculate amount to receive
        prizeTicketsToReceive = 0;
        for(int i = 0; i < ticketConverts.Count; i++)
        {
            BigInteger amountToTurnIn = ticketConverts[i].getCount();

            amountToTurnIn -= amountToTurnIn % ticketConverts[i].inputAmount;
            BigInteger numberOfConversions = amountToTurnIn / ticketConverts[i].inputAmount;
            prizeTicketsToReceive += numberOfConversions * ticketConverts[i].outputAmount;
        }

        conversionText.text = "You Will Receive:\n" + GameOperations.BigIntToString(prizeTicketsToReceive) + "\nPrize Tickets";
    }
 public void Populate()
 {
     image.sprite  = activePrinter.GetPrinterSprite();
     trayText.text = GameOperations.BigIntToString(activePrinter.TicketsPrinted) + "/" + GameOperations.BigIntToString(activePrinter.Capacity);
     if (!activePrinter.IsActive)
     {
         image.color = tintColor;
         trayText.gameObject.SetActive(false);
         slider.gameObject.SetActive(false);
     }
     else
     {
         image.color = Color.white;
         trayText.gameObject.SetActive(true);
         slider.gameObject.SetActive(true);
     }
     slider.maxValue = activePrinter.BatchTime;
 }
示例#26
0
    /**
     * Initializes the values of the PopUp.
     */
    private void InitializePopUp()
    {
        image.sprite         = GameOperations.LoadSpriteFromPath(activeUpgrade.sprite);
        nameText.text        = activeUpgrade.upgradeName;
        descriptionText.text = activeUpgrade.description;
        priceText.text       = GameOperations.BigIntToString(activeUpgrade.price.value) + " Tickets";

        if (activeUpgrade.currentLevel == activeUpgrade.maxLevel)
        {
            priceText.gameObject.SetActive(false);
            buyButton.interactable = false; // or message
        }
        else
        {
            priceText.gameObject.SetActive(true);
            buyButton.interactable = true;
        }
    }
    public void InitializeCurrencyView()
    {
        arcadeStatus = ArcadeManager.ReadArcadeStatus();
        pawnStatus   = PawnManager.ReadPawnStatus();

        // Set the static currencies
        moneyText.text       = GameOperations.BigIntToString(pawnStatus.Money);
        prizeTicketText.text = GameOperations.BigIntToString(arcadeStatus.ArcadePrizeStatus.Tickets);

        // Get the list of statuses to complete dynamic currencies
        int xPos    = 0;
        int yPos    = -10;
        int yOffset = -70;
        List <LayerZeroStatus> statuses = arcadeStatus.Statuses;

        lineItems = new List <GameObject>();
        for (int i = 1; i < statuses.Count; i++)
        {
            CabinetStatus status = (CabinetStatus)statuses[i];
            if (status.IsActive)
            {
                // Add prefab
                // Make the item
                GameObject lineItem = Instantiate(ticketLinePrefab);
                lineItem.transform.SetParent(scrollViewTransform, false);
                lineItems.Add(lineItem);

                // Set position
                RectTransform rt = lineItem.GetComponent <RectTransform>();
                rt.anchorMin        = new UnityEngine.Vector2(0, 0);
                rt.anchorMax        = new UnityEngine.Vector2(1, 1);
                rt.sizeDelta        = new Vector2(200, 50);
                rt.anchoredPosition = new UnityEngine.Vector3(xPos, yPos, 0);

                yPos += yOffset;

                //Populate the prefab with the proper data.
                lineItem.GetComponent <CurrencyViewUI>().Populate(status);
            }
        }
        int newHeight = Mathf.Max(-yPos, 720);

        scrollViewTransform.sizeDelta = new Vector2(225, newHeight);
    }
    public static Sprite GetPrinterSprite(TicketPrinter printer)
    {
        Sprite sprite = null;

        switch (printer.Printer)
        {
        case TicketPrinter.PrinterType.Receipt:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Receipt");
            break;

        case TicketPrinter.PrinterType.Inkjet:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Inkjet");
            break;

        case TicketPrinter.PrinterType.Laser:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Laser");
            break;

        case TicketPrinter.PrinterType.Office:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Office");
            break;

        case TicketPrinter.PrinterType.Industrial:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Industrial");
            break;

        case TicketPrinter.PrinterType.Compact3D:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Compact3D");
            break;

        case TicketPrinter.PrinterType.Industrial3D:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Industrial3D");
            break;

        case TicketPrinter.PrinterType.Space:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Space");
            break;

        default:
            sprite = GameOperations.LoadSpriteFromPath("Sprites/Printers/Receipt");
            break;
        }
        return(sprite);
    }
    public void LogarithmicPopulate(BigInteger number)
    {
        valueText.text = GameOperations.BigIntToString(number);

        double value = BigInteger.Log10(number);

        value  = value / 10f;
        value += 0.1f;

        if (value < 1f)
        {
            slider.value = (float)value;
        }
        else
        {
            // do further scaling (next overflow tier)
            Debug.Log("Next overflow tier should happen");
        }
    }
示例#30
0
        public async Task <ActionResult> JoinSession([FromRoute] string sessionId)
        {
            Task <UserModel> userTask = userManager.GetUserAsync(HttpContext.User);
            Task <Game>      gameTask = gameService.Get(sessionId);
            Session?         session  = await sessionService.Get(sessionId);

            if (session == null)
            {
                return(Status404NotFound("Session"));
            }
            if (session.LinkEnabled == false)
            {
                return(Status400Invalid("Session is private."));
            }
            if ((session.Players.Count + session.Invitations.Length) >= 4)
            {
                return(Status400Invalid("Session is full."));
            }
            Game game = await gameTask;

            if (game.Status != GameStatus.Preparing)
            {
                return(Status400Invalid("Game has started."));
            }
            UserModel user = await userTask;

            if (session.Players.Any((kvp) => kvp.Key == user.UserId))
            {
                return(NoContent());
            }

            user.AddSession(session);
            List <Task> updateTasks = new List <Task> {
                userManager.UpdateAsync(user)
            };

            GameOperations.AddPlayer(game, user.UserId);
            updateTasks.Add(gameService.Update(sessionId, game));
            session.Players.Add(user.UserId, PlayerSummary.CreateFromUser(user));
            updateTasks.Add(sessionService.Update(sessionId, session));
            Task.WaitAll(updateTasks.ToArray());
            return(NoContent());
        }
示例#31
0
 void Awake()
 {
     instance = this;
 }
示例#32
0
 public void TestMethod1()
 {
     GameOperations game = new GameOperations(1000);
     var games = game.Get();
 }