/// <summary>
 /// 角色换装
 /// </summary>
 /// <param name="slotStr">Slot string.</param>
 /// <param name="texture2D">Texture2 d.</param>
 /// <param name="successfulCallBack">Successful call back.</param>
 /// <param name="failCallBack">Fail call back.</param>
 public void SpineRoleChange(RoleAnaimationData animationData, SkeletonAnimation skeletonAnim, CombineTextureData combineTextureData, Dictionary <int, List <string> > slotAttachmentDic, RoleEquipmentData equipmentData, RoleEquipmentItem equipmentItem, bool isTexturePackaged, List <Texture2D> destoryTextureList, Action <bool> setRoleStatus, Action <string> failCallBack = null)
 {
     if (null != setRoleStatus)
     {
         setRoleStatus.Invoke(false);
     }
     System.DateTime time1 = System.DateTime.Now;
     SpineChangeDataLogic.Instance.GetRoleEquipmentObject(equipmentItem, (UnityEngine.Object o) => {
         //SpineChangeDataLogic.Instance.SaveRoleEquipmentToServerAndLocal (equipmentData, equipmentItem);
         if (null != combineTextureData.changeRoleCoroutine)
         {
             GameManager.Instance.StopCoroutine(combineTextureData.changeRoleCoroutine);
         }
         combineTextureData.changeRoleCoroutine = GameManager.Instance.StartCoroutine(spineChangeCoreLogic.Change(animationData, skeletonAnim, combineTextureData, slotAttachmentDic, o as EquipmentObject, isTexturePackaged, destoryTextureList, setRoleStatus, failCallBack));
         System.DateTime time2 = System.DateTime.Now;
         if (null != GameObject.FindObjectOfType <ChangeTest> ())
         {
             GameObject.FindObjectOfType <ChangeTest> ().text.text += "加载AB用时:" + (time2 - time1).TotalMilliseconds + "\n";
         }
     });
 }
 /// <summary>
 /// 创建角色
 /// </summary>
 /// <param name="skeletonJson">Skeleton json.</param>
 /// <param name="atlasText">Atlas text.</param>
 /// <param name="textures">Textures.</param>
 /// <param name="material">Material.</param>
 /// <param name="initialize">If set to <c>true</c> initialize.</param>
 /// <param name="skinName">Skin name.</param>
 /// <param name="animationName">Animation name.</param>
 /// <param name="loop">If set to <c>true</c> loop.</param>
 /// <param name="pos">Position.</param>
 /// <param name="successfulCallBack">Successful call back.</param>
 /// <param name="failCallBack">Fail call back.</param>
 public void SpineCreateRole(SpineAvatarType avatarType, RoleEquipmentItem equipmentItem, Material material, bool initialize, string name, string skinName, string animationName, bool loop, RoleEquipmentData data, Action <Avatar> createSucCallBack, Action <string> failCallBack, Action <bool> createQueueCallBack, bool isTP)
 {
     SpineChangeDataLogic.Instance.GetRoleEquipmentObject(equipmentItem, (UnityEngine.Object o) => {
         spineChangeCoreLogic.Create(avatarType, o as EquipmentObject, material, initialize, name, skinName, animationName, loop, data, createSucCallBack, failCallBack, createQueueCallBack, isTP);
     });
 }
Exemplo n.º 3
0
 /// <summary>
 /// 保存角色的服装数据到服务器和本地
 /// </summary>
 /// <returns><c>true</c>, if role equipment to server and local was saved, <c>false</c> otherwise.</returns>
 /// <param name="equipmentData">Equipment data.</param>
 public bool SaveRoleEquipmentToServerAndLocal(RoleEquipmentData equipmentData, RoleEquipmentItem item)
 {
     //item更新到equipmentData里面。
     for (int i = 0; i < equipmentData.RoleEquipmentItems.Count; i++)
     {
         if (item.EquipmentType.Equals(equipmentData.RoleEquipmentItems[i].EquipmentType))
         {
             equipmentData.RoleEquipmentItems[i] = item;
             break;
         }
     }
     //新的equipmentData持久化存储。
     //TODO
     return(true);
 }
 //通过RoleEquipmentItem创建装备ID
 public static string CreateIdByRoleEquipmentItem(RoleEquipmentItem item)
 {
     return(string.Concat(((int)item.EquipmentType / 10).ToString(), item.EquipmentId.ToString()));
 }
Exemplo n.º 5
0
        //根据装备类型和装备名称ID 组装的数据类 获取装备资源
        public EquipmentRes GetRoleEquipmentObject(RoleEquipmentItem equipmentItem, Action <UnityEngine.Object> action)
        {
            string resName = equipmentItem.EquipmentType + "_" + equipmentItem.EquipmentId;

            return(ResourcesManager.Instance.LoadResAsyn <EquipmentRes> (resName, ResLoadType.AssetBundleLoad, action) as EquipmentRes);
        }