Ejemplo n.º 1
0
    protected void HandleModuleException(Exception e)
    {
        Debug.Log("[TwitchPlays] While solving a module an exception has occurred! Here's the error:");
        Debug.LogException(e);

        IRCConnection.SendMessage("Looks like a module ran into a problem while running a command, automatically solving module. Some other modules may also be solved to prevent problems.");

        _currentUserNickName        = null;
        _delegatedSolveUserNickName = null;
        BombCommander.RemoveSolveBasedModules();
        CommonReflectedTypeInfo.HandlePassMethod.Invoke(BombComponent, null);
    }
Ejemplo n.º 2
0
    private void Start()
    {
        if (bombComponent != null)
        {
            headerText.text = (string)CommonReflectedTypeInfo.ModuleDisplayNameField.Invoke(bombComponent, null);
        }

        idText.text            = string.Format("!{0}", _code);
        idTextMultiDecker.text = _code;

        canvasGroup.alpha    = 0.0f;
        highlightGroup.alpha = 0.0f;

        canvasGroupMultiDecker.alpha = bombCommander._multiDecker ? 1.0f : 0.0f;

        unclaimedBackgroundColor = idBannerPrefab.GetComponent <Image>().color;

        try
        {
            _solver = ComponentSolverFactory.CreateSolver(bombCommander, bombComponent, componentType, ircConnection, coroutineCanceller);
            if (_solver != null)
            {
                _solver.Code            = _code;
                _solver.ComponentHandle = this;
                Vector3 pos = canvasGroupMultiDecker.transform.localPosition;
                canvasGroupMultiDecker.transform.localPosition = new Vector3(_solver.statusLightLeft ? -pos.x : pos.x, pos.y, _solver.statusLightBottom ? -pos.z : pos.z);

                /*
                 * Vector3 angle = canvasGroupMultiDecker.transform.eulerAngles;
                 * canvasGroupMultiDecker.transform.localEulerAngles = new Vector3(angle.x, _solver.IDRotation, angle.z);
                 * angle = canvasGroupMultiDecker.transform.localEulerAngles;
                 * canvasGroup.transform.localEulerAngles = new Vector3(angle.x, _solver.IDRotation, angle.z);
                 *
                 * switch ((int) _solver.IDRotation)
                 * {
                 *  case 90:
                 *  case -270:
                 *      switch (direction)
                 *      {
                 *          case Direction.Up:
                 *              direction = Direction.Left;
                 *              break;
                 *          case Direction.Left:
                 *              direction = Direction.Down;
                 *              break;
                 *          case Direction.Down:
                 *              direction = Direction.Right;
                 *              break;
                 *          case Direction.Right:
                 *              direction = Direction.Up;
                 *              break;
                 *      }
                 *      break;
                 *
                 *  case 180:
                 *  case -180:
                 *      switch (direction)
                 *      {
                 *          case Direction.Up:
                 *              direction = Direction.Down;
                 *              break;
                 *          case Direction.Left:
                 *              direction = Direction.Right;
                 *              break;
                 *          case Direction.Down:
                 *              direction = Direction.Up;
                 *              break;
                 *          case Direction.Right:
                 *              direction = Direction.Left;
                 *              break;
                 *      }
                 *      break;
                 *
                 *  case 270:
                 *  case -90:
                 *      switch (direction)
                 *      {
                 *          case Direction.Up:
                 *              direction = Direction.Right;
                 *              break;
                 *          case Direction.Left:
                 *              direction = Direction.Up;
                 *              break;
                 *          case Direction.Down:
                 *              direction = Direction.Left;
                 *              break;
                 *          case Direction.Right:
                 *              direction = Direction.Down;
                 *              break;
                 *      }
                 *      break;
                 * }*/
            }
        }
        catch (NotSupportedException e)
        {
            Debug.Log(e.Message);
            unsupportedPrefab.gameObject.SetActive(true);
            idBannerPrefab.gameObject.SetActive(false);
            canvasGroupMultiDecker.alpha = 0.0f;

            Debug.Log("[TwitchPlays] An unimplemented module was added to a bomb, solving module.");
            bombCommander.RemoveSolveBasedModules();
            CommonReflectedTypeInfo.HandlePassMethod.Invoke(bombComponent, null);
        }

        Arrow.gameObject.SetActive(true);
        HighlightArrow.gameObject.SetActive(true);
    }