Compare commits

3 Commits
main ... master

Author SHA1 Message Date
Đặng Minh Quang
28e45f92e6 update update
All checks were successful
Deploy to Production / deploy (push) Successful in 7s
2026-02-27 14:29:01 +07:00
Đặng Minh Quang
7586ea20cb update them mockdata
All checks were successful
Deploy to Production / deploy (push) Successful in 8s
2026-02-27 13:39:07 +07:00
Đặng Minh Quang
93a6a17379 update lai injection
All checks were successful
Deploy to Production / deploy (push) Successful in 8s
2026-02-25 13:07:56 +07:00
8 changed files with 24 additions and 13 deletions

View File

@@ -25772,10 +25772,10 @@ cr.getObjectRefTable = function () { return [
cr.plugins_.Audio,
cr.plugins_.Browser,
cr.plugins_.Function,
cr.plugins_.Touch,
cr.plugins_.SenaPlugin,
cr.plugins_.Text,
cr.plugins_.Sprite,
cr.plugins_.SenaPlugin,
cr.plugins_.Touch,
cr.plugins_.Text,
cr.behaviors.Rex_MoveTo,
cr.behaviors.Sin,
cr.behaviors.Timer,
@@ -25785,6 +25785,7 @@ cr.getObjectRefTable = function () { return [
cr.behaviors.Fade,
cr.behaviors.lunarray_Tween,
cr.system_object.prototype.cnds.OnLayoutStart,
cr.plugins_.SenaPlugin.prototype.acts.Load,
cr.plugins_.Audio.prototype.acts.Play,
cr.plugins_.Text.prototype.acts.SetPos,
cr.plugins_.Sprite.prototype.exps.X,
@@ -25793,7 +25794,6 @@ cr.getObjectRefTable = function () { return [
cr.plugins_.Sprite.prototype.acts.SetAnimFrame,
cr.system_object.prototype.acts.Wait,
cr.plugins_.Sprite.prototype.acts.Destroy,
cr.plugins_.SenaPlugin.prototype.acts.Load,
cr.plugins_.SenaPlugin.prototype.cnds.OnLoad,
cr.plugins_.SenaPlugin.prototype.acts.Start,
cr.plugins_.SenaPlugin.prototype.cnds.OnStart,

File diff suppressed because one or more lines are too long

View File

@@ -81,7 +81,7 @@
<!-- Construct 2 exported games require jQuery. -->
<script src="jquery-3.4.1.min.js"></script>
<script src="tdv_sdk.js"></script>
<script src="sena_sdk.js"></script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 KiB

After

Width:  |  Height:  |  Size: 352 KiB

View File

@@ -1,5 +1,5 @@
{
"version": 1771998207,
"version": 1772177279,
"fileList": [
"data.js",
"c2runtime.js",
@@ -34,8 +34,6 @@
"icon-128.png",
"icon-256.png",
"loading-logo.png",
"tdv_sdk.js",
"bg.mp4",
"sena_sdk.js"
]
}

View File

@@ -50,6 +50,7 @@ function SenaSDK(gid = "G2510S1T30") {
// 'preview' - Timeout 5s rồi fallback sample (testing với data thật)
// 'dev' - Load sample ngay lập tức (development)
this.mode = "preview"; // Default mode
this.role = "student"; // Default role
}
/**
@@ -118,6 +119,7 @@ SenaSDK.prototype.loadFromPostMessage = function (inputJson, callback) {
console.warn("⚠️ Sena SDK: tdv_sdk not found, storing data locally");
self.data = inputJson.data;
self.correctAnswer = inputJson.answer;
self._parseGameCode(); // Thêm dòng này để SDK đọc đuôi thời gian T30
if (callback) callback(true);
}
return true;
@@ -153,7 +155,7 @@ SenaSDK.prototype.loadFromPostMessage = function (inputJson, callback) {
// Lưu trữ danh sách gốc
self.masterList = [...self.data.options];
// 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;
// Load Level 1 ngay lập tức để self.data.options chỉ chứa 6 card đầu
@@ -373,9 +375,15 @@ SenaSDK.prototype.load = function (callback, template = "G2510S1T30") {
self.mode = urlMode.toLowerCase();
}
// THÊM 2 DÒNG NÀY: Lấy role từ URL
const urlRole = urlParams.get("role");
if (urlRole) self.role = urlRole.toLowerCase();
console.log(
"🎮 Sena SDK: Mode =",
self.mode.toUpperCase(),
"| Role =",
self.role || "student",
"| GameCode =",
self.gameCode,
);
@@ -511,7 +519,7 @@ SenaSDK.prototype._loadFromServer = function (
// Lưu trữ danh sách gốc
self.masterList = [...self.data.options];
// 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;
// Load Level 1 ngay lập tức để self.data.options chỉ chứa 6 card đầu
@@ -1171,7 +1179,12 @@ SenaSDK.prototype.end = function (answer, callback) {
// -----------------------------------------------------------
// [BƯỚC 1] Kiểm tra Time Limit TRƯỚC (Sửa biến isCorrect)
// -----------------------------------------------------------
if (self.timeLimit > 0 && duration > self.timeLimit) {
// THÊM ĐIỀU KIỆN: Nếu là teacher thì bỏ qua kiểm tra thời gian
if (
self.role !== "teacher" &&
self.timeLimit > 0 &&
duration > self.timeLimit
) {
isCorrect = false; // CHỈ sửa biến boolean, KHÔNG gọi result.isCorrect
console.log("🎮 Sena SDK: Time Limit Exceeded -> Result set to False");
}
@@ -1721,7 +1734,7 @@ SenaSDK.prototype.loadLevelG5 = function (levelIndex) {
if (self.gameType !== 5 || !self.masterList) return false;
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);

Binary file not shown.

Binary file not shown.