private static void JSEditorSelect(string _activity, string _params) { string uuid = ""; try { JSONNode root = JSON.Parse(_params); uuid = root["uuid"].Value; } catch (System.Exception e) { onNotify("Parse json has error: " + e.Message); } GameObject go = ResourceMgr.FindGameObject(uuid); if (null == go) { onNotify(string.Format("{0} is not exists", uuid)); return; } Battlehub.RTEditor.RuntimeSelection.activeObject = go; Battlehub.RTEditor.RuntimeEditor.Instance.SceneView.Focus(); Battlehub.RTHandles.RuntimeTools.CameraEuler = Battlehub.RTHandles.RuntimeCameraEuler.Target; Battlehub.RTHandles.RuntimeTools.Current = Battlehub.RTHandles.RuntimeTool.Move; }
private static void JSAlignGameObject(string _activity, string _params) { try { JSONNode root = JSON.Parse(_params); string uuid = root["uuid"].Value; GameObject go = ResourceMgr.FindGameObject(uuid); if (null == go) { onNotify("GameObject " + uuid + " is not exists!"); return; } CameraMgr.Align(go.transform); } catch (System.Exception e) { onNotify("Parse json has error: " + e.Message); } }
public static void Execute(Dictionary <string, string> _params, ActionDelegate _onFinish) { string targetGameObject = ""; if (!_params.TryGetValue("targetgameobject", out targetGameObject)) { Log.Error("LookFromPosition", "need params targetgameobject"); return; } string x = ""; if (!_params.TryGetValue("x", out x)) { Log.Error("LookFromPosition", "need params x"); return; } string y = ""; if (!_params.TryGetValue("y", out y)) { Log.Error("LookFromPosition", "need params y"); return; } string z = ""; if (!_params.TryGetValue("z", out z)) { Log.Error("LookFromPosition", "need params z"); return; } string duration = ""; if (!_params.TryGetValue("duration", out duration)) { Log.Error("LookFromPosition", "need params time"); return; } Vector3 position = new Vector3(float.Parse(x), float.Parse(y), float.Parse(z)); float time = float.Parse(duration); try { GameObject go = null; if (targetGameObject.Equals("camera")) { go = CameraMgr.GetMainCamera(); } else { go = ResourceMgr.FindGameObject(targetGameObject); } if (go != null) { lookFrom(go, position, time, () => { _onFinish(); return; }); } else { Log.Error("LookFromPosition", "[{0}] GameObject is not exist...", targetGameObject); } } catch (System.Exception e) { Log.Error("LookFromPosition", "Parse json has error: " + e.Message); } }