fix bug dragdrop
All checks were successful
Deploy to Production / deploy (push) Successful in 6s

This commit is contained in:
Đặng Minh Quang
2026-02-27 18:20:29 +07:00
parent 3da319e41d
commit 681a67d0b5
5 changed files with 9 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{ {
"version": 1772161641, "version": 1772191073,
"fileList": [ "fileList": [
"data.js", "data.js",
"c2runtime.js", "c2runtime.js",

View File

@@ -119,6 +119,7 @@ SenaSDK.prototype.loadFromPostMessage = function (inputJson, callback) {
console.warn("⚠️ Sena SDK: tdv_sdk not found, storing data locally"); console.warn("⚠️ Sena SDK: tdv_sdk not found, storing data locally");
self.data = inputJson.data; self.data = inputJson.data;
self.correctAnswer = inputJson.answer; self.correctAnswer = inputJson.answer;
self._parseGameCode(); // Thêm dòng này để SDK đọc đuôi thời gian T30
if (callback) callback(true); if (callback) callback(true);
} }
return true; return true;
@@ -154,7 +155,7 @@ SenaSDK.prototype.loadFromPostMessage = function (inputJson, callback) {
// Lưu trữ danh sách gốc // Lưu trữ danh sách gốc
self.masterList = [...self.data.options]; self.masterList = [...self.data.options];
// Tính tổng số level // Tính tổng số level
self.totalLevels = Math.ceil(self.masterList.length / self.itemCount); self.totalLevels = Math.ceil(self.masterList.length / 6);
self.currentLevel = 0; self.currentLevel = 0;
// Load Level 1 ngay lập tức để self.data.options chỉ chứa 6 card đầu // Load Level 1 ngay lập tức để self.data.options chỉ chứa 6 card đầu
@@ -518,7 +519,7 @@ SenaSDK.prototype._loadFromServer = function (
// Lưu trữ danh sách gốc // Lưu trữ danh sách gốc
self.masterList = [...self.data.options]; self.masterList = [...self.data.options];
// Tính tổng số level // Tính tổng số level
self.totalLevels = Math.ceil(self.masterList.length / self.itemCount); self.totalLevels = Math.ceil(self.masterList.length / 6);
self.currentLevel = 0; self.currentLevel = 0;
// Load Level 1 ngay lập tức để self.data.options chỉ chứa 6 card đầu // Load Level 1 ngay lập tức để self.data.options chỉ chứa 6 card đầu
@@ -1037,6 +1038,9 @@ SenaSDK.prototype.getHintValue = function (index) {
SenaSDK.prototype.start = function () { SenaSDK.prototype.start = function () {
let self = this; let self = this;
// LUÔN GÁN THỜI GIAN BẮT ĐẦU Ở ĐÂY
self.startTime = Date.now();
// Nếu là matching game, forward sang tdv_sdk.start() // Nếu là matching game, forward sang tdv_sdk.start()
if (self.isMatchingGame) { if (self.isMatchingGame) {
console.log("🎮 Sena SDK: Matching game - forwarding start() to tdv_sdk"); console.log("🎮 Sena SDK: Matching game - forwarding start() to tdv_sdk");
@@ -1051,7 +1055,6 @@ SenaSDK.prototype.start = function () {
if (self.shuffle && self.data && self.data.options) { if (self.shuffle && self.data && self.data.options) {
self.shuffleArray(self.data.options); self.shuffleArray(self.data.options);
} }
self.startTime = Date.now();
// Additional logic for tracking can be added here if needed // Additional logic for tracking can be added here if needed
}; };
@@ -1733,7 +1736,7 @@ SenaSDK.prototype.loadLevelG5 = function (levelIndex) {
if (self.gameType !== 5 || !self.masterList) return false; if (self.gameType !== 5 || !self.masterList) return false;
self.currentLevel = levelIndex; self.currentLevel = levelIndex;
let count = self.itemCount; // Số card tối đa mỗi trang (VD: 6) let count = 6; // Khóa cứng max 6 card/trang cho G5
window.Sena_TotalLevels = Math.ceil(self.masterList.length / count); window.Sena_TotalLevels = Math.ceil(self.masterList.length / count);