This commit is contained in:
@@ -26020,10 +26020,10 @@ cr.getObjectRefTable = function () { return [
|
|||||||
cr.plugins_.Audio,
|
cr.plugins_.Audio,
|
||||||
cr.plugins_.Browser,
|
cr.plugins_.Browser,
|
||||||
cr.plugins_.Function,
|
cr.plugins_.Function,
|
||||||
cr.plugins_.Sprite,
|
|
||||||
cr.plugins_.SenaPlugin,
|
cr.plugins_.SenaPlugin,
|
||||||
cr.plugins_.Touch,
|
cr.plugins_.Sprite,
|
||||||
cr.plugins_.Text,
|
cr.plugins_.Text,
|
||||||
|
cr.plugins_.Touch,
|
||||||
cr.behaviors.Rex_MoveTo,
|
cr.behaviors.Rex_MoveTo,
|
||||||
cr.behaviors.Fade,
|
cr.behaviors.Fade,
|
||||||
cr.behaviors.DragnDrop,
|
cr.behaviors.DragnDrop,
|
||||||
@@ -26088,6 +26088,7 @@ cr.getObjectRefTable = function () { return [
|
|||||||
cr.plugins_.Sprite.prototype.cnds.CompareInstanceVar,
|
cr.plugins_.Sprite.prototype.cnds.CompareInstanceVar,
|
||||||
cr.plugins_.Sprite.prototype.cnds.IsOverlapping,
|
cr.plugins_.Sprite.prototype.cnds.IsOverlapping,
|
||||||
cr.behaviors.DragnDrop.prototype.cnds.OnDrop,
|
cr.behaviors.DragnDrop.prototype.cnds.OnDrop,
|
||||||
|
cr.plugins_.Sprite.prototype.cnds.PickDistance,
|
||||||
cr.plugins_.Sprite.prototype.acts.SetPos,
|
cr.plugins_.Sprite.prototype.acts.SetPos,
|
||||||
cr.system_object.prototype.cnds.ForEach,
|
cr.system_object.prototype.cnds.ForEach,
|
||||||
cr.system_object.prototype.cnds.CompareVar,
|
cr.system_object.prototype.cnds.CompareVar,
|
||||||
@@ -26101,6 +26102,7 @@ cr.getObjectRefTable = function () { return [
|
|||||||
cr.system_object.prototype.exps.len,
|
cr.system_object.prototype.exps.len,
|
||||||
cr.plugins_.SenaPlugin.prototype.acts.Finish,
|
cr.plugins_.SenaPlugin.prototype.acts.Finish,
|
||||||
cr.plugins_.SenaPlugin.prototype.cnds.OnCorrect,
|
cr.plugins_.SenaPlugin.prototype.cnds.OnCorrect,
|
||||||
|
cr.plugins_.Audio.prototype.acts.SetPaused,
|
||||||
cr.plugins_.SenaPlugin.prototype.cnds.OnWrong,
|
cr.plugins_.SenaPlugin.prototype.cnds.OnWrong,
|
||||||
cr.system_object.prototype.cnds.EveryTick,
|
cr.system_object.prototype.cnds.EveryTick,
|
||||||
cr.plugins_.SenaPlugin.prototype.exps.getTimeLimit,
|
cr.plugins_.SenaPlugin.prototype.exps.getTimeLimit,
|
||||||
@@ -26113,6 +26115,5 @@ cr.getObjectRefTable = function () { return [
|
|||||||
cr.system_object.prototype.cnds.LayerVisible,
|
cr.system_object.prototype.cnds.LayerVisible,
|
||||||
cr.behaviors.Fade.prototype.acts.RestartFade,
|
cr.behaviors.Fade.prototype.acts.RestartFade,
|
||||||
cr.behaviors.Sin.prototype.acts.SetActive,
|
cr.behaviors.Sin.prototype.acts.SetActive,
|
||||||
cr.plugins_.Audio.prototype.acts.SetPaused,
|
|
||||||
cr.plugins_.SenaPlugin.prototype.exps.getQuestionValue
|
cr.plugins_.SenaPlugin.prototype.exps.getQuestionValue
|
||||||
];};
|
];};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
SQ_Word_Hint-Audio/images/boardsetting-sheet0.png
Normal file
BIN
SQ_Word_Hint-Audio/images/boardsetting-sheet0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": 1772162120,
|
"version": 1772435392,
|
||||||
"fileList": [
|
"fileList": [
|
||||||
"data.js",
|
"data.js",
|
||||||
"c2runtime.js",
|
"c2runtime.js",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"images/khung_timer-sheet0.png",
|
"images/khung_timer-sheet0.png",
|
||||||
"images/pause-sheet0.png",
|
"images/pause-sheet0.png",
|
||||||
"images/pause-sheet1.png",
|
"images/pause-sheet1.png",
|
||||||
"images/board-sheet0.png",
|
"images/boardsetting-sheet0.png",
|
||||||
"images/bgm-sheet0.png",
|
"images/bgm-sheet0.png",
|
||||||
"images/bgm-sheet1.png",
|
"images/bgm-sheet1.png",
|
||||||
"images/pauseicon-sheet0.png",
|
"images/pauseicon-sheet0.png",
|
||||||
|
|||||||
@@ -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,10 @@ 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();
|
||||||
|
console.log("🎮 Sena SDK: Game Started");
|
||||||
|
|
||||||
// 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 +1056,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
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1103,6 +1107,20 @@ SenaSDK.prototype.end = function (answer, callback) {
|
|||||||
`Result: ${correctCount}/${totalPairs} correct - ${isCorrect ? "CORRECT" : "INCORRECT"}`,
|
`Result: ${correctCount}/${totalPairs} correct - ${isCorrect ? "CORRECT" : "INCORRECT"}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// [NEW] Universal PostMessage for BE
|
||||||
|
window.parent.postMessage(
|
||||||
|
{
|
||||||
|
type: "GAME_RESULT",
|
||||||
|
payload: {
|
||||||
|
game_id: self.gameID || self.gameCode,
|
||||||
|
result: isCorrect ? "CORRECT" : "INCORRECT",
|
||||||
|
time_spent: duration,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"*",
|
||||||
|
);
|
||||||
|
console.log("📤 Sena SDK: GAME_RESULT sent successfully");
|
||||||
|
|
||||||
if (callback) callback(isCorrect);
|
if (callback) callback(isCorrect);
|
||||||
return {
|
return {
|
||||||
isCorrect: isCorrect,
|
isCorrect: isCorrect,
|
||||||
@@ -1202,9 +1220,7 @@ SenaSDK.prototype.end = function (answer, callback) {
|
|||||||
// [BƯỚC 3] Log và Return
|
// [BƯỚC 3] Log và Return
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
console.log(`Time spent: ${duration}s`);
|
console.log(`Time spent: ${duration}s`);
|
||||||
console.log(
|
console.log(`Result: ${isCorrect ? "CORRECT" : "INCORRECT"}`);
|
||||||
`Result: ${isCorrect ? "CORRECT" : "INCORRECT"} (User: ${result.userAnswer} vs Correct: ${result.correctAnswer})`,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (callback) callback(result.isCorrect);
|
if (callback) callback(result.isCorrect);
|
||||||
return result; // Return full object for debug
|
return result; // Return full object for debug
|
||||||
@@ -1733,7 +1749,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);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user