Skip to content

Develop

Schwarzer edited this page Jul 30, 2018 · 6 revisions

As you are reading this page, i assume you have gain the ability to program. That means you have the ability to read English, so i will not translate this.

  • I use Visual Studio 2017, i don't care what are you using.
  • Create a new Class Library (.NET Framework) project, use .NET Framework 4.6, save to anywhere you like.
  • Change the default filename Class1 to your plugin's name.
  • You need to add some reference to Lanotalium's libraries:
    • In project hierarchy, right click to Reference and select Add Reference
    • Navigate to Lanotalium_Data/Managed
    • Select Schwarzer.Lanotalium.dll, Schwarzer.Dialogs.dll and add them.
      • Please note, every Lanotalium's update you have to reselect the binaries.
  • In the .cs file, using these namespaces
using EasyRequest;
using Lanotalium.Chart;
using Lanotalium.Plugin;
  • Create a class that use interface ILanotaliumPlugin
public class MyPlugin : ILanotaliumPlugin
{
  ...
}
  • Implement the methods.
  • Compile and put it in Lanotalium_Data/StreamingAssets/Plugins

Q&A

How to request data from user?

  • Create a request class
public class MyPluginRequest
{
    public float MyRequestData1;
}
  • Use Name Attribute to display the name you set instead of field name.
    [Name("Your field name")]
    public float MyRequestData1;
  • Use Default Attribute to set an default value to the field.
    [Default(5.5)]
    public float MyRequestData1;
  • Use Range Attribute to validate user's input when field is int and float.
    [Range(1,10)]
    public float MyRequestData1;
  • Call the request
Request<MyPluginRequest> request = new Request<MyPluginRequest>();
yield return context.UserRequest.Request(request, "Your description");
  • A dialog will popup.
  • If the user click on Confirm, request.Succeed will be true, vice versa.
  • Check the request.Succeed, if true, then user's data will be filled in request.Object.

How to show some message to user?

context.MessageBox.ShowMessage("Your message");

How to operate on chart?

  • Please note, although you can directly visit chart data via
context.TunerManager.TapNoteManager.TapNote
context.TunerManager.HoldNoteManager.HoldNote
context.TunerManager.BpmManager.Bpm
context.TunerManager.CameraManager.Horizontal
context.TunerManager.CameraManager.Vertical
context.TunerManager.CameraManager.Rotation
context.TunerManager.ScrollManager.Scroll
  • You are not recommend to change value directly, although the game logic changes directly, the UI may not update and display old data.
  • You are recommend to call methods in context.OperationManager to modify chart safe and sound.
  • Add Element
[ElementClass] element = new [ElementClass]()
{
  Time = 100 (Example)
};
context.OperationManager.Add[ElementClass](element);

For example:

Lanotalium.Chart.LanotaTapNote New = new Lanotalium.Chart.LanotaTapNote()
{
    Type = 0,
    Time = 10,
    Degree = 30,
    Size = 0
};
OperationManager.AddTapNote(New);
  • Modify Element
context.OperationManager.Set[ElementClass][ElementField](element, value);

For example:

foreach (LanotaTapNote tap in context.TunerManager.TapNoteManager.TapNote)
{
    context.OperationManager.SetTapNoteTime(tap, tap.Time + 1);
}
  • Delete Element
context.OperationManager.Delete[ElementClass](element);

For example:

context.OperationManager.DeleteTapNote(tap);
  • Special Properties
context.OperationManager.SelectedTapNote
context.OperationManager.SelectedHoldNote
context.OperationManager.SelectedMotions

These can be used to get current selected objects.

Clone this wiki locally