Example #1
0
        private void TickUsers()
        {
            for (LinkedListNode <UserInfo> linkNode = UserManager.Users.FirstValue; null != linkNode; linkNode = linkNode.Next)
            {
                UserInfo info = linkNode.Value;
                if (info.GetEquipmentStateInfo().EquipmentChanged)
                {
                    RefreshItemSkills(info);
                }
                if (info.LevelChanged || info.GetSkillStateInfo().BuffChanged || info.GetEquipmentStateInfo().EquipmentChanged || info.GetLegacyStateInfo().LegacyChanged)
                {
                    UserAttrCalculator.Calc(info);
                    info.LevelChanged = false;
                    info.GetSkillStateInfo().BuffChanged          = false;
                    info.GetEquipmentStateInfo().EquipmentChanged = false;
                    info.GetLegacyStateInfo().LegacyChanged       = false;
                }
                if (info.Hp <= 0)
                {
                    if (info.DeadTime <= 0)
                    {
                        //计算击杀收益
                        CalcKillIncome(info);
                        info.GetCombatStatisticInfo().AddDeadCount(1);  //死亡计数+1
                                                                        //解除控制
                        ReleaseControl(info);
                        //发送玩家死亡消息
                        Msg_RC_Dead build = new Msg_RC_Dead();
                        build.role_id = info.GetId();
                        NotifyAllUser(build);
                        PlayerLevelupExpConfig cfg = PlayerConfigProvider.Instance.GetPlayerLevelupExpConfigById(info.GetLevel());
                        info.SetStateFlag(Operate_Type.OT_AddBit, CharacterState_Type.CST_BODY);

                        m_StorySystem.SendMessage("userkilled", info.GetId(), GetLivingUserCount());

                        TryFireAllUserKilled();
                        NoticeAttempRoomClosing();

                        info.DeadTime = TimeUtility.GetServerMilliseconds();
                        if (null != cfg && m_IsPvpScene)
                        {
                            info.ReviveTime = TimeUtility.GetServerMilliseconds() + cfg.m_RebornTime * 1000;
                        }
                        else
                        {
                            info.ReviveTime = TimeUtility.GetServerMilliseconds() + info.ReleaseTime + 2000;
                        }
                        NpcInfo npc = NpcManager.GetNpcInfo(info.PartnerId);
                        if (null != npc && npc.NpcType == (int)NpcTypeEnum.Partner)
                        {
                            npc.NeedDelete = true;
                        }
                    }
                    else
                    {
                        /*
                         * long delta = TimeUtility.GetServerMilliseconds() - info.DeadTime;
                         * if (delta > info.ReleaseTime) {
                         * info.DeadTime = info.ReviveTime;
                         * Msg_RC_Disappear build = new Msg_RC_Disappear();
                         * build.role_id = info.GetId();
                         * NotifyAllUser(build);
                         * }
                         */
                    }
                }
            }
        }
Example #2
0
        public void LoadData(int resId)
        {
            SetLinkId(resId);
            m_LevelupConfig = PlayerConfigProvider.Instance.GetPlayerLevelupConfigById(resId);
            Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(resId);

            if (null != playerData)
            {
                SetName(playerData.m_Name);
                SetModel(playerData.m_Model);
                SetActionList(playerData.m_ActionList);

                m_AiEquipment      = playerData.m_AiEquipment;
                m_AiAttackSkill    = playerData.m_AiAttackSkill;
                m_AiMoveSkill      = playerData.m_AiMoveSkill;
                m_AiControlSkill   = playerData.m_AiControlSkill;
                m_AiSelfAssitSkill = playerData.m_AiSelfAssitSkill;
                m_AiTeamAssitSkill = playerData.m_AiTeamAssitSkill;
                ///
                GetAiStateInfo().AiLogic = playerData.m_AiLogic;

                m_Scale         = playerData.m_Scale;
                AvoidanceRadius = playerData.m_AvoidanceRadius;
                Shape           = new Circle(new Vector3(0, 0, 0), playerData.m_Radius);

                ViewRange           = playerData.m_ViewRange;
                ReleaseTime         = playerData.m_ReleaseTime;
                HeadUiPos           = playerData.m_HeadUiPos;
                CostType            = playerData.m_CostType;
                ShootBuffLifeTime   = playerData.m_ShootBuffLifeTime;
                NoGunRunEnterTimeMs = playerData.m_NoGunRunEnterTimeMs;

                int   hp                = (int)playerData.m_AttrData.GetAddHpMax(0, 0);
                int   energy            = (int)playerData.m_AttrData.GetAddNpMax(0, 0);
                int   energyCore        = (int)playerData.m_AttrData.GetAddEpMax(0, 0);
                float moveSpeed         = playerData.m_AttrData.GetAddSpd(0, 0);
                int   hpMax             = (int)playerData.m_AttrData.GetAddHpMax(0, 0);
                int   energyMax         = (int)playerData.m_AttrData.GetAddNpMax(0, 0);
                int   energyCoreMax     = (int)playerData.m_AttrData.GetAddEpMax(0, 0);
                int   crgMax            = (int)playerData.m_AttrData.GetAddCrgMax(0, 0);
                float hpRecover         = playerData.m_AttrData.GetAddHpRecover(0, 0);
                float energyRecover     = playerData.m_AttrData.GetAddNpRecover(0, 0);
                float energyCoreRecover = playerData.m_AttrData.GetAddEpRecover(0, 0);
                int   attackBase        = (int)playerData.m_AttrData.GetAddAd(0, 0);
                int   defenceBase       = (int)playerData.m_AttrData.GetAddDp(0, 0);
                float critical          = playerData.m_AttrData.GetAddCri(0, 0);
                float criticalPow       = playerData.m_AttrData.GetAddPow(0, 0);
                float armorPenetration  = playerData.m_AttrData.GetAddAndp(0, 0);
                float energyIntensity   = playerData.m_AttrData.GetAddAp(0, 0);
                float energyArmor       = playerData.m_AttrData.GetAddTay(0, 0);
                float attackRange       = playerData.m_AttrData.GetAddRange(0, 0);

                m_MuzzlePos = playerData.m_GunEndRelativePos;

                GetBaseProperty().SetMoveSpeed(Operate_Type.OT_Absolute, moveSpeed);
                GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, hpMax);
                GetBaseProperty().SetRageMax(Operate_Type.OT_Absolute, (int)playerData.m_AttrData.GetAddRageMax(0, 0));
                GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, energyMax);
                GetBaseProperty().SetEnergyCoreMax(Operate_Type.OT_Absolute, energyCoreMax);
                GetBaseProperty().SetCrgMax(Operate_Type.OT_Absolute, crgMax);
                GetBaseProperty().SetHpRecover(Operate_Type.OT_Absolute, hpRecover);
                GetBaseProperty().SetEnergyRecover(Operate_Type.OT_Absolute, energyRecover);
                GetBaseProperty().SetEnergyCoreRecover(Operate_Type.OT_Absolute, energyCoreRecover);
                GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, attackBase);
                GetBaseProperty().SetDefenceBase(Operate_Type.OT_Absolute, defenceBase);
                GetBaseProperty().SetCritical(Operate_Type.OT_Absolute, critical);
                GetBaseProperty().SetCriticalPow(Operate_Type.OT_Absolute, criticalPow);
                GetBaseProperty().SetArmorPenetration(Operate_Type.OT_Absolute, armorPenetration);
                GetBaseProperty().SetEnergyIntensity(Operate_Type.OT_Absolute, energyIntensity);
                GetBaseProperty().SetEnergyArmor(Operate_Type.OT_Absolute, energyArmor);
                GetBaseProperty().SetAttackRange(Operate_Type.OT_Absolute, attackRange);

                // 技能数据
                for (int i = 0; i < 4; i++)
                {
                    GetSkillStateInfo().AddSkill(i, new SkillInfo(i + 1));
                }
                GetSkillStateInfo().AddSkill(4, new SkillInfo(playerData.m_RollSkill));

                // 武器数据
                for (int i = 0; i < playerData.m_WeaponList.Count; ++i)
                {
                    WeaponInfo      weaponInfo = new WeaponInfo(playerData.m_WeaponList[i]);
                    WeaponLogicData weaponData = weaponInfo.ConfigData;
                    if (null != weaponData)
                    {
                        GetShootStateInfo().AddWeapon(i, weaponInfo);
                        if (null == GetShootStateInfo().GetCurWeaponInfo())
                        {
                            GetShootStateInfo().SetCurWeaponInfo(weaponInfo.WeaponId);
                            GetShootStateInfo().CurrentWeaponIndex = i;
                        }
                        //todo:先按武器表里的武器配置上,后续需要从db里读取升级数据并初始化升级配置数据
                        EquipmentDataInfo equipDataInfo = new EquipmentDataInfo();
                        equipDataInfo.EquipmentConfig = EquipmentConfigProvider.Instance.GetEquipmentConfigById(weaponData.m_EquipmentId);
                        GetEquipmentStateInfo().EquipmentInfo.Weapons[i] = equipDataInfo;
                    }
                }

                //装备数据
                for (int i = 0; i < ShopEquipmentsId.Length; ++i)
                {
                    ShopEquipmentsId[i] = -1;
                }
                UserAttrCalculator.Calc(this);
                SetHp(Operate_Type.OT_Absolute, GetActualProperty().HpMax);
                SetRage(Operate_Type.OT_Absolute, 0);
                SetEnergy(Operate_Type.OT_Absolute, GetActualProperty().EnergyMax);
                SetEnergyCore(Operate_Type.OT_Absolute, GetActualProperty().EnergyCoreMax);
                for (int i = 0; i < playerData.m_WeaponList.Count; ++i)
                {
                    WeaponInfo      weaponInfo = GetShootStateInfo().GetWeaponInfoById(playerData.m_WeaponList[i]);
                    WeaponLogicData weaponData = weaponInfo.ConfigData;
                    if (null != weaponData)
                    {
                        //暴击数值
                        float CRIRATE_   = (float)(GetActualProperty().Critical / 480.0);
                        float CRIRATE_C_ = CriticalConfigProvider.Instance.GetC(CRIRATE_);
                        weaponInfo.CurCritical = CRIRATE_C_;
                    }
                }
            }
        }