void Awake() { ReInput.ControllerConnectedEvent += OnControllerConnected; currentScene.ChangeState(SceneManager.GetActiveScene().name); inputs = inputs.FindAllPlayersWithJoystick(); trasition = GetComponent <CoreView>(); }
//! 查找指定Tag的图形对象ID public int FindShapeByTag(int tag) { int doc = CoreView.acquireFrontDoc(); int sid = CoreView.findShapeByTag(doc, tag); GiCoreView.releaseDoc(doc); return(sid); }
//! 视图坐标转为模型坐标 public bool DisplayToModel(Point pt) { Floats p = new Floats((float)pt.X, (float)pt.Y); bool ret = CoreView.displayToModel(p); pt.X = p.get(0); pt.Y = p.get(1); return(ret); }
//! 视图坐标转为模型坐标 public bool DisplayToModel(Rect rect) { Floats p = new Floats((float)rect.Left, (float)rect.Top, (float)rect.Right, (float)rect.Bottom); bool ret = CoreView.displayToModel(p); rect.X = p.get(0); rect.Y = p.get(1); rect.Width = p.get(2) - rect.X; rect.Height = p.get(3) - rect.Y; return(ret); }
//! 保存图形到JSON文件 public bool Save(string vgfile) { try { var dir = new DirectoryInfo(vgfile).Parent; if (!dir.Exists) { dir.Create(); } } catch (IOException) { return(false); } return(CoreView.saveToFile(vgfile)); }
//! 开始Undo录制 public bool StartUndoRecord(string path) { if (CoreView.isUndoRecording()) { return(false); } try { var dir = new DirectoryInfo(path); if (dir.Exists) { dir.Delete(true); } dir.Create(); } catch (IOException) { return(false); } return(CoreView.startRecord(path, CoreView.acquireFrontDoc(), true, WPFGraphView.getTick())); }
//! 放缩显示指定范围到视图区域 public bool ZoomToModel(float x, float y, float w, float h, float margin) { return(CoreView.zoomToModel(x, y, w, h, margin)); }
//! 指定名称和JSON串参数,启动命令 public bool SetCommand(string name, string param) { return(CoreView.setCommand(name, param)); }
//! 重做 public bool Redo() { return(CoreView.redo(ViewAdapter)); }
//! 能否重做 public bool CanRedo() { return(CoreView.canRedo()); }
//! 停止录屏 public void StopRecord() { CoreView.stopRecord(false); }
//! 返回已录制的相对毫秒数 public int GetRecordTicks() { return(CoreView.getRecordTick(false, WPFGraphView.getTick())); }
//! 是否正在录屏 public bool IsRecording() { return(CoreView.isRecording()); }
//! 清除当前视图区域内的未锁定的图形 public void EraseView() { CoreView.setCommand("erasewnd"); }
//! 清除所有图形,含锁定的图形 public void Clear() { CoreView.clear(); }
//! 图形向右上平移显示,像素单位 public bool ZoomPan(float dxPixel, float dyPixel) { return(CoreView.zoomPan(dxPixel, dyPixel)); }
//! 从JSON文件中加载图形 public bool Load(string vgfile) { return(CoreView.loadFromFile(vgfile)); }
//! 切换到下一命令 public bool SwitchCommand() { return(CoreView.switchCommand()); }
//! 从JSON文件中只读加载图形 public bool Load(string vgfile, bool readOnly) { return(CoreView.loadFromFile(vgfile, readOnly)); }
//! 当前是否为指定名称的命令 public bool isCommand(string name) { return(CoreView.isCommand(name)); }
//! 清除所有图形 public void ClearShapes() { CoreView.clear(); }
//! 导出静态图形到SVG文件 public bool ExportSVG(string filename) { return(CoreView.exportSVG(ViewAdapter, filename) > 0); }
//! 停止Undo录制 public void StopUndoRecord() { CoreView.stopRecord(true); }
//! 放缩显示全部内容到视图区域 public bool ZoomToExtent() { return(CoreView.zoomToExtent()); }
//! 撤销 public bool Undo() { return(CoreView.undo(ViewAdapter)); }
//! 放缩显示全部内容到视图区域 public bool ZoomToExtent(float margin) { return(CoreView.zoomToExtent(margin)); }
//! 返回内核视图的句柄, MgView 指针 public int CmdViewHandle() { return(CoreView.viewAdapterHandle()); }
//! 添加测试图形 public int AddShapesForTest() { return(CoreView.addShapesForTest()); }
//! 放缩显示指定范围到视图区域 public bool ZoomToModel(float x, float y, float w, float h) { return(CoreView.zoomToModel(x, y, w, h)); }
//! 放缩显示指定范围到视图区域 public bool ZoomToModel(Rect rect) { return(CoreView.zoomToModel((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height)); }