private bool DoMain()
    {
        bool result = false;

        imgList.Draw();
        labelList.Draw();
        bubbleEffect.Draw();
        title.Draw();
        explain.Draw();
        token.Draw();
        tokenCount.Draw();
        coin.Draw();
        coinCount.Draw();
        tokenButton.Draw();
        tokenHighlight.Draw();
        coinButton.Draw();
        coinHighlight.Draw();
        myTokenHave.SetText(MyInfoManager.Instance.Cash.ToString("n0"));
        myCoinHave.SetText(MyInfoManager.Instance.FreeCoin.ToString("n0"));
        myToken.Draw();
        myTokenHave.Draw();
        myCoinHave.Draw();
        if (BuildOption.Instance.Props.GetTokensURL.Length > 0)
        {
            string text = (!BuildOption.Instance.IsInfernum) ? string.Format(StringMgr.Instance.Get("BUY_TOKEN"), TokenManager.Instance.GetTokenString()) : StringMgr.Instance.Get("BUY_TOKEN2");
            buyToken.SetText(text.ToUpper());
            if (buyToken.Draw())
            {
                string url = BuildOption.Instance.Props.GetTokensURL + BuildOption.Instance.TokensParameter();
                if (MyInfoManager.Instance.SiteCode == 11)
                {
                    url = BuildOption.Instance.Props.GetTokensURL2 + BuildOption.Instance.TokensParameter();
                }
                BuildOption.OpenURL(url);
            }
        }
        if (tokenButton.isClick())
        {
            if (MyInfoManager.Instance.Cash < tcStatus.TokenPrice)
            {
                MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("NOT_ENOUGH_MONEY"));
            }
            else
            {
                ((RandomBoxSureNetmarble)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURENETMARBLE, exclusive: false))?.InitDialog(tcStatus.Seq, 1, tcStatus.TokenPrice);
            }
        }
        if (coinButton.isClick())
        {
            areYouSure = (RandomBoxSureDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE, exclusive: false);
            if (areYouSure != null)
            {
                areYouSure.InitDialog(tcStatus.Seq, 1, 0);
            }
        }
        if (exit.Draw())
        {
            result = true;
        }
        if (goBack.Draw() || (GlobalVars.Instance.IsEscapePressed() && !DialogManager.Instance.IsPopup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE) && !rouletteEffect.IsDraw))
        {
            CSNetManager.Instance.Sock.SendCS_TC_LEAVE_REQ();
            ((TCGateDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.TCGATE, exclusive: true))?.InitDialog();
        }
        return(result);
    }
Exemplo n.º 2
0
    public override bool DoDialog()
    {
        bool    result = false;
        GUISkin skin   = GUI.skin;

        GUI.skin = GUISkinFinder.Instance.GetGUISkin();
        DoTitle();
        DoBoard();
        DoPrizes();
        DoTcStatus();
        DoMoney();
        DoStroking();
        DoTooltip();
        DoFlying();
        DoRareFx();
        noConfirm = GUI.Toggle(crdNoConfirm, noConfirm, StringMgr.Instance.Get("DONT_ASK_GAMBLE"));
        bool enabled = GUI.enabled;

        GUI.enabled = (resetStep == RESET_STEP.NONE && tcStatus != null && 0 < MyInfoManager.Instance.FreeCoin && 0 <= curTicket && curTicket < tcBoard.Count && tcBoard[curTicket] > 0 && tcStatus.CoinPrice != 0);
        if (GlobalVars.Instance.MyButton(crdFreeBtn, StringMgr.Instance.Get("FREE"), "BtnAction"))
        {
            if (noConfirm)
            {
                CSNetManager.Instance.Sock.SendCS_TC_OPEN_PRIZE_TAG_REQ(tcStatus.Seq, curTicket, freeCoin: true);
            }
            else
            {
                areYouSure = (RandomBoxSureDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE, exclusive: false);
                if (areYouSure != null)
                {
                    areYouSure.InitDialog(tcStatus.Seq, curTicket, 0);
                }
            }
        }
        GUI.enabled = (resetStep == RESET_STEP.NONE && tcStatus != null && tcStatus.TokenPrice <= MyInfoManager.Instance.Cash && 0 <= curTicket && curTicket < tcBoard.Count && tcBoard[curTicket] > 0 && tcStatus.TokenPrice != 0);
        if (GlobalVars.Instance.MyButton(crdTokenBtn, TokenManager.Instance.GetTokenString(), "BtnAction"))
        {
            if (noConfirm)
            {
                CSNetManager.Instance.Sock.SendCS_TC_OPEN_PRIZE_TAG_REQ(tcStatus.Seq, curTicket, freeCoin: false);
            }
            else
            {
                areYouSure = (RandomBoxSureDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE, exclusive: false);
                if (areYouSure != null)
                {
                    areYouSure.InitDialog(tcStatus.Seq, curTicket, tcStatus.TokenPrice);
                }
            }
        }
        GUI.enabled = enabled;
        if (GlobalVars.Instance.MyButton(crdX, string.Empty, "BtnClose"))
        {
            result = true;
        }
        if (GlobalVars.Instance.MyButton(crdBack, string.Empty, "BtnBack") || (!DialogManager.Instance.IsPopup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE) && GlobalVars.Instance.IsEscapePressed()))
        {
            CSNetManager.Instance.Sock.SendCS_TC_LEAVE_REQ();
            ((TCGateDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.TCGATE, exclusive: true))?.InitDialog();
        }
        if (!ContextMenuManager.Instance.IsPopup)
        {
            WindowUtil.EatEvent();
        }
        GUI.skin = skin;
        return(result);
    }