void Update() { // 透明なところではホイール操作は受け付けなくする if (windowController && cameraController) { Vector2 pos = Input.mousePosition; bool inScreen = (pos.x >= 0 && pos.x < Screen.width && pos.y >= 0 && pos.y < Screen.height); if (!windowController.isClickThrough && inScreen) { if (uiController) { _originalZoomType = uiController.zoomType; } cameraController.zoomType = _originalZoomType; } else { cameraController.zoomType = CameraController.ZoomType.None; } } // UIで変化があったら反映させる if (uiController && windowController) { // 透明化方式がUIで変更されていれば反映 if (uiController.transparentType != windowController.transparentType) { windowController.SetTransparentType(uiController.transparentType); } // ヒットテスト方式がUIで変更されていれば反映 if (uiController.hitTestType != windowController.hitTestType) { windowController.hitTestType = uiController.hitTestType; } } // End を押すとウィンドウ透過切替 if (Input.GetKeyDown(KeyCode.End)) { windowController.SetTransparent(!windowController.isTransparent); } // Home を押すと最前面切替 if (Input.GetKeyDown(KeyCode.Home)) { windowController.SetTopmost(!windowController.isTopmost); } // F11 を押すと最大化切替 if (Input.GetKeyDown(KeyCode.F11)) { windowController.SetMaximized(!windowController.isMaximized); } // Insert を押すと最小化切替 if (Input.GetKeyDown(KeyCode.Insert)) { windowController.SetMinimized(!windowController.isMinimized); } }
// Use this for initialization void Start() { // 指定がなければ自動で探す if (!uiController) { uiController = FindObjectOfType <VrmUiController>(); } uiController.enableRandomMotion = true; uiController.enableRandomEmotion = true; if (uiController.motionToggleRandom) { uiController.motionToggleRandom.onValueChanged.AddListener(val => SetRandomMotion(val)); } if (uiController.emotionToggleRandom) { uiController.emotionToggleRandom.onValueChanged.AddListener(val => SetRandomEmotion(val)); } // 指定がなければ自動で探す if (!cameraController) { cameraController = FindObjectOfType <CameraController>(); if (cameraController) { _originalZoomType = cameraController.zoomType; } } // 指定がなければ自動で探す if (!audioSource) { audioSource = FindObjectOfType <AudioSource>(); } // Load the initial model. LoadModel(Application.streamingAssetsPath + "/default_vrm.vrm"); //// 引数でオプションが渡る場合の処理が面倒なため、引数でモデル指定は無しとする //string[] cmdArgs = System.Environment.GetCommandLineArgs(); //if (cmdArgs.Length > 1) //{ // LoadModel(cmdArgs[1]); //} else //{ // LoadModel(Application.streamingAssetsPath + "/default_vrm.vrm"); //} //// Load the default motion. //LoadMotion(Application.streamingAssetsPath + "/default_bvh.txt"); // Initialize window manager windowController = FindObjectOfType <WindowController>(); if (windowController) { // Add a file drop handler. windowController.OnFilesDropped += Window_OnFilesDropped; if (uiController && uiController.openButton) { uiController.openButton.onClick.AddListener(() => { string path = windowController.ShowOpenFileDialog("All supported files|*.vrm;*.bvh;*.wav;*.ogg|VRM file|*.vrm|Motion file|*.bvh|Audio file|*.wav;*.ogg|All file|*.*"); LoadFile(path); }); } } }