-
-
Notifications
You must be signed in to change notification settings - Fork 5
Useful Things
Nenkai edited this page Jul 13, 2024
·
4 revisions
context.addTimeOut("myFunctionTimeout", (context) =>
{
// ...
}, context);
context.setTimeOut("myFunctionTimeout", 0.5); // Will be called in 0.5s
<module>.load("path_to_script"); // no .adc extension
main::sound.play(sfx_name); // i.e "cursor"
DialogUtil::openConfirmDialog(context, DialogUtil::..., message);
CursorUtil::setCursor(context, cursor_name);
Refer to SequenceUtil.ad
for implementation details.
module MyProject
{
function onLoad(update_context)
{
// Entrypoint-loading of the project
update_context.createRenderContext(1);
var render_context = update_context.getRenderContext(0);
// Go to a page/root
// GT4
render_context.startPage(LoadRoot)
// GT5/6
// Using open
<root>.open(render_context);
// Using SequenceUtil
SequenceUtil::startPageSimple(render_context, root1, root2);
}
// Optional
function onRealize(manager)
{
}
// Optional
function onDestroy(manager)
{
}
}
Refer to SequenceUtil.ad
for implementation details.
module MyRoot
{
function open(context)
{
// Sets the current page
SequenceUtil::startPage(context, ROOT);
// Pushes the page
SequenceUtil::pushPage(context, ROOT);
// Return a result here if needed
}
function close(cotnext)
{
// if the page was pushed, you might wanna pop it
SequenceUtil::popPage(context, ROOT);
}
// Initialize widget data/state for the root here.
method onInitialize(context)
{
}
// Clean up widgets here.
method onFinalize(context)
{
}
// Optional, handling keys
method onKeyPress(context, event)
{
return EVENTRESULT_CONTINUE;
}
// Optional
method onCancel(context)
{
main::sound.play("cancel");
self.close(context);
return EVENTRESULT_FILTER;
}
}