Example #1
0
 void androidPlatformLoader()
 {
     ZRAndroidFilePicker.PickFile(
         //ZRFilePicker.Creat (
         (filepath) => {
         TrackMap ZRTrackFile;
         if (!string.IsNullOrEmpty(filepath))
         {
             string json = File.ReadAllText(filepath);
             try{
                 ZRTrackFile = TrackMap.FromJson(json);
             }catch (Exception e) {
                 editor.debugLog.LogWarning(ExceptionList.openFileError.Value);
                 return;
             }
             manager.cacheFilePath = filepath;
             editor.getTrackMap    = ZRTrackFile;
             //TODO:Load its AudioClip and Background Image
             StartCoroutine(LoadContent(editor.getTrackMap.header));
         }
         else
         {
             editor.debugLog.LogWarning(ExceptionList.openFileError.Value);
         }
     });
 }
Example #2
0
        private void TestTrackMap(string fileName)
        {
            byte[]   dataBefore = File.ReadFile(fileName);
            TrackMap map        = new TrackMap(dataBefore);

            byte[] dataAfter = map.GetBytes();
            Assert.AreEqual(dataBefore, dataAfter);
        }
Example #3
0
        /// <summary>
        /// Fills the clipboard with the selected tiles.
        /// </summary>
        /// <param name="trackMap">The track map the tiles will be copied from.</param>
        public void Fill(TrackMap trackMap)
        {
            this.data.Clear();

            for (int y = this.Rectangle.Y; y < this.Rectangle.Bottom; y++)
            {
                for (int x = this.Rectangle.X; x < this.Rectangle.Right; x++)
                {
                    this.data.Add(trackMap[x, y]);
                }
            }

            this.OnTilesChanged(this.Rectangle);
        }
Example #4
0
        IEnumerator _Init()
        {
            string path = null;

            path = ConfigUtility.fileLoadPath(
                Path.Combine(
                    temp.folderPath,
                    temp.chunkHeader.trackMapFileCode
                    )
                );

            WWW trackmap = new WWW(path);
            WWW texture  = null;

            path = Path.Combine(
                temp.folderPath,
                temp.chunkHeader.backgroundFileCode
                );

            bool hasTexture = File.Exists(path);

            path = ConfigUtility.fileLoadPath(path);

            if (hasTexture)
            {
                texture = new WWW(path);
            }

            yield return(trackmap);

            if (hasTexture)
            {
                yield return(texture);
            }


            trackMap = TrackMap.FromJson(trackmap.text);

            if (hasTexture)
            {
                m_Texture.mainTexture = texture.texture;
            }

            m_Label.text = trackMap.header.Title + " - " + trackMap.header.Artist;
            isInit       = true;
        }
Example #5
0
        void windowsPlatformLoader()
        {
            string path = ConfigUtility.persistentDataPath + "/" + editor.getTrackMap.header.Title + TrackMap.extension;

            TrackMap     ZRTrackFile;
            OpenFileName ofn = new OpenFileName();

            ofn.structSize = Marshal.SizeOf(ofn);
            ofn.filter     = "All Files\0*.*\0\0";
            //ofn.filter = "MP3 audio (*.mp3) | *.mp3";
            ofn.file         = new string (new char[256]);
            ofn.maxFile      = ofn.file.Length;
            ofn.fileTitle    = new string (new char[64]);
            ofn.maxFileTitle = ofn.fileTitle.Length;
            ofn.initialDir   = ConfigUtility.persistentDataPath;
            ofn.title        = "請選擇一個" + TrackMap.extension + "檔案";
            ofn.defExt       = TrackMap.extension.ToUpper();
            //ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
            ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;            //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_NOCHANGEDIR
            if (DllOpebFile.GetOpenFileName(ofn))
            {
                if (!string.IsNullOrEmpty(ofn.file))
                {
                    string json = File.ReadAllText(ofn.file);
                    try{
                        ZRTrackFile = TrackMap.FromJson(json);
                    }catch (Exception e) {
                        editor.debugLog.LogWarning(ExceptionList.openFileError.Value);
                        return;
                    }
                    manager.cacheFilePath = ofn.file;
                    editor.getTrackMap    = ZRTrackFile;
                    //TODO:Load its AudioClip and Background Image
                    StartCoroutine(LoadContent(editor.getTrackMap.header));
                }
                else
                {
                    editor.debugLog.LogWarning(ExceptionList.openFileError.Value);
                }
            }
        }
Example #6
0
        IEnumerator LoadTrackMap(GameMapTempFolder temp)
        {
            string path = ConfigUtility.fileLoadPath(
                Path.Combine(
                    temp.folderPath,
                    temp.chunkHeader.trackMapFileCode
                    )
                );

            WWW trackmap = new WWW(path);

            //yield return trackmap;

            while (!trackmap.isDone)
            {
                GameLoadingDialog.getInstance.ReportProgress(trackmap.progress / 3f);
                yield return(null);
            }

            currentTrackMap = TrackMap.FromJson(trackmap.text);
        }
        private void rq_QueryCompleted(object sender, QueryCompletedEventArgs <Route> e)
        {
            if (e.Error == null)
            {
                if (myMapRoute != null)
                {
                    TrackMap.RemoveRoute(myMapRoute);
                }
                Route myRoute = e.Result;
                myMapRoute = new MapRoute(myRoute);
                TrackMap.AddRoute(myMapRoute);


                TimeSpan timeDiff = positions.Last().Timestamp.TimeOfDay - positions.First().Timestamp.TimeOfDay;
                TrackMap.Center = positions.First().Location;
                Mileage         = float.Parse(e.Result.LengthInMeters.ToString()) * KM_METERS;
                Runtime         = timeDiff;
            }
            else
            {
                MessageBox.Show("An error has ocurred. Details: " + e.Error.Message);
            }
        }
Example #8
0
 public static void UpdateUIText(TrackMap trackMap)
 {
     getInstance.text_Title.text  = string.Format("標題:{0}", trackMap.header.Title);
     getInstance.text_Artist.text = string.Format("作者:{0}", trackMap.header.Artist);
 }
Example #9
0
 public UndoRedoBuffer(TrackMap trackMap)
 {
     this.trackMap   = trackMap;
     this.undoBuffer = new LinkedList <TileChange>();
     this.redoBuffer = new LinkedList <TileChange>();
 }
Example #10
0
 void Awake()
 {
     getInstance = this;
     m_TrackMap  = new TrackMap();
 }