Esempio n. 1
0
    private bool OnPass(object _ignore)
    {
        string componentType = ComponentHandle.componentType.ToString();

        if ((componentType.Length > 4) && (componentType.Substring(0, 5).Equals("Needy")))
        {
            return(false);
        }

        if (_delegatedSolveUserNickName != null && _delegatedSolveResponseNotifier != null)
        {
            AwardSolve(_delegatedSolveUserNickName, _delegatedSolveResponseNotifier);
            _delegatedSolveUserNickName     = null;
            _delegatedSolveResponseNotifier = null;
        }
        else if (_currentUserNickName != null && _currentResponseNotifier != null)
        {
            AwardSolve(_currentUserNickName, _currentResponseNotifier);
        }

        BombCommander._bombSolvedModules++;
        BombMessageResponder.moduleCameras.UpdateSolves();

        if (_turnQueued)
        {
            Debug.LogFormat("[ComponentSolver] Activating queued turn for completed module {0}.", Code);
            _readyToTurn = true;
            _turnQueued  = false;
        }

        ComponentHandle.OnPass();

        BombMessageResponder.moduleCameras.DetachFromModule(BombComponent, true);

        return(false);
    }
Esempio n. 2
0
    private bool OnPass(object _ignore)
    {
        //string componentType = ComponentHandle.componentType.ToString();
        //string headerText = (string)CommonReflectedTypeInfo.ModuleDisplayNameField.Invoke(BombComponent, null);
        if (UnsupportedModule)
        {
            ComponentHandle?.idTextUnsupported?.gameObject.SetActive(false);
        }

        if (modInfo == null)
        {
            return(false);
        }

        int moduleScore = modInfo.moduleScore;

        if (modInfo.moduleScoreIsDynamic)
        {
            switch (modInfo.moduleScore)
            {
            case 0:
                moduleScore = (BombCommander.bombSolvableModules) / 2;
                break;

            default:
                moduleScore = 5;
                break;
            }
        }

        switch (modInfo.moduleID)
        {
        case "NeedyVentComponentSolver":
        case "NeedyKnobComponentSolver":
        case "NeedyDischargeComponentSolver":
            return(false);

        default:
            if (BombComponent.GetComponent <KMNeedyModule>() != null)
            {
                return(false);
            }
            break;
        }

        if (_delegatedSolveUserNickName != null && _delegatedSolveResponseNotifier != null)
        {
            AwardSolve(_delegatedSolveUserNickName, _delegatedSolveResponseNotifier, moduleScore);
            _delegatedSolveUserNickName     = null;
            _delegatedSolveResponseNotifier = null;
        }
        else if (_currentUserNickName != null && _currentResponseNotifier != null)
        {
            AwardSolve(_currentUserNickName, _currentResponseNotifier, moduleScore);
        }

        BombCommander.bombSolvedModules++;
        BombMessageResponder.moduleCameras?.UpdateSolves();

        if (_turnQueued)
        {
            DebugHelper.Log("[ComponentSolver] Activating queued turn for completed module {0}.", Code);
            _readyToTurn = true;
            _turnQueued  = false;
        }

        ComponentHandle.OnPass();

        BombMessageResponder.moduleCameras?.DetachFromModule(BombComponent, true);

        return(false);
    }
    private bool OnPass(object _ignore)
    {
        if (DisableOnStrike)
        {
            return(false);
        }
        //string componentType = ComponentHandle.componentType.ToString();
        //string headerText = (string)CommonReflectedTypeInfo.ModuleDisplayNameField.Invoke(BombComponent, null);
        if (modInfo != null)
        {
            int moduleScore = modInfo.moduleScore;
            if (modInfo.moduleScoreIsDynamic)
            {
                switch (modInfo.moduleScore)
                {
                case 0:
                    switch (modInfo.moduleID)                             //handle it on a module by module basis, this is to allow for FE to gain 3 times as many points
                    {
                    case "HexiEvilFMN":
                        moduleScore = (int)(BombCommander.bombSolvableModules * 3 * TwitchPlaySettings.data.DynamicScorePercentage);
                        break;

                    default:                                     //default for forget me not
                        moduleScore = (int)(BombCommander.bombSolvableModules * TwitchPlaySettings.data.DynamicScorePercentage);
                        break;
                    }
                    break;

                default:
                    moduleScore = 5;
                    break;
                }
            }

            if (BombComponent is NeedyComponent)
            {
                return(false);
            }

            if (UnsupportedModule)
            {
                ComponentHandle?.IDTextUnsupported?.gameObject.SetActive(false);
            }

            string solverNickname = null;
            if (!_silentlySolve)
            {
                if (_delegatedSolveUserNickName != null)
                {
                    solverNickname = _delegatedSolveUserNickName;
                    _delegatedSolveUserNickName = null;
                }
                else if (_currentUserNickName != null)
                {
                    solverNickname = _currentUserNickName;
                }
                else if (ComponentHandle?.PlayerName != null)
                {
                    solverNickname = ComponentHandle.PlayerName;
                }
                else
                {
                    solverNickname = IRCConnection.Instance.ChannelName;
                }
                AwardSolve(solverNickname, moduleScore);
            }
            ComponentHandle?.OnPass(solverNickname);
        }

        BombCommander.bombSolvedModules++;
        BombMessageResponder.moduleCameras?.UpdateSolves();

        if (_turnQueued)
        {
            DebugHelper.Log("[ComponentSolver] Activating queued turn for completed module {0}.", Code);
            _readyToTurn = true;
            _turnQueued  = false;
        }

        BombMessageResponder.moduleCameras?.DetachFromModule(BombComponent, true);
        CommonReflectedTypeInfo.UpdateTimerDisplayMethod.Invoke(BombCommander.timerComponent, null);

        return(false);
    }