public static void Execute(Dictionary <string, string> _params, ActionDelegate _onFinish) { string uuid = ""; if (!_params.TryGetValue("uuid", out uuid)) { Log.Error("RotateAgent", "need params uuid"); return; } string x = ""; if (!_params.TryGetValue("x", out x)) { Log.Error("RotateAgent", "need params x"); return; } string y = ""; if (!_params.TryGetValue("y", out y)) { Log.Error("RotateAgent", "need params y"); return; } string z = ""; if (!_params.TryGetValue("z", out z)) { Log.Error("RotateAgent", "need params z"); return; } float _x = float.Parse(x); float _y = float.Parse(y); float _z = float.Parse(z); try { AgentMgr.Rotate(uuid, _x, _y, _z, (_err) => { Log.Error("RotateAgent", _err); }); _onFinish(); } catch (System.Exception e) { Log.Error("RotateAgent", "Parse json has error: " + e.Message); } }
private static void JSRotateAgent(string _activity, string _params) { try { JSONNode root = JSON.Parse(_params); string uuid = root["uuid"].Value; float x = root["x"].AsFloat; float y = root["y"].AsFloat; float z = root["z"].AsFloat; AgentMgr.Rotate(uuid, x, y, z, (_err) => { onNotify(_err); }); } catch (System.Exception e) { onNotify("Parse json has error: " + e.Message); } }