Exemplo n.º 1
0
    /// <summary>
    /// 创建角色
    /// </summary>
    /// <param name="index"></param>
    private void CreateActor(int index)
    {
        string bodyweaponstring = string.Empty;

        if (index >= 0 && index < mRoleData.Count)
        {
            // 获取配置的初始武器和装备信息
            //bodyweaponstring = GameConstHelper.GetString(string.Format("GAME_BORN_ROLE{0}", mRoleData[index].rid));

            string[]    splits    = bodyweaponstring.Split('[', ',', ']');
            List <uint> modelList = new List <uint>();
            if (splits.Length > 3)
            {
                uint bodyId = uint.Parse(splits[1]);
                modelList.Add(bodyId);
                uint weaponId = uint.Parse(splits[2]);
                modelList.Add(weaponId);
            }
            modelList = ActorManager.ReplaceModelList(modelList, (Actor.EVocationType)mRoleData[index].rid, false);

            UnitID actor_uid = null;
            if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetFashion() != 0)
            {
                //List<uint> npc_id = SDKHelper.GetRoleList();
                //actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(npc_id[index]), OnActorLoaded);


                uint        type_idx     = ActorHelper.RoleIdToTypeId(mRoleData[index].rid);
                List <uint> model_list   = new List <uint>();
                List <uint> fashion_list = new List <uint>();
                ActorHelper.GetModelFashionList(mRoleData[index].shows, model_list, fashion_list);
                fashion_list.Add(SDKHelper.GetFashion());
                var         model_id_list = ActorManager.ReplaceModelList(model_list, (Actor.EVocationType)mRoleData[index].rid, true);
                ClientModel actor         = ClientModel.CreateClientModel(type_idx, mRoleData[index].uuid, model_id_list, fashion_list, mRoleData[index].effects, OnActorLoaded);
                mActors.Add(actor);
            }
            else
            {
                actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(mRoleData[index].rid), OnActorLoaded);
            }



            var client_model = ActorManager.Instance.GetActor(actor_uid) as ClientModel;
            if (client_model != null)
            {
                client_model.AttackSpeed = 1.0f;// 攻速必须为1,不然出场特效与动作匹配不上
                mActors.Add(client_model);
            }
        }
    }
Exemplo n.º 2
0
            // 创建对应的角色
            public void CreateActor(int index)
            {
                if (index >= 0 && index < mData.Count)
                {
                    //if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetRoleList() != null)
                    //{
                    //    List<uint> npc_id = SDKHelper.GetRoleList();
                    //    int rid = (int)mData[index].rid - 1;
                    //    UnitID actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(npc_id[rid]), OnResLoaded);
                    //    var client_model = ActorManager.Instance.GetActor(actor_uid) as ClientModel;
                    //    client_model.AttackSpeed = 1.0f;
                    //    mActorGameObjects.Add(client_model);
                    //    return;
                    //}



                    uint type_idx = ActorHelper.RoleIdToTypeId(mData [index].rid);

                    List <uint> model_list   = new List <uint>();
                    List <uint> fashion_list = new List <uint>();
                    ActorHelper.GetModelFashionList(mData[index].shows, model_list, fashion_list);

                    if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel() && SDKHelper.GetFashion() != 0)
                    {
                        fashion_list.Add(SDKHelper.GetFashion());
                    }

                    var         model_id_list = ActorManager.ReplaceModelList(model_list, (Actor.EVocationType)mData [index].rid, true);
                    ClientModel actor         = ClientModel.CreateClientModel(type_idx, mData[index].uuid, model_id_list, fashion_list, mData[index].effects, OnResLoaded, false, true);
                    // 攻速必须为1,不然出场特效与动作匹配不上
                    actor.AttackSpeed = 1.0f;
                    mActorGameObjects.Add(actor);
                    actor.Freeze(DBActor.UF_ANIMATION);
                }
            }