//设置人物等级 void SetHeroLevel(MyKeys.CurrentHero current_Hero) { //声音特效 MyAudio.PlayAudio(StaticParameter.s_Levelup, false, StaticParameter.s_Levelup_Volume); EffectManager.Instance.LevelUpEffect(); SetItemLevel(MyKeys.GetHeroLevel(current_Hero)); switch (current_Hero) { case MyKeys.CurrentHero.GuiYuZi: MyKeys.GuiYuZi_Level_Value += 1; break; case MyKeys.CurrentHero.CiShen: MyKeys.CiShen_Level_Value += 1; break; case MyKeys.CurrentHero.YuZi: MyKeys.YuZi_Level_Value += 1; break; case MyKeys.CurrentHero.ShouSi: MyKeys.ShouSi_Level_Value += 1; break; } UpdateText((int)current_Hero); Debug.Log("关于等级的友盟设置还没有修改"); //UMManager.SetHeroLevel(MyKeys.HeroOne_Level_Value); //UMManager.Event(EventID.Boy_Level, MyKeys.HeroOne_Level_Value.ToString()); JudgeMaxButtonState(); }
//直升满级 public void UpMax() { MyAudio.PlayAudio(StaticParameter.s_Levelup, false, StaticParameter.s_Levelup_Volume); //若英雄是最大等级跳出 if (MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero) == _level_Max_List[(int)MyKeys.CurrentSelectedHero]) { return; } if (MyKeys.Diamond_Value >= MyKeys.Up_Max_Cost) { EffectManager.Instance.LevelUpEffect(); MyKeys.Diamond_Value -= MyKeys.Up_Max_Cost; SetHeroLevelMax(MyKeys.CurrentSelectedHero); UpdateList(MyKeys.CurrentSelectedHero); ChangeLevelImage(); JudgeMaxButtonState(); ChangeCost(); } else { UIManager.ActiveWindow(WindowID.WindowID_ShopDiamond); } //更新红点状态 UpdatePage(); }
void ChangeCostIcon() { Transform iconTransform = _item_List_Father.GetChild(5).GetChild(0); Transform goldIcon = iconTransform.GetChild(0); Transform diamondIcon = iconTransform.GetChild(1); if (!iconTransform.name.Contains("icon")) { Debug.LogError("升级按钮上的图标获取错误"); } if (!MyKeys.JudgeLevelMax()) { int hero_Level = MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero); if (hero_Level < MyKeys.Level_Cost_Change_Point) { goldIcon.gameObject.SetActive(true); diamondIcon.gameObject.SetActive(false); } else { goldIcon.gameObject.SetActive(false); diamondIcon.gameObject.SetActive(true); } } else { goldIcon.gameObject.SetActive(false); diamondIcon.gameObject.SetActive(false); } }
//升级按钮 public void LevelUp() { int hero_Level = MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero); if (GuidanceBase.GuidanceMark == 1) { //升级 SetHeroLevel(MyKeys.CurrentSelectedHero); ChangeLevelImage(); return; } if (hero_Level < MyKeys.Level_Cost_Change_Point) { int pay_Gold = (hero_Level + 1) * 100; if (MyKeys.Gold_Value >= pay_Gold) { MyKeys.Gold_Value -= pay_Gold; //升级 SetHeroLevel(MyKeys.CurrentSelectedHero); ChangeLevelImage(); //升级提示 _red_Point.GetComponent <RedPoint>().LevelUpHint(); } else { //UIManager.ActiveWindow(WindowID.WindowID_ShopJinBi); SetButtonInactivity(_level_Up_Button); } } else { if (MyKeys.Diamond_Value >= MyKeys.Level_Cost_Diamond) { MyKeys.Diamond_Value -= MyKeys.Level_Cost_Diamond; //升级 SetHeroLevel(MyKeys.CurrentSelectedHero); ChangeLevelImage(); } else { //UIManager.ActiveWindow(WindowID.WindowID_ShopZuanShi); SetButtonInactivity(_level_Up_Button); } } ChangeCost();//显示下一级所需金币 //更新红点状态 UpdatePage(); }
//更新等级文本 void UpdateLevelText() { for (int i = 0; i < 4; i++) { if ((MyKeys.GetHeroLevel((MyKeys.CurrentHero)i) + 1) < 10) { _Level_Text_List[i].text = " " + (MyKeys.GetHeroLevel((MyKeys.CurrentHero)i) + 1); } else { _Level_Text_List[i].text = (MyKeys.GetHeroLevel((MyKeys.CurrentHero)i) + 1).ToString(); } } }
IEnumerator Wait() { yield return(new WaitForSeconds(1)); transform.GetChild(_index).gameObject.SetActive(false); _index++; if (_index == 1) { MyAudio.PlayAudio(StaticParameter.s_Rankup, false, StaticParameter.s_Rankup_Volume); transform.GetChild(1).gameObject.SetActive(true); _tempList = _rankupList; times = 0; Next(); int index = (MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero) - 1) % 5; transform.GetChild(1).localPosition = Vector3.right * transform.GetChild(1).localPosition.x + Vector3.up * _rankup_Positions[index]; } }
//列表更新函数 void UpdateList(MyKeys.CurrentHero current_Hero) { Clear(); //获取人物等级 int hero_Level = MyKeys.GetHeroLevel(current_Hero); //计算每种技能的等级 for (int i = 0; i < hero_Level; i++) { SetItemLevel(i); } //更新文本 UpdateText((int)MyKeys.CurrentSelectedHero); ChangeLevelImage(); ChangeCost(); ChangeSelectedState((int)MyKeys.CurrentSelectedHero); }
//判断显示 void JudgeActive() { if (!MyKeys.JudgeLevelMax()) { int hero_Level = MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero); int pay_Gold = (hero_Level + 1) * 100; if (MyKeys.Gold_Value > pay_Gold) { gameObject.SetActive(true); } else { gameObject.SetActive(false); } } else { gameObject.SetActive(false); } }
void ChangeCostTest() { if (!MyKeys.JudgeLevelMax()) { int hero_Level = MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero); if (hero_Level < MyKeys.Level_Cost_Change_Point) { int temp = (hero_Level + 1) * 100; _Cost_Text.text = temp.ToString(); if (MyKeys.Gold_Value < temp) { SetButtonInactivity(_level_Up_Button); } else { SetButtonActivity(_level_Up_Button); } } else { _Cost_Text.text = MyKeys.Level_Cost_Diamond.ToString(); if (MyKeys.Diamond_Value < MyKeys.Level_Cost_Diamond) { SetButtonInactivity(_level_Up_Button); } else { SetButtonActivity(_level_Up_Button); } } } else { _Cost_Text.text = "满级"; SetButtonInactivity(_level_Up_Button); _red_Point.SetActive(false); } }