Ejemplo n.º 1
0
        /// <summary>
        /// Unity callback that is invoked before the first frame update.
        /// Here we initialize drag-and-drop, parse command line arguments,
        /// and start the initial glTF model import (if any).
        /// </summary>
        void Start()
        {
            // Drag-and-drop code that only works correctly
            // in Windows standalone builds. See the README at:
            // https://github.com/Bunny83/UnityWindowsFileDrag-Drop
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR_WIN
            UnityDragAndDropHook.InstallHook();
            UnityDragAndDropHook.OnDroppedFiles += OnDropFiles;
#endif

            Gui.Instance.DefaultFooterMessage
                = "drag .gltf/.glb/.zip onto window to view";
            Gui.Instance.ResetFooterMessage();

            // By default, the Windows Unity Player will pause
            // execution when it loses focus.  Setting
            // `Application.runInBackground` to true overrides
            // this behaviour and tells it to keep running
            // always.
            //
            // The player must be continuously running in
            // order for drag-and-drop of files to work in
            // an intuitive manner.  Otherwise, dropping
            // a .gltf/.glb file onto a non-focused player
            // window will not immediately trigger an import,
            // and the user will have to additionally click
            // the window to give it focus again, before the
            // glTF import will start running.

            Application.runInBackground = true;
        }
Ejemplo n.º 2
0
 private void OnEnable()
 {
     // must be created on the main thread to get the right thread id.
     _hook = new UnityDragAndDropHook();
     _hook.InstallHook();
     _hook.OnDroppedFiles += OnFiles;
 }
Ejemplo n.º 3
0
 void Start()
 {
     // must be created on the main thread to get the right thread id.
     hook = new UnityDragAndDropHook();
     hook.InstallHook();
     hook.OnDroppedFiles += OnFiles;
 }
Ejemplo n.º 4
0
 void OnEnable()
 {
     // must be installed on the main thread to get the right thread id.
     UnityDragAndDropHook.InstallHook();
     UnityDragAndDropHook.OnDroppedFiles += OnFiles;
     enabled = true;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Unity callback that is invoked before the first frame update.
        /// Here we initialize drag-and-drop, parse command line arguments,
        /// and start the initial glTF model import (if any).
        /// </summary>
        void Start()
        {
            _dragAndDropHook = new UnityDragAndDropHook();
            _dragAndDropHook.InstallHook();
            _dragAndDropHook.OnDroppedFiles += OnDropFiles;

            Gui.Instance.DefaultFooterMessage
                = "drag .gltf/.glb/.zip onto window to view";
            Gui.Instance.ResetFooterMessage();

            // By default, the Windows Unity Player will pause
            // execution when it loses focus.  Setting
            // `Application.runInBackground` to true overrides
            // this behaviour and tells it to keep running
            // always.
            //
            // The player must be continuously running in
            // order for drag-and-drop of files to work in
            // an intuitive manner.  Otherwise, dropping
            // a .gltf/.glb file onto a non-focused player
            // window will not immediately trigger an import,
            // and the user will have to additionally click
            // the window to give it focus again, before the
            // glTF import will start running.

            Application.runInBackground = true;

            ParseCommandLineArgs();
        }
Ejemplo n.º 6
0
 void OnEnable()
 {
     // must be created on the main thread to get the right thread id.
     hook = new UnityDragAndDropHook();
     hook.InstallHook();
     hook.OnDroppedFiles            += OnFiles;
     Application.logMessageReceived += HandleLog;
 }
Ejemplo n.º 7
0
        void Start()
        {
            UnityDragAndDropHook.InstallHook();
            UnityDragAndDropHook.OnDroppedFiles += OnFilesDropped;

            _notificationDisplayer = FindObjectOfType <TemporaryNotificationDisplayer>();
            _uriConverter          = new FilePathConverter();
        }
Ejemplo n.º 8
0
        protected override void OnEnable()
        {
        #if UNITY_STANDALONE_WIN && !UNITY_EDITOR
            UnityDragAndDropHook.InstallHook();
            UnityDragAndDropHook.OnDroppedFiles += LoadDropPaths;
        #endif

            base.OnEnable();
        }
Ejemplo n.º 9
0
    void OnEnable()
    {
        // must be created on the main thread to get the right thread id.
        hook = new UnityDragAndDropHook();
        hook.InstallHook();
        hook.OnDroppedFiles += OnFiles;
        var binding = time_line.playableAsset.outputs.First(c => c.streamName == "MoveRoot");

        time_line.SetGenericBinding(binding.sourceObject, move_root);
        SetTimeline();
    }
Ejemplo n.º 10
0
    void Start()
    {
        if (defaultArtwork != null)
        {
            defaultArtworkData = Convert.ToBase64String(defaultArtwork.EncodeToPNG());
            SetSpriteToImage(newArtworkField, defaultArtworkData);
        }

        // must be created on the main thread to get the right thread id.
        hook = new UnityDragAndDropHook();
        hook.InstallHook();
        hook.OnDroppedFiles += OnFiles;
    }
Ejemplo n.º 11
0
 // important to keep the instance alive while the hook is active.
 void Start()
 {
     if (!isAdministrator)
     {
         ReStartAs();
     }
     else
     {
         Debug.Log("管理员");
         // must be created on the main thread to get the right thread id.
         hook = new UnityDragAndDropHook();
         hook.InstallHook();
         hook.OnDroppedFiles += OnFiles;
     }
 }
Ejemplo n.º 12
0
    void Awake()
    {
        instance = this;

        _hwnd = FindWindow(null, UnityEngine.Application.productName);
        UnityDragAndDropHook.InstallHook(_hwnd);
        UnityDragAndDropHook.OnDroppedFiles += OpenDragFile;

        if (UnityEngine.Application.isEditor)
        {
            return;
        }


        //  UnityEngine.Screen.fullScreen = false;

        //SetWindowLong(_hwnd, GWL_EXSTYLE, WS_EX_LAYERED);
        //int intExTemp = GetWindowLong(_hwnd, GWL_EXSTYLE);

        //SetWindowLong(_hwnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);
        //SetWindowLong(_hwnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT);


        SetWindowLong(_hwnd, GWL_EXSTYLE, WS_EX_LAYERED);
        int intExTemp = GetWindowLong(_hwnd, GWL_EXSTYLE);

        SetWindowLong(_hwnd, GWL_EXSTYLE, intExTemp | WS_EX_TRANSPARENT | WS_EX_LAYERED);

        SetWindowLong(_hwnd, GWL_STYLE, GetWindowLong(_hwnd, GWL_STYLE) & ~WS_BORDER & ~WS_CAPTION);

        int currentX = UnityEngine.Screen.currentResolution.width / 2 - winWidth / 2;
        int currentY = UnityEngine.Screen.currentResolution.height / 2 - winHeight / 2;

        SetWindowPos(_hwnd, (int)currentTopType, currentX, currentY, winWidth, winHeight, SWP_SHOWWINDOW);

        var margins = new MARGINS()
        {
            cxLeftWidth = -1
        };

        DwmExtendFrameIntoClientArea(_hwnd, ref margins);
    }
Ejemplo n.º 13
0
 private void Start()
 {
     _hook = new UnityDragAndDropHook();
     _hook.InstallHook();
     _hook.OnDroppedFiles += OnFiles;
 }
Ejemplo n.º 14
0
 void OnEnable()
 {
     UnityDragAndDropHook.InstallHook();
     UnityDragAndDropHook.OnDroppedFiles += OnFiles;
 }
Ejemplo n.º 15
0
 private void OnEnable()
 {
     m_DragAndDropHook = new UnityDragAndDropHook();
     m_DragAndDropHook.InstallHook();
     m_DragAndDropHook.OnDroppedFiles += OnDroppedFiles;
 }
Ejemplo n.º 16
0
 protected void OnEnable()
 {
     UnityDragAndDropHook.InstallHook();
     UnityDragAndDropHook.OnDroppedFiles += FilesDropped;
 }
Ejemplo n.º 17
0
 void OnEnable()
 {
     UnityDragAndDropHook.InstallHook();
     UnityDragAndDropHook.OnDroppedFiles += onDragDrop;
     shortcutManager.current.OpenFile    += openImage;
 }
Ejemplo n.º 18
0
 public static void StartDragAndDrop()
 {
     dragAndDropHook.OnDroppedFiles += OnFilesDragDropped;
     dragAndDropHook.InstallHook();
 }