Ejemplo n.º 1
0
    public void ExitMerchant()
    {
        ThreatUIManager.GetInstance().Show();

        List <WholeMonsterRiskManager.MonsterRisk> tonightHunted =
            WholeMonsterRiskManager.GetInstance().DecreaseThreat(WholeMonsterRiskManager.GetInstance().LetsHuntingAtEndOfDay());

        List <WholeMonsterRiskManager.MonsterRisk> increasedThreat = WholeMonsterRiskManager.GetInstance().IncreaseThreat();



        ThreatUIManager.GetInstance().exitBtn.onClick.AddListener(
            () => {
            AdAsk();        //위협도 정산 후 광고 묻기로 이동. 알아서 머챈트와 위협도는 꺼져있음.
        }
            );
        ThreatUIManager.GetInstance().exitBtn.interactable = false;

        StartCoroutine(ThreatUIAnim(tonightHunted, increasedThreat));


        GameEndJudgeManager.GetInstance().didThreatHitsMax(WholeMonsterRiskManager.GetInstance().IsThreatHitsMax());



        //이 로직은 따로 빼야함.
    }
Ejemplo n.º 2
0
    public void AdAskCancel()
    {
        adAskCanvas.SetActive(false);
        GoldManager.GetInstance().AdjustGold(-1 * Constant.defenseExpense, GoldManager.E_PayType.NOTHING); //방위비용 지불.
        GameEndJudgeManager.GetInstance().didGoldRunOut(GoldManager.GetInstance().IsGoldRunOut());

        if (GameEndJudgeManager.GetInstance().IsGameEnd())
        {
            gameEndCanvas.SetActive(true);
            return;
        }
        callItADayUI.gameObject.SetActive(true);
        callItADayUI.Init(false);
    }
Ejemplo n.º 3
0
    public void Init(bool didWatchAd)
    {
        todayStartGoldTxt.text = GoldManager.GetInstance().TodayStartWallet.ToString();

        if (didWatchAd)
        {
            todayDefenseGoldTxt.text = "0";
        }
        else
        {
            todayDefenseGoldTxt.text = "- " + Constant.defenseExpense.ToString();
        }


        TextShowByColor(todayClientIncomeGoldTxt, GoldManager.GetInstance().ClientIncomeToday);

        TextShowByColor(todayHunterPayGoldTxt, GoldManager.GetInstance().HunterPaymentToday);

        TextShowByColor(todayRemainGoldTxt, GoldManager.GetInstance().Gold);

        TextShowByColor(todayMerchantBuyCostTxt, GoldManager.GetInstance().MerchantBuyCost);

        TextShowByColor(todayMerchantSellCostIncomeTxt, GoldManager.GetInstance().MerchantSellCostIncome);


        string net = noteEndInfoShowTxt_Threat.text;

        net = net.Replace("[0]", Constant.ThreatHoldDays.ToString());
        noteEndInfoShowTxt_Threat.text = net;

        string neg = noteEndInfoShowTxt_Gold.text;

        neg = neg.Replace("[0]", Constant.GoldRunOutHoldDays.ToString());
        noteEndInfoShowTxt_Gold.text = neg;

        string netnow = noteThreatShowTxt.text;

        netnow = netnow.Replace("[0]", GameEndJudgeManager.GetInstance().ThreatMaxContinuityDays.ToString());
        noteThreatShowTxt.text = netnow;

        string negnow = noteGoldShowTxt.text;

        negnow = negnow.Replace("[0]", GameEndJudgeManager.GetInstance().GoldRunOutContinuityDays.ToString());
        noteGoldShowTxt.text = negnow;
    }
Ejemplo n.º 4
0
    public void AdShowDone()
    {
        Debug.Log("광고 끝 확인");
        bool rewarded = AdMobManager.GetInstance().Rewarded;

        adAskCanvas.SetActive(false);

        GameEndJudgeManager.GetInstance().didGoldRunOut(GoldManager.GetInstance().IsGoldRunOut());

        if (GameEndJudgeManager.GetInstance().IsGameEnd())
        {
            gameEndCanvas.SetActive(true);
            return;
        }

        callItADayUI.gameObject.SetActive(true);

        callItADayUI.Init(rewarded);
    }
Ejemplo n.º 5
0
    public void NewStartGame()  //완전 새로운 게임 시작.
    {
        SaveManager.GetInstance().DeleteSavedGame();

        SettingUIManager.GetInstance().PauseBtn.interactable = true;
        Debug.Log("게임매니져 - 뉴스타트게임-");

        InGameTimeManager.GetInstance().SetMainTime(1, 1, 1, 1, 1);
        WholeMonsterRiskManager.GetInstance().Init();
        PhaseManager.GetInstance().InitForNewStart();
        GoldManager.GetInstance().SetGold(Constant.newStartGolds);
        QuestManager.GetInstance().QuestDic.Clear();
        Inventory.GetInstance().MobEvidenceInven.Clear();
        Inventory.GetInstance().WeaponInventory.Clear();
        GameEndJudgeManager.GetInstance().InitForNewStart();
        CharactorManager.GetInstance().InitForNewStart();
        TextManager.GetInstance().DistributedNames.Clear();

        //모킹/
        for (int i = 0; i < (int)E_Monster.MAX; i++)
        {
            for (int j = 0; j < (int)E_Evidence.MAX; j++)
            {
                Inventory.GetInstance().AddMobEvi(new QuestPerMob((E_Monster)i, (E_Evidence)j, 3));
            }
        }
        List <Weapon> temp = new List <Weapon>();
        Weapon        w    = WeaponInfoManager.GetInstance().CreateWeapon(E_Weapon.AXE);

        temp.Add(w);
        Inventory.GetInstance().AddWeaponsToInven(temp);

        //모킹종료


        StartCoroutine(LoadingScene("QuestRoom_1", StartNewMorning));
    }
Ejemplo n.º 6
0
    public void SavePrepare()
    {
        lang  = LanguageManager.GetInstance().Language;
        golds = GoldManager.GetInstance().Gold;
        goldRunOutContinuityDays = GameEndJudgeManager.GetInstance().GoldRunOutContinuityDays;
        threatMaxContinuityDays  = GameEndJudgeManager.GetInstance().ThreatMaxContinuityDays;
        savedDate = InGameTimeManager.GetInstance().GetNowTime();

        charactorList_Client = CharactorManager.GetInstance().GetClientListSave();
        charactorList_Hunter = CharactorManager.GetInstance().GetHunterListSave();

        questDic          = QuestManager.GetInstance().QuestDic;
        inventoryMobEvi   = Inventory.GetInstance().MobEvidenceInven;
        inventoryWeapon   = Inventory.GetInstance().GetWeaponInvenSave();
        threatState       = WholeMonsterRiskManager.GetInstance().MonsterRiskList;
        threatHunters     = WholeMonsterRiskManager.GetInstance().HuntersWhohaveQuest;
        phaseMobShowedUp  = PhaseManager.GetInstance().MobShowedUp;
        phaseMobOpen      = PhaseManager.GetInstance().MobOpen;
        phaseEvidenceOpen = PhaseManager.GetInstance().EvidenceOpen;
        phaseUpgradeOpen  = PhaseManager.GetInstance().UpgradeOpen;
        phaseInteriorOpen = PhaseManager.GetInstance().InteriorOpen;

        distributedNames = TextManager.GetInstance().DistributedNames;
    }
Ejemplo n.º 7
0
    public bool LoadGame()  //이닛 후에 불려져야함.
    {
#if UNITY_ANDROID
        if (st == null || !savedGame)
        {
            Debug.Log("로드게임 - 세이브 데이타가 존재하지 않음 또는 " + savedGame);
            return(false);
        }


        if (false == PlayGamesPlatform.Instance.localUser.authenticated)
        {
            PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build();
            PlayGamesPlatform.InitializeInstance(config);
            PlayGamesPlatform.DebugLogEnabled = true;
            PlayGamesPlatform.Activate();
            Social.localUser.Authenticate((bool success, string msg) =>
            {
                if (false == success)
                {
                    Debug.Log("로드 실패 - 로그인 불가");
                    return;
                }
            });
        }
        ISavedGameClient saveClient = PlayGamesPlatform.Instance.SavedGame;
        saveClient.OpenWithAutomaticConflictResolution(Constant.saveFileNameInGPGSCloud, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseMostRecentlySaved, (status, metaData) =>
        {
            if (status != SavedGameRequestStatus.Success)
            {
                Debug.Log("로드 실패 - 메타데이타 오픈 불가");
                return;
            }
            saveClient.ReadBinaryData(metaData, (readStatus, savedData) =>
            {
                if (readStatus == SavedGameRequestStatus.Success)
                {
                    Debug.Log("바이너리 데이타 리드 읽기 성공!");
                    byte[] savedDataByteArr = savedData;

                    BinaryFormatter bt = new BinaryFormatter();
                    MemoryStream ms    = new MemoryStream(savedDataByteArr);
                    st = bt.Deserialize(ms) as SaveStructure;
                    ms.Dispose();
                    ms.Close();

                    if (st == null)
                    {
                        Debug.Log("리드는 했으나 스트럭쳐가 널임.");
                    }
                }
                else
                {
                    Debug.Log("바이너리 데이타 리드 읽기 실패!");
                    saveClient.ShowSelectSavedGameUI("리드가 안됨.", 5, false, false, (stq, md) => { });
                }
            });
        });
        if (st == null)
        {
            Debug.Log("리드 실패");
            return(false);
        }
#else
        BinaryFormatter bt   = new BinaryFormatter();
        FileStream      file = File.Open(Constant.saveDataAllPath, FileMode.Open);

        if (file != null && file.Length > 0)
        {
            st = bt.Deserialize(file) as SaveStructure;
            file.Close();
            if (st == null)
            {
                Debug.Log("파일이 없음.");
                return(false);
            }
        }
        else
        {
            file.Close();
            return(false);
        }
#endif
        Debug.Log("로드 게임");
        //  LanguageManager.GetInstance().SetLanguage(st.lang);   언어설정은 새로 할 수 있게.
        GoldManager.GetInstance().SetGold(st.golds);
        GameEndJudgeManager.GetInstance().Load(st);
        InGameTimeManager.GetInstance().Load(st);
        CharactorManager.GetInstance().Load(st);
        QuestManager.GetInstance().Load(st);
        Inventory.GetInstance().Load(st);
        WholeMonsterRiskManager.GetInstance().Load(st);
        PhaseManager.GetInstance().Load(st);
        TextManager.GetInstance().Load(st);

        return(true);
    }