示例#1
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("AdvancedXML",
                              _("Advanced XML 1.0"),
                              _("Extension allowing to manipulate XML files."),
                              "Victor Levasseur",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("NewFile",
                       _("Create an XML document"),
                       _("Create an XML document"),
                       _("Create an XML document into reference _PARAM0_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference (allow to access later to the element)"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::CreateNewDocument").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("LoadFile",
                       _("Load an XML file"),
                       _("Load an XML file."),
                       _("Load XML File _PARAM0_ into reference _PARAM1_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXMLOpen.png",
                       "res/AdvancedXML/AdvancedXMLOpen16.png")

            .AddParameter("file", _("Source file"))
            .AddParameter("string", _("Reference (allow to access later to the element)"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::LoadXmlFile").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("SaveFile",
                       _("Save an XML file"),
                       _("Save an XML file."),
                       _("Save XML file _PARAM1_ into _PARAM0_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXMLSave.png",
                       "res/AdvancedXML/AdvancedXMLSave16.png")

            .AddParameter("file", _("File where to save the document"))
            .AddParameter("string", _("Reference to the XML document"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SaveXmlFile").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("BrowseTo",
                       _("Load an element into a reference"),
                       _("Load an element (relative to another) in a reference.\nNote: References allows to access to an element using the name of the reference pointing to it."),
                       _("Load path _PARAM2_ (relative to the element _PARAM0_) into reference _PARAM1_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRef.png",
                       "res/AdvancedXML/AdvancedXMLRef16.png")

            .AddParameter("string", _("Reference of an existing element ( The path of the element will be relative to this element )"))
            .AddParameter("string", _("Name of the reference to the newly created element"))
            .AddParameter("string", _("Path ( tags can be browsed by separating them using /. Use * to go to the first child element without knowing the tag name )"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::BrowseTo").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("NextSibling",
                       _("Go to next element"),
                       _("Create a reference on the element following the specified element.\nNote: The reference will be invalid if there is no valid element following the specified one.Conditions are available to check if an element is valid."),
                       _("Load the element called _PARAM2_ following _PARAM1_ into reference _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRef.png",
                       "res/AdvancedXML/AdvancedXMLRef16.png")

            .AddParameter("string", _("Reference to create"))
            .AddParameter("string", _("Reference to the element preceeding the element to be accessed"))
            .AddParameter("string", _("Tag name filter "), "", true)
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::NextSibling").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddCondition("IsRefValid",
                       _("The reference is valid"),
                       _("Is valid only when the reference is pointing to an existing and valid element."),
                       _("_PARAM0_ exists and is valid"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be tested"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::IsRefValid").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddCondition("GetElementType",
                       _("Element type"),
                       _("Test the type of the element.\n(0-> Tag, 1-> Text, 2-> Comment, 3-> XML Document, -1 -> Unknown )"),
                       _("Type of _PARAM0_ _PARAM1__PARAM2_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be tested"))
            .AddParameter("relationalOperator", _("Comparison sign"))
            .AddParameter("expression", _("Type"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetRefType").SetManipulatedType("number").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddExpression("GetElementType",
                       _("Element type"),
                       _("Return the type of the element.\n(0-> Tag, 1-> Text, 2-> Comment, 3-> XML Document, -1 -> Unknown )"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetRefType").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("CreateNewElement",
                       _("Create a new element"),
                       _("Create a new element.\nNote: References allows to access to an element using the name of the reference pointing to it."),
                       _("Create a new element of type _PARAM1_ and attach to it the reference _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLAdd.png",
                       "res/AdvancedXML/AdvancedXMLAdd16.png")

            .AddParameter("string", _("Reference which will be used to access to the element"))
            .AddParameter("expression", _("Tye of the element to be created\n(0-> Tag, 1-> Text, 2-> Comment )"))
            .AddParameter("string", _("Text of the element\nIf the element is a tag, it will be the tag name,if the element is a text or a comment, it will be the content."))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::CreateNewElement").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("DeleteAnElement",
                       _("Delete an element"),
                       _("Delete an element (The element will be removed from its parent and will be destroyed)."),
                       _("Delete element _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRemove.png",
                       "res/AdvancedXML/AdvancedXMLRemove16.png")

            .AddParameter("string", _("Reference to the element to be deleted"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::DeleteAnElement").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("InsertElementIntoAnother",
                       _("Add an element inside another"),
                       _("Add an element into another: The element will be a \"child\" of its \"parent\"."),
                       _("Add _PARAM0_ as a child of _PARAM1_ (before _PARAM2_)"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be added"))
            .AddParameter("string", _("Reference to the parent element (must be a Tag element)"))
            .AddParameter("string", _("The element will be added before this element (if not defined, the element will be added at the end)"), "", true)
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::InsertElementIntoAnother").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("SetTagName",
                       _("Change the tag name"),
                       _("Change the tag name"),
                       _("Do _PARAM1__PARAM2_ to the name of tag _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the Tag element"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Tag name"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetText").SetManipulatedType("string");

        AddStrExpression("GetTagName",
                       _("Tag name"),
                       _("Get the name of a tag"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetContent",
                       _("Change the content of the element"),
                       _("Change the content (text) of the element ( For text and comments elements only )."),
                       _("Do _PARAM1__PARAM2_ to the content of _PARAM0_"),
                       _("Advanced XML : Text and comments"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Contents"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetText").SetManipulatedType("string");

        AddStrExpression("GetContent",
                       _("Contents"),
                       _("Get the content of a text or comment element"),
                       _("Advanced XML : Text and comments"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddExpression("GetAttributeNumber",
                       _("Value of an attribute of an element"),
                       _("Get the value of an attribute of an element"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetAttributeNumber").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetAttributeNumber",
                       _("Change the value of an attribute"),
                       _("Change the value of an attribute of an element ( which must be a Tag element )."),
                       _("Do _PARAM2__PARAM3_ to the attribute _PARAM1_ of element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("expression", _("Value"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetAttributeNumber").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetAttributeNumber").SetManipulatedType("number");

        AddStrExpression("GetAttributeString",
                       _("Text of an attribute of an element"),
                       _("Get the text of an attribute of an element"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetAttributeString").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetAttributeString",
                       _("Change the text of an attribute"),
                       _("Change the text of an attribute of an element ( which must be a Tag element )."),
                       _("Do _PARAM2__PARAM3_ to the attribute _PARAM1_ of element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Value"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetAttributeString").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetAttributeString").SetManipulatedType("string");

        AddAction("RemoveAttribute",
                       _("Delete an attribute"),
                       _("Delete an attribute from an element ( which must be a Tag element)."),
                       _("Delete attribute _PARAM1_ from the element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::RemoveAttribute").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
示例#2
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Function",
                              _("Function events"),
                              _("Extension allowing to use events behaving as functions."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("LaunchFunction",
            _("Launch a function"),
            _("Launch a function"),
            _("Launch _PARAM0_ (_PARAM1_, _PARAM2_, _PARAM3_, _PARAM4_, _PARAM5_, _PARAM6_, _PARAM7_)"),
            _("Functions"),
            "res/actions/function24.png",
            "res/actions/function.png")
            .AddParameter("", _("Name of the function"))
            .AddParameter("string", _("Parameter 1"), "", true)
            .AddParameter("string", _("Parameter 2"), "", true)
            .AddParameter("string", _("Parameter 3"), "", true)
            .AddParameter("string", _("Parameter 4"), "", true)
            .AddParameter("string", _("Parameter 5"), "", true)
            .AddParameter("string", _("Parameter 6"), "", true)
            .AddParameter("string", _("Parameter 7"), "", true)
            .codeExtraInformation.SetCustomCodeGenerator([](gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context) {
                gd::String functionName = instruction.GetParameter(0).GetPlainString();
                const gd::Project & project = codeGenerator.GetProject();
                const gd::Layout & layout = codeGenerator.GetLayout();

                const FunctionEvent * functionEvent = FunctionEvent::SearchForFunctionInEvents(project, layout.GetEvents(), functionName);
                if ( !functionEvent )
                {
                    std::cout << "Function \""+functionName+"\" not found!" << std::endl;
                    return "//Function \""+functionName+"\" not found.\n";
                }

                codeGenerator.AddGlobalDeclaration("void "+FunctionEvent::MangleFunctionName(layout, *functionEvent)+"(RuntimeContext *, std::map <gd::String, std::vector<RuntimeObject*> *>, std::vector<gd::String> &);\n");
                gd::String code;

                //Generate code for objects passed as arguments
                gd::String objectsAsArgumentCode;
                {
                    objectsAsArgumentCode += "runtimeContext->ClearObjectListsMap()";
                    std::vector<gd::String> realObjects = codeGenerator.ExpandObjectsName(functionEvent->GetObjectsPassedAsArgument(), context);
                    for (std::size_t i = 0;i<realObjects.size();++i)
                    {
                        context.EmptyObjectsListNeeded(realObjects[i]);
                        objectsAsArgumentCode += ".AddObjectListToMap(\""+codeGenerator.ConvertToString(realObjects[i])+"\", "+ManObjListName(realObjects[i])+")";
                    }
                    objectsAsArgumentCode += ".ReturnObjectListsMap()";
                }

                //Generate code for evaluating parameters
                code += "std::vector<gd::String> functionParameters;\n";
                for (std::size_t i = 1;i<8;++i)
                {
                    gd::String parameterCode;
                    gd::CallbacksForGeneratingExpressionCode callbacks(parameterCode, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameter(i).GetPlainString());
                    parser.ParseStringExpression(CppPlatform::Get(), project, layout, callbacks);
                    if (parameterCode.empty()) parameterCode = "\"\"";

                    code += "functionParameters.push_back("+parameterCode+");\n";
                }

                code += FunctionEvent::MangleFunctionName(layout, *functionEvent)+"(runtimeContext, "+objectsAsArgumentCode+", functionParameters);\n";
                return code;
            });

        AddEvent("Function",
            _("Function"),
            _("Function event : An event which is launched only thanks to action \"Launch a function\""),
            "",
            "res/function.png",
            std::shared_ptr<gd::BaseEvent>(new FunctionEvent))
            .SetCodeGenerator([](gd::BaseEvent & event_, gd::EventsCodeGenerator & codeGenerator,
                gd::EventsCodeGenerationContext & /* The function has nothing to do with the current context */){
                FunctionEvent & event = dynamic_cast<FunctionEvent&>(event_);
                const gd::Layout & layout = codeGenerator.GetLayout();

                //Declaring function prototype.
                codeGenerator.AddGlobalDeclaration("void "+FunctionEvent::MangleFunctionName(layout, event)+"(RuntimeContext *, std::map <gd::String, std::vector<RuntimeObject*> *>, std::vector<gd::String> &);\n");

                //Generating function code:
                gd::String functionCode;
                functionCode += "\nvoid "+FunctionEvent::MangleFunctionName(layout, event)+"(RuntimeContext * runtimeContext, std::map <gd::String, std::vector<RuntimeObject*> *> objectsListsMap, std::vector<gd::String> & currentFunctionParameters)\n{\n";

                gd::EventsCodeGenerationContext callerContext;
                {
                    std::vector<gd::String> realObjects = codeGenerator.ExpandObjectsName(event.GetObjectsPassedAsArgument(), callerContext);
                    for (std::size_t i = 0;i<realObjects.size();++i)
                    {
                        callerContext.EmptyObjectsListNeeded(realObjects[i]);
                        functionCode += "std::vector<RuntimeObject*> "+ManObjListName(realObjects[i]) + ";\n";
                        functionCode += "if ( objectsListsMap[\""+realObjects[i]+"\"] != NULL ) "+ManObjListName(realObjects[i])+" = *objectsListsMap[\""+realObjects[i]+"\"];\n";
                    }
                }
                functionCode += "{";

                gd::EventsCodeGenerationContext context;
                context.InheritsFrom(callerContext);

                //Generating function body code
                gd::String conditionsCode = codeGenerator.GenerateConditionsListCode(event.GetConditions(), context);
                gd::String actionsCode = codeGenerator.GenerateActionsListCode(event.GetActions(), context);
                gd::String subeventsCode = codeGenerator.GenerateEventsListCode(event.GetSubEvents(), context);

                functionCode += codeGenerator.GenerateObjectsDeclarationCode(context);
                gd::String ifPredicat = "true";
                for (std::size_t i = 0;i<event.GetConditions().size();++i)
                    ifPredicat += " && condition"+gd::String::From(i)+"IsTrue";

                functionCode += conditionsCode;
                functionCode += "if (" +ifPredicat+ ")\n";
                functionCode += "{\n";
                functionCode += actionsCode;
                if ( event.HasSubEvents() ) //Sub events
                {
                    functionCode += "\n{\n";
                    functionCode += subeventsCode;
                    functionCode += "}\n";
                }
                functionCode += "}\n";

                functionCode += "}\n"; //Context end
                functionCode += "}\n"; //Function end
                codeGenerator.AddCustomCodeOutsideMain(functionCode);

                return "";
            });

        AddStrExpression("Parameter",
            _("Parameter of the current function"),
            _("Return the text contained in a parameter of the currently launched function"),
            _("Function"),
            "res/function.png")
            .AddParameter("expression", _("Index of the parameter (Parameters start at 0!)"))
            .codeExtraInformation.SetCustomCodeGenerator([](const std::vector<gd::Expression> & parameters, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context) {
                codeGenerator.AddIncludeFile("Function/FunctionTools.h");
                const gd::Project & game = codeGenerator.GetProject();
                const gd::Layout & scene = codeGenerator.GetLayout();

                //Ensure currentFunctionParameters vector is always existing.
                gd::String mainFakeParameters = "std::vector<gd::String> currentFunctionParameters;\n";
                if (codeGenerator.GetCustomCodeInMain().find(mainFakeParameters) == gd::String::npos)
                    codeGenerator.AddCustomCodeInMain(mainFakeParameters);

                //Generate code for evaluating index
                gd::String expression;
                gd::CallbacksForGeneratingExpressionCode callbacks(expression, codeGenerator, context);
                gd::ExpressionParser parser(parameters[0].GetPlainString());
                if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), game, scene, callbacks) || expression.empty()) expression = "0";

                gd::String code;

                code += "GDpriv::FunctionTools::GetSafelyStringFromVector(currentFunctionParameters, "+expression+")";

                return code;
            });
        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
示例#3
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Network",
                              _("Network features"),
                              _("Built-in extension allowing to exchange data on the network between games."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("AddRecipient",
                       _("Add a recipient"),
                       _("Add the computer with the corresponding IP Adress as a recipient of sent data."),
                       _("Add _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Recipient IP address."))
            .AddParameter("expression", _("Recipient port (Default : 50001)"), "", true)

            .SetFunctionName("GDpriv::NetworkExtension::AddRecipient").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("RemoveAllRecipients",
                       _("Delete all recipients"),
                       _("Clear the list of the recipients of sent data"),
                       _("Clear the list of recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::RemoveAllRecipients").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddAction("ListenToPort",
                       _("Initialize data reception"),
                       _("Initialize the network so as to be able te receive data from other computers."),
                       _("Initialize data reception"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("expression", _("Listening port (Default : 50001)"), "", true).SetDefaultValue("50001")
            .SetFunctionName("GDpriv::NetworkExtension::ListenToPort").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("StopListening",
                       _("Stop data reception"),
                       _("Stop data reception."),
                       _("Stop data reception"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ActStopListening").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("SendValue",
                       _("Send a value"),
                       _("Send a value to recipients"),
                       _("Send value _PARAM1_ with title _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Group"))
            .AddParameter("expression", _("Value"))

            .SetFunctionName("GDpriv::NetworkExtension::SendValue").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("SendString",
                       _("Send a text"),
                       _("Send a text to recipients"),
                       _("Send text _PARAM1_ with title _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Group"))
            .AddParameter("string", _("Text"))

            .SetFunctionName("GDpriv::NetworkExtension::SendString").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("ReceivePackets",
                       _("Receive waiting data"),
                       _("Receive data sent by other computers.\nYou can then access to them with the appropriate expressions."),
                       _("Receive data"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ReceivePackets").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("ResetReceivedData",
                       _("Delete all received data stored in memory"),
                       _("Delete every received data stored in memory"),
                       _("Delete every received data stored in memory"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ResetReceivedData").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddStrExpression("GetReceivedDataString", _("Get the text of a data"), _("Get the text contained in a data"), _("Network: Reception"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("string", _("Name of the data containing the text to get"))

            .SetFunctionName("GDpriv::NetworkExtension::GetReceivedDataString").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddExpression("GetReceivedDataValue", _("Get the value of a data"), _("Get the value contained in a data"), _("Network: Reception"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("string", _("Name of the data containing the text to get"))

            .SetFunctionName("GDpriv::NetworkExtension::GetReceivedDataValue").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetLastError", _("Last error occured"), _("Get the text describing the last error which occured."), _("Network: Errors"), "res/error.png")

            .SetFunctionName("GDpriv::NetworkExtension::GetLastError").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetPublicAddress", _("IP address"), _("Allow to get the public IP Address of the computer."), _("Network"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("expression", _("Maximum time to wait before getting the address ( in seconds ) ( 0 = no timeout )"), "", true)

            .SetFunctionName("GDpriv::NetworkExtension::GetPublicAddress").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetLocalAddress", _("Local IP address ( local/LAN )"), _("Allow to get the public IP Address of the computer."), _("Network"), "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::GetLocalAddress").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddAction("GenerateObjectNetworkId",
                       _("Generate objects' identifiers"),
                       _("Generate automatically identifiers for these objects.\nNote that this action must be preferably used at the start of the scene for example, so as to be sure objects\nhave the same unique identifiers on the different computers."),
                       _("Generate unique network identifiers for _PARAM0_"),
                       _("Automatism Automatic Network Updater"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("objectList", _("Object"))
            .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
            .SetFunctionName("NetworkAutomatism::GenerateObjectNetworkIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");

        #endif

        {
            gd::AutomatismMetadata & aut = AddAutomatism("NetworkAutomatism",
                  _("Automatic network update"),
                  _("NetworkUpdater"),
                  _("Allows to automatically synchronize the objects of a game on the network."),
                  "",
                  "CppPlatform/Extensions/networkicon32.png",
                  "NetworkAutomatism",
                  std::shared_ptr<gd::Automatism>(new NetworkAutomatism),
                  std::shared_ptr<gd::AutomatismsSharedData>(new SceneNetworkDatas));

            #if defined(GD_IDE_ONLY)
            aut.SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetAsSender",
                           _("Set to send data"),
                           _("The automatism will send the data of the objects.\nBe sure to have generated identifiers for these objects before."),
                           _("Set _PARAM0_ to send data"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("SetAsSender").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetAsReceiver",
                           _("Set to receive data"),
                           _("The automatism will receive the data and will update the objects.\nBe sure to have generated identifiers for these objects before."),
                           _("Set _PARAM0_ to receive data"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("SetAsReceiver").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetIdentifier",
                           _("Change object's identifier"),
                           _("Each object need a unique identifier, the same on all computers, so as to be identified and updated"),
                           _("Set identifier of _PARAM0_ to _PARAM2_"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .AddParameter("expression", _("Identifier"))
                .SetFunctionName("SetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddExpression("GetIdentifier", _("Get the identifier of the object"), _("Get the identifier of the object"), _("Automatism Automatic Network Updater"), "res/texteicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("GetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");
            #endif
        }

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };