Ejemplo n.º 1
0
 private void onPathChanged(string Path)
 {
     if (OnPathChanged != null)
     {
         OnPathChanged.Invoke(Path, EventArgs.Empty);
     }
 }
Ejemplo n.º 2
0
        private void OnInputEnd()
        {
            if (!sessionController.IsRunning)
            {
                return;
            }

            OnStopRaycasting?.Invoke();
            path.Clear();
            OnPathChanged?.Invoke(path);
        }
Ejemplo n.º 3
0
        private void _createNewButton_Click(object sender, EventArgs e)
        {
            var asset = _controlForm.CreateAndSaveEmptyAsset(false);

            if (asset == null)
            {
                return;
            }

            _path.Text = asset.AssetFilePath;
            OnPathChanged?.Invoke(this, new EventArgs());

            EditAsset();
        }
Ejemplo n.º 4
0
        public void OpenPathDialog()
        {
            SaveFileDialog saveFileDialog;

            saveFileDialog = new SaveFileDialog();

            saveFileDialog.InitialDirectory = @"C:\";

            if (saveFileDialog.ShowDialog() == true)
            {
                OnPathChanged?.Invoke(this, new PathDialogEventArgs {
                    Path = saveFileDialog.FileName
                });
            }
        }
Ejemplo n.º 5
0
        private void OnInputStay()
        {
            if (!sessionController.IsRunning)
            {
                return;
            }

            var cameraPosition = camera.ScreenToWorldPoint(inputModule.InputPosition);

            hit = Physics2D.Raycast(transform.position, new Vector3(cameraPosition.x, cameraPosition.y, transform.position.z) - transform.position);
            if (hit)
            {
                if (hit.collider && hit.collider.gameObject.CompareTag(BUBBLE_TAG))
                {
                    ProceedBubbleRaycastHit(hit);
                    path.Clear();
                    path.Add(transform.position);
                    path.Add(hit.point);
                    OnPathChanged?.Invoke(path);
                }
                else if (hit.transform.gameObject.CompareTag(WALL_TAG))
                {
                    var offset          = hit.point.x > transform.position.x ? -0.01f : 0.01f;
                    var reflectedOrigin = new Vector3(hit.point.x + offset, hit.point.y, transform.position.z);
                    var reflectedY      = 2 * (reflectedOrigin.y - transform.position.y) + transform.position.y;

                    wallHit = Physics2D.Raycast(reflectedOrigin, new Vector3(transform.position.x, reflectedY, transform.position.z) - reflectedOrigin);

                    if (wallHit.collider && wallHit.collider.CompareTag(BUBBLE_TAG))
                    {
                        ProceedBubbleRaycastHit(wallHit);
                        path.Clear();
                        path.Add(transform.position);
                        path.Add(hit.point);
                        path.Add(wallHit.point);
                        OnPathChanged?.Invoke(path);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            var path = _controlForm.SelectAssetFileFromBrowser();

            if (path == null)
            {
                return;
            }

            try
            {
                var asset = LoadableAsset <TAsset> .LoadFromFile(path);

                _path.Text = asset.AssetFilePath;
                OnPathChanged?.Invoke(this, new EventArgs());
                EditAsset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "-" + ex.StackTrace, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 7
0
        public bool VerifySettings(out List <string> errors)
        {
            // Code execute when user decides to confirm changes made since BeginEdit was called.
            // Executed before EndEdit is called and EndEdit is not called if false is returned.
            // List of errors is presented to user if verification fails.
            var tempShortcutPath = plugin.settingsView.PathTextBox.Text;
            var bt = plugin.settingsView.SelectFolderButton;

            bt.Click -= Bt_Click;
            errors    = new List <string>();
            try
            {
                Directory.CreateDirectory(tempShortcutPath);
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                return(false);
            }
            // Check whether user has write persmission to the selected folder
            try
            {
                var ac = Directory.GetAccessControl(tempShortcutPath);
            }
            catch (UnauthorizedAccessException)
            {
                errors.Add("The selected folder cannot be written to. Please select another folder.");
                return(false);
            }
            ShortcutSync.logger.Info($"Verified Settings. Old {ShortcutPath}. New {tempShortcutPath}");
            if (ShortcutPath != tempShortcutPath)
            {
                OnPathChanged?.Invoke(ShortcutPath, tempShortcutPath);
                ShortcutPath = tempShortcutPath;
            }
            return(true);
        }
Ejemplo n.º 8
0
 public void ResetPath()
 {
     currentPathLength = 0;
     path.Clear();
     OnPathChanged?.Invoke(path);
 }
Ejemplo n.º 9
0
 private void AddPointToPath(Vector3 newPathPosition)
 {
     path.Add(newPathPosition);
     lastPoint = newPathPosition;
     OnPathChanged?.Invoke(path);
 }
Ejemplo n.º 10
0
 private void SetPath(Queue <Point> path)
 {
     Path = path;
     OnPathChanged?.Invoke();
 }
Ejemplo n.º 11
0
 private void _clearButton_Click(object sender, EventArgs e)
 {
     _path.Text = string.Empty;
     OnPathChanged?.Invoke(this, new EventArgs());
 }