Esempio n. 1
0
    public SongCondensed(SongMap sm)
    {
        id = sm.id;

        hitMap[KeyCode.Keypad1] = sm.Presses1;
        hitMap[KeyCode.Keypad2] = sm.Presses2;
        hitMap[KeyCode.Keypad3] = sm.Presses3;
        hitMap[KeyCode.Keypad4] = sm.Presses4;
        hitMap[KeyCode.Keypad5] = sm.Presses5;
        hitMap[KeyCode.Keypad6] = sm.Presses6;
        hitMap[KeyCode.Keypad7] = sm.Presses7;
        hitMap[KeyCode.Keypad8] = sm.Presses8;
        hitMap[KeyCode.Keypad9] = sm.Presses9;
    }
Esempio n. 2
0
    private void LoadGameData()
    {
        var stream = File.OpenText("./Assets/Maps/map3.json");

        string json = stream.ReadToEnd();
        //Debug.Log(json);
        SongMap s = new SongMap();

        JsonUtility.FromJsonOverwrite(json, s);
        this.song = new SongCondensed(s);

        foreach (float i in song.hitMap[KeyCode.Keypad1])
        {
            Debug.Log(i);
        }

        //SongCondensed = new

        //setSong(new SongCondensed(SongMap.CreateFromJSON(json)));

        /*
         * // Path.Combine combines strings into a file path
         * // Application.StreamingAssets points to Assets/StreamingAssets in the Editor, and the StreamingAssets folder in a build
         * string filePath = Path.Combine(Application.streamingAssetsPath, "Maps/map1.json");
         *
         * if (File.Exists(filePath))
         * {
         *  // Read the json from the file into a string
         *  string dataAsJson = File.ReadAllText(filePath);
         *  setSong(new SongCondensed(SongMap.CreateFromJSON(filePath)));
         * }
         * else
         * {
         *  Debug.LogError("Cannot load game data!");
         * }
         */
    }