Click or drag to resize

SFSEventMMOITEM_VARIABLES_UPDATE Field

Dispatched when an MMOItem Variable is updated in an MMORoom.

Namespace:  Sfs2X.Core
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.7.11.0 (1.7.11)
Syntax
C#
public static readonly string MMOITEM_VARIABLES_UPDATE

Field Value

Type: String
Remarks
This event is caused by an MMOItem Variable being set, updated or deleted in a server side Extension, and it is received only if the current user has the related MMOItem in his Area of Interest.

The Params object contains the following parameters:

ParameterDescription
room(MMORoom) The MMORoom where the MMOItem whose Variables have been updated is located.
mmoItem(MMOItem) The MMOItem whose variables have been updated.
changedVars(List<string>) The list of names of the MMOItem Variables that were changed (or created for the first time).
Examples
The following example shows how to handle the MMOItem Variable update:
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.MMOITEM_VARIABLES_UPDATE, OnMMOItemVarsUpdate);
}

void OnMMOItemVarsUpdate(BaseEvent evt) {
    var changedVars = (List<String>)evt.Params["changedVars"];
    var item = (IMMOItem) evt.Params["mmoItem"];

    // Check if the MMOItem was moved
    if (changedVars.Contains("x") || changedVars.Contains("y"))
    {
        // Move the sprite representing the MMOItem
        ...
    }
}
See Also