| | |
| | | [SerializeField, Header("特效位置")] Vector3 m_EffectPosition = Vector3.zero;
|
| | |
|
| | | GameObject clothesModel;
|
| | | GameObject secondaryModel;
|
| | | Animator clothesAnimator;
|
| | |
|
| | | Transform showPoint;
|
| | |
| | |
|
| | | var secondary = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWeapon2);
|
| | | var _secondaryId = secondary == null ? 0 : (int)secondary.itemInfo.ItemID;
|
| | |
|
| | | int _suitLevel = 0;
|
| | |
|
| | | if (clothes != null)
|
| | | {
|
| | | if (clothes.itemInfo.IsSuite == 1)
|
| | | {
|
| | | if (clothes.GetUseDataModel(30) != null && clothes.GetUseDataModel(30)[0] != 0)
|
| | | {
|
| | | _suitLevel = clothes.GetUseDataModel(30)[0];
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | showPoint = m_HeroStage;
|
| | | var _hero = ShowHero(_job, _clothesId, _suitLevel, _weaponId, _wingsId, _secondaryId);
|
| | | var _hero = ShowHero(_job, _clothesId, _weaponId, _wingsId, _secondaryId);
|
| | | if (_hero != null)
|
| | | {
|
| | | SitDown();
|
| | |
| | | clothesModel = null;
|
| | | clothesAnimator = null;
|
| | | }
|
| | | if (secondaryModel != null)
|
| | | {
|
| | | Destroy(secondaryModel);
|
| | | secondaryModel = null;
|
| | | }
|
| | | }
|
| | |
|
| | | GameObject ShowHero(int _job, int _clothes, int suitID, int _weaponId, int _wingsId, int _secondaryId)
|
| | | GameObject ShowHero(int _job, int _clothes, int _weaponId, int _wingsId, int _secondaryId)
|
| | | {
|
| | | PutOnClothes(_job, _clothes, suitID);
|
| | | PutOnClothes(_job, _clothes);
|
| | |
|
| | | var jobConfig = Config.Instance.Get<JobSetupConfig>(_job);
|
| | | var secondaryResId = 0;
|
| | | if (_secondaryId == 0)
|
| | | {
|
| | | if (_job == 1)
|
| | | {
|
| | | secondaryResId = _clothes + 2900;
|
| | | }
|
| | | else
|
| | | {
|
| | | secondaryResId = jobConfig.BaseEquip[2];
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var item = Config.Instance.Get<ItemConfig>(_secondaryId);
|
| | | secondaryResId = item == null ? jobConfig.BaseEquip[2] : item.ChangeOrd;
|
| | | }
|
| | | PutOnSecondary(_job, secondaryResId);
|
| | |
|
| | | return clothesModel;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void PutOnClothes(int _job, int itemID, int suitID)
|
| | | public void PutOnClothes(int _job, int itemID)
|
| | | {
|
| | | var newClothes = 0;
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | |
| | | newClothes = config.BaseEquip[0];
|
| | | }
|
| | |
|
| | | LoadClothes(newClothes);
|
| | |
|
| | | LoadClothesEffect(_job, itemID, suitID);
|
| | | LoadClothes(newClothes, _job);
|
| | | }
|
| | |
|
| | | private void LoadClothes(int resID)
|
| | | private void PutOnSecondary(int _job, int secondaryResId)
|
| | | {
|
| | | if (_job == 2)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (secondaryResId != 0)
|
| | | {
|
| | | var prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId);
|
| | | if (!prefab)
|
| | | {
|
| | | var config = Config.Instance.Get<JobSetupConfig>(_job);
|
| | | secondaryResId = config.BaseEquip[2];
|
| | | prefab = InstanceResourcesLoader.LoadModelRes(secondaryResId);
|
| | | }
|
| | |
|
| | | if (prefab)
|
| | | {
|
| | | if (secondaryModel == null)
|
| | | {
|
| | | secondaryModel = Instantiate(prefab, Constants.Special_Hide_Position, Quaternion.identity);
|
| | | var parent = clothesModel.transform.GetChildTransformDeeply(GAStaticDefine.SecondaryBindBoneName[_job - 1]);
|
| | | secondaryModel.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)
|
| | |
| | |
|
| | | LayerUtility.SetLayer(clothesModel, LayerUtility.Player, false);
|
| | | var skinnedMeshRenderer = clothesModel.GetComponentInChildren<SkinnedMeshRenderer>(true);
|
| | |
|
| | | var mat = MaterialLoader.LoadClothesMaterial(resID, false, IsSuit(job, resID));
|
| | | skinnedMeshRenderer.material = mat;
|
| | |
|
| | | LayerUtility.SetLayer(skinnedMeshRenderer.gameObject, LayerUtility.Player, false);
|
| | | clothesModel.SetActive(true);
|
| | | clothesModel.transform.SetParentEx(showPoint, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void LoadClothesEffect(int job, int clothedID, int suitLevel)
|
| | | public bool IsSuit(int job, int clothedID)
|
| | | {
|
| | | var _equipModel = ModelCenter.Instance.GetModel<PlayerPackModel>().GetSinglePackModel(PackType.rptEquip);
|
| | | if (_equipModel == null)
|
| | | {
|
| | | return;
|
| | | return false;
|
| | | }
|
| | |
|
| | | int _suitCount = 0;
|
| | |
| | |
|
| | | if (_itemModel == null)
|
| | | {
|
| | | return;
|
| | | return false;
|
| | | }
|
| | |
|
| | | int _rank = _itemModel.chinItemModel.LV;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | PutOnEffect(clothedID, _suitCount >= 5);
|
| | | }
|
| | |
|
| | | public void PutOnEffect(int clothedID, bool isSuit)
|
| | | {
|
| | | if (clothesModel == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var smRenderer = clothesModel.GetComponentInChildren<SkinnedMeshRenderer>();
|
| | | if (smRenderer == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var newMat = MaterialLoader.LoadClothesMaterial(clothedID, true, isSuit);
|
| | | if (newMat != null)
|
| | | {
|
| | | smRenderer.material = newMat;
|
| | | }
|
| | | return _suitCount >= 5;
|
| | | }
|
| | | }
|
| | | }
|