コード例 #1
0
    public void InitUIElements()
    {
        currencyCostIcon.gameObject.SetActive(false);
        if (_foodAndBeverageData.state == ItemState.LOCKED || _foodAndBeverageData.state == ItemState.TO_BE_UNLOCKED)
        {
            lockedBox.SetActive(true);
            idleBox.SetActive(false);
            lockedFillImage.sprite = _foodAndBeverageData.icon;
            lockedNameText.gameObject.GetComponent <LocalizationComponent>().SetTheLocalizedText(_foodAndBeverageData.name);
            tapToUnlockText.gameObject.SetActive(_foodAndBeverageData.state == ItemState.TO_BE_UNLOCKED);
            locketAnim.gameObject.SetActive(_foodAndBeverageData.state == ItemState.LOCKED);
            //lockedInfoText.gameObject.SetActive(_rideData.state == ItemState.LOCKED);
            if (_foodAndBeverageData.state == ItemState.LOCKED)
            {
                lockedInfoText.gameObject.GetComponent <LocalizationComponent>().SetTheLocalizedText();
            }
            else
            {
                AttractionsDataAsset    attractionsDataAsset = GameManager.Instance.GetAttractionsData();
                AttractionDataAssetItem assetDataItem        = attractionsDataAsset.attractionsDataAsset.Find
                                                                   (a => a.gameEventType == attractionsDataAsset.currentEvent);
                BasicAtractionData attrationData     = assetDataItem.GetBasicAttractionForGUID(guid);
                string             costText          = LocalizationManager.Instance.GetTextForKey("UNLOCK_COST");
                UnlockCondition    currencyCondition = attrationData.unlockConditionList.Find(a => a.unlockConditionType == UnlockConditionType.PAY_CURRENCY);
                if (currencyCondition != null)
                {
                    lockedInfoText.text = costText + currencyCondition.unlockConditionValue.currencyAmount.amount.ToString();
                    CurrencyData currencyData = GameManager.Instance.GetGameData().currencies.Find(
                        a => a.type == currencyCondition.unlockConditionValue.currencyAmount.type);
                    currencyCostIcon.gameObject.SetActive(true);
                    currencyCostIcon.sprite = currencyData.icon;
                }
            }
        }

        if (_foodAndBeverageData.state == ItemState.IDLE)
        {
            lockedBox.SetActive(false);
            idleBox.SetActive(true);

            icon.sprite = _foodAndBeverageData.icon;
            nameText.gameObject.GetComponent <LocalizationComponent>().SetTheLocalizedText(_foodAndBeverageData.name);
            descriptionText.gameObject.GetComponent <LocalizationComponent>().SetTheLocalizedText(_foodAndBeverageData.description);
            amountText.text = _userProductData.count.ToString();

            buyBtnText.text = LocalizationManager.Instance.GetTextForKey(buyBtnText.GetComponent <LocalizationComponent>().localizationKey)
                              + " " + _foodAndBeverageData.initialCost.amount.ToString();
            buyBtnCurrencyIcon.sprite = gameAsset.currencies.Find(x => x.type == _foodAndBeverageData.initialCost.type).icon;
            profitDescriptionBox.Init(_foodAndBeverageData.initialProfits);
        }
        //check state
    }
コード例 #2
0
    //TODO - add card!

    public override void Init(BasePopupData data)
    {
        base.Init(data);
        userInventory = GameManager.Instance.GetUserInventory();
        UserProductData         inventoryData        = userInventory.productDataList.Find(x => x.guid == ((AtractionPopupData)data).guid);
        AttractionsDataAsset    attractionsDataAsset = GameManager.Instance.GetAttractionsData();
        AttractionDataAssetItem assetDataItem        = attractionsDataAsset.attractionsDataAsset.Find
                                                           (a => a.gameEventType == attractionsDataAsset.currentEvent);
        RideData rideData = assetDataItem.rideData.Find(a => a.guid == ((AtractionPopupData)data).guid);

        if (rideData != null)
        {
            InitRidePopup(rideData, inventoryData);
        }
    }
コード例 #3
0
    private void InitRecreationAreaList(AttractionsListData data, List <UserProductData> userProductDataList)
    {
        transform.GetComponent <Image>().color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
        AttractionDataAssetItem assetDataItem = attractionsDataAsset.attractionsDataAsset.Find
                                                    (a => a.gameEventType == attractionsDataAsset.currentEvent);
        List <RecreationAreaData> recreationAreaDataList = assetDataItem.recreationAreaData;

        foreach (UserProductData userData in userProductDataList)
        {
            GameObject gameObj = Instantiate(data.prefab);
            RecreationAreaElementUI recreationAreaElementUI = gameObj.GetComponent <RecreationAreaElementUI>();
            recreationAreaElementUI.Init(recreationAreaDataList.Find(a => a.guid == userData.guid));

            gameObj.transform.SetParent(listParent, false);
        }
    }
コード例 #4
0
    public void Debug_UnlockAllItems()
    {
        AttractionDataAssetItem assetItem = GetAttractionsData().GetCurrentEventAssets();

        GetUserInventory().productDataList.Clear();
        foreach (RideData ride in assetItem.rideData)
        {
            GetUserInventory().OnItemBought(ride.guid, AttractionType.RIDE, 15001);
        }
        foreach (FoodAndBeverageData foodAndBeverage in assetItem.foodAndBeverageData)
        {
            GetUserInventory().OnItemBought(foodAndBeverage.guid, AttractionType.FOOD_AND_BEVERAGE, 22009);
        }
        foreach (RecreationAreaData recreationArea in assetItem.recreationAreaData)
        {
            GetUserInventory().OnItemBought(recreationArea.guid, AttractionType.RECREATION_AREA, 3500);
        }
    }
コード例 #5
0
    public void Debug_NewUserScenario()
    {
        AttractionDataAssetItem assetItem = GetAttractionsData().GetCurrentEventAssets();

        GetUserInventory().productDataList.Clear();
        List <RideData> freeRideUnlockedItems = assetItem.rideData.FindAll(a => a.unlockConditionList.Find(x => x.unlockConditionType == UnlockConditionType.FREE) != null);

        foreach (RideData ride in freeRideUnlockedItems)
        {
            bool isUnlocked = UnlockManager.Instance.CheckUnlockConditions(ride.unlockConditionList);
            if (isUnlocked)
            {
                GetUserInventory().OnItemBought(ride.guid, AttractionType.RIDE, 1);
            }
        }

        List <FoodAndBeverageData> freeFABUnlockedItems = assetItem.foodAndBeverageData.FindAll(a => a.unlockConditionList.Find(x => x.unlockConditionType == UnlockConditionType.FREE) != null);

        foreach (FoodAndBeverageData ride in freeFABUnlockedItems)
        {
            bool isUnlocked = UnlockManager.Instance.CheckUnlockConditions(ride.unlockConditionList);
            if (isUnlocked)
            {
                GetUserInventory().OnItemBought(ride.guid, AttractionType.FOOD_AND_BEVERAGE, 1);
            }
        }

        List <RecreationAreaData> freeRAUnlockedItems = assetItem.recreationAreaData.FindAll(a => a.unlockConditionList.Find(x => x.unlockConditionType == UnlockConditionType.FREE) != null);

        foreach (RecreationAreaData ride in freeRAUnlockedItems)
        {
            bool isUnlocked = UnlockManager.Instance.CheckUnlockConditions(ride.unlockConditionList);
            if (isUnlocked)
            {
                GetUserInventory().OnItemBought(ride.guid, AttractionType.RECREATION_AREA, 1);
            }
        }
    }
コード例 #6
0
    public override void Init(BasePopupData data)
    {
        base.Init(data);
        _unlockConditionsList.Clear();
        AttractionsDataAsset    attractionsDataAsset = GameManager.Instance.GetAttractionsData();
        AttractionDataAssetItem assetDataItem        = attractionsDataAsset.attractionsDataAsset.Find
                                                           (a => a.gameEventType == attractionsDataAsset.currentEvent);
        BasicAtractionData attrationData = assetDataItem.GetBasicAttractionForGUID(((AttractionUnlockPopupData)data).guid);

        titleText.GetComponent <LocalizationComponent>().SetTheLocalizedText(attrationData.name);
        icon.sprite = attrationData.icon;
        foreach (UnlockCondition condition in attrationData.unlockConditionList)
        {
            if (condition.unlockConditionType != UnlockConditionType.FREE)
            {
                UnlockConditionComponent newCondition = Instantiate <UnlockConditionComponent>(
                    unlockConditionComponentPrefab, transform.position, Quaternion.identity);
                newCondition.transform.SetParent(unlockConditionsListParent, false);
                newCondition.Init(condition);
                _unlockConditionsList.Add(newCondition);
            }
        }
    }