forked from pookzilla/Eclipse-Corona-SDK-Templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstoryboard_templates.xml
95 lines (62 loc) · 6.3 KB
/
storyboard_templates.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="This scene template can be used as a bare-bones scene to be used with the Storyboard API." enabled="true" name="storyboard scene template">----------------------------------------------------------------------------------
--
-- scenetemplate.lua
--
----------------------------------------------------------------------------------
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
----------------------------------------------------------------------------------
--
-- NOTE:
--
-- Code outside of listener functions (below) will only be executed once,
-- unless storyboard.removeScene() is called.
--
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view
-----------------------------------------------------------------------------
-- CREATE display objects and add them to 'group' here.
-- Example use-case: Restore 'group' from previously saved state.
-----------------------------------------------------------------------------
end
-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
-----------------------------------------------------------------------------
-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)
-----------------------------------------------------------------------------
end
-- Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
-----------------------------------------------------------------------------
-- INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)
-----------------------------------------------------------------------------
end
-- Called prior to the removal of scene's "view" (display group)
function scene:destroyScene( event )
local group = self.view
-----------------------------------------------------------------------------
-- INSERT code here (e.g. remove listeners, widgets, save state, etc.)
-----------------------------------------------------------------------------
end
---------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )
-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )
-- "exitScene" event is dispatched before next scene's transition begins
scene:addEventListener( "exitScene", scene )
-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )
---------------------------------------------------------------------------------
return scene</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Returns the name of the previous scene (as a string)." enabled="true" name="storyboard.getPrevious">${previous} = storyboard.getPrevious()</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Returns the specified scene object. If the scene object does not exist, the function will return nil. This is useful for getting a reference to a specific scene object, for example, if you have a function attached to a specific scene that a separate scene needs access to.local scene = storyboard.getScene( "scene2" )" enabled="true" name="storyboard.getScene">${scene} = storyboard.getScene( ${sceneName} )</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Used to transition to a specific scene (determined by scene's module name). Internally, this will handle all loading/unloading of the scenes. Scenes may also be explicitly unloaded/removed by the user." enabled="true" name="storyboard.gotoScene">storyboard.gotoScene( ${sceneName}, ${effect}, ${effectTime} )</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Used to create new scene objects to be returned and used with the Storyboard API." enabled="true" name="storyboard.newScene">${scene} = storyboard.newScene()</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Will purge all scenes (except for the one that is currently showing). A "destroyScene" event will be dispatched to all scenes before they are purged." enabled="true" name="storyboard.purgeAll">storyboard.purgeAll()</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Unloads the specified scene's "view" property, which is a group that contains all of the scene's objects. It takes one (required) argument, sceneName, which is the module name of the scene you are attempting to unload. This function preserves the scene's module in the global package.loaded table." enabled="true" name="storyboard.purgeScene">storyboard.purgeScene( ${sceneName} )</template><template autoinsert="true" context="LuaUniversalTemplateContextType" deleted="false" description="Will purge/remove all scenes (except for the one that is currently showing). A "destroyScene" event will be dispatched to all scenes before they are purged." enabled="true" name="storyboard.removeAll">storyboard.removeAll()</template></templates>