示例#1
0
    void RefreshTypeData(int maintype)
    {
        int index = mSkillTypeDatas.FindIndex(itr => itr.info._mainType == maintype);

        if (index != -1)
        {
            mSkillTypeDatas[index].data = SkillTreeInfo.GetUIShowList(maintype, skillMgr);
        }


        if (mActiveSkillType != null)
        {
            SkillMainType mainType = SkillTreeInfo.SkillMainTypeInfo[pageIndex].Find(itr => itr._mainType == mActiveSkillType.data.info._mainType);

            if (mainType != null)
            {
                UISkillType.SkillTypeData skillTypeData = new UISkillType.SkillTypeData(SkillTreeInfo.GetUIShowList(mainType._mainType, skillMgr), mainType);
                mActiveSkillType.data = skillTypeData;
            }
        }

        if (onRefreshTypeData != null)
        {
            onRefreshTypeData(this);
        }
    }
    public ulong GetNextExpBySkillType(int skillType)
    {
        SkillTreeUnit skill = FindSkillUnit(skillType);
        SkillTreeUnit nextSkill;

        if (skill != null)
        {
            int nextLevel = skill._level + 1;
            nextSkill = SkillTreeInfo.GetSkillUnit(skillType, nextLevel);
            if (nextSkill != null)
            {
                return(nextSkill._exp);
            }
            else
            {
                return(0);
            }
        }
        else
        {
            nextSkill = SkillTreeInfo.GetMinLevelSkillByType(skillType);
            if (nextSkill != null)
            {
                return(nextSkill._exp);
            }
            else
            {
                return(0);
            }
        }
    }
    public SKTLearnResult SKTLearn(int skillType)
    {
        SkillTreeUnit skill = FindSkillUnit(skillType);
        SkillTreeUnit nextSkill;

        if (skill != null)
        {
            int nextLevel = skill._level + 1;
            nextSkill = SkillTreeInfo.GetSkillUnit(skillType, nextLevel);
            if (nextSkill != null)
            {
                SKTLearnResult result = CheckLevelUpCondition(nextSkill);
                if (result != SKTLearnResult.SKTLearnResult_Success)
                {
                    return(result);
                }
                if (!DecExp(nextSkill._exp))
                {
                    return(SKTLearnResult.SKTLearnResult_DontHaveEnoughExp);
                }
                RemoveSkillUnit(skill);
                AddSkillUnit(nextSkill);
            }
            else
            {
                return(SKTLearnResult.SKTLearnResult_DataError);
            }
        }
        else
        {
            nextSkill = SkillTreeInfo.GetMinLevelSkillByType(skillType);
            if (nextSkill != null)
            {
                SKTLearnResult result = CheckLevelUpCondition(nextSkill);
                if (result != SKTLearnResult.SKTLearnResult_Success)
                {
                    return(result);
                }
                if (!DecExp(nextSkill._exp))
                {
                    return(SKTLearnResult.SKTLearnResult_DontHaveEnoughExp);
                }
                ;
                AddSkillUnit(nextSkill);
            }
            else
            {
                return(SKTLearnResult.SKTLearnResult_DataError);
            }
        }
        SkillTreeInfo.RefreshUI(nextSkill._mainType);
        if (GameConfig.IsMultiMode && _net != null)
        {
            _net.RPCServer(EPacketType.PT_InGame_SKTLevelUp, skillType, PlayerNetwork.mainPlayerId);
        }
        return(SKTLearnResult.SKTLearnResult_Success);
    }
示例#4
0
    protected override void InitWindow()
    {
        base.InitWindow();
        skillMgr = GameUI.Instance.mMainPlayer.GetCmpt <SkillTreeUnitMgr>();
        skEntiyt = GameUI.Instance.mMainPlayer.GetCmpt <SkAliveEntity>();
        Refresh(TableState.tb_Work);
        SkillTreeInfo.SetUICallBack(RefreshTypeData);
        Invoke("ResetScrollValue", 0.2f);

        mSkillTypeCtrl.onSetBtnActive += OnSkillTypeBtnActive;

        mSkillTypeCtrl.SetActiveBtn(0);
    }
示例#5
0
 void RPC_S2C_InitLearntSkills(uLink.BitStream stream, uLink.NetworkMessageInfo info)
 {
     int[] ids = stream.Read <int[]>();
     for (int i = 0; i < ids.Length; i++)
     {
         SkillTreeUnit skillUnit = SkillTreeInfo.GetSkillUnit(ids[i]);
         if (skillUnit != null)
         {
             _learntSkills.AddSkillUnit(skillUnit);
         }
     }
     _learntSkills.InitDefaultSkill();
 }
 public void ChangeSkillState(SkillTreeUnit skill)
 {
     skill._state = SkillState.Lock;
     if (_learntSkills.Contains(skill))
     {
         skill._state = SkillState.learnt;
         return;
     }
     string[] args = skill._parent.Split(';');
     for (int i = 0; i < args.Length; i++)
     {
         SkillTreeUnit skillUnit = SkillTreeInfo.GetSkillUnit(System.Int32.Parse(args[i]));
         if (skillUnit == null)
         {
             if (args[i] == "0")
             {
                 skill._state = SkillState.unLock;
             }
             else
             {
                 skill._state = SkillState.Lock;
                 Debug.LogError("parent skill is not exsit");
             }
             return;
         }
         else
         {
             SkillTreeUnit skilllearnt = FindSkillUnit(skillUnit._skillType);
             if (skilllearnt != null)
             {
                 if (skilllearnt._level >= skillUnit._level)
                 {
                     if (i == args.Length - 1)
                     {
                         skill._state = SkillState.unLock;
                     }
                 }
                 else
                 {
                     skill._state = SkillState.Lock;
                     return;
                 }
             }
             else
             {
                 skill._state = SkillState.Lock;
                 return;
             }
         }
     }
 }
    public static Dictionary <int, List <SkillTreeUnit> > GetUIShowList(int mainType, SkillTreeUnitMgr mgr)
    {
        //[grade][unit]
        List <SkillTreeUnit> minLevelSkills = SkillTreeInfo.GetMinLevelByMainType(mainType);
        List <SkillTreeUnit> learntSkills   = mgr.GetSkillsByMainType(mainType);
        //[grade][unit]
        Dictionary <int, List <SkillTreeUnit> > outSkills = new Dictionary <int, List <SkillTreeUnit> >();

        for (int j = 0; j < minLevelSkills.Count; j++)
        {
            for (int i = 0; i < learntSkills.Count; i++)
            {
                if (learntSkills[i]._skillType == minLevelSkills[j]._skillType)
                {
                    minLevelSkills[j] = learntSkills[i];
                    break;
                }
            }
            mgr.ChangeSkillState(minLevelSkills[j]);
            if (!outSkills.ContainsKey(minLevelSkills[j]._skillGrade))
            {
                outSkills[minLevelSkills[j]._skillGrade] = new List <SkillTreeUnit>();
            }
            outSkills[minLevelSkills[j]._skillGrade].Add(minLevelSkills[j]);
        }
        foreach (var iter in outSkills)
        {
            if (iter.Value != null && iter.Value.Count > 1)
            {
                iter.Value.Sort((left, right) =>
                {
                    if (left._descIndex > right._descIndex)
                    {
                        return(1);
                    }
                    else if (left._descIndex == right._descIndex)
                    {
                        return(0);
                    }
                    else
                    {
                        return(-1);
                    }
                });
            }
        }
        return(outSkills);
    }
 SKTLearnResult CheckLevelUpCondition(SkillTreeUnit skill)
 {
     if (_ske == null)
     {
         return(SKTLearnResult.SKTLearnResult_SkAliveEntityIsNULL);
     }
     if (skill != null)
     {
         if (_ske.GetAttribute((int)AttribType.Exp) < skill._exp)
         {
             return(SKTLearnResult.SKTLearnResult_DontHaveEnoughExp);
         }
         if (skill._parent != "0")
         {
             string[] args = skill._parent.Split(';');
             for (int i = 0; i < args.Length; i++)
             {
                 SkillTreeUnit skillunit = SkillTreeInfo.GetSkillUnit(System.Int32.Parse(args[i]));
                 if (skillunit == null)
                 {
                     return(SKTLearnResult.SKTLearnResult_DataError);
                 }
                 else
                 {
                     SkillTreeUnit skilllearnt = FindSkillUnit(skillunit._skillType);
                     if (skilllearnt != null)
                     {
                         if (skilllearnt._level >= skillunit._level)
                         {
                             if (i == args.Length - 1)
                             {
                                 return(SKTLearnResult.SKTLearnResult_Success);
                             }
                         }
                         else
                         {
                             return(SKTLearnResult.SKTLearnResult_NeedLearntParentSkill);
                         }
                     }
                 }
             }
             return(SKTLearnResult.SKTLearnResult_DataError);
         }
         return(SKTLearnResult.SKTLearnResult_Success);
     }
     return(SKTLearnResult.SKTLearnResult_DataError);
 }
    public override void Deserialize(BinaryReader _in)
    {
        if (_net != null)
        {
            return;
        }
        int count = _in.ReadInt32();

        for (int i = 0; i < count; i++)
        {
            int           id        = _in.ReadInt32();
            SkillTreeUnit skillUnit = SkillTreeInfo.GetSkillUnit(id);
            if (skillUnit != null)
            {
                AddSkillUnit(skillUnit);
            }
        }
    }
示例#10
0
    void RefreshData()
    {
        if (!SkillTreeInfo.SkillMainTypeInfo.ContainsKey(pageIndex) || skillMgr == null)
        {
            return;
        }

        foreach (UISkillType uiType in mSkillTypeList)
        {
            SkillMainType mainType = SkillTreeInfo.SkillMainTypeInfo[pageIndex].Find(itr => itr._mainType == uiType.mainType);
            if (mainType == null)
            {
                continue;
            }

            UISkillType.SkillTypeData skillTypeData = new UISkillType.SkillTypeData(SkillTreeInfo.GetUIShowList(mainType._mainType, skillMgr), mainType);
            uiType.data = skillTypeData;
        }
    }
示例#11
0
    void RPC_S2C_SKTLevelUp(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int levelUpType = stream.Read <int>();
        int level       = stream.Read <int> ();
        int playerid    = stream.Read <int> ();

        if (playerid == PlayerNetwork.mainPlayerId || _learntSkills == null)
        {
            return;
        }
        SkillTreeUnit skillUnit = _learntSkills.FindSkillUnit(levelUpType);

        if (skillUnit != null)
        {
            _learntSkills.RemoveSkillUnit(skillUnit);
        }
        SkillTreeUnit nextSkillUnit = SkillTreeInfo.GetSkillUnit(levelUpType, level);

        if (nextSkillUnit != null)
        {
            _learntSkills.AddSkillUnit(nextSkillUnit);
        }
    }
示例#12
0
    void Refresh(TableState state)
    {
        if (mTableState != state)
        {
            mTableState = state;

            if (SkillTreeInfo.SkillMainTypeInfo.ContainsKey(pageIndex))
            {
                mSkillTypeDatas.Clear();
//				int count = 0;
                for (int i = 0; i < SkillTreeInfo.SkillMainTypeInfo[pageIndex].Count; i++)
                {
                    int                       main_type     = SkillTreeInfo.SkillMainTypeInfo[pageIndex][i]._mainType;
                    SkillMainType             mainType      = SkillTreeInfo.SkillMainTypeInfo[pageIndex].Find(itr => itr._mainType == main_type);
                    UISkillType.SkillTypeData skillTypeData = new UISkillType.SkillTypeData(SkillTreeInfo.GetUIShowList(mainType._mainType, skillMgr), mainType);
                    mSkillTypeDatas.Add(skillTypeData);
                }


                mSkillTypeCtrl.SetContent(SkillTreeInfo.SkillMainTypeInfo[pageIndex].Count, OnSetSkillTypeBtnContent);

                mSkillTypeCtrl.SetActiveBtn(0);
            }
        }

        UpdateSkillTypePos();
    }
示例#13
0
    public static void LoadAllData()
    {
        if (s_localDatabase != null)
        {
            return;
        }

#if UNITY_EDITOR
        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
        sw.Start();
#endif
        s_localDatabase = LoadDb();
        SkillSystem.SkData.LoadData();
        Pathea.Effect.EffectData.LoadData();
        Pathea.Projectile.ProjectileData.LoadData();
        Pathea.RequestRelation.LoadData();
        Pathea.CampData.LoadData();
        Pathea.ThreatData.LoadData();
        Pathea.DamageData.LoadData();
        HumanSoundData.LoadData();
        ItemDropData.LoadData();

        PELocalization.LoadData();

        NaturalResAsset.NaturalRes.LoadData();
        //SkillAsset.EffCastData.LoadData();
        //SkillAsset.EffSkill.LoadData();
        //SkillAsset.MergeSkill.LoadData();
        //AnimData.LoadData();
        //AnimSoundData.LoadData();

        AiAsset.AiData.LoadData();

        SoundAsset.SESoundBuff.LoadData();
        SoundAsset.SESoundStory.LoadData();
        //CharacterData.LoadCharacterData();
        StoryDoodadMap.LoadData();
        StoreRepository.LoadData();
        NpcMissionDataRepository.LoadData();
        //PlayerAttribute.LoadData();
        MissionRepository.LoadData();
        TalkRespository.LoadData();
        //NpcRandomRepository.LoadData();
        ShopRespository.LoadData();
        WareHouseManager.LoadData();
        //HeroTalkRepository.LoadData();
        MutiPlayRandRespository.LoadData();
        PromptRepository.LoadData();

        //MapIconData.LoadDate();
        //MapMaskData.LoadDate();
        CampPatrolData.LoadDate();
        Camp.LoadData();
        RepProcessor.LoadData();

        CloudManager.LoadData();
        //BattleUnitData.LoadData();
        TutorialData.LoadData();
        //RepairMachineManager.LoadData();
        MapMaskData.LoadDate();
        MessageData.LoadData();         //lz-2016.07.13 Add it
        MonsterHandbookData.LoadData(); //lz-2016.07.20 Add it
        StoryRepository.LoadData();
        RMRepository.LoadRandMission();
        MisInitRepository.LoadData();
        CameraRepository.LoadCameraPlot();
        AdRMRepository.LoadData();
        VCConfig.InitConfig();
        Cutscene.LoadData();

//		BuildBrushData.LoadBrush();
        BSPattern.LoadBrush();
        BSVoxelMatMap.Load();
        BSBlockMatMap.Load();
        BlockBuilding.LoadBuilding();
        LifeFormRule.LoadData();
        PlantInfo.LoadData();
        MetalScanData.LoadData();
        BattleConstData.LoadData();
        CustomCharactor.CustomMetaData.LoadData();
        SkillTreeInfo.LoadData();
        VArtifactUtil.LoadData();
        Pathea.ActionRelationData.LoadActionRelation();

        //colony
        CSInfoMgr.LoadData();
        ProcessingObjInfo.LoadData();
        CSTradeInfoData.LoadData();
        CampTradeIdData.LoadData();
        AbnormalTypeTreatData.LoadData();
        CSMedicineSupport.LoadData();
        //RandomItemMgr
        RandomItemDataMgr.LoadData();
        FecesData.LoadData();
        //randomdungeon
        RandomDungeonDataBase.LoadData();
        AbnormalData.LoadData();
        PEAbnormalNoticeData.LoadData();

        RelationInfo.LoadData();
        EquipSetData.LoadData();
        SuitSetData.LoadData();

        CheatData.LoadData();

        Pathea.NpcProtoDb.Load();
        Pathea.MonsterProtoDb.Load();
        Pathea.MonsterRandomDb.Load();
        Pathea.MonsterGroupProtoDb.Load();
        Pathea.RandomNpcDb.Load();
        Pathea.PlayerProtoDb.Load();
        Pathea.TowerProtoDb.Load();
        Pathea.DoodadProtoDb.Load();
        Pathea.AttPlusNPCData.Load();
        Pathea.AttPlusBuffDb.Load();
        Pathea.NpcTypeDb.Load();
        Pathea.NpcRandomTalkDb.Load();
        Pathea.NpcThinkDb.LoadData();
        Pathea.NpcEatDb.LoadData();
        Pathea.NpcRobotDb.Load();
        Pathea.NPCScheduleData.Load();
        Pathea.NpcVoiceDb.LoadData();
        InGameAidData.LoadData(); //lz-2016.08.21 add it
        MountsSkillDb.LoadData();

#if UNITY_EDITOR
        sw.Stop();
        Debug.Log("Database Loaded : " + sw.ElapsedMilliseconds);
        sw.Reset();
#else
        Debug.Log("Database Loaded");
#endif
    }