| | |
| | | private GameObject instanceGO; |
| | | |
| | | private Action onComplete; |
| | | public void Create(int _skinID, float scale = 1f, Action _onComplete = null, string motionName = "idle", bool isLh = false) |
| | | public void Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false) |
| | | { |
| | | if (skinID == _skinID) |
| | | { |
| | |
| | | { |
| | | skeletonGraphic.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinConfig.SpineRes); |
| | | } |
| | | if (skeletonGraphic.skeletonDataAsset == null) |
| | | { |
| | | |
| | | transform.SetActive(false); |
| | | if (pool != null) |
| | | pool.Release(instanceGO); |
| | | skeletonGraphic = null; |
| | | Destroy(instanceGO); |
| | | Debug.LogError("未配置spine"); |
| | | return; |
| | | } |
| | | skeletonGraphic.Initialize(true); |
| | | this.transform.localScale = Vector3.one * scale; |
| | | if (isLh) |
| | | { |
| | | //X轴偏移,Y轴偏移,缩放,是否水平翻转(0否1是) |
| | | if (skinConfig.TachieParam.Length == 4) |
| | | { |
| | | this.transform.localPosition = new Vector3(skinConfig.TachieParam[0], skinConfig.TachieParam[1], 0); |
| | | this.transform.localScale = Vector3.one * skinConfig.TachieParam[2]; |
| | | this.transform.localRotation = Quaternion.Euler(0, skinConfig.TachieParam[3] == 0 ? 0 : 180, 0); |
| | | } |
| | | else |
| | | { |
| | | this.transform.localPosition = Vector3.zero; |
| | | this.transform.localScale = Vector3.one; |
| | | this.transform.localRotation = Quaternion.identity; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | this.transform.localScale = Vector3.one * scale; |
| | | } |
| | | spineAnimationState = skeletonGraphic.AnimationState; |
| | | spineAnimationState.Data.DefaultMix = 0f; |
| | | if (motionName == "") |