public SimpleModComponentSolver(TwitchModule module, ComponentSolverFields componentSolverFields) :
     base(module, componentSolverFields.HookUpEvents)
 {
     ProcessMethod      = componentSolverFields.Method;
     ForcedSolveMethod  = componentSolverFields.ForcedSolveMethod;
     CommandComponent   = componentSolverFields.CommandComponent;
     ZenModeField       = componentSolverFields.ZenModeField;
     TimeModeField      = componentSolverFields.TimeModeField;
     AbandonModuleField = componentSolverFields.AbandonModuleField;
     TwitchPlaysField   = componentSolverFields.TwitchPlaysField;
     HelpMessageField   = componentSolverFields.HelpMessageField;
     TwitchPlays        = true;
     ZenMode            = OtherModes.Unexplodable;
     TimeMode           = OtherModes.TimeModeOn;
     ModInfo            = ComponentSolverFactory.GetModuleInfo(GetModuleType());
 }
Ejemplo n.º 2
0
 public CoroutineModComponentSolver(TwitchModule module, ComponentSolverFields componentSolverFields) :
     base(module, componentSolverFields.HookUpEvents)
 {
     ProcessMethod      = componentSolverFields.Method;
     ForcedSolveMethod  = componentSolverFields.ForcedSolveMethod;
     CommandComponent   = componentSolverFields.CommandComponent;
     TryCancelField     = componentSolverFields.CancelField;
     ZenModeField       = componentSolverFields.ZenModeField;
     TimeModeField      = componentSolverFields.TimeModeField;
     AbandonModuleField = componentSolverFields.AbandonModuleField;
     TwitchPlaysField   = componentSolverFields.TwitchPlaysField;
     SkipTimeField      = componentSolverFields.TwitchPlaysSkipTimeField;
     HelpMessageField   = componentSolverFields.HelpMessageField;
     ManualCodeField    = componentSolverFields.ManualCodeField;
     TwitchPlays        = true;
     ZenMode            = OtherModes.ZenModeOn;
     TimeMode           = OtherModes.TimeModeOn;
     ModInfo            = ComponentSolverFactory.GetModuleInfo(GetModuleType());
 }
Ejemplo n.º 3
0
    public UnsupportedModComponentSolver(TwitchModule module, ComponentSolverFields componentSolverFields = null)
        : base(module, componentSolverFields == null || componentSolverFields.HookUpEvents)
    {
        _bombModule  = module.BombComponent.GetComponent <KMBombModule>();
        _needyModule = module.BombComponent.GetComponent <KMNeedyModule>();

        ModInfo = new ModuleInformation {
            moduleScore = 0, builtIntoTwitchPlays = true, DoesTheRightThing = true, helpText = $"Solve this {(_bombModule != null ? "module" : "needy")} with !{{0}} solve", moduleDisplayName = $"Unsupported Twitchplays Module  ({module.BombComponent.GetModuleDisplayName()})", moduleID = "UnsupportedTwitchPlaysModule"
        };

        UnsupportedModule = true;

        Selectable selectable = module.BombComponent.GetComponent <Selectable>();

        Selectable[]         selectables       = module.BombComponent.GetComponentsInChildren <Selectable>();
        HashSet <Selectable> selectableHashSet = new HashSet <Selectable>(selectables)
        {
            selectable
        };

        selectable.OnInteract += () => { if (Module != null && Module.CanvasGroupUnsupported != null)
                                         {
                                             Module.CanvasGroupUnsupported.gameObject.SetActive(false);
                                         }
                                         return(true); };
        selectable.OnDeselect += (x) => { if (Module != null && Module.CanvasGroupUnsupported != null)
                                          {
                                              Module.CanvasGroupUnsupported.gameObject.SetActive(x == null || !selectableHashSet.Contains(x));
                                          }
        };

        if (componentSolverFields == null)
        {
            return;
        }
        CommandComponent  = componentSolverFields.CommandComponent;
        ForcedSolveMethod = componentSolverFields.ForcedSolveMethod;
    }