//Save Verse Card public void SetVerseToCht(BibleCard c) { int cV = c.GetVerseCode(); if (IsVerseDISTINCT(cV)) { dm.PutOnlyVerseCount(1); dm.PutOnlyVerseCountPerAbility(c.GetAbilityCode(), 1); dm.GetVerseCodeAndBestRank().Add(cV, c.GetCardRareRate()); dm.SaveOD(); dm.PutForCheckVerseTable(cV, true); ChangeChapterAndVerseUI(c); CheckPerfection(); lm.RefreshAbilityLvUI(); } //Overlap 2 or 3 or .. etc else { int a; if (dm.GetVerseCodeAndOverlapCount().TryGetValue(cV, out a)) { if (a >= 5) { //refuse full stack show pop-up return; } dm.GetVerseCodeAndOverlapCount()[cV] += 1; dm.SaveOD(); } //if FirstTime Overlap else { dm.GetVerseCodeAndOverlapCount().Add(cV, 2); dm.SaveOD(); } //for check Show RareImage if Overlap Situation if (c.GetCardRareRate() >= dm.GetVerseCodeAndBestRank()[cV]) { dm.GetVerseCodeAndBestRank()[cV] = c.GetCardRareRate(); dm.SaveOD(); } ChangeOverlapCardUI(c); } //common add Verse card info dm.PutHasTotalVerseCount(1); dm.GetVerseList(c.GetChapterCode()).Add(c); dm.SaveCD(); long bE = c.GetBibleEnergy(); //Add BE gm.AddBibleEnergy(bE); dm.PutBibleEnergyPerChapter(c.GetChapterCode(), bE); dm.PutBibleEnergyPerAbility(c.GetAbilityCode(), bE); dm.SaveVD(); }
//if Not Overlap Change UI public void ChangeChapterAndVerseUI(BibleCard c) { //Debug.Log("Mask/G_ab" + c.GetAbilityCode() + "/G_t" + c.GetTestamentCode() + "/Contents/ChapterBtn (" + GetIndexOfTestamentPerChapterCode(c.GetChapterCode(), c.GetTestamentCode()) + ")"); GameObject t = _G_CardsUI.transform.Find("Mask/G_ab" + c.GetAbilityCode() + "/G_t" + c.GetTestamentCode() + "/Contents/" + c.GetChapterCode()).gameObject; _G_AbiMenuBtnsUI.transform.Find("Abibtn" + c.GetAbilityCode()).GetComponent <Outline>().enabled = true; t.GetComponent <Outline>().enabled = true; t.transform.Find("Slider").GetComponent <Slider>().value += 1; }
//if Overlap Change UI public void ChangeOverlapCardUI(BibleCard c) { _G_AbiMenuBtnsUI.transform.Find("Abibtn" + c.GetAbilityCode()).GetComponent <Outline>().enabled = true; }
IEnumerator NormalBoxAllOpen() { int giftType = _forChkNowGift.CurrentPage; _Pup2_BoxImage.sprite = _boxSpriteList[giftType]; _isOepnCard = true; for (int k = 0; k < _allOpenBoxCount; k++) { _timer = 0.0f; for (int i = 0; i < 5; i++) { _Pup2_Stars[i].texture = Resources.Load("images/star_e") as Texture; } int verseCode; if (_selectedChtCode != -1) { verseCode = Random.Range(bm.GetFirstVerseCodePerChapterCode(_selectedChtCode), bm.GetLastVerseCodePerChapterCode(_selectedChtCode)); } else if (_selectedTmtCode != -1) { verseCode = Random.Range(bm.GetFirstVerseCodePerTestamentCode(_selectedTmtCode), bm.GetLastVerseCodePerTestamentCode(_selectedTmtCode)); } else if (_selectedAbiCode != -1) { verseCode = Random.Range(bm.GetFirstVerseCodePerAbilityCode(_selectedAbiCode), bm.GetLastVerseCodePerAbilityCode(_selectedAbiCode)); } else { verseCode = Random.Range(0, BibleManager._verseTotCount); } BibleData d = DataManager.bd[verseCode]; _Pup2_VerseTitle.text = d.title; _Pup2_VerseText.text = d.text; int txtCntForBE = d.text.Replace(" ", "").Length; int rareRate = fm.SetNormalRareStyle(); int testamentCode = bm.GetTestamentCode(verseCode); int abiCode = bm.GetAbilityCode(testamentCode); _Pup2_CardImage.texture = Resources.Load("images/card" + rareRate) as Texture; _Pup2_AbilityIcon.texture = bm._abilityImages[2 * (abiCode - 1)]; for (int i = 0; i < rareRate; i++) { _Pup2_Stars[i].texture = Resources.Load("images/star") as Texture; } long BE = (txtCntForBE + Random.Range(0, 21)) * (30 / long.Parse(Mathf.Pow(2, (5 - rareRate)) + "")); _Pup2_BibleEnergy.text = BE + ""; if (rareRate < 2) { am.FindCardSoundPlay(0); } else { am.FindCardSoundPlay(1); } BibleCard c = new BibleCard(verseCode, bm.GetChapterCode(verseCode), testamentCode, abiCode, BE, rareRate); bm.SetVerseToCht(c); _boxCount[giftType] -= 1; Text s = _Pup2_AbiGroup.transform.Find("Image (" + (c.GetAbilityCode() - 1) + ")/Text").GetComponent <Text>(); s.text = (int.Parse(s.text) + 1) + ""; _Pup2_BoxCount.text = "남은 개수 : " + _boxCount[giftType]; if (k == _allOpenBoxCount - 1) { StopAllOpenBtnPressed(); } yield return(new WaitForSeconds(2)); if (!_isOepnCard || _timer < 2.0f) { _isOepnCard = false; break; } } }