Esempio n. 1
0
        private void OnGUI()
        {
            const IconColor iconColor   = IconColor.Gray;
            var             iconSize    = position.width / 2f - 4.5f;
            var             buttonStyle = new GUIStyle(GUI.skin.button)
            {
                alignment     = TextAnchor.MiddleCenter,
                imagePosition = ImagePosition.ImageAbove
            };

            if (GUILayout.Button("New Table"))
            {
                const string tableName   = "Table1";
                var          rootGameObj = new GameObject();
                var          table       = new Table(new TableData {
                    Name = tableName
                });
                var converter = rootGameObj.AddComponent <VpxConverter>();
                converter.Convert(tableName, table);
                DestroyImmediate(converter);
                Selection.activeGameObject = rootGameObj;
                Undo.RegisterCreatedObjectUndo(rootGameObj, "New Table");
            }

            if (_tableAuthoring == null)
            {
                return;
            }

            EditorGUILayout.Space();
            GUILayout.Label(_tableAuthoring.name, new GUIStyle(GUI.skin.label)
            {
                fontStyle = FontStyle.Bold
            });

            GUILayout.BeginHorizontal();

            if (CreateButton("Wall", Icons.Surface(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Surface.GetDefault, "Wall");
            }

            if (CreateButton("Gate", Icons.Gate(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Gate.GetDefault, "New Gate");
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (CreateButton("Ramp", Icons.Ramp(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Ramp.GetDefault, "New Ramp");
            }

            if (CreateButton("Flipper", Icons.Flipper(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Flipper.GetDefault, "New Flipper");
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (CreateButton("Plunger", Icons.Plunger(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Plunger.GetDefault, "New Plunger");
            }

            if (CreateButton("Bumper", Icons.Bumper(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Bumper.GetDefault, "New Bumper");
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (CreateButton("Spinner", Icons.Spinner(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Spinner.GetDefault, "New Spinner");
            }

            if (CreateButton("Trigger", Icons.Trigger(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Trigger.GetDefault, "New Trigger");
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (CreateButton("Kicker", Icons.Kicker(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Kicker.GetDefault, "New Kicker");
            }

            if (CreateButton("Light", Icons.Light(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Light.GetDefault, "New Light");
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (CreateButton("Target", Icons.Target(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(HitTarget.GetDefault, "New Target");
            }

            if (CreateButton("Rubber", Icons.Rubber(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Rubber.GetDefault, "New Rubber");
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (CreateButton("Primitive", Icons.Primitive(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(Primitive.GetDefault, "New Primitive");
            }

            GUILayout.EndHorizontal();
        }