public void ChangeSelectPosition(SelectView selectView, int position) { if (selectView == selectHair) { characterBodyCpt.SetHair(listSelectHair[position].key); } else if (selectView == selectEye) { characterBodyCpt.SetEye(listSelectEye[position].key); } else if (selectView == selectMouth) { characterBodyCpt.SetMouth(listSelectMouth[position].key); } else if (selectView == selectHat) { characterDressCpt.SetHat(listSelectHat[position]); } else if (selectView == selectClothes) { characterDressCpt.SetClothes(listSelectClothes[position]); } else if (selectView == selectShoes) { characterDressCpt.SetShoes(listSelectShoes[position]); } }
private void OnGUI() { if (GUILayout.Button("Test")) { ItemsInfoBean itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(2100002); characterDressCpt.SetHat(itemsInfo); itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(140065); characterDressCpt.SetMask(itemsInfo); itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(250007); characterDressCpt.SetClothes(itemsInfo); itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(350007); characterDressCpt.SetShoes(itemsInfo); itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(810010); characterDressCpt.SetHand(itemsInfo); } }
/// <summary> /// 设置角色数据 /// </summary> /// <param name="gameItemsManager"></param> /// <param name="characterBean"></param> public virtual void SetCharacterData(CharacterBean characterBean) { if (characterBean == null) { return; } this.characterData = characterBean; //设置身体数据 if (characterBody != null) { characterBody.SetCharacterBody(characterData.body); } //设置服装数据 if (characterDress != null) { //设置面具 ItemsInfoBean maskEquip = null; if (characterBean.equips.maskTFId != 0) { maskEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.maskTFId); } else { maskEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.maskId); } characterDress.SetMask(maskEquip); //设置手持 ItemsInfoBean handEquip = null; if (characterBean.equips.handTFId != 0) { handEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.handTFId); } else { handEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.handId); } characterDress.SetHand(handEquip); //设置头部 ItemsInfoBean hatEquip = null; if (characterBean.equips.hatTFId != 0) { hatEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.hatTFId); } else { hatEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.hatId); } characterDress.SetHat(hatEquip); //设置衣服 ItemsInfoBean clothesEquip = null; if (characterBean.equips.clothesTFId != 0) { clothesEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.clothesTFId); } else { clothesEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.clothesId); } characterDress.SetClothes(clothesEquip); //设置鞋子 ItemsInfoBean shoesEquip = null; if (characterBean.equips.shoesTFId != 0) { shoesEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.shoesTFId); } else { shoesEquip = GameItemsHandler.Instance.manager.GetItemsById(characterBean.equips.shoesId); } characterDress.SetShoes(shoesEquip); } //设置属性数据 //获取属性数据 characterData.GetAttributes( out CharacterAttributesBean totalAttributes, out CharacterAttributesBean selfAttributes, out CharacterAttributesBean equipAttributes); //设置速度 if (characterMoveCpt != null) { float speed = totalAttributes.speed * 0.04f + 1f; //速度修正 if (speed <= 0.1f) { //最低不小于0.1 speed = 0.1f; } characterMoveCpt.SetMoveSpeed(speed); } }