示例#1
0
    public void ResetRobotAttribute(PRoleAttr roleAttrs, PFashion fashion = null)
    {
        CreatureInfo originalInfo = ConfigManager.Get <CreatureInfo>(configID);

        if (originalInfo == null)
        {
            Logger.LogError("configID = {0} connot be loaded,please check out!!", configID);
            return;
        }

        CreatureInfo info = roleAttrs.ToCreatureInfo(originalInfo.Clone <CreatureInfo>());

        //如果有时装的话,刷新武器数据
        if (fashion != null)
        {
            PropItemInfo item = ConfigManager.Get <PropItemInfo>(fashion.weapon);
            if (item != null)
            {
                info.weaponID     = item.subType;
                info.weaponItemID = item.ID;
            }

            item = ConfigManager.Get <PropItemInfo>(fashion.gun);
            if (item != null)
            {
                info.offWeaponID     = item.subType;
                info.offWeaponItemID = item.ID;
            }
        }
        UpdateConfig(info);
    }
示例#2
0
 public static int GetProto(this PFashion fashion)
 {
     if (fashion != null)
     {
         var w = ConfigManager.Get <PropItemInfo>(fashion.weapon);
         if (w)
         {
             return(w.subType);
         }
     }
     return((int)CreatureVocationType.Vocation1);
 }
示例#3
0
    public static List <PropItemInfo> GetValidFashionList(PFashion fashion)
    {
        var items = GetValidFashionClothList(fashion);

        if (fashion.weapon > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.weapon));
        }
        if (fashion.gun > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.gun));
        }

        return(items);
    }
示例#4
0
    /// <summary>
    /// 仅处理更换时装
    /// </summary>
    /// <param name="c"></param>
    /// <param name="fashion"></param>
    /// <param name="isCombine">如果合并网格,则需要重新加载动画控制器</param>
    public static void ChangeCloth(Creature c, PFashion fashion, bool isCombine = false)
    {
        if (fashion == null)
        {
            return;
        }

        var e = c.activeRootNode.GetComponentDefault <CharacterEquip>();

        c.AddEventListener(CreatureEvents.RESET_LAYERS, e.OnCreatureResetLayer);
        e.RefreshCloth(fashion);
        if (isCombine)
        {
            e.CombineMesh();
        }
    }
示例#5
0
    public static List <PropItemInfo> GetValidFashionClothList(PFashion fashion)
    {
        var items = new List <PropItemInfo>();

        if (fashion.hair > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.hair));
        }
        if (fashion.clothes > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.clothes));
        }
        if (fashion.trousers > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.trousers));
        }
        if (fashion.glove > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.glove));
        }
        if (fashion.shoes > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.shoes));
        }
        if (fashion.headdress > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.headdress));
        }
        if (fashion.guiseId > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.guiseId));
        }
        if (fashion.hairdress > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.hairdress));
        }
        if (fashion.facedress > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.facedress));
        }
        if (fashion.neckdress > 0)
        {
            items.Add(ConfigManager.Get <PropItemInfo>(fashion.neckdress));
        }

        return(items);
    }
示例#6
0
    public static List <string> GetAnimatorAssets(PFashion fashion)
    {
        List <string> list = new List <string>();
        PropItemInfo  info = ConfigManager.Get <PropItemInfo>(fashion.weapon);

        if (info == null)
        {
            Logger.LogError("propid = {0} cannot be found,please check out", fashion.weapon);
            return(list);
        }

        for (int j = 0; j < 2; j++)
        {
            list.Add(Util.Format("animator_weapon_{0}_{1}", info.subType, j));
        }
        return(list);
    }
示例#7
0
    public static List <string> GetEquipAssets(PFashion fashionData)
    {
        if (fashionData == null)
        {
            return(new List <string>());
        }

        var fashions = GetValidFashionList(fashionData);
        var list     = new List <string>();

        foreach (var i in fashions)
        {
            if (!i)
            {
                continue;
            }

            switch (i.itemType)
            {
            //武器和枪械的都去weapon表里面获取
            case PropType.Weapon:
                var ws = WeaponInfo.GetSingleWeapons(i.subType, i.ID);
                foreach (var w in ws)
                {
                    if (!string.IsNullOrEmpty(w.model))
                    {
                        list.Add(w.model);
                    }
                    if (!string.IsNullOrEmpty(w.effects))
                    {
                        var es = Util.ParseString <string>(w.effects);
                        list.AddRange(es);
                    }
                }
                break;

            case PropType.FashionCloth:
                for (int j = 0; j < i.mesh.Length; j++)
                {
                    list.Add(i.mesh[j]);
                }
                break;
            }
        }
        return(list);
    }
示例#8
0
    public PFashion GetRandomFashion(int gender, int proto)
    {
        var      infos   = ConfigManager.GetAll <PropItemInfo>().FindAll(o => o.itemType == PropType.Weapon || o.itemType == PropType.FashionCloth);
        PFashion fashion = PacketObject.Create <PFashion>();

        var          items  = infos.FindAll(o => o.itemType == PropType.Weapon && o.subType == proto && o.IsValidVocation(proto));
        PropItemInfo weapon = items.GetValue(Random.Range(0, items.Count));

        if (!weapon)
        {
            Logger.LogError("cannot finded a valid weapon with proto {0}", proto);
            return(fashion);
        }
        fashion.weapon = (ushort)weapon?.ID;

        items       = infos.FindAll(o => o.itemType == PropType.Weapon && o.subType == (int)WeaponSubType.Gun && (o.sex == gender || o.sex == 2));
        fashion.gun = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;

        items            = infos.FindAll(o => o.itemType == PropType.FashionCloth && o.subType == (int)FashionSubType.FourPieceSuit && o.IsValidVocation(proto));
        fashion.clothes  = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;
        fashion.trousers = fashion.glove = fashion.shoes = fashion.clothes;

        items        = infos.FindAll(o => o.itemType == PropType.FashionCloth && o.subType == (int)FashionSubType.Hair && o.IsValidVocation(proto));
        fashion.hair = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;

        items             = infos.FindAll(o => o.itemType == PropType.FashionCloth && o.subType == (int)FashionSubType.HeadDress && o.IsValidVocation(proto));
        fashion.headdress = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;

        items             = infos.FindAll(o => o.itemType == PropType.FashionCloth && o.subType == (int)FashionSubType.HairDress && o.IsValidVocation(proto));
        fashion.hairdress = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;

        items             = infos.FindAll(o => o.itemType == PropType.FashionCloth && o.subType == (int)FashionSubType.FaceDress && o.IsValidVocation(proto));
        fashion.facedress = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;

        items             = infos.FindAll(o => o.itemType == PropType.FashionCloth && o.subType == (int)FashionSubType.NeckDress && o.IsValidVocation(proto));
        fashion.neckdress = (ushort)items.GetValue(Random.Range(0, items.Count))?.ID;

        return(fashion);
    }
示例#9
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);
    }
示例#10
0
 public void RefreshCloth(PFashion fashion)
 {
     _RefreshCloth(GetValidFashionClothList(fashion));
 }
示例#11
0
    public PFashion GetSelfFashion()
    {
        PFashion fashion = PacketObject.Create <PFashion>();

        for (int i = 0, count = moduleEquip.currentDressClothes.Count; i < count; i++)
        {
            PItem        item     = moduleEquip.currentDressClothes[i];
            PropItemInfo itemInfo = item?.GetPropItem();
            if (itemInfo == null)
            {
                continue;
            }

            switch (itemInfo.itemType)
            {
            case PropType.Weapon:
                if (itemInfo.subType != (byte)WeaponSubType.Gun)
                {
                    fashion.weapon = item.itemTypeId;
                }
                else
                {
                    fashion.gun = item.itemTypeId;
                }
                break;

            case PropType.FashionCloth:
                switch ((FashionSubType)itemInfo.subType)
                {
                case FashionSubType.UpperGarment:
                case FashionSubType.FourPieceSuit:
                case FashionSubType.TwoPieceSuit:
                    fashion.clothes = item.itemTypeId;
                    break;

                case FashionSubType.Pants:
                    fashion.trousers = item.itemTypeId;
                    break;

                case FashionSubType.Glove:
                    fashion.glove = item.itemTypeId;
                    break;

                case FashionSubType.Shoes:
                    fashion.shoes = item.itemTypeId;
                    break;

                case FashionSubType.Hair:
                    fashion.hair = item.itemTypeId;
                    break;

                case FashionSubType.ClothGuise:
                    fashion.guiseId = item.itemTypeId;
                    break;

                case FashionSubType.HeadDress:
                    fashion.headdress = item.itemTypeId;
                    break;

                case FashionSubType.HairDress:
                    fashion.hairdress = item.itemTypeId;
                    break;

                case FashionSubType.FaceDress:
                    fashion.facedress = item.itemTypeId;
                    break;

                case FashionSubType.NeckDress:
                    fashion.neckdress = item.itemTypeId;
                    break;
                }
                break;
            }
        }

        return(fashion);
    }