예제 #1
0
        /// <summary>
        /// 创于预览角色(使用List的接口)
        /// </summary>
        public static UnitID CreateClientModelForLua(uint type_id, uint uid, List <uint> modIdLst, List <uint> fashions, List <uint> suit_effects, Action <Actor> cbResLoad = null, List <xc.DBAvatarPart.BODY_PART> no_show_parts = null, bool is_ui_model = true, bool updateWithRawActor = true)
        {
            UnitID unit_id = ActorManager.GetAvailableModelId((byte)EUnitType.UNITTYPE_PLAYER);

            xc.UnitCacheInfo info          = new xc.UnitCacheInfo(EUnitType.UNITTYPE_PLAYER, unit_id.obj_idx);
            List <uint>      model_id_list = new List <uint>(modIdLst);
            List <uint>      fashions_list = new List <uint>(fashions);

            if (suit_effects != null)
            {
                info.AOIPlayer.suit_effects = new List <uint>(suit_effects);
            }

            List <xc.DBAvatarPart.BODY_PART> no_show_part_list = null;

            if (no_show_parts != null)
            {
                no_show_part_list = new List <DBAvatarPart.BODY_PART>(no_show_parts);
                for (int index = 0; index < no_show_part_list.Count; ++index)
                {
                    xc.DBAvatarPart.BODY_PART del_body_part = no_show_part_list[index];
                    Equip.EquipHelper.DelEquipPart(model_id_list, del_body_part);
                    Equip.EquipHelper.DelEquipPart(fashions_list, del_body_part);
                }
            }

            model_id_list.AddRange(fashions_list);

            info.AOIPlayer.model_id_list = new List <uint>();
            info.AOIPlayer.fashions      = new List <uint>();

            ActorHelper.GetModelFashionList(model_id_list, info.AOIPlayer.model_id_list, info.AOIPlayer.fashions);

            info.AOIPlayer.type_idx = type_id;
            info.PosBorn            = Vector3.zero;
            info.IsUIModel          = is_ui_model;

            var client_model = ActorManager.Instance.CreateActor <ClientModel>(info, Quaternion.identity, null, true, cbResLoad);

            if (client_model == null)
            {
                return(null);
            }

            client_model.UpdateWithRawActor = updateWithRawActor;
            client_model.RawUID             = uid;

            if (client_model.mAvatarCtrl != null && no_show_part_list != null && no_show_part_list.Count > 0)
            {
                client_model.mAvatarCtrl.mNoShowParts = no_show_part_list;
            }
            ShadowBehavior shadow_behavior = client_model.GetBehavior <ShadowBehavior>();

            if (shadow_behavior != null)
            {
                shadow_behavior.HideFakeShadow = true;
            }

            return(info.UnitID);
        }
예제 #2
0
        /// <summary>
        /// 根据PkgPlayerBrief来初始化AOI数据
        /// </summary>
        public static UnitCacheInfo CreateUnitCacheInfo(PkgPlayerBrief info, Vector3 pos)
        {
            var cache_info = new xc.UnitCacheInfo(EUnitType.UNITTYPE_PLAYER, info.uuid);

            cache_info.CacheType               = xc.UnitCacheInfo.EType.ET_Create;
            cache_info.PosBorn                 = pos;
            cache_info.AOIPlayer.type_idx      = ActorHelper.RoleIdToTypeId(info.rid);
            cache_info.AOIPlayer.name          = System.Text.Encoding.UTF8.GetString(info.name);
            cache_info.AOIPlayer.model_id_list = new List <uint>();
            cache_info.AOIPlayer.fashions      = new List <uint>();
            ActorHelper.GetModelFashionList(info.shows, cache_info.AOIPlayer.model_id_list, cache_info.AOIPlayer.fashions);
            cache_info.AOIPlayer.suit_effects = info.effects;
            cache_info.AOIPlayer.level        = (short)info.level;
            cache_info.AOIPlayer.mount_id     = info.ride;
            cache_info.AOIPlayer.name_color   = info.name_color;
            cache_info.AOIPlayer.state        = info.state;
            cache_info.AOIPlayer.honor_id     = info.honor;
            cache_info.AOIPlayer.title_id     = info.title;
            cache_info.AOIPlayer.transfer_lv  = info.transfer;
            cache_info.AOIPlayer.mate_info    = info.mate;

            if (info.war != null)
            {
                cache_info.AOIPlayer.camp      = info.war.side;
                cache_info.AOIPlayer.team_id   = info.war.team_id;
                cache_info.AOIPlayer.pet_id    = info.war.pet_skin; //宠物皮肤
                cache_info.AOIPlayer.escort_id = info.war.escort_id;
            }
            else
            {
                cache_info.AOIPlayer.camp      = 0;
                cache_info.AOIPlayer.team_id   = 0;
                cache_info.AOIPlayer.pet_id    = 0;
                cache_info.AOIPlayer.escort_id = 0;
            }
            if (info.guild != null)
            {
                cache_info.AOIPlayer.guild_id   = info.guild.guild_id;
                cache_info.AOIPlayer.guild_name = System.Text.Encoding.UTF8.GetString(info.guild.guild_name);
            }
            else
            {
                cache_info.AOIPlayer.guild_id   = 0;
                cache_info.AOIPlayer.guild_name = "";
            }

            return(cache_info);
        }
예제 #3
0
        public static UnitID CreateWorshipModelForLua(uint type_id, uint uid, uint rank, string name, string guildName, uint honor, uint title, XLua.LuaTable modIdLst, XLua.LuaTable fashions, XLua.LuaTable suit_effects, Action <Actor> cbResLoad = null)
        {
            Vector3            pos      = Vector3.zero;
            Quaternion         rotation = Quaternion.identity;
            List <Neptune.Tag> tags     = Neptune.DataHelper.GetTagListByType(Neptune.DataManager.Instance.Data, "special_pos");

            if (rank <= tags.Count)
            {
                pos      = tags[(int)(rank - 1)].Position;
                pos      = RoleHelp.GetPositionInScene(type_id, pos.x, pos.z);
                rotation = tags[(int)(rank - 1)].Rotation;
            }

            xc.UnitCacheInfo info = new xc.UnitCacheInfo(EUnitType.UNITTYPE_PLAYER, GetAvailableUUId());
            info.AOIPlayer.model_id_list = XLua.XUtils.CreateListByLuaTable <uint, uint>(modIdLst);
            info.AOIPlayer.fashions      = XLua.XUtils.CreateListByLuaTable <uint, uint>(fashions);
            info.AOIPlayer.suit_effects  = XLua.XUtils.CreateListByLuaTable <uint, uint>(suit_effects);
            info.AOIPlayer.type_idx      = type_id;
            info.PosBorn  = pos;
            info.Rotation = rotation;

            info.AOIPlayer.model_id_list.AddRange(info.AOIPlayer.fashions);

            ActorHelper.GetModelFashionList(info.AOIPlayer.model_id_list, info.AOIPlayer.model_id_list, info.AOIPlayer.fashions);

            var model = ActorManager.Instance.CreateActor <WorshipModel>(info, info.Rotation, null, true, cbResLoad);

            model.RawUID           = uid;
            model.Rank             = rank;
            model.UserName         = name;
            model.GuildName        = guildName;
            model.mActorAttr.Honor = honor;
            model.mActorAttr.Title = title;

            WorshipModelHeadBehavior worshipModelHeadBehavior = model.GetBehavior <WorshipModelHeadBehavior>();

            worshipModelHeadBehavior.ResetHeadInfo();
            worshipModelHeadBehavior.Honor = honor;
            worshipModelHeadBehavior.Title = title;

            return(info.UnitID);
        }
예제 #4
0
        /// <summary>
        /// 根据AOI信息更新本地玩家
        /// </summary>
        /// <param name="info"></param>
        void UpdateLocalPlayerAOIInfo(PkgPlayerBrief info)
        {
            var local_player = Game.Instance.GetLocalPlayer() as LocalPlayer;

            if (local_player == null)
            {
                return;
            }

            List <uint> model_list   = new List <uint>();
            List <uint> fashion_list = new List <uint>();

            ActorHelper.GetModelFashionList(info.shows, model_list, fashion_list);
            local_player.mAvatarCtrl.ChangeFacade(model_list, fashion_list, info.effects, local_player.VocationID);
            var client_model_set = ActorManager.Instance.ClientModelSet;

            foreach (var client_modle in client_model_set.Values)
            {
                if (client_modle != null && client_modle.RawUID == local_player.UID.obj_idx && client_modle.UpdateWithRawActor)
                {
                    client_modle.mAvatarCtrl.ChangeFacade(model_list, fashion_list, info.effects, local_player.VocationID);
                }
            }

            if (info.guild != null)
            {
                local_player.ActorAttribute.GuildId   = info.guild.guild_id;
                local_player.ActorAttribute.GuildName = System.Text.Encoding.UTF8.GetString(info.guild.guild_name);
            }
            else
            {
                local_player.ActorAttribute.GuildId   = 0;
                local_player.ActorAttribute.GuildName = "";
            }

            local_player.UpdateNameColor(info.name_color);

            local_player.ActorAttribute.Honor      = info.honor;
            local_player.ActorAttribute.Title      = info.title;
            local_player.ActorAttribute.TransferLv = info.transfer;

            local_player.MateInfo = info.mate;

            local_player.SetNameText();
            local_player.ActorAttribute.BattlePower = info.battle_power;
            local_player.ActorAttribute.Level       = info.level;

            uint oldEscortId = local_player.ActorAttribute.EscortId;

            if (info.war != null)
            {
                local_player.ActorAttribute.TeamId   = info.war.team_id;
                local_player.ActorAttribute.EscortId = info.war.escort_id;

                if (local_player != null)
                {
                    local_player.UpdateAOIAttrElement(info.war.attr_elm);
                }

                local_player.UpdateByBitState(info.bit_states);
                local_player.SetHeadIcons(Actor.EHeadIcon.TEAM);
                local_player.UpdatePetId(info.war.pet_skin);
            }
            else
            {
                local_player.ActorAttribute.TeamId   = 0;
                local_player.ActorAttribute.EscortId = 0;
            }
            if (oldEscortId != local_player.ActorAttribute.EscortId)
            {
                local_player.UpdateEscortNPC();
            }
            if (local_player.ActorAttribute.EscortId > 0)
            {
                // 如果有进行中的护送任务,则寻路做这个任务
                if (oldEscortId != local_player.ActorAttribute.EscortId)
                {
                    RouterManager.Instance.GenericGoToSysWindow(GameConst.SYS_OPEN_QUEST_ESCORT);
                }
            }

            local_player.SetHeadIcons(Actor.EHeadIcon.PEAK);

            LocalPlayerManager.Instance.LocalActorAttribute.EscortId = local_player.ActorAttribute.EscortId;

            local_player.MountId = info.ride;
        }
예제 #5
0
        /// <summary>
        /// 更新AOI的数据
        /// </summary>
        /// <param name="info"></param>
        protected override void UpdateAoiInfo(PkgPlayerBrief info)
        {
            if (Actor == null)
            {
                return;
            }

            Actor.ActorAttribute.State = info.state;

            List <uint> model_list   = new List <uint>();
            List <uint> fashion_list = new List <uint>();

            ActorHelper.GetModelFashionList(info.shows, model_list, fashion_list);
            Actor.mAvatarCtrl.ChangeFacade(model_list, fashion_list, info.effects, Actor.VocationID);

            if (info.guild != null)
            {
                Actor.ActorAttribute.GuildId   = info.guild.guild_id;
                Actor.ActorAttribute.GuildName = System.Text.Encoding.UTF8.GetString(info.guild.guild_name);
            }
            else
            {
                Actor.ActorAttribute.GuildId   = 0;
                Actor.ActorAttribute.GuildName = "";
            }

            Actor.ActorAttribute.Honor      = info.honor;
            Actor.ActorAttribute.Title      = info.title;
            Actor.ActorAttribute.TransferLv = info.transfer;
            Actor.UpdateNameColor(info.name_color);
            Actor.MateInfo = info.mate;
            Actor.SetNameText();
            Actor.ActorAttribute.BattlePower = info.battle_power;
            Actor.ActorAttribute.Level       = info.level;

            uint oldEscortId = Actor.ActorAttribute.EscortId;

            if (info.war != null)
            {
                Actor.ActorAttribute.TeamId   = info.war.team_id;
                Actor.ActorAttribute.EscortId = info.war.escort_id;

                //Actor.PKLvProtect = Info.war.pk_lv_protect;
                if (Actor != null)
                {
                    Actor.UpdateAOIAttrElement(info.war.attr_elm);
                }

                Actor.UpdateByBitState(Info.bit_states);
                Actor.SetHeadIcons(Actor.EHeadIcon.TEAM);
                if (Actor is Player)
                {
                    (Actor as Player).UpdatePetId(info.war.pet_skin);
                }
            }
            else
            {
                Actor.ActorAttribute.TeamId   = 0;
                Actor.ActorAttribute.EscortId = 0;
            }
            Actor.SetHeadIcons(Actor.EHeadIcon.PEAK);

            // 远程玩家的护送npc暂时屏蔽掉
            //Player player = Actor as Player;
            //if (player != null)
            //{
            //    if (oldEscortId != Actor.ActorAttribute.EscortId)
            //    {
            //        player.UpdateEscortNPC();
            //    }
            //}

            Actor.MountId = info.ride;
        }