private void onSelectNode(T node) { if (SelectNode != null) { SelectNode.Invoke(node); } }
private void SetView(MapViewForm TView, MoveNodeForm moveForm) { TView.Add(moveForm); TView.MouseDown = (b) => { if (b == 2) { rotCam = true; return; } if (b == 1) { MoveCam = true; return; } Console.WriteLine("MX:" + mX + " MY:" + mY); AppInfo.RW = W; AppInfo.RH = H; if (Mode == EditMode.Pick) { var pn = TView.PickObj(mX, mY); if (pn != null) { if (pn is Vivid.Scene.GraphMarker) { ActiveNode = pn; TView.ActiveNode = pn; TView.SetActiveSprite(); moveForm.SetNode(TView.ActiveNode); moveForm.Set((int)TView.ActiveNodeSprite.DrawP[0].X, (int)TView.ActiveNodeSprite.DrawP[0].Y, 64, 64); // Console.WriteLine("Set PN"); Selected?.Invoke(pn); } else if (pn is Vivid.Scene.GraphLight) { ActiveNode = pn; TView.ActiveNode = pn; TView.SetActiveSprite(); moveForm.SetNode(TView.ActiveNode); moveForm.Set((int)TView.ActiveNodeSprite.DrawP[0].X, (int)TView.ActiveNodeSprite.DrawP[0].Y, 64, 64); // Console.WriteLine("Set PN"); Selected?.Invoke(pn); } else { Selected?.Invoke(pn); // Console.WriteLine("nope"); } } else { Console.WriteLine("No obj"); } } MouseIn = true; var hz = ONode; // TView.Graph.Pick(lx, ly); if (hz != null) { } }; TView.MouseWheelMoved = (z) => { TView.Graph.Z += ((z * 0.1f) * TView.Graph.Z); }; TView.MouseUp = (b) => { if (b == 2) { rotCam = false; return; } if (b == 1) { MoveCam = false; return; } MouseIn = false; }; TView.MouseMove = (x, y, dx, dy) => { mX = x; mY = y; if (rotCam) { TView.Graph.Rot += dx; } if (MoveCam) { TView.Graph.Move(-dx, -dy); //TView.Graph.X -= dx; // TView.Graph.Y -= dy; } lx = x; ly = y; if (TView.Graph != null) { AppInfo.RW = TView.MapFrame.IW; AppInfo.RH = TView.MapFrame.IH; var node = TView.Graph.Pick(x, y); AppInfo.RW = AppInfo.W; AppInfo.RH = AppInfo.H; if (node != null) { ONode = node; if (MouseIn) { switch (Mode) { case EditMode.Paste: TView.Map.Layers[EditZ].SetTile(node.TileX, node.TileY, TileBrowser.ActiveTile); //TView.UpdateGraph(); break; case EditMode.Fill: TView.Map.Layers[EditZ].Fill(TileBrowser.ActiveTile); break; case EditMode.Pick: break; } } var tView = TView; TView.Map.HL.Clear(); TView.Map.HighlightTile(node.TileX, node.TileY); TView.UpdateGraph(); if (TView.ActiveNodeSprite != null) { // TView.ActiveNodeSprite.SyncCoords(); if (TView.ActiveNodeSprite.DrawP != null) { moveForm.Set((int)TView.ActiveNodeSprite.DrawP[0].X, (int)TView.ActiveNodeSprite.DrawP[0].Y, 64, 64); // TView.Graph.X = -32 + TView.W / 2; } } // TView.Graph.Y = -32 + TView.H / 2; // Console.WriteLine("MX:" + x + " MY:" + y); } else { ClearHL(TView); } } }; }