Esempio n. 1
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        PlacementWindow window = (PlacementWindow)EditorWindow.GetWindow(typeof(PlacementWindow));

        window.Show();

        _objectPlacer = UnityEditor.SceneView.lastActiveSceneView.camera.gameObject.AddComponent <ObjectPlacer>();
        _settings     = (SettingsScriptableObject)Resources.Load("PlacementSettings", typeof(SettingsScriptableObject));
        window.LoadValues();
    }
Esempio n. 2
0
        ///-------------------------------------------------------------------------
        /// <summary>更新</summary>
        ///-------------------------------------------------------------------------
        public void Update()
        {
            try
            {
                // if(this.Enable)
                // {
                if (!initialized)
                {
                    {
                        this.Initialize();
                        this.initialized = true;
                    }
                }

                if (this.timelineWindow != null && this.timelineWindow.wantsLanguageChange)
                {
                    string lang = this.timelineWindow.LanguageValue;
                    if (Translation.HasTranslation(lang))
                    {
                        Preferences["Config"]["Language"].Value = timelineWindow.LanguageValue;
                        configLanguage = timelineWindow.LanguageValue;
                        SaveConfig();

                        this.timelineWindow.wantsLanguageChange = false;
                    }
                }

                if (Input.GetKeyDown(configWindowKey))
                {
                    if (this.selectedMode == ConstantValues.EditMode.Movie)
                    {
                        this.selectedMode = ConstantValues.EditMode.Disable;
                    }
                    else
                    {
                        this.selectedMode = ConstantValues.EditMode.Movie;
                    }
                }
                else if (Input.GetKeyDown(configPlayKey))
                {
                    this.timelineWindow.Play(this, new EventArgs());
                }
                else if (Input.GetKeyDown(configStopKey))
                {
                    this.timelineWindow.Stop(this, new EventArgs());
                }
                else if (Input.GetKeyDown(configHideUIKey))
                {
                    this.enableUI = !this.enableUI;

                    if (this.windowMgr == null)
                    {
                        GameObject placementWindow = GameObject.Find("PlacementWindow");
                        if (placementWindow != null)
                        {
                            PlacementWindow placementWindowCompo = placementWindow.GetComponent <PlacementWindow>();
                            this.windowMgr = placementWindowCompo.mgr;
                        }
                    }

                    if (this.windowMgr != null)
                    {
                        this.SetUIEnabled(this.enableUI);
                    }
                }

                // if( this.selectedMode == ConstantValues.EditMode.Movie )
                // {
                this.timelineWindow.Update();
                // }
                // }
            }
            catch (Exception e)
            {
                Debug.LogError(e.ToString());
            }
        }