Esempio n. 1
0
        private static void DrawCoil(string label, DeviceCoil coil)
        {
            var labelPos = EditorGUILayout.GetControlRect();

            labelPos.height = 18;
            var switchPos = new Rect((float)(labelPos.x + (double)EditorGUIUtility.labelWidth - 20.0), labelPos.y, labelPos.height, labelPos.height);

            GUI.Label(labelPos, label);
            GUI.DrawTexture(switchPos, Icons.Bolt(IconSize.Small, coil.IsEnabled ? IconColor.Orange : IconColor.Gray));
        }
Esempio n. 2
0
        private static void DrawSwitch(string label, DeviceSwitch sw)
        {
            var labelPos = EditorGUILayout.GetControlRect();

            labelPos.height = 18;
            var switchPos = new Rect((float)(labelPos.x + (double)EditorGUIUtility.labelWidth + 2.0), labelPos.y, labelPos.height, labelPos.height);

            GUI.Label(labelPos, label);
            GUI.DrawTexture(switchPos, Icons.Switch(sw.IsSwitchClosed, IconSize.Small, sw.IsSwitchClosed ? IconColor.Orange : IconColor.Gray));
        }
        protected override void OnEnable()
        {
            titleContent = new GUIContent("Switch Manager",
                                          Icons.Switch(false, size: IconSize.Small));

            RowHeight = 22;

            _inputManager = new InputManager(RESOURCE_PATH);
            AssetDatabase.Refresh();

            _listViewItemRenderer = new SwitchListViewItemRenderer(_ids, _switchables, _inputManager);

            base.OnEnable();
        }
        public void Render(Rect pos, T currentObj, Action <T> onUpdated, Func <T, bool> filter = null)
        {
            // render content
            var content = currentObj == null
                                ? new GUIContent("None")
                                : _showIcon
                                        ? new GUIContent(currentObj.name, Icons.ByComponent(currentObj, IconSize.Small, IconColor))
                                        : new GUIContent(currentObj.name);

            // render drawer
            var id = GUIUtility.GetControlID(FocusType.Keyboard, pos);
            var objectFieldButton = GUI.skin.GetStyle("ObjectFieldButton");
            var suffixButtonPos   = new Rect(pos.xMax - 19f, pos.y + 1, 19f, pos.height - 2);

            EditorGUIUtility.SetIconSize(new Vector2(12f, 12f));

            // handle click
            if (Event.current.type == EventType.MouseDown && pos.Contains(Event.current.mousePosition))
            {
                if (currentObj != null && !suffixButtonPos.Contains(Event.current.mousePosition))
                {
                    // click on ping
                    var mb = currentObj as MonoBehaviour;
                    if (mb)
                    {
                        EditorGUIUtility.PingObject(mb.gameObject);
                    }
                }
                else
                {
                    // click on picker
                    _itemPickDropdownState ??= new AdvancedDropdownState();
                    var dropdown = new ItemSearchableDropdown <T>(
                        _itemPickDropdownState,
                        _tableComp,
                        _pickerTitle,
                        onUpdated,
                        filter
                        );
                    dropdown.Show(pos);
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                EditorStyles.objectField.Draw(pos, content, id, DragAndDrop.activeControlID == id, pos.Contains(Event.current.mousePosition));
                objectFieldButton.Draw(suffixButtonPos, GUIContent.none, id, DragAndDrop.activeControlID == id, suffixButtonPos.Contains(Event.current.mousePosition));
            }
        }
        protected override Texture GetIcon(CoilListData coilListData)
        {
            Texture2D icon = null;

            switch (coilListData.Destination)
            {
            case CoilDestination.Playfield:
                if (coilListData.Device != null)
                {
                    icon = Icons.ByComponent(coilListData.Device, IconSize.Small);
                }
                break;

            case CoilDestination.Lamp:
                icon = Icons.Light(IconSize.Small);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(icon);
        }
Esempio n. 6
0
        private UnityEngine.Texture GetIcon(CoilListData coilListData)
        {
            Texture2D icon = null;

            switch (coilListData.Destination)
            {
            case CoilDestination.Playfield:
                if (_coils.ContainsKey(coilListData.PlayfieldItem.ToLower()))
                {
                    icon = Icons.ByComponent(_coils[coilListData.PlayfieldItem.ToLower()], size: IconSize.Small);
                }
                break;

            case CoilDestination.Device:
                if (_coilDevices.ContainsKey(coilListData.Device.ToLower()))
                {
                    icon = Icons.ByComponent(_coilDevices[coilListData.Device.ToLower()], IconSize.Small);
                }
                break;
            }

            return(icon);
        }
 protected override Texture2D StatusIcon(bool status) => Icons.Bolt(IconSize.Small, status ? IconColor.Orange : IconColor.Gray);
Esempio n. 8
0
 public void DisableGizmoIcons()
 {
     Icons.DisableGizmo <BallRollerComponent>();
     Icons.DisableGizmo <BumperComponent>();
     Icons.DisableGizmo <BumperColliderComponent>();
     Icons.DisableGizmo <BumperRingAnimationComponent>();
     Icons.DisableGizmo <BumperSkirtAnimationComponent>();
     Icons.DisableGizmo <CannonRotatorComponent>();
     Icons.DisableGizmo <DefaultGamelogicEngine>();
     Icons.DisableGizmo <DotMatrixDisplayComponent>();
     Icons.DisableGizmo <DropTargetComponent>();
     Icons.DisableGizmo <DropTargetBankComponent>();
     Icons.DisableGizmo <DropTargetColliderComponent>();
     Icons.DisableGizmo <DropTargetAnimationComponent>();
     //Icons.DisableGizmo<FlasherComponent>();
     Icons.DisableGizmo <FlipperComponent>();
     Icons.DisableGizmo <FlipperColliderComponent>();
     Icons.DisableGizmo <FlipperBaseMeshComponent>();
     Icons.DisableGizmo <FlipperRubberMeshComponent>();
     Icons.DisableGizmo <GateComponent>();
     Icons.DisableGizmo <GateLifterComponent>();
     Icons.DisableGizmo <GateColliderComponent>();
     Icons.DisableGizmo <GateWireAnimationComponent>();
     Icons.DisableGizmo <HitTargetComponent>();
     Icons.DisableGizmo <HitTargetColliderComponent>();
     Icons.DisableGizmo <HitTargetAnimationComponent>();
     Icons.DisableGizmo <KickerComponent>();
     Icons.DisableGizmo <KickerColliderComponent>();
     Icons.DisableGizmo <LightComponent>();
     Icons.DisableGizmo <LightGroupComponent>();
     Icons.DisableGizmo <PlayfieldComponent>();
     Icons.DisableGizmo <PlayfieldColliderComponent>();
     Icons.DisableGizmo <PlayfieldMeshComponent>();
     Icons.DisableGizmo <PlungerComponent>();
     Icons.DisableGizmo <PlungerColliderComponent>();
     Icons.DisableGizmo <PlungerFlatMeshComponent>();
     Icons.DisableGizmo <PlungerRodMeshComponent>();
     Icons.DisableGizmo <PlungerSpringMeshComponent>();
     Icons.DisableGizmo <PrimitiveComponent>();
     Icons.DisableGizmo <PrimitiveColliderComponent>();
     Icons.DisableGizmo <PrimitiveMeshComponent>();
     Icons.DisableGizmo <RampComponent>();
     Icons.DisableGizmo <RampColliderComponent>();
     Icons.DisableGizmo <RampFloorMeshComponent>();
     Icons.DisableGizmo <RampWallMeshComponent>();
     Icons.DisableGizmo <RampWireMeshComponent>();
     Icons.DisableGizmo <RotatorComponent>();
     Icons.DisableGizmo <RubberComponent>();
     Icons.DisableGizmo <RubberMeshComponent>();
     Icons.DisableGizmo <RubberColliderComponent>();
     Icons.DisableGizmo <ScoreReelComponent>();
     Icons.DisableGizmo <ScoreReelDisplayComponent>();
     Icons.DisableGizmo <SegmentDisplayComponent>();
     Icons.DisableGizmo <SlingshotComponent>();
     Icons.DisableGizmo <SpinnerComponent>();
     Icons.DisableGizmo <SpinnerColliderComponent>();
     Icons.DisableGizmo <SpinnerPlateAnimationComponent>();
     Icons.DisableGizmo <SurfaceComponent>();
     Icons.DisableGizmo <SurfaceColliderComponent>();
     Icons.DisableGizmo <SurfaceSideMeshComponent>();
     Icons.DisableGizmo <SurfaceTopMeshComponent>();
     Icons.DisableGizmo <TableComponent>();
     Icons.DisableGizmo <TeleporterComponent>();
     Icons.DisableGizmo <TriggerComponent>();
     Icons.DisableGizmo <TriggerAnimationComponent>();
     Icons.DisableGizmo <TriggerColliderComponent>();
     Icons.DisableGizmo <TriggerMeshComponent>();
     Icons.DisableGizmo <MetalWireGuideComponent>();
     Icons.DisableGizmo <MetalWireGuideMeshComponent>();
     Icons.DisableGizmo <MetalWireGuideColliderComponent>();
 }
Esempio n. 9
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);
            }
        }
Esempio n. 10
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();
        }