예제 #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>
        /// 创建玩家的预览模型(用于创角和选角场景)
        /// </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);
        }
예제 #3
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);
        }
예제 #4
0
        /// <summary>
        /// 创建角色
        /// </summary>
        /// <param name="actorId"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <returns></returns>

        //private uint PeiID = 8000;

        /// <summary>
        /// 创建怪物
        /// </summary>
        /// <param name="actorId"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <returns></returns>
        public UnitID CreatePet(uint pet_id, uint actorId, Vector3 pos, Quaternion rot, Actor parent)
        {
            if (parent == null)
            {
                return(null);
            }

            //++PeiID;
            UnitID unit_id         = ActorManager.GetAvailableModelId((byte)EUnitType.UNITTYPE_PET);
            var    unit_cache_info = ActorHelper.CreatePetUnitCacheInfo(unit_id.obj_idx, pet_id, actorId, pos, rot, parent);

            ActorManager.Instance.PushUnitCacheData(unit_cache_info);
            return(unit_cache_info.UnitID);
        }
예제 #5
0
        public void Awake()
        {
            Instance          = this;
            mGame             = xc.Game.GetInstance();
            mActorSet         = new Dictionary <UnitID, Actor>();
            m_ClientModelSet  = new Dictionary <UnitID, ClientModel>();
            m_WorshipModelSet = new Dictionary <UnitID, WorshipModel>();
            mMonsterSet       = new Dictionary <UnitID, Actor>();
            m_PetSet          = new Dictionary <UnitID, Actor>();
            mSummonMonsterSet = new Dictionary <UnitID, Actor>();
            mCalledMonsterSet = new Dictionary <UnitID, Actor>();
            mPlayerSet        = new Dictionary <UnitID, Actor>();
            mRemoveWaitList   = new List <Actor>();

            mDestroyActorCoroutines.Clear();
        }