public PointInfo(int _x, int _y, PointEnum _pointType, GameObject _go) { pointPos = new PointPos(_x, _y); pointType = _pointType; go = _go; if (go != null) { renderer = go.GetComponent <MeshRenderer>(); } }
public void UpdateCheck() { if (Input.GetKeyDown(KeyCode.Space)) { StartAStar(); } else if (Input.GetMouseButtonDown(0)) { GetPointByInput(Input.mousePosition); } else if (Input.GetKeyDown(KeyCode.BackQuote)) { nowState = PointEnum.Normal; } else if (Input.GetKeyDown(KeyCode.F1)) { nowState = PointEnum.Start; } else if (Input.GetKeyDown(KeyCode.F2)) { nowState = PointEnum.End; } else if (Input.GetKeyDown(KeyCode.F3)) { nowState = PointEnum.Hard; } else if (Input.GetKeyDown(KeyCode.F4)) { nowState = PointEnum.Cannot; } else if (Input.GetKeyDown(KeyCode.Escape)) { nowState = PointEnum.None; } else if (Input.GetKeyDown(KeyCode.F5)) { SpawnMapRandomPoint(true); } else if (Input.GetKeyDown(KeyCode.F8)) { PointFinding.IsEight = !PointFinding.IsEight; } else if (Input.GetKeyDown(KeyCode.Tab)) { foreach (var item in mapArray) { if (item.IsPass) { item.SwitchPassColor(); } } } }
/// <summary> /// MainGrid鼠标抬起事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_MouseUp(object sender, MouseButtonEventArgs e) { CurrentPoint = PointEnum.None; if (GlobalBorder.Width != 0 && GlobalBorder.Height != 0) { ToolPanel.Visibility = Visibility.Visible; if (GlobalBorder.Margin.Top + GlobalBorder.Height > windows.ActualHeight - 44 && GlobalBorder.Margin.Top >= 44) { ToolPanel.Margin = new Thickness(GlobalBorder.Margin.Left + GlobalBorder.Width - 160, GlobalBorder.Margin.Top - 42, windows.Width - (GlobalBorder.Margin.Left + GlobalBorder.Width), windows.Height - GlobalBorder.Margin.Top); } else if (GlobalBorder.Margin.Top + GlobalBorder.Height > windows.ActualHeight - 44 && GlobalBorder.Margin.Top < 44) { ToolPanel.Margin = new Thickness(GlobalBorder.Margin.Left + GlobalBorder.Width - 160, GlobalBorder.Margin.Top, windows.Width - (GlobalBorder.Margin.Left + GlobalBorder.Width), windows.Height - GlobalBorder.Margin.Top - 40); } else { ToolPanel.Margin = new Thickness(GlobalBorder.Margin.Left + GlobalBorder.Width - 160, GlobalBorder.Margin.Top + GlobalBorder.Height, windows.Width - (GlobalBorder.Margin.Left + GlobalBorder.Width), windows.Height - (GlobalBorder.Margin.Top + GlobalBorder.Height) - 45); } } ScopeFlag = true; }
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) { if (untypedValue == null) { serializer.Serialize(writer, null); return; } PointEnum value = (PointEnum)untypedValue; if (value == PointEnum.Transparent) { serializer.Serialize(writer, "transparent"); return; } throw new Exception("Cannot marshal type PointEnum"); }
private void GlobalBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MovePreviousPoint = e.GetPosition(MainGrid); Rect = new Rect(new Point(GlobalBorder.Margin.Left, GlobalBorder.Margin.Top), new Point(GlobalBorder.Margin.Left + GlobalBorder.ActualWidth, GlobalBorder.Margin.Top + GlobalBorder.ActualHeight)); CurrentPoint = PointEnum.Move; }
private void Anchor_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Rect = new Rect(new Point(GlobalBorder.Margin.Left, GlobalBorder.Margin.Top), new Point(GlobalBorder.Margin.Left + GlobalBorder.ActualWidth, GlobalBorder.Margin.Top + GlobalBorder.ActualHeight)); CurrentPoint = (PointEnum)(sender as FrameworkElement).Tag; }
private void Anchor_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { CurrentPoint = PointEnum.None; }
/// <summary> /// MainGrid鼠标离开事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_MouseLeave(object sender, MouseEventArgs e) { ScopeFlag = true; CurrentPoint = PointEnum.None; }
public void Reset() { PointType = PointEnum.Normal; IsPass = false; }