npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

com.amanotes.contentreader

v2.1.7

Published

Ama Content Reader is a free library from Amanotes that provides an efficient way to access Amanotes's content store.

Downloads

46

Readme

Amanotes Content Reader

Before you begin

Ama Content Reader is a free library from Amanotes that provides an efficient way to access Amanotes's content store.

How does it work?

Ama Content Reader helps you to read any content (bin files) of your game from Amanotes Content Store.

Setup Content Reader for your game

Add npm registry at the top of ./Packages/manifest.json, then add com.amanotes.contentreader package at the end of dependencies block. You can get lastest version here

{
    "scopedRegistries": [{
        "name": "Amanotes",
        "url": "https://registry.npmjs.org/",
        "scopes": [
            "com.amanotes"
        ]
    }],

    "dependencies": {
        // Others config goes here
        // ...

        "com.amanotes.contentreader" : "<lastest_version>"
    }
}

###Getting license key for Content Reader

Contact your PO to set up and request for a unique key to use the content reader.

Init Content Reader for your game

Init Key: Init Content Reader in your very first init scene of your game with the license provided by Amanotes

/**
 * Project's ID needs to be matched with the license Bundle ID. (example ID: com.amanotes.rnd)
 * @param  licenseKey   provided by Amanotes, please contract Producer Owner from Amanotes to get your license
 */

ContentNoteGenerator.InitKey("U2FsdGVkX1+Z7MdUt2Ladzxcuy/mxlnwcSlyXGduG6uFioT/aWJ7rABeVeB8/3dEjnosq");

Read Notes Data

Import the package

using Amanotes.ContentReader;

To read notes datas, use GetNotes method in NoteGeneration

/**
 * @param  contentFile MIDI content in byte[] format
 * @param  difficulty Which difficulty to generate note for - equals to NoteTab
 * @param  OnComplete Will be call when load file completed
 * @param  OnError Will be call when load file error
 */
  
void ReadNotesData(byte[] contentFile)
{
    NoteGeneration.GetNotes(contentFile, NoteTab.Easy,
        (res,bpm) =>
        {
            Debug.Log("Total notes: " + res.Count);
			Debug.Log("bpm: " + bpm);
		},
        (err) =>
        {
            Debug.Log(err);
        });
}

Customize notes list

First, you should add three variables in your song config files for NoteTab, NoteLine and GridSnap. Bellow are the enum values for these variables:

NoteTab: SupperEasy, Easy, Medium,Hard, Expert NoteLine: All,LineOne,LineTwo,LineThree,LineFour,LineFive GridSnap: OneByFour, OneByEight, OneByTwelve, OneBySixTeen, OneByTwentyFour, OneByThirtyTwo, OneByFortyEight, OneBySixtyFour, OneByNinetySix

To filter notes datas, use Filter method in NoteGeneration.

/**
* Get notes only from specific line
*
* @param  notes get from function ReaderNoteData
* @param  NoteLine Which NoteLine to generate note for - this parameters should be retrieved from song configs
*/
  
List<NoteData> FilterNoteData(List<NoteData> notes)
{
	return NoteGeneration.Filter(notes, NoteLine.All);
}

/**
* Custom the density of notes
*
* @param  notes get from function ReaderNoteData
* @param  bpm get from function ReaderNoteData
* @param  GridSnap Which GridSnap to generate note for -  this parameters should be retrieved from song configs
*/
  
List<NoteData> TranslateNoteData(List<NoteData> notes, float bpm)
{
	return NoteGeneration.Translate(bpm, notes, GridSnap.OneByEight);
}

Example Content Reader

First, you need to install ExampleContentReader.unitypackage

public string license; //Content Reader licensing from Amanotes
public string fileName;
public NoteTab noteTab;
private float bpm;
List<NoteData> notesData;
void Start()
{
        /*Note 
        The Unity project's ID needs to be matched with the license Bundle ID. (example ID: com.amanotes.rnd)
        */
        ContentNoteGenerator.InitKey(license);
        ExampleReadContentFile();

        FileUtils f = new FileUtils();
        f.GetListFiles();
}

public void OnClickButtonRead()
{
    ExampleReadContentFile();
}


void ExampleReadContentFile()
{
    string contentPath = GetStreammingAssetsPath(fileName);
    WWW reader = new WWW(contentPath);
    while (!reader.isDone) { }
    notesData = ReaderNoteData(reader.bytes);
    Debug.Log("Total notes: " + notesData.Count);

    //Use noteTimes below to generate object for your game
    for (int i = 0; i < notesData.Count; i++)
    {
        float noteTime = notesData[i].timeAppear;
        Debug.Log("noteTime: " + noteTime);
    }
}

public string GetStreammingAssetsPath(string name)
{
#if UNITY_EDITOR_OSX
    return "file://"+Application.streamingAssetsPath + "/" + name;
#elif UNITY_EDITOR
    return Application.streamingAssetsPath + "/" + name;
#elif UNITY_ANDROID
    return Path.Combine("jar:file://" + Application.dataPath + "!/assets" , name);
#elif UNITY_IOS
    return Path.Combine(Application.dataPath + "/Raw" , name);
#else
    return Application.streamingAssetsPath + "/" + name;
#endif
}

//To read notes datas, use GetNotes method in NoteGeneration
/**
* @param  contentFile MIDI content in byte[] format
* @param  NoteTab Which NoteTab to generate note for
* @param  OnComplete Will be call when load file completed
* @param  OnError Will be call when load file error
*/
List<NoteData> ReaderNoteData(byte[] contentfile)
{
    List<NoteData> notes = new List<NoteData>();
    NoteGeneration.GetNotes(contentfile, NoteTab.SupperEasy,
    (res, bpm) =>
    {
        this.bpm = bpm;
        for (int i = 0; i < res.Count; i++)
        {
            notes.Add(res[i]);
            Debug.Log(notes[i].stringIndex);
        }
    },
    (err) =>
    {
        Debug.Log(err);
    });
    return notes;
}

Versioning

We use SemVer for versioning.

License

This project is licensed under the MIT License - see the LICENSE.md file for details