コード例 #1
0
        public UIController(EditorWindow window, Assets assets)
        {
            assets.Initialize();
            Assets  = assets;
            _root   = window.rootVisualElement;
            _window = window;

            Assets.UIAssets.TryGetValue(typeof(MainWindow), out var mainWindow);
            mainWindow?.FirstOrDefault()?.Layout.CloneTree(_root);

            ContentFrame = _root.Q("content-frame");

            _root.Q <Toolbar>("navigation").Add(_breadcrumbs);
            Assets.MiniAvatar.CloneTree(_root.Q("header"));
            var miniAvatarObjectField = _root.Q("avatar-mini").Q <ObjectField>("object-field");

            miniAvatarObjectField.RegisterValueChangedCallback(e => miniAvatarObjectField.SetValueWithoutNotify(e.previousValue));

            ExpressionInfo = new ExpressionInfo(UpdateMiniAvatar);

            if (AvatarCache.GetAllAvatarInfo().Count == 1)
            {
                ExpressionInfo.SetInfo(AvatarCache.GetAllAvatarInfo().First());
            }
            AvatarCache.AvatarWasUpdated += OnAvatarWasUpdated;
            UpdateMiniAvatar(ExpressionInfo);
            Messages = new Messages(this, _root.Q("info-box"));

            SetupFooter();
            SetupUpdater();
        }