Exemplo n.º 1
0
    private void OnMemberReborn(PTeamMemberInfo memberData)
    {
        if (memberData == null)
        {
            return;
        }

        foreach (var item in m_teamMembers)
        {
            if (item.roleId == memberData.roleId && item.health == 0)
            {
                item.Revive();
                if (item == player)
                {
                    QuitState(BattleStates.Watch);
                }
                break;
            }
        }

        SetAllMonsterInvincible(false);

        FightRecordManager.RecordLog <LogUlong>(l =>
        {
            l.tag   = (byte)TagType.Reborn;
            l.value = memberData.roleId;
        });
    }
Exemplo n.º 2
0
    private void OnMemberQuit(PTeamMemberInfo member, EnumTeamQuitState reason)
    {
        if (moduleTeam.members == null)
        {
            return;
        }

        var c = m_teamMembers.Find(o => o.roleId == member.roleId);

        //掉线,角色直接死亡
        bool alive = c && c.health > 0;

        if (reason == EnumTeamQuitState.DroppedDuringGame && !isEndingState && !m_isPVEFinish && !m_recvOverMsg && alive)
        {
            c?.Kill();
        }

        //切换队长
        if (member.teamLeader > 0)
        {
            foreach (var item in moduleTeam.members)
            {
                item.teamLeader = (byte)(item.roleId == member.roleId ? 0 : 1);
            }

            if (c)
            {
                var temp = m_normalMember;
                m_normalMember = c;
                m_teamLeader   = temp;
                Logger.LogInfo("OnMemberQuit... team leader change to {0}", m_teamLeader ? m_teamLeader.uiName : "null");
            }
        }
    }
Exemplo n.º 3
0
    public CreatureInfo BuildPlayerInfo(PTeamMemberInfo memberInfo, bool playerBuff = true, bool playerSkill = true)
    {
        var info = ConfigManager.Get <CreatureInfo>(memberInfo.roleProto);

        if (!info)
        {
            Logger.LogError("Module_Player::BuildPlayerInfo: Build CreatureInfo from PTeamMemberInfo failed, could not find proto template config: {0}", memberInfo.roleProto);
            return(null);
        }

        info = memberInfo.attrInfo.ToCreatureInfo(info.Clone <CreatureInfo>());

        var w  = WeaponInfo.GetWeapon(0, memberInfo.fashion.weapon);
        var ww = WeaponInfo.GetWeapon(0, memberInfo.fashion.gun);

        if (w.isEmpty)
        {
            Logger.LogError("Creature::BuildPlayerInfo: MatchInfo has invalid weapon item:<b>[{0}]</b>", memberInfo.fashion.weapon);
        }

        if (ww.isEmpty)
        {
            Logger.LogError("Creature::BuildPlayerInfo: MatchInfo has invalid off weapon item:<b>[{0}]</b>", memberInfo.fashion.gun);
        }

        info.elementType     = memberInfo.elementType;
        info.weaponID        = w.weaponID;
        info.offWeaponID     = ww.weaponID;
        info.weaponItemID    = memberInfo.fashion.weapon;
        info.offWeaponItemID = memberInfo.fashion.gun;
        info.bulletCount     = memberInfo.bulletCount;
        info.energy          = memberInfo.energy;
        info.maxEnergy       = memberInfo.maxEnergy;
        info.awakeDuration   = memberInfo.awakeDuration;
        memberInfo.awakeChangeAttr.CopyTo(ref info.awakeChangeAttr);

        if (playerBuff)
        {
            info.buffs = memberInfo.buffs.SimpleClone();
        }
        else
        {
            info.buffs = null;
        }

        if (playerSkill && memberInfo.skills != null && memberInfo.skills.Length > 0)
        {
            PSkill[] skills = null;
            memberInfo.skills.CopyTo(ref skills);
            info.skills = skills;
        }
        else
        {
            info.skills = null;
        }

        return(info);
    }
Exemplo n.º 4
0
    protected Creature CreateTeamPlayer(PTeamMemberInfo rInfo, Vector3 pos, int index = 0)
    {
        if (rInfo == null)
        {
            return(null);
        }
        var info     = modulePlayer.BuildPlayerInfo(rInfo);
        var isPlayer = rInfo.roleId == LoadParamTeam.MasterId;

        var p = Creature.Create(info, pos, new Vector3(0, 90, 0), isPlayer, index + ":" + rInfo.roleId, rInfo.roleName);

        p.roleId       = rInfo.roleId;
        p.roleProto    = rInfo.roleProto;
        p.teamIndex    = index;
        p.avatar       = rInfo.avatar;
        p.enableUpdate = false;

        if (isPlayer)
        {
            m_player = p;
            moduleBattle.SetPlayerTeamIndex(p.teamIndex);
        }

        CharacterEquip.ChangeCloth(p, rInfo.fashion);

        if (rInfo.pet == null || rInfo.pet.itemTypeId == 0)
        {
            return(p);
        }
        var show = ConfigManager.Get <ShowCreatureInfo>(rInfo.pet.itemTypeId);

        if (show == null)
        {
            Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rInfo.pet.itemTypeId);
            return(p);
        }

        var showData = show.GetDataByIndex(0);
        var data     = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0);

        p.pet = PetCreature.Create(p, PetInfo.Create(rInfo.pet), p.position_ + data.pos, p.eulerAngles, false, Module_Home.PET_OBJECT_NAME);
        p.pet.enableUpdate = false;
        return(p);
    }
Exemplo n.º 5
0
    public static List <string> BuildPlayerPreloadAssets(PTeamMemberInfo info, List <string> assets = null)
    {
        if (assets == null)
        {
            assets = new List <string>();
        }
        if (info == null)
        {
            return(assets);
        }

        // Player shadow
        if (info.roleId == modulePlayer.id_)
        {
            assets.Add(CombatConfig.sdefaultSelfShadow);
        }

        // Player model
        var model = ConfigManager.Get <CreatureInfo>(info.roleProto);

        if (model)
        {
            assets.AddRange(model.models);
        }

        var w  = WeaponInfo.GetWeapon(0, info.fashion.weapon);
        var ww = WeaponInfo.GetWeapon(0, info.fashion.gun);

        // Player weapons
        BuildWeaponPreloadAssets(info.roleProto, info.gender, w.weaponID, w.weaponItemId, ww.weaponID, ww.weaponItemId, assets);

        // Buff effects
        BuildBuffPreloadAssets(info.buffs, assets);

        // Equipments
        assets.AddRange(CharacterEquip.GetEquipAssets(info.fashion));

        // Pet
        BuildPetPreloadAssets(assets, info.pet != null && info.pet.itemTypeId != 0 ? PetInfo.Create(info.pet) : null);

        return(assets);
    }
Exemplo n.º 6
0
 public void DispatchReborn(PTeamMemberInfo memberData)
 {
     DispatchModuleEvent(EventMemberReborn, memberData);
 }