Example #1
0
        /// <summary>
        /// 创建玩家的预览模型(用于创角和选角场景)
        /// </summary>
        /// <returns></returns>
        public static ClientModel CreateClientModel(uint type_id, uint uid, List <uint> modleIdLst, List <uint> fashions, List <uint> suit_effects, Action <Actor> cbResLoad = null, bool updateWithRawActor = true, bool isUIModel = false)
        {
            UnitID unit_id = ActorManager.GetAvailableModelId((byte)EUnitType.UNITTYPE_PLAYER);

            xc.UnitCacheInfo info = new xc.UnitCacheInfo(EUnitType.UNITTYPE_PLAYER, unit_id.obj_idx);
            info.AOIPlayer.model_id_list = modleIdLst;
            info.AOIPlayer.fashions      = fashions;
            info.AOIPlayer.suit_effects  = suit_effects;
            info.AOIPlayer.type_idx      = type_id;
            info.PosBorn   = Vector3.zero;
            info.IsUIModel = isUIModel;

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

            if (client_model == null)
            {
                return(null);
            }
            ShadowBehavior shadow_behavior = client_model.GetBehavior <ShadowBehavior>();

            if (shadow_behavior != null)
            {
                shadow_behavior.HideFakeShadow = true;
            }
            client_model.UpdateWithRawActor = updateWithRawActor;
            client_model.RawUID             = uid;
            return(client_model);
        }
Example #2
0
        /// <summary>
        /// 使用角色表中的ID来创建预览角色(一般用于怪物)
        /// </summary>
        /// <param name="actorId"></param>
        /// <param name="actionAfterLoad"></param>
        /// <returns></returns>
        public static UnitID CreateClientModelByActorIdForLua(uint actorId, Action <Actor> actionAfterLoad, bool is_ui_model = false)
        {
            actorId = CheckResourceActorId(actorId);
            UnitID unit_id = ActorManager.GetAvailableModelId((byte)EUnitType.UNITTYPE_MONSTER);

            xc.UnitCacheInfo info = new xc.UnitCacheInfo(EUnitType.UNITTYPE_MONSTER, unit_id.obj_idx);
            info.AOIMonster.type_idx = actorId;
            info.PosBorn             = Vector3.zero;
            info.IsUIModel           = is_ui_model;
            ClientModel client_model = ActorManager.Instance.CreateActor <ClientModel>(info, Quaternion.identity, null, true, actionAfterLoad);

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

            ShadowBehavior shadow_behavior = client_model.GetBehavior <ShadowBehavior>();

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

            return(client_model.UID);
        }
Example #3
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);
        }
Example #4
0
        /// <summary>
        /// 使用传入的actor的换装数据来创建新的预览角色
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="actionAfterLoad"></param>
        /// <returns></returns>
        public static UnitID CreateClientModelByCloneForLua(Actor actor, Action <Actor> actionAfterLoad, bool updateWithRawActor = true, bool isUIModel = true)
        {
            if (actor == null || actor.mAvatarCtrl == null)
            {
                return(null);
            }
            AvatarProperty ap           = actor.mAvatarCtrl.GetLatestAvatartProperty();
            List <uint>    modelList    = new List <uint>();
            List <uint>    fashionList  = new List <uint>();
            List <uint>    suit_effects = null;

            if (ap != null)
            {
                modelList    = ap.GetEquipModleIds();
                fashionList  = ap.GetFashionModleIds();
                suit_effects = ap.SuitEffectIds != null ? new List <uint>(ap.SuitEffectIds) : null;
            }
            ClientModel client_model = CreateClientModel(actor.TypeIdx, actor.UID.obj_idx, modelList, fashionList, suit_effects, actionAfterLoad, updateWithRawActor, isUIModel);

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

            ShadowBehavior shadow_behavior = client_model.GetBehavior <ShadowBehavior>();

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

            return(client_model.UID);
        }