void OnChildRemoved(UwcWindow childWindow) { if (texture_.window == childWindow) { texture_.window = null; } }
void OnChildAdded(UwcWindow childWindow) { if (texture_) { texture_.window = childWindow; } }
UwcWindow AddWindow(int id) { var window = new UwcWindow(id); windows.Add(id, window); return(window); }
static public UwcWindow Find(int id) { UwcWindow window = null; windows.TryGetValue(id, out window); return(window); }
void OnWindowRemoved(UwcWindow window) { if (texture_.window == window) { texture_.window = null; } }
static public UwcWindow Find(string partialTitle, bool isAltTabWindow = true) { UwcWindow target = null; int minIndex = int.MaxValue; foreach (var kv in windows) { var window = kv.Value; if (isAltTabWindow && !window.isAltTabWindow) { continue; } var index = window.title.IndexOf(partialTitle); if (index == 0) { return(window); } else if (index != -1 && index < minIndex) { minIndex = index; target = window; } } return(target); }
void OnWindowRemoved(UwcWindow window) { UwcWindowListItem listItem; items_.TryGetValue(window.id, out listItem); if (listItem) { Destroy(listItem.gameObject); } }
void OnChildRemoved(UwcWindow window) { UwcWindowTexture child; children.TryGetValue(window.id, out child); if (child) { Destroy(child.gameObject); children.Remove(window.id); } }
void OnWindowAdded(UwcWindow window) { if (!isReady) { return; } if (texture_) { texture_.window = window; } }
public void RemoveWindowTexture(UwcWindow window) { UwcWindowTexture windowTexture; windows_.TryGetValue(window.id, out windowTexture); if (windowTexture) { onWindowTextureRemoved.Invoke(windowTexture); windows_.Remove(window.id); Destroy(windowTexture.gameObject); } }
void OnWindowAdded(UwcWindow window) { if (window.parentWindow != null) { return; // handled by UwcWindowTextureChildrenManager } if (!window.isVisible || !window.isAltTabWindow || window.isBackground) { return; } window.RequestCapture(); AddWindowTexture(window); }
void OnDisable() { if (window_ != null) { window_.onChildAdded.RemoveListener(OnChildAdded); window_.onChildRemoved.RemoveListener(OnChildRemoved); window_ = null; } if (texture_) { texture_.window = null; texture_ = null; } }
void OnWindowAdded(UwcWindow window) { if (!window.isAltTabWindow || window.isBackground) { return; } var gameObject = Instantiate(windowListItem, listRoot, false); var listItem = gameObject.GetComponent <UwcWindowListItem>(); listItem.window = window; listItem.list = this; items_.Add(window.id, listItem); window.RequestCaptureIcon(); window.RequestCapture(CapturePriority.Low); }
void UpdateWindow() { if (window_ != null) { return; } var window = UwcManager.Find(partialWindowName, false); if (window == null) { return; } window_ = window; window_.onChildAdded.AddListener(OnChildAdded); window_.onChildRemoved.AddListener(OnChildRemoved); }
void OnChildAdded(UwcWindow window) { var childWindowTexture = InstantiateChild(); if (!childWindowTexture) { Debug.LogError("childPrefab is not set or does not have UwcWindowTexture."); return; } childWindowTexture.window = window; childWindowTexture.parent = windowTexture_; childWindowTexture.manager = windowTexture_.manager; childWindowTexture.type = WindowTextureType.Child; childWindowTexture.captureFrameRate = windowTexture_.captureFrameRate; childWindowTexture.captureRequestTiming = windowTexture_.captureRequestTiming; childWindowTexture.drawCursor = windowTexture_.drawCursor; children.Add(window.id, childWindowTexture); }
public UwcWindowTexture AddWindowTexture(UwcWindow window) { if (!windowPrefab) { Debug.LogError("windowPrefab is null."); return(null); } var obj = Instantiate(windowPrefab, transform); var windowTexture = obj.GetComponent <UwcWindowTexture>(); Assert.IsNotNull(windowTexture, "Prefab must have UwcWindowTexture component."); windowTexture.window = window; windowTexture.manager = this; windows_.Add(window.id, windowTexture); onWindowTextureAdded.Invoke(windowTexture); return(windowTexture); }
void OnWindowChanged(UwcWindow newWindow, UwcWindow oldWindow) { if (newWindow == oldWindow) { return; } if (oldWindow != null) { oldWindow.onChildAdded.RemoveListener(OnChildAdded); oldWindow.onChildRemoved.RemoveListener(OnChildRemoved); foreach (var kv in children) { var windowTexture = kv.Value; Destroy(windowTexture.gameObject); } children.Clear(); } if (newWindow != null) { newWindow.onChildAdded.AddListener(OnChildAdded); newWindow.onChildRemoved.AddListener(OnChildRemoved); foreach (var pair in UwcManager.windows) { var window = pair.Value; if ( !window.isAltTabWindow && window.isChild && window.parentWindow.id == newWindow.id) { OnChildAdded(window); } } } }
//モニタ・ウィンドウ切り替え public void Change() { uWindowCapture.UwcWindow win = null; if (desktopMode) { //デスクトップモードの場合 //次のデスクトップへ desktopIndex++; //デスクトップインデックスを超える場合は、0に戻す if (desktopIndex > uWindowCapture.UwcManager.desktopCount - 1) { desktopIndex = 0; } winTex.desktopIndex = desktopIndex; //表示 TitleText.text = LanguageManager.config.misc.DESKTOP + desktopIndex; } else { //ウィンドウモードの場合 loadJSON();//読み込み //次のウィンドウへ windowIndex++; //更新掛ける uWindowCapture.UwcManager.UpdateAltTabWindowTitles(); //最新のウィンドウ辞書を取得 Dictionary <int, uWindowCapture.UwcWindow> Windows = uWindowCapture.UwcManager.windows; //有効なウィンドウリストを作成する List <uWindowCapture.UwcWindow> WindowList = new List <uWindowCapture.UwcWindow>(); //隙間ないウィンドウリストを作成する int i = 0; foreach (KeyValuePair <int, uWindowCapture.UwcWindow> winPair in Windows) { //無限ループにはまらないためにループ制限をしている if (i > 500) { break; } i++; //条件に合うものだけ追加していく if (winPair.Value.isVisible && !winPair.Value.isMinimized && !winPair.Value.isBackground && winPair.Value.isAltTabWindow) { WindowList.Add(winPair.Value); } } //ウィンドウ切り替え番号が大きすぎるなら0に戻す if (windowIndex >= WindowList.Count) { windowIndex = 0; } Debug.Log("WindowList.Count: " + WindowList.Count); Debug.Log("windowIndex: " + windowIndex); //それでも大きすぎる(ウィンドウがないかなにかおかしい時) if (windowIndex >= WindowList.Count) { menu.ShowDialogOK(LanguageManager.config.showdialog.ERROR, LanguageManager.config.showdialog.WINDOW_NOT_FOUND, 0.1f, () => { }); DesktopMode(); return; } else { win = WindowList[windowIndex]; } /* * Debug.Log("Check:" + windowIndex); * Debug.Log("Title:" + win.title); * Debug.Log("isVisible:" + win.isVisible); * Debug.Log("isAltTabWindow:" + win.isAltTabWindow); * Debug.Log("isBackground:" + win.isBackground); * Debug.Log("isMinimized:" + win.isMinimized); */ //条件を満たした状態ではない状態で脱出した場合 if (win == null) { menu.ShowDialogOK(LanguageManager.config.showdialog.ERROR, LanguageManager.config.showdialog.WINDOW_NOT_FOUND, 0.1f, () => { }); DesktopMode(); return; } //切り替え winTex.window = win; //表示 TitleText.text = win.title; //何があろうとまずPrintWindow winTex.captureMode = uWindowCapture.CaptureMode.PrintWindow; } }
public static Vector3 ConvertDesktopCoordToUnityPosition(UwcWindow window, float basePixel) { return(ConvertDesktopCoordToUnityPosition(window.x, window.y, window.width, window.height, basePixel)); }
void OnChildRemoved(UwcWindow window) { OnChildRemoved(window.id); }
void OnWindowRemoved(UwcWindow window) { RemoveWindowTexture(window); }