Esempio n. 1
0
    private void OnEnable()
    {
        this.CommonGameConfigurations = new CommonGameConfigurations();
        EditorInformationsHelper.InitProperties(ref this.CommonGameConfigurations);

        this.RootElement = new VisualElement();

        this.ContextBar = new ContextBar(this.RootElement);
        this.ContextBar.SetupRefreshButton(this.Refresh);
        this.ContextBar.SetupSelectedAllButton(this.SelectAllGizmo);
        this.ContextBar.SetupUnselectedAllButton(this.UnSelectAllGizmo);

        this.SearchTextField = new TextField();
        this.SearchTextField.RegisterCallback <ChangeEvent <string> >(this.OnSearchStringChange);
        this.RootElement.Add(this.SearchTextField);

        this.InteractiveObjectSelectionScroll = new ScrollView(ScrollViewMode.Vertical);
        this.RootElement.Add(this.InteractiveObjectSelectionScroll);

        rootVisualElement.Add(this.RootElement);

        // rootVisualElement.RegisterCallback<MouseUpEvent>(this.RootMouseDown);

        SceneView.duringSceneGui += this.SceneTick;
    }
Esempio n. 2
0
    private void OnEnable()
    {
        CommonGameConfigurations = new CommonGameConfigurations();
        EditorInformationsHelper.InitProperties(ref CommonGameConfigurations);

        RootElement = new VisualElement();
        RootElement.style.flexDirection = FlexDirection.Row;

        LeftPanel = new VisualElement();
        LeftPanel.style.flexDirection = FlexDirection.Column;
        LeftPanel.style.alignSelf     = Align.FlexStart;

        SeachTextElement = new TextField();
        SeachTextElement.RegisterCallback <ChangeEvent <string> >(OnSearchTextChange);
        LeftPanel.Add(SeachTextElement);

        ObjectFieldParent = new ScrollView(ScrollViewMode.Vertical);
        LeftPanel.Add(ObjectFieldParent);

        RootElement.Add(LeftPanel);
        SelectedInteractiveObjectDetail = new SelectedInteractiveObjectDetail(RootElement);

        rootVisualElement.Add(RootElement);

        EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
        EditorApplication.update += Tick;
        SceneView.duringSceneGui += SceneTick;
    }
Esempio n. 3
0
 private void InitProperties()
 {
     if (this.AllConfigurationTypes == null || this.AllConfigurationTypes.Count == 0)
     {
         this.AllConfigurationTypes = TypeHelper.GetAllGameConfigurationTypes().ToList();
     }
     EditorInformationsHelper.InitProperties(ref this.EditorInformationsData.CommonGameConfigurations);
 }
Esempio n. 4
0
 private void InitProperties()
 {
     EditorInformationsHelper.InitProperties(ref this.EditorInformationsData.CommonGameConfigurations);
 }
Esempio n. 5
0
        public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
        {
            if (CommonGameConfigurations == null)
            {
                CommonGameConfigurations = new CommonGameConfigurations();
                EditorInformationsHelper.InitProperties(ref CommonGameConfigurations);
            }

            if (this.GameDesignerEditorProfile == null)
            {
                this.GameDesignerEditorProfile = GameDesignerEditorProfile;
            }

            if (GameDesignerEditorProfileSO == null)
            {
                GameDesignerEditorProfileSO = new SerializedObject(this.GameDesignerEditorProfile);
            }

            currentSelectedObjet = GameDesignerHelper.GetCurrentSceneSelectedObject();
            selectedModuleIndex  = EditorGUILayout.Popup(selectedModuleIndex, AvailableModules.ConvertAll(t => t.Name).ToArray());
            EditorGUILayout.HelpBox(POIModuleDescription(AvailableModules[selectedModuleIndex]), MessageType.None);

            T selectedPointOfIterestType = null;

            if (currentSelectedObjet != null)
            {
                selectedPointOfIterestType = currentSelectedObjet.GetComponent <T>();
            }

            var additionalEditAllowed = AdditionalEditCondition(AvailableModules[selectedModuleIndex]);

            EditorGUILayout.BeginHorizontal();
            var newAdd    = GUILayout.Toggle(add, "ADD", EditorStyles.miniButtonLeft);
            var newRemove = GUILayout.Toggle(remove, "REMOVE", EditorStyles.miniButtonRight);

            if (newAdd && newRemove)
            {
                if (add && !remove)
                {
                    add    = false;
                    remove = true;
                }
                else if (!add && remove)
                {
                    add    = true;
                    remove = false;
                }
                else
                {
                    add    = newAdd;
                    remove = newRemove;
                }
            }
            else
            {
                add    = newAdd;
                remove = newRemove;
            }

            EditorGUILayout.EndHorizontal();


            EditorGUI.BeginDisabledGroup(IsDisabled() || !additionalEditAllowed);
            if (GUILayout.Button("EDIT"))
            {
                OnEnabled();
                OnEdit(selectedPointOfIterestType, AvailableModules[selectedModuleIndex]);
                EditorUtility.SetDirty(currentSelectedObjet);
            }

            EditorGUI.EndDisabledGroup();

            if (currentSelectedObjet != null && selectedPointOfIterestType != null)
            {
                DoModuleListing(selectedPointOfIterestType);
            }

            GameDesignerEditorProfileSO.ApplyModifiedProperties();
            GameDesignerEditorProfileSO.Update();
        }
Esempio n. 6
0
 public virtual void OnEnabled()
 {
     this.commonGameConfigurations = new CommonGameConfigurations();
     EditorInformationsHelper.InitProperties(ref this.commonGameConfigurations);
 }