Esempio n. 1
0
        public static void OpenWindow(PlainStateMachineBuilder builder)
        {
            var window = GetWindow <PlainStateMachineBuilderEditorWindow>();

            window.Initialize(builder);
            window.Show();
        }
Esempio n. 2
0
        private void Initialize(PlainStateMachineBuilder builder)
        {
            if (builder == null)
            {
                return;
            }

            _builder = builder;

            backgroundTexture = CreateBackgroundTexture(backgroundColor);

            titleContent = new GUIContent("Plain State Machine Builder Window");

            _nodes       = new List <StateNode>();
            _transitions = new List <TransitionConnection>();

            _gridDrawer         = new BackgroundGridDrawer();
            _windowEventHandler = new WindowEventHandler(this);
            _nodeEventHandler   = new StateNodeEventHandler(this);
            _transitionConnectionEventHandler = new TransitionConnectionEventHandler(this);
            _metadata        = new PlainStateMachineBuilderMetadata();
            _inspectorDrawer = new InspectorDrawer();

            LoadBuilder();

            _builderSettingsDrawer = new PlainStateMachineBuilderSettingsDrawer(_builder);
            _builderSettingsDrawer.OnStateIdTypeChanged += OnStateIdTypeChanged;
            _builderSettingsDrawer.OnTriggerTypeChanged += OnTriggerTypeChanged;

            Undo.undoRedoPerformed += Reload;
        }
        public static bool OpenEditorWindow(int instanceID, int line)
        {
            PlainStateMachineBuilder builderAsset = EditorUtility.InstanceIDToObject(instanceID) as PlainStateMachineBuilder;

            if (builderAsset != null)
            {
                PlainStateMachineBuilderEditorWindow.OpenWindow(builderAsset);

                return(true);
            }

            return(false);
        }
        public PlainStateMachineBuilderSettingsDrawer(PlainStateMachineBuilder builder = null)
        {
            PlainStateMachineBuilder = builder;

            _titleStyle           = new GUIStyle();
            _titleStyle.padding   = new RectOffset(20, 20, 20, 20);
            _titleStyle.alignment = TextAnchor.MiddleCenter;
            _titleStyle.fontSize  = 20;

            _labelStyle          = new GUIStyle();
            _labelStyle.wordWrap = true;

            _controlsAreaStyle         = new GUIStyle();
            _controlsAreaStyle.padding = new RectOffset(20, 20, 20, 20);

            LoadStateIdTypeDataFrom(builder.StateIdType);
            LoadTriggerTypeDataFrom(builder.TriggerType);

            SetStateIdTypeByRepresentation();
            SetTriggerTypeByRepresentation();
        }