示例#1
0
        public void CleanBeforeInit()
        {
            ExitClean();
            BPM          = 110;
            BPMText.text = BPM.ToString();
            MaxLine      = 0;
            BeatVal      = 4;
            NoteColorR   = 255;
            NoteColorG   = 255;
            NoteColorB   = 255;
            for (int i = 1; i < 9; i++)
            {
                if (LineButtons[i] != null)
                {
                    LineButtons[i].targetGraphic.color = GlobalTheme.ThemeColor();
                    LineButtons[i].gameObject.GetComponentInChildren <Text>().color = GlobalTheme.ThemeContrastColor();
                }
            }
            for (int i = 0; i < 4; i++)
            {
                LevelButtons[i].targetGraphic.color = GlobalTheme.ThemeColor();
                LevelButtons[i].gameObject.GetComponentInChildren <Text>().color = GlobalTheme.ThemeContrastColor();
            }
            DensityVal       = 20;
            DensityText.text = DensityVal.ToString();
            LevelSelect(2);
            NoteCount          = 0;
            NoteCountText.text = "0 notes";

            NameField.text   = "";
            ArtistField.text = "";
            MapperField.text = "";
            OffsetField.text = "";
        }
示例#2
0
        // ========== FROM HERE THIS IS TWx IN/OUTPUT

        public bool ReadFromTWx(string path, string name)
        {
            ScopeVal = 1;

            try
            {
                FileStream   stream   = new FileStream(path, FileMode.Open, FileAccess.Read);
                StreamReader reader   = new StreamReader(stream);
                string       jsonText = reader.ReadToEnd();

                JsonData jsonData = JsonMapper.ToObject(jsonText);
                TWxData  data     = JsonMapper.ToObject <TWxData>(jsonText);
                NameField.text   = name;
                ArtistField.text = data.metadata.artist;
                MapperField.text = data.metadata.mapper;
                LevelSelect(data.metadata.level);
                DensityVal       = data.metadata.density;
                DensityText.text = DensityVal.ToString();
                OffsetField.text = data.metadata.offset.ToString();

                LineSelect(int.Parse(path.Substring(path.Length - 1)));

                int curBlockIndex = -1, curBPMQueue = -1, curBeatsQueue = -1;
                for (int i = 0; i < data.notes.Length; i++)
                {
                    while (data.notes[i].YPos / 192 > curBlockIndex)
                    {
                        curBlockIndex++;
                        if ((curBPMQueue + 1 < data.metadata.bpmQueue.Length && data.metadata.bpmQueue[curBPMQueue + 1] <= curBlockIndex))
                        {
                            curBPMQueue++;
                            ChangeBPMWithValue(data.metadata.bpm[curBPMQueue]);
                        }
                        if (data.metadata.beats == null)
                        {
                            BeatVal = 4;
                        }
                        else if ((curBeatsQueue + 1 < data.metadata.beatsQueue.Length && data.metadata.beatsQueue[curBeatsQueue + 1] <= curBlockIndex))
                        {
                            curBeatsQueue++;
                            BeatVal = data.metadata.beats[curBeatsQueue];
                        }
                        AddBlock();
                    }
                    Blocks[curBlockIndex].CreateNote(data.notes[i]);
                }
                SelectedNote.Clear();
                reader.Close();
                stream.Close();
                return(true);
            }
            catch (Exception e)
            {
                Debug.Log(e.Message + Environment.NewLine + e.StackTrace);
                return(false);
            }
        }
示例#3
0
 public void ChangeDensity(int moveVal)
 {
     if (moveVal.Equals(0))
     {
         DensityVal--;
         if (DensityVal < 1)
         {
             DensityVal = 1;
         }
     }
     else
     {
         DensityVal++;
         if (DensityVal > 99)
         {
             DensityVal = 99;
         }
     }
     DensityText.text = DensityVal.ToString();
 }