private static void VibrateRadial(Toy toy, string text = "")
 {
     CustomSubMenu.AddRadialPuppet(text, f => {
         int roundedPercent = (int)Math.Round(f * 100);
         toy.setSpeed(roundedPercent / (100 / toy.maxSpeed)); //0-10
     }, ((float)toy.lastSpeed) / toy.maxSpeed, toy.GetTexture());
 }
Ejemplo n.º 2
0
 private static void VibrateRadial(Toy toy, string text = "")
 {
     AMAPI.AddRadialPedalToSubMenu(text,
                                   f => {
         int roundedPercent = (int)Math.Round(f * 100);
         toy.setSpeed(roundedPercent / 5);     //0-20
     }, ((float)toy.lastSpeed) / 20, toy_icons[toy.name]);
 }
        private static void handleSetSpeeds(VibratorControllerMessage msg)
        {
            foreach (var toymessage in msg.messages.Select(x => x.Value))
            {
                if (!Toy.myToys.ContainsKey(toymessage.ToyID))
                {
                    continue;
                }

                Toy toy = Toy.myToys[toymessage.ToyID];

                switch (toymessage.Command)
                {
                //Local toy commands
                case Commands.SetSpeed:
                    if (toy?.hand == Hand.shared)
                    {
                        toy?.setSpeed(toymessage.Strength);
                    }

                    break;

                case Commands.SetSpeedEdge:
                    if (toy?.hand == Hand.shared)
                    {
                        toy?.setEdgeSpeed(toymessage.Strength);
                    }

                    break;

                case Commands.SetAir:
                    if (toy?.hand == Hand.shared)
                    {
                        toy?.setContraction(toymessage.Strength);
                    }

                    break;

                case Commands.SetRotate:
                    if (toy?.hand == Hand.shared)
                    {
                        toy?.rotate();
                    }

                    break;
                }
            }
        }
Ejemplo n.º 4
0
        // TODO find a way to use radial button
        // See with gompo#6956 if he found anything interesting for that

        private static void PercentageMenu(Toy toy, int purcent, Texture2D logo = null)
        {
            actionMenuApi.AddPedalToCustomMenu(() => { toy.setSpeed(purcent / 5); }, "", logo);
        }