using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using GameFramework.Event; using UnityEngine.UI; using RootMotion.FinalIK; using System.Linq; namespace MetaClient { public class AniManager : MonoBehaviour { public static AniManager Instance; public Dictionary> aniBPT = new Dictionary>(); public Dictionary> bonedata = new Dictionary>(); public EIKPickOnButtonStyple eIKPickOnButtonStyple = EIKPickOnButtonStyple.None; public CCDIK cCDIK = null; public float dis = 0.5f; public Transform picParent; public List bones = new List(); public List chooseImage = new List(); public List bonePicTarget = new List(); private int nowtime = 0; public string nowAniName = "8"; //private // Start is called before the first frame update //public Dictionary void Start() { bones.ForEach(i => { Vector3 worldPos = i.position; Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos); GameObject imgObj = new GameObject(); GameObject target = new GameObject(); target.transform.position = i.position; var image = imgObj.AddComponent(); image.color = Color.red; //if (aniBPT.ContainsKey(i.name)||i.name=="8") //{ // i.name = "All"; //} //else //{ imgObj.name = i.name; //} imgObj.transform.position = screenPos; imgObj.transform.SetParent(picParent); imgObj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); BonePicTarget _bonePicTarget = new BonePicTarget(i, imgObj.transform, target.transform); bonePicTarget.Add(_bonePicTarget); AniPickOnImage pickOnImage = imgObj.AddComponent(); pickOnImage.bonePicTarget = _bonePicTarget; pickOnImage.bonePicture = this; //BoneRotateByTime boneRotateByTime = i.gameObject.AddComponent(); // boneRotateByTimes.Add(boneRotateByTime); }); } private void Awake() { Instance = this; } public void Init() { GameEntry.Event.Subscribe(AniEventArgs.EventId, UpdateAni); } public void SaveMove(string boneName) { } private void UpdateAni(object sender, GameEventArgs e) { AniEventArgs crf = (AniEventArgs)e; if (crf != null) { switch (crf.Type) { case EAniEventArgsType.None: break; case EAniEventArgsType.RotateX: break; case EAniEventArgsType.RotateY: break; case EAniEventArgsType.Move: break; case EAniEventArgsType.PlayKTime: break; case EAniEventArgsType.MoveKTime: break; case EAniEventArgsType.CopyKTime: break; case EAniEventArgsType.DelectKTime: break; } } } public void SavePart(EAniBodyPart eAniBodyPart,int time) { switch (eAniBodyPart) { case EAniBodyPart.None: break; case EAniBodyPart.Head: break; case EAniBodyPart.Node: break; case EAniBodyPart.Xiong: break; case EAniBodyPart.Yao: break; case EAniBodyPart.FuBu: break; case EAniBodyPart.LefftHand: break; case EAniBodyPart.RightHand: break; case EAniBodyPart.LeftArm: break; case EAniBodyPart.RightArm: break; case EAniBodyPart.LeftLeg: break; case EAniBodyPart.RightLeg: break; case EAniBodyPart.All: break; } } public void Clear() { GameEntry.Event.Unsubscribe(AniEventArgs.EventId, UpdateAni); } // Update is called once per frame void Update() { } } public class BonePicTarget { public Transform bone; public Transform pic; public Transform target; public BonePicTarget(Transform _bone, Transform _pic, Transform _target) { bone = _bone; pic = _pic; target = _target; } } public enum EIKPickOnButtonStyple { None, Choose, Rotate, Move } public enum EAniBodyPart { None, Head, Node, Xiong, Yao, FuBu, LeftArm, RightArm, LefftHand, RightHand, LeftLeg, RightLeg, All, } public class BoneData { public string Name; public Dictionary Ro; public Dictionary Pos; } }