コード例 #1
0
        GameObject[] GetNotOwnedShipsFromPrefabList()
        {
            //Get all ships available from repository
            GameObject[] ships          = Resources.LoadAll <GameObject>("Prefabs/Ships");
            var          ownedShipdsIds = PlayerStatusService.LoadPlayerStatus().GetOwnedShipsIDs();

            return(ships.Where(x => !ownedShipdsIds.Contains(x.GetComponent <Ship>().GetId())).ToArray());
        }
コード例 #2
0
        public void LoadOwnedShips(bool displayPriceTag)
        {
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            GameObject[] ships        = GetAllShipsFromPrefabList();
            GameObject[] filteredList = ships.Where(x =>
                                                    playerData.GetOwnedShipsIDs().Contains(x.GetComponent <Ship>().shipId)).ToArray();
            PlotShipsIntoCarousel(filteredList, displayPriceTag);
        }
コード例 #3
0
        void DisableOwnedShips()
        {
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            foreach (var shipInstance in shipsInstance)
            {
                //if player has already bought this ship, disable its button
                if (playerData.GetOwnedShipsIDs().Contains(shipInstance.GetComponent <Ship>().shipId))
                {
                    DisableShipButtonClick(shipInstance);
                }
            }
        }
コード例 #4
0
        public void HideNotOwnedShips()
        {
            PlayerStatusData playerData    = PlayerStatusService.LoadPlayerStatus();
            List <int>       ownedShipsIDs = playerData.GetOwnedShipsIDs();

            foreach (var shipInstance in shipsInstance)
            {
                //if player doesn't have a ship, remove it from the interface
                if (!ownedShipsIDs.Contains(shipInstance.GetComponent <Ship>().shipId))
                {
                    shipInstance.SetActive(false);
                }
            }
        }
コード例 #5
0
        void DisableOwnedShips(Ship[] instantiatedShips)
        {
            //player data in ShipCarousel instance has not been loaded yet, so we'll have to do it manually
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            foreach (var shipInstance in instantiatedShips)
            {
                //if player has already bought this ship, disable its button
                if (playerData.GetOwnedShipsIDs().Contains(shipInstance.GetId()))
                {
                    shipInstance.DisableCharacterButton();
                }
            }
        }
コード例 #6
0
        public void SetCulture(string culture)
        {
            selectAudioSource.Play();

            var playerData = PlayerStatusService.LoadPlayerStatus();

            playerData.SetCurrentLanguage(culture);

            PlayerStatusService.SavePlayerStatus(playerData);

            LanguageService.ReloadDictionary();

            scenesManager.LoadMainMenu();
        }
コード例 #7
0
ファイル: LivesPrize.cs プロジェクト: bigstupidx/ShallowAbyss
        public override void GivePrize(GameOverManager gameOverManager)
        {
            PlayerStatusService.LoadPlayerStatus().storedLifePrizes += base.Amount;

            AdsPrizeData prizeData = new AdsPrizeData();

            prizeData.message = base.languageDictionary.adsResultMsgLives;

            prizeData.prizeSprite = Resources.Load <Sprite>(base.resourcesSpritePath + "StoredLives");


            gameOverManager.SetPrizeMessage(prizeData);
            resultPrizeOkBtn.onClick.RemoveAllListeners();
            resultPrizeOkBtn.onClick.AddListener(() => { resultPrizePanel.SetActive(false); });
        }
コード例 #8
0
ファイル: Ship.cs プロジェクト: bigstupidx/ShallowAbyss
        private void Start()
        {
            playerData = PlayerStatusService.LoadPlayerStatus();

            priceTag.text      = string.Format("{0}", shipPrice);
            ui_shipDescription = GameObject.Find("SelectedItemDescription").GetComponent <Text>();
            var selectedObjectManager = GameObject.Find("SelectedObjectManager").GetComponent <SelectedObjectManager>();


            shipButton = this.transform.Find("ShipButton");
            var cmp = shipButton.gameObject.GetComponentInChildren <Image>();

            cmp.sprite = shipImage;

            //set listener when clicking to select object
            shipButton.GetComponent <Button>().onClick.AddListener(() => selectedObjectManager.SetSelectedObject(this));

            originalColor = shipButton.GetComponent <Image>().color;
        }
コード例 #9
0
        public override void GivePrize(GameOverManager gameOverManager)
        {
            int finalCredits = gameOverManager.GetFinalScore();
            int totalCredits = base.Amount * finalCredits;

            PlayerStatusService.LoadPlayerStatus().score += totalCredits;

            AdsPrizeData prizeData = new AdsPrizeData();

            if (!string.IsNullOrEmpty(base.languageDictionary.adsResultMsgCredits))
            {
                prizeData.message = string.Format(base.languageDictionary.adsResultMsgCredits, base.Amount);
            }

            prizeData.prizeSprite = Resources.Load <Sprite>(base.resourcesSpritePath + "Coin");


            gameOverManager.SetPrizeMessage(prizeData);
            resultPrizeOkBtn.onClick.RemoveAllListeners();
            resultPrizeOkBtn.onClick.AddListener(() => { resultPrizePanel.SetActive(false); gameOverManager.RollScoreForAdsCredits(totalCredits); });
        }
コード例 #10
0
        static LanguageDictionary LoadDictionary()
        {
            var currentCulture    = PlayerStatusService.LoadPlayerStatus().GetCurrentLanguage();
            LanguageDictionary ld = new LanguageDictionary();

            ld.isLoaded = false;
            if (Application.platform == RuntimePlatform.Android)
            {
                string filePath = string.Format("{0}/Language_{1}.json", Application.streamingAssetsPath, currentCulture);

                WWW reader = new WWW(filePath);
                while (!reader.isDone)
                {
                }

                //we have to remove 3 bytes from the reader head and parse it into string
                string jsonString;
                jsonString = System.Text.Encoding.UTF8.GetString(reader.bytes, 3, reader.bytes.Length - 3);

                ld          = JsonUtility.FromJson <LanguageDictionary>(jsonString);
                ld.isLoaded = true;
            }
            return(ld);
        }
コード例 #11
0
 public override Action BuyItem()
 {
     return(() => PlayerStatusService.LoadPlayerStatus().IncreaseLifeBuff(1));
 }
コード例 #12
0
 public override Func <bool> HasReachedItemMax()
 {
     return(() => PlayerStatusService.LoadPlayerStatus().CanIncreaseLifeBuff());
 }
コード例 #13
0
 public override Action BuyItem()
 {
     return(() => PlayerStatusService.LoadPlayerStatus().IncreaseJackpotTokens(1));
 }
コード例 #14
0
 public override Action BuyItem()
 {
     return(() => PlayerStatusService.LoadPlayerStatus().IncreaseShieldUpgrade());
 }
コード例 #15
0
 public override Func <bool> HasReachedItemMax()
 {
     return(() => PlayerStatusService.LoadPlayerStatus().CanUpgradeShield());
 }