| | |
| | |
|
| | | GameObject clothesModel;
|
| | | GameObject secondaryModel;
|
| | | GameObject extraSecondaryModel;
|
| | | Animator clothesAnimator;
|
| | |
|
| | | Transform showPoint;
|
| | |
| | | var clothes = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retClothes);
|
| | | var _clothesId = clothes == null ? 0 : (int)clothes.itemInfo.ItemID;
|
| | |
|
| | | var weapon = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWeapon);
|
| | | var _weaponId = weapon == null ? 0 : (int)weapon.itemInfo.ItemID;
|
| | |
|
| | | var wings = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWing);
|
| | | var _wingsId = wings == null ? 0 : (int)wings.itemInfo.ItemID;
|
| | |
|
| | | var secondary = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWeapon2);
|
| | | var _secondaryId = secondary == null ? 0 : (int)secondary.itemInfo.ItemID;
|
| | |
|
| | | var fashionClothes = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retFashionClothes);
|
| | | var fashionClothesId = fashionClothes == null ? 0 : (int)fashionClothes.itemInfo.ItemID;
|
| | |
|
| | | var fashionWeapon = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retFashionWeapon);
|
| | | var fashionWeaponId = fashionWeapon == null ? 0 : (int)fashionWeapon.itemInfo.ItemID;
|
| | |
|
| | | var fashionSecondary = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retFashionWeapon2);
|
| | | var fashionSecondaryId = fashionSecondary == null ? 0 : (int)fashionSecondary.itemInfo.ItemID;
|
| | | #endregion
|
| | |
|
| | | showPoint = m_HeroStage;
|
| | | var _hero = ShowHero(_job, fashionClothesId > 0 ? fashionClothesId : _clothesId,
|
| | | fashionWeaponId > 0 ? fashionWeaponId : _weaponId, _wingsId,
|
| | | fashionSecondaryId > 0 ? fashionSecondaryId : _secondaryId);
|
| | | var _hero = ShowHero(_job, _clothesId, _secondaryId, fashionClothesId, fashionSecondaryId);
|
| | | if (_hero != null)
|
| | | {
|
| | | SitDown();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | GameObject ShowHero(int _job, int _clothes, int _weaponId, int _wingsId, int _secondaryId)
|
| | | GameObject ShowHero(int job, int clothesId, int secondaryId, int fashionClothesId, int fashionSecondaryId)
|
| | | {
|
| | | PutOnClothes(_job, _clothes);
|
| | |
|
| | | var jobConfig = Config.Instance.Get<JobSetupConfig>(_job);
|
| | | var secondaryResId = 0;
|
| | | if (_secondaryId == 0)
|
| | | clothesId = fashionClothesId > 0 ? fashionClothesId : clothesId;
|
| | | secondaryId = fashionSecondaryId > 0 ? fashionSecondaryId : secondaryId;
|
| | | var jobConfig = Config.Instance.Get<JobSetupConfig>(job);
|
| | | var clothesResId = 0;
|
| | | if (clothesId == 0)
|
| | | {
|
| | | if (_job == 1)
|
| | | clothesResId = jobConfig.BaseEquip[0];
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(clothesId);
|
| | | clothesResId = item == null ? clothesResId = jobConfig.BaseEquip[0] : item.ChangeOrd;
|
| | | }
|
| | |
|
| | | PutOnClothes(job, clothesResId);
|
| | |
|
| | | var secondaryResId = 0;
|
| | | if (secondaryId == 0)
|
| | | {
|
| | | if (fashionClothesId <= 0)
|
| | | {
|
| | | secondaryResId = _clothes + 2900;
|
| | | }
|
| | | else
|
| | | {
|
| | | secondaryResId = jobConfig.BaseEquip[2];
|
| | | if (job == 1)
|
| | | {
|
| | | secondaryResId = clothesId + 2900;
|
| | | }
|
| | | else
|
| | | {
|
| | | secondaryResId = jobConfig.BaseEquip[2];
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(_secondaryId);
|
| | | var item = Config.Instance.Get<ItemConfig>(secondaryId);
|
| | | secondaryResId = item == null ? jobConfig.BaseEquip[2] : item.ChangeOrd;
|
| | | }
|
| | | PutOnSecondary(_job, secondaryResId);
|
| | | PutOnSecondary(job, secondaryResId);
|
| | |
|
| | | var extraSecondaryId = 0;
|
| | | if (job == 1 && fashionSecondaryId > 0 && fashionClothesId == 0)
|
| | | {
|
| | | if (clothesId == 0)
|
| | | {
|
| | | extraSecondaryId = jobConfig.BaseEquip[0] + 2900;
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(clothesId);
|
| | | var defaultClothesResId = item == null ? jobConfig.BaseEquip[0] : item.ChangeOrd;
|
| | | extraSecondaryId = defaultClothesResId + 2900;
|
| | | }
|
| | | }
|
| | |
|
| | | PutOnExtraSecondary(job, extraSecondaryId);
|
| | |
|
| | | return clothesModel;
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void PutOnClothes(int _job, int itemID)
|
| | | public void PutOnClothes(int _job, int clothesResId)
|
| | | {
|
| | | var newClothes = 0;
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | |
|
| | | if (itemID == 0)
|
| | | {
|
| | | newClothes = config.BaseEquip[0];
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(itemID);
|
| | | newClothes = item == null ? newClothes = config.BaseEquip[0] : item.ChangeOrd;
|
| | | }
|
| | |
|
| | | var _prefab = InstanceResourcesLoader.LoadModelRes(newClothes,true);
|
| | | var _prefab = InstanceResourcesLoader.LoadModelRes(clothesResId, true);
|
| | | if (!_prefab)
|
| | | {
|
| | | newClothes = config.BaseEquip[0];
|
| | | clothesResId = config.BaseEquip[0];
|
| | | }
|
| | |
|
| | | LoadClothes(newClothes, _job);
|
| | | LoadClothes(clothesResId, _job);
|
| | | }
|
| | |
|
| | | private void PutOnSecondary(int _job, int secondaryResId)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void LoadClothes(int resID,int job)
|
| | | private void PutOnExtraSecondary(int job, int extraSecondaryId)
|
| | | {
|
| | | var prefab = InstanceResourcesLoader.LoadModelRes(resID,true);
|
| | | if (job == 2)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (extraSecondaryId != 0)
|
| | | {
|
| | | var prefab = InstanceResourcesLoader.LoadModelRes(extraSecondaryId);
|
| | | if (!prefab)
|
| | | {
|
| | | var config = Config.Instance.Get<JobSetupConfig>(job);
|
| | | extraSecondaryId = config.BaseEquip[2];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(extraSecondaryId);
|
| | | }
|
| | |
|
| | | if (prefab)
|
| | | {
|
| | | if (extraSecondaryModel == null)
|
| | | {
|
| | | extraSecondaryModel = Instantiate(prefab, Constants.Special_Hide_Position, Quaternion.identity);
|
| | | var parent = clothesModel.transform.GetChildTransformDeeply(GAStaticDefine.SecondaryBindBoneName[job - 1]);
|
| | | extraSecondaryModel.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void LoadClothes(int resID, int job)
|
| | | {
|
| | | var prefab = InstanceResourcesLoader.LoadModelRes(resID, true);
|
| | | if (clothesModel == null)
|
| | | {
|
| | | clothesModel = Instantiate(prefab, Constants.Special_Hide_Position, Quaternion.identity);
|
| | |
| | | LayerUtility.SetLayer(clothesModel, LayerUtility.Player, false);
|
| | | var skinnedMeshRenderer = clothesModel.GetComponentInChildren<SkinnedMeshRenderer>(true);
|
| | |
|
| | | var mat = MaterialLoader.LoadClothesMaterial(resID, false, IsSuit(job, resID));
|
| | | var mat = MaterialLoader.LoadClothesMaterial(resID, false, false);
|
| | | if (mat)
|
| | | {
|
| | | skinnedMeshRenderer.material = mat;
|
| | |
| | | clothesAnimator.runtimeAnimatorController = _controller;
|
| | | clothesAnimator.enabled = true;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsSuit(int job, int clothedID)
|
| | | {
|
| | | var _equipModel = ModelCenter.Instance.GetModel<PlayerPackModel>().GetSinglePackModel(PackType.rptEquip);
|
| | | if (_equipModel == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | int _suitCount = 0;
|
| | |
|
| | | int _start = (int)RoleEquipType.retHat;
|
| | | int _end = (int)RoleEquipType.retShoes;
|
| | |
|
| | | ItemModel _itemModel = null;
|
| | |
|
| | | _itemModel = _equipModel.GetItemModelByIndex((int)RoleEquipType.retClothes);
|
| | |
|
| | | if (_itemModel == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | int _rank = _itemModel.chinItemModel.LV;
|
| | |
|
| | | for (int i = _start; i <= _end; ++i)
|
| | | {
|
| | | _itemModel = _equipModel.GetItemModelByIndex(i);
|
| | |
|
| | | if (_itemModel == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (_itemModel.chinItemModel.SuiteiD <= 0)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (i == (int)RoleEquipType.retClothes)
|
| | | {
|
| | | _rank = _itemModel.chinItemModel.LV;
|
| | | }
|
| | |
|
| | | var suitModel = ModelCenter.Instance.GetModel<PlayerSuitModel>();
|
| | | if (suitModel.suitModelDict.ContainsKey(i))
|
| | | {
|
| | | if (suitModel.suitModelDict[i].ContainsKey(1)
|
| | | || suitModel.suitModelDict[i].ContainsKey(2))
|
| | | {
|
| | | if (_itemModel.chinItemModel.LV >= _rank)
|
| | | {
|
| | | _suitCount += 1;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return _suitCount >= 5;
|
| | | }
|
| | | }
|
| | | }
|