Ejemplo n.º 1
0
 public void UpdateFaceList()
 {
     //clear list
     _faces.Clear();
     //valid target check
     if (target == null)
     {
         return;
     }
     //fill list
     target.AddRectsToList(_faces);
 }
Ejemplo n.º 2
0
    public void UpdateLists()
    {
        //record list guids
        VoxelComponent lib_obj = null;

        if (_libobjlist.index >= 0 && _libobjlist.index < _libobjlist.count)
        {
            lib_obj = _libobjs[_libobjlist.index];
        }
        string guid_guid = "";

        if (_guidlist.index >= 0 && _guidlist.index < _guidlist.count)
        {
            guid_guid = _guids[_guidlist.index];
        }
        //update library lists
        _libobjs.Clear();
        if (target != null)
        {
            if (typeof(T) == typeof(CornerDesign))
            {
                target.AddCornersToList(_libobjs);
            }
            else if (typeof(T) == typeof(LateralDesign))
            {
                target.AddLateralsToList(_libobjs);
            }
            else if (typeof(T) == typeof(LongitudeDesign))
            {
                target.AddLongitudesToList(_libobjs);
            }
            else if (typeof(T) == typeof(RectDesign))
            {
                target.AddRectsToList(_libobjs);
            }
            else if (typeof(T) == typeof(HexagonDesign))
            {
                target.AddHexagonsToList(_libobjs);
            }
        }
        HashSet <string> lib_guids = new HashSet <string>();

        for (int k = 0; k < _libobjs.Count; k++)
        {
            string guid;
            long   local_id;
            if (!AssetDatabase.TryGetGUIDAndLocalFileIdentifier(_libobjs[k].GetInstanceID(), out guid, out local_id))
            {
                continue;
            }
            lib_guids.Add(guid);
        }
        //update guid list
        _guids.Clear();
        _guidstrs.Clear();
        string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).ToString());
        for (int k = 0; k < guids.Length; k++)
        {
            if (lib_guids.Contains(guids[k]))
            {
                continue;
            }
            string name = AssetDatabase.GUIDToAssetPath(guids[k]);
            if (name == null || name.Length <= 0)
            {
                continue;
            }
            name = Path.GetFileNameWithoutExtension(name);
            if (name == null || name.Length <= 0)
            {
                continue;
            }
            _guids.Add(guids[k]);
            _guidstrs.Add(name);
        }
        //set new list indices
        _libobjlist.index = _libobjs.IndexOf(lib_obj);
        _guidlist.index   = _guids.IndexOf(guid_guid);
    }