/// <summary> /// 设置彩票机打印命令. /// </summary> public void SetCaiPiaoPrintCmd(CaiPiaoPrintCmd printCmd, CaiPiaoJi indexCaiPiaoJi, int caiPiaoCount) { Debug.Log("SetCaiPiaoPrintState -> printCmd " + printCmd + ", indexCaiPiaoJi " + indexCaiPiaoJi + ", caiPiaoCount " + caiPiaoCount); CaiPiaoPrintCmdVal[(int)indexCaiPiaoJi] = printCmd; if (printCmd == CaiPiaoPrintCmd.QuanPiaoPrint || printCmd == CaiPiaoPrintCmd.BanPiaoPrint) { CaiPiaoCountPrint[(int)indexCaiPiaoJi] = caiPiaoCount; CaiPiaoJiPrintStArray[(int)indexCaiPiaoJi] = CaiPiaoPrintState.Null; } }
/// <summary> /// 获取是否可以继续打印彩票. /// </summary> public bool GetIsCanPrintCaiPiao(CaiPiaoJi indexCaiPiaoJi) { if (CaiPiaoCountPrint[(int)indexCaiPiaoJi] <= 0) { //目前需要打印彩票为0时,可以继续开启打印彩票. return(true); } if (CaiPiaoPrintFailedCount[(int)indexCaiPiaoJi] >= 3) { //目前打印彩票失败次数大于3时,可以继续开启打印彩票(认为彩票机没有彩票了). return(true); } return(false); }
/// <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; }