public void ToggleOn()
    {
        toggled = true;

        flexButtonComponent.selectedColor = ToggleOnColor;
        flexButtonComponent.passiveColor  = DarkPassiveColor;
        flexButtonComponent.hoveringColor = DarkHoveringColor;

        spriteRenderer.sprite = liftHeadsetSprite;
        labelText.text        = "Lift\nHeadset";

        flexButtonComponent.SetState(1);

        Tippies.SpawnTippy("Please Lift Headset", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
    }
Esempio n. 2
0
    public void ToggleOn()
    {
        toggled = true;
        button.selectedColor = TOGGLE_ON;
        button.passiveColor  = DARK_PASSIVE;
        button.hoveringColor = DARK_HOVERING;

        text.text     = "Lift Headset...";
        text.fontSize = otherFontSize;
        text.color    = Color.white;

        button.SetState(1);

        Tippies.SpawnTippy("Please Lift Headset", 4f, TMPro.TextAlignmentOptions.Center, new Vector2(6, 1f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
    }
    public void ToggleOn()
    {
        switch (tournamentMenu.actionState)
        {
        case TournamentMenu.ActionState.NoAction:
            return;

        case TournamentMenu.ActionState.Contribute:
            canvasSubmitMenu.gameObject.SetActive(true);
            Tippies.SpawnTippy("Please Lift Headset", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
            break;

        case TournamentMenu.ActionState.SelectWinners:
            // make tournament panel multi select
            text.text = "Choose\nFrom Below...";
            tournamentMenu.submissionsPanel.SwitchToMultiSelect();
            if (tournamentMenu.submissionsPanel.selected.Count > 0)
            {
                tournamentMenu.continueButton.gameObject.SetActive(true);
            }
            break;

        case TournamentMenu.ActionState.ManageTournament:
            text.text = "Managing...";
            TournamentMenu.Instance.manageTournamentMenu.UpdateState();
            TournamentMenu.Instance.manageTournamentMenu.GetComponent <AnimationHandler>().OpenMenu();
            break;
        }

        toggled = true;
        button.selectedColor = TOGGLE_ON;
        button.passiveColor  = DARK_PASSIVE;
        button.hoveringColor = DARK_HOVERING;

        text.fontSize = otherFontSize;
        text.color    = Color.white;

        button.SetState(1);
    }
    public void FireSelectWinners()
    {
        Async.runInCoroutine(delegate(Async thread, object param)
        {
            var submissions = winningSubmissions.Select(sub => Utils.HexStringToByteArray(sub.hash)).ToList();
            return(TournamentMenu.Tournament.selectWinners(submissions, distribution, new BigInteger((int)MatryxTournament.SelectWinnerAction.DoNothing), BigInteger.Zero, BigInteger.Zero, BigInteger.Zero, BigInteger.Zero,
                                                           delegate(object result)
            {
                Debug.Log((bool)result ? "Successfully selected winners!" : "Winner selection unsuccessful.");
                SpinForTheWin(false);
                SetButtonsEnabled(true);
                PressButton("WinnersOnlyButton");
                if ((bool)result)
                {
                    StatisticsTracking.EndEvent("Matryx", "Winner Selection Only", new Dictionary <string, object>()
                    {
                        { "success", true }
                    });
                    Tippies.SpawnTippy("Winner Selection Transaction Successful", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 5f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                    TournamentMenu.Tournament.currentRound.winningSubmissions = winningSubmissions;
                    TournamentMenu.Instance.ProcessRound(TournamentMenu.Tournament.currentRound);
                    Close();

                    TournamentMenu.Instance.actionState = TournamentMenu.ActionState.ManageTournament;
                    TournamentMenuCenterButton.Instance.updateState();
                }
                else
                {
                    StatisticsTracking.EndEvent("Matryx", "Winner Selection Only", new Dictionary <string, object>()
                    {
                        { "success", false }
                    });
                    Tippies.SpawnTippy("Winner Selection Transaction Failed", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                }
            }));
        });
    }
Esempio n. 5
0
 public void createTippy(string content)
 {
     // var body = transform.Find("Body");
     tippy = Tippies.SpawnTippy(content, fontSize, alignment, size, lifetime, gameObject.transform, offset, fadeInDuration, fadeOutDuration, movementMode);
 }
    public void HandleInput(GameObject sender)
    {
        switch (sender.name)
        {
        case "WinnersOnlyButton":
            ToggleButton("WinnersYes");
            ToggleButton("WinnersNo");
            ToggleText("Are You Sure Winners");
            winnersToggled = !winnersToggled;
            ToggleFlexButton(winnersToggled, buttons["WinnersOnlyButton"]);
            break;

        case "NewRoundButton":
            roundToggled = !roundToggled;
            string btnText = "Create New\nRound";
            if (roundToggled)
            {
                btnText = "Please Lift\nHeadset";
                Tippies.SpawnTippy("Please Lift Headset", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                newRoundMenu.SetTournament(TournamentMenu.Tournament);
                newRoundMenu.gameObject.SetActive(true);
            }
            else
            {
                Tippies.DestroyTippy("Please Lift Headset");
                newRoundMenu.gameObject.SetActive(false);
            }
            ToggleFlexButton(roundToggled, buttons["NewRoundButton"], btnText);
            break;

        case "CloseTournamentButton":
            ToggleButton("CloseTournamentYes");
            ToggleButton("CloseTournamentNo");
            ToggleText("Are You Sure Tournament");
            closeToggled = !closeToggled;
            ToggleFlexButton(closeToggled, buttons["CloseTournamentButton"]);
            break;

        case "WinnersYes":
            if (!winSpin)
            {
                SpinForTheWin();
                SetButtonsEnabled(false);
                FireSelectWinners();
            }
            break;

        case "WinnersNo":
            HandleInput(buttons["WinnersOnlyButton"].gameObject);
            break;

        case "CloseTournamentYes":
            SpinForTheClose();
            SetButtonsEnabled(false);
            FireCloseTournament();
            break;

        case "CloseTournamentNo":
            HandleInput(buttons["CloseTournamentButton"].gameObject);
            break;

        default:
            break;
        }
    }
    public void FireCloseTournament()
    {
        if (TournamentMenu.Tournament.currentRound.winningSubmissions.Count == 0)
        {
            Async.runInCoroutine(delegate(Async thread, object param)
            {
                var submissions = winningSubmissions.Select(sub => Utils.HexStringToByteArray(sub.hash)).ToList();
                return(TournamentMenu.Tournament.selectWinners(submissions, distribution, new BigInteger((int)MatryxTournament.SelectWinnerAction.CloseTournament), BigInteger.Zero, BigInteger.Zero, BigInteger.Zero, BigInteger.Zero,
                                                               delegate(object result)
                {
                    Debug.Log((bool)result ? "Successfully closed the tournament!" : "Close tournament unsuccessful.");
                    SpinForTheClose(false);
                    PressButton("CloseTournamentButton");
                    if ((bool)result)
                    {
                        StatisticsTracking.EndEvent("Matryx", "Winner Selection & Tournament Close", new Dictionary <string, object>()
                        {
                            { "success", true }
                        });
                        Tippies.SpawnTippy("Close Tournament Transaction Successful", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 5f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                        Close();

                        TournamentMenu.Instance.actionState = TournamentMenu.ActionState.NoAction;
                        TournamentMenuCenterButton.Instance.updateState();
                    }
                    else
                    {
                        StatisticsTracking.EndEvent("Matryx", "Winner Selection Only", new Dictionary <string, object>()
                        {
                            { "success", false }
                        });
                        Tippies.SpawnTippy("Close Tournament Transaction Failed", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                    }
                }));
            });
        }
        else
        {
            Async.runInCoroutine(delegate(Async thread, object param)
            {
                var submissions = winningSubmissions.Select(sub => Utils.HexStringToByteArray(sub.hash)).ToList();
                return(TournamentMenu.Tournament.closeTournament(
                           delegate(object result)
                {
                    Debug.Log((bool)result ? "Successfully closed the tournament!" : "Close tournament unsuccessful.");
                    SetButtonsEnabled(true);
                    SpinForTheClose(false);
                    if ((bool)result)
                    {
                        StatisticsTracking.EndEvent("Matryx", "Tournament Close Only", new Dictionary <string, object>()
                        {
                            { "success", true }
                        });
                        Tippies.SpawnTippy("Close Tournament Transaction Successful", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 5f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                        buttons["CloseButton"].transform.Find("Body").GetComponent <RayCastButton>().PressButton(null);
                        Close();

                        TournamentMenu.Instance.actionState = TournamentMenu.ActionState.NoAction;
                        TournamentMenuCenterButton.Instance.updateState();
                    }
                    else
                    {
                        StatisticsTracking.EndEvent("Matryx", "Tournament Close Only", new Dictionary <string, object>()
                        {
                            { "success", false }
                        });
                        Tippies.SpawnTippy("Close Tournament Transaction Failed", 4f, TMPro.TextAlignmentOptions.Center, new Vector3(1f, 0.25f, 0.05f), 15f, AvatarSelector.centerEye, new Vector3(0f, 0f, 0.4f), 0.5f, 0.5f, Tippy.MovementMode.Soft, true);
                    }
                }));
            });
        }
    }