Exemple #1
0
 public SimpleHoldableHandler(KMHoldableCommander commander, FloatingHoldable holdable, Component commandComponent, MethodInfo handler, string helpMessage)
     : base(commander, holdable)
 {
     CommandComponent = commandComponent;
     HandlerMethod    = handler;
     HelpMessage      = helpMessage;
 }
 public CoroutineHoldableHandler(KMHoldableCommander commander, FloatingHoldable holdable, Component commandComponent, MethodInfo handler, string helpMessage, FieldInfo cancelbool)
     : base(commander, holdable)
 {
     CommandComponent = commandComponent;
     HandlerMethod    = handler;
     CancelBool       = cancelbool;
     HelpMessage      = helpMessage;
 }
 public AlarmClockHoldableHandler(KMHoldableCommander commander, FloatingHoldable holdable) : base(commander, holdable)
 {
     clock        = Holdable.GetComponentInChildren <AlarmClock>();
     HelpMessage  = "Snooze the alarm clock with !{0} snooze.";
     HelpMessage += (TwitchPlaySettings.data.AllowSnoozeOnly && !TwitchPlaySettings.data.AnarchyMode)
                     ? " (Current Twitch play settings forbids turning the Alarm clock back on.)"
                     : " Alarm clock may also be turned back on with !{0} snooze.";
     Instance = this;
 }
 public IRCConnectionManagerHandler(KMHoldableCommander commander, FloatingHoldable holdable) : base(commander, holdable)
 {
     _connectButton  = holdable.GetComponent <IRCConnectionManagerHoldable>().ConnectButton;
     _elevatorSwitch = TPElevatorSwitch.Instance;
     HelpMessage     = "Disconnect the IRC from twitch plays with !{0} disconnect.  For obvious reasons, only the streamer may do this.";
     if (_elevatorSwitch?.gameObject.activeInHierarchy ?? false)
     {
         HelpMessage += " Turn the elevator on with !{0} elevator on. Turn the Elevator off with !{0} elevator off. Flip the elevator on/off with !{0} elevator toggle";
     }
     if (commander != null)
     {
         commander.ID = "ircmanager";
     }
     Instance = this;
 }
Exemple #5
0
    private static HoldableHandler CreateModComponentSolver(KMHoldableCommander commander, FloatingHoldable holdable)
    {
        DebugLog("Attempting to find a valid process command method to respond with on holdable {0}...", holdable.name);

        ModHoldableHandlerDelegate modComponentSolverCreator = GenerateModComponentSolverCreator(holdable, out Type holdableType);

        if (holdableType?.FullName == null || modComponentSolverCreator == null)
        {
            return(new UnsupportedHoldableHandler(commander, holdable));
        }

        ModHoldableCreators[holdableType.FullName] = modComponentSolverCreator;

        return(ModHoldableCreators[holdableType.FullName](commander, holdable));
    }
    protected HoldableHandler(KMHoldableCommander commander, FloatingHoldable holdable)
    {
        HoldableCommander = commander;
        Holdable          = holdable;

        if (!BombMessageResponder.BombActive)
        {
            return;
        }
        KMGameCommands gameCommands = holdable.GetComponent <KMGameCommands>();

        if (gameCommands == null)
        {
            return;
        }
        gameCommands.OnCauseStrike += OnStrike;
    }
Exemple #7
0
    public static HoldableHandler CreateHandler(KMHoldableCommander commander, FloatingHoldable holdable)
    {
        if (commander != null)
        {
            commander.ID = holdable.name.ToLowerInvariant().Replace("(clone)", "");
        }

        foreach (Type type in ModHoldableTypes)
        {
            if (type?.FullName == null)
            {
                continue;
            }
            if (holdable.GetComponent(type) == null || !ModHoldableCreators.ContainsKey(type.FullName))
            {
                continue;
            }
            return(ModHoldableCreators[type.FullName](commander, holdable));
        }

        return(CreateModComponentSolver(commander, holdable));
    }
 public UnsupportedHoldableHandler(KMHoldableCommander commander, FloatingHoldable holdable)
     : base(commander, holdable)
 {
     HelpMessage = "!{0} is not supported by Twitch Plays yet.";
 }