1 line
50 KiB
JSON
1 line
50 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\n/* eslint-disable */\nimport $store from \"@/store\";\nvar askInterval = null;\n\n// 自动问路\nfunction autoask(newData) {\n const askObg = {\n // 自动问路\n BbigEyeRoadisshow: false,\n BbigEyeRoadcolor: \"\",\n Bpathwayisshow: false,\n Bpathwaycolor: \"\",\n Broachisshow: false,\n Broachcolor: \"\",\n // 闲问路\n PbigEyeRoadisshow: false,\n PbigEyeRoadcolor: \"\",\n Ppathwayisshow: false,\n Ppathwaycolor: \"\",\n Proachisshow: false,\n Proachcolor: \"\"\n };\n // 庄问路\n if (newData.ludan_banker) {\n if (newData.ludan_banker.waybill) {\n const bigEyeRoad = newData.ludan_banker.waybill.bigEyeRoad;\n const pathway = newData.ludan_banker.waybill.pathway;\n const roach = newData.ludan_banker.waybill.roach;\n if (bigEyeRoad[0]) {\n if (bigEyeRoad[bigEyeRoad.length - 1].result == 1) {\n askObg.BbigEyeRoadcolor = \"red\";\n } else {\n askObg.BbigEyeRoadcolor = \"blue\";\n }\n askObg.BbigEyeRoadisshow = true;\n } else {\n askObg.BbigEyeRoadisshow = false;\n }\n if (pathway[0]) {\n if (pathway[pathway.length - 1].result == 1) {\n askObg.Bpathwaycolor = \"red\";\n } else {\n askObg.Bpathwaycolor = \"blue\";\n }\n askObg.Bpathwayisshow = true;\n } else {\n askObg.Bpathwayisshow = false;\n }\n if (roach[0]) {\n if (roach[roach.length - 1].result == 1) {\n askObg.Broachcolor = \"red\";\n } else {\n askObg.Broachcolor = \"blue\";\n }\n askObg.Broachisshow = true;\n } else {\n askObg.Broachisshow = false;\n }\n }\n // 闲问路\n if (newData.ludan_player.waybill) {\n const bigEyeRoad = newData.ludan_player.waybill.bigEyeRoad;\n const pathway = newData.ludan_player.waybill.pathway;\n const roach = newData.ludan_player.waybill.roach;\n if (bigEyeRoad[0]) {\n if (bigEyeRoad[bigEyeRoad.length - 1].result == 1) {\n askObg.PbigEyeRoadcolor = \"red\";\n } else {\n askObg.PbigEyeRoadcolor = \"blue\";\n }\n askObg.PbigEyeRoadisshow = true;\n } else {\n askObg.PbigEyeRoadisshow = false;\n }\n if (pathway[0]) {\n if (pathway[pathway.length - 1].result == 1) {\n askObg.Ppathwaycolor = \"red\";\n } else {\n askObg.Ppathwaycolor = \"blue\";\n }\n askObg.Ppathwayisshow = true;\n } else {\n askObg.Ppathwayisshow = false;\n }\n if (roach[0]) {\n if (roach[roach.length - 1].result == 1) {\n askObg.Proachcolor = \"red\";\n } else {\n askObg.Proachcolor = \"blue\";\n }\n askObg.Proachisshow = true;\n } else {\n askObg.Proachisshow = false;\n }\n }\n }\n return askObg;\n}\n// 问路\nfunction waybillAsk(canvas, type, data, game_id) {\n if (askInterval != null) {\n clearInterval(askInterval);\n }\n if (type == \"banker\") {\n if (data.ludan_banker && data.ludan_banker.waybill) {\n ask(canvas, data.ludan_banker, data.ludan, game_id);\n }\n } else if (type == \"palyer\") {\n if (data.ludan_player && data.ludan_player.waybill) {\n ask(canvas, data.ludan_player, data.ludan, game_id);\n }\n }\n}\nfunction ask(canvas, newdata, olddata, game_id) {\n const nshowRoad = newdata.waybill.showRoad || [];\n const nbigEyeRoad = newdata.waybill.bigEyeRoad || [];\n const nbigRoad = newdata.waybill.bigRoad || [];\n const npathway = newdata.waybill.pathway || [];\n const nroach = newdata.waybill.roach || [];\n const nsanxing = newdata.waybill.sanxingRoad || [];\n const oshowRoad = olddata.waybill.showRoad || [];\n const obigEyeRoad = olddata.waybill.bigEyeRoad || [];\n const obigRoad = olddata.waybill.bigRoad || [];\n const opathway = olddata.waybill.pathway || [];\n const oroach = olddata.waybill.roach || [];\n const osanxing = olddata.waybill.sanxingRoad || [];\n if (nshowRoad.length > 0) {\n var n_s_last_x = nshowRoad[nshowRoad.length - 1].show_x;\n } else {\n var n_s_last_x = 0;\n }\n if (nbigEyeRoad.length > 0) {\n var n_e_last_x = nbigEyeRoad[nbigEyeRoad.length - 1].show_x;\n } else {\n var n_e_last_x = 0;\n }\n if (nbigRoad.length > 0) {\n var n_b_last_x = nbigRoad[nbigRoad.length - 1].show_x;\n } else {\n var n_b_last_x = 0;\n }\n if (npathway.length > 0) {\n var n_p_last_x = npathway[npathway.length - 1].show_x;\n } else {\n var n_p_last_x = 0;\n }\n if (nroach.length > 0) {\n var n_r_last_x = nroach[nroach.length - 1].show_x;\n } else {\n var n_r_last_x = 0;\n }\n if (nsanxing.length > 0) {\n var n_sx_last_x = nsanxing[nsanxing.length - 1].show_x;\n } else {\n var n_sx_last_x = 0;\n }\n if (oshowRoad.length > 0) {\n var o_s_last_x = oshowRoad[oshowRoad.length - 1].show_x;\n } else {\n var o_s_last_x = 0;\n }\n if (obigEyeRoad.length > 0) {\n var o_e_last_x = obigEyeRoad[obigEyeRoad.length - 1].show_x;\n } else {\n var o_e_last_x = 0;\n }\n if (obigRoad.length > 0) {\n var o_b_last_x = obigRoad[obigRoad.length - 1].show_x;\n } else {\n var o_b_last_x = 0;\n }\n if (opathway.length > 0) {\n var o_p_last_x = opathway[opathway.length - 1].show_x;\n } else {\n var o_p_last_x = 0;\n }\n if (oroach.length > 0) {\n var o_r_last_x = oroach[oroach.length - 1].show_x;\n } else {\n var o_r_last_x = 0;\n }\n if (osanxing.length > 0) {\n var o_sx_last_x = osanxing[osanxing.length - 1].show_x;\n } else {\n var o_sx_last_x = 0;\n }\n var askroad = {\n askshowroad: false,\n askbigRoad: false,\n askbigEyeRoad: false,\n askpathway: false,\n askroach: false\n };\n if (n_s_last_x > o_s_last_x) {\n askroad.askshowroad = true;\n } else {\n askroad.askshowroad = false;\n }\n if (n_e_last_x > o_e_last_x) {\n askroad.askbigEyeRoad = true;\n } else {\n askroad.askbigEyeRoad = false;\n }\n if (n_b_last_x > o_b_last_x) {\n askroad.askbigRoad = true;\n } else {\n askroad.askbigRoad = false;\n }\n if (n_p_last_x > o_p_last_x) {\n askroad.askpathway = true;\n } else {\n askroad.askpathway = false;\n }\n if (n_r_last_x > o_r_last_x) {\n askroad.askroach = true;\n } else {\n askroad.askroach = false;\n }\n if (n_sx_last_x > o_sx_last_x) {\n askroad.asksanxing = true;\n } else {\n askroad.asksanxing = false;\n }\n var time = 8;\n askInterval = setInterval(function () {\n time--;\n var num = time % 2;\n if (time < 0) {\n clearInterval(askInterval);\n } else {\n if (num == 1) {\n waybillConfig(canvas, newdata, game_id, true, askroad);\n // halfwayConfig(newdata, true, askroad)\n } else {\n waybillConfig(canvas, olddata, game_id, true);\n // halfwayConfig(canvas, olddata, true)\n }\n }\n }, 200);\n}\n// 全路\nfunction waybillConfig(canvas, data, game_id, ask, askroad) {\n // console.log(data)\n var getPixelRatio = context => {\n var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;\n return (window.devicePixelRatio || 1) / backingStore;\n };\n const ctb = canvas.getContext(\"2d\"),\n dpr = getPixelRatio(ctb),\n height = canvas.clientHeight,\n width = canvas.clientWidth;\n let rows, unit, cols, path, unit_y, unit_x;\n rows = 6;\n unit = parseInt(height / rows) * dpr;\n cols = parseInt(width / (unit / dpr));\n path = false;\n if (cols % 2 != 0) {\n cols = cols + 1;\n }\n if (game_id == 1 || game_id == 2) {\n if (ask != true) {\n if (data && data.ludan && data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n } else {\n if (data.waybill) {\n path = data.waybill;\n }\n }\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n Waybill(ctb, unit, rows, cols, path, game_id, ask, askroad);\n } else if (game_id == 4 || game_id == 5) {\n rows = 4;\n unit_y = height / rows * dpr;\n unit_x = unit_y * 1.05;\n cols = parseInt(width / (unit_x / dpr));\n canvas.setAttribute(\"width\", unit_x * cols);\n canvas.setAttribute(\"height\", unit_y * rows);\n if (data.ludan && data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n NNcanvas(game_id, ctb, unit_x, unit_y, rows, cols, path);\n } else if (game_id == 6) {\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n if (data && data.ludan && data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n const toningShowBigWay = $store.state.config.toningShowBigWay;\n ToningWaybill(ctb, unit, rows, cols, path, data.game_id, 3, toningShowBigWay);\n } else if (game_id == 7) {\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n if (data && data.ludan && data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n DiceWaybill(ctb, unit, rows, cols, path, 3);\n } else if (game_id == 8) {\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n if (data && data.ludan && data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n RouletteWaybill(ctb, unit, rows, cols, path, 3);\n }\n}\n// 半路\nfunction halfwayConfig(canvas, data, ask, askroad) {\n var getPixelRatio = context => {\n var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;\n return (window.devicePixelRatio || 1) / backingStore;\n };\n const ctb = canvas.getContext(\"2d\"),\n dpr = getPixelRatio(ctb),\n height = canvas.clientHeight,\n width = canvas.clientWidth,\n rows = 12,\n unit = parseInt(height / rows) * dpr,\n cols = parseInt(width / (unit / dpr)),\n game_id = data.game_id;\n let path = false;\n if (ask != true) {\n if (data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n } else {\n if (data.waybill) {\n path = data.waybill;\n }\n }\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n HalfWay(ctb, unit, rows, cols, path, game_id, ask, askroad);\n}\nfunction Waybill(ctb, unit, rows, cols, path, gameId, ask, askroad, multiple) {\n var ask = ask || false;\n var askroad = askroad || {\n askshowroad: false,\n askbigRoad: false,\n askbigEyeRoad: false,\n askpathway: false,\n askroach: false,\n asksanxing: false\n };\n ctb.clearRect(0, 0, unit * 100, unit * rows);\n var showRoad = path.showRoad;\n var bigRoad = path.bigRoad;\n var bigEyeRoad = path.bigEyeRoad;\n var pathway = path.pathway;\n var roach = path.roach;\n var sanxingRoad = path.sanxingRoad;\n if (multiple == true) {\n multipleDrawline(ctb, unit, rows, cols);\n var billnumber = 4;\n } else {\n Drawline(ctb, unit, rows, cols);\n var billnumber = 5;\n }\n if (path) {\n if (showRoad && multiple != true) {\n var roadType = \"showWay\";\n cutRoad(billnumber, roadType, ctb, unit, showRoad, cols, gameId, ask, askroad.askshowroad);\n }\n if (bigRoad && bigRoad.length > 0) {\n if (bigRoad[0].result == 3 && bigRoad[0].show_x == 1 && bigRoad[0].show_y == 1) {\n BigPathTie(billnumber, ctb, unit, cols, bigRoad[0].tie_num);\n } else {\n var roadType = \"bigWay\";\n cutRoad(billnumber, roadType, ctb, unit, bigRoad, cols, gameId, ask, askroad.askbigRoad);\n }\n }\n if (bigEyeRoad && bigEyeRoad.length > 0) {\n var roadType = \"bigeyeWay\";\n cutRoad(billnumber, roadType, ctb, unit, bigEyeRoad, cols, gameId, ask, askroad.askbigEyeRoad);\n }\n if (pathway && pathway.length > 0) {\n var roadType = \"littlWay\";\n cutRoad(billnumber, roadType, ctb, unit, pathway, cols, gameId, ask, askroad.askpathway);\n }\n if (roach && roach.length > 0) {\n var roadType = \"roachWay\";\n cutRoad(billnumber, roadType, ctb, unit, roach, cols, gameId, ask, askroad.askroach);\n }\n if (sanxingRoad && sanxingRoad.length > 0) {\n var roadType = \"sanxingWay\";\n cutRoad(billnumber, roadType, ctb, unit, sanxingRoad, cols, gameId, ask, askroad.asksanxing);\n }\n }\n}\n// 大眼路单独一条\nfunction WaybillbigRoad(ctb, unit, rows, cols, path, gameId) {\n ctb.clearRect(0, 0, unit * 100, unit * rows);\n Drawline(ctb, unit, rows, cols, true);\n if (path && path.length > 0) {\n if (path[0].result == 3 && path[0].show_x == 1 && path[0].show_y == 1) {\n BigPathTie(1, ctb, unit, cols, path[0].tie_num, true);\n } else {\n cutRoad(1, \"bigWay\", ctb, unit, path, cols, gameId, false, false);\n }\n }\n}\n\n// 半路 竖版路单\nfunction HalfWay(ctb, unit, rows, cols, path, gameId, ask, askroad) {\n var ask = ask || false;\n var askroad = askroad || {\n askshowroad: false,\n askbigRoad: false,\n askbigEyeRoad: false,\n askpathway: false,\n askroach: false,\n asksanxing: false\n };\n ctb.clearRect(0, 0, unit * 100, unit * rows);\n var showRoad = path.showRoad;\n var bigRoad = path.bigRoad;\n var bigEyeRoad = path.bigEyeRoad;\n var pathway = path.pathway;\n var roach = path.roach;\n var sanxingRoad = path.sanxingRoad;\n halfwayDrawline(ctb, unit, rows, cols);\n if (path) {\n if (showRoad) {\n var roadType = \"showWay\";\n halfcutRoad(roadType, ctb, unit, showRoad, cols, gameId, ask, askroad.askshowroad);\n }\n if (bigRoad) {\n if (bigRoad[0].result == 3 && bigRoad[0].show_x == 1 && bigRoad[0].show_y == 1) {\n BigPathTie(5, ctb, unit, cols, bigRoad[0].tie_num);\n } else {\n var roadType = \"bigWay\";\n halfcutRoad(roadType, ctb, unit, bigRoad, cols, gameId, ask, askroad.askbigRoad);\n }\n }\n if (bigEyeRoad) {\n var roadType = \"bigeyeWay\";\n halfcutRoad(roadType, ctb, unit, bigEyeRoad, cols, gameId, ask, askroad.askbigEyeRoad);\n }\n if (pathway) {\n var roadType = \"littlWay\";\n halfcutRoad(roadType, ctb, unit, pathway, cols, gameId, ask, askroad.askpathway);\n }\n if (roach) {\n var roadType = \"roachWay\";\n halfcutRoad(roadType, ctb, unit, roach, cols, gameId, ask, askroad.askroach);\n }\n if (sanxingRoad) {\n var roadType = \"sanxingWay\";\n halfcutRoad(roadType, ctb, unit, sanxingRoad, cols, gameId, ask, askroad.asksanxing);\n }\n }\n}\n\n// 前端路单数据截取\nfunction cutRoad(billnumber, roadType, ctb, unit, roadData, cols, gameId, ask, askroad) {\n var L = roadData.length;\n var new_roadData = [];\n var Tab = 0;\n var start_x = 0;\n // 格子个数\n if (roadType == \"showWay\" || roadType == \"bigWay\") {\n if (roadType == \"showWay\") {\n if (ask && askroad) {\n Tab = cols / 2;\n } else if (gameId == 6 && billnumber == 3) {\n Tab = parseInt(cols / 3) - 1;\n } else {\n Tab = cols / 2 - 1;\n }\n } else {\n if (ask && askroad) {\n Tab = cols;\n } else {\n Tab = cols - 1;\n }\n }\n } else if (roadType == \"sanxingWay\") {\n if (ask && askroad) {\n Tab = cols / 2;\n } else {\n Tab = cols / 2 - 1;\n }\n } else if (roadType == \"toningBigWay\" || roadType == \"bigRoadBS\" || roadType == \"bigRoadSP\") {\n if (billnumber == 3) {\n Tab = parseInt(cols / 3) - 1;\n } else if (billnumber == 2) {\n Tab = parseInt(cols / 2) - 1;\n } else {\n Tab = cols - 1;\n }\n } else {\n if (ask && askroad) {\n Tab = cols - 1;\n } else {\n Tab = cols - 2;\n }\n }\n // 初始位置\n if (billnumber == 1) {\n start_x = 0.25;\n } else if (billnumber == 2) {\n if (roadType == \"bigRoadSP\") {\n start_x = 0.25;\n }\n if (roadType == \"bigRoadBS\") {\n start_x = parseInt(cols / 2) + 0.25;\n }\n } else if (billnumber == 3) {\n if (roadType == \"toningBigWay\") {\n start_x = 0.25;\n }\n if (roadType == \"bigRoadSP\") {\n start_x = parseInt(cols / 3) + 0.25;\n }\n if (roadType == \"bigRoadBS\") {\n start_x = parseInt(cols / 3) * 2 + 0.25;\n }\n } else if (billnumber == 4) {\n start_x = 0.25;\n if (roadType == \"littlWay\") {\n start_x = cols * 0.55 * unit;\n }\n unit = unit * 2;\n } else if (billnumber == 5) {\n start_x = cols / 2 + 0.25;\n if (roadType == \"bigWay\") {\n start_x = cols / 2;\n }\n if (roadType == \"littlWay\") {\n start_x = cols * 0.5 * unit + 0.25 * unit * (cols + 1);\n }\n if (roadType == \"sanxingWay\") {\n start_x = cols * 0.5 * unit + 0.25 * unit * (cols + 1);\n }\n }\n if (L >= 1) {\n var last_x = roadData[L - 1].show_x;\n if (last_x > Tab) {\n var cut = last_x - Tab;\n roadData.forEach(function (v) {\n if (v.show_x > cut) {\n new_roadData.push(v);\n }\n });\n } else {\n new_roadData = roadData;\n cut = 0;\n }\n } else {\n new_roadData = roadData;\n cut = 0;\n }\n new_roadData.forEach(function (v) {\n if (roadType == \"roachWay\") {\n CockrochPath(ctb, unit, start_x, v.show_x - cut, v.show_y, v.result);\n } else if (roadType == \"littlWay\") {\n LittlePath(ctb, unit, start_x, v.show_x - cut, v.show_y, v.result);\n } else if (roadType == \"bigeyeWay\") {\n BigeyePath(ctb, unit, start_x, v.show_x - cut, v.show_y, v.result);\n } else if (roadType == \"showWay\") {\n SoloPath(gameId, ctb, unit, v.show_x - cut, v.show_y, v.result, v.pair);\n } else if (roadType == \"bigWay\") {\n BigPath(ctb, unit, start_x, v.show_x - cut, v.show_y, v.result, v.tie_num, v.pair, billnumber);\n } else if (roadType == \"sanxingWay\") {\n sanxingPath(ctb, unit, start_x, v.show_x - cut, v.show_y, v.result, v.tie_num);\n } else if (roadType == \"toningBigWay\" || roadType == \"bigRoadSP\" || roadType == \"bigRoadBS\") {\n ToningBigPath(ctb, unit, start_x, v.show_x - cut, v.show_y, v.result, v.tie_num, v.pair, billnumber, roadType);\n }\n });\n}\n\n// 半路单数据截取\nfunction halfcutRoad(roadType, ctb, unit, roadData, cols, gameId, ask, askroad) {\n var L = roadData.length;\n var new_roadData = [];\n var Tab = 0;\n var start_x = 0;\n if (roadType == \"showWay\") {\n if (ask && askroad) {\n Tab = cols;\n } else {\n Tab = cols - 1;\n }\n }\n if (roadType == \"bigeyeWay\" || roadType == \"roachWay\") {\n if (ask && askroad) {\n Tab = cols * 2 + 1;\n } else {\n Tab = cols * 2;\n }\n }\n if (roadType == \"bigWay\" || roadType == \"littlWay\") {\n if (ask && askroad) {\n Tab = cols * 2;\n } else {\n Tab = cols * 2 - 1;\n }\n }\n if (roadType == \"sanxingWay\") {\n if (ask && askroad) {\n Tab = cols;\n } else {\n Tab = cols - 1;\n }\n }\n if (L >= 1) {\n var last_x = roadData[L - 1].show_x;\n if (last_x > Tab) {\n var cut = last_x - Tab;\n roadData.forEach(function (v) {\n if (v.show_x > cut) {\n new_roadData.push(v);\n }\n });\n } else {\n new_roadData = roadData;\n cut = 0;\n }\n } else {\n new_roadData = roadData;\n cut = 0;\n }\n new_roadData.forEach(function (v) {\n if (roadType == \"showWay\") {\n SoloPath(gameId, ctb, unit, v.show_x - cut, v.show_y, v.result, v.pair);\n } else if (roadType == \"bigWay\") {\n BigPath(ctb, unit, start_x, v.show_x - cut, v.show_y + 12, v.result, v.tie_num, v.pair, 2);\n } else if (roadType == \"bigeyeWay\") {\n BigeyePath(ctb, unit, start_x, v.show_x - cut, v.show_y + 24, v.result);\n } else if (roadType == \"littlWay\") {\n start_x = (cols + 0.5) * unit / 2;\n LittlePath(ctb, unit, start_x, v.show_x - cut, v.show_y + 24, v.result);\n } else if (roadType == \"roachWay\") {\n CockrochPath(ctb, unit, start_x, v.show_x - cut, v.show_y + 24, v.result);\n } else if (roadType == \"sanxingWay\") {\n start_x = cols * 0.525 * unit;\n sanxingPath(ctb, unit, start_x, v.show_x - cut, v.show_y + 12, v.result, v.tie_num);\n }\n });\n}\n\n// 画线条\nfunction Drawline(ctb, unit, rows, cols, billnumber) {\n var CanvasWidht = unit * cols;\n var CanvasHeight = unit * rows;\n ctb.lineWidth = 1; //线条宽度\n ctb.strokeStyle = \"#d9d9d9\"; //线条颜色\n ctb.beginPath();\n ctb.moveTo(0, 0.5);\n ctb.lineTo(CanvasWidht, 0.5);\n for (var i = 1; i <= rows; i++) {\n ctb.moveTo(0, unit * i);\n ctb.lineTo(CanvasWidht, unit * i);\n }\n ctb.moveTo(0.5, 0);\n ctb.lineTo(0.5, CanvasHeight);\n for (var j = 1; j <= cols; j++) {\n ctb.moveTo(unit * j, 0);\n ctb.lineTo(unit * j, CanvasHeight);\n }\n if (billnumber != 1) {\n for (var l = 0; l <= rows; l++) {\n ctb.moveTo(CanvasWidht * 0.5, (l + 0.5) * unit);\n ctb.lineTo(CanvasWidht, (l + 0.5) * unit);\n }\n for (var k = 0; k <= cols - Math.floor(0.5 * cols); k++) {\n ctb.moveTo((Math.floor(0.5 * cols) + k + 0.5) * unit, 0);\n ctb.lineTo((Math.floor(0.5 * cols) + k + 0.5) * unit, CanvasHeight);\n }\n }\n ctb.closePath();\n ctb.stroke();\n}\n\n// 多台四条路\nfunction multipleDrawline(ctb, unit, rows, cols) {\n var CanvasWidht = unit * cols;\n var CanvasHeight = unit * rows;\n ctb.lineWidth = 1; //线条宽度\n ctb.strokeStyle = \"#d9d9d9\"; //线条颜色\n ctb.beginPath();\n ctb.moveTo(0, 0.5);\n ctb.lineTo(CanvasWidht, 0.5);\n for (var i = 1; i <= rows; i++) {\n ctb.moveTo(0, unit * i);\n ctb.lineTo(CanvasWidht, unit * i);\n }\n ctb.moveTo(0.5, 0);\n ctb.lineTo(0.5, CanvasHeight);\n for (var j = 1; j <= cols; j++) {\n ctb.moveTo(unit * j, 0);\n ctb.lineTo(unit * j, CanvasHeight);\n }\n ctb.closePath();\n ctb.stroke();\n}\n\n// 半路\nfunction halfwayDrawline(ctb, unit, rows, cols) {\n var CanvasWidht = unit * cols;\n var CanvasHeight = unit * rows;\n ctb.lineWidth = 1;\n ctb.beginPath();\n ctb.strokeStyle = \"#d9d9d9\";\n ctb.moveTo(0, 0.5);\n ctb.lineTo(CanvasWidht, 0.5);\n for (var i = 1; i <= rows; i++) {\n ctb.moveTo(0, unit * i);\n ctb.lineTo(CanvasWidht, unit * i);\n }\n ctb.moveTo(0.5, 0);\n ctb.lineTo(0.5, CanvasHeight);\n for (var j = 1; j <= cols; j++) {\n ctb.moveTo(unit * j, 0);\n ctb.lineTo(unit * j, CanvasHeight);\n }\n for (var i = 0; i <= rows; i++) {\n ctb.moveTo(0, unit * (i + 6.5));\n ctb.lineTo(CanvasWidht, unit * (i + 6.5));\n }\n for (var j = 0; j <= cols; j++) {\n ctb.moveTo(unit * (j + 0.5), CanvasHeight / 2);\n ctb.lineTo(unit * (j + 0.5), CanvasHeight);\n }\n ctb.closePath();\n ctb.stroke();\n // 画划分线\n ctb.beginPath();\n ctb.strokeStyle = \"#555\";\n ctb.moveTo(0, unit * 6);\n ctb.lineTo(CanvasWidht, unit * 6);\n ctb.moveTo(0, unit * 9);\n ctb.lineTo(CanvasWidht, unit * 9);\n ctb.closePath();\n ctb.stroke();\n}\n\n// 局数 数,文字X坐标,文字Y坐标,文字大小风格\nfunction Font_tie(ctb, num, Font_x, Font_y, fontsize, color) {\n if (num !== undefined) {\n ctb.beginPath();\n ctb.font = fontsize;\n ctb.textAlign = \"center\";\n ctb.textBaseline = \"middle\";\n ctb.fillStyle = color || \"#000\";\n ctb.fillText(num, Font_x, Font_y);\n ctb.stroke();\n }\n}\nfunction SoloPath(gameId, ctb, unit, x, y, type, corners) {\n ctb.beginPath();\n ctb.lineWidth = unit * 0.02;\n ctb.strokeStyle = \"#fff\";\n const radius = unit / 2;\n const $Type = $store.state.config.$Type;\n const $lang = $store.state.config.$lang;\n let color, fonts;\n switch (gameId) {\n case 1:\n if (type == 1) {\n color = \"#cf0012\";\n fonts = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].banker : \"B\";\n } else if (type == 2) {\n color = \"#1c1f89\";\n fonts = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].player : \"P\";\n } else if (type == 3) {\n color = \"#009944\";\n fonts = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].tie : \"T\";\n }\n break;\n case 2:\n if (type == 1) {\n color = \"#cf0012\";\n fonts = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].dragon : \"D\";\n } else if (type == 2) {\n color = \"#1c1f89\";\n fonts = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].tiger : \"T\";\n } else if (type == 3) {\n color = \"#009944\";\n fonts = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].tie : \"T\";\n }\n break;\n case 6:\n fonts = type;\n if (type == 0) {\n color = \"#2e2e2e\";\n } else if (type == 1) {\n color = \"#1c1f89\";\n } else if (type == 2) {\n color = \"#009944\";\n } else if (type == 3) {\n color = \"#ffc107\";\n } else if (type == 4) {\n color = \"#cf0012\";\n }\n break;\n }\n ctb.arc(unit * (x - 0.5), radius + unit * (y - 1), unit * 0.4, 0, Math.PI * 2);\n ctb.fillStyle = color;\n ctb.fill();\n ctb.font = \"bold \" + unit * 0.54 + \"px Arial\";\n ctb.fillStyle = \"#ddd\"; // 颜色\n ctb.textAlign = \"center\";\n ctb.textBaseline = \"middle\";\n ctb.fillText(fonts, unit * (x - 0.5), radius + unit * (y - 1));\n ctb.stroke();\n var corner_xy = unit / 3.5;\n if (corners == 1) {\n corner(ctb, unit, x, y, corner_xy, \"#cf0012\");\n } else if (corners == 2) {\n corner(ctb, unit, x, y, -corner_xy, \"#1c1f89\");\n } else if (corners == 3) {\n corner(ctb, unit, x, y, corner_xy, \"#cf0012\");\n corner(ctb, unit, x, y, -corner_xy, \"#1c1f89\");\n }\n}\n//SoloPath角标\nfunction corner(ctb, unit, x, y, corner_xy, corner_color) {\n var radius = unit / 2;\n ctb.beginPath();\n ctb.lineWidth = unit * 0.02;\n ctb.strokeStyle = \"#fff\";\n ctb.arc(unit * (x - 0.5) - corner_xy, radius + unit * (y - 1) - corner_xy, unit * 0.13, 0, Math.PI * 2);\n ctb.fillStyle = corner_color;\n ctb.fill();\n ctb.stroke();\n}\n\n// 大路\nfunction BigPath(ctb, unit, start_x, x, y, type, slash, corners, billnumber) {\n ctb.beginPath();\n if (billnumber == 1) {\n ctb.lineWidth = unit * 0.12;\n var radius = unit,\n half = 0.75;\n } else {\n ctb.lineWidth = unit * 0.065;\n var radius = unit / 2,\n half = 0.5;\n }\n if (type == 2) {\n var color = \"#1c1f89\";\n } else if (type == 1) {\n var color = \"#cf0012\";\n }\n ctb.strokeStyle = color;\n ctb.arc(radius * (x - half) + start_x * unit, radius * (y - 0.5), radius * 0.38, 0, Math.PI * 2);\n ctb.closePath();\n ctb.stroke();\n if (slash != 0) {\n ctb.beginPath();\n var linewidth = unit * 0.15;\n ctb.lineWidth = radius * 0.14; //线条宽度\n ctb.lineCap = \"round\";\n ctb.strokeStyle = \"#009944\"; //线条颜色\n ctb.moveTo(radius * (x - half) + start_x * unit - linewidth, radius * (y - 0.5) + linewidth);\n ctb.lineTo(radius * (x - half) + start_x * unit + linewidth, radius * (y - 0.5) - linewidth);\n ctb.stroke();\n if (slash != 0) {\n Font_tie(ctb, slash, radius * (x - half) + start_x * unit, radius * (y - 0.5), \"bold \" + radius * 0.65 + \"px Arial\");\n }\n }\n var corner_xy = radius / 3.5;\n if (corners == 1) {\n BigPathcorner(ctb, unit, start_x, x, y, corner_xy, \"#cf0012\", billnumber);\n } else if (corners == 2) {\n BigPathcorner(ctb, unit, start_x, x, y, -corner_xy, \"#1c1f89\", billnumber);\n } else if (corners == 3) {\n BigPathcorner(ctb, unit, start_x, x, y, corner_xy, \"#cf0012\", billnumber);\n BigPathcorner(ctb, unit, start_x, x, y, -corner_xy, \"#1c1f89\", billnumber);\n }\n}\n\n//大路角标\nfunction BigPathcorner(ctb, unit, start_x, x, y, corner_xy, corner_color, billnumber) {\n if (billnumber == 1) {\n var radius = unit,\n half = 0.75,\n width = radius * 0.16;\n } else {\n var radius = unit / 2,\n half = 0.55,\n width = radius * 0.18;\n }\n ctb.beginPath();\n ctb.lineWidth = unit * 0.015;\n ctb.strokeStyle = \"#fff\";\n ctb.arc(radius * (x - half) + start_x * unit - corner_xy, radius * (y - 0.5) - corner_xy, width, 0, Math.PI * 2);\n ctb.arc(radius * (x - half) + start_x * unit - corner_xy, radius * (y - 0.5) - corner_xy, width, 0, Math.PI * 2);\n ctb.fillStyle = corner_color;\n ctb.fill();\n ctb.stroke();\n}\n\n// 大路 第一局 和\nfunction BigPathTie(billnumber, ctb, unit, cols, order) {\n if (billnumber == 1 || billnumber == 4) {\n var radius = unit,\n start_x = 0;\n } else {\n var radius = unit / 2,\n start_x = unit * cols * 0.5;\n }\n ctb.beginPath();\n ctb.lineWidth = 3; //线条宽度\n ctb.strokeStyle = \"#3EA542\"; //线条颜色\n ctb.lineCap = \"round\";\n ctb.moveTo(radius * 0.15 + start_x, radius / 2);\n ctb.lineTo(radius * 0.85 + start_x, radius / 2);\n ctb.stroke();\n Font_tie(ctb, order, radius * 0.5 + start_x, radius / 2, radius * 0.8 + \"px Arial\");\n}\n\n// 大眼路\nfunction BigeyePath(ctb, unit, start_x, x, y, type) {\n ctb.beginPath();\n ctb.lineWidth = unit * 0.06;\n var radius = unit / 4;\n if (type == 2) {\n var color = \"#1c1f89\";\n } else if (type == 1) {\n var color = \"#cf0012\";\n }\n ctb.strokeStyle = color;\n ctb.arc(radius / 2 + radius * (x - 2) + start_x * unit, unit * 3.25 + radius * (y - 1.5), unit * 0.09, 0, Math.PI * 2);\n ctb.closePath();\n ctb.stroke();\n}\n//小路\nfunction LittlePath(ctb, unit, start_x, x, y, type) {\n ctb.beginPath();\n ctb.lineWidth = 0;\n var radius = unit / 4;\n if (type == 2) {\n var color = \"#1c1f89\";\n } else if (type == 1) {\n var color = \"#cf0012\";\n }\n ctb.strokeStyle = color;\n ctb.fillStyle = color;\n ctb.arc(radius / 2 + radius * (x - 2) + start_x, unit * 3.25 + radius * (y - 1.5), radius * 0.28, 0, Math.PI * 2);\n ctb.closePath();\n ctb.stroke();\n ctb.fill();\n}\nfunction CockrochPath(ctb, unit, start_x, x, y, type) {\n var radius = unit / 4,\n linewidth = radius * 0.3;\n ctb.beginPath();\n ctb.lineCap = \"round\";\n ctb.lineWidth = radius * 0.3; //线条宽度\n if (type == 2) {\n var color = \"#1c1f89\";\n } else if (type == 1) {\n var color = \"#cf0012\";\n }\n ctb.strokeStyle = color;\n ctb.moveTo(start_x * unit + radius * (x - 1.5) - linewidth, radius / 2 + radius * (y - 1) + linewidth + 4.5 * unit);\n ctb.lineTo(start_x * unit + radius * (x - 1.5) + linewidth, radius / 2 + radius * (y - 1) - linewidth + 4.5 * unit);\n ctb.stroke();\n}\nfunction sanxingPath(ctb, unit, start_x, x, y, type, slash) {\n ctb.beginPath();\n var radius = unit / 2;\n ctb.lineWidth = radius * 0.15;\n if (type == 2) {\n var color = \"#1c1f89\";\n } else if (type == 1) {\n var color = \"#cf0012\";\n }\n ctb.strokeStyle = color;\n ctb.arc(start_x + radius * (x - 1), unit * 4.75 + radius * (y - 1), radius * 0.38, 0, Math.PI * 2);\n ctb.closePath();\n ctb.stroke();\n if (slash != 0) {\n ctb.beginPath();\n var linewidth = unit * 0.12;\n ctb.lineWidth = unit * 0.08; //线条宽度\n ctb.lineCap = \"round\";\n ctb.strokeStyle = \"#009944\"; //线条颜色\n\n ctb.moveTo(start_x + radius * (x - 1) - linewidth, unit * 4.5 + radius * (y - 0.5) + linewidth);\n ctb.lineTo(start_x + radius * (x - 1) + linewidth, unit * 4.5 + radius * (y - 0.5) - linewidth);\n ctb.stroke();\n if (slash > 0) {\n Font_tie(ctb, slash, start_x + radius * (x - 1), unit * 4.5 + radius * (y - 0.5), radius * 0.7 + \"px Arial\");\n }\n }\n}\n\n// NN\nfunction NNcanvas(gameId, ctb, unit_x, unit_y, rows, cols, roadData\n// total_num\n) {\n if (roadData && roadData != undefined) {\n var L = roadData.length;\n var new_roadData = [];\n var Tab = cols - 2;\n if (L >= 1) {\n var last_x = roadData[L - 1].show_x;\n if (last_x > Tab) {\n var cut = last_x - Tab;\n roadData.forEach(function (v) {\n if (v.show_x > cut) {\n new_roadData.push(v);\n }\n });\n } else {\n new_roadData = roadData;\n cut = 0;\n }\n } else {\n new_roadData = roadData;\n cut = 0;\n }\n roadData.forEach(function (v) {\n NNwaybill(gameId, ctb, unit_x, unit_y, v.show_x - cut, v.show_y, v.type, v.result, v.is_win);\n });\n }\n NNtitle(ctb, unit_x, unit_y, unit_y);\n NNline(ctb, unit_x, unit_y, rows, cols);\n}\nfunction NNwaybill(gameId, ctb, unit_x, unit_y, x, y, type, result, win) {\n var fonts = \"\",\n color = \"#000\";\n var fontsize = unit_x * 0.28;\n if ($store.state.config.$Type == \"cn\") {\n if (result == 0) {\n fonts = \"无牛\";\n } else if (result == 1) {\n fonts = \"牛1\";\n } else if (result == 2) {\n fonts = \"牛2\";\n } else if (result == 3) {\n fonts = \"牛3\";\n } else if (result == 4) {\n fonts = \"牛4\";\n } else if (result == 5) {\n fonts = \"牛5\";\n } else if (result == 6) {\n fonts = \"牛6\";\n } else if (result == 7) {\n fonts = \"牛7\";\n } else if (result == 8) {\n fonts = \"牛8\";\n } else if (result == 9) {\n fonts = \"牛9\";\n } else if (result == 10) {\n fonts = \"牛牛\";\n } else if (result == 11 && gameId == 4) {\n fonts = \"五公\";\n } else if (result == 11 && gameId == 5) {\n fonts = \"豹子\";\n } else if (result == 12) {\n fonts = \"同花顺\";\n } else if (result == 13) {\n fonts = \"皇家同花顺\";\n }\n } else if ($store.state.config.$Type == \"tw\") {\n if (result == 0) {\n fonts = \"無牛\";\n } else if (result == 1) {\n fonts = \"牛1\";\n } else if (result == 2) {\n fonts = \"牛2\";\n } else if (result == 3) {\n fonts = \"牛3\";\n } else if (result == 4) {\n fonts = \"牛4\";\n } else if (result == 5) {\n fonts = \"牛5\";\n } else if (result == 6) {\n fonts = \"牛6\";\n } else if (result == 7) {\n fonts = \"牛7\";\n } else if (result == 8) {\n fonts = \"牛8\";\n } else if (result == 9) {\n fonts = \"牛9\";\n } else if (result == 10) {\n fonts = \"牛牛\";\n } else if (result == 11 && gameId == 4) {\n fonts = \"五公\";\n } else if (result == 11 && gameId == 5) {\n fonts = \"豹子\";\n } else if (result == 12) {\n fonts = \"同花順\";\n } else if (result == 13) {\n fonts = \"皇家同花順\";\n }\n } else {\n if (result == 0) {\n fonts = \"No Bull\";\n } else if (result == 1) {\n fonts = \"B 1\";\n } else if (result == 2) {\n fonts = \"B 2\";\n } else if (result == 3) {\n fonts = \"B 3\";\n } else if (result == 4) {\n fonts = \"B 4\";\n } else if (result == 5) {\n fonts = \"B 5\";\n } else if (result == 6) {\n fonts = \"B 6\";\n } else if (result == 7) {\n fonts = \"B 7\";\n } else if (result == 8) {\n fonts = \"B 8\";\n } else if (result == 9) {\n fonts = \"B 9\";\n } else if (result == 10) {\n fonts = \"Super B \";\n } else if (result == 11 && gameId == 4) {\n fonts = \"Five P \";\n } else if (result == 11 && gameId == 5) {\n fonts = \"Leopard\";\n } else if (result == 12) {\n fonts = \"Flush\";\n } else if (result == 13) {\n fonts = \"SuperFlush\";\n }\n fontsize = unit_x * 0.22;\n }\n if (type == 1) {\n color = \"#ce2837\";\n if (win == 1) {\n ctb.fillStyle = color;\n ctb.fillRect(unit_x * x, unit_y * (y - 0.3), unit_x, unit_y * 0.3);\n Font_tie(ctb, \"WIN\", unit_x * (0.5 + x), unit_y * (y - 0.14), \"bold \" + unit_x * 0.15 + \"px Arial\", \"#fff\");\n }\n } else if (type == 2) {\n color = \"#1d4999 \";\n if (win == 1) {\n ctb.fillStyle = color;\n ctb.fillRect(unit_x * x, unit_y * (y - 0.3), unit_x, unit_y * 0.3);\n Font_tie(ctb, \"WIN\", unit_x * (0.5 + x), unit_y * (y - 0.14), \"bold \" + unit_x * 0.15 + \"px Arial\", \"#fff\");\n }\n }\n Font_tie(ctb, fonts, unit_x * (0.5 + x), unit_y * (y - 0.5), \"bold \" + fontsize + \"px Arial\", color);\n}\n\n// 画表头\nfunction NNtitle(ctb, unit_x, unit_y) {\n for (var i = 0; i <= 4; i++) {\n var grd = ctb.createLinearGradient(0, unit_x, 0, 0);\n var fontsize = unit_x * 0.32;\n if (i == 0) {\n if ($store.state.config.$Type == \"cn\") {\n var color = \"#fff\",\n font = \"庄家\";\n } else if ($store.state.config.$Type == \"tw\") {\n var color = \"#fff\",\n font = \"莊家\";\n } else if ($store.state.config.$Type == \"tl\") {\n var color = \"#fff\",\n font = \"เจ้ามือ\";\n } else {\n var color = \"#fff\",\n font = \"Banker\",\n fontsize = unit_x * 0.25;\n }\n grd.addColorStop(0, \"#ae0b1a\");\n grd.addColorStop(0.5, \"#ff0017\");\n grd.addColorStop(1, \"#ae0b1a\");\n } else {\n if ($store.state.config.$Type == \"cn\") {\n var color = \"#fff\",\n font = \"闲\" + i;\n } else if ($store.state.config.$Type == \"tw\") {\n var color = \"#fff\",\n font = \"閒\" + i;\n } else if ($store.state.config.$Type == \"yn\") {\n var color = \"#fff\",\n font = \"Palyer\" + i,\n fontsize = unit_x * 0.25;\n } else if ($store.state.config.$Type == \"tl\") {\n var color = \"#fff\",\n font = \"ผู้เล่น\" + i,\n fontsize = unit_x * 0.25;\n } else {\n var color = \"#fff\",\n font = \"Palyer\" + i,\n fontsize = unit_x * 0.25;\n }\n grd.addColorStop(0, \"#0321a2\");\n grd.addColorStop(0.5, \"#002ffb\");\n grd.addColorStop(1, \"#092679\");\n }\n ctb.fillStyle = grd;\n ctb.fillRect(0, i * unit_y, unit_x, unit_y);\n Font_tie(ctb, font, unit_x / 2, i * unit_y + unit_y / 2, \"bold \" + fontsize + \"px Arial\", color);\n }\n}\n\n// NN画线条\nfunction NNline(ctb, unit_x, unit_y, rows, cols) {\n const CanvasWidht = unit_x * cols;\n const CanvasHeight = unit_y * rows;\n ctb.lineWidth = 1; //线条宽度\n ctb.strokeStyle = \"#deded9\"; //线条颜色\n ctb.beginPath();\n for (let i = 0; i <= rows; i++) {\n ctb.moveTo(0, unit_y * i);\n ctb.lineTo(CanvasWidht, unit_y * i);\n }\n for (let j = 1; j <= cols; j++) {\n ctb.moveTo(unit_x * j, 0);\n ctb.lineTo(unit_x * j, CanvasHeight);\n }\n ctb.closePath();\n ctb.stroke();\n}\n\n// 色碟\nfunction ToningWaybill(ctb, unit, rows, cols, path, gameId, billnumber, showBigWay) {\n ctb.clearRect(0, 0, unit * 100, unit * rows);\n const showRoad = path.showRoad;\n const bigRoad = path.bigRoad;\n const bigRoadBS = path.bigRoadBS;\n const bigRoadSP = path.bigRoadSP;\n let roadType = null;\n Drawline(ctb, unit, rows, cols, true);\n if (path) {\n if (billnumber != 2) {\n if (showRoad && showRoad.length > 0 && !showBigWay && billnumber != 1) {\n roadType = \"showWay\";\n cutRoad(billnumber, roadType, ctb, unit, showRoad, cols, gameId);\n }\n if (bigRoad && bigRoad.length > 0 && showBigWay) {\n roadType = \"toningBigWay\";\n cutRoad(billnumber, roadType, ctb, unit, bigRoad, cols, gameId);\n }\n }\n if (billnumber != 1) {\n if (bigRoadSP && bigRoadSP.length > 0) {\n roadType = \"bigRoadSP\";\n cutRoad(billnumber, roadType, ctb, unit, bigRoadSP, cols, gameId);\n }\n if (bigRoadBS && bigRoadBS.length > 0) {\n roadType = \"bigRoadBS\";\n cutRoad(billnumber, roadType, ctb, unit, bigRoadBS, cols, gameId);\n }\n }\n }\n}\n\n// 色碟单双路\nfunction ToningBigPath(ctb, unit, start_x, x, y, type, slash, corners, billnumber, roadType) {\n const $Type = $store.state.config.$Type;\n const $lang = $store.state.config.$lang;\n ctb.beginPath();\n let radius = unit,\n color,\n font;\n if (roadType == \"toningBigWay\") {\n font = type;\n if (type == 0) {\n color = \"#2e2e2e\";\n } else if (type == 1) {\n color = \"#1c1f89\";\n } else if (type == 2) {\n color = \"#009944\";\n } else if (type == 3) {\n color = \"#ffc107\";\n } else if (type == 4) {\n color = \"#cf0012\";\n }\n } else if (roadType == \"bigRoadBS\") {\n if (type == 1) {\n color = \"#cf0012\";\n font = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].big : \"B\";\n } else if (type == 2) {\n color = \"#1c1f89\";\n font = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].small : \"S\";\n }\n } else if (roadType == \"bigRoadSP\") {\n if (type == 1) {\n color = \"#cf0012\";\n font = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].even : \"E\";\n } else if (type == 2) {\n color = \"#1c1f89\";\n font = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].odd : \"O\";\n }\n }\n ctb.arc(radius * (x - 0.75) + start_x * radius, radius * (y - 0.5), radius * 0.38, 0, Math.PI * 2);\n ctb.fillStyle = color;\n ctb.fill();\n ctb.font = \"bold \" + unit * 0.54 + \"px Arial\";\n ctb.fillStyle = \"#fff\"; // 颜色\n ctb.textAlign = \"center\";\n ctb.textBaseline = \"middle\";\n ctb.fillText(font, radius * (x - 0.75) + start_x * unit, radius * (y - 0.5));\n ctb.closePath();\n ctb.stroke();\n const corner_xy = radius / 3.5;\n if (corners == 1) {\n BigPathcorner(ctb, unit, start_x, x, y, corner_xy, \"#cf0012\", billnumber);\n } else if (corners == 2) {\n BigPathcorner(ctb, unit, start_x, x, y, -corner_xy, \"#1c1f89\", billnumber);\n } else if (corners == 3) {\n BigPathcorner(ctb, unit, start_x, x, y, corner_xy, \"#cf0012\", billnumber);\n BigPathcorner(ctb, unit, start_x, x, y, -corner_xy, \"#1c1f89\", billnumber);\n }\n if (slash && roadType == \"bigRoadBS\") {\n corner(ctb, unit, start_x + x - 0.25, y, -corner_xy, \"#009944\");\n }\n}\n\n// 骰宝\nconst diceSpriteSrc = require(`../images/dice/sprite.png`);\nconst en_diceSpriteSrc = require(`../images/dice/en_sprite.png`);\nfunction DiceWaybill(ctb, unit, rows, cols, data, billnumber) {\n const $Type = $store.state.config.$Type;\n ctb.clearRect(0, 0, unit * (cols + 1), unit * (rows + 1));\n const sprite = new Image();\n sprite.crossOrigin = \"anonymous\";\n sprite.src = $Type == \"cn\" || $Type == \"tw\" ? diceSpriteSrc : en_diceSpriteSrc;\n let diceWidth = 0,\n diceHeight = 0,\n spriteArry = [];\n sprite.onload = () => {\n diceWidth = sprite.width / 2;\n diceHeight = sprite.height / 6;\n spriteArry = {\n dice_1: [0, 0],\n dice_2: [0, 1],\n dice_3: [0, 2],\n dice_odd: [0, 3],\n dice_even: [0, 4],\n dice_triplet: [0, 5],\n dice_4: [1, 0],\n dice_5: [1, 1],\n dice_6: [1, 2],\n dice_small: [1, 3],\n dice_big: [1, 4],\n dice_num: [1, 5]\n };\n if (data) {\n inputData(data.showRoad, \"showRoad\");\n if (billnumber == 3) {\n inputData(data.bigRoadBS, \"bigRoadBS\");\n inputData(data.bigRoadSP, \"bigRoadSP\");\n }\n }\n drawLine();\n };\n function inputData(data, type) {\n // 数据截取\n let newData = [];\n const L = data.length;\n let Tab = cols - 1;\n if (billnumber == 3) {\n Tab = parseInt(cols / 3) - 1;\n }\n let cut = 0;\n if (L <= Tab) {\n newData = data;\n } else {\n if (type == \"showRoad\") {\n newData = data.slice(L - Tab, L);\n } else {\n newData = data.filter(v => v.show_x > data[L - 1].show_x - Tab);\n if (newData.length > 0) {\n cut = newData[0].show_x;\n }\n }\n }\n // 绘制图标\n if (type == \"showRoad\") {\n newData.forEach((v, i) => {\n const totle = v[0] + v[1] + v[2];\n drawIcon(i, 0, \"icon\", v[0]);\n drawIcon(i, 1, \"icon\", v[1]);\n drawIcon(i, 2, \"icon\", v[2]);\n drawIcon(i, 3, \"num\", totle);\n if (v[0] == v[1] && v[1] == v[2]) {\n drawIcon(i, 4, \"icon\", \"triplet\");\n drawIcon(i, 5, \"icon\", \"triplet\");\n } else {\n if (totle >= 11) {\n drawIcon(i, 4, \"icon\", \"big\");\n } else {\n drawIcon(i, 4, \"icon\", \"small\");\n }\n if (totle % 2 == 0) {\n drawIcon(i, 5, \"icon\", \"even\");\n } else {\n drawIcon(i, 5, \"icon\", \"odd\");\n }\n }\n });\n } else if (type == \"bigRoadBS\") {\n newData.forEach(v => {\n const text = v.result == 1 ? \"big\" : v.result == 2 ? \"small\" : \"triplet\";\n drawIcon(v.show_x - cut + Tab + 1, v.show_y - 1, \"icon\", text);\n });\n } else if (type == \"bigRoadSP\") {\n newData.forEach(v => {\n const text = v.result == 1 ? \"even\" : v.result == 2 ? \"odd\" : \"triplet\";\n drawIcon(v.show_x - cut + Tab * 2 + 2, v.show_y - 1, \"icon\", text);\n });\n }\n }\n function drawIcon(x, y, type, text) {\n if (type == \"icon\") {\n const position = spriteArry[`dice_${text}`];\n ctb.drawImage(sprite, position[0] * diceWidth, position[1] * diceHeight, diceWidth, diceHeight, unit * x + unit * 0.05, unit * y + unit / diceWidth * diceHeight * 0.05, unit * 0.9, unit / diceWidth * diceHeight * 0.9);\n } else if (type == \"num\") {\n const position = spriteArry[`dice_num`];\n ctb.drawImage(sprite, position[0] * diceWidth, position[1] * diceHeight, diceWidth, diceHeight, unit * x + unit * 0.05, unit * y + unit / diceWidth * diceHeight * 0.05, unit * 0.9, unit / diceWidth * diceHeight * 0.9);\n ctb.font = `bold ${unit * 0.58}px Arial`;\n ctb.fillStyle = \"#fff\";\n ctb.textAlign = \"center\";\n ctb.textBaseline = \"middle\";\n ctb.fillText(text, unit * (x + 0.45), unit * (y + 0.55));\n }\n // 大小单双路\n if (billnumber == 3 && type == \"icon\") {\n const position = spriteArry[`dice_${text}`];\n ctb.drawImage(sprite, position[0] * diceWidth, position[1] * diceHeight, diceWidth, diceHeight, unit * x, unit * y, unit * 0.9, unit / diceWidth * diceHeight * 0.9);\n }\n }\n function drawLine() {\n const CanvasWidht = unit * cols;\n const CanvasHeight = unit * rows;\n ctb.lineWidth = 1;\n ctb.strokeStyle = \"#deded9\";\n ctb.beginPath();\n for (let i = 0; i <= rows; i++) {\n ctb.moveTo(0, unit * i);\n ctb.lineTo(CanvasWidht, unit * i);\n }\n for (let j = 0; j <= cols; j++) {\n ctb.moveTo(unit * j, 0);\n ctb.lineTo(unit * j, CanvasHeight);\n }\n ctb.closePath();\n ctb.stroke();\n }\n}\n\n// 轮盘\nconst rouletteSpriteSrc = require(`../images/roulette/sprite.png`);\nfunction RouletteWaybill(ctb, unit, rows, cols, data, billnumber) {\n const $Type = $store.state.config.$Type;\n const $lang = $store.state.config.$lang;\n ctb.clearRect(0, 0, unit * (cols + 1), unit * (rows + 1));\n const sprite = new Image();\n sprite.crossOrigin = \"anonymous\";\n sprite.src = rouletteSpriteSrc;\n let W = 0,\n H = 0,\n spriteArry = [];\n sprite.onload = () => {\n W = sprite.width / 2;\n H = sprite.height / 3;\n spriteArry = {\n blue: [0, 0],\n red: [0, 1],\n green: [0, 2],\n black: [1, 2]\n };\n if (data) {\n inputData(data.showRoad, \"showRoad\");\n // console.log(data)\n if (billnumber == 3) {\n // console.log(data.bigRoadBS)\n inputData(data.bigRoadBS, \"bigRoadBS\");\n inputData(data.bigRoadSP, \"bigRoadSP\");\n }\n }\n drawLine();\n };\n function inputData(data, type) {\n // 数据截取\n let newData = [];\n const L = data.length;\n let Tab = cols - 1;\n if (billnumber == 3) {\n Tab = parseInt(cols / 3) - 1;\n }\n let cut = 0;\n if (L <= Tab) {\n newData = data;\n } else {\n newData = data.filter(v => v.show_x > data[L - 1].show_x - Tab);\n if (newData.length > 0) {\n cut = newData[0].show_x;\n }\n }\n // 绘制图标\n if (type == \"showRoad\") {\n newData.forEach((v, i) => {\n drawIcon(type, v.show_x - cut - 1, v.show_y - 1, v.result);\n });\n } else if (type == \"bigRoadBS\") {\n // console.log(newData)\n newData.forEach(v => {\n drawIcon(type, v.show_x - cut + Tab + 1, v.show_y - 1, v.result);\n });\n } else if (type == \"bigRoadSP\") {\n newData.forEach(v => {\n drawIcon(type, v.show_x - cut + Tab * 2 + 2, v.show_y - 1, v.result);\n });\n }\n }\n function drawIcon(type, x, y, text) {\n let position = [0, 0];\n if (type == \"showRoad\") {\n const isBlack = [\"2\", \"4\", \"6\", \"8\", \"10\", \"11\", \"13\", \"15\", \"17\", \"20\", \"22\", \"24\", \"26\", \"28\", \"29\", \"31\", \"33\", \"35\"].includes(text);\n const isRed = [\"1\", \"3\", \"5\", \"7\", \"9\", \"12\", \"14\", \"16\", \"18\", \"19\", \"21\", \"23\", \"25\", \"27\", \"30\", \"32\", \"34\", \"36\"].includes(text);\n if (text == 0) {\n position = spriteArry.green;\n } else if (isBlack) {\n position = spriteArry.black;\n } else if (isRed) {\n position = spriteArry.red;\n }\n } else if (type == \"bigRoadBS\") {\n if (text == 1) {\n text = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].big : \"B\";\n position = spriteArry.red;\n } else if (text == 2) {\n text = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].small : \"S\";\n position = spriteArry.blue;\n } else if (text == 3) {\n text = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].zero : \"Z\";\n position = spriteArry.green;\n }\n } else if (type == \"bigRoadSP\") {\n if (text == 1) {\n text = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].even : \"E\";\n position = spriteArry.red;\n } else if (text == 2) {\n text = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].odd : \"O\";\n position = spriteArry.blue;\n } else if (text == 3) {\n text = $Type == \"cn\" || $Type == \"tw\" ? $lang[$Type].zero : \"Z\";\n position = spriteArry.green;\n }\n }\n ctb.drawImage(sprite, position[0] * W, position[1] * H, W, H, unit * x + unit * 0.05, unit * y + unit / W * H * 0.05, unit * 0.9, unit / W * H * 0.9);\n ctb.font = `bold ${unit * 0.58}px Arial`;\n ctb.fillStyle = \"#fff\";\n ctb.textAlign = \"center\";\n ctb.textBaseline = \"middle\";\n ctb.fillText(text, unit * (x + 0.5), unit * (y + 0.55));\n }\n function drawLine() {\n const CanvasWidht = unit * cols;\n const CanvasHeight = unit * rows;\n ctb.lineWidth = 1;\n ctb.strokeStyle = \"#deded9\";\n ctb.beginPath();\n for (let i = 0; i <= rows; i++) {\n ctb.moveTo(0, unit * i);\n ctb.lineTo(CanvasWidht, unit * i);\n }\n for (let j = 0; j <= cols; j++) {\n ctb.moveTo(unit * j, 0);\n ctb.lineTo(unit * j, CanvasHeight);\n }\n ctb.closePath();\n ctb.stroke();\n }\n}\nexport { autoask, waybillAsk, waybillConfig, halfwayConfig, Waybill, WaybillbigRoad, NNcanvas, ToningWaybill, DiceWaybill, RouletteWaybill, HalfWay };","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]} |