Ejemplo n.º 1
0
 public void Save(string name, Optional <Image> preview)
 {
     IsSaving = true;
     MapWorker.BuilderMapController.MapHost += (map, isSuccessful, error) =>
     {
         if (isSuccessful)
         {
             var mapMeta = new MapMeta(map, new List <MapMeta.PropInfo>());
             MapMetaManager.Save(mapMeta);
             GUIPopup.EnqueueMessage("Map Generated", 3);
             GUIPopup.EnqueueMessage("Notice: map name can be changed on website," + Environment.NewLine +
                                     "while the SDK side will not get updated until map cache cleared and a re-download has been triggered.", 5);
             Saved = true;
         }
         else
         {
             GUIPopup.EnqueueMessage("Fail to generate Map" + (string.IsNullOrEmpty(error) ? "" : "\n error: " + error), 5);
         }
         IsSaving = false;
     };
     try
     {
         MapWorker.BuilderMapController.Host(name, preview);
     }
     catch (Exception e)
     {
         GUIPopup.EnqueueMessage("Fail to host map: " + e.Message, 5);
         IsSaving = false;
     }
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
        public void Save()
        {
            if (mapData == null)
            {
                return;
            }

            var propInfos = new List <MapMeta.PropInfo>();

            foreach (var prop in mapData.Props)
            {
                var position = prop.transform.localPosition;
                var rotation = prop.transform.localRotation;
                var scale    = prop.transform.localScale;

                propInfos.Add(new MapMeta.PropInfo()
                {
                    Name     = prop.name,
                    Position = new float[3] {
                        position.x, position.y, position.z
                    },
                    Rotation = new float[4] {
                        rotation.x, rotation.y, rotation.z, rotation.w
                    },
                    Scale = new float[3] {
                        scale.x, scale.y, scale.z
                    }
                });
            }
            mapData.Meta.Props = propInfos;

            MapMetaManager.Save(mapData.Meta);
        }
Ejemplo n.º 4
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);
            }
        }