//接收到服务器发送的 技能升级 public void OnMsgRecoverLevelUpSucc_BS2C(PacketReader p, object state) { int levelPointNum = p.ReadInt32(); bool isSkill = (p.ReadInt32() == 1) ? true : false; int skillId = p.ReadInt32(); int yellowPointNum = p.ReadInt32(); MainPlayer mainPlayer = ActorManager.Singleton.MainActor; mainPlayer.Props.SetProperty_Int32(ENProperty.LevelUpPoint, levelPointNum); if (isSkill) { int skillIndex = UIBattleBtn_D.Singleton.GetSkillIndexBySkillId(skillId); PropertyValueIntListView skillLevelList = mainPlayer.Props.GetProperty_Custom(ENProperty.SkillLevelList) as PropertyValueIntListView; skillLevelList.m_list[skillIndex]++; mainPlayer.Props.SetProperty_Custom(ENProperty.SkillLevelList, skillLevelList); Actor.ActorSkillInfo info = mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == skillId); if (null != info) { info.SkillLevel++; } } else { mainPlayer.Props.SetProperty_Int32(ENProperty.YellowPointLevel, yellowPointNum); } mainPlayer.UpDataSkillLevelUp(); }
public int GetSkillIndexBySkillId(int SkillId) { int index = 0; PropertyValueIntListView skillIDList = m_mainPlayer.Props.GetProperty_Custom(ENProperty.SkillIDList) as PropertyValueIntListView; foreach (var item in skillIDList.m_list) { if (item == SkillId) { return(index); } ++index; } return(index); }
public override void OnInitProps() { base.OnInitProps(); CurrentTableInfo = GameTable.HeroInfoTableAsset.Lookup(IDInTable); if (CurrentTableInfo == null) { return; } if (0 == Props.GetProperty_Int32(ENProperty.vocationid)) { Props.SetProperty_Int32(ENProperty.vocationid, 1); } //显示玩家名称 AddPlayerName(); HP = CurrentTableInfo.FHPMax; MaxHP = CurrentTableInfo.FHPMax; MoveSpeed = CurrentTableInfo.MoveSpeed; MovebackSpeed = CurrentTableInfo.MovebackSpeed; AnimationSpeed = CurrentTableInfo.AnimationSpeed; AttackAnimSpeed = 1; Props.SetProperty_Int32(ENProperty.islive, 1); Props.SetProperty_Float(ENProperty.phyattack, (int)CurrentTableInfo.FPhyAttack); Props.SetProperty_Float(ENProperty.phydefend, (int)CurrentTableInfo.FPhyDefend); Props.SetProperty_Float(ENProperty.magattack, (int)CurrentTableInfo.FMagAttack); Props.SetProperty_Float(ENProperty.magdefend, (int)CurrentTableInfo.FMagDefend); Props.SetProperty_Float(ENProperty.avoid, (int)CurrentTableInfo.FAvoid); Props.SetProperty_Float(ENProperty.hit, (int)CurrentTableInfo.HitRate); Props.SetProperty_Float(ENProperty.crit, (int)CurrentTableInfo.CritRate); Props.SetProperty_Float(ENProperty.critParam, (int)CurrentTableInfo.CritParam); Props.SetProperty_Float(ENProperty.stamina, (float)CurrentTableInfo.StaminaMax); Props.SetProperty_Float(ENProperty.maxStamina, (float)CurrentTableInfo.StaminaMax); Props.SetProperty_Float(ENProperty.FResist, (float)CurrentTableInfo.FResist); Props.SetProperty_Float(ENProperty.AnitInterfere, (float)CurrentTableInfo.AnitInterfereRate); Props.SetProperty_Float(ENProperty.AnitInterrupt, (float)CurrentTableInfo.AnitInterruptRate); Props.SetProperty_Float(ENProperty.AnitRepel, (float)CurrentTableInfo.AnitRepelRate); Props.SetProperty_Float(ENProperty.AnitLauncher, (float)CurrentTableInfo.AnitLauncherRate); Props.SetProperty_Float(ENProperty.WoundParam, CurrentTableInfo.WoundParam); Props.SetProperty_Int32(ENProperty.WeaponID, CurrentTableInfo.WeaponId); Props.SetProperty_Float(ENProperty.ModelScale, CurrentTableInfo.ModelScale); CSItem card = CardBag.Singleton.GetCardByGuid(GUID); if (card == null) { if (Type == ActorType.enFollow) { card = Team.Singleton.Comrade; } } if (card != null) { MaxHP = card.GetHp(); HP = MaxHP; Level = card.Level; Props.SetProperty_Float(ENProperty.phyattack, card.GetPhyAttack()); Props.SetProperty_Float(ENProperty.magattack, card.GetMagAttack()); Props.SetProperty_Float(ENProperty.phydefend, card.GetPhyDefend()); Props.SetProperty_Float(ENProperty.magdefend, card.GetMagDefend()); PropertyCustomValue value = Props.GetProperty_Custom(ENProperty.SkillIDList); if (value == null) { Debug.LogWarning("ENProperty.SkillIDList is null"); return; } PropertyValueIntListView skillIDList = value as PropertyValueIntListView; if (skillIDList == null) { Debug.LogWarning("ENProperty.SkillIDList cast fail"); return; } for (int i = 0; i < card.SkillItemInfoList.Length; ++i) { skillIDList.m_list[i] = card.SkillItemInfoList[i].m_skillID; } Props.SetProperty_Custom(ENProperty.SkillIDList, skillIDList); } }
public override void OnInitProps() { base.OnInitProps(); CurrentTableInfo = GameTable.NPCInfoTableAsset.Lookup(IDInTable); if (CurrentTableInfo == null) { return; } if (GetNpcType() == ENNpcType.enBOSSNPC) { //boss SelfAI = new AINpcBoss(m_npcInfo.BossAIXmlName, m_npcInfo.BossAIXmlSubName); } else { if ((ENNPCAIType)m_npcInfo.AIType == ENNPCAIType.enAITypeNormal) { SelfAI = new AINpcLong(); } else if ((ENNPCAIType)m_npcInfo.AIType == ENNPCAIType.enAITypeBlock) { SelfAI = new AINpcBlock(); } } SelfAI.Owner = this; if (GetNpcType() == ENNpcType.enBOSSNPC) { //显示boss硬直,测试用 UIPauseBtn.Singleton.Register(ID); } //添加buff if (m_npcInfo.GiftBuffIDList != null && m_npcInfo.GiftBuffIDList.Count != 0) { IResult r = BattleFactory.Singleton.CreateResult(ENResult.AddBuff, ID, ID, 0, 0, m_npcInfo.GiftBuffIDList.ToArray()); if (r != null) { r.ResultExpr(m_npcInfo.GiftBuffIDList.ToArray()); BattleFactory.Singleton.GetBattleContext().CreateResultControl().DispatchResult(r); } } Props.SetProperty_Int32(ENProperty.islive, 1); SM.MonsterData mCurRoomMonsterData = null; if (roomElement != null && roomElement.MonsterData != null) { mCurRoomMonsterData = SM.RandomRoomLevel.Singleton.LookupMonsterData(roomElement.MonsterData.monsterObjId); } if (mCurRoomMonsterData != null && mCurRoomMonsterData.HP != -1) { Props.SetProperty_Float(ENProperty.maxhp, mCurRoomMonsterData.HP); Props.SetProperty_Float(ENProperty.hp, mCurRoomMonsterData.HP); } else { Props.SetProperty_Float(ENProperty.maxhp, m_npcInfo.HPMax); Props.SetProperty_Float(ENProperty.hp, m_npcInfo.HPMax); } if (mCurRoomMonsterData != null && mCurRoomMonsterData.PhyAtk != -1) { Props.SetProperty_Float(ENProperty.phyattack, mCurRoomMonsterData.PhyAtk); } else { Props.SetProperty_Float(ENProperty.phyattack, m_npcInfo.PhyAttack); } if (mCurRoomMonsterData != null && mCurRoomMonsterData.PhyDef != -1) { Props.SetProperty_Float(ENProperty.phydefend, mCurRoomMonsterData.PhyDef); } else { Props.SetProperty_Float(ENProperty.phydefend, m_npcInfo.PhyDefend); } if (mCurRoomMonsterData != null && mCurRoomMonsterData.MagAtk != -1) { Props.SetProperty_Float(ENProperty.magattack, mCurRoomMonsterData.MagAtk); } else { Props.SetProperty_Float(ENProperty.magattack, m_npcInfo.MagAttack); } if (mCurRoomMonsterData != null && mCurRoomMonsterData.MagDef != -1) { Props.SetProperty_Float(ENProperty.magdefend, mCurRoomMonsterData.MagDef); } else { Props.SetProperty_Float(ENProperty.magdefend, m_npcInfo.MagDefend); } PropertyValueIntListView skillIDList = Props.GetProperty_Custom(ENProperty.SkillIDList) as PropertyValueIntListView; //if (mCurRoomMonsterData != null) { int count = 0; if (mCurRoomMonsterData != null && mCurRoomMonsterData.SkillList != null) { for (int i = 0; i < mCurRoomMonsterData.SkillList.Count; ++i) { skillIDList.m_list[i] = mCurRoomMonsterData.SkillList[i]; ++count; } } else { for (int i = 0; i < m_npcInfo.SkillList.Count; i++) { skillIDList.m_list[i] = m_npcInfo.SkillList[i]; ++count; } } if (mCurRoomMonsterData != null && mCurRoomMonsterData.PassiveSkillList != null) { for (int i = 0; i < mCurRoomMonsterData.PassiveSkillList.Count; ++i) { skillIDList.m_list[i + count] = mCurRoomMonsterData.PassiveSkillList[i]; } } else { for (int i = 0; i < m_npcInfo.PassiveSkillList.Count; i++) { skillIDList.m_list[i + count] = m_npcInfo.PassiveSkillList[i]; } } } Props.SetProperty_Custom(ENProperty.SkillIDList, skillIDList); //设置NPCType if (mCurRoomMonsterData != null && mCurRoomMonsterData.MonsterType != -1) { Props.SetProperty_Int32(ENProperty.NpcType, (int)mCurRoomMonsterData.MonsterType); } else { Props.SetProperty_Int32(ENProperty.NpcType, (int)m_npcInfo.Type); } //设置模型比例 if (mCurRoomMonsterData != null && mCurRoomMonsterData.ChangeScale != -1) { ModelScale = mCurRoomMonsterData.ChangeScale; } else { ModelScale = m_npcInfo.ModelScale; } Props.SetProperty_Float(ENProperty.avoid, m_npcInfo.Avoid); Props.SetProperty_Float(ENProperty.hit, m_npcInfo.HitRate); Props.SetProperty_Float(ENProperty.crit, m_npcInfo.CritRate); Props.SetProperty_Float(ENProperty.critParam, m_npcInfo.CritParam); Props.SetProperty_Float(ENProperty.runSpeed, m_npcInfo.MoveSpeed); Props.SetProperty_Float(ENProperty.stamina, (float)m_npcInfo.StaminaMax); Props.SetProperty_Float(ENProperty.maxStamina, (float)m_npcInfo.StaminaMax); Props.SetProperty_Float(ENProperty.FResist, m_npcInfo.Resist); Props.SetProperty_Float(ENProperty.AnitInterfere, m_npcInfo.AnitInterfereRate); Props.SetProperty_Float(ENProperty.AnitInterrupt, m_npcInfo.AnitInterruptRate); Props.SetProperty_Float(ENProperty.AnitRepel, m_npcInfo.AnitRepelRate); Props.SetProperty_Float(ENProperty.AnitLauncher, m_npcInfo.AnitLauncherRate); Props.SetProperty_Float(ENProperty.WoundParam, m_npcInfo.WoundParam); Props.SetProperty_Float(ENProperty.MovebackSpeed, m_npcInfo.RetreatSpeed); Props.SetProperty_Float(ENProperty.AnimationSpeed, m_npcInfo.AnimationSpeed); Props.SetProperty_Int32(ENProperty.WeaponID, m_npcInfo.WeaponID); AttackAnimSpeed = 1; }