コード例 #1
0
    public void LoadNextTutorial()
    {
        if (currentLevel != null)
        {
            Debug.Log("Destroying");
            MonoBehaviour.Destroy(currentLevel);
        }
        if (index > 3)
        {
            LevelManager.instance.tm = null;
            LevelManager.instance.LoadLevel(false);
            PlayerDataController.SaveData("isRefreshDataEveryLaunch", false);
            UIManager.instance.OpenScreen((int)UIManager.Screens.GamePlayUI);
            UIManager.instance.CloseScreen((int)UIManager.Screens.GoodJobUI);
            return;
        }

        UIManager.instance.CloseScreen((int)UIManager.Screens.GoodJobUI);
        currentLevel = MonoBehaviour.Instantiate(tutorialLevels[index]);
        // activeLevelData = currentLevel.GetComponent<LevelData>();
        LevelManager.instance.activeLevelData = currentLevel.GetComponent <LevelData>();
        LevelManager.instance.activeLevel     = currentLevel;
        GridConstructer.instance.Init(LevelManager.instance.activeLevelData, true);

        InitCurrentTutorial();
    }
コード例 #2
0
 public void Reload()
 {
     GamePlayUI.SetActive(true);
     CloseScreen((int)Screens.Failscreen);
     PlayerDataController.SaveData("isLevelCompleted", true);
     LevelManager.instance.LoadLevel(true);
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        playerDataController = GameObject.FindGameObjectWithTag("Persistent")
                               .GetComponent <PlayerDataController>();
        PlayerData playerData = playerDataController.GetPlayerData();

        equippedItemNames = playerData.equippedItems;
        foreach (string thisItemName in equippedItemNames)
        {
            Debug.Log("(HomeScreenController)" + thisItemName);
        }


        foreach (GameObject thisFurniture in furnitures)
        {
            thisFurniture.SetActive(false);
        }

        foreach (string itemName in equippedItemNames)
        {
            Debug.Log("name of equipped items when HomeScreen is loaded: " + itemName);

            foreach (GameObject thisFurniture in furnitures)
            {
                if (thisFurniture.name.Equals(itemName))
                {
                    Debug.Log("Setting furniture to equipped");
                    thisFurniture.SetActive(true);
                }
            }
        }
    }
コード例 #4
0
 private void Awake()
 {
     languageController    = FindObjectOfType <LanguageController>();
     confirmationScreen    = FindObjectOfType <ConfirmationScreen>();
     recruitmentController = GameObject.FindObjectOfType <RecruitmentController>().GetComponent <RecruitmentController>();
     pDataController       = GameObject.FindObjectOfType <PlayerDataController>();
 }
コード例 #5
0
    // Start is called before the first frame update
    void Start()
    {
        sceneLoader          = new SceneLoaderService();
        characterPrefab      = (GameObject)Resources.Load("Prefabs/Characters/RandomCharacter");
        playerDataController = GameObject.FindObjectOfType <PlayerDataController>();
        GameObject playerLocations = GameObject.FindGameObjectWithTag("PlayerLocations");
        GameObject enemyLocations  = GameObject.FindGameObjectWithTag("EnemyLocations");
        var        numOfCharacters = playerDataController.PlayerData.CurrentCrew.Count >= 5 ? 5 : playerDataController.PlayerData.CurrentCrew.Count;

        for (int i = 0; i < numOfCharacters; i++)
        {
            var newPlayer  = Instantiate(characterPrefab);
            var newNpcBase = newPlayer.GetComponent <NpcBase>();
            newNpcBase.stats = playerDataController.PlayerData.CurrentCrew[i];
            newNpcBase.SetPlayerTeam(true);
            newNpcBase.SetStartPosition(playerLocations.transform.GetChild(i).transform);
            goodBois.Add(newNpcBase);
        }
        var eventDifficulty = playerDataController.PlayerData.EventDifficulty;
        var numOfEnemies    = Random.Range(3, eventDifficulty * 2 - 1);

        //TODO change num by parameter
        for (int i = 0; i < numOfEnemies; i++)
        {
            var newPlayer  = Instantiate(characterPrefab);
            var newNpcBase = newPlayer.GetComponent <NpcBase>();
            //TODO change level by parametes
            newNpcBase.stats = new NpcStats(eventDifficulty, eventDifficulty * 2);
            newNpcBase.SetPlayerTeam(false);
            newNpcBase.SetStartPosition(enemyLocations.transform.GetChild(i).transform);
            badBois.Add(newNpcBase);
        }
        turn = 0;
        PrepareBattle();
    }
コード例 #6
0
 private void Awake()
 {
     sceneLoaderService = new SceneLoaderService();
     paused             = false;
     PauseMenu.SetActive(false);
     playerDataController = FindObjectOfType <PlayerDataController>();
 }
コード例 #7
0
 public static void Initialize()
 {
     if (_instance == null)
     {
         _instance = new PlayerDataController();
     }
     _instance.LoadData();
 }
コード例 #8
0
    public void ToggleHaptic()
    {
        hapticSetting = !hapticSetting;
        PlayerDataController.SaveData("isVibrationOpen", hapticSetting);

        hapticSettingDisplay.sprite = hapticSprites[hapticSetting ? 1 : 0];
        Debug.Log("Haptic Toggled");
    }
コード例 #9
0
 void Awake()
 {
     portraits            = new List <Sprite>();
     playerDataController = FindObjectOfType <PlayerDataController>();
     uiController         = FindObjectOfType <UIController>();
     portraits            = Resources.LoadAll <Sprite>("Sprites").ToList();
     shopCanvas.SetActive(false);
 }
コード例 #10
0
 public void ToggleSound()
 {
     soundSetting = !soundSetting;
     PlayerDataController.SaveData("isSoundOpen", soundSetting);
     PlayerDataController.SaveData("isRefreshDataEveryLaunch", !soundSetting);
     soundSettingDisplay.sprite = soundSprites[soundSetting ? 1 : 0];
     Debug.Log("Sound Toggled");
 }
コード例 #11
0
 public static void Initialize()
 {
     if (_instance == null)
     {
         _instance = new PlayerDataController();
     }
     //Debug.Log(Application.persistentDataPath + "/data.dat");
     _instance.LoadData();
 }
コード例 #12
0
 void Loaded()
 {
     _settingsFile = new JSONFile <ConfigData>($"{Name}", ConfigLocation.Config, extension: ".cfg");
     PlayerData    = new PlayerDataController <SlotPlayerData>();
     if (lang_en.Count > 0)
     {
         lang.RegisterMessages(lang_en, this); //Setup lang now by default in case it is needed
     }
 }
コード例 #13
0
    private void Awake()
    {
        //load playerData or set default values
        PlayerDataController.Initialize();
        PlayerDataController.Instance.LoadData();

        GameData.Initialize();
        SoundManager.Initialize();
    }
コード例 #14
0
    public void LoadLevelDataFromSave()
    {
        activeLevelData.partTheme = (PartTheme)Enum.GetValues(typeof(PartTheme)).GetValue(PlayerDataController.data.levelPartTheme);
        var loadedTheme = Resources.LoadAll("Parts/" + activeLevelData.partTheme.ToString(), typeof(Sprite));

        lastPartTheme = activeLevelData.partTheme;
        activeLevelData.levelPartSprites = new List <Sprite>();
        foreach (var theme in loadedTheme)
        {
            activeLevelData.levelPartSprites.Add(theme as Sprite);
        }


        foreach (var cell in PlayerDataController.data.uncompletedLevel)
        {
            if (cell.isFull)
            {
                GameManager.instance.SpawnPart(GameManager.cells[new Tuple <int, int>(cell.x, cell.y)]);
            }
        }
        int  k = 0;
        bool isLevelCompleted = true;

        foreach (var mission in activeLevelData.missions)
        {
            string animalPlayerPrefsName = "animalProgress" + LevelManager.instance.activeLevelData.animalIndex[k];
            mission.RewindMissionCount(PlayerDataController.GetData <int>(animalPlayerPrefsName));
            k++;
            if (!mission.missionCompleted)
            {
                isLevelCompleted = false;
            }
        }
        GameManager.instance.GameModeType = (GameManager.ModeTypes)Enum.GetValues(typeof(GameManager.ModeTypes))
                                            .GetValue(PlayerDataController.data.levelModIndex);

        GameManager.instance.CheckMode();

        foreach (var shape in PlayerDataController.data.savedShapes)
        {
            GameManager.instance.SpawnShape(shape.x, shape.y);
        }

        Player.main.goldAccuiredThisLevel = PlayerDataController.data.goldAccuiredThisLevel;
        if (isLevelCompleted)
        {
            UIManager.instance.OpenScreen((int)UIManager.Screens.SuccessUI);
        }
        else
        {
            UIManager.instance.OpenScreen((int)UIManager.Screens.LevelInfoUI);
        }

        GameManager.instance.CheckEmptyCellCount();
        GameManager.instance.CanShapesFit();
    }
コード例 #15
0
        // It indicates that the interstitial ad is closed by clicking cross button/back button
        public void OnInterstitialDismiss()
        {
            //timer i sifirliyoruz
            Timer.Reset();

            AdManager.instance.onComplete(PlayerDataController.data.whichVideoFor, AdManager.AD_STATES.NOT_COMPLETE);
            PlayerDataController.SaveData("whichVideoFor", "");
            AMRSDK.loadInterstitial();
            Debug.Log("Intersititial Ad dismiss!");
        }
コード例 #16
0
    // Use this for initialization
    public void Start()
    {
        GameObject playerDatagO = GameObject.FindGameObjectWithTag("Persistent");

        if (playerDatagO != null)
        {
            playerData = playerDatagO.GetComponent <PlayerDataController> ();
        }
        //StartNewRound ();
    }
コード例 #17
0
    private void Awake()
    {
        GameObject dome = GameObject.FindGameObjectWithTag("Sky");

        domeRenderer = dome.GetComponent <Renderer>();
        domeRenderer.material.mainTextureOffset = new Vector2(offset, 0);
        domeRenderX  = domeRenderer.material.mainTextureOffset.x;
        pDController = FindObjectOfType <PlayerDataController>().GetComponent <PlayerDataController>();
        uiController = FindObjectOfType <UIController>().GetComponent <UIController>();
    }
コード例 #18
0
 public void SaveShapes()
 {
     PlayerDataController.data.savedShapes = new List <MyTuples>();
     foreach (var shape in GameManager.instance.currentShapes)
     {
         Shape shapeData = shape.GetComponent <Shape>();
         PlayerDataController.data.savedShapes.Add(new MyTuples(shapeData.id, shapeData.spawnIndex));
     }
     PlayerDataController.SaveData("savedShapes", FlatHelper.ToJson <MyTuples>(PlayerDataController.data.savedShapes));
 }
コード例 #19
0
    public void UpdatePlayerGold(int amount)
    {
        if (amount != 0)
        {
            Gold += amount;

            PlayerDataController.SaveData("gold", Gold);
            UIManager.instance.UpdateGoldText();
        }
    }
コード例 #20
0
        // It indicates that the user deserves to receive a reward. You may need to store this information in a variable and give a reward
        // to the user after OnVideoDismiss() callback is called by showing some animations for instance.
        // Note: If OnVideoComplete callback is called for the ad, it is always called before OnVideoDismiss() callback.
        public void OnVideoComplete()
        {
            PlayerDataController.SaveData("isRewardedVideoWatched", true);

            AdManager.instance.onComplete(PlayerDataController.data.whichVideoFor, AdManager.AD_STATES.COMPLETE);
            if (PlayerDataController.data.GetVideoReward(PlayerDataController.data.whichVideoFor) > 0)
            {
                PlayerDataController.SaveData(PlayerDataController.data.whichVideoFor, PlayerDataController.data.GetVideoReward(PlayerDataController.data.whichVideoFor), true);
            }
            Debug.Log("Video Ad complete!");
        }
コード例 #21
0
    public void SaveBlockStatusChange(CellManager placement, bool placed)
    {
        MyTuples myTuple = PlayerDataController.data.uncompletedLevel.GetTuple(placement.index.x, placement.index.y);

        if (myTuple.isFull != placed)
        {
            myTuple.isFull = placed;

            PlayerDataController.SaveData("uncompletedLevel", FlatHelper.ToJson <MyTuples>(PlayerDataController.data.uncompletedLevel));
        }
    }
コード例 #22
0
    public void SaveMissionProgress(Mission mission)
    {
        // int k = 0;
        // foreach (var mission in activeLevelData.missions)
        // {
        string animalPlayerPrefsName = "animalProgress" + LevelManager.instance.activeLevelData.animalIndex[activeLevelData.missions.IndexOf(mission)];

        PlayerDataController.SaveData(animalPlayerPrefsName, mission.Count);
        //     k++;
        // }
    }
コード例 #23
0
    public void WinThisRound()
    {
        playerDataController = GameObject.FindGameObjectWithTag("Persistent")        //Get the PlayerDataController
                               .GetComponent <PlayerDataController>();
        if (playerDataController)
        {
            Debug.Log("playerDataController is found successfully");

            playerDataController.UpdatePlayerCoins(10);
        }
    }
コード例 #24
0
ファイル: SaveSystem.cs プロジェクト: jjgp13/Futbolito
    public static void SavePlayerData(PlayerDataController data)
    {
        BinaryFormatter bin = new BinaryFormatter();

        string     path   = Application.persistentDataPath + "/player.bin";
        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData playerData = new PlayerData(data);

        bin.Serialize(stream, playerData);
        stream.Close();
    }
コード例 #25
0
ファイル: CanvasController.cs プロジェクト: robinzhx/loom
 // Start is called before the first frame update
 void Start()
 {
     if (!dataController)
     {
         Debug.LogError("Did not assign PlayerDataController, try to find one...");
         dataController = GameObject.FindObjectOfType <PlayerDataController>();
         if (!dataController)
         {
             Debug.LogError("PlayerDataController NOT EXIST!!!");
         }
     }
 }
コード例 #26
0
 private void Awake()
 {
     if (instance == null)
     {
         instance  = this;
         ItemsList = new Dictionary <InventoryItem, int>();
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(instance);
 }
コード例 #27
0
 private void Awake()
 {
     if (PlayerDataController.Instance == null)
     {
         PlayerDataController.Instance = this;
         DontDestroyOnLoad(this);
         DeadCounter.f_Reset();
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
コード例 #28
0
 // It indicates that the rewarded video ad is closed by clicking cross button/back button.
 // It does not mean that the user deserves to receive a reward. You need to check whether OnVideoComplete callback is called or not.
 public void OnVideoDismiss()
 {
     if (PlayerDataController.data.isRewardedVideoWatched)
     {
         AdManager.instance.onComplete(PlayerDataController.data.whichVideoFor, AdManager.AD_STATES.COMPLETE);
     }
     else
     {
         AdManager.instance.onComplete(PlayerDataController.data.whichVideoFor, AdManager.AD_STATES.NOT_COMPLETE);
     }
     PlayerDataController.SaveData("whichVideoFor", "");
     AMRSDK.loadRewardedVideo();
     Debug.Log("Video Ad dismiss!");
 }
コード例 #29
0
    void Awake()
    {
        if (Controller != null && Controller != this)
        {
            Destroy(gameObject);
            return;
        }
        else
        {
            Controller = this;
        }

        DontDestroyOnLoad(gameObject);
    }
コード例 #30
0
    IEnumerator RandomSelectAnimation(int cycleCount, int[] travelList, int whichTheme)
    {
        var elapsed = 0;
        var xInc    = 234;
        var yInc    = -233.5f;

        var defaultX = -354.0f;
        var defaultY = 443.0f;

        animatedSelectedTheme.SetActive(true);

        if (whichTheme == 0)
        {
            lastSelectedTheme1.sprite = openThemeSprite;
        }
        else
        {
            lastSelectedTheme2.sprite = openThemeSprite;
        }

        while (elapsed < cycleCount)
        {
            animatedSelectedTheme.GetComponent <RectTransform>().position = new Vector2(
                Screen.width / 2 + defaultX + xInc * (travelList[elapsed] % 4),
                Screen.height / 2 + defaultY + yInc * (int)(travelList[elapsed] / 4)
                );
            yield return(new WaitForSeconds(.15f));

            elapsed++;
        }

        animatedSelectedTheme.SetActive(false);

        if (whichTheme == 0)
        {
            PlayerDataController.ChangeValueInList("theme1", "item" + (travelList[travelList.Length - 1] + 1), true);
            PlayerDataController.SaveData("gold", PlayerDataController.data.gold - PlayerDataController.data.inventory1RandomGoldPrice);
            ChangeTheme1(travelList[travelList.Length - 1]);
        }
        else
        {
            PlayerDataController.ChangeValueInList("theme2", "item" + (travelList[travelList.Length - 1] + 1), true);
            PlayerDataController.SaveData("gold", PlayerDataController.data.gold - PlayerDataController.data.inventory2RandomGoldPrice);
            ChangeTheme2(travelList[travelList.Length - 1]);
        }

        UpdateGoldText();
        StopCoroutine(randomSelectCoroutine);
    }
コード例 #31
0
 void Awake()
 {
     instance = this;
 }