コード例 #1
0
    /// <summary>
    /// 循环检测收到IO板的信息.
    /// </summary>
    void KeyProcess(byte[] buffer)
    {
        //game coinInfo
        PlayerCoinHidArray[0] = buffer[18] & 0x0f;
        PlayerCoinHidArray[1] = (buffer[18] & 0xf0) >> 4;
        PlayerCoinHidArray[2] = buffer[19] & 0x0f;
        PlayerCoinHidArray[3] = (buffer[19] & 0xf0) >> 4;
        CheckPlayerCoinInfo(PlayerCoinEnum.player01);
        CheckPlayerCoinInfo(PlayerCoinEnum.player02);
        CheckPlayerCoinInfo(PlayerCoinEnum.player03);
        CheckPlayerCoinInfo(PlayerCoinEnum.player04);

        UpdateDianWeiQiDt(buffer);

        if (!CheckAnJianInfoIsError(buffer[41]))
        {
            UpdateAnJianLbDt(buffer);
            CheckKaiFangAnJianInfo(buffer[33]);
        }

        CaiPiaoPrintState caiPiaoPrintSt01 = (CaiPiaoPrintState)buffer[44];

        //CaiPiaoPrintState caiPiaoPrintSt02 = (CaiPiaoPrintState)buffer[44];
        OnReceiveCaiPiaoJiPrintState(caiPiaoPrintSt01, CaiPiaoJi.Num01);
        //CheckCaiPiaoJiPrintState(caiPiaoPrintSt02, CaiPiaoJi.Num02);
    }
    /// <summary>
    /// 初始化彩票打印半票或全票.
    /// </summary>
    void InitCaiPiaoPrintState()
    {
        int    val  = 0;
        string info = HandleJsonObj.ReadFromFileXml(FileName, "CaiPiaoPrintState");

        if (info == null || info == "")
        {
            val = 0;
        }
        else
        {
            val = Convert.ToInt32(info);
        }

        m_CaiPiaoPrintState = val == 0 ? CaiPiaoPrintState.BanPiao : CaiPiaoPrintState.QuanPiao;
    }
コード例 #3
0
    /// <summary>
    /// 收到彩票打印状态信息.
    /// </summary>
    void OnReceiveCaiPiaoJiPrintState(CaiPiaoPrintState printSt, CaiPiaoJi indexCaiPiaoJi)
    {
        switch (printSt)
        {
        case CaiPiaoPrintState.WuXiao:
        {
            if (CaiPiaoJiPrintStArray[(int)indexCaiPiaoJi] != CaiPiaoPrintState.WuXiao)
            {
                Debug.Log("CaiPiaoJi_" + indexCaiPiaoJi + " -> print wuXiao!");
            }

            if (CaiPiaoCountPrint[(int)indexCaiPiaoJi] > 0 && CaiPiaoPrintFailedCount[(int)indexCaiPiaoJi] <= 3)
            {
                SetCaiPiaoPrintCmd(CaiPiaoPrintCmdRecord[(int)indexCaiPiaoJi], indexCaiPiaoJi, CaiPiaoCountPrint[(int)indexCaiPiaoJi]);
            }
            break;
        }

        case CaiPiaoPrintState.Succeed:
        {
            Debug.Log("CaiPiaoJi_" + indexCaiPiaoJi + " -> print succeed!");
            SetCaiPiaoPrintCmd(CaiPiaoPrintCmd.StopPrint, indexCaiPiaoJi, 0);
            if (CaiPiaoJiPrintStArray[(int)indexCaiPiaoJi] != CaiPiaoPrintState.Succeed)
            {
                CaiPiaoCountPrint[(int)indexCaiPiaoJi] -= 1;
                InputEventCtrl.GetInstance().OnCaiPiaJiChuPiao(indexCaiPiaoJi);
            }
            CaiPiaoPrintFailedCount[(int)indexCaiPiaoJi] = 0;
            break;
        }

        case CaiPiaoPrintState.Failed:
        {
            Debug.Log("CaiPiaoJi_" + indexCaiPiaoJi + " -> print failed! failedCount " + CaiPiaoPrintFailedCount[(int)indexCaiPiaoJi]);
            SetCaiPiaoPrintCmd(CaiPiaoPrintCmd.StopPrint, indexCaiPiaoJi, 0);
            CaiPiaoPrintFailedCount[(int)indexCaiPiaoJi]++;
            if (CaiPiaoPrintFailedCount[(int)indexCaiPiaoJi] > 3)
            {
                //彩票机无票了.
                InputEventCtrl.GetInstance().OnCaiPiaJiWuPiao(indexCaiPiaoJi);
            }
            break;
        }
        }
        CaiPiaoJiPrintStArray[(int)indexCaiPiaoJi] = printSt;
    }
 /// <summary>
 /// 设置打印彩票是半票还是全票.
 /// </summary>
 public void SetCaiPiaoPrintState(CaiPiaoPrintState type)
 {
     m_CaiPiaoPrintState = type;
     HandleJsonObj.WriteToFileXml(FileName, "CaiPiaoPrintState", type == CaiPiaoPrintState.BanPiao ? "0" : "1");
 }
 /// <summary>
 /// 重置彩票打印为半票.
 /// </summary>
 public void ResetCaiPiaoPrintState()
 {
     m_CaiPiaoPrintState = CaiPiaoPrintState.BanPiao;
     HandleJsonObj.WriteToFileXml(FileName, "CaiPiaoPrintState", "0");
 }