User prompt
el calendario este tenga meses
User prompt
que aparescan desplegables
User prompt
las opciones esta la fecha en esa aparescan 3 opciones primero mes y luego dia(los dias dependen del mes
User prompt
en las opciones de fechas auméntale días
User prompt
en el calendario auméntale los numero y sombrea la fecha actual
User prompt
aumenta sábado y domingos en el calendario
User prompt
en las clases aumenta la opción de fecha y acomodar mejor los lugares de las casillas
User prompt
quiero que se pueda escribir cuando se marque la opción del nombre de la clase y el calendario pasalo al español
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'placeholderText.style.fill = value ? "#000000" : "#999999";' Line Number: 117
Code edit (1 edits merged)
Please save this source code
User prompt
Calendar Organizer Pro
Initial prompt
un juego de organización. primero tienes un calendario y en la parte superior tienes secciones para escoger en especifico 4. el primero: clases, el segundo: actividades, el tercero: tareas y el cuarto: otros. cada uno con colores diferentes. después de marcar la opción 1 da mas casillas donde hay 3: curso, tiempo y duración. en cada uno hay sitios para escribir y esas respuestas se reflejan en el calendario. al marcar la segunda opción dos aparecerán todas las clases y hay que escoger una y al marcarla aparecerá un lugar para poner un tiempo estimado y que acción se va a realizar en ese tiempo. en la tercera aparecerá una lugar, hora y fecha. en otros aparecerá lo mismo que en la opción tres con la adición de nombrar la actividad.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var CalendarEntry = Container.expand(function (data, color) {
var self = Container.call(this);
var entryGraphics = self.attachAsset('calendarEntry', {
anchorX: 0,
anchorY: 0
});
entryGraphics.tint = color;
var entryText = new Text2(data.name || data.course || data.activity, {
size: 18,
fill: 0x000000
});
entryText.anchor.set(0.5, 0.5);
entryText.x = entryGraphics.width / 2;
entryText.y = entryGraphics.height / 2;
self.addChild(entryText);
self.data = data;
return self;
});
var CategoryButton = Container.expand(function (type, color) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset(type + 'Button', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(type.toUpperCase(), {
size: 32,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.type = type;
self.isSelected = false;
self.select = function () {
self.isSelected = true;
tween(buttonGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200
});
currentCategory = self.type;
updateInputPanel();
};
self.deselect = function () {
self.isSelected = false;
tween(buttonGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
};
self.down = function (x, y, obj) {
// Deselect all other buttons
for (var i = 0; i < categoryButtons.length; i++) {
categoryButtons[i].deselect();
}
self.select();
LK.getSound('click').play();
};
return self;
});
var InputField = Container.expand(function (label, placeholder) {
var self = Container.call(this);
var fieldBackground = self.attachAsset('inputPanel', {
anchorX: 0,
anchorY: 0,
scaleX: 0.3,
scaleY: 0.15
});
fieldBackground.tint = 0xFFFFFF;
var labelText = new Text2(label, {
size: 24,
fill: 0x333333
});
labelText.anchor.set(0, 0.5);
labelText.x = 10;
labelText.y = -30;
self.addChild(labelText);
var placeholderText = new Text2(placeholder, {
size: 20,
fill: 0x999999
});
placeholderText.anchor.set(0, 0.5);
placeholderText.x = 10;
placeholderText.y = fieldBackground.height / 2;
self.addChild(placeholderText);
self.value = "";
self.placeholder = placeholder;
self.isActive = false;
self.setValue = function (value) {
self.value = value;
placeholderText.setText(value || placeholder);
placeholderText.tint = value ? 0x000000 : 0x999999;
};
self.down = function (x, y, obj) {
// Simple input simulation - cycle through common values
if (label === "Time") {
var times = ["9:00 AM", "10:00 AM", "11:00 AM", "1:00 PM", "2:00 PM", "3:00 PM"];
var currentIndex = times.indexOf(self.value);
self.setValue(times[(currentIndex + 1) % times.length]);
} else if (label === "Duration") {
var durations = ["1 hour", "2 hours", "3 hours"];
var currentIndex = durations.indexOf(self.value);
self.setValue(durations[(currentIndex + 1) % durations.length]);
} else if (label === "Date") {
var dates = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"];
var currentIndex = dates.indexOf(self.value);
self.setValue(dates[(currentIndex + 1) % dates.length]);
} else {
// For text fields, use some sample data
if (label === "Course Name") {
var courses = ["Math 101", "History 201", "Physics 301", "English 102"];
var currentIndex = courses.indexOf(self.value);
self.setValue(courses[(currentIndex + 1) % courses.length]);
} else if (label === "Location") {
var locations = ["Library", "Room 201", "Lab A", "Conference Room"];
var currentIndex = locations.indexOf(self.value);
self.setValue(locations[(currentIndex + 1) % locations.length]);
} else if (label === "Activity Name") {
var activities = ["Study Group", "Project Work", "Research", "Meeting"];
var currentIndex = activities.indexOf(self.value);
self.setValue(activities[(currentIndex + 1) % activities.length]);
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xF0F0F0
});
/****
* Game Code
****/
// Game state variables
var currentCategory = "classes";
var calendarEntries = [];
var categoryButtons = [];
var inputFields = [];
var classList = [];
// Create main calendar background
var calendarBg = game.addChild(LK.getAsset('calendarBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1500
}));
// Create category buttons
var buttonTypes = [{
type: "classes",
color: 0xFF6B6B
}, {
type: "activities",
color: 0x4ECDC4
}, {
type: "tasks",
color: 0xFFE66D
}, {
type: "others",
color: 0xA8E6CF
}];
for (var i = 0; i < buttonTypes.length; i++) {
var button = game.addChild(new CategoryButton(buttonTypes[i].type, buttonTypes[i].color));
button.x = 300 + i * 420;
button.y = 200;
categoryButtons.push(button);
}
// Select first category by default
categoryButtons[0].select();
// Create input panel
var inputPanel = game.addChild(LK.getAsset('inputPanel', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 350
}));
// Create day columns for calendar
var days = ["MON", "TUE", "WED", "THU", "FRI"];
var dayColumns = [];
for (var d = 0; d < days.length; d++) {
var dayColumn = game.addChild(LK.getAsset('dayColumn', {
anchorX: 0.5,
anchorY: 0,
x: 300 + d * 300,
y: 800
}));
var dayLabel = new Text2(days[d], {
size: 28,
fill: 0x333333
});
dayLabel.anchor.set(0.5, 0.5);
dayLabel.x = dayColumn.width / 2;
dayLabel.y = 30;
dayColumn.addChild(dayLabel);
dayColumns.push(dayColumn);
}
// Submit button
var submitButton = game.addChild(LK.getAsset('submitButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 720
}));
var submitText = new Text2("ADD TO CALENDAR", {
size: 20,
fill: 0xFFFFFF
});
submitText.anchor.set(0.5, 0.5);
submitButton.addChild(submitText);
submitButton.down = function (x, y, obj) {
addToCalendar();
};
function updateInputPanel() {
// Clear existing input fields
for (var i = 0; i < inputFields.length; i++) {
inputFields[i].destroy();
}
inputFields = [];
var startY = 380;
var fieldHeight = 80;
if (currentCategory === "classes") {
inputFields.push(game.addChild(new InputField("Course Name", "Enter course name")));
inputFields.push(game.addChild(new InputField("Time", "Select time")));
inputFields.push(game.addChild(new InputField("Duration", "Select duration")));
} else if (currentCategory === "activities") {
inputFields.push(game.addChild(new InputField("Select Class", "Choose from classes")));
inputFields.push(game.addChild(new InputField("Estimated Time", "Enter time needed")));
inputFields.push(game.addChild(new InputField("Action", "Describe activity")));
} else if (currentCategory === "tasks") {
inputFields.push(game.addChild(new InputField("Location", "Enter location")));
inputFields.push(game.addChild(new InputField("Time", "Select time")));
inputFields.push(game.addChild(new InputField("Date", "Select date")));
} else if (currentCategory === "others") {
inputFields.push(game.addChild(new InputField("Activity Name", "Enter activity name")));
inputFields.push(game.addChild(new InputField("Location", "Enter location")));
inputFields.push(game.addChild(new InputField("Time", "Select time")));
inputFields.push(game.addChild(new InputField("Date", "Select date")));
}
// Position input fields
for (var i = 0; i < inputFields.length; i++) {
inputFields[i].x = 200 + i % 2 * 600;
inputFields[i].y = startY + Math.floor(i / 2) * fieldHeight;
}
}
function addToCalendar() {
if (inputFields.length === 0) return;
var entryData = {};
var color = 0xFF6B6B;
// Get color for category
for (var i = 0; i < buttonTypes.length; i++) {
if (buttonTypes[i].type === currentCategory) {
color = buttonTypes[i].color;
break;
}
}
// Collect input data
if (currentCategory === "classes") {
entryData.course = inputFields[0].value || "New Course";
entryData.time = inputFields[1].value || "9:00 AM";
entryData.duration = inputFields[2].value || "1 hour";
entryData.type = "class";
// Add to class list for activities
classList.push(entryData);
} else if (currentCategory === "activities") {
entryData["class"] = inputFields[0].value || "Math 101";
entryData.estimatedTime = inputFields[1].value || "30 min";
entryData.action = inputFields[2].value || "Study";
entryData.type = "activity";
entryData.name = entryData.action + " - " + entryData["class"];
} else if (currentCategory === "tasks") {
entryData.location = inputFields[0].value || "Library";
entryData.time = inputFields[1].value || "2:00 PM";
entryData.date = inputFields[2].value || "Monday";
entryData.type = "task";
entryData.name = "Task at " + entryData.location;
} else if (currentCategory === "others") {
entryData.activity = inputFields[0].value || "Custom Activity";
entryData.location = inputFields[1].value || "Room 101";
entryData.time = inputFields[2].value || "3:00 PM";
entryData.date = inputFields[3].value || "Tuesday";
entryData.type = "other";
entryData.name = entryData.activity;
}
// Add to calendar display
var dayIndex = 0;
if (entryData.date) {
var dayMap = {
"Monday": 0,
"Tuesday": 1,
"Wednesday": 2,
"Thursday": 3,
"Friday": 4
};
dayIndex = dayMap[entryData.date] || 0;
}
var entry = new CalendarEntry(entryData, color);
var targetColumn = dayColumns[dayIndex];
// Position entry in day column
var entriesInDay = 0;
for (var i = 0; i < calendarEntries.length; i++) {
if (calendarEntries[i].dayIndex === dayIndex) {
entriesInDay++;
}
}
entry.x = targetColumn.x - targetColumn.width / 2 + 10;
entry.y = targetColumn.y + 60 + entriesInDay * 90;
entry.dayIndex = dayIndex;
game.addChild(entry);
calendarEntries.push(entry);
// Clear input fields
for (var i = 0; i < inputFields.length; i++) {
inputFields[i].setValue("");
}
// Visual feedback
tween(entry, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
onFinish: function onFinish() {
tween(entry, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
}
});
LK.setScore(LK.getScore() + 1);
}
// Initialize input panel
updateInputPanel();
game.update = function () {
// Update game logic here if needed
}; ===================================================================
--- original.js
+++ change.js
@@ -98,9 +98,9 @@
self.isActive = false;
self.setValue = function (value) {
self.value = value;
placeholderText.setText(value || placeholder);
- placeholderText.style.fill = value ? "#000000" : "#999999";
+ placeholderText.tint = value ? 0x000000 : 0x999999;
};
self.down = function (x, y, obj) {
// Simple input simulation - cycle through common values
if (label === "Time") {