Esempio n. 1
0
        public static int GetGridSize(this StageMode mode)
        {
            var modeIndex = (int)mode;
            var gridSizes = Constants.GridSizes;

            if (gridSizes.Length <= modeIndex || modeIndex < 0)
            {
                return(0);
            }

            return(gridSizes[modeIndex]);
        }
Esempio n. 2
0
        public static int GetBlockSize(this StageMode mode)
        {
            var modeIndex  = (int)mode;
            var blockSizes = Constants.BoardSizes;

            if (blockSizes.Length <= modeIndex || modeIndex < 0)
            {
                return(0);
            }

            return(blockSizes[modeIndex]);
        }
Esempio n. 3
0
    void Start()
    {
        timer              = 0;
        nowLevel           = 0;
        Input.gyro.enabled = true;
        pastNumber         = 0;
        startFlag          = false;
        yPoint             = 0; zPoint = 0;
        cameraYPoint       = 0; cameraZPoint = 0;
        int modeN;

        //デバッグモード
        if (DebugMode)
        {
            debugLength           = StageList.Instance.DebugStage.Length;
            modeN                 = Random.Range(0, debugLength);
            pastStage[pastNumber] = Instantiate(StageList.Instance.DebugStage[modeN], new Vector3(0, -100, 0), Quaternion.identity);
            pastNumber++;

            return;
        }

        //mode数を取得
        modeLength      = System.Enum.GetValues(typeof(StageMode)).Length;
        boxStageLength  = StageList.Instance.BoxStage.Length;
        tubeStageLength = StageList.Instance.TubeStage.Length;
        fallStageLength = StageList.Instance.FallStage.Length;
        //次どのモードか
        modeN = Random.Range(1, 2);
        //次どの配列か
        switch (modeN)
        {
        case 0:
            nextStageMode         = StageMode.Nomal;
            modeN                 = Random.Range(0, boxStageLength);
            pastStage[pastNumber] = Instantiate(StageList.Instance.BoxStage[modeN], new Vector3(0, -100, 0), Quaternion.identity);
            CreateEnergyNormal(pastStage[pastNumber]);

            break;

        case 1:
            nextStageMode         = StageMode.Tube;
            modeN                 = Random.Range(0, tubeStageLength);
            pastStage[pastNumber] = Instantiate(StageList.Instance.TubeStage[modeN], new Vector3(0, -100, 0), Quaternion.identity);
            CreateEnergyTube(pastStage[pastNumber]);

            break;
        }
        pastNumber++;
    }
Esempio n. 4
0
        private void resetGame()
        {
            cashInBank     = new List <MoneyCard>();
            toPay          = 0;
            inBank         = 0;
            payBtnProgress = 0;
            mode           = StageMode.Normal;

            foreach (ToyCard card in cards)
            {
                card.isChoosen = false;
            }

            sounds.resetSounds();
        }
Esempio n. 5
0
        /// <summary>
        /// 보드의 가로 세로 사이즈
        /// </summary>
        public static int GetBoardSize(this StageMode mode)
        {
            switch (mode)
            {
            case StageMode.Stage3x3:
                return(3);

            case StageMode.Stage4x4:
                return(4);

            case StageMode.Staeg5x5:
                return(5);
            }

            return(4);
        }
Esempio n. 6
0
    /// <summary>
    /// 重力
    /// </summary>
    public void GravityRb(float startGravitySpeed, float gravitySpeed, StageMode stageMode = StageMode.Nomal)
    {
        Rigidbody rb = PlayerObjectManager.Instance.rb;

        if (!isGround)
        {
            time += Time.deltaTime;
        }
        //重力処理
        rb.AddForce(-gameObject.transform.up.normalized * startGravitySpeed * Time.deltaTime * 60 - gameObject.transform.up.normalized * time * Time.deltaTime * 60 * gravitySpeed, ForceMode.Acceleration);
        //TODO:OnTrigger的な処理の追加

        if (isGround)
        {
            time = 0;
        }
    }
Esempio n. 7
0
        public Screen(Fonts fonts)
        {
            this.fonts     = fonts;
            cards          = new List <ToyCard>();
            money          = new List <MoneyCard>();
            squareBarParts = new List <Texture2D>();
            cashInBank     = new List <MoneyCard>();
            toPay          = 0;
            inBank         = 0;
            payBtnProgress = 0;
            mode           = StageMode.Normal;

            sounds = new SoundVault(new List <AvailableSounds>()
            {
                AvailableSounds.END_GAME,
                AvailableSounds.CARTOON_HOP,
                AvailableSounds.ERROR,
            }, 1);
        }
Esempio n. 8
0
        /// <summary>
        /// 해당 스테이지의 한 블록의 최대 수치가 되는 값을 가져오기
        /// <remarks>현재는 모든 스테이지 최대 사이즈가 고정</remarks>
        /// </summary>
        public static int GetBlockMaxNum(this StageMode mode)
        {
            var maxSizes = Constants.MaxValue;

            switch (mode)
            {
            case StageMode.Stage3x3:
                return(maxSizes[0]);

            case StageMode.Stage4x4:
                return(maxSizes[1]);

            case StageMode.Staeg5x5:
                return(maxSizes[2]);

            default:
                return(maxSizes[1]);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 게임 시작시 처음 세팅
        /// TODO: 로딩이 들어가면 로딩 과정에 넣기
        /// </summary>
        public void Init(StageMode mode)
        {
            isGameClear = false;

            // 전체 보드 가로(혹은 세로)의 크기 결정
            maxSize = mode.GetBoardSize();
            maxNum  = mode.GetBlockMaxNum();

            // 정사각형 블록 1개의 너비 (혹은 높이)
            var blockSize = mode.GetBlockSize();

            // 초기 블록의 사이즈 결정
            originBlock.SetSize(blockSize);

            // 오브젝트 풀 초기 개수 세팅 (최대 블럭수만큼 미리 생성)
            objectPoolBlock.Init(originBlock, blockTransform, maxSize * maxSize);
            objectPoolBoard.Init(originBoard, originBoard.transform.parent, maxSize * maxSize);

            for (var i = 0; i < maxSize * maxSize; i++)
            {
                var obj = objectPoolBoard.GetOrCreate();
                obj.Set(blockSize, $"board{i}");
                obj.gameObject.SetActive(true);
                boards.Add(obj);
            }

            originBoard.gameObject.SetActive(false);
            originBlock.gameObject.SetActive(false);

            // grid가 자동으로 보드를 정렬해서 배치를 해줌
            var gridSize = mode.GetGridSize();

            grid.cellHeight = gridSize;
            grid.cellWidth  = gridSize;
            grid.maxPerLine = maxSize;
            grid.Reposition();

            // 처음 배치되는 블록 생
            CreateBlock();
        }
Esempio n. 10
0
    private async Task <bool> StartBlockchainCommunication()
    {
        Debug.Log("Starting Blockchain Communication");
        //byte[] bytes = new byte[32];
        //string x = await WorldsRegistry.WorldsQueryAsync(null);

        //Task updatePanelTask = UpdateUIPanel();
        //updatePanelTask.Start();


        System.Threading.Thread thread = new System.Threading.Thread(new ThreadStart(UpdateUIPanel));
        thread.Start();


        Galleass = new Galleass3D.Contracts.Galleass.GalleassService(Web3, LastKnownGalleassAddress);

        Timber = await GetContract <Galleass3D.Contracts.Timber.TimberService>();

        Copper = await GetContract <Galleass3D.Contracts.Copper.CopperService>();

        Fillet = await GetContract <Galleass3D.Contracts.Fillet.FilletService>();

        Dogger = await GetContract <Galleass3D.Contracts.Dogger.DoggerService>();

        Bay = await GetContract <Galleass3D.Contracts.Bay.BayService>();

        Citizens = await GetContract <Galleass3D.Contracts.Citizens.CitizensService>();

        CitizensLib = await GetContract <Galleass3D.Contracts.CitizensLib.CitizensLibService>();

        Land = await GetContract <Galleass3D.Contracts.Land.LandService>();

        TimberCamp = await GetContract <Galleass3D.Contracts.TimberCamp.TimberCampService>();

        LandLib = await GetContract <Galleass3D.Contracts.LandLib.LandLibService>();

        Harbor = await GetContract <Galleass3D.Contracts.Harbor.HarborService>();

        Fishmonger = await GetContract <Galleass3D.Contracts.Fishmonger.FishmongerService>();

        Village = await GetContract <Galleass3D.Contracts.Village.VillageService>();

        Market = await GetContract <Galleass3D.Contracts.Market.MarketService>();

        Sea = await GetContract <Galleass3D.Contracts.Sea.SeaService>();

        //fishes
        Catfish = await GetContract <Galleass3D.Contracts.Catfish.CatfishService>();

        Bay_FishEventHandler = Bay.ContractHandler.GetEvent <Galleass3D.Contracts.Bay.ContractDefinition.FishEventDTO>();



        UpdateBalances();

        MainIslandX = await Land.MainXQueryAsync();

        MainIslandY = await Land.MainYQueryAsync();

        Debug.Log("MainIsland:" + MainIslandX.ToString() + " - " + MainIslandY.ToString());

        bool stockCatfish = false;


        if (stockCatfish)
        {
            Debug.Log("Minting Catfish");
            TransactionReceipt mintedCatfish = await Catfish.MintRequestAndWaitForReceiptAsync(Account.Address, 10);

            var catFishBalance = await Catfish.BalanceOfQueryAsync(Account.Address);

            Debug.Log("CatfishBalance:" + catFishBalance.ToString());

            Debug.Log("Allowing Catfish in Bay");
            TransactionReceipt allowCatfishInBay = await Bay.AllowSpeciesRequestAndWaitForReceiptAsync(5, 5, Catfish.ContractHandler.ContractAddress);

            Debug.Log("Stocking Catfish in Bay");
            TransactionReceipt stockCatfishInBay = await Bay.StockRequestAndWaitForReceiptAsync(new Galleass3D.Contracts.Bay.ContractDefinition.StockFunction()
            {
                Gas = DefaultGas, GasPrice = DefaultGasPrice, X = 5, Y = 5, Species = Catfish.ContractHandler.ContractAddress
            });

            Bay.ContractHandler.EthApiContractService.TransactionManager.DefaultGas = new BigInteger(1000000);
            Debug.Log("Stocking Catfish in Bay -finished!");
            DebugTransactionReceipt(stockCatfishInBay);
        }

        //Debug.Log("Minting Timber");
        //var timberReceipt = await Timber.MintRequestAndWaitForReceiptAsync(Account.Address, new BigInteger(100));


        bool mineDogger = false;

        var setPermission = await Galleass.SetPermissionRequestAndWaitForReceiptAsync(Account.Address, Encoding.ASCII.GetBytes("buildDogger"), true);

        //var setPermission2 = await Galleass.SetPermissionRequestAndWaitForReceiptAsync(Account.Address, Encoding.ASCII.GetBytes("transferDogger"), true);

        if (mineDogger)
        {
            var doggerSupply = await Dogger.TotalSupplyQueryAsync();

            Debug.Log("Total Supply Doggers:" + doggerSupply.ToString());

            //var setPermission = await Galleass.SetPermissionRequestAndWaitForReceiptAsync(Account.Address, Encoding.ASCII.GetBytes("buildDogger"), true);
            var setPermission2 = await Galleass.SetPermissionRequestAndWaitForReceiptAsync(Account.Address, Encoding.ASCII.GetBytes("transferDogger"), true);


            //CancellationTokenSource s = new CancellationTokenSource(1500);
            Debug.Log("Building Dogger");
            var buildDoggerReceipt = await Dogger.BuildRequestAndWaitForReceiptAsync(new Galleass3D.Contracts.Dogger.ContractDefinition.BuildFunction()
            {
                Gas = DefaultGas, GasPrice = DefaultGasPrice
            });

            Debug.Log("Dogger: <<");
            DebugTransactionReceipt(buildDoggerReceipt);
        }


        if (MainIslandX > 0 && MainIslandY > 0)
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            LandManager.LoadIsland(MainIslandX, MainIslandY);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }



        var stageMode = await Galleass.StagedModeQueryAsync();

        CurrentStageMode = (StageMode)stageMode;


        //TODO: for some reason, for this Reiceipt we have to wait forever!!
        //but it seems to go throught.

        //Bay.FishQueryAsync()



        return(true);
    }
Esempio n. 11
0
        public GameType update(Rectangle cursorRect)
        {
            switch (mode)
            {
            case StageMode.Normal:
            {
                if (cursorRect.Intersects(rectPayBtn))
                {
                    if ((payBtnProgress + 1) < 60)
                    {
                        payBtnProgress++;
                    }
                    else
                    {
                        payBtnProgress = 60;
                    }
                }
                else
                {
                    if ((payBtnProgress - 1) >= 0)
                    {
                        payBtnProgress--;
                    }
                    else
                    {
                        payBtnProgress = 0;
                    }
                }

                if (payBtnProgress >= 60)
                {
                    payBtnProgress = 0;
                    mode           = StageMode.Paying;
                }

                foreach (ToyCard card in cards)
                {
                    if (card.cardRectangle.Intersects(cursorRect) && !card.isChoosen)
                    {
                        card.isChoosen = true;
                        toPay         += card.toyPrize;
                    }
                }

                return(GameType.ToyStore);
            }

            case StageMode.Paying:
            {
                foreach (MoneyCard cash in money)
                {
                    if (cursorRect.Intersects(cash.cardRectangle) && !cardPicked)
                    {
                        if ((cash.cardProgress + 1) < 60)
                        {
                            cash.cardProgress++;
                        }
                        else
                        {
                            cash.cardProgress = 60;
                        }
                    }
                    else
                    {
                        if ((cash.cardProgress - 1) >= 0)
                        {
                            cash.cardProgress--;
                        }
                        else
                        {
                            cash.cardProgress = 0;
                        }
                    }

                    if (cash.isChoosen)
                    {
                        cash.cardPosition = new Vector2(cursorRect.X, cursorRect.Y);
                    }

                    if (cash.cardProgress >= 60 && !cardPicked)
                    {
                        cash.cardProgress = 0;
                        cash.isChoosen    = true;
                        cardPicked        = true;
                    }

                    if (cursorRect.Intersects(rectDragMoneyHere) && cardPicked && cash.isChoosen)
                    {
                        //Mamy pieniadz w rece i kladziemy go w polu
                        cash.cardPosition = cash.originPosition;
                        cash.cardProgress = 0;
                        cardPicked        = false;
                        cash.isChoosen    = false;
                        inBank           += cash.value;
                        addToBank(cash);
                    }

                    if (cursorRect.Intersects(rectCashRegister) && !cardPicked)
                    {
                        if (btnCashRegisterClicked())
                        {
                            mode = StageMode.Finish;
                        }
                        else
                        {
                            btnTrashClicked();
                        }
                    }

                    if (cursorRect.Intersects(rectTrash) && !cardPicked)
                    {
                        btnTrashClicked();
                    }
                }

                return(GameType.ToyStore);
            }

            case StageMode.Finish:
            {
                sounds.PlaySoundOnce(AvailableSounds.END_GAME);

                if (cursorRect.Intersects(rectBtnExit))
                {
                    sounds.PlaySound(AvailableSounds.CARTOON_HOP);
                    return(GameType.School);
                }

                if (cursorRect.Intersects(rectBtnReply))
                {
                    sounds.PlaySound(AvailableSounds.CARTOON_HOP);
                    resetGame();
                    return(GameType.ToyStore);
                }

                return(GameType.ToyStore);
            }

            default:
            {
                return(GameType.ToyStore);
            }
            }
        }
Esempio n. 12
0
    // Token: 0x060008C8 RID: 2248 RVA: 0x000B4D5C File Offset: 0x000B2F5C
    public static bool sendInitBattleEx()
    {
        if (!GUIManager.Instance.ShowUILock(EUILock.Battle))
        {
            return(false);
        }
        MessagePacket messagePacket = new MessagePacket(1024);

        messagePacket.AddSeqId();
        messagePacket.Protocol = Protocol._MSG_REQUEST_EX_BATTLEINIT_NPC;
        ushort num = BattleNetwork.battlePointID;

        if (!BattleNetwork.bReplay)
        {
            num = DataManager.StageDataController.currentPointID;
            BattleNetwork.battlePointID = num;
        }
        StageMode stageMode = DataManager.StageDataController.StageDareMode(BattleNetwork.battlePointID);

        messagePacket.Add((stageMode != StageMode.Full) ? 2 : 1);
        if (stageMode == StageMode.Lean)
        {
            num /= 3;
        }
        messagePacket.Add(num);
        for (int i = 0; i < 5; i++)
        {
            messagePacket.Add(DataManager.Instance.heroBattleData[i].HeroID);
        }
        byte currentNodus = DataManager.StageDataController.currentNodus;

        messagePacket.Add(currentNodus);
        if (!messagePacket.Send(false))
        {
            GUIManager.Instance.HideUILock(EUILock.Battle);
            return(false);
        }
        StageManager stageDataController = DataManager.StageDataController;
        DataManager  instance            = DataManager.Instance;

        if (stageDataController.StageDareMode(num) == StageMode.Lean)
        {
            LevelEX levelEXBycurrentPointID = stageDataController.GetLevelEXBycurrentPointID(0);
            if (currentNodus == 1)
            {
                instance.BattleConditionKey = levelEXBycurrentPointID.NodusOneID;
            }
            else if (currentNodus == 2)
            {
                instance.BattleConditionKey = levelEXBycurrentPointID.NodusTwoID;
            }
            else if (currentNodus == 3)
            {
                instance.BattleConditionKey = levelEXBycurrentPointID.NodusThrID;
            }
        }
        else
        {
            instance.BattleConditionKey = stageDataController.GetLevelEXBycurrentPointID(0).NodusTwoID;
        }
        return(true);
    }
Esempio n. 13
0
 /// <summary>
 /// 현재 선택한 스테이지 변경
 /// </summary>
 public void ChangeStage(StageMode mode)
 {
     CurrentStage = mode;
 }
Esempio n. 14
0
    public void RandomNextCreateMode(StageMode mode)
    {
        nowStageMode = mode;
        //次どのモードか
        int modeN = Random.Range(0, 6);

        ////デバッグ
        //modeN = 1;

        cameraRotaX = Random.Range(-10, 10);
        cameraRotaY = Random.Range(-10, 10);
        //次どの配列か
        switch (modeN)
        {
        case 0:
        case 1:
        case 2:
            nextStageMode         = StageMode.Nomal;
            modeN                 = Random.Range(0, boxStageLength);
            yPoint               -= 100;
            zPoint               += 1200;
            cameraYPoint         -= 100;
            cameraZPoint         += 1200;
            pastStage[pastNumber] = Instantiate(StageList.Instance.BoxStage[modeN], new Vector3(0, yPoint - 100, zPoint), Quaternion.identity);
            CreateEnergyNormal(pastStage[pastNumber]);
            break;

        case 3:
        case 4:
            nextStageMode         = StageMode.Tube;
            modeN                 = Random.Range(0, tubeStageLength);
            yPoint               -= 100;
            zPoint               += 1200;
            cameraYPoint         -= 100;
            cameraZPoint         += 1200;
            pastStage[pastNumber] = Instantiate(StageList.Instance.TubeStage[modeN], new Vector3(0, yPoint - 100, zPoint), Quaternion.identity);
            CreateEnergyTube(pastStage[pastNumber]);
            break;

        case 5:
            nextStageMode         = StageMode.Fall;
            modeN                 = Random.Range(0, fallStageLength);
            yPoint               -= 100;
            zPoint               += 1200;
            cameraYPoint         -= 100;
            cameraZPoint         += 1200;
            pastStage[pastNumber] = Instantiate(StageList.Instance.FallStage[modeN], new Vector3(0, yPoint - 100, zPoint), Quaternion.identity);
            CreateEnergyFall(pastStage[pastNumber]);
            break;
        }
        //削除
        if (pastNumber == 3)
        {
            Destroy(pastStage[0]);
            Destroy(pastStage[1]);
            pastStage[0] = pastStage[2];
            pastStage[1] = pastStage[3];
            pastStage[2] = null;
            pastStage[3] = null;
            pastNumber   = 2;
        }
        else
        {
            pastNumber++;
        }
    }
Esempio n. 15
0
 public void ChangeStageMode(StageMode mode)
 {
     nowStageMode = mode;
 }