-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
108 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import BaseRender from "../base/base-render"; | ||
import {MellowShapeProvider} from "./mellow-shape-provider"; | ||
|
||
export default class MellowRender extends BaseRender{ | ||
static provider = new MellowShapeProvider(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import Block from "../../block/block.class"; | ||
import PathBuilder, {PLine} from "../../utils/path-builder"; | ||
|
||
export class MellowShapeProvider { | ||
|
||
CORNER_SIZE = 4 // 边角大小 | ||
|
||
SEAT_HEIGHT = 8 // 占位行高度 | ||
|
||
PUZZLE_LEFT = 14 // 上下拼图距左侧距离(相对图形块) | ||
PUZZLE_WIDTH = 20 // 上下拼图宽度 | ||
PUZZLE_HEIGHT = 4 // 上下拼图高度 | ||
|
||
TAB_TOP = 4 // 左右拼图距顶部距离(相对图形块) | ||
TAB_WIDTH = 6 // 左右拼图宽度 | ||
TAB_HEIGHT = 15 // 左右拼图高度 | ||
|
||
HAT_WIDTH = 56 // 帽子宽度 | ||
HAT_HEIGHT = 10 // 帽子高度 | ||
|
||
makeTopLeftCorner(reverse: boolean = false, isRect: boolean = false): PLine[]{ | ||
if(isRect){ | ||
return new PathBuilder() | ||
.verticalTo(-this.CORNER_SIZE) | ||
.horizontalTo(this.CORNER_SIZE) | ||
.getPath(reverse) | ||
}else{ | ||
return new PathBuilder() | ||
.lineTo(this.CORNER_SIZE, -this.CORNER_SIZE) | ||
.getPath(reverse) | ||
} | ||
} | ||
|
||
makeBottomLeftCorner(reverse: boolean = false, isRect: boolean = false): PLine[]{ | ||
if(isRect){ | ||
return new PathBuilder() | ||
.verticalTo(this.CORNER_SIZE) | ||
.horizontalTo(this.CORNER_SIZE) | ||
.getPath(reverse) | ||
}else{ | ||
return new PathBuilder() | ||
.lineTo(this.CORNER_SIZE, this.CORNER_SIZE) | ||
.getPath(reverse) | ||
} | ||
} | ||
|
||
makeTab(reverse: boolean = false): PLine[]{ | ||
const MR = 3 | ||
return new PathBuilder() | ||
.verticalTo(MR) | ||
.lineTo(-this.TAB_WIDTH, -MR) | ||
.verticalTo(this.TAB_HEIGHT) | ||
.lineTo(this.TAB_WIDTH, -MR) | ||
.verticalTo(MR) | ||
.getPath(reverse) | ||
} | ||
|
||
makePuzzle(reverse: boolean = false): PLine[]{ | ||
return new PathBuilder() | ||
.lineTo(this.PUZZLE_HEIGHT, this.PUZZLE_HEIGHT) | ||
.horizontalTo(this.PUZZLE_WIDTH - this.PUZZLE_HEIGHT * 2) | ||
.lineTo(this.PUZZLE_HEIGHT, -this.PUZZLE_HEIGHT) | ||
.getPath(reverse) | ||
} | ||
|
||
makeHat(reverse: boolean = false): PLine[]{ | ||
return new PathBuilder() | ||
.lineTo(this.HAT_HEIGHT, -this.HAT_HEIGHT) | ||
.horizontalTo(this.HAT_WIDTH - this.HAT_HEIGHT * 2) | ||
.lineTo(this.HAT_HEIGHT, this.HAT_HEIGHT) | ||
.getPath(reverse) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters