コード例 #1
0
        private void CreateFileMenu(Rect position)
        {
            GenericMenu fileMenu = new GenericMenu();

            fileMenu.AddItem(new GUIContent("Overwrite Input Settings"), false, HandleFileMenuOption, 0);
            fileMenu.AddSeparator("");
            if (_inputManager.inputConfigurations.Count > 0)
            {
                fileMenu.AddItem(new GUIContent("Create Snapshot"), false, HandleFileMenuOption, 1);
            }
            else
            {
                fileMenu.AddDisabledItem(new GUIContent("Create Snapshot"));
            }
            if (EditorToolbox.CanLoadSnapshot())
            {
                fileMenu.AddItem(new GUIContent("Load Snapshot"), false, HandleFileMenuOption, 2);
            }
            else
            {
                fileMenu.AddDisabledItem(new GUIContent("Load Snapshot"));
            }
            fileMenu.AddSeparator("");

            fileMenu.AddItem(new GUIContent("Forum"), false, HandleFileMenuOption, 3);
            fileMenu.AddItem(new GUIContent("About"), false, HandleFileMenuOption, 4);
            fileMenu.DropDown(position);
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            _InputManager inputManager = target as _InputManager;

            serializedObject.Update();
            GUILayout.Space(5.0f);

            GUILayout.BeginHorizontal();
            GUI.enabled = !AdvancedInputEditor.IsOpen;
            if (GUILayout.Button("Input\nEditor", GUILayout.Height(40.0f)))
            {
                AdvancedInputEditor.OpenWindow(inputManager);
            }
            GUI.enabled = true;
            if (GUILayout.Button(_createSnapshotIngo, GUILayout.Height(40.0f)))
            {
                EditorToolbox.CreateSnapshot(inputManager);
            }
            GUI.enabled = EditorToolbox.CanLoadSnapshot();
            if (GUILayout.Button("Restore\nSnapshot", GUILayout.Height(40.0f)))
            {
                EditorToolbox.LoadSnapshot(inputManager);
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();

            GUILayout.Space(5.0f);
            EditorGUILayout.PropertyField(_playerOneDefault);
            EditorGUILayout.PropertyField(_playerTwoDefault);
            EditorGUILayout.PropertyField(_playerThreeDefault);
            EditorGUILayout.PropertyField(_playerFourDefault);
            EditorGUILayout.PropertyField(_dontDestroyOnLoad);
            EditorGUILayout.PropertyField(_ignoreTimescale);
            EditorGUILayout.PropertyField(_intputConfigurations);
            if (_intputConfigurations.isExpanded)
            {
                EditorGUI.indentLevel++;
                int arraySize = EditorGUILayout.DelayedIntField("Size", _intputConfigurations.arraySize);
                if (arraySize != _intputConfigurations.arraySize)
                {
                    _intputConfigurations.arraySize = arraySize;
                }

                for (int i = 0; i < _intputConfigurations.arraySize; i++)
                {
                    DisplayInputConfigurations(_intputConfigurations.GetArrayElementAtIndex(i));
                }

                EditorGUI.indentLevel--;
            }

            GUILayout.Space(5.0f);
            serializedObject.ApplyModifiedProperties();
        }
コード例 #3
0
        private void CreateFileMenu(Rect position)
        {
            GenericMenu fileMenu = new GenericMenu();

            fileMenu.AddItem(new GUIContent("Overwrite Input Settings"), false, HandleFileMenuOption, FileMenuOptions.OverriteInputSettings);
            fileMenu.AddItem(new GUIContent("Default Input Configuration"), false, HandleFileMenuOption, FileMenuOptions.CreateDefaultInputConfig);
            if (EditorToolbox.HasInputAdapterAddon())
            {
                fileMenu.AddItem(new GUIContent("Configure For Input Adapter"), false, HandleFileMenuOption, FileMenuOptions.ConfigureForInputAdapter);
            }

            fileMenu.AddSeparator("");
            if (_inputManager.inputConfigurations.Count > 0)
            {
                fileMenu.AddItem(new GUIContent("Create Snapshot"), false, HandleFileMenuOption, FileMenuOptions.CreateSnapshot);
            }
            else
            {
                fileMenu.AddDisabledItem(new GUIContent("Create Snapshot"));
            }

            if (EditorToolbox.CanLoadSnapshot())
            {
                fileMenu.AddItem(new GUIContent("Load Snapshot"), false, HandleFileMenuOption, FileMenuOptions.LoadSnapshot);
            }
            else
            {
                fileMenu.AddDisabledItem(new GUIContent("Load Snapshot"));
            }
            fileMenu.AddSeparator("");

            if (_inputManager.inputConfigurations.Count > 0)
            {
                fileMenu.AddItem(new GUIContent("Export"), false, HandleFileMenuOption, FileMenuOptions.Export);
            }
            else
            {
                fileMenu.AddDisabledItem(new GUIContent("Export"));
            }

            fileMenu.AddItem(new GUIContent("Import"), false, HandleFileMenuOption, FileMenuOptions.Import);
            if (EditorToolbox.HasJoystickMappingAddon())
            {
                fileMenu.AddItem(new GUIContent("Import Joystick Mapping"), false, HandleFileMenuOption, FileMenuOptions.ImportJoystickMapping);
            }

            fileMenu.DropDown(position);
        }