コード例 #1
0
    public static List <string> BuildPlayerSimplePreloadAssets(PRoleSummary info, List <string> assets = null)
    {
        if (assets == null)
        {
            assets = new List <string>();
        }

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

        if (model)
        {
            assets.Add(model.models[0]);
        }

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

        // Player weapons
        BuildWeaponSimplePreloadAssets(info.proto, info.gender, w.weaponID, w.weaponItemId, assets);

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

        if (info.pet == null || info.pet.itemId == 0)
        {
            return(assets);
        }

        var rPet = PetInfo.Create(info.pet);

        BuildPetSimplePreloadAssets(rPet, assets, 2);

        return(assets);
    }
コード例 #2
0
ファイル: Window_PVP.cs プロジェクト: NoeCalmness/CoreFrame
    private void CreatEnemyCreature(PMatchInfo info)
    {
        //创建敌人
        ShowCreatureInfo showInfo = ConfigManager.Get <ShowCreatureInfo>(10);
        Vector3_         pos      = new Vector3_(1.3, 0, 0);
        Vector3          rot      = new Vector3(0, -110, 0);

        if (showInfo != null)
        {
            for (int i = 0; i < showInfo.forData.Length; i++)
            {
                if (showInfo.forData[i].index == info.roleProto)
                {
                    pos = showInfo.forData[i].data[0].pos;
                    rot = showInfo.forData[i].data[0].rotation;
                    break;
                }
            }
        }

        var weaponInfo = ConfigManager.Get <PropItemInfo>(info.fashion.weapon);

        if (weaponInfo == null)
        {
            return;
        }

        moduleGlobal.LockUI("", 0.5f);
        Level.PrepareAssets(Module_Battle.BuildPlayerSimplePreloadAssets(info), (r) =>
        {
            if (!r)
            {
                return;
            }

            enemy = moduleHome.CreatePlayer(info, pos, CreatureDirection.BACK);
            enemy.transform.localEulerAngles = rot;
            moduleGlobal.UnLockUI();
        });
        if (info.pet != null && info.pet.itemTypeId != 0)
        {
            var rPet   = PetInfo.Create(info.pet);
            var assets = new List <string>();
            Level.PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, assets, 2), b =>
            {
                var rGradeInfo = rPet.UpGradeInfo;
                var show       = ConfigManager.Get <ShowCreatureInfo>(rPet.ID);
                if (show == null)
                {
                    Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rPet.ID);
                    return;
                }
                var showData = show.GetDataByIndex(0);
                var data     = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0);
                enemyPet     = moduleHome.CreatePet(rGradeInfo, pos + data.pos, data.rotation, Level.current.startPos, true, Module_Home.FIGHTING_PET_OBJECT_NAME + "_Enemy");
                enemyPet.transform.localScale      *= data.size;
                enemyPet.transform.localEulerAngles = data.rotation;
            });
        }
    }
コード例 #3
0
    protected override List <string> OnBuildPreloadAssets(List <string> assets = null)
    {
        base.OnBuildPreloadAssets(assets);

        PropItemInfo weaponInfo = ConfigManager.Get <PropItemInfo>(moduleLabyrinth.sneakPlayerDetail.fashion.weapon);

        LoadStateMachineEffect(assets, weaponInfo.subType, weaponInfo.ID, 0, 1);  // @TODO: 尽管现在性别绑定到职业了,但逻辑上必须使用性别
        LoadAllBuffAsset(assets);

        // enermy model
        var model = ConfigManager.Get <CreatureInfo>(moduleLabyrinth.lastSneakPlayer.GetProto());

        if (model)
        {
            assets.AddRange(model.models);
        }
        //添加装备和时装
        assets.AddRange(CharacterEquip.GetEquipAssets(moduleLabyrinth.sneakPlayerDetail.fashion));
        assets.AddRange(CharacterEquip.GetAnimatorAssets(moduleLabyrinth.sneakPlayerDetail.fashion));

        var pet = moduleLabyrinth.lastSneakPlayer.pet;

        if (pet != null && pet.itemId > 0)
        {
            var petInfo = PetInfo.Create(pet);
            if (petInfo != null)
            {
                Module_Battle.BuildPetPreloadAssets(assets, petInfo);
            }
        }

        assets.AddRange(FillLabyrithBuffAsset());
        return(assets);
    }
コード例 #4
0
    public Creature GetPlayerCreature(int creatureId, PNmlPlayer data)
    {
        CreatureInfo info = ConfigManager.Get <CreatureInfo>(creatureId);
        var          prop = ConfigManager.Get <PropItemInfo>(data.fashion.weapon);

        if (prop)
        {
            info.weaponID     = prop.subType;
            info.weaponItemID = data.fashion.weapon;
        }
        Creature player = Creature.Create(info, Vector3.zero, new Vector3(0f, 90f, 0f), data.roleId.Equals(modulePlayer.roleInfo.roleId), false);

        if (data.pet != null && data.pet.itemTypeId != 0)
        {
            player.pet = PetCreature.Create(player, PetInfo.Create(data.pet), player.position_, player.eulerAngles, false, Module_Home.PET_OBJECT_NAME);
            if (player.pet != null)
            {
                if (!moduleAI.IsStartAI)
                {
                    moduleAI.StartAI();
                }
                player.pet.DisableSkills(true);
                moduleAI.AddPetAI(player.pet);
            }
        }
        return(player);
    }
コード例 #5
0
    private void CreateTeamPlayer()
    {
        var members = moduleTeam.members;

        if (members != null)
        {
            for (var i = 0; i < members.Length; ++i)
            {
                var pi       = members[i];
                var info     = modulePlayer.BuildPlayerInfo(pi);
                var isPlayer = pi.roleId == LoadParamTeam.MasterId;
                var pos      = new Vector3_(playerStart.x - i, 0, 0);

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

                p.roleId       = pi.roleId;
                p.roleProto    = pi.roleProto;
                p.teamIndex    = i;
                p.avatar       = pi.avatar;
                p.enableUpdate = false;
                p.SetCreatureCamp(CreatureCamp.PlayerCamp);

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

                if (pi.teamLeader > 0)
                {
                    m_teamLeader = p;
                }
                else
                {
                    m_normalMember = p;
                }

                m_teamMembers.Add(p);

                CharacterEquip.ChangeCloth(p, pi.fashion);

                if (pi.pet != null && pi.pet.itemTypeId != 0)
                {
                    var show = ConfigManager.Get <ShowCreatureInfo>(pi.pet.itemTypeId);
                    if (show == null)
                    {
                        Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", pi.pet.itemTypeId);
                        continue;
                    }

                    var showData = show.GetDataByIndex(0);
                    var data     = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0);
                    p.pet = PetCreature.Create(p, PetInfo.Create(pi.pet), p.position_ + data.pos, p.eulerAngles, false, Module_Home.PET_OBJECT_NAME);
                    p.pet.enableUpdate = false;
                }
            }
        }
    }
コード例 #6
0
    private void ShowDecomposeComfirm()
    {
        var petInfo = PetInfo.Create(ConfigManager.Get <PropItemInfo>(itemCache.source));

        Util.SetPetInfo(originItem, petInfo);
        Util.SetItemInfo(item, ConfigManager.Get <PropItemInfo>(itemCache.itemTypeId), 0, (int)itemCache.num);
        comfirmButton?.onClick.RemoveAllListeners();
        comfirmButton?.onClick.AddListener(GoBack);
        closeComfirmButton?.onClick.RemoveAllListeners();
        closeComfirmButton?.onClick.AddListener(GoBack);
        decomposePanel.SafeSetActive(true);
    }
コード例 #7
0
    private void CreatTeamCreature(PMatchProcessInfo info, int index)
    {
        //创建敌人
        var t   = GetTransform(info, index);
        var pos = t.pos;
        var rot = t.rotation;

        var weaponInfo = ConfigManager.Get <PropItemInfo>(info.fashion.weapon);

        if (weaponInfo == null)
        {
            return;
        }

        moduleGlobal.LockUI("", 0.5f);
        m_memberLoadCoroutine = Level.PrepareAssets(Module_Battle.BuildPlayerSimplePreloadAssets(info), r =>
        {
            if (!r)
            {
                return;
            }

            teamPlayer                            = moduleHome.CreatePlayer(info, pos, CreatureDirection.FORWARD);
            teamPlayer.uiName                     = Module_Home.TEAM_OBJECT_NAME;
            teamPlayer.gameObject.name            = Module_Home.TEAM_OBJECT_NAME;
            teamPlayer.transform.localEulerAngles = rot;
            teamPlayer.transform.localScale       = Vector3.one * t.size;
            moduleGlobal.UnLockUI();
        });

        if (info.pet != null && info.pet.itemTypeId != 0)
        {
            var rPet   = PetInfo.Create(info.pet);
            var assets = new List <string>();
            Level.PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, assets, 2), b =>
            {
                var rGradeInfo = rPet.UpGradeInfo;
                var show       = ConfigManager.Get <ShowCreatureInfo>(rPet.ID);
                if (show == null)
                {
                    Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rPet.ID);
                    return;
                }
                var showData  = show.GetDataByIndex(0);
                var data      = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0);
                teamPlayerPet = moduleHome.CreatePet(rGradeInfo, pos + data.pos, data.rotation, Level.current.startPos, true,
                                                     Module_Home.TEAM_PET_OBJECT_NAME);
                teamPlayerPet.transform.localScale      *= data.size;
                teamPlayerPet.transform.localEulerAngles = data.rotation;
            });
        }
    }
コード例 #8
0
    private List <string> GetPlayerPreloadAssets(List <PMazePlayer> infos)
    {
        List <string> list = new List <string>();

        string temp = string.Empty;

        foreach (var p in infos)
        {
            //add creature
            var c = ConfigManager.Get <CreatureInfo>(p.GetProto());
            if (!c)
            {
                Logger.LogError("wrong player proto with pmazePlayer : id:{0},name:{1},gender:{2} proto:{3}",
                                p.roleId, p.roleName, p.gender, p.GetProto());
                continue;
            }
            list.AddRange(c.models);

            if (p.fashion != null)
            {
                //add animator asset
                var prop = ConfigManager.Get <PropItemInfo>(p.fashion.weapon);
                if (prop)
                {
                    temp = Creature.GetAnimatorName(prop.subType, p.gender);
                    if (!list.Contains(temp))
                    {
                        list.Add(temp);
                    }
                }

                //equip assets
                List <string> equips = CharacterEquip.GetEquipAssets(p.fashion);
                foreach (var e in equips)
                {
                    if (!list.Contains(e))
                    {
                        list.Add(e);
                    }
                }
            }

            //pet assets
            if (p.pet != null && p.pet.itemTypeId != 0)
            {
                var pet = PetInfo.Create(p.pet);
                Module_Battle.BuildPetSimplePreloadAssets(pet, list, 1);
            }
        }
        list.Distinct();
        return(list);
    }
コード例 #9
0
    public void Show(PItem2 rItem)
    {
        itemCache = rItem;
        gameObject.SetActive(true);
        var levelHome = Level.current as Level_Home;
        var pet       = PetInfo.Create(ConfigManager.Get <PropItemInfo>(rItem.source != 0 ? rItem.source : rItem.itemTypeId));

        if (pet != null)
        {
            levelHome?.CreatePet(pet);
            Util.SetText(NameText, pet.CPetInfo.itemNameId);
        }
    }
コード例 #10
0
ファイル: Module_Pet.cs プロジェクト: NoeCalmness/CoreFrame
    /// <summary>
    ///     获取所有配置中的宠物信息
    /// </summary>
    /// <returns></returns>
    public static List <PetInfo> GetAllPet()
    {
        var rList = ConfigManager.FindAll <PropItemInfo>(item => item.itemType == PropType.Pet);

        var res = new List <PetInfo>();

        foreach (var info in rList)
        {
            var petInfo = modulePet.GetPet(info.ID);
            res.Add(petInfo ?? PetInfo.Create(info));
        }

        res.Sort(CompareHandle);
        return(res);
    }
コード例 #11
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);
    }
コード例 #12
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);
    }
コード例 #13
0
    private List <string> GetPlayerPreloadAssets(PNmlPlayer[] infos)
    {
        List <string> list = new List <string>();

        string temp = string.Empty;

        foreach (var p in infos)
        {
            //add creature
            var c = ConfigManager.Get <CreatureInfo>(p.GetProto());
            list.AddRange(c.models);

            //add animator asset
            var prop = ConfigManager.Get <PropItemInfo>(p.fashion.weapon);
            if (prop)
            {
                temp = Creature.GetAnimatorName(prop.subType, p.gender);
                if (!list.Contains(temp))
                {
                    list.Add(temp);
                }
            }

            //equip assets
            List <string> equips = CharacterEquip.GetEquipAssets(p.fashion);
            foreach (var e in equips)
            {
                if (!list.Contains(e))
                {
                    list.Add(e);
                }
            }

            if (p.pet != null && p.pet.itemTypeId != 0)
            {
                var pet = PetInfo.Create(p.pet);
                Module_Battle.BuildPetSimplePreloadAssets(pet, list, 1);
            }
        }
        list.Distinct();
        return(list);
    }
コード例 #14
0
ファイル: Module_Pet.cs プロジェクト: NoeCalmness/CoreFrame
    /// <summary>
    ///     增加或更新宠物列表信息
    /// </summary>
    /// <param name="rInfo"></param>
    /// <param name="isNew"></param>
    /// <returns>true 成功增加  false 更新宠物信息</returns>
    public bool AddPet(PItem rInfo, bool isNew = true)
    {
        var pet = GetPet(rInfo.itemTypeId);

        if (pet == null)
        {
            pet = PetInfo.Create(rInfo);
            if (pet != null)
            {
                PetList.Add(pet);
                if (isNew)
                {
                    NewPetList.Add(pet.ID);
                    DispatchModuleEvent(EventGetNewPet, pet, null);
                }
                return(true);
            }
        }
        else
        {
            pet.InitData(rInfo);
        }
        return(false);
    }
コード例 #15
0
ファイル: Level_PVP.cs プロジェクト: NoeCalmness/CoreFrame
    protected override void OnCreateCreatures()
    {
        m_isEnding = false;

        EventManager.AddEventListener(CreatureEvents.DEAD, OnCreatureDead);

        if (!moduleAI.IsStartAI)
        {
            moduleAI.StartAI();
        }

        var players = LoadParam.players;

        for (var i = 0; i < players.Length; ++i)
        {
            var pi       = players[i];
            var info     = modulePlayer.BuildPlayerInfo(pi);
            var isPlayer = pi.roleId == LoadParam.MasterId;
            var pos      = new Vector3_(i == 0 ? CombatConfig.spvpStart.x : CombatConfig.spvpStart.y, 0, 0);

            var p = isPlayer || !LoadParam.IsMatchRobot ? Creature.Create(info, pos, new Vector3(0, 90, 0), isPlayer, i + ":" + pi.roleId, pi.roleName) : RobotCreature.Create(info, pos, new Vector3(0, 90, 0), i + ":" + pi.roleId, pi.roleName);

            if (i != 0)
            {
                p.direction = CreatureDirection.BACK;
            }

            p.roleId       = pi.roleId;
            p.roleProto    = pi.roleProto;
            p.teamIndex    = i;
            p.avatar       = pi.avatar;
            p.enableUpdate = false;

            if (isPlayer)
            {
                m_player = p;
            }

            m_players.Add(p);

            if (LoadParam.IsMatchRobot)
            {
                if (!isPlayer)
                {
                    moduleAI.AddPlayerAI(p);
                }
                moduleAI.AddCreatureToCampDic(p);
            }

            CharacterEquip.ChangeCloth(p, pi.fashion);

            if (pi.pet != null && pi.pet.itemTypeId != 0)
            {
                var show = ConfigManager.Get <ShowCreatureInfo>(pi.pet.itemTypeId);
                if (show == null)
                {
                    Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", pi.pet.itemTypeId);
                    continue;
                }

                var showData = show.GetDataByIndex(0);
                var data     = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0);
                p.pet = PetCreature.Create(p, PetInfo.Create(pi.pet), p.position_ + data.pos, p.eulerAngles, false, Module_Home.PET_OBJECT_NAME);
                p.pet.enableUpdate = false;

                if (!moduleAI.IsStartAI)
                {
                    moduleAI.StartAI();
                }
                moduleAI.AddPetAI(p.pet);
            }
        }

        combatCamera.enabled = false;
        combatCamera.LookTo(new Vector3((float)((CombatConfig.spvpStart.x + CombatConfig.spvpStart.y) * 0.5), 0, 0));
    }
コード例 #16
0
    protected override void OnCreateCreatures()
    {
        base.OnCreateCreatures();
        EventManager.AddEventListener(CreatureEvents.DEAD, OnCreatureDead);

        //进入迷宫的时候要还原血量
        if (modulePVE.reopenPanelType == PVEReOpenPanel.Labyrinth)
        {
            int damage = (int)(player.maxHealth * (1.0f - moduleLabyrinth.labyrinthSelfInfo.healthRate / 100f));
            player.TakeDamage(null, DamageInfo.CreatePreCalculate(damage));
            player.rage = moduleLabyrinth.labyrinthSelfInfo.angerRate;

            //Logger.LogDetail("进入关卡赋值血量和怒气health = {0},anger = {1}", player.healthRate, player.rageRate);
        }

        moduleAI.StartAI();

        if (m_player.pet != null)
        {
            moduleAI.AddPetAI(m_player.pet);
        }

        //创建机器人
        int      enermyCreatureId = moduleLabyrinth.lastSneakPlayer.GetProto();
        PFashion enermyFashion    = moduleLabyrinth.sneakPlayerDetail.fashion;

        m_enermy = RobotCreature.CreateRobot(enermyCreatureId, Vector3.zero + Vector3.right * 5, new Vector3(0f, 90f, 0f), enermyFashion.weapon, enermyFashion.gun, "hero2", moduleLabyrinth.lastSneakPlayer.roleName);
        m_enermy.gameObject.name = "enermy_robot";
        m_enermy.direction       = CreatureDirection.BACK;
        m_enermy.avatar          = moduleLabyrinth.lastSneakPlayer.avatar;
        m_enermy.roleProto       = enermyCreatureId;

        CharacterEquip.ChangeCloth(m_enermy, moduleLabyrinth.sneakPlayerDetail.fashion);
        //重置属性
        ((RobotCreature)m_enermy).ResetRobotAttribute(moduleLabyrinth.sneakPlayerDetail.roleAttrs, enermyFashion);

        //创建宠物
        PItem pet = moduleLabyrinth.lastSneakPlayer.pet;

        if (pet != null && pet.itemTypeId != 0)
        {
            var show = ConfigManager.Get <ShowCreatureInfo>(pet.itemTypeId);
            if (show == null)
            {
                Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", pet.itemTypeId);
            }

            var showData = show.GetDataByIndex(0);
            var data     = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0);
            m_enermy.pet = PetCreature.Create(m_enermy, PetInfo.Create(pet), m_enermy.position_ + data.pos, m_enermy.eulerAngles, false, Module_Home.PET_OBJECT_NAME);

            moduleAI.AddPetAI(m_enermy.pet);
        }

        //设置被偷袭玩家BUFF
        if (moduleLabyrinth.sneakPlayerDetail.buffs != null)
        {
            ushort[] buffIds = moduleLabyrinth.sneakPlayerDetail.buffs;
            for (int i = 0, length = buffIds.Length; i < length; i++)
            {
                Buff.Create(buffIds[i], m_enermy);
            }
        }
        moduleAI.AddCreatureToCampDic(m_enermy);
        moduleAI.AddCreatureToCampDic(player);
        moduleAI.AddPlayerAI(m_enermy);

        combatCamera.enabled = false;
        combatCamera.LookTo(new Vector3((float)((CombatConfig.spvpStart.x + CombatConfig.spvpStart.y) * 0.5), 0, 0));

        //set initial health and rage
        modulePVE.SetPveGameData(EnumPVEDataType.Health, m_player.healthRate);
        modulePVE.SetPveGameData(EnumPVEDataType.Rage, m_player.rageRate);
    }