mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 06:34:13 +00:00
fix: update data to 1.21.4
This commit is contained in:
parent
a5bea3b585
commit
e4719200d3
19 changed files with 3281 additions and 300 deletions
|
|
@ -6,10 +6,12 @@ interface Context {
|
|||
blocks: Block[];
|
||||
coords: Position;
|
||||
scale: number;
|
||||
version: number;
|
||||
setStageSize: React.Dispatch<React.SetStateAction<Dimension>>;
|
||||
setBlocks: React.Dispatch<React.SetStateAction<Block[]>>;
|
||||
setCoords: React.Dispatch<React.SetStateAction<Position>>;
|
||||
setScale: React.Dispatch<React.SetStateAction<number>>;
|
||||
setVersion: React.Dispatch<React.SetStateAction<number>>;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
|
@ -23,6 +25,7 @@ export const CanvasProvider = ({ children }: Props) => {
|
|||
const [blocks, setBlocks] = useState<Block[]>([]);
|
||||
const [coords, setCoords] = useState<Position>({ x: 0, y: 0 });
|
||||
const [scale, setScale] = useState(1);
|
||||
const [version, setVersion] = useState(1200);
|
||||
|
||||
const canvasSize = useMemo(() => {
|
||||
let minX = Infinity,
|
||||
|
|
@ -46,7 +49,9 @@ export const CanvasProvider = ({ children }: Props) => {
|
|||
}, [blocks]);
|
||||
|
||||
return (
|
||||
<CanvasContext.Provider value={{ stageSize, canvasSize, blocks, coords, scale, setStageSize, setBlocks, setCoords, setScale }}>
|
||||
<CanvasContext.Provider
|
||||
value={{ stageSize, canvasSize, blocks, coords, scale, version, setStageSize, setBlocks, setCoords, setScale, setVersion }}
|
||||
>
|
||||
{children}
|
||||
</CanvasContext.Provider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import * as PIXI from "pixi.js";
|
|||
|
||||
import { LoadingContext } from "./Loading";
|
||||
|
||||
import spritesheet from "@/data/blocks/programmer-art/spritesheet.json";
|
||||
import _blockData from "@/data/blocks/programmer-art/data.json";
|
||||
import spritesheet from "@/data/blocks/spritesheet.json";
|
||||
import _blockData from "@/data/blocks/data.json";
|
||||
const blockData: BlockData = _blockData;
|
||||
|
||||
interface Context {
|
||||
|
|
@ -34,7 +34,7 @@ export const TexturesProvider = ({ children }: Props) => {
|
|||
setMissingTexture(new PIXI.Texture(baseTexture));
|
||||
|
||||
// Load textures
|
||||
const sheet = new PIXI.Spritesheet(PIXI.BaseTexture.from("/blocks/programmer-art/spritesheet.png"), spritesheet);
|
||||
const sheet = new PIXI.Spritesheet(PIXI.BaseTexture.from("/blocks/spritesheet.png"), spritesheet);
|
||||
sheet.parse().then((t) => {
|
||||
setTextures(t);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue