Example #1
0
 private void OnEnable()
 {
     foreach (var meta in MapMetaManager.LoadAll())
     {
         var cell = Instantiate(MapCellPrefab);
         cell.transform.SetParent(transform);
         var controller = cell.GetComponent <MapCellController>();
         controller.SetData(meta);
         controller.PointerDown += OnCellChange;
         controller.Delete      += () =>
         {
             if (cells.Remove(controller))
             {
                 MapMetaManager.Delete(controller.MapMeta);
                 Destroy(controller.gameObject);
                 OnCellChange();
                 easyar.GUIPopup.EnqueueMessage(
                     "DELETED: {(Sample) Meta Data}" + Environment.NewLine +
                     "NOT DELETED: {Map Cache, Map on Server}" + Environment.NewLine +
                     "Use recycle bin button to delete map cache" + Environment.NewLine +
                     "Use web develop center to manage maps on server", 5);
             }
         };
         cells.Add(controller);
     }
 }
Example #2
0
        public void ClearAll()
        {
            // Notice:
            //   a) When clear both map cache and map list,
            //      load map will not trigger a download (cache is build when upload),
            //      and statistical request count will not be increased in a subsequent load (when edit or preview).
            //   b) When clear map cache only,
            //      load map after clear (only the first time each map) will trigger a download,
            //      and statistical request count will be increased in a subsequent load (when edit or preview).
            //      Map cache is used after a successful download and will be cleared if SparseSpatialMapManager.clear is called or app uninstalled.
            //
            // More about the statistical request count and limitations for different subscription mode can be found at EasyAR website.

            if (!ViewManager.Instance.MainViewRecycleBinClearMapCacheOnly)
            {
                // clear map meta and the list on UI
                foreach (var cell in cells)
                {
                    if (cell)
                    {
                        MapMetaManager.Delete(cell.MapMeta);
                        Destroy(cell.gameObject);
                    }
                }
                cells.Clear();
            }

            // clear map cache
            MapSession.ClearCache();

            // UI notification
            OnCellChange();
            if (!ViewManager.Instance.MainViewRecycleBinClearMapCacheOnly)
            {
                easyar.GUIPopup.EnqueueMessage(
                    "DELETED: {(Sample) Meta Data, Map Cache}" + Environment.NewLine +
                    "NOT DELETED: {Map on Server}" + Environment.NewLine +
                    "Use web develop center to manage maps on server", 5);
            }
            else
            {
                easyar.GUIPopup.EnqueueMessage(
                    "DELETED: {Map Cache}" + Environment.NewLine +
                    "NOT DELETED: {Map on Server, (Sample) Meta Data}" + Environment.NewLine +
                    "Use web develop center to manage maps on server", 5);
            }
        }