コード例 #1
0
        public override void OnDeactivate()
        {
            //TODO: ask to save changes

            rootVisualElement?.Clear();
            buildTypesConteiners?.Clear();
        }
コード例 #2
0
 void RefreshList()
 {
     m_Container.Clear();
     for (var i = 0; i < m_Property.arraySize; i++)
     {
         m_Container.Add(new RandomizerElement(m_Property.GetArrayElementAtIndex(i), this));
     }
 }
        public void SetStackChange(IEnumerable <VisualStackTemplate> oldStackTemplates, IEnumerable <VisualStackTemplate> newStackTemplates)
        {
            m_ProgressBar.style.display = DisplayStyle.Flex;
            m_ProgressBar.value         = 0;
            m_Container.Clear();

            m_Container.Add(CreateStackElements(oldStackTemplates));

            var labelArrow = new Label {
                text = "→"
            };

            labelArrow.AddToClassList(StackVisualizerViewUss.ArrowClass);
            m_Container.Add(labelArrow);

            m_Container.Add(CreateStackElements(newStackTemplates));
        }
コード例 #4
0
 void LayoutItems()
 {
     m_ItemContainer.Clear();
     foreach (var item in m_Items)
     {
         m_ItemContainer.Add(item);
     }
 }
コード例 #5
0
    public void SetData(WidgetDataLaunchCommandElement data)
    {
        _widgetData = data;

        _nameLabel.text     = data.GameConsoleInvokable.DisplayName;
        _activeToggle.value = data.Active;
        _paramsContainer.Clear();

        int paramIndex = 0;

        foreach (IGameConsoleParameter param in data.GameConsoleInvokable.Parameters)
        {
            if (param.Type == typeof(bool))
            {
                var field = new Toggle();
                bool.TryParse(TryPopParam(), out bool val);
                field.value = val;
                field.RegisterValueChangedCallback((evt) => OnParameterModified());
                _paramsContainer.Add(field);
            }
            else if (param.Type == typeof(int))
            {
                var field = new IntegerField();
                int.TryParse(TryPopParam(), out int val);
                field.value = val;
                field.RegisterValueChangedCallback((evt) => OnParameterModified());
                _paramsContainer.Add(field);
            }
            else if (param.Type == typeof(float))
            {
                var field = new FloatField();
                float.TryParse(TryPopParam(), out float val);
                field.value = val;
                field.RegisterValueChangedCallback((evt) => OnParameterModified());
                _paramsContainer.Add(field);
            }
            else
            {
                var field = new TextField();
                field.value = TryPopParam();
                field.RegisterValueChangedCallback((evt) => OnParameterModified());
                _paramsContainer.Add(field);
            }
        }

        _nameLabel.SetEnabled(data.Active);
        foreach (var item in _paramsContainer.Children())
        {
            item.SetEnabled(data.Active);
        }

        OnParameterModified();

        string TryPopParam()
        {
            if (data.Parameters == null)
            {
                return(default);
コード例 #6
0
        public override void Reload(IProperty property)
        {
            m_ContentRoot.Clear();

            var list = GetValue();

            if (null == list)
            {
                return;
            }

            m_PaginationElement.Update(list.Count);

            if (m_Size.focusController?.focusedElement != m_Size)
            {
                m_Size.isDelayed = false;
                m_Size.SetValueWithoutNotify(list.Count);
                m_Size.isDelayed = true;
            }

            var startIndex = 0;
            var endIndex   = list.Count;

            if (UsesPagination)
            {
                startIndex = m_PaginationElement.StartIndex;
                endIndex   = m_PaginationElement.EndIndex;
            }

            var atIndexPath = PropertyPath.Pool.Get();

            try
            {
                atIndexPath.PushPath(Path);

                for (var i = startIndex; i < endIndex; ++i)
                {
                    var index = i;

                    atIndexPath.PushIndex(index);
                    try
                    {
                        var root = new VisualElement();
                        Root.VisitAtPath(atIndexPath, root);
                        MakeListElement(root, index);
                        m_ContentRoot.Add(root);
                    }
                    finally
                    {
                        atIndexPath.Pop();
                    }
                }
            }
            finally
            {
                PropertyPath.Pool.Release(atIndexPath);
            }
        }
コード例 #7
0
    private void RefreshListView <T>(out ListView listview, string visualElementName, T[] itemsSource)
    {
        listview = new ListView();
        VisualElement parentVE = rootVisualElement.Q <VisualElement>(visualElementName);

        parentVE.Clear();
        InitListView(listview, itemsSource);
        parentVE.Add(listview);
    }
コード例 #8
0
        void CloneTree()
        {
            m_Container.Clear();

            if (m_CurrentVisualTreeAsset == null)
                return;

            m_CurrentVisualTreeAsset.CloneTree(m_Container);
        }
コード例 #9
0
 /// <summary>
 /// clearing original inspector structure
 /// building the new structure
 /// </summary>
 /// <returns></returns>
 public override VisualElement CreateInspectorGUI()
 {
     root = new VisualElement();
     root.Clear();
     root.style.flexDirection  = FlexDirection.Column;
     root.style.justifyContent = Justify.SpaceBetween;
     AddPlaylistInspectorVisualElements();
     return(root);
 }
コード例 #10
0
 public void UpdateActions()
 {
     actionContainer.Clear();
     foreach (UtilityAIAction action in utilityAIAgent.actions)
     {
         UtilityAIActionEditor utilityAIActionEditor = new UtilityAIActionEditor(this, action);
         actionContainer.Add(utilityAIActionEditor);
     }
 }
コード例 #11
0
    public void Init(List <string> presetNames)
    {
        _presetListDict = presetNames.ToDictionary(item => item, item => true);
        _title.text     = "Preset exporter";
        var listView = ImportExportCommon.Populate(presetNames, (e, preset) => _presetListDict[preset] = e.newValue);

        _listContainer.Clear();
        _listContainer.Add(listView);
    }
コード例 #12
0
ファイル: TechTree.cs プロジェクト: Aspekt1024/HexCraft
 private void Reset()
 {
     nodeRoot.Clear();
     dependencyLinks.Clear();
     data.techTreeData.ClearVisualData();
     objectViewer.UpdateContents();
     SetupData();
     UpdateTree();
 }
コード例 #13
0
        private VisualElement CreateMediaSourceView(string id)
        {
            var root      = new VisualElement();
            var container = new VisualElement();

            root.Add(container);

            var sourceGraph = new MediaSourceGraphView();
            var graphView   = sourceGraph.Create();

            m_parent.OnStats += (peer, report) =>
            {
                if (peer != m_peerConnection)
                {
                    return;
                }

                container.Clear();
                if (!report.TryGetValue(id, out var stats) ||
                    !(stats is RTCMediaSourceStats mediaSourceStats))
                {
                    container.Add(new Label($"no stats report about {RTCStatsType.MediaSource}"));
                    return;
                }

                container.Add(new Label($"{nameof(mediaSourceStats.Id)}: {mediaSourceStats.Id}"));
                container.Add(new Label($"{nameof(mediaSourceStats.Timestamp)}: {mediaSourceStats.Timestamp}"));
                container.Add(
                    new Label($"{nameof(mediaSourceStats.trackIdentifier)}: {mediaSourceStats.trackIdentifier}"));
                container.Add(new Label($"{nameof(mediaSourceStats.kind)}: {mediaSourceStats.kind}"));

                if (mediaSourceStats is RTCVideoSourceStats videoSourceStats)
                {
                    container.Add(new Label($"{nameof(videoSourceStats.width)}: {videoSourceStats.width}"));
                    container.Add(new Label($"{nameof(videoSourceStats.height)}: {videoSourceStats.height}"));
                    container.Add(new Label($"{nameof(videoSourceStats.frames)}: {videoSourceStats.frames}"));
                    container.Add(
                        new Label($"{nameof(videoSourceStats.framesPerSecond)}: {videoSourceStats.framesPerSecond}"));
                    sourceGraph.AddInput(videoSourceStats);
                    graphView.visible = true;
                }

                if (mediaSourceStats is RTCAudioSourceStats audioSourceStats)
                {
                    container.Add(new Label($"{nameof(audioSourceStats.audioLevel)}: {audioSourceStats.audioLevel}"));
                    container.Add(new Label($"{nameof(audioSourceStats.totalAudioEnergy)}: {audioSourceStats.totalAudioEnergy}"));
                    container.Add(new Label($"{nameof(audioSourceStats.totalSamplesDuration)}: {audioSourceStats.totalSamplesDuration}"));
                    sourceGraph.AddInput(audioSourceStats);
                    graphView.visible = true;
                }
            };

            root.Add(graphView);

            return(root);
        }
コード例 #14
0
ファイル: BBWatcher.cs プロジェクト: recstazy/BehaviourTree
        private void OnDisable()
        {
            TreeSelector.OnTreeChanged -= TreeSelectorTreeChanged;
            VisualElement root = rootVisualElement;

            if (root.childCount > 0)
            {
                root.Clear();
            }
        }
コード例 #15
0
        void OnMouseUp(MouseUpEvent evt)
        {
            var track = target as Track;

            if (track != null && track.item != null)
            {
                m_ExtraViewPanel.Clear();
                track.item.OnClick(m_ExtraViewPanel, m_TimeConverter.PixelToTime(evt.mousePosition.x));
            }
        }
コード例 #16
0
 private void InitSecondsUI(VisualElement DraggerContainer, MVideoClip clip)
 {
     DraggerContainer.Clear();
     for (int i = 0; i < clip.Duration; i++)
     {
         var cm = new VisualElement();
         cm.AddToClassList("SecondsTick");
         DraggerContainer.Add(cm);
     }
 }
コード例 #17
0
ファイル: InspectorView.cs プロジェクト: whpskyeagle/Graphics
        // This should be implemented by any inspector class that wants to define its own GraphSettings
        // which for SG, is a representation of the settings in GraphData
        protected virtual void ShowGraphSettings_Internal(VisualElement contentContainer)
        {
            var graphEditorView = ParentView.GetFirstAncestorOfType<GraphEditorView>();
            if (graphEditorView == null)
                return;

            contentContainer.Clear();
            DrawInspectable(contentContainer, (IInspectable)ParentView, m_graphSettingsPropertyDrawer);
            contentContainer.MarkDirtyRepaint();
        }
コード例 #18
0
 void SyncAttacksUI()
 {
     UpdateAttackListLabel();
     attacksContainer.Clear();
     for (var i = 0; i < targetMonster.attacks.Count; i++)
     {
         var newAttack = new MonsterAttackEditor(targetMonster, i, DeleteAttack, DuplicateAttack);
         attacksContainer.Add(newAttack);
     }
 }
コード例 #19
0
        private void UpdateCanvas()
        {
            m_RootVisualElement.Clear();

            m_BaseVisualElement   = GetBaseVisualElement();
            m_BottomVisualElement = GetBottomVisualElement();

            m_RootVisualElement.Add(m_BaseVisualElement);
            m_RootVisualElement.Add(m_BottomVisualElement);
        }
コード例 #20
0
ファイル: StarSystemEditor.cs プロジェクト: rthakur/blog
 public void UpdatePlanets()
 {
     planetList.Clear();
     // Create and add a PlanetSubEditor to our planetList container for each planet.
     foreach (Planet planet in starSystem.planets)
     {
         PlanetSubEditor planetSubEditor = new PlanetSubEditor(this, planet);
         planetList.Add(planetSubEditor);
     }
 }
コード例 #21
0
        private void UpdateInspector()
        {
            ISelectable selectable = selection.FirstOrDefault((s) => s is IInspectable);

            inspectorContainer.Clear();
            if (selectable is IInspectable inspectable)
            {
                inspectorContainer.Add(inspectable.GetInspectorView());
            }
        }
コード例 #22
0
 public override VisualElement CreateInspectorGUI()
 {
     rootElement.Clear();
     rootElement.Add(gameBoardManagerField);
     rootElement.Add(cameraField);
     rootElement.Add(playMatRendererField);
     rootElement.Add(refresh);
     UpdateFields(true);
     return(rootElement);
 }
コード例 #23
0
        void BuildComponents()
        {
            VisualElement root = rootVisualElement;

            root.Clear();
            root.LoadStyle("PlasticWindow/PlasticWindow");

            BuildTabview(root);
            BuildStatusBar(root);
        }
コード例 #24
0
        void RefreshClassListContainer()
        {
            m_ClassListContainer.Clear();
            if (BuilderSharedStyles.IsSelectorElement(currentVisualElement))
            {
                return;
            }

            var builderWindow = m_PaneWindow as Builder;

            if (builderWindow == null)
            {
                return;
            }

            var documentRootElement = builderWindow.documentRootElement;

            foreach (var className in currentVisualElement.GetClasses())
            {
                m_ClassPillTemplate.CloneTree(m_ClassListContainer.contentContainer);
                var pill             = m_ClassListContainer.contentContainer.ElementAt(m_ClassListContainer.childCount - 1);
                var pillLabel        = pill.Q <Label>("class-name-label");
                var pillDeleteButton = pill.Q <Button>("delete-class-button");
                pillDeleteButton.userData = className;

                // Add ellipsis if the class name is too long.
                var classNameShortened = BuilderNameUtilities.CapStringLengthAndAddEllipsis(className, BuilderConstants.ClassNameInPillMaxLength);
                pillLabel.text = BuilderConstants.UssSelectorClassNameSymbol + classNameShortened;

                if (IsClassInUXMLDoc(className))
                {
                    pillDeleteButton.clickable.clickedWithEventInfo += OnStyleClassDelete;
                }
                else
                {
                    // Don't show "x" button if the class can't actually be removed.
                    pillDeleteButton.style.display = DisplayStyle.None;
                }

                // See if the class is in document as its own selector.
                var selector = BuilderSharedStyles.FindSelectorElement(documentRootElement, BuilderConstants.UssSelectorClassNameSymbol + className);
                pill.SetProperty(BuilderConstants.InspectorClassPillLinkedSelectorElementVEPropertyName, selector);
                var clickable = CreateClassPillClickableManipulator();
                pill.AddManipulator(clickable);
                if (selector == null)
                {
                    pill.AddToClassList(BuilderConstants.InspectorClassPillNotInDocumentClassName);
                    pill.tooltip = BuilderConstants.InspectorClassPillDoubleClickToCreate;
                }
                else
                {
                    pill.tooltip = BuilderConstants.InspectorClassPillDoubleClickToSelect;
                }
            }
        }
コード例 #25
0
    void OnEnable()
    {
        lastT = EditorApplication.timeSinceStartup;
        UnityEditor.Undo.postprocessModifications += OnPropMod;
        UnityEditor.Undo.undoRedoPerformed        += OnUndoRedo;
        window = this;
        string[] search = AssetDatabase.FindAssets("t:asmdef uPixel");
        if (search.Length > 0)
        {
            m_PackagePath = Regex.Match(AssetDatabase.GUIDToAssetPath(search[0]), ".*\\/").ToString();
        }
        m_Tool = null;
        // Each editor window contains a root VisualElement object
        m_Root = rootVisualElement;
        m_Root.Clear();
        // Import UXML
        var           visualTree    = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(m_PackagePath + "Editor/uPixel.uxml");
        VisualElement labelFromUXML = visualTree.CloneTree();
        // A stylesheet can be added to a VisualElement.
        // var styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>(m_PackagePath + "Editor/uPixel.uss");
        var styleSheet = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/uPixel.uss");

        // The style will be applied to the VisualElement and all of its children.
        m_Root.styleSheets.Add(styleSheet);
        m_Root.Add(labelFromUXML);
        m_Root.Q <VisualElement>(className: "canvas").StretchToParentSize();
        m_Root.Q <VisualElement>(className: "canvas").style.height = this.position.height;
        m_Root.Q <Image>().style.backgroundImage = AssetDatabase.LoadAssetAtPath <Texture2D>(m_PackagePath + "T_Canvas.png");
        m_Root.Query <Toggle>().ForEach(o =>
        {
            o.RegisterCallback <MouseUpEvent>(SwitchTool);
            o.Q <Image>().style.backgroundImage = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Icons/Icon_" + o.name + ".png");
            m_ToolButtons.Add(o);
        });
        m_Root.focusable = true;
        m_Root.RegisterCallback <KeyDownEvent>(OnKeyDown);
        m_Root.RegisterCallback <KeyUpEvent>(OnKeyUp);
        m_Root.RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);

        m_Image = m_Root.Q <Image>();
        var canvas  = m_Root.Q <VisualElement>(className: "canvas");
        var history = m_Root.Q <VisualElement>(name: "History");
        // history.style.width = this.position.width;
        // history.style.top = this.position.height - history.style.height.value.value;
        VisualElement HistoryDrawParent = history.Q <VisualElement>(name: "HistoryDraw");

        HistoryDrawParent.Add(new IMGUIContainer(HistoryDrawOnGUI));

        InitImage();

        DrawPalette();
        m_Preview = m_Root.Q <Image>(name: "preview");

        m_HistoryValue = pixelAsset.GetHistoryLength();
    }
コード例 #26
0
 public void BindElements()
 {
     m_SelectorContainer = this.Q("VisibilityToolSelection");
     m_Container         = this.Q("VisibilityToolContainer");
     m_BoneOpacitySlider = this.Q <Slider>("BoneOpacitySlider");
     m_BoneOpacitySlider.RegisterValueChangedCallback(OnBoneOpacitySliderValueChangd);
     m_MeshOpacitySlider = this.Q <Slider>("MeshOpacitySlider");
     m_MeshOpacitySlider.RegisterValueChangedCallback(OnMeshOpacitySliderValueChangd);
     m_Tabs = new List <Button>();
     m_SelectorContainer.Clear();
 }
コード例 #27
0
        private void RefershPacks(VisualElement packsContainer)
        {
            if (Localizer.Instance == null)
            {
                Localizer.Initialize(Application.streamingAssetsPath.TrimEnd('/', '\\') + "/Localization", "");
            }

            var packs     = Localizer.Instance.Packs;
            var packsList = new List <LocalizationPack>(packs);

            var listView  = packsContainer.Q <ListView>("packList");
            int listIndex = 0;

            if (listView != null)
            {
                listIndex = listView.selectedIndex;
                if (listIndex < 0)
                {
                    listIndex = 0;
                }
            }


            packsContainer.Clear();

            Func <VisualElement>        makeItem = () => new Label();
            Action <VisualElement, int> bindItem = (e, i) => (e as Label).text = packs[i].Name;

            const int itemHeight = 16;

            listView = new ListView(packsList, itemHeight, makeItem, bindItem);

            listView.selectionType = SelectionType.Multiple;

            listView.onSelectionChanged += (o) => { OnSelectedPackChanged(listView.selectedItem as LocalizationPack); };

            listView.style.flexGrow = 1.0f;
            listView.name           = "packList";

            packsContainer.Add(listView);

            if (listView.itemsSource.Count > listIndex)
            {
                listView.selectedIndex = listIndex;
            }
            else if (listView.itemsSource.Count > 0)
            {
                listView.selectedIndex = listView.itemsSource.Count - 1;
            }
            else
            {
                OnSelectedPackChanged(null);
            }
        }
コード例 #28
0
        //Overwrite and build the Editor interface
        public override VisualElement CreateInspectorGUI()
        {
            //Clear the visual element
            _RootElement.Clear();
            _ControlElement.Clear();
            _PatternSetElement.Clear();

            //Clone the visual tree into our Visual Elements using the templates
            _BeatMachineTemplate.CloneTree(_RootElement);
            _ControlTemplate.CloneTree(_ControlElement);

            LoadPatternSetFromDisc();
            //LoadSoundBankAndSetPatternRows(_beatMachine.m_currentPatternSet.soundBank, _PatternSetElement);
            RegisterUICallbacks();

            _RootElement.Add(_PatternSetElement);
            _RootElement.Add(_ControlElement);

            return(_RootElement);
        }
コード例 #29
0
    private void ClearSystem()
    {
        //var root = userControls.gameObject.GetComponent<VisualElement>().rootVisualElement;

        var root = userControls.rootVisualElement;

        controls = root.Q("controls");
        controls.Clear();


        if (planetObjects.Count > 0)
        {
            foreach (GameObject planet in planetObjects)
            {
                DestroyImmediate(planet);
            }
        }

        planetObjects.Clear();

        if (noteObjects.Count > 0)
        {
            foreach (GameObject note in noteObjects)
            {
                DestroyImmediate(note);
            }
        }

        noteObjects.Clear();

        synthObjects = new Dictionary <string, GameObject>();

        //AudioHelm.HelmController[] synthInstances = this.transform.GetComponentsInChildren<AudioHelm.HelmController>();
        //foreach (AudioHelm.HelmController s in synthInstances)
        //    DestroyImmediate(s.gameObject);

        AudioSource[] synthInstances = this.transform.GetComponentsInChildren <AudioSource>();
        foreach (AudioSource a in synthInstances)
        {
            DestroyImmediate(a.gameObject);
        }


        if (orbitObjects.Count > 0)
        {
            foreach (GameObject orbit in orbitObjects)
            {
                DestroyImmediate(orbit);
            }
        }


        orbitObjects.Clear();
    }
コード例 #30
0
    private void ClearElements(selectionType type)
    {
        List <string> listElements = new List <string>();

        listElements.Clear();
        Button createQuest = rootVisualElement.Q <Button>("CreateQ");
        Button createStep  = rootVisualElement.Q <Button>("CreateS");

        switch (type)
        {
        case selectionType.Questline:
            listElements.Add("steps-list");
            listElements.Add("actor-conversations");
            listElements.Add("steps-list");
            listElements.Add("dialogues-list");

            listElements.Add("step-info-scroll");
            listElements.Add("dialogue-info-scroll");
            if (createQuest != null)
            {
                createQuest.SetEnabled(true);
            }
            if (createStep != null)
            {
                createStep.SetEnabled(false);
            }

            break;

        case selectionType.Quest:
            listElements.Add("dialogues-list");

            listElements.Add("step-info-scroll");
            listElements.Add("dialogue-info-scroll");

            if (createStep != null)
            {
                createStep.SetEnabled(true);
            }

            break;

        case selectionType.Step:

            listElements.Add("dialogue-info-scroll");

            break;
        }
        foreach (string elementName in listElements)
        {
            VisualElement element = rootVisualElement.Q <VisualElement>(elementName);
            element.Clear();
        }
    }