12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using GameFramework.Event;
- using UnityEngine;
- using HumanoidEditor;
- namespace MetaClient
- {
- public class CustomManager : MonoBehaviour
- {
- public static CustomManager Instance;
- public RoleCustomData bodyData;
- public const float valueFloating = 1f;
- public CustomRoleController testPlayer = null;
- private void Awake()
- {
- Instance = this;
- }
- public void Init()
- {
- GameEntry.Event.Subscribe(CustomRoleBodyEventArgs.EventId, UpdateBody);
- bodyData = new RoleCustomData();
- for (int i = 0; i < 6; i++)
- {
- bodyData.bodyList.Add(i, new PartData((EditableBodyPart)i, ModifyType.LengthWidthThick));
- }
- //CustomRoleUtility.ShowFile();
- testPlayer = GameObject.Find("biaozhunnv").GetComponent<CustomRoleController>();
- }
- public void Clear()
- {
- GameEntry.Event.Unsubscribe(CustomRoleBodyEventArgs.EventId, UpdateBody);
- }
- private void UpdateBody(object sender, GameEventArgs e)
- {
- CustomRoleBodyEventArgs crf = (CustomRoleBodyEventArgs)e;
- if (crf != null)
- {
- bodyData.bodyList[(int)crf.Part].floatValue = 1 + (crf.ChangeValue.x - 0.5f) * valueFloating;
- if (testPlayer != null)
- {
- testPlayer.UpdateBoneScale(crf.Part, bodyData.bodyList[(int)crf.Part].floatValue);
- }
- }
- }
- public float GetBodyBoneValue(EditableBodyPart part)
- {
- return 0.5f + (bodyData.bodyList[(int)part].floatValue - 1) / valueFloating;
- }
- }
- }
|