public void UpdatePlayerInfoStat() { playerName.text = "이름: " + PlayerController.Instance.getName(); playerAttack.text = "공격력: " + PlayerController.Instance.getAttack(); playerDefense.text = "방어력: " + PlayerController.Instance.getDefense(); playerGold.text = "골드: " + unitSetter.GetUnitStr(playerData.player_gold); playerExp.text = "경험치: " + PlayerController.Instance.GetCurrentExp() + " / " + PlayerController.Instance.GetMaxExp(); playerCritRate.text = "크리티컬 확률: " + playerData.player_critRate.ToString() + "%"; playerCritDamage.text = "크리티컬 데미지: " + (playerData.player_critDamage * 100).ToString() + "%"; goldInterfaceText.text = unitSetter.GetUnitStr(playerData.player_gold); }
public void LevelUpCallback(int id, int level) { mInfoArr[id].CurrentLevel += level; if (mInfoArr[id].CurrentLevel == mInfoArr[id].MaxLevel) { mElementList[id].SetButtonActive(false); } if (mInfoArr[id].CurrentLevel + 10 > mInfoArr[id].MaxLevel) { mElementList[id].SetTenButtonActive(false); } mLevelArr[id] = mInfoArr[id].CurrentLevel; CalcData(id); // 계산된 값 적용 UI, GameLogic string valueStr; if (mInfoArr[id].IsPercent) { valueStr = mInfoArr[id].ValueCurrent.ToString("P0"); } else { valueStr = UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent); } mElementList[id].Refresh(mInfoArr[id].CurrentLevel.ToString(), string.Format(mTextInfoArr[id].ContentsFormat, valueStr, mInfoArr[id].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent * mInfoArr[id].CostTenWeight)); }
// Start is called before the first frame update void Start() { LoadJson(out mInfoArr, Paths.PLAYER_ITEM_TABLE); LoadJson(out mTextInfoArr, Paths.PLAYER_ITEM_TEXT_TABLE); mIconArr = Resources.LoadAll <Sprite>(Paths.PLAYER_ITEM_ICON); mLevelArr = GameController.Instance.GetPlayerItemLevelArr(); mSkillIndexList = new List <int>(); for (int i = 0; i < mInfoArr.Length; i++) { if (mInfoArr[i].Cooltime > 0) { mSkillIndexList.Add(i); } mInfoArr[i].CurrentLevel = mLevelArr[i]; mInfoArr[i].CostTenWeight = (Math.Pow(mInfoArr[i].CostWeight, 10) - 1) / (mInfoArr[i].CostWeight - 1); CalcData(i); } mElementList = new List <UIElement>(); for (int i = 0; i < mInfoArr.Length; i++) { UIElement elem = Instantiate(mElementPrefab, mElementArea); string valueStr;// = mInfoArr[i].IsPercent ? // mInfoArr[i].ValueCurrent.ToString("P0") : // UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); if (mInfoArr[i].IsPercent) { valueStr = mInfoArr[i].ValueCurrent.ToString("P0"); } else { valueStr = UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); } elem.Init(i, mIconArr[i], mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, valueStr, mInfoArr[i].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), LevelUP); mElementList.Add(elem); } mSkillCooltimeArr = GameController.Instance.GetSkillCooltimeArr(); for (int i = 0; i < mSkillButtonArr.Length; i++) { int skillID = mSkillIndexList[i]; if (mInfoArr[skillID].CurrentLevel > 0) { mSkillButtonArr[i].SetButtonActive(true); } StartCoroutine(CooltimeRoutine(i, mInfoArr[skillID].Cooltime)); } }
public void JobFinish(int id, Vector3 effectPos) { Sprite icon = null; string valueText = null; switch (id) { case 0: GameController.Instance.Gold += mInfoArr[id].ValueCurrent; valueText = UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent); break; case 1: GameController.Instance.PowerTouch(mInfoArr[id].ValueCurrent); valueText = UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent); break; case 2: //주기동작 아닌 동료 break; default: Debug.LogError("wrong coworker id " + id); break; } TextEffect effect = TextEffectPool.Instance.GetFromPool(); effect.SetText(valueText); //effect.SetIcon(icon); effect.transform.position = effectPos; }
private void ReLoad() { for (int i = 0; i <= GameController.Instance.Stage; i++) { StageUIElement element = Instantiate(mElementPrefab[i], mElementArea); element.Init(i, mAnimArr[i]); mElementList.Add(element); mElementList[i].HaveStage(); PlayerButtoninteractable(i); if (GameController.Instance.CoworkerLevelArr[i] > 0) { mElementList[i].CoworkerActive(true); } } mLastSibling.Refresh(mElementList.Count, UnitSetter.GetUnitStr(100000 * math.pow(2.1, mElementList.Count - 1))); mDigCost = 100000 * math.pow(2.1, mElementList.Count - 1); CheckDigButton(); mElementList[GameController.Instance.PlayerPos].PlayerActive(true); mLastSibling.transform.SetAsLastSibling(); if (!GameController.Instance.CheckScrollPin) { mScrollArea.vertical = true; mPinToggle.SetIsOnWithoutNotify(false); } }
// Start is called before the first frame update void Start() { LoadJson(out mInfoArr, Paths.PLAYER_ITEM_TABLE); LoadJson(out mTextInfoArr, Paths.PLAYER_ITEM_TEXT_TABLE); mIconArr = Resources.LoadAll <Sprite>(Paths.PLAYER_ITEM_ICON); //세이브데이터 불러오기 mLevelArr = GameController.Instance.GetPlayerItemLevelArr(); //레벨업자동갱신. for (int i = 0; i < mInfoArr.Length; i++) { mInfoArr[i].CostTenWeight = (Math.Pow(mInfoArr[i].CostWeight, 10) - 1) / (mInfoArr[i].CostWeight - 1); CalcData(i); } mElementList = new List <UIElement>(); for (int i = 0; i < mInfoArr.Length; i++) { UIElement elem = Instantiate(mElementPrefab, mElementArea); elem.Init(i, mIconArr[i], mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent), mInfoArr[i].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), LevelUP); mElementList.Add(elem); } }
private void Load() { GameController.Instance.MineCount = 0; for (int i = 0; i < mInfoArr.Length; i++) { MineUIElement element = Instantiate(mElementPrefab, mElementArea); element.Init(i, mIconArr[i], mTextInfoArr[i].Title, string.Format(mTextInfoArr[i].ContentsFormat, mTime, UnitSetter.GetUnitStr(mAddGem)), UnitSetter.GetUnitStr(mInfoArr[i].Cost), BuyMine, SellMine); mElementList.Add(element); if (GameController.Instance.HaveMine[i] != 0) { mElementList[i].SetBuyButtonActive(false); GameController.Instance.MineCount += 1; GameController.Instance.MineTutorial = 1; } if (i <= GameController.Instance.Stage) { mElementList[i].gameObject.SetActive(true); } } }
private void Load() { for (int i = 0; i < mInfoArr.Length; i++) { UIElement elem = Instantiate(mElementPrefab, mElementArea); string valueStr;// = mInfoArr[i].IsPercent ? // mInfoArr[i].ValueCurrent.ToString("P0") : // UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); if (mInfoArr[i].IsPercent) { valueStr = mInfoArr[i].ValueCurrent.ToString("P0"); } else { valueStr = UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); } elem.Init(i, mIconArr[i], mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, valueStr, mInfoArr[i].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), LevelUP); mElementList.Add(elem); } }
public void AddCowerker(int id) { if (mInfoArr[id].CurrentLevel >= 10 && GameController.Instance.Stage > id && id < mInfoArr.Length) { int nextID = id + 1; if (mElementList.Count <= nextID) { GameController.Instance.CoworkerLevelArr[nextID] = mInfoArr[nextID].CurrentLevel = 0; CalcData(nextID); UIElement element = Instantiate(mElementPrefab, mElementArea); element.Init(nextID, mIconArr[nextID], mTextInfoArr[nextID].Title, string.Format("레벨 : {0}", mInfoArr[nextID].CurrentLevel.ToString()), string.Format(mTextInfoArr[nextID].ContentsFormat, mInfoArr[nextID].PeriodCurrent, UnitSetter.GetUnitStr(mInfoArr[nextID].ValueCurrent)), UnitSetter.GetUnitStr(mInfoArr[nextID].CostCurrent), LevelUP); mElementList.Add(element); if (!mCoworkerWindow.gameObject.activeInHierarchy) { PointController.Instance.ShowCoworkerPoint(true); } } } }
private void Load() { for (int i = 0; i < mInfoArr.Length; i++) { if (i % 4 == 0) { LayerButtonUIElement Buttonelement = Instantiate(mLayerButtonPrefab, mElementArea); Buttonelement.Init(i / 4); mButtonElementList.Add(Buttonelement); } mIconArr[i] = mOriginArr[i / 4].GetSprite(i % 4); GemSellUIElement element = Instantiate(mElementPrefab, mElementArea); element.Init(i, mIconArr[i], mTextInfoArr[i].Title, string.Format("가격 : {0} 원", UnitSetter.GetUnitStr(mInfoArr[i].Cost)), SellGem, SellPoint); mElementList.Add(element); mElementList[i].gameObject.SetActive(false); if (i % 4 == 3) { mButtonElementList[mButtonElementList.Count - 1].bToggleIsOn(false); mButtonElementList[mButtonElementList.Count - 1].setting(mElementList[i - 3], mElementList[i - 2], mElementList[i - 1], mElementList[i], LayerPoint, SellPoint, mElementArea); } if (i / 4 <= GameController.Instance.Stage) { mButtonElementList[i / 4].gameObject.SetActive(true); } } mAllSellToggle.onValueChanged.AddListener((bOn) => { GameController.Instance.CheckAllSell = bOn; for (int i = 0; i < mElementList.Count; i++) { if (i % 4 == 0) { if (bOn) { GameController.Instance.CheckAutoSell[i] = bOn; SellGem(i, mElementList[i].GetMaxSellAmount()); mElementList[i].bToggleIsOn(true); } else { GameController.Instance.CheckAutoSell[i] = false; mElementList[i].bToggleIsOn(false); } } } }); mButtonElementList[GameController.Instance.Stage].SetGemSellUI(); SetAllSellToggle(GameController.Instance.CheckAllSell); }
public void ShowGaugeBar(double current, double max) { string progressStr = string.Format("{0} / {1}", UnitSetter.GetUnitStr(current), UnitSetter.GetUnitStr(max)); float progress = (float)(current / max); mGaugeBar.ShowGaugeBar(progress, progressStr); }
private void Refresh() { CalcData(); mElement.Refresh(string.Format("레벨 : {0}", mInfo.CurrentLevel.ToString()), string.Format(mTextInfo.ContentsFormat, UnitSetter.GetUnitStr(mInfo.ValueCurrent), mInfo.Duration.ToString()), UnitSetter.GetUnitStr(Math.Round(mInfo.CostCurrent))); }
public void ShowGaugeBar(double current, double max) { string progressStr = string.Format("{0}/{1}", //current.ToString("N0"), UnitSetter.GetUnitStr(current), UnitSetter.GetUnitStr(max)); //max.ToString("C0")); //"N0"는 소수점 자리가 안 보이게 함. N1~2는 소수점까지 보여줌. float progress = (float)(current / max); //string progressStr = progress.ToString("P"); mGaugeBar.ShowGaugeBar(progress, progressStr); }
public void LevelUPCallback(int id, int level) { //int id = mSelectedID; //int level = mSelectedAmount; mInfoArr[id].CurrentLevel += level; if (mInfoArr[id].CurrentLevel == mInfoArr[id].MaxLevel) { //레벨업 잠금 UIElement에 잠금해제 기능 추가 mElementList[id].SetButtonActive(false); } if (mInfoArr[id].CurrentLevel + 10 > mInfoArr[id].MaxLevel) { mElementList[id].SetTenButtonActive(false); } mLevelArr[id] = mInfoArr[id].CurrentLevel; //자동 데이터 저장 CalcData(id); //계산된 값 적용 UI, GameLogic if (mInfoArr[id].Cooltime <= 0) { switch (id) { case 0: GameController.Instance.TouchPower = mInfoArr[id].ValueCurrent; break; case 1: GameController.Instance.CriticalRate = mInfoArr[id].ValueCurrent; break; case 2: GameController.Instance.CriticalValue = mInfoArr[id].ValueCurrent; break; default: Debug.LogError("Wrong cooltime value on player stat " + id); break; } } mElementList[id].Refresh(mInfoArr[id].CurrentLevel.ToString(), string.Format(mTextInfoArr[id].ContentsFormat, UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent), mInfoArr[id].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent * mInfoArr[id].CostTenWeight)); //GameController.Instance.TouchPower++; //바뀌는 데이터가 달라져 수정. //UIElement elem = Instantiate(mElementPrefab, mElementArea); //elem.Init(0, null, "test1", "1", "Power UP", "2", LevelUP); //mElementList.Add(elem); }
public void ShowGaugeBar(double current, double max) { string progressStr = string.Format("{0}/{1}", UnitSetter.GetUnitStr(current), //current.ToString("n0"), UnitSetter.GetUnitStr(max)); //max.ToString("n0")); //"n0" 정수형태 표준 숫자 서식 문자열 float progress = (float)(current / max); //string progressStr2 = progress.ToString("P"); //float 이 0~1사이면 %표시가능 mGaugeBar.ShowGaugeBar(progress, progressStr); }
//public void SetCoworkerPos(int i, Transform trans) //{ // mEffectPos[i].position = trans.position; //} private void Load() { GameController.Instance.Buff_Coworker = 0; GameController.Instance.BuffCoworker_Double = 0; mDoubleBuffUIElement.Init(mBlockIcon, "A to Z", "버프 2배"); for (int i = 0; i < mInfoArr.Length; i++) { mBuffUIElement[i].Init(mBlockIcon, mTextInfoArr[i].Title, string.Format(100 * mInfoArr[i].BuffAmount + "%")); if (GameController.Instance.CoworkerLevelArr[i] < 0) { continue; } mInfoArr[i].CurrentLevel = GameController.Instance.CoworkerLevelArr[i]; CalcData(i); if (mInfoArr[i].CurrentLevel > 0) { mCoworkerArr[i].gameObject.SetActive(true); mCoworkerArr[i].StartWork(i, mInfoArr[i].PeriodCurrent); if (i == mInfoArr.Length - 1) { GameController.Instance.BuffCoworker_Double = 1; mDoubleBuffUIElement.ShowBuff(mDoubleBuffIcon); } if (mInfoArr[i].CurrentLevel >= mCoworkerBuffLevel) { GameController.Instance.Buff_Coworker += mInfoArr[i].BuffAmount; mBuffUIElement[i].ShowBuff(mIconArr[i]); } } UIElement element = Instantiate(mElementPrefab, mElementArea); element.Init(i, mIconArr[i], mTextInfoArr[i].Title, string.Format("레벨 : {0}", mInfoArr[i].CurrentLevel.ToString()), string.Format(mTextInfoArr[i].ContentsFormat, mInfoArr[i].PeriodCurrent, UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent)), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), LevelUP); mElementList.Add(element); if (mInfoArr[i].CurrentLevel >= mInfoArr[i].MaxLevel) { mElementList[i].SetButtonActive(false); } } ShowCoworkerBuff(); }
// Start is called before the first frame update void Start() { LoadJson(out mInfoArr, Paths.COWORKER_INFO_TABLE); LoadJson(out mTextInfoArr, Paths.COWORKER_INFO_TEXT_TABLE); mLevelArr = GameController.Instance.GetCorokerLevelArr(); mElementList = new List <UIElement>(); for (int i = 0; i < mInfoArr.Length; i++) { if (mLevelArr[i] < 0) { continue; } mInfoArr[i].CurrentLevel = mLevelArr[i]; mInfoArr[i].CostTenWeight = (Math.Pow(mInfoArr[i].CostWeight, 10) - 1) / (mInfoArr[i].CostWeight - 1); CalcData(i); if (mInfoArr[i].CurrentLevel > 0) { mCoworkerArr[i].gameObject.SetActive(true); mCoworkerArr[i].StartWork(i, mInfoArr[i].PeriodCurrent); } UIElement element = Instantiate(mElementPrefab, mElementArea); string valueStr; if (mInfoArr[i].ValueCalcType == eCalculationType.Exp) { valueStr = UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); } else { valueStr = mInfoArr[i].ValueCurrent.ToString("N1"); } element.Init(i, mIconArr[i], mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, valueStr, mInfoArr[i].PeriodCurrent.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), LevelUP); //내용 채우기 mElementList.Add(element); } }
// Start is called before the first frame update void Start() { //원래 하던 방식 (>데이터 테이블로 처리) //mInfoArr = new PlayerStat[5]; //mInfoArr[0] = new PlayerStat(); //mInfoArr[0].ID = 0; //mInfoArr[0].CurrentLevel = 1; //mInfoArr[0].CostType = eCostType.Gold; .... LoadJson(out mInfoArr, Paths.PLAYER_ITEM_TABLE); //아래 2줄과 같은 코드 //string data = Resources.Load<TextAsset>(Paths.PLAYER_ITEM_TABLE).text; //Json파일 불러옴. //mInfoArr = JsonConvert.DeserializeObject<PlayerStat[]>(data); //Debug.Log(data); //test = JsonConvert.DeserializeObject<PlayerStat[]>(data); LoadJson(out mTextInfoArr, Paths.PLAYER_ITEM_TEXT_TABLE); //아래 2줄과 같은 코드 //data = Resources.Load<TextAsset>(Paths.PLAYER_ITEM_TEXT_TABLE).text; //언어팩 형식도 이런 방식으로 진행 //mTextInfoArr = JsonConvert.DeserializeObject<PlayerStatText[]>(data); mIconArr = Resources.LoadAll <Sprite>(Paths.PLAYER_ITEM_ICON); mLevelArr = GameController.Instance.GetPlayerItemLevelArr(); //세이브데이터 불러오기 for (int i = 0; i < mInfoArr.Length; i++) { mInfoArr[i].CurrentLevel = mLevelArr[i]; mInfoArr[i].CostTenWeight = (Math.Pow(mInfoArr[i].CostWeight, 10) - 1) / (mInfoArr[i].CostWeight - 1); CalcData(i); } mElementList = new List <UIElement>(); for (int i = 0; i < mInfoArr.Length; i++) { UIElement elem = Instantiate(mElementPrefab, mElementArea); elem.Init(i, mIconArr[i], mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent), mInfoArr[i].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), LevelUP); //가능하면 데이터 순서랑 ID순서 동일하게 설정 mElementList.Add(elem); //나중에 지우려고 만듦. } }
public void LevelUpCallback(int id, int level) { mInfoArr[id].CurrentLevel += level; if (mInfoArr[id].CurrentLevel == mInfoArr[id].MaxLevel) { mElementList[id].SetButtonActive(false); } GameController.Instance.CoworkerLevelArr[id] = mInfoArr[id].CurrentLevel; if (mInfoArr[id].CurrentLevel == 1) { mCoworkerArr[id].gameObject.SetActive(true); StageController.Instance.CoworkerActive(id); if (id == mInfoArr.Length - 1) { GameController.Instance.BuffCoworker_Double = 1; mDoubleBuffUIElement.ShowBuff(mDoubleBuffIcon); ShowCoworkerBuff(); PlayerUpgradeController.Instance.ReSetSlider(); } } if (mInfoArr[id].CurrentLevel == mCoworkerBuffLevel) { GameController.Instance.Buff_Coworker += mInfoArr[id].BuffAmount; mBuffUIElement[id].ShowBuff(mIconArr[id]); ShowCoworkerBuff(); PlayerUpgradeController.Instance.ReSetSlider(); SoundController.Instance.FXSound(12); PointController.Instance.ShowPlayerPoint(true); mBuffWindow.gameObject.SetActive(true); } AddCowerker(id); CalcData(id); mCoworkerArr[id].StartWork(id, mInfoArr[id].PeriodCurrent); mElementList[id].Refresh( string.Format("레벨 : {0}", mInfoArr[id].CurrentLevel.ToString()), string.Format(mTextInfoArr[id].ContentsFormat, mInfoArr[id].PeriodCurrent, UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent)), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent)); Quest_CowerkorLevelSum.Instance.CheckQuest(); }
private void Load() { for (int i = 0; i <= GameController.Instance.Stage; i++) { StageUIElement element = Instantiate(mElementPrefab[i], mElementArea); element.Init(i, mAnimArr[i]); mElementList.Add(element); mElementList[i].HaveStage(); PlayerButtoninteractable(i); if (GameController.Instance.CoworkerLevelArr[i] > 0) { mElementList[i].CoworkerActive(true); } } mLastSibling.Init(mElementList.Count, UnitSetter.GetUnitStr(100000 * math.pow(2.1, mElementList.Count - 1)), AddStage); mDigCost = 100000 * math.pow(2.1, mElementList.Count - 1); CheckDigButton(); mElementList[GameController.Instance.PlayerPos].PlayerActive(true); mPinToggle.onValueChanged.AddListener((bool bOn) => { mScrollArea.vertical = !bOn; if (GameController.Instance.StagePinTutorial == 0 && bOn) { GameController.Instance.StagePinTutorial = 1; PointController.Instance.ShowStagePinPoint(false); } }); if (GameController.Instance.CheckScrollPin) { mScrollArea.vertical = false; mPinToggle.SetIsOnWithoutNotify(true); } if (GameController.Instance.Stage < Constants.MAX_fLOOR - 1) { mLastSibling.transform.SetAsLastSibling(); } else { mLastSibling.gameObject.SetActive(false); } }
private void Load() { mElement.Init(0, mIcon.sprite, mTextInfo.Title, string.Format("레벨 : {0}", mInfo.CurrentLevel.ToString()), string.Format(mTextInfo.ContentsFormat, UnitSetter.GetUnitStr(mInfo.ValueCurrent), mInfo.Duration.ToString()), UnitSetter.GetUnitStr(Math.Round(mInfo.CostCurrent)), LevelUP); CustomController.Instance.CheckName(); Sprite spr = CustomImage.Instance.CheckCustompath(); if (spr != null) { mSpriteArr[mSpriteArr.Length - 1] = spr; } mIcon.sprite = mSpriteArr[GameController.Instance.PlayerProfile]; }
private void Load() { for (int i = 0; i < mInfoArr.Length; i++) { if (mLevelArr[i] < 0) { continue; } mInfoArr[i].CurrentLevel = mLevelArr[i]; mInfoArr[i].CostTenWeight = (Math.Pow(mInfoArr[i].CostWeight, 10) - 1) / (mInfoArr[i].CostWeight - 1); CalcData(i); if (mInfoArr[i].CurrentLevel > 0) { mCoworkerArr[i].gameObject.SetActive(true); mCoworkerArr[i].StartWork(i, mInfoArr[i].PeriodCurrent); } UIElement element = Instantiate(mElementPrefab, mElementArea); string valueStr; if (mInfoArr[i].ValueCalcType == eCalculationType.Exp) { valueStr = UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); } else { valueStr = mInfoArr[i].ValueCurrent.ToString("N1"); } element.Init(i, mIconArr[i], mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, valueStr, mInfoArr[i].PeriodCurrent.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), LevelUP); //내용 채우기 mElementList.Add(element); } }
public void LevelUpCallback(int id, int level) { mInfoArr[id].CurrentLevel += level; if (mInfoArr[id].CurrentLevel == mInfoArr[id].MaxLevel) { mElementList[id].SetButtonActive(false); } if (mInfoArr[id].CurrentLevel + 10 > mInfoArr[id].MaxLevel) { mElementList[id].SetTenButtonActive(false); } mLevelArr[id] = mInfoArr[id].CurrentLevel; CalcData(id); //// 계산된 값 적용 UI, GameLogic //if (mInfoArr[id].Cooltime <= 0) //{ // switch(id) // { // case 0: // GameController.Instance.TouchPower = mInfoArr[id].ValueCurrent; // break; // case 1: // GameController.Instance.CriticalRate = mInfoArr[id].ValueCurrent; // break; // case 2: // GameController.Instance.CriticalValue = mInfoArr[id].ValueCurrent; // break; // default: // Debug.LogError("wrong cooltime value on player stat " + id); // break; // } //} mElementList[id].Refresh(mInfoArr[id].CurrentLevel.ToString(), string.Format(mTextInfoArr[id].ContentsFormat, UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent), mInfoArr[id].Duration.ToString()), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent * mInfoArr[id].CostTenWeight)); }
// Start is called before the first frame update void Start() { LoadJson(out mInfoArr, Paths.COWORKER_INFO_TABLE); LoadJson(out mTextInfoArr, Paths.COWORKER_INFO_TEXT_TABLE); //load element icon //load level data mElementList = new List <UIElement>(); for (int i = 0; i < 3; i++) { //mInfoArr[i]CurrentLevel = mInfoArr[i].CostTenWeight = (Math.Pow(mInfoArr[i].CostWeight, 10) - 1) / (mInfoArr[i].CostWeight - 1); //calc UIElement element = Instantiate(mElementPrefab, mElementArea); string valueStr; if (mInfoArr[i].ValueCalcType == eCalculationType.Exp) { valueStr = UnitSetter.GetUnitStr(mInfoArr[i].ValueCurrent); } else { valueStr = mInfoArr[i].ValueCurrent.ToString("N1"); } element.Init(i, null, mTextInfoArr[i].Title, mInfoArr[i].CurrentLevel.ToString(), string.Format(mTextInfoArr[i].ContentsFormat, valueStr, mInfoArr[i].PeriodCurrent.ToString()), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[i].CostCurrent * mInfoArr[i].CostTenWeight), null); //내용 채우기 mElementList.Add(element); } }
public void AddStageCallback(int id, int amount) { SoundController.Instance.FXSound(8); GameController.Instance.Stage = id; int nextID = id + 1; CoworkerController.Instance.AddCowerker(id - 1); MineShopController.Instance.SetMine(id); CraftController.Instance.SetCraft(id); GemSellController.Instance.SetSellUI(id); if (GameController.Instance.Stage == 1) { PointController.Instance.ShowStageChangeExplain(); } if (mElementList.Count <= nextID) { StageUIElement element = Instantiate(mElementPrefab[id], mElementArea); element.Init(id, mAnimArr[id]); mElementList.Add(element); mElementList[id].ShowStage(); PlayerButtoninteractable(id); mLastSibling.Refresh(mElementList.Count, UnitSetter.GetUnitStr(100000 * math.pow(2.1, id))); mDigCost = 100000 * math.pow(2.1, mElementList.Count - 1); CheckDigButton(); } if (GameController.Instance.Stage < Constants.MAX_fLOOR - 1) { mLastSibling.transform.SetAsLastSibling(); } else { mLastSibling.gameObject.SetActive(false); } Quest_DigCount.Instance.CheckQuest(); PlayerActive(GameController.Instance.Stage); }
public void CalSellAmount() { int div; div = mID % 4; switch (div) { case 0: mMaxSellAmount = GameController.Instance.AddAmoutGem_O[mID / 4]; break; case 1: mMaxSellAmount = GameController.Instance.AddAmoutGem_B[mID / 4]; break; case 2: mMaxSellAmount = GameController.Instance.AddAmoutGem_A[mID / 4]; break; case 3: mMaxSellAmount = GameController.Instance.AddAmoutGem_S[mID / 4]; break; } if (mMaxSellAmount > 0) { SetButtonActive(true); SetSliderActive(true); } else { SetButtonActive(false); SetSliderActive(false); } mAmountText.text = UnitSetter.GetUnitStr(mMaxSellAmount).ToString(); mSellAmount = Math.Round(mSlider.value * mMaxSellAmount); mSellAmountText.text = UnitSetter.GetUnitStr(mSellAmount).ToString(); }
public void LevelUpCallback(int id, int level) { mInfoArr[id].CurrentLevel += level; if (mInfoArr[id].CurrentLevel == mInfoArr[id].MaxLevel) { mElementList[id].SetButtonActive(false); } if (mInfoArr[id].CurrentLevel + 10 > mInfoArr[id].MaxLevel) { mElementList[id].SetTenButtonActive(false); } mLevelArr[id] = mInfoArr[id].CurrentLevel; if (mInfoArr[id].CurrentLevel == 1) { mCoworkerArr[id].gameObject.SetActive(true); if (id + 1 < mInfoArr.Length) { int nextID = id + 1; mLevelArr[nextID] = mInfoArr[nextID].CurrentLevel = 0; CalcData(nextID); UIElement element = Instantiate(mElementPrefab, mElementArea); string valueStrNext; if (mInfoArr[nextID].ValueCalcType == eCalculationType.Exp) { valueStrNext = UnitSetter.GetUnitStr(mInfoArr[nextID].ValueCurrent); } else { valueStrNext = mInfoArr[nextID].ValueCurrent.ToString("N1"); } element.Init(nextID, mIconArr[nextID], mTextInfoArr[nextID].Title, mInfoArr[nextID].CurrentLevel.ToString(), string.Format(mTextInfoArr[nextID].ContentsFormat, valueStrNext, mInfoArr[nextID].PeriodCurrent.ToString()), UnitSetter.GetUnitStr(mInfoArr[nextID].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[nextID].CostCurrent * mInfoArr[nextID].CostTenWeight), LevelUP); //내용 채우기 mElementList.Add(element); } } CalcData(id); mCoworkerArr[id].StartWork(id, mInfoArr[id].PeriodCurrent); // 계산된 값 적용 UI, GameLogic string valueStr; if (mInfoArr[id].ValueCalcType == eCalculationType.Exp) { valueStr = UnitSetter.GetUnitStr(mInfoArr[id].ValueCurrent); } else { valueStr = mInfoArr[id].ValueCurrent.ToString("N1"); } mElementList[id].Refresh(mInfoArr[id].CurrentLevel.ToString(), string.Format(mTextInfoArr[id].ContentsFormat, valueStr, mInfoArr[id].PeriodCurrent.ToString()), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent), UnitSetter.GetUnitStr(mInfoArr[id].CostCurrent * mInfoArr[id].CostTenWeight)); }
public void ShowMoney() { mMoneyText.text = UnitSetter.GetUnitStr(Math.Round(GameController.Instance.Gold, 2)); }
public void SleepJob(int num) { for (int i = 0; i < mInfoArr.Length; i++) { if (mCoworkerArr[i].gameObject.activeInHierarchy) { double AddAmount = mInfoArr[i].ValueCurrent; GameController.Instance.AddAmoutGem_O[i] += AddAmount * (int)((GameController.Instance.TimeLag / (mInfoArr[i].PeriodCurrent * mTimePeriod))) * num; GemSellController.Instance.RefreshGemData(); SleepUIElement Sleepelement = Instantiate(mSleepElementPrefab, mSleepElementArea); Sleepelement.Init(mIconArr[i], mTextInfoArr[i].Title, mTextInfoArr[i].GemName, UnitSetter.GetUnitStr(AddAmount * (int)((GameController.Instance.TimeLag / (mInfoArr[i].PeriodCurrent * mTimePeriod))) * num)); mSleepElementList.Add(Sleepelement); } } }
public void ShowAmount(double amount) { mAmountText.text = string.Format("{0}개", UnitSetter.GetUnitStr(amount).ToString()); }