Exemplo n.º 1
0
        /// <summary>
        /// 自分のウィンドウハンドルが不確かならば探しなおす
        /// </summary>
        private void UpdateTargetWindow()
        {
            if (uniWinCore == null)
            {
                uniWinCore = new UniWinCore();
            }

            // ウィンドウがまだ取得できていなければ、取得の処理を行う
            if (!uniWinCore.IsActive)
            {
                uniWinCore.AttachMyWindow();

                // ウィンドウを取得できたら最初の値を設定
                if (uniWinCore.IsActive)
                {
                    uniWinCore.SetTransparentType(transparentType);
                    uniWinCore.SetKeyColor(keyColor);
                    SetTransparent(_isTransparent);
                    SetTopmost(_isTopmost);
                    SetClickThrough(_isClickThrough);
                    SetAllowDrop(_allowDropFiles);
                }
            }
            else
            {
                #if UNITY_EDITOR
                // エディタではゲームビューが閉じられたりドッキングされたりするため、変化していれば対象ウィンドウを変更
                // アクティブウィンドウが現在の対象と同じならばなにもおこらない
                uniWinCore.AttachMyActiveWindow();
                #endif
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 自分のウィンドウハンドルが不確かならば探しなおす
        /// </summary>
        private void UpdateTargetWindow()
        {
            if (_uniWinCore == null)
            {
                _uniWinCore = new UniWinCore();
            }

            // ウィンドウがまだ取得できていなければ、取得の処理を行う
            if (!_uniWinCore.IsActive)
            {
                _uniWinCore.AttachMyWindow();

                // ウィンドウを取得できたら最初の値を設定
                if (_uniWinCore.IsActive)
                {
                    _uniWinCore.SetTransparentType((UniWinCore.TransparentType)transparentType);
                    _uniWinCore.SetKeyColor(keyColor);
                    _uniWinCore.SetAlphaValue(_alphaValue);
                    SetTransparent(_isTransparent);
                    if (_isBottommost)
                    {
                        SetBottommost(_isBottommost);
                    }
                    else
                    {
                        SetTopmost(_isTopmost);
                    }
                    SetZoomed(_isZoomed);
                    SetClickThrough(_isClickThrough);
                    SetAllowDrop(_allowDropFiles);

                    // ウィンドウ取得時にはモニタ変更と同等の処理を行う
                    OnMonitorChanged?.Invoke();
                }
            }
            else
            {
                #if UNITY_EDITOR
                // エディタではゲームビューが閉じられたりドッキングされたりするため、変化していれば対象ウィンドウを変更
                // アクティブウィンドウが現在の対象と同じならばなにもおこらない
                _uniWinCore.AttachMyActiveWindow();
                #endif
            }
        }