Ejemplo n.º 1
0
 private void OnResetBtn(GameObject go)
 {
     if (LevelManager.Instance.CheckSceneIsTest())
     {
         if (LevelManager.Instance.IsServerZyBattleType)
         {
             return;
         }
         GameObject gameObject = GameObject.FindGameObjectWithTag("Player");
         if (gameObject != null)
         {
             Units       component = gameObject.GetComponent <Units>();
             UtilCounter counter   = UtilManager.Instance.GetCounter(UtilType.Exp);
             ExpValue    expValue  = counter.GetValue(PlayerControlMgr.Instance.GetPlayer().unique_id) as ExpValue;
             expValue.AddExp(-expValue.CurExp);
             component.skillManager.SkillPointsLeft = 0;
             for (int i = 0; i < 4; i++)
             {
                 List <SkillDataKey> skillsByIndex = component.getSkillsByIndex(i);
                 if (skillsByIndex != null)
                 {
                     for (int j = 0; j < skillsByIndex.Count; j++)
                     {
                         skillsByIndex[j] = new SkillDataKey(skillsByIndex[j].SkillID, 0, skillsByIndex[j].Skin);
                         Skill skillById = component.getSkillById(skillsByIndex[j].SkillID);
                         if (skillById != null)
                         {
                             skillById.SetLevel(0);
                         }
                     }
                 }
             }
             SkillCounter skillCounter = UtilManager.Instance.GetCounter(UtilType.Skill) as SkillCounter;
             skillCounter.OnHeroLevelup(component, 0);
             component.level = 1;
             component.UpLevel();
             CtrlManager.CloseWindow(WindowID.SkillView);
             CtrlManager.OpenWindow(WindowID.SkillView, null);
         }
     }
 }
Ejemplo n.º 2
0
    private void OnLvChange(int originLv, int newLv)
    {
        int   num    = newLv - originLv;
        Units player = PlayerControlMgr.Instance.GetPlayer();

        if (player == null)
        {
            return;
        }
        if (num > 0 && originLv > 0 && this._onwerId != player.unique_id)
        {
            SkillCounter skillCounter = UtilManager.Instance.GetCounter(UtilType.Skill) as SkillCounter;
            if (skillCounter == null)
            {
                Debug.LogError("no counter get for UtilType.Skill : " + this._onwerId);
                return;
            }
            Units unit = MapManager.Instance.GetUnit(this._onwerId);
            if (unit == null)
            {
                Debug.LogError("no hero get for id : " + this._onwerId);
                return;
            }
            skillCounter.OnHeroLevelup(unit, newLv);
        }
        if (num > 0)
        {
            this.ShowLevelUpEffect(this._onwerId);
            Units unit2 = MapManager.Instance.GetUnit(this._onwerId);
            if (null != unit2 && unit2.isHero)
            {
                unit2.level = newLv;
            }
            if (this._onwerId == player.unique_id && !Singleton <PvpManager> .Instance.IsInPvp)
            {
                Singleton <SkillView> .Instance.AddSkillPoint(num);
            }
        }
    }