//用于uiPresent; public void PlayNimAnimation(int index, int desMissionId) { MeshRenderer objCurrModel = ShowMissionHelper.Instance.objCurrModel; if (objCurrModel != null) { Spine.Unity.SkeletonAnimation skeletonAnimation = objCurrModel.GetComponent <Spine.Unity.SkeletonAnimation>(); if (index == 1) { objCurrModel.gameObject.SetActive(true); // skeletonAnimation.state.ClearTracks(); can`t use skeletonAnimation.state.SetAnimation(0, "animation02", true); } else if (index == 0) { objCurrModel.gameObject.SetActive(true); skeletonAnimation.state.ClearTracks(); skeletonAnimation.state.SetAnimation(0, "animation01", true); } else { objCurrModel.gameObject.SetActive(false); } } }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *__ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = new Spine.Unity.SkeletonAnimation(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *get_AnimationName_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Spine.Unity.SkeletonAnimation instance_of_this_method = (Spine.Unity.SkeletonAnimation) typeof(Spine.Unity.SkeletonAnimation).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.AnimationName; return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *ClearState_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Spine.Unity.SkeletonAnimation instance_of_this_method = (Spine.Unity.SkeletonAnimation) typeof(Spine.Unity.SkeletonAnimation).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.ClearState(); return(__ret); }
void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); skeletonAnimation = GetComponent <Spine.Unity.SkeletonAnimation>(); // meshRenderer = GetComponent<MeshRenderer>(); if (skeletonAnimation && skeletonAnimation.skeleton != null && skeletonAnimation.skeleton.A != toAlpha) { skeletonAnimation.skeleton.A = toAlpha; //ChangeAlpha(0, 1, 2); } //if (meshRenderer != null) //{ // meshRenderer.material.DOFade(1, 1); //} }
static StackObject *Update_7(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @deltaTime = *(float *)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Spine.Unity.SkeletonAnimation instance_of_this_method = (Spine.Unity.SkeletonAnimation) typeof(Spine.Unity.SkeletonAnimation).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Update(@deltaTime); return(__ret); }
static StackObject *Initialize_6(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @overwrite = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Spine.Unity.SkeletonAnimation instance_of_this_method = (Spine.Unity.SkeletonAnimation) typeof(Spine.Unity.SkeletonAnimation).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Initialize(@overwrite); return(__ret); }
public async void NewAnimation(GameObject Rander, SkillData skillData) { GameObject Animation = Rander.GetChild("Animation", true); Spine.Unity.SkeletonAnimation skeletonAnimation = Animation.AddComponent <Spine.Unity.SkeletonAnimation>(); skeletonAnimation.skeletonDataAsset = await AssetManager.LoadAssetAsync <Spine.Unity.SkeletonDataAsset>(skillData.SkeletonDataAssetPath); var skeletonAnimationRenderer = skeletonAnimation.GetComponent <Renderer>(); skeletonAnimationRenderer.enabled = false; DelayFunc(() => { skeletonAnimationRenderer.enabled = true; }, 0.00001f); skeletonAnimation.initialSkinName = skillData.SkinName; skeletonAnimation.Initialize(true); Spine.TrackEntry TrackEntry = skeletonAnimation.state.SetAnimation(0, skillData.AnimationName, true); Animation.AddComponent <SortRenderer>(); }
private void PlayNimAnimation(MeshRenderer objModel, int desMissionId) { if (objModel) { Spine.Unity.SkeletonAnimation skeletonAnimation = objModel.GetComponent <Spine.Unity.SkeletonAnimation>(); #if ALLMISSIONOPEN int voicePercent = 15; #if (UNITY_ANDROID) && (!UNITY_EDITOR) voicePercent = AudioControl.getVolume(); #endif if (voicePercent < 7) { objModel.gameObject.SetActive(true); skeletonAnimation.state.SetAnimation(0, "animation01", true); } else { objModel.gameObject.SetActive(true); skeletonAnimation.state.SetAnimation(0, "animation02", true); } #else if (missionDataManager.IsTreasureOpen(desMissionId, 1)) { objModel.gameObject.SetActive(true); skeletonAnimation.state.ClearTracks(); skeletonAnimation.state.SetAnimation(0, "animation02", true); } else if (missionDataManager.IsTreasureOpen(desMissionId, 0)) { objModel.gameObject.SetActive(true); skeletonAnimation.state.ClearTracks(); skeletonAnimation.state.SetAnimation(0, "animation01", true); } else { objModel.gameObject.SetActive(false); } #endif } }
static int _m_LoadResourcesPrefab_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { object _atlas = translator.GetObject(L, 1, typeof(object)); object _png = translator.GetObject(L, 2, typeof(object)); object _json = translator.GetObject(L, 3, typeof(object)); string _shaderName = LuaAPI.lua_tostring(L, 4); Spine.Unity.SkeletonAnimation gen_ret = Casinos.SpineHelper.LoadResourcesPrefab(_atlas, _png, _json, _shaderName); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public static void LoadSpinAnimSkeleton(Spine.Unity.SkeletonAnimation anim, Qarth.ResLoader loader, string asset) { Spine.Unity.SkeletonDataAsset data = loader.LoadSync(asset) as Spine.Unity.SkeletonDataAsset; anim.skeletonDataAsset = data; anim.Initialize(true); }
/// <summary> /// 重建ClippingAttachment /// </summary> /// <returns>The clipping attachment by name.</returns> /// <param name="allAttachmentName">All attachment name.</param> public abstract Attachment CreateClippingAttachmentByName(Spine.Unity.SkeletonAnimation skeletonAnim, string allAttachmentName);
/// <summary> /// 通过Texture重建MeshAttachment /// </summary> /// <returns>The mesh attachment by texture.</returns> /// <param name="slotName">Slot name.</param> /// <param name="texture">Texture.</param> public abstract Attachment CreateMeshAttachmentByTexture(Spine.Unity.SkeletonAnimation sAnim, string slotName, Texture2D texture);
/// <summary> /// 通过AtlasRegion重建MeshAttachment /// </summary> /// <returns>The mesh attachment by atlas region.</returns> /// <param name="allAttachmentName">Attachment name.</param> /// <param name="atlasRegion">Atlas region.</param> public abstract Attachment CreateMeshAttachmentByAtlasRegion(Spine.Unity.SkeletonAnimation skeletonAnim, string allAttachmentName, AtlasRegion atlasRegion);
public System.Collections.IEnumerator CreateNewRoleJsonDic(RoleAnaimationData animationData, UnityEngine.TextAsset equipmentJson, List <string> slotAttachmentNameList, Spine.Unity.SkeletonAnimation skeletonAnim, Action <bool> setRoleStatus, bool isCreateNewJson = false) { if (isCreateNewJson) { #region 注释掉了 // //重新绑定引用(更换attachment之后顶点动画引用丢失的情况) // //1.把当前装备所替换的attachment保存起来,再分别找到各个attachment在当前装备json中的顶点动画数据。 // //2.把各个attachment的顶点动画数据复制到roleJson中。 // //3.利用新的roleJson生成新的动画并和新的attachment进行绑定。(可以用litjson插件替换json里面的数据) // Dictionary<string, JsonData> dic = new Dictionary<string, JsonData> (); // JsonData allDataFromEquipment = JsonMapper.ToObject (equipmentJson.text); // JsonData animDataFromEquipment = allDataFromEquipment.TryGetData ("animations"); // string[] animNamesFromEquipment = new string[animDataFromEquipment.Count]; // animDataFromEquipment.Keys.CopyTo (animNamesFromEquipment, 0); // //1.先从当前装备的json中拿出来 // for (int i = 0; i < slotAttachmentNameList.Count; i++) { // for (int j = 0; j < animDataFromEquipment.Count; j++) { // JsonData deformData = animDataFromEquipment[j].TryGetData ("deform"); // if (null != deformData) { // JsonData slotData = deformData.TryGetData (SpineConstValue.defaultSkinName).TryGetData (slotAttachmentNameList[i].Split ('$') [0]); // if (null != slotData) { // JsonData attachmentData = slotData.TryGetData (slotAttachmentNameList[i].Split ('$') [1]); // dic.Add (animNamesFromEquipment[j] + "$deform$" + SpineConstValue.defaultSkinName + "$" + slotAttachmentNameList[i].Split ('$') [0] + "$" + slotAttachmentNameList[i].Split ('$') [1], attachmentData); // } // } // yield return null; // } // } // //2.重新组装到roleJson中 // JsonData allDataFromRoleJson = JsonMapper.ToObject (animationData.roleJsonStr); // foreach (KeyValuePair<string, JsonData> keyValue in dic) { // JsonData animsData = allDataFromRoleJson.TryGetData ("animations"); // string[] keys = keyValue.Key.Split ('$'); // int length = keys.Length; // if (null != animsData) { // for (int i = 0; i < length; i++) { // animsData = animsData.TryGetData (keys[i]); // if (null != animsData) { // if (i >= length - 1) { // string newJsonStr = keyValue.Value.ToJson ().Substring (1, keyValue.Value.ToJson ().Length - 2); // animsData.Add (JsonMapper.ToObject (newJsonStr)); // yield return null; // } // continue; // } else { // break; // } // } // } // } // //3.刷新json // animationData.roleJsonStr = allDataFromRoleJson.ToJson ().ToString (); #endregion skeletonAnim.skeleton.data.animations.Clear(true); this.animationData = animationData; this.equipmentJson = equipmentJson.text; this.slotAttachmentNameList = slotAttachmentNameList; this.skeletonAnim = skeletonAnim; this.setRoleStatus = setRoleStatus; thread = new System.Threading.Thread(new System.Threading.ThreadStart(CopyJsonData)); thread.IsBackground = false; thread.Start(); while (!isFinshedThread) { yield return(null); } var input = new StringReader(this.animationData.roleJsonStr); Dictionary <String, System.Object> tempDic = GetDictionaryTypeObject((Json.Deserialize(input) as Dictionary <String, Object>) ["animations"]); if (null != tempDic) { foreach (KeyValuePair <string, System.Object> entry in tempDic) { try { SpineCreateAttachment.Instance.ReadAnimation((Dictionary <string, System.Object>)entry.Value, entry.Key, skeletonAnim.Skeleton.Data); } catch (Exception e) { throw new Exception("Error reading animation: " + entry.Key, e); } } skeletonAnim.AnimationState.SetAnimation(SpineConstValue.TrackIndex, skeletonAnim.AnimationState.GetCurrent(SpineConstValue.TrackIndex).animation.name, true); } } }