Beispiel #1
0
    void OnDestroy()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        playerData.fatigue = (int)currFatigue;
        SaveMgr.SavePlayerData(playerData);
    }
Beispiel #2
0
    private void SetFatigueBarWithCurrFatigue()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        currFatigue = playerData.fatigue;
        SetFatigueBar(currFatigue);
    }
Beispiel #3
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        currStep = playerData.foodBenefit; // 튜토리얼에서만 단계 인덱스로 씀
        StartCoroutine("StartTutorial");
    }
Beispiel #4
0
    IEnumerator StartTutorial()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        for (int i = currStep; i < 15; i++)
        {
            descriptions[i].SetActive(true);
            currStep = i;
            playerData.foodBenefit = currStep + 1;

            if (currStep == 9)
            {
                nextPanel.SetActive(false);
            }
            else if (currStep == 13)
            {
                nextPanel.SetActive(false);
            }
            else if (currStep == 14)
            {
                playerData.isNew       = false;
                playerData.foodBenefit = 0;
            }
            SaveMgr.SavePlayerData(playerData);
            yield return(new WaitUntil(() => clicked));

            clicked = false;
            descriptions[i].SetActive(false);
        }
    }
Beispiel #5
0
    public void SetBGMbyTime()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.isNew)
        {
            BGM[0].clip = BGM_by_time[2];
        }
        else
        {
            int intHour = playerData.intHour;
            if (intHour >= 20 && intHour < 22)       // 20~22, evening
            {
                BGM[0].clip = BGM_by_time[0];
            }
            else if (intHour >= 2 && intHour <= 4)   // 2~4, dawn
            {
                BGM[0].clip = BGM_by_time[2];
            }
            else                                    // else, night
            {
                BGM[0].clip = BGM_by_time[1];
            }
        }
    }
Beispiel #6
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.isNew)
        {
            currImage.sprite = dawn;
        }
        else
        {
            intHour = playerData.intHour;
            if (intHour >= 20 && intHour < 22)       // 20~22, evening
            {
                currImage.sprite = evening;
            }
            else if (intHour >= 2 && intHour <= 4)   // 2~4, dawn
            {
                currImage.sprite = dawn;
            }
            else                                    // else, night
            {
                currImage.sprite = night;
            }
        }
    }
Beispiel #7
0
    public void OnClickUpgrade()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.fRodLevel == 8)
        {
            return;
        }
        else
        {
            if (playerData.gold < fRodCost[fishingRodLevel])
            {
                SFXMgr.Instance.Button();
                noMoneyText.gameObject.SetActive(true);
                return;
            }
            else
            {
                SFXMgr.Instance.Coin();
                playerData.gold -= fRodCost[fishingRodLevel];
                gold.text        = playerData.gold.ToString();
                playerData.fRodLevel++;
                fishingRodLevel = playerData.fRodLevel + 1;
                setRodInfo();
            }
            SaveMgr.SavePlayerData(playerData);
        }
    }
Beispiel #8
0
    void OnDestroy()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        playerData.intHour     = intHour;
        playerData.timeElapsed = timeElapesd;

        SaveMgr.SavePlayerData(playerData);
    }
Beispiel #9
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        currImage       = GetComponent <Image>();
        fishingRodLevel = playerData.fRodLevel + 1;
        loadFRodInfo();
        setRodInfo();
    }
Beispiel #10
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        currImage = GetComponent <Image>();
        hookLevel = playerData.hookLevel + 1;
        loadHookInfo();
        setHookInfo();
    }
Beispiel #11
0
    public void SetResult()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        dayTxt.text         = "Day " + playerData.day;
        myGoldTxt.text      = "소지 골드 : " + playerData.gold + " G";
        todayTotalTxt.text  = "오늘 번 돈 : " + playerData.todayGold + " G";
        salayTxt.text       = "일급 : " + salary + " G";
        medicalBillTxt.text = "병원비 : - " + medicalBill + " G";
    }
Beispiel #12
0
 private void Awake()
 {
     if(instance != null)
     {
         Destroy(this.gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(this);
 }
Beispiel #13
0
 void Start()
 {
     UpdateGoldNum(SaveMgr.LoadPlayerData().gold);
     title.text = "상점";
     category.SetActive(true);
     fishingRod.SetActive(false);
     hook.SetActive(false);
     bait.SetActive(false);
     food.SetActive(false);
 }
Beispiel #14
0
    private int GetEnableFishNum()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();
        int sum = 0;

        for (int i = 0; i < playerData.inven_code.Count; i++)
        {
            sum += playerData.inven_num[i];
        }
        return(sum);
    }
Beispiel #15
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        food1txt.text = playerData.foodNum[1].ToString();
        food2txt.text = playerData.foodNum[2].ToString();
        food3txt.text = playerData.foodNum[3].ToString();
        piroGaugeBar  = FindObjectOfType <PiroGaugeBar>();
        food1Image    = food1.GetComponent <Image>();
        food2Image    = food2.GetComponent <Image>();
        food3Image    = food3.GetComponent <Image>();
    }
Beispiel #16
0
    public void OnClickStart()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.isNew)
        {
            StartCoroutine(StartPrologue());
        }
        else
        {
            StartCoroutine(StartGame());
        }
    }
Beispiel #17
0
    public void OnClickSellAll()
    {
        SFXMgr.Instance.Coin();

        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();
        int sum = 0;

        // 가격 리스트 만들기
        if (costList.Count == 0)
        {
            for (int i = 0; i < fishContainer.level0.Length; i++)
            {
                costList.Add(fishContainer.level0[i].cost);
            }
            for (int i = 0; i < fishContainer.level1.Length; i++)
            {
                costList.Add(fishContainer.level1[i].cost);
            }
            for (int i = 0; i < fishContainer.level2.Length; i++)
            {
                costList.Add(fishContainer.level2[i].cost);
            }
            for (int i = 0; i < fishContainer.level3.Length; i++)
            {
                costList.Add(fishContainer.level3[i].cost);
            }
            for (int i = 0; i < fishContainer.level4.Length; i++)
            {
                costList.Add(fishContainer.level4[i].cost);
            }
        }

        // 합계 계산
        for (int i = 0; i < playerData.inven_code.Count; i++)
        {
            sum += playerData.inven_num[i] * costList[i];
            playerData.inven_num[i] = 0;
        }
        for (int i = 0; i < playerData.inven_num.Count; i++)
        {
            playerData.inven_num[i] = 0;
        }
        playerData.gold      += sum;
        playerData.todayGold += sum;
        gold.text             = playerData.gold.ToString();
        SaveMgr.SavePlayerData(playerData);
        SetEnableFish();

        invenIdx.Clear();
        fishInfo.SetActive(false);
    }
Beispiel #18
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        isDiscovered = playerData.dogam[index];
        if (isDiscovered == false)
        {
            gameObject.SetActive(false);
        }
        else
        {
            dogamControl = FindObjectOfType <DogamControl>();
        }
    }
Beispiel #19
0
    public void SetCurrFishInfo(int index)
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();
        int lv_idx    = index / 3;
        int in_lv_idx = index % 3;

        gradeImage.sprite = gradeSprites[lv_idx];
        fishNum.text      = "수량 : " + playerData.inven_num[index];
        fishImage.sprite  = fishSprites[index];
        if (lv_idx == 0)
        {
            fishName.text        = fishContainer.level0[in_lv_idx].name;
            fishNameEng.text     = fishContainer.level0[in_lv_idx].eng;
            fishCost.text        = "가격 : " + fishContainer.level0[in_lv_idx].cost + "G";
            fishDescription.text = fishContainer.level0[in_lv_idx].description;
            currFishCost         = fishContainer.level0[in_lv_idx].cost;
        }
        if (lv_idx == 1)
        {
            fishName.text        = fishContainer.level1[in_lv_idx].name;
            fishNameEng.text     = fishContainer.level1[in_lv_idx].eng;
            fishCost.text        = "가격 : " + fishContainer.level1[in_lv_idx].cost + "G";
            fishDescription.text = fishContainer.level1[in_lv_idx].description;
            currFishCost         = fishContainer.level1[in_lv_idx].cost;
        }
        if (lv_idx == 2)
        {
            fishName.text        = fishContainer.level2[in_lv_idx].name;
            fishNameEng.text     = fishContainer.level2[in_lv_idx].eng;
            fishCost.text        = "가격 : " + fishContainer.level2[in_lv_idx].cost + "G";
            fishDescription.text = fishContainer.level2[in_lv_idx].description;
            currFishCost         = fishContainer.level2[in_lv_idx].cost;
        }
        if (lv_idx == 3)
        {
            fishName.text        = fishContainer.level3[in_lv_idx].name;
            fishNameEng.text     = fishContainer.level3[in_lv_idx].eng;
            fishCost.text        = "가격 : " + fishContainer.level3[in_lv_idx].cost + "G";
            fishDescription.text = fishContainer.level3[in_lv_idx].description;
            currFishCost         = fishContainer.level3[in_lv_idx].cost;
        }
        if (lv_idx == 4)
        {
            fishName.text        = fishContainer.level4[in_lv_idx].name;
            fishNameEng.text     = fishContainer.level4[in_lv_idx].eng;
            fishCost.text        = "가격 : " + fishContainer.level4[in_lv_idx].cost + "G";
            fishDescription.text = fishContainer.level4[in_lv_idx].description;
            currFishCost         = fishContainer.level4[in_lv_idx].cost;
        }
    }
Beispiel #20
0
    void CheckTime()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        gold.text   = playerData.gold.ToString();
        intHour     = playerData.intHour;
        timeElapesd = playerData.timeElapsed;
        minute.text = (timeElapesd / 10).ToString("0") + 0;
        hour.text   = intHour.ToString();
        if (intHour >= 20 && intHour < 22)       // 20~22, evening
        {
            cg_e.alpha = 1f;
            evening.SetActive(true);
            fisher.transform.GetChild(0).gameObject.SetActive(true);
            cg_n.alpha = 0f;
            night.SetActive(false);
            fisher.transform.GetChild(1).gameObject.SetActive(false);
            cg_d.alpha = 0f;
            dawn.SetActive(false);
            fisher.transform.GetChild(2).gameObject.SetActive(false);
            lights.SetInteger("BackState", 0);
        }
        else if (intHour >= 2 && intHour <= 4)   // 2~4, dawn
        {
            cg_e.alpha = 0f;
            evening.SetActive(false);
            fisher.transform.GetChild(0).gameObject.SetActive(false);
            cg_n.alpha = 0f;
            night.SetActive(false);
            fisher.transform.GetChild(1).gameObject.SetActive(false);
            cg_d.alpha = 1f;
            dawn.SetActive(true);
            fisher.transform.GetChild(2).gameObject.SetActive(true);
            lights.SetInteger("BackState", 2);
        }
        else                                    // else, night
        {
            cg_e.alpha = 0f;
            evening.SetActive(false);
            fisher.transform.GetChild(0).gameObject.SetActive(false);
            cg_n.alpha = 1f;
            night.SetActive(true);
            fisher.transform.GetChild(1).gameObject.SetActive(true);
            cg_d.alpha = 0f;
            dawn.SetActive(false);
            fisher.transform.GetChild(2).gameObject.SetActive(false);
            lights.SetInteger("BackState", 1);
        }
    }
Beispiel #21
0
    public void UpdateEquipBaitToPlayerData(bool isSelected)
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (isSelected)
        {
            playerData.currBaitIndex = currBaitIndex;
        }
        else
        {
            playerData.currBaitIndex = 0;
        }

        SaveMgr.SavePlayerData(playerData);
    }
Beispiel #22
0
    public void OnClickFood3()
    {
        SFXMgr.Instance.EatFood();

        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.foodNum[3] > 0)
        {
            playerData.foodBenefit = 25;
            playerData.foodNum[3]--;
            food3txt.text = playerData.foodNum[3].ToString();
            piroGaugeBar.SetFatigueBarZero();
        }
        SaveMgr.SavePlayerData(playerData);
    }
Beispiel #23
0
    public void OnClickFood1()
    {
        SFXMgr.Instance.EatFood();

        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.foodNum[1] > 0)
        {
            playerData.foodNum[1]--;
            food1txt.text = playerData.foodNum[1].ToString();
            piroGaugeBar.AddFatigueness(-200);
        }

        SaveMgr.SavePlayerData(playerData);
    }
Beispiel #24
0
    void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.isNew)
        {
            for (int i = 2; i < 5; i++)
            {
                descriptions.Add(gameObject.transform.GetChild(i).gameObject);
            }
            StartCoroutine(StartTutorial());
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
Beispiel #25
0
    private void Start()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        BGMMgr.Instance.StopBGM(0);
        BGMMgr.Instance.StopBGM(1);
        // set date
        playerData.day++;
        // get today fatigue
        fatigue = playerData.fatigue;
        // calculate reduced salary
        if (fatigue - playerData.foodBenefit > 100)
        {
            salary = 30;
        }
        else
        {
            salary = 100;
        }
        // claculate carrying gold
        myGold = playerData.gold;
        playerData.foodBenefit = 0;
        // set medical bill & message
        if (fatigue >= 125f)
        {
            medicalBill     = (int)(playerData.gold * 0.1);
            myGold         -= medicalBill;
            messageTxt.text = "*피곤한 하루였습니다.";
        }
        else
        {
            messageTxt.text = "*오늘 하루도 무사히 마쳤습니다.";
        }
        myGold         += salary;
        playerData.gold = myGold;
        // set randomized tmi context
        tmiTxt.text = TMILoader.LoadRandomTMI();
        // set result
        SetResult();
        // reset fatigue, time, today total
        playerData.fatigue     = 0;
        playerData.intHour     = 20;
        playerData.timeElapsed = -5f;
        playerData.todayGold   = 0;
        SaveMgr.SavePlayerData(playerData);
    }
Beispiel #26
0
    IEnumerator StartTutorial()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        for (int i = 0; i < 3; i++)
        {
            descriptions[i].SetActive(true);
            if (i == 2)
            {
                isDone = true;
            }
            yield return(new WaitUntil(() => clicked));

            clicked = false;
            descriptions[i].SetActive(false);
        }
    }
Beispiel #27
0
    // Fisher의 Animation event
    public void FishingSucceed()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        int codeIndex = playerData.inven_code.IndexOf(GameMgr.Instance.caughtFishCode);;

        playerData.inven_num[codeIndex]++;
        playerData.dogam[codeIndex - 3] = true;
        SaveMgr.SavePlayerData(playerData);

        GameObject tmp = Instantiate(caughtFish, fishPos.position, Quaternion.identity);

        tmp.transform.SetParent(fishPos);
        result.text = GameMgr.Instance.caughtFishName + "(을)를 낚았습니다.";

        fishingResult.SetActive(true);
    }
Beispiel #28
0
    private void initializeFishInfo()
    {
        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        invenIdx.Clear();
        for (int i = 0; i < playerData.inven_code.Count; i++)
        {
            if (playerData.inven_num[i] > 0)
            {
                invenIdx.Add(i);
            }
        }
        if (invenIdx.Count > 0)
        {
            SetCurrFishInfo(invenIdx[0]);
        }
    }
Beispiel #29
0
    void LoadHistory()
    {
        int userCount = SaveMgr.GetHistoryAccountAndPwds().Count;

        foreach (string key in SaveMgr.GetHistoryAccountAndPwds().Keys)
        {
            userAccounts.Add(key);
        }
        for (int i = 0; i < userCount; i++)
        {
            userItems[i].SetActive(true);
            userItems[i].GetComponentInChildren <UILabel>().text = userAccounts[i];
        }
        for (int i = userCount; i < 5; i++)
        {
            userItems[i].SetActive(false);
        }
    }
Beispiel #30
0
    public void OnClickFood2()
    {
        SFXMgr.Instance.EatFood();

        SerializablePlayerData playerData = SaveMgr.LoadPlayerData();

        if (playerData.foodNum[2] > 0)
        {
            if (playerData.foodBenefit < 10)
            {
                playerData.foodBenefit = 10;
            }
            Debug.Log(playerData.foodBenefit);
            playerData.foodNum[2]--;
            food2txt.text = playerData.foodNum[2].ToString();
            piroGaugeBar.AddFatigueness(-400);
        }
        SaveMgr.SavePlayerData(playerData);
    }