示例#1
0
    public void endSessionFinal()
    {
        playerConfig.isInGame = false;
        playerConfig.gold    += Gold;
        addRewardToUser();
        ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

        SceneManager.LoadScene("FrontPage");
    }
示例#2
0
    public void endApplication(List <Tower> towers, float Gold, float numCapturedEnemy, float Wave, float Health, Dictionary <int, int> capturedEnemy)
    {
        playerConfig.userMapConfig = getMapConfig(towers);
        playerConfig.userMapPath   = staticTransition.pathToLevel;
        playerConfig.gameConfig    = new float[] { Gold, numCapturedEnemy, Wave, Health };
        playerConfig.capturedEnemy_duringSession = capturedEnemy;

        ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

        SceneManager.LoadScene("FrontPage");
    }
    public void continueToNewGame()
    {
        playerConfig.isInGame      = false;
        playerConfig.userMapPath   = null;
        playerConfig.userMapConfig = null;
        playerConfig.gameConfig    = null;

        ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

        ToInGame();
    }
示例#4
0
    public void ToFrontPage()
    {
        Time.timeScale = 1;

        playerConfig.isInGame = false;

        playerConfig.gold = Gold;

        ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

        SceneManager.LoadScene("FrontPage");
    }
示例#5
0
    public void ToFrontPageFinal()
    {
        setTimeBack();
        playerConfig.userMapConfig = getMapConfig();
        playerConfig.userMapPath   = staticTransition.pathToLevel;
        print(Gold);
        playerConfig.gameConfig = new float[] { Gold, numCapturedEnemy, Wave, Health };
        playerConfig.capturedEnemy_duringSession = capturedEnemy;

        ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

        SceneManager.LoadScene("FrontPage");
    }
示例#6
0
    //need big change
    //need to add discription to every nodes
    public void upgrade()
    {
        upgradeIndicator.SetActive(true);

        float timeSinceLastClick = Time.time - lastClickTime;

        if (timeSinceLastClick <= Double_click_interval)
        {
            print("tree#: " + (current_treeNode.nodeOfTree) + ", node#: " + (current_treeNode.rank));

            upgradeIndicator.SetActive(false);

            playerConfig.gold -= stateCalculator.upgradeStat(current_treeNode.goldCost, current_treeNode.goldCostMultiplier, current_treeNode.nodeLevel);

            playerConfig.trees[currentButtonOfTree][current_treeNode.rank][0]++;

            upgradePage.GetComponent <textHandler>().setValue(playerConfig.gold);

            playerConfig.trees[currentButtonOfTree][current_treeNode.rank][1] = current_treeNode.upgradeDisplay;

            ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

            upgradePage.getNewPlayerConfig();

            if (playerConfig.gold < current_treeNode.priceDisplay)
            {
                upgradeButton.interactable = false;
            }


            if (current_treeNode.rank == 0)
            {
                if (currentTree != upgradePage.allTrees[0].GetComponent <Tree>() && currentTree != upgradePage.allTrees[1].GetComponent <Tree>())
                {
                    if (current_treeNode.nodeLevel >= 1)
                    {
                        upgradeButton.interactable = false;
                    }
                }
            }
        }
        lastClickTime = Time.time;
        StatRefresh();
    }
    public void ToInGame()
    {
        if (playerConfig.isInGame == false)
        {
            playerConfig.isInGame    = true;
            playerConfig.userMapPath = staticTransition.pathToLevel;
            playerConfig.gameConfig  = new float[] { 10, 0, 0, 10 };


            ConfigSaver.save(staticTransition.userID, staticTransition.userPass, playerConfig);

            staticTransition.pathToLevel = path;
            gameObject.SetActive(false);

            staticTransition.isNewGame = true;

            SceneManager.LoadScene("InGame");
        }
        else
        {
            isGameStartedPrompt.SetActive(true);
        }
    }
示例#8
0
    public static void playerInitiation(string Username, string password)
    {
        string saveFile = playinitPathPrefix + Username + ".txt";

        PlayerConfig config = new PlayerConfig();

        config.Username = Username;
        config.Password = password;

        config.isInGame = false;

        config.userMapPath = null;

        config.userMapConfig = null;

        config.gameConfig = null;

        config.capturedEnemy_duringSession = new Dictionary <int, int>();

        config.allCapturedEnemy = new Dictionary <int, int>();

        config.gold = 200;

        //first value in the list is level, second is increment
        //first four elements of tower are the same

        config.trees = new Dictionary <int, float[][]>
        {
            {
                //utility
                0, new float[][]
                {
                    new float[] { 1, 1 },                                 //inGame_life
                    new float[] { 1, 1 }                                  //inGame_gold
                }
            },

            {
                //general upgrade
                1, new float[][]
                {
                    new float[] { 1, 0 },                                 //general_damage
                    new float[] { 1, 0 },                                 //general_range
                    new float[] { 1, 0 },                                 //general_atk_speed
                    new float[] { 1, 0 }                                  //general_effect
                }
            },

            {
                //first tower
                2, new float[][]
                {
                    new float[] { 0, 0 },
                    new float[] { 1, 0 },                                 //damage
                    new float[] { 1, 0 },                                 //range
                    new float[] { 1, 0 },                                 //atk_speed
                    new float[] { 1, 0 }                                  //effect
                }
            },

            {
                //second tower
                3, new float[][]
                {
                    new float[] { 0, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 }
                }
            },

            {
                //third tower
                4, new float[][]
                {
                    new float[] { 0, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 }
                }
            },

            {
                //fourth tower
                5, new float[][]
                {
                    new float[] { 0, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 }
                }
            },

            {
                //fifth tower
                6, new float[][]
                {
                    new float[] { 0, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 }
                }
            },

            {
                //sixth tower
                7, new float[][]
                {
                    new float[] { 0, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 },
                    new float[] { 1, 0 }
                }
            }
        };

        ConfigSaver.save <PlayerConfig>(saveFile, config);
    }