// Update is called once per frame void Update() { if (winTex == null) { winTex = GetComponent <uWindowCapture.UwcWindowTexture>(); } if (winTex.window != null) { //画面比率を更新。動的にモニタの縦横比が変わることがあるため Width = winTex.window.width; Height = winTex.window.height; var nowaspect = Width / Height; if (aspect != nowaspect) { aspect = nowaspect; var width = startScale.x; var height = startScale.x / aspect; if (height > startScale.y) { width = startScale.y * aspect; height = startScale.y; } if (!float.IsNaN(width + height)) { transform.localScale = new Vector3(width, height, 1); } } } }
void AddWindow() { var manager = list.windowTextureManager; windowTexture = manager.AddWindowTexture(window); image_.color = selected; }
void MoveAndScaleChildWindow(UwcWindowTexture child) { var window = child.window; var parent = window.parentWindow; var px = parent.x; var py = parent.y; var pw = parent.width; var ph = parent.height; var cx = window.x; var cy = window.y; var cw = window.width; var ch = window.height; var dz = windowTexture_.childWindowZDistance; var desktopX = (cw - pw) * 0.5f + (cx - px); var desktopY = (ch - ph) * 0.5f + (cy - py); var localX = desktopX / parent.width; var localY = -desktopY / parent.height; var localZ = dz * (window.zOrder - window.parentWindow.zOrder) / transform.localScale.z; child.transform.localPosition = new Vector3(localX, localY, localZ); var widthRatio = 1f * window.width / window.parentWindow.width; var heightRatio = 1f * window.height / window.parentWindow.height; child.transform.localScale = new Vector3(widthRatio, heightRatio, 1f); }
public UwcWindowTexture Get(int id) { UwcWindowTexture window = null; windows.TryGetValue(id, out window); return(window); }
public void RemoveWindow() { var manager = list.windowTextureManager; manager.RemoveWindowTexture(window); windowTexture = null; image_.color = notSelected; }
void OnDisable() { UwcManager.onWindowAdded.RemoveListener(OnWindowAdded); UwcManager.onWindowAdded.RemoveListener(OnWindowRemoved); if (texture_) { texture_.window = null; texture_ = null; } }
void OnEnable() { texture_ = GetComponent <UwcWindowTexture>(); texture_.window = null; texture_.searchTiming = WindowSearchTiming.Manual; texture_.updateTitle = false; texture_.createChildWindows = false; texture_.updateScaleForcely = true; renderer_ = GetComponent <Renderer>(); }
void MoveWindow(UwcWindowTexture windowTexture, bool useFilter) { var window = windowTexture.window; var pos = UwcWindowUtil.ConvertDesktopCoordToUnityPosition(window, basePixel); pos.z = window.zOrder * zMargin; var targetPos = transform.localToWorldMatrix.MultiplyPoint3x4(pos); windowTexture.transform.position = (useFilter ? Vector3.Slerp(windowTexture.transform.position, targetPos, filter) : targetPos); }
void InitWindow(UwcWindowTexture windowTexture) { MoveWindow(windowTexture, false); if (useScaleFilter) { windowTexture.transform.localScale = Vector3.zero; } else { ScaleWindow(windowTexture, false); } }
void Start() { udpUnity = new UdpClient(unityEP); udpUnity.Client.ReceiveTimeout = 20; udpUnity.Connect(localEP); isReceiving = true; thread = new Thread(new ThreadStart(ThreadMethod)); thread.Start(); Debug.Log("start"); window = GameObject.Find("Window"); windowScript = window.GetComponent <uWindowCapture.UwcWindowTexture>(); //Debug.Log(windowScript.partialWindowTitle); }
void OnEnable() { UwcManager.onWindowAdded.AddListener(OnWindowAdded); UwcManager.onWindowRemoved.AddListener(OnWindowRemoved); texture_ = GetComponent <UwcWindowTexture>(); texture_.window = null; texture_.searchTiming = WindowSearchTiming.Manual; texture_.updateTitle = false; texture_.createChildWindows = false; texture_.updateScaleForcely = true; renderer_ = GetComponent <Renderer>(); }
// Use this for initialization IEnumerator Start() { wAnimationWindowHelper.init(); inputSimulator = new WindowsInput.InputSimulator(); var activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); //現在のシーンを取得 string activeSceneName = activeScene.name; if (activeSceneName == string.Empty) { activeSceneName = "Untitled"; } getWindowObject.GetComponent <uWindowCapture.UwcWindowTexture>().partialWindowTitle = activeSceneName; //ウインドウ名には現在のシーン名が含まれてるハズなので指定 yield return(null); //ウインドウが更新されるのを待つ int waitCount = 0; while (waitCount < 300) { if (getWindowObject.childCount == 0) { waitCount++; yield return(null); } else { break; } } if (getWindowObject.childCount == 0) { Debug.Log("Unityエディタの子ウインドウが見つかりません"); yield break; } var child = getWindowObject.GetChild(0); //最初の子がアニメーションビューだと決めてかかって取得 var material = child.GetComponent <MeshRenderer>().sharedMaterial; //マテリアル取得 childWindow = child.GetComponent <uWindowCapture.UwcWindowTexture>(); Debug.Log("title:" + childWindow.window.threadId); setWindowObject.GetComponent <MeshRenderer>().sharedMaterial = material; //取得したマテリアルをセット getWindowObject.GetComponent <uWindowCapture.UwcWindowTexture>().captureRequestTiming = uWindowCapture.WindowTextureCaptureTiming.Manual; //もうUnity本体のウインドウは更新不要 init = true; }
void OnDisable() { if (window_ != null) { window_.onChildAdded.RemoveListener(OnChildAdded); window_.onChildRemoved.RemoveListener(OnChildRemoved); window_ = null; } if (texture_) { texture_.window = null; texture_ = null; } }
void Start() { winTex = GetComponent <uWindowCapture.UwcWindowTexture>(); freeLoupe = GetComponent <FreeLoupeForWindowWorkerScript>(); //Managerが初期化されていないのかデスクトップ表示の初期化に失敗するため遅延を入れている DOVirtual.DelayedCall(1f, () => { DesktopMode(); }); loadJSON(); started = true; }
public void OnClick() { var manager = list.windowTextureManager; if (windowTexture == null) { windowTexture = manager.AddWindowTexture(window); image_.color = selected; } else { manager.RemoveWindowTexture(window); windowTexture = null; image_.color = notSelected; } }
#pragma warning restore 649 void Update() { var from2to = to.position - from.position; var dir = from2to.normalized; var distance = from2to.magnitude; var result = UwcWindowTexture.RayCast(from.position, dir, distance, layerMask); if (result.hit) { Debug.DrawLine(from.position, to.position, Color.red); Debug.DrawRay(result.position, result.normal, Color.green); windowCoord = result.windowCoord; desktopCoord = result.desktopCoord; } else { Debug.DrawLine(from.position, to.position, Color.yellow); windowCoord = new Vector2(-1, -1); desktopCoord = new Vector2(-1, -1); } }
void Awake() { windowTexture_ = GetComponent <UwcWindowTexture>(); windowTexture_.onWindowChanged.AddListener(OnWindowChanged); OnWindowChanged(windowTexture_.window, null); }
void ScaleWindow(UwcWindowTexture windowTexture, bool useFilter) { windowTexture.scaleControlType = WindowTextureScaleControlType.BaseScale; windowTexture.scalePer1000Pixel = scale; }
void CheckWindow(UwcWindowTexture windowTexture) { windowTexture.enabled = !windowTexture.window.isIconic; }