Skip to content

Communication with Oege

I (marwan) made a class to communicate with Oege, while taking threads into account. I’ve abstracted the complicated stuff so it should be easy to use.

To do: add link to Doxygen documentation.

Sending a query

To send a query, you can use the Oege.SendCurrentQuery method. You do not need to provide the full address, just the path of the php file on the server, relative to the Micro Mayhem directory.

Example:

void Example() {
  Oege.SendCurrentQuery("test.php");
}

Passing arguments

All of the arguments are contained in a static dictionary called Oege.CurrentQuery. To use it, call the Add method on it with the parameter name and then value like so:

void Example() {
  Oege.CurrentQuery.Add("param_name", "value");
  Oege.SendCurrentQuery("test.php");
}

You can add as many arguments as you want, before sending the query. Once the query is sent, the argument list will be reset automatically.

Executing logic after response

If you want to execute something when you get a response from the server, you can pass an HttpRequestCallback delegate as an additional argument.

HttpRequestCallback takes a string parameter.

void Example() {
  Oege.SendCurrentQuery("test.php", PrintResponse);
}

void PrintResponse(string response) {
  Debug.Log(response);
}

The response will always be executed on the main Unity thread, so you can use mess with Unity safely.

Where to put the php files?

You need the password to the server for that, but once you have it it’s in ~esseghm/micro_mayhem/


Last update: June 6, 2023