Skip to content

Commit

Permalink
Merge pull request #6 from lezzthanthree/birthdays
Browse files Browse the repository at this point in the history
Birthdays
  • Loading branch information
lezzthanthree authored Aug 3, 2024
2 parents 493fab1 + cee5bc5 commit 8947e17
Show file tree
Hide file tree
Showing 93 changed files with 481 additions and 43 deletions.
Binary file added public/img/birthday/19ddpk_3109988.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/1u65my_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/2k78ul_2639148.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/2v67sa_2626845.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/2yvdye_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/3fmj4u_1826453.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/3r4ho1_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/4x4rrf_1731077.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/5986tc_1229773.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/6hf7xv_273724.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/6s5aa3_4798383.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/72bmoy_3931599.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/7pixio_4144001.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/7vbehk_577227.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/82pzbw_2019919.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/8qsop5_2163709.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/9gxqqj_2302352.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/9rnh2s_769473.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/a27wrn_1152847.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/a27wrn_2047952.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/a65x4b_1554082.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/bxkrz6_559653.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/c6sdm7_1600440.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/cgnmtq_2326727.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/crzqhk_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/birthday/crzqhk_892149.jpg
Binary file added public/img/birthday/cvryj5_567869.jpg
Binary file added public/img/birthday/ddx52m_475775.jpg
Binary file added public/img/birthday/dj5s37_1470871.jpg
Binary file added public/img/birthday/do7hz4_947570.jpg
Binary file added public/img/birthday/dsbdab_650590.jpg
Binary file added public/img/birthday/dtzymy_2392145.jpg
Binary file added public/img/birthday/dy69qh_516868.jpg
Binary file added public/img/birthday/dy7enq_290059.jpg
Binary file added public/img/birthday/e5dc0f_0.jpg
Binary file added public/img/birthday/e657b5_1773158.jpg
Binary file added public/img/birthday/ed84ca_0.jpg
Binary file added public/img/birthday/ed84ca_846550.jpg
Binary file added public/img/birthday/eqtmqm_3534609.jpg
Binary file added public/img/birthday/fuzlc1_596076.jpg
Binary file added public/img/birthday/gifqd6_0.jpg
Binary file added public/img/birthday/gtfs1c_2655862.jpg
Binary file added public/img/birthday/hax5hu_2212733.jpg
Binary file added public/img/birthday/hhf2ad_3520218.jpg
Binary file added public/img/birthday/i571bi_304583.jpg
Binary file added public/img/birthday/ik9ocr_7154864.jpg
Binary file added public/img/birthday/isusor_5131924.jpg
Binary file added public/img/birthday/ixmw9d_3451958.jpg
Binary file added public/img/birthday/ixmw9d_4394634.jpg
Binary file added public/img/birthday/j6hzg4_5296465.jpg
Binary file added public/img/birthday/j6hzg4_5842262.jpg
Binary file added public/img/birthday/j95qvv_1662002.jpg
Binary file added public/img/birthday/jpghb8_2232189.jpg
Binary file added public/img/birthday/jt3htc_1191013.jpg
Binary file added public/img/birthday/jxgykd_1083172.jpg
Binary file added public/img/birthday/kcmcbe_597315.jpg
Binary file added public/img/birthday/kpcssz_870204.jpg
Binary file added public/img/birthday/kq0vk6_1520420.jpg
Binary file added public/img/birthday/kztbbm_416320.jpg
Binary file added public/img/birthday/lrq6k2_768932.jpg
Binary file added public/img/birthday/m3uwyu_260231.jpg
Binary file added public/img/birthday/mikpxc_1726002.jpg
Binary file added public/img/birthday/mxbjz5_3309196.jpg
Binary file added public/img/birthday/n2alem_603783.jpg
Binary file added public/img/birthday/oa4ovd_2630311.jpg
Binary file added public/img/birthday/ojvgm2_877137.jpg
Binary file added public/img/birthday/onw7ly_2863579.jpg
Binary file added public/img/birthday/op3hqp_0.jpg
Binary file added public/img/birthday/ou9aka_2955428.jpg
Binary file added public/img/birthday/p45j5w_864013.jpg
Binary file added public/img/birthday/py6gl8_840665.jpg
Binary file added public/img/birthday/qtj2nn_308059.jpg
Binary file added public/img/birthday/rl2iln_262972.jpg
Binary file added public/img/birthday/s34p99_4992869.jpg
Binary file added public/img/birthday/si6skp_548848.jpg
Binary file added public/img/birthday/sl710e_1276677.jpg
Binary file added public/img/birthday/t5jyh1_3020623.jpg
Binary file added public/img/birthday/v2ks6s_0.jpg
Binary file added public/img/birthday/vnltly_545159.jpg
Binary file added public/img/birthday/vntzxu_655014.jpg
Binary file added public/img/birthday/vsmnrq_299949.jpg
Binary file added public/img/birthday/w5e5sg_1502545.jpg
Binary file added public/img/birthday/wbhkrt_0.jpg
Binary file added public/img/birthday/wbhkrt_423399.jpg
Binary file added public/img/birthday/wbhkrt_921148.jpg
Binary file added public/img/birthday/wggxi3_553629.jpg
Binary file added public/img/birthday/wpn6n6_291926.jpg
Binary file added public/img/birthday/yvgng6_3080318.jpg
Binary file added public/img/birthday/yvsfnl_3324047.jpg
Binary file added public/img/birthday/yxdwz3_903309.jpg
Binary file added public/img/birthday/zliddd_669534.jpg
59 changes: 47 additions & 12 deletions src/AppContext.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createContext, useState, useEffect } from "react";
import loadImage from "./js/loadImage";
import data from "./characters.json";
import "./css/main.css";

export const AppContext = createContext();
Expand All @@ -25,43 +26,77 @@ export const AppProvider = ({ children }) => {
sessionStorage.setItem("dictionary", {
Test: "test again",
});

const checkBirthday = () => {
const today = new Date(
Date.now() + (new Date().getTimezoneOffset() + 540) * 60 * 1000
);
console.log(today);
const characters = Object.keys(data);
console.log(characters);
for (const c in characters) {
const char = characters[c];
const birthday = data[char].information.birthday;
const [month, day] = birthday.split("-").map(Number);
console.log(month, day);
if (today.getMonth() + 1 == month && today.getDate() == day) {
return data[char].birthday;
}
}
return null;
};
useEffect(() => {
let data = checkBirthday();

if (!data) {
data = {
name: "Honoka",
id: "honoka",
tag: "μ's",
message: "kyou no pan ga umai!",
"background-src": "/img/background/6olyyw_0.jpg",
costume: "3c2bnw",
expression: {
eye: 3,
mouth: 2,
},
};
}

setSprites(null);
loadImage("/img/background/6olyyw_0.jpg")
loadImage(data["background-src"])
.then((img) => setBackground(img))
.catch((error) => console.error(error));

loadImage("/img/char_icon/honoka.png")
loadImage(`/img/char_icon/${data.id}.png`)
.then((img) =>
setNameTag({
primary: "#ff79cd",
secondary: "#ffcdec",
name: "Honoka",
iconValue: "honoka",
name: data.name,
iconValue: data.id,
icon: img,
hidden: false,
})
)
.catch((error) => console.error(error));

setText({
dialogue: "kyou no pan ga umai!",
dialogue: data.message,
hidden: false,
fontSize: 35,
});

Promise.all([
loadImage("/img/sprites/honoka/3c2bnw_0.png"),
loadImage("/img/sprites/honoka/3c2bnw_1.png"),
loadImage(`/img/sprites/${data.id}/${data.costume}_0.png`),
loadImage(`/img/sprites/${data.id}/${data.costume}_1.png`),
])
.then(([bodyImage, expressionImage]) => {
setSprites({
"sprite-layer-1": {
layerName: "Layer 1: Honoka",
layerName: `Layer 1: ${data.name}`,
layerNumber: 1,
character: "honoka",
costume: "3c2bnw",
character: data.id,
costume: data.id,
position: "front",
bodyImage: bodyImage,
expressionImage: expressionImage,
Expand All @@ -70,7 +105,7 @@ export const AppProvider = ({ children }) => {
mouth: 1,
},
options: {
x: 0,
x: 540,
y: 0,
scale: 0,
hidden: false,
Expand Down
Loading

0 comments on commit 8947e17

Please sign in to comment.