Пример #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"))
            {
                var tableContainer = new FileTableContainer();
                var converter      = new VpxSceneConverter(tableContainer);
                var rootGameObj    = converter.Convert(false);
                Selection.activeGameObject = rootGameObj;
                Undo.RegisterCreatedObjectUndo(rootGameObj, "New Table");
            }

            if (TableComponent == null)
            {
                return;
            }

            EditorGUILayout.Space();
            GUILayout.Label(TableComponent.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("Hit Target", Icons.HitTarget(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(HitTarget.GetHitTarget, "New Hit Target");
            }

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

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

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

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

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

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

            if (CreateButton("Drop Target\nBank", Icons.DropTargetBank(color: iconColor), iconSize, buttonStyle))
            {
                CreatePrefab <DropTargetBankComponent>("Drop Target Banks", "Prefabs/DropTargetBank");
            }

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

            if (CreateButton("Slingshot", Icons.Slingshot(color: iconColor), iconSize, buttonStyle))
            {
                CreatePrefab <SlingshotComponent>("Slingshots", "Prefabs/Slingshot");
            }

            if (CreateButton("Metal Wire\nGuide", Icons.MetalWireGuide(color: iconColor), iconSize, buttonStyle))
            {
                CreateItem(MetalWireGuide.GetDefault, "New MetalWireGuide");
            }


            GUILayout.EndHorizontal();
        }
Пример #2
0
        public Texture2D Lookup <T>(T mb, IconSize size = IconSize.Large, IconColor color = IconColor.Gray) where T : class
        {
            switch (mb)
            {
            case BallRollerComponent _: return(Icons.BallRoller(size, color));

            case BumperComponent _: return(Icons.Bumper(size, color));

            case CannonRotatorComponent _: return(Icons.Cannon(size, color));

            case DropTargetComponent _: return(Icons.DropTarget(size, color));

            case DropTargetBankComponent _: return(Icons.DropTargetBank(size, color));

            case FlipperComponent _: return(Icons.Flipper(size, color));

            case GateComponent _: return(Icons.Gate(size, color));

            case GateLifterComponent _: return(Icons.GateLifter(size, color));

            case HitTargetComponent _: return(Icons.HitTarget(size, color));

            case KickerComponent _: return(Icons.Kicker(size, color));

            case LightComponent _: return(Icons.Light(size, color));

            case LightGroupComponent _: return(Icons.LightGroup(size, color));

            case PlungerComponent _: return(Icons.Plunger(size, color));

            case PlayfieldComponent _: return(Icons.Playfield(size, color));

            case PrimitiveComponent _: return(Icons.Primitive(size, color));

            case RampComponent _: return(Icons.Ramp(size, color));

            case RotatorComponent _: return(Icons.Rotator(size, color));

            case RubberComponent _: return(Icons.Rubber(size, color));

            case ScoreReelDisplayComponent _: return(Icons.ScoreReel(size, color));

            case ScoreReelComponent _: return(Icons.ScoreReelSimple(size, color));

            case SpinnerComponent _: return(Icons.Spinner(size, color));

            case SlingshotComponent _: return(Icons.Slingshot(size, color));

            case SurfaceComponent _: return(Icons.Surface(size, color));

            case StepRotatorMechComponent _: return(Icons.Mech(size, color));

            case TeleporterComponent _: return(Icons.Teleporter(size, color));

            case TriggerComponent _: return(Icons.Trigger(size, color));

            case TroughComponent _: return(Icons.Trough(size, color));

            case MetalWireGuideComponent _: return(Icons.MetalWireGuide(size, color));

            case CollisionSwitchComponent _: return(Icons.Switch(false, size, color));

            default: return(null);
            }
        }
Пример #3
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();
        }