private CNGPI.Message Box_OnReviceMsg(CNGPI.Message msg) { switch (msg.PID) { case 0x010C: return(new Msg_GameAlert_Back() { TransID = (msg as CNGPI.ITransMsg).TransID, ADR = PayBox.RemoteDev.CurrPortIndex }); case 0x0105: return(new Msg_GameStart_Back() { TransID = (msg as CNGPI.ITransMsg).TransID, ADR = PayBox.RemoteDev.CurrPortIndex }); case 0x0106: return(new Msg_GameFinish_Back() { TransID = (msg as CNGPI.ITransMsg).TransID, ADR = PayBox.RemoteDev.CurrPortIndex, ErrCode = 0 }); case 0x0401: var msg41 = msg as Msg_CreateOrder_Event; ven_box.Text = msg41.BoxNum.ToString(); ven_price.Text = msg41.Price.ToString(); return(new Msg_CreateOrder_Back() { ADR = PayBox.RemoteDev.CurrPortIndex, ErrCode = 0, QrCode = "https://github.com/xsharkx/CNGPI/raw/master/logo/CNGPIV1.png" }); case 0x0402: return(new Msg_CancelOrder_Back() { ADR = PayBox.RemoteDev.CurrPortIndex, ErrCode = 0, }); case 0x0409: return(new Msg_GetQrCodeAndProImg_Back() { ADR = PayBox.RemoteDev.CurrPortIndex, ErrCode = 0, QrCode = "https://raw.githubusercontent.com/xsharkx/CNGPI/master/logo/CNGPIV1.png", ProductImage = "https://raw.githubusercontent.com/xsharkx/CNGPI/master/logo/CNGPIV1.png", }); } return(null); }
private CNGPI.Message Box_OnReviceMsg(CNGPI.Message msg) { switch (msg.PID) { case 0x0101: return(new CNGPI.Msg_Connect_Back() { ADR = 0, CurrGamePortIndex = 1, DeviceID = CNGPI.Utility.HexToByte(Devinfo.ID), DeviceType = Devinfo.DeviceType, GamePortCount = 1, GPIVersion = (uint)Devinfo.CNGPIVer, ProductNum = Devinfo.ProductNum, SoftVer = Devinfo.SoftVer }); case 0x0102: return(new CNGPI.Msg_Sync_Back() { ADR = 1, ErrCode = 0, RemainCoin = CoinCount, RemainSec = 0, State = State }); case 0x0103: CoinCount += (msg as Msg_Pay_Event).Coins; return(new CNGPI.Msg_Pay_Back() { ADR = 1, ErrCode = 0, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0104: CoinPertime = (msg as Msg_Config_Event).CoinsPerTimes; return(new CNGPI.Msg_Config_Back() { ADR = 1, ErrCode = 0 }); case 0x0107: exdate = (msg as Msg_ConfigEx_Event).ExData; return(new CNGPI.Msg_ConfigEx_Back() { ADR = 1, ErrCode = 0 }); case 0x0108: CoinCount = 0; State = 1; CoinPertime = 2; exdate = Guid.NewGuid().ToByteArray(); return(new CNGPI.Msg_Reset_Back() { ADR = 1, ErrCode = 0 }); case 0x0109: return(new CNGPI.Msg_GetConfig_Back() { ADR = 1, ErrCode = 0, CoinsPerTimes = CoinPertime }); case 0x010A: return(new CNGPI.Msg_GetConfigEx_Back() { ADR = 1, ErrCode = 0, ExData = exdate }); case 0x010B: return(new CNGPI.Msg_GetCounter_Back() { ADR = 1, ErrCode = 0, PCoins = 123456, ECoins = 456789, PGifts = 9876, PTickets = 976655344 }); case 0x010D: if ((msg as Msg_Pause_Event).Action == 0) { State = 0x07; } else { State = 1; } return(new CNGPI.Msg_Pause_Back() { ADR = 1, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0201: CoinCount += (msg as Msg_PayWithWinList_Event).WinList.Count * CoinPertime; return(new CNGPI.Msg_PayWithWinList_Back() { ADR = 1, ErrCode = 0, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0202: CoinPertime = (msg as Msg_GiftConfig_Event).CoinsPerTimes; return(new CNGPI.Msg_GiftConfig_Back() { ADR = 1, ErrCode = 0 }); case 0x0203: return(new CNGPI.Msg_GetGiftConfig_Back() { ADR = 1, ErrCode = 0, CoinsPerTimes = CoinPertime, GameSec = 10, HightPower = 90, LowPower = 10, WinCoins = 100, WinGifts = 9 }); case 0x0111: return(new CNGPI.Msg_GetMenuIndex_Back() { ADR = 1, ErrCode = 0, MenuItems = new int[] { 10, 11, 12, 14, 15, 17, 18, 19 }, }); case 0x0110: var it = msg as CNGPI.Msg_GetMenuDetail_Event; switch (it.ItemID) { case 10: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "越低越容易中奖", ItemID = it.ItemID, ItemName = "中奖难度", Value = GetMenuV(it.ItemID, 10), MaxValue = 20, MinValue = 1, }); case 11: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "不中奖时按钮按下时的爪力", ItemID = it.ItemID, ItemName = "弱爪第一爪力", Value = GetMenuV(it.ItemID, 5), MaxValue = 10, MinValue = 1, }); case 12: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "不中奖时提起奖品爪力", ItemID = it.ItemID, ItemName = "弱爪第二爪力", Value = GetMenuV(it.ItemID, 5), MaxValue = 10, MinValue = 1, }); case 14: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "不中奖时拉回奖品爪力", ItemID = it.ItemID, ItemName = "弱爪第三爪力", Value = GetMenuV(it.ItemID, 5), MaxValue = 10, MinValue = 1, }); case 15: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "1=欢快,2=萌萌,3=酷", ItemID = it.ItemID, ItemName = "游戏音乐", Value = GetMenuV(it.ItemID, 2), MaxValue = 3, MinValue = 1, }); case 17: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "1=开,0=关", ItemID = it.ItemID, ItemName = "中奖爆闪灯", Value = GetMenuV(it.ItemID, 1), MaxValue = 1, MinValue = 0, }); case 18: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "一轮游戏次数", ItemID = it.ItemID, ItemName = "每轮次数", Value = GetMenuV(it.ItemID, 40), MaxValue = 100, MinValue = 0, }); case 19: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "一轮中奖次数,与一轮次数结合使用", ItemID = it.ItemID, ItemName = "每轮中奖数", Value = GetMenuV(it.ItemID, 2), MaxValue = 100, MinValue = 0, }); default: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 1, }); } case 0x010F: var menuset = msg as CNGPI.Msg_MenuSet_Event; SetMenuV(menuset.ItemID, menuset.ItemValue); return(new CNGPI.Msg_MenuSet_Back() { ADR = 1, ErrCode = 0, }); default: return(null); } }
private CNGPI.Message Box_OnReviceMsg(CNGPI.Message msg) { switch (msg.PID) { case 0x0101: return(new CNGPI.Msg_Connect_Back() { ADR = 0, CurrGamePortIndex = 1, DeviceID = CNGPI.Utility.HexToByte(Devinfo.ID), DeviceType = Devinfo.DeviceType, GamePortCount = 1, GPIVersion = 100, ProductNum = Devinfo.ProductNum, SoftVer = Devinfo.SoftVer }); case 0x0102: return(new CNGPI.Msg_Sync_Back() { ADR = 1, ErrCode = 0, RemainCoin = CoinCount, RemainSec = 0, State = State }); case 0x0103: CoinCount += (msg as Msg_Pay_Event).Coins; return(new CNGPI.Msg_Pay_Back() { ADR = 1, ErrCode = 0, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0104: CoinPertime = (msg as Msg_Config_Event).CoinsPerTimes; return(new CNGPI.Msg_Config_Back() { ADR = 1, ErrCode = 0 }); case 0x0107: exdate = (msg as Msg_ConfigEx_Event).ExData; return(new CNGPI.Msg_ConfigEx_Back() { ADR = 1, ErrCode = 0 }); case 0x0108: CoinCount = 0; State = 1; CoinPertime = 2; exdate = Guid.NewGuid().ToByteArray(); return(new CNGPI.Msg_Reset_Back() { ADR = 1, ErrCode = 0 }); case 0x0109: return(new CNGPI.Msg_GetConfig_Back() { ADR = 1, ErrCode = 0, CoinsPerTimes = CoinPertime }); case 0x010A: return(new CNGPI.Msg_GetConfigEx_Back() { ADR = 1, ErrCode = 0, ExData = exdate }); case 0x010B: return(new CNGPI.Msg_GetCounter_Back() { ADR = 1, ErrCode = 0, PCoins = 123456, ECoins = 456789, PGifts = 9876, PTickets = 976655344 }); case 0x010D: if ((msg as Msg_Pause_Event).Action == 0) { State = 0x07; } else { State = 1; } return(new CNGPI.Msg_Pause_Back() { ADR = 1, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0201: CoinCount += (msg as Msg_PayWithWinList_Event).WinList.Count * CoinPertime; return(new CNGPI.Msg_PayWithWinList_Back() { ADR = 1, ErrCode = 0, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0202: CoinPertime = (msg as Msg_GiftConfig_Event).CoinsPerTimes; return(new CNGPI.Msg_GiftConfig_Back() { ADR = 1, ErrCode = 0 }); case 0x0203: return(new CNGPI.Msg_GetGiftConfig_Back() { ADR = 1, ErrCode = 0, CoinsPerTimes = CoinPertime, GameSec = 10, HightPower = 90, LowPower = 10, WinCoins = 100, WinGifts = 9 }); case 0x0403: return(new CNGPI.Msg_PayOrder_Back() { ADR = 1, ErrCode = 0, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x010E: return(new CNGPI.Msg_MenuGet_Back() { ADR = 1, ErrCode = 0, ItemID = (msg as Msg_MenuGet_Event).ItemID, ItemValue = 10, Display = 1 }); case 0x010F: return(new CNGPI.Msg_MenuSet_Back() { ADR = 1, ErrCode = 0, }); default: return(null); } }
private CNGPI.Message Box_OnReviceMsg(CNGPI.Message msg) { switch (msg.PID) { case 0x0101: return(new CNGPI.Msg_Connect_Back() { ADR = 0, CurrGamePortIndex = 1, DeviceID = CNGPI.Utility.HexToByte(Devinfo.ID), DeviceType = Devinfo.DeviceType, GamePortCount = 1, GPIVersion = Devinfo.CNGPIVer, ProductNum = Devinfo.ProductNum, SoftVer = Devinfo.SoftVer }); case 0x0102: return(new CNGPI.Msg_Sync_Back() { ADR = 1, ErrCode = 0, RemainCoin = CoinCount, RemainSec = 0, State = State }); case 0x0103: CoinCount += (msg as Msg_Pay_Event).Coins; return(new CNGPI.Msg_Pay_Back() { ADR = 1, ErrCode = 0, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0104: CoinPertime = (msg as Msg_Config_Event).CoinsPerTimes; return(new CNGPI.Msg_Config_Back() { ADR = 1, ErrCode = 0 }); case 0x0108: CoinCount = 0; State = 0; CoinPertime = 2; exdate = Guid.NewGuid().ToByteArray(); return(new CNGPI.Msg_Reset_Back() { ADR = 1, ErrCode = 0 }); case 0x0109: return(new CNGPI.Msg_GetConfig_Back() { ADR = 1, ErrCode = 0, CoinsPerTimes = CoinPertime }); case 0x010B: return(new CNGPI.Msg_GetCounter_Back() { ADR = 1, ErrCode = 0, PCoins = 123456, ECoins = 456789, PGifts = 9876, PTickets = 976655344 }); case 0x0403: int errcode = 0; string ordernum = (msg as Msg_PayOrder_Event).OrderNum; if (lastordernum == ordernum) { errcode = 0; } else { lastordernum = ordernum; int currkucun = Int32.Parse(textBox1.Text); if (currkucun > 0) { this.BeginInvoke((EventHandler) delegate { textBox1.Text = (currkucun - 1).ToString(); }); } else { errcode = 0x020C; } if (errcode == 0 && checkBox1.Checked) { errcode = 0x020A; } else { if (checkBox2.Checked) { errcode = 0x020B; } } } return(new CNGPI.Msg_PayOrder_Back() { ADR = 1, ErrCode = errcode, TransID = (msg as CNGPI.ITransMsg).TransID }); case 0x0111: return(new CNGPI.Msg_GetMenuIndex_Back() { ADR = 1, ErrCode = 0, MenuItems = new int[] { 10, 11 }, }); case 0x0110: var it = msg as CNGPI.Msg_GetMenuDetail_Event; switch (it.ItemID) { case 10: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "实际扭蛋直径", ItemID = it.ItemID, ItemName = "扭蛋直径(mm)", Value = GetMenuV(it.ItemID, 45), MaxValue = 50, MinValue = 40, }); case 11: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 0, ItemDiscribe = "货将售罄检测", ItemID = it.ItemID, ItemName = "货将售罄检测", Value = GetMenuV(it.ItemID, 1), MaxValue = 1, MinValue = 0, }); default: return(new CNGPI.Msg_GetMenuDetail_Back() { ADR = msg.ADR, ErrCode = 1, }); } case 0x010F: var menuset = msg as CNGPI.Msg_MenuSet_Event; SetMenuV(menuset.ItemID, menuset.ItemValue); return(new CNGPI.Msg_MenuSet_Back() { ADR = 1, ErrCode = 0, }); default: return(null); } }