public static void ResetAllCollider()
    {
        GameColliderSet colliderSet = new GameColliderSet();
        var             guids       = AssetDatabase.FindAssets("t:GameObject", new string[] { "Assets/ResourceEx/Prefab" });
        int             count       = guids.Length;

        for (int i = 0; i < count; i++)
        {
            EditorUtility.DisplayProgressBar("更新碰撞框数据", "正在更新碰撞框数据(" + i + "/" + count + ")", i / (float)count);
            string           goPath       = AssetDatabase.GUIDToAssetPath(guids[i]);
            GameObject       gameObject   = AssetDatabase.LoadAssetAtPath <GameObject>(goPath);
            GameColliderView colliderView = gameObject.GetComponent <GameColliderView>();
            if (colliderView != null)
            {
                GameColliderItem colliderItem = new GameColliderItem();
                colliderItem.path = goPath;
                FindCollider(gameObject.transform, gameObject.transform, colliderItem);
                colliderSet.mLstColliderItem.Add(colliderItem);
            }
        }
        NEUtil.SerializerObject(GameColliderCfgSys.GameColliderPath, colliderSet, GameColliderCfgSys.RelateTypes);
        EditorUtility.ClearProgressBar();
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
Beispiel #2
0
    public static void ResetAllHangPoint()
    {
        HangPointSet hangPointSet = new HangPointSet();
        var          guids        = AssetDatabase.FindAssets("t:GameObject", new string[] { "Assets/ResourceEx/Prefab" });
        int          count        = guids.Length;

        for (int i = 0; i < count; i++)
        {
            EditorUtility.DisplayProgressBar("更新挂点数据", "正在更新挂点数据(" + i + "/" + count + ")", i / (float)count);
            string        goPath        = AssetDatabase.GUIDToAssetPath(guids[i]);
            GameObject    gameObject    = AssetDatabase.LoadAssetAtPath <GameObject>(goPath);
            HangPointView hangPointView = gameObject.GetComponent <HangPointView>();
            if (hangPointView != null)
            {
                HangPointItem hangPointItem = new HangPointItem();
                hangPointItem.path = goPath;
                FindHangPoint(gameObject.transform, gameObject.transform, null, null, hangPointItem);
                hangPointSet.mLstHangPointItem.Add(hangPointItem);
            }
        }
        NEUtil.SerializerObject(HangPointCfgSys.HangPointPath, hangPointSet);
        EditorUtility.ClearProgressBar();
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
 private void SaveData()
 {
     if (m_cColliderSet == null)
     {
         return;
     }
     NEUtil.SerializerObject(GameColliderCfgSys.GameColliderPath, m_cColliderSet, GameColliderCfgSys.RelateTypes);
 }
Beispiel #4
0
 private void SaveData()
 {
     if (m_cHangPointSet == null)
     {
         return;
     }
     NEUtil.SerializerObject(HangPointCfgSys.HangPointPath, m_cHangPointSet);
 }
Beispiel #5
0
 public static void Init()
 {
     if (m_bInit)
     {
         return;
     }
     m_bInit = true;
     NEUtil.LoadTreeComposeTypes(RemoteComposeType, out m_lstRemoteNodeType, out m_lstRemoteNodeDataType);
     m_arrRemoteNodeDataType = m_lstRemoteNodeDataType.ToArray();
 }
        private void OnLoadSucc(Resource res)
        {
            var callback = m_cCallback;

            m_cCallback = null;
            if (res.isSucc)
            {
                byte[] bytes = res.GetBytes();
                m_cGameColliderSet = NEUtil.DeSerializerObjectFromBuff(bytes, typeof(GameColliderSet), RelateTypes) as GameColliderSet;
            }
            if (callback != null)
            {
                callback();
            }
        }
        private void OnLoadSucc(Resource res)
        {
            var callback = m_cCallback;

            m_cCallback = null;
            if (res.isSucc)
            {
                byte[] bytes = res.GetBytes();
                m_cHangPointSet = NEUtil.DeSerializerObjectFromBuff(bytes, typeof(HangPointSet)) as HangPointSet;
            }
            if (callback != null)
            {
                callback();
            }
        }
    private void LoadData()
    {
        TextAsset textAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(GameColliderCfgSys.GameColliderPath);

        m_cColliderSet = null;
        if (textAsset != null)
        {
            var bytes = textAsset.bytes;
            m_cColliderSet = NEUtil.DeSerializerObjectFromBuff(bytes, typeof(GameColliderSet), GameColliderCfgSys.RelateTypes) as GameColliderSet;
        }
        if (m_cColliderSet == null)
        {
            m_cColliderSet = new GameColliderSet();
        }

        GameColliderView colliderView = (GameColliderView)target;
        PrefabType       prefabType   = PrefabUtility.GetPrefabType(colliderView.gameObject);

        Debug.Log(prefabType);
        m_bIsPrefab = (prefabType == PrefabType.Prefab || prefabType == PrefabType.PrefabInstance);
        if (m_bIsPrefab)
        {
            UnityEngine.Object prefab = null;
            if (prefabType == PrefabType.PrefabInstance)
            {
                prefab = PrefabUtility.GetPrefabParent(colliderView.gameObject);
            }
            else
            {
                prefab = colliderView.gameObject;
            }
            Debug.Log(prefab);
            if (m_cColliderSet != null && prefab != null)
            {
                string path = AssetDatabase.GetAssetPath(prefab);
                Debug.Log("path:" + path);
                m_cColliderItem = m_cColliderSet.GetColliderItem(path);
                if (m_cColliderItem == null)
                {
                    m_cColliderItem      = new GameColliderItem();
                    m_cColliderItem.path = path;
                    m_cColliderSet.mLstColliderItem.Add(m_cColliderItem);
                }
            }
        }
    }
Beispiel #9
0
    private void LoadData()
    {
        TextAsset textAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(HangPointCfgSys.HangPointPath);

        m_cHangPointSet = null;
        if (textAsset != null)
        {
            var bytes = textAsset.bytes;
            m_cHangPointSet = NEUtil.DeSerializerObjectFromBuff(bytes, typeof(HangPointSet)) as HangPointSet;
        }
        if (m_cHangPointSet == null)
        {
            m_cHangPointSet = new HangPointSet();
        }

        HangPointView hangPoint  = (HangPointView)target;
        PrefabType    prefabType = PrefabUtility.GetPrefabType(hangPoint.gameObject);

        Debug.Log(prefabType);
        m_bIsPrefab = (prefabType == PrefabType.Prefab || prefabType == PrefabType.PrefabInstance);
        if (m_bIsPrefab)
        {
            UnityEngine.Object prefab = null;
            if (prefabType == PrefabType.PrefabInstance)
            {
                prefab = PrefabUtility.GetPrefabParent(hangPoint.gameObject);
            }
            else
            {
                prefab = hangPoint.gameObject;
            }
            Debug.Log(prefab);
            if (m_cHangPointSet != null && prefab != null)
            {
                string path = AssetDatabase.GetAssetPath(prefab);
                Debug.Log("path:" + path);
                m_cHangPointItem = m_cHangPointSet.GetHangPointItem(path);
                if (m_cHangPointItem == null)
                {
                    m_cHangPointItem      = new HangPointItem();
                    m_cHangPointItem.path = path;
                    m_cHangPointSet.mLstHangPointItem.Add(m_cHangPointItem);
                }
            }
        }
    }