AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzActionsScript.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CZ_ACTIONS_SCRIPT_H_)
00015 #define _CZ_ACTIONS_SCRIPT_H_
00016 
00017 #include "CzActions.h"
00018 #include "CzXoml.h"
00019 
00020 /**
00021  @addtogroup Actions
00022  @{
00023  */
00024  
00025 /**
00026  @class CzXomlActions_Script
00027 
00028  @brief Implements actions that relate to scripts
00029 
00030  The CzXomlActions_Script class holds Actions (IzXomlAction) that deal with scripts such as CallScript
00031  
00032  The following actions are supported:
00033  - CallScript
00034  - Inline
00035  - CallGlobalScript
00036 
00037  The above actions have the following XOML prototypes:
00038  - CallScript(script-function-name, context-name, param2, param3, param4)
00039    - script-function-name - Script function name to call (must be in scene or global scope)
00040    - context-name - Scene or actor that should be passed as the first parameter to the script function. If not set then the actor or scene that the action is defined inside of will be passed.
00041    - Param2 to Param4 - Passed as the 2nd, 3rd and 4th parameters of the function (all optional)
00042  - Inline(script-code, scene-name)
00043    - script-code - Script code snipit to execute
00044    - scene-name - Name of scene that contains the script engine that should execute the script. By not passing this parameter the scene that contains the action will be used. If the action is declared outside of a scene then the global script engine will be used.
00045  - CallGlobalScript(script-function-name, context-name, param2, param3, param4)
00046    - script-function-name - Global script function name to call
00047    - Scene that should be passed as the first parameter to the script function. If not set then the main game object will be passed.
00048    - Param2 to Param4 - Passed as the 2nd, 3rd and 4th parameters of the function (all optional)
00049 
00050  For more information on scripting see CzScript and IzScriptEngine
00051  
00052  */
00053 
00054 class CzXomlActions_Script : public IzXomlAction
00055 {
00056 public:
00057     enum eActionType
00058     {
00059         Action_CallScript           = 0, 
00060         Action_Inline               = 1, 
00061         Action_CallGlobalScript     = 2, 
00062         Action_Max                  = 3, 
00063     };
00064 protected:
00065     eActionType Type;
00066     CzXomlActions_Script() {}
00067 public:
00068     CzXomlActions_Script(eActionType type)
00069     {
00070         Type = type;
00071         switch (Type)
00072         {
00073         case Action_CallScript:
00074             setActionName("callscript");
00075             break;
00076         case Action_Inline:
00077             setActionName("inline");
00078             break;
00079         case Action_CallGlobalScript:
00080             setActionName("callglobalscript");
00081             break;
00082         }
00083     }
00084     void Execute(IzXomlResource* source, CzAction* action);
00085 };
00086 
00087 /// @}
00088 
00089 #endif // _CZ_ACTIONS_SCRIPT_H_