Exemplo n.º 1
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        windowController = FindObjectOfType <WindowController>();
        windowController.OnStateChanged += windowController_OnStateChanged;

        zoomMode = CameraController.ZoomMode.Zoom;

        vrmLoaderLocale = this.GetComponentInChildren <VRMLoader.VRMPreviewLocale>();
        vrmLoaderUI     = this.GetComponentInChildren <VRMLoader.VRMPreviewUI>();
        uiLocale        = this.GetComponentInChildren <VrmUiLocale>();
        tabPanelManager = this.GetComponentInChildren <TabPanelManager>();

        // Initialize toggles.
        UpdateUI();

        // Set event listeners.
        if (closeButton)
        {
            closeButton.onClick.AddListener(Close);
        }
        if (quitButton)
        {
            quitButton.onClick.AddListener(Quit);
        }
        if (transparentToggle)
        {
            transparentToggle.onValueChanged.AddListener(windowController.SetTransparent);
        }
        if (maximizeToggle)
        {
            maximizeToggle.onValueChanged.AddListener(windowController.SetMaximized);
        }
        if (topmostToggle)
        {
            topmostToggle.onValueChanged.AddListener(windowController.SetTopmost);
        }
        if (zoomModeDropdown)
        {
            zoomModeDropdown.onValueChanged.AddListener(val => SetZoomMode(val));
            zoomModeDropdown.value = 0;
        }
        if (languageDropdown)
        {
            languageDropdown.onValueChanged.AddListener(val => SetLanguage(val));
            languageDropdown.value = 1;
        }

        // Show menu on startup.
        Show(null);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        if (!canvas)
        {
            canvas = GetComponent <Canvas>();
        }

        zoomType        = CameraController.ZoomType.Zoom;
        transparentType = UniWinApi.TransparentTypes.Alpha;

        // WindowControllerが指定されていなければ自動取得
        windowController = FindObjectOfType <WindowController>();
        if (windowController)
        {
            windowController.OnStateChanged += windowController_OnStateChanged;

            transparentType = windowController.transparentType;
        }

        vrmLoaderLocale = this.GetComponentInChildren <VRMLoader.VRMPreviewLocale>();
        vrmLoaderUI     = this.GetComponentInChildren <VRMLoader.VRMPreviewUI>();
        uiLocale        = this.GetComponentInChildren <VrmUiLocale>();
        tabPanelManager = this.GetComponentInChildren <TabPanelManager>();

        // 中央基準にする
        panel.anchorMin          = panel.anchorMax = panel.pivot = new Vector2(0.5f, 0.5f);
        originalAnchoredPosition = panel.anchoredPosition;

        // 表情の選択肢を準備
        SetupBlendShapeDropdown();

        // Load settings.
        Load();

        // Initialize toggles.
        UpdateUI();

        // Set event listeners.
        if (closeButton)
        {
            closeButton.onClick.AddListener(Close);
        }
        if (quitButton)
        {
            quitButton.onClick.AddListener(Quit);
        }

        if (windowController)
        {
            // プロパティをバインド
            if (transparentToggle)
            {
                transparentToggle.onValueChanged.AddListener(windowController.SetTransparent);
            }
            if (maximizeToggle)
            {
                maximizeToggle.onValueChanged.AddListener(windowController.SetMaximized);
            }
            if (topmostToggle)
            {
                topmostToggle.onValueChanged.AddListener(windowController.SetTopmost);
            }
        }

        //if (emotionToggleRandom) { emotionToggleRandom.onValueChanged.AddListener(val => enableRandomEmotion = val); }
        //if (motionTogglePreset) { motionTogglePreset.onValueChanged.AddListener(val => motionMode = VrmCharacterBehaviour.MotionMode.Default); }
        //if (motionToggleRandom) { motionToggleRandom.onValueChanged.AddListener(val => motionMode = VrmCharacterBehaviour.MotionMode.Random); }
        //if (motionToggleBvh) { motionToggleBvh.onValueChanged.AddListener(val => motionMode = VrmCharacterBehaviour.MotionMode.Bvh); }

        // 直接バインドしない項目の初期値とイベントリスナーを設定
        if (zoomTypeDropdown)
        {
            zoomTypeDropdown.value = (int)zoomType;
            zoomTypeDropdown.onValueChanged.AddListener(val => SetZoomType(val));
        }
        if (transparentTypeDropdown)
        {
            transparentTypeDropdown.value = (int)transparentType;
            transparentTypeDropdown.onValueChanged.AddListener(val => SetTransparentType(val));
        }
        if (hitTestTypeDropdown)
        {
            hitTestTypeDropdown.value = (int)hitTestType;
            hitTestTypeDropdown.onValueChanged.AddListener(val => SetHitTestType(val));
        }
        if (languageDropdown)
        {
            languageDropdown.value = language;
            languageDropdown.onValueChanged.AddListener(val => SetLanguage(val));
        }

        // Show menu on startup.
        Show(null);
    }