/// <summary>
    /// 开始打印彩票.
    /// </summary>
    internal void StartPrintPlayerCaiPiao(PlayerEnum indexPlayer, int caiPiao)
    {
        Debug.Log("pcvr::StartPrintPlayerCaiPiao -> indexPlayer == " + indexPlayer + ", caiPiao == " + caiPiao
                  + ", time == " + Time.time);
        if (bIsHardWare && mPcvrTXManage != null)
        {
            int indexVal = (int)indexPlayer;
            if (indexVal < 1 || indexVal > 3)
            {
                Debug.LogWarning("StartPrintPlayerCaiPiao -> indexVal was wrong! indexVal ==== " + indexVal);
                return;
            }

            if (IsOpenDelayPrintPlayerCaiPiao[indexVal - 1] == false)
            {
                pcvrTXManage.CaiPiaoJi indexCaiPiaoJi = (pcvrTXManage.CaiPiaoJi)(indexVal - 1);
                if (mPcvrTXManage.GetIsCanPrintCaiPiao(indexCaiPiaoJi) == true)
                {
                    pcvrTXManage.CaiPiaoPrintCmd cmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
                    if (XKGlobalData.GetInstance().m_CaiPiaoPrintState == XKGlobalData.CaiPiaoPrintState.QuanPiao)
                    {
                        cmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
                    }
                    mPcvrTXManage.SetCaiPiaoPrintCmd(cmd, indexCaiPiaoJi, caiPiao);
                }
                else
                {
                    StartCoroutine(DelayCheckPrintPlayerCaiPiao(indexPlayer, caiPiao));
                }
            }
        }
    }
Пример #2
0
    /// <summary>
    /// 点击打印彩票按键.
    /// </summary>
    public void OnClickPrintCaiPiao(GameObject btGroup, GameObject btPrint)
    {
        string btGroupName = btGroup.name;
        string btPrintName = btPrint.name;

        pcvrTXManage.CaiPiaoJi       caiPiaoJi = pcvrTXManage.CaiPiaoJi.Null;
        pcvrTXManage.CaiPiaoPrintCmd printCmd  = pcvrTXManage.CaiPiaoPrintCmd.WuXiao;
        switch (btGroupName)
        {
        case "caiPiaoJi01":
        {
            caiPiaoJi = pcvrTXManage.CaiPiaoJi.Num01;
            break;
        }

        case "caiPiaoJi02":
        {
            caiPiaoJi = pcvrTXManage.CaiPiaoJi.Num02;
            break;
        }

        case "caiPiaoJi03":
        {
            caiPiaoJi = pcvrTXManage.CaiPiaoJi.Num03;
            break;
        }
        }

        int countCaiPiao = 1;

        switch (btPrintName)
        {
        case "Button_01":
        {
            printCmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
            break;
        }

        case "Button_02":
        {
            printCmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
            break;
        }

        case "Button_03":
        {
            printCmd     = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
            countCaiPiao = 5;
            break;
        }
        }

        if (pcvr.GetInstance().mPcvrTXManage.GetIsCanPrintCaiPiao(caiPiaoJi))
        {
            pcvr.GetInstance().mPcvrTXManage.SetCaiPiaoPrintCmd(printCmd, caiPiaoJi, countCaiPiao);
        }
    }
    /// <summary>
    /// 延迟检测玩家彩票机是否可以打印彩票.
    /// </summary>
    IEnumerator DelayCheckPrintPlayerCaiPiao(PlayerEnum indexPlayer, int caiPiao)
    {
        int indexVal = (int)indexPlayer;

        IsOpenDelayPrintPlayerCaiPiao[indexVal - 1] = true;
        pcvrTXManage.CaiPiaoJi indexCaiPiaoJi = (pcvrTXManage.CaiPiaoJi)(indexVal - 1);
        do
        {
            yield return(new WaitForSeconds(0.1f));

            if (mPcvrTXManage.GetIsCanPrintCaiPiao(indexCaiPiaoJi) == true)
            {
                pcvrTXManage.CaiPiaoPrintCmd cmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
                if (XKGlobalData.GetInstance().m_CaiPiaoPrintState == XKGlobalData.CaiPiaoPrintState.QuanPiao)
                {
                    cmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
                }
                mPcvrTXManage.SetCaiPiaoPrintCmd(cmd, indexCaiPiaoJi, caiPiao);
                break;
            }
        }while (true);
        IsOpenDelayPrintPlayerCaiPiao[indexVal - 1] = false;
    }
    /// <summary>
    /// 缺票后重新开始打印彩票.
    /// </summary>
    internal void RestartPrintCaiPiao(PlayerEnum indexPlayer)
    {
        if (bIsHardWare && mPcvrTXManage != null)
        {
            int indexVal = (int)indexPlayer;
            if (indexVal < 1 || indexVal > 3)
            {
                Debug.LogWarning("StartPrintPlayerCaiPiao -> indexVal was wrong! indexVal ==== " + indexVal);
                return;
            }

            pcvrTXManage.CaiPiaoJi indexCaiPiaoJi = (pcvrTXManage.CaiPiaoJi)(indexVal - 1);
            if (mPcvrTXManage.GetIsCanPrintCaiPiao(indexCaiPiaoJi) == true)
            {
                pcvrTXManage.CaiPiaoPrintCmd cmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
                if (XKGlobalData.GetInstance().m_CaiPiaoPrintState == XKGlobalData.CaiPiaoPrintState.QuanPiao)
                {
                    cmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
                }
                int caiPiao = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.GetPlayerCaiPiaoVal(indexPlayer);
                mPcvrTXManage.SetCaiPiaoPrintCmd(cmd, indexCaiPiaoJi, caiPiao);
            }
        }
    }
    /// <summary>
    /// 点击打印彩票按键.
    /// </summary>
    public void OnClickPrintCaiPiao(GameObject btGroup, GameObject btPrint)
    {
        string btGroupName = btGroup.name;
        string btPrintName = btPrint.name;

        //UnityEngine.Debug.Log("btGroupName ==== " + btGroupName + ", btPrintName ==== " + btPrintName);
        pcvrTXManage.CaiPiaoJi       caiPiaoJi = pcvrTXManage.CaiPiaoJi.Null;
        pcvrTXManage.CaiPiaoPrintCmd printCmd  = pcvrTXManage.CaiPiaoPrintCmd.WuXiao;
        switch (btGroupName)
        {
        case "caiPiaoJi01":
        {
            caiPiaoJi = pcvrTXManage.CaiPiaoJi.Num01;
            break;
        }

        case "caiPiaoJi02":
        {
            caiPiaoJi = pcvrTXManage.CaiPiaoJi.Num02;
            break;
        }

        case "caiPiaoJi03":
        {
            caiPiaoJi = pcvrTXManage.CaiPiaoJi.Num03;
            break;
        }
        }

        int countCaiPiao = 1;

        switch (btPrintName)
        {
        case "Button_01":
        {
            printCmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
            break;
        }

        case "Button_02":
        {
            printCmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
            break;
        }

        case "Button_03":
        {
            printCmd     = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
            countCaiPiao = 5;
            break;
        }
        }

        bool isInt = IsInt(m_InputValueCaiPiaoJi[(int)caiPiaoJi]);

        if (isInt == false)
        {
            //非整形数据,停止打印彩票.
            printCmd = pcvrTXManage.CaiPiaoPrintCmd.StopPrint;
        }
        else
        {
            countCaiPiao = Convert.ToInt32(m_InputValueCaiPiaoJi[(int)caiPiaoJi]);
            if (countCaiPiao < 1)
            {
                //非有效数据,
                printCmd = pcvrTXManage.CaiPiaoPrintCmd.StopPrint;
            }
        }

        if (printCmd == pcvrTXManage.CaiPiaoPrintCmd.StopPrint)
        {
            pcvr.GetInstance().mPcvrTXManage.SetCaiPiaoPrintCmd(printCmd, caiPiaoJi, 0);
        }
        else
        {
            if (pcvr.GetInstance().mPcvrTXManage.GetIsCanPrintCaiPiao(caiPiaoJi))
            {
                if (printCmd == pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint || printCmd == pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint)
                {
                    //清空彩票机已经打印的彩票数量信息.
                    m_CaiPiaoOutValue[(int)caiPiaoJi] = 0;
                }
                pcvr.GetInstance().mPcvrTXManage.SetCaiPiaoPrintCmd(printCmd, caiPiaoJi, countCaiPiao);
            }
        }
    }