Ejemplo n.º 1
0
    public void PurchaseCoffeeMaker()
    {
        CoffeeMakerAddition addition = PlayerAdditions.GetCoffeeMakerAddition();

        if (!addition.GetIsUnlocked())
        {
            if (addition.GetPurchaseCosts().HasInInventory())
            {
                addition.GetPurchaseCosts().SubtractFromInventory();
                PlayerAdditions.GetCoffeeMakerAddition().SetIsUnlocked(true);
                ShopCanvas.TriggerAdditionsInfoUpdate();

                // For this to immedialty show up, have to manually trigger
                // because the addition exists in the same scene as the menu
                cabinAdditionHandlers[0].HandleAdditions();
            }
            else
            {
                Debug.Log("Insufficient Resources");
            }
        }
        else
        {
            Debug.Log("Already Purchased: COFFEE MAKER");
        }
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        var text = AssetBundleContainer.LoadAsset <TextAsset>("jsons", "ShopKeepperTable");

        if (text == null)
        {
            AssetBundle result = AssetBundleContainer.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "jsons"));

            text = result.LoadAsset <TextAsset>("ShopKeepperTable");
        }

        //TODO: 본 게임에 들어갈때 삭제 할 코드
        //ItemContainer.CreateItem();

        Data = JsonManager.LoadJson <Serialization <string, ShopKeepperData> >(text).ToDictionary()[ID];

        _ShopCanvas = GetComponentInChildren <ShopCanvas>();

        nameText.text = Data.NPCName;

        List <int> copyItemID = new List <int>(Data.ItemID);

        _ShopCanvas.LinkingItems(copyItemID);

        _ShopCanvas.CloseCanvas();
    }
Ejemplo n.º 3
0
    void Awake()
    {
        if (!instance)
        {
            instance = this;
        }

        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 4
0
        void Awake()
        {
            if (m_LeaderboardPanel == null)
            {
                m_LeaderboardPanel = FindObjectOfType <LeaderboardPanel>();
            }
            if (m_ConfirmLogoutPanel == null)
            {
                m_ConfirmLogoutPanel = FindObjectOfType <ConfirmLogoutPanel>();
            }

            // show login panels
            if (m_LoginSignupPanels == null)
            {
                m_LoginSignupPanels = FindObjectOfType <LoginSignUpPanels>();
            }
            if (m_LoginSignupPanels)
            {
                m_LoginSignupPanels.gameObject.SetActive(true);
            }

            if (m_InfoPanel == null)
            {
                m_InfoPanel = FindObjectOfType <InfoPanel>();
            }
            if (m_MainMenuPanel == null)
            {
                m_MainMenuPanel = FindObjectOfType <MainMenuPanel>();
            }
            if (m_FadePanel == null)
            {
                m_FadePanel = FindObjectOfType <FadePanel>();
            }
            if (m_LevelPanel == null)
            {
                m_LevelPanel = FindObjectOfType <LevelPanel>();
            }
            if (m_ShopCanvas == null)
            {
                m_ShopCanvas = FindObjectOfType <ShopCanvas>();
            }
            if (m_BoostLoading == null)
            {
                m_BoostLoading = FindObjectOfType <BoostLoading>();
            }
            if (m_ScorePanel == null)
            {
                m_ScorePanel = FindObjectOfType <ScoreMenuPanel>();
            }
        }
Ejemplo n.º 5
0
    public void PurchaseWoodworkingBench()
    {
        WoodworkingBenchAddition addition = PlayerAdditions.GetWoodworkingBenchAddition();

        if (!addition.GetIsUnlocked())
        {
            if (addition.GetPurchaseCosts().HasInInventory())
            {
                addition.GetPurchaseCosts().SubtractFromInventory();
                PlayerAdditions.GetWoodworkingBenchAddition().SetIsUnlocked(true);
                ShopCanvas.TriggerAdditionsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources");
            }
        }
        else
        {
            Debug.Log("Already Purchased: WOODWORKING BENCH");
        }
    }
Ejemplo n.º 6
0
    public void PurchaseFrontPorch()
    {
        FrontPorchAddition addition = PlayerAdditions.GetFrontPorchAddition();

        if (!addition.GetIsUnlocked())
        {
            if (addition.GetPurchaseCosts().HasInInventory())
            {
                addition.GetPurchaseCosts().SubtractFromInventory();
                PlayerAdditions.GetFrontPorchAddition().SetIsUnlocked(true);
                ShopCanvas.TriggerAdditionsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources");
            }
        }
        else
        {
            Debug.Log("Already Purchased: FRONT PORCH");
        }
    }
Ejemplo n.º 7
0
    public void PurchaseFireplace()
    {
        FireplaceAddition addition = PlayerAdditions.GetFireplaceAddition();

        if (!addition.GetIsUnlocked())
        {
            if (addition.GetPurchaseCosts().HasInInventory())
            {
                addition.GetPurchaseCosts().SubtractFromInventory();
                PlayerAdditions.GetFireplaceAddition().SetIsUnlocked(true);
                ShopCanvas.TriggerAdditionsInfoUpdate();
                cabinAdditionHandlers[1].HandleAdditions();
            }
            else
            {
                Debug.Log("Insufficient Resources");
            }
        }
        else
        {
            Debug.Log("Already Purchased: FIREPLACE");
        }
    }
Ejemplo n.º 8
0
    public void UpgradeStudy()
    {
        StudyRoom study = PlayerRooms.GetStudyRoom();

        if (study.CanBeUpgraded())
        {
            int currentTier = PlayerRooms.GetStudyRoomTier();

            if (study.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                PlayerRooms.SetStudyRoomTier(currentTier + 1);
                study.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                ShopCanvas.TriggerRoomsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources:" + study.GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: STUDY ");
        }
    }
Ejemplo n.º 9
0
    public void UpgradeBedroom()
    {
        BedRoom bedroom = PlayerRooms.GetBedRoom();

        if (bedroom.CanBeUpgraded())
        {
            int currentTier = PlayerRooms.GetBedRoomTier();

            if (bedroom.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                PlayerRooms.SetBedRoomTier(currentTier + 1);
                bedroom.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                ShopCanvas.TriggerRoomsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources:" + bedroom.GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: BEDROOM ");
        }
    }
Ejemplo n.º 10
0
    public void UpgradeOffice()
    {
        OfficeRoom office = PlayerRooms.GetOfficeRoom();

        if (office.CanBeUpgraded())
        {
            int currentTier = PlayerRooms.GetOfficeRoomTier();

            if (office.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                PlayerRooms.SetOfficeRoomTier(currentTier + 1);
                office.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                ShopCanvas.TriggerRoomsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources:" + office.GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: OFFICE ");
        }
    }
Ejemplo n.º 11
0
    public void UpgradeKitchen()
    {
        KitchenRoom kitchen = PlayerRooms.GetKitchenRoom();

        if (kitchen.CanBeUpgraded())
        {
            int currentTier = PlayerRooms.GetKitchenRoomTier();

            if (kitchen.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                PlayerRooms.SetKitchenRoomTier(currentTier + 1);
                kitchen.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                ShopCanvas.TriggerRoomsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources:" + kitchen.GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: KITCHEN ");
        }
    }
Ejemplo n.º 12
0
    public void UpgradeWorkshop()
    {
        WorkshopRoom workshop = PlayerRooms.GetWorkshopRoom();

        if (workshop.CanBeUpgraded())
        {
            int currentTier = PlayerRooms.GetWorkshopRoomTier();

            if (workshop.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                PlayerRooms.SetWorkshopRoomTier(currentTier + 1);
                workshop.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                ShopCanvas.TriggerRoomsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources:" + workshop.GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: WORKSHOP ");
        }
    }
Ejemplo n.º 13
0
        public override void Action()
        {
            ShopCanvas c = new ShopCanvas(Managers.GameManager.Instance.PlayerData, this);

            (Managers.ScreenManager.Instance.CurrentScreen as Screens.GameScreen).ChangeCanvas(c);
        }