private async void Window_Loaded(object sender, RoutedEventArgs e) { if (ColumnLocal.ActualWidth > (this.ActualWidth - 15.0)) { ColumnLocal.Width = new GridLength(this.ActualWidth - 15.0); } this.PreviewMouseUp += new MouseButtonEventHandler(window_PreviewMouseUp); this.Drop += new DragEventHandler(window_Drop); this.Closing += new CancelEventHandler(Window_Closing); this.GiveFeedback += new GiveFeedbackEventHandler(window_GiveFeedback); ClientHelper.Owner = this; ClientHelper.OnLock += new ClientHelper.ClientHandler(Lock); ClientHelper.OnUnLock += new ClientHelper.ClientHandler(UnLock); ClientHelper.OnConnecting += new ClientHelper.StateHandler(Connecting); ClientHelper.OnConnected += new ClientHelper.StateHandler(Connected); ClientHelper.OnDisconnected += new ClientHelper.StateHandler(Disconnected); ButtonServerConnect.Focus(); SetPhrases(); DragThumb.Set(this); await setLocalList(LocalHelper.Home); LocalHelper.OnListChanged += new LocalHelper.DirectoryHandler(localListChanged); TaskbarHelper.MainTaskbar = MainTaskbar; AppMessage.Set(DetailList); DetailList.ItemsSource = AppMessage.Items; LabelServerTime.DataContext = ClientHelper.Counts; LabelServerCount.DataContext = ClientHelper.Counts; ((INotifyPropertyChanged)(ServerList.View as GridView).Columns[0]).PropertyChanged += new PropertyChangedEventHandler(WidthPropertyChanged); hideServerToolbarAnimation.Completed += new EventHandler(hideServerToolbarAnimationCompleted); ServerItemsToolbarAnimation.Freeze(); hideServerToolbarAnimation.Freeze(); DragSelection.Register(this, LocalList, 0.0, 0.0, "ListBoxItem"); DragSelection.Register(this, ServerList, 0.0, 20.0, "ListViewItem"); DragWatcher.Source = "PlusFTP.DragItems"; DragWatcher.OnDraged += new DragWatcher.DragWatcherHandler(DragWatcher_Draged); AppLanguage.OnUpdated += new AppLanguage.UpdatedHandler(LanguageUpdated); CryptoHashing.Password = "******"; VersionHelper.AppUrlHomePage = "http://PlusFTP.com/"; VersionHelper.VersionUrl = "http://PlusFTP.com/v"; VersionHelper.NewAppUrl = "http://PlusFTP.com/download/"; if (AppSettings.Get("App", "CheckVersion", true) && (bool)await VersionHelper.Check()) { NewVersionWindow.Initialize(this); } }
void Update() { if (Mesh.isVisible && Input.GetMouseButton(0) && !_unit.IsDead) { var camPos = Camera.main.WorldToScreenPoint(transform.position); camPos.y = DragSelection.InvertMouseY(camPos.y); if (DragSelection.SelectionBox.Contains(camPos)) { if (!_unitManager.GetSelectedUnits().Contains(_unit)) { _unitManager.SelectAditionalUnit(_unit); } } else { if (_unitManager.GetSelectedUnits().Contains(_unit)) { _unitManager.DeselectSingleUnit(_unit); } } } }
private static void DoSelection(Rect rect) { if (!Preferences.EnhancedSelection || Event.current.button != 1) { DragSelection = null; return; } using (ProfilerSample.Get()) { rect.xMin = 0f; switch (Event.current.type) { case EventType.MouseDrag: if (!IsFirstVisible) { return; } if (DragSelection == null) { DragSelection = new List <Object>(); SelectionStart = Event.current.mousePosition; SelectionRect = new Rect(); } SelectionRect = new Rect() { xMin = Mathf.Min(Event.current.mousePosition.x, SelectionStart.x), yMin = Mathf.Min(Event.current.mousePosition.y, SelectionStart.y), xMax = Mathf.Max(Event.current.mousePosition.x, SelectionStart.x), yMax = Mathf.Max(Event.current.mousePosition.y, SelectionStart.y) }; if (Event.current.control || Event.current.command) { DragSelection.AddRange(Selection.objects); } Selection.objects = DragSelection.ToArray(); Event.current.Use(); break; case EventType.MouseUp: if (DragSelection != null) { Event.current.Use(); } DragSelection = null; break; case EventType.Repaint: if (DragSelection == null || !IsFirstVisible) { break; } Rect scrollRect; if (Event.current.mousePosition.y > FinalRect.y) { scrollRect = FinalRect; scrollRect.y += scrollRect.height; } else if (Event.current.mousePosition.y < RawRect.y) { scrollRect = RawRect; scrollRect.y -= scrollRect.height; } else { break; } SelectionRect = new Rect() { xMin = Mathf.Min(scrollRect.xMax, SelectionStart.x), yMin = Mathf.Min(scrollRect.yMax, SelectionStart.y), xMax = Mathf.Max(scrollRect.xMax, SelectionStart.x), yMax = Mathf.Max(scrollRect.yMax, SelectionStart.y) }; if (Event.current.control || Event.current.command) { DragSelection.AddRange(Selection.objects); } Selection.objects = DragSelection.ToArray(); GUI.ScrollTowards(scrollRect, 9f); EditorApplication.RepaintHierarchyWindow(); break; case EventType.Layout: if (DragSelection != null && IsGameObject) { if (!SelectionRect.Overlaps(rect) && DragSelection.Contains(CurrentGameObject)) { DragSelection.Remove(CurrentGameObject); } else if (SelectionRect.Overlaps(rect) && !DragSelection.Contains(CurrentGameObject)) { DragSelection.Add(CurrentGameObject); } } break; } } }