Description
This stub may be of use for asset developers.
This class does not stub all of Minibuffer's methods but it includes stubs for the most used setup methods. The motivation for this class is that one might want to make their own assets "minibuffer-able"–i.e., expose commands and variables for those that have Minibuffer–without having to litter #ifdefs everywhere.
That's also why the license for the attributes and this stub is different than Minibuffer proper. Minibuffer proper is licensed under Unity Asset Store End User License Agreement. The classes Command, Variable, Prompt, UniversalArgument, MinibufferListing, and MinibufferStub are licensed under the MIT License. (See the MIT license page for more details.) Should someone else wish to write tools that adopt Minibuffer's philosophy of UI-by-decoration but with a UI that is less like Emacs and more a CLI, or more Vim-like experience, etc., I encourage them to use these attributes.
If one needs functionality not exposed by this stub, I suggest doing the following:
The only thing this stub actually does is redirect messages to Debug.Log()
. All Action
s or Func
s provided to stub methods will never be executed.
Using this Class
To use this stub as a drop-in replacement for the Minibuffer class, comment out the following line in MinibufferStub.cs
:
That will expose MinibufferStub as the Minibuffer class.
Note the stub does not inherit from MonoBehaviour.
Public Member Functions | |
void | Message (string msgFormat, params object[] args) |
Prints message using Debug.Log() with prefix "Message: ". | |
void | MessageAlert (string msgFormat, params object[] args) |
Prints message using Debug.Log() with prefix "MessageAlert: ". | |
void | RegisterObject (object o) |
Does nothing. | |
void | RegisterType (Type t) |
Does nothing. | |
void | UnregisterObject (object o) |
Does nothing. | |
void | RegisterVariable< T > (Variable variable, Func< T > getFunc, Action< T > setFunc) |
Does nothing. | |
void | UnregisterVariable (string variable) |
Does nothing. | |
void | RegisterCommand (Command command, Delegate action) |
Does nothing. | |
void | UnregisterCommand (string commandName) |
Does nothing. | |
void | ToBuffer (string bufferName, string content) |
Print content using Debug.Log with the bufferName used as a prefix. | |
void | MessageOrBuffer (string bufferName, string msg) |
Print content using Debug.Log with the bufferName used as a prefix. | |
Static Public Member Functions | |
static void | OnStart (Action< MinibufferStub > action) |
Does nothing. | |
static void | With (Action< MinibufferStub > action) |
Does nothing. | |
static void | Register (object o) |
Does nothing. | |
static void | Register (Type t) |
Does nothing. | |
static void | Unregister (object o) |
Does nothing. | |
Properties | |
static MinibufferStub | instance [get] |
Returns an instance of the MinibufferStub class. More... | |
Property Documentation
|
staticget |
Returns an instance of the MinibufferStub class.
Will always work unlike Minibuffer, we don't need to wait for Unity to instantiate it.