public void cellCall(string methodname, params object[] arguments)
{
if(KBEngineApp.app.currserver == "loginapp")
{
Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "), currserver=!" + KBEngineApp.app.currserver);
return;
}
Method method = null;
if(!EntityDef.moduledefs[className].cell_methods.TryGetValue(methodname, out method))
{
Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "), not found method!");
return;
}
UInt16 methodID = method.methodUtype;
if(arguments.Length != method.args.Count)
{
Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "): args(" + (arguments.Length) + "!= " + method.args.Count + ") size is error!");
return;
}
if(cellMailbox == null)
{
Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "): no cell!");
return;
}
cellMailbox.newMail();
cellMailbox.bundle.writeUint16(methodID);
try
{
for(var i=0; i<method.args.Count; i++)
{
if(method.args[i].isSameType(arguments[i]))
{
method.args[i].addToStream(cellMailbox.bundle, arguments[i]);
}
else
{
throw new Exception("arg" + i + ": " + method.args[i].ToString());
}
}
}
catch(Exception e)
{
Dbg.ERROR_MSG(className + "::cellCall(" + methodname + "): args is error(" + e.Message + ")!");
cellMailbox.bundle = null;
return;
}
cellMailbox.postMail(null);
}