storybook

This commit is contained in:
Kyle
2020-06-14 12:29:39 -07:00
parent 21658e546b
commit 101072267e
15 changed files with 36 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -414,7 +414,7 @@ function writeText(textObjectList, targetContext) {
textParagraphCanvas.height = scaleY(textObjectList[i].height) + 2 * textCanvasBuffer textParagraphCanvas.height = scaleY(textObjectList[i].height) + 2 * textCanvasBuffer
textLineContext.clearRect(0, 0, textLineCanvas.width, textLineCanvas.height) textLineContext.clearRect(0, 0, textLineCanvas.width, textLineCanvas.height)
textParagraphContext.clearRect(0, 0, textParagraphCanvas.width, textParagraphCanvas.height) textParagraphContext.clearRect(0, 0, textParagraphCanvas.width, textParagraphCanvas.height)
var outline, shadow = 0, oneLine = false, outlineThickness = 2, textAlign = 'left', finishLine = false, paragraphSpace = 0, permanentLineShift = 0, temporaryLineShift = 0, fontStyle = '' var outline, shadow = 0, oneLine = false, outlineThickness = 2, textAlign = 'left', finishLine = false, paragraphSpace = 0, permanentLineShift = 0, temporaryLineShift = 0, fontStyle = '', manaCost = false, canWriteText = true
textObjectList[i].otherParameters.forEach(item => eval(item)) textObjectList[i].otherParameters.forEach(item => eval(item))
textLineContext.strokeStyle = outline textLineContext.strokeStyle = outline
textLineContext.lineWidth = outlineThickness textLineContext.lineWidth = outlineThickness
@@ -425,6 +425,10 @@ function writeText(textObjectList, targetContext) {
var textY = 0 var textY = 0
var currentLineWidth = 0 var currentLineWidth = 0
var splitText = textObjectList[i].text.replace(/\n/g, '{line}').replace(/{/g, 'fh48a3h2{').replace(/}/g, '}fh48a3h2').replace(/ /g, 'fh48a3h2 fh48a3h2').split('fh48a3h2') var splitText = textObjectList[i].text.replace(/\n/g, '{line}').replace(/{/g, 'fh48a3h2{').replace(/}/g, '}fh48a3h2').replace(/ /g, 'fh48a3h2 fh48a3h2').split('fh48a3h2')
if (manaCost) {
splitText = '{' + textObjectList[i].text.replace(/\n/g, '').replace(/{/g, ' ').replace(/}/g, ' ').replace(/ /g, '}fh48a3h2{right4}fh48a3h2{') + '}'
splitText = splitText.split('fh48a3h2')
}
splitText.push('') splitText.push('')
innerloop: innerloop:
for (var n = 0; n < splitText.length; n++) { for (var n = 0; n < splitText.length; n++) {
@@ -510,6 +514,12 @@ function writeText(textObjectList, targetContext) {
} else if (manaSymbolCodeList.includes(possibleCodeLower.split('/').join(''))) { } else if (manaSymbolCodeList.includes(possibleCodeLower.split('/').join(''))) {
//THIS HAS TO BE THE LAST ONE //THIS HAS TO BE THE LAST ONE
var manaSymbolDiameter = textSize * 0.77 var manaSymbolDiameter = textSize * 0.77
if (manaCost) {
var shadowOffset = eval(manaCostShadowOffset)
textLineContext.beginPath()
textLineContext.arc(textX + manaSymbolDiameter / 2 + shadowOffset[0], textCanvasBuffer + textSize - manaSymbolDiameter * 0.45 + shadowOffset[1], manaSymbolDiameter / 2, 0, 2 * Math.PI)
textLineContext.fill()
}
textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(possibleCodeLower.split('/').join(''))], textX, textCanvasBuffer + textSize - manaSymbolDiameter * 0.95, manaSymbolDiameter, manaSymbolDiameter) textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(possibleCodeLower.split('/').join(''))], textX, textCanvasBuffer + textSize - manaSymbolDiameter * 0.95, manaSymbolDiameter, manaSymbolDiameter)
currentLineWidth += manaSymbolDiameter * 1.02 currentLineWidth += manaSymbolDiameter * 1.02
textX += manaSymbolDiameter * 1.02 textX += manaSymbolDiameter * 1.02
@@ -519,6 +529,9 @@ function writeText(textObjectList, targetContext) {
} else { } else {
wordToWrite = splitText[n] wordToWrite = splitText[n]
} }
if (!canWriteText) {
wordToWrite = ''
}
if (wordToWrite != '' || n == splitText.length - 1 || finishLine) { if (wordToWrite != '' || n == splitText.length - 1 || finishLine) {
var currentWordWidth = textLineContext.measureText(wordToWrite).width var currentWordWidth = textLineContext.measureText(wordToWrite).width
if (currentWordWidth + currentLineWidth > scaleX(textObjectList[i].width) || n == splitText.length - 1 || finishLine) { if (currentWordWidth + currentLineWidth > scaleX(textObjectList[i].width) || n == splitText.length - 1 || finishLine) {

View File

@@ -6,7 +6,13 @@ if (!loadedVersions.includes('storybookRegular')) {
['Black Frame', 'data/images/storybook/storybookFrameB.png', 0, 0, 1, 1, ['Full']], ['Black Frame', 'data/images/storybook/storybookFrameB.png', 0, 0, 1, 1, ['Full']],
['Red Frame', 'data/images/storybook/storybookFrameR.png', 0, 0, 1, 1, ['Full']], ['Red Frame', 'data/images/storybook/storybookFrameR.png', 0, 0, 1, 1, ['Full']],
['Green Frame', 'data/images/storybook/storybookFrameG.png', 0, 0, 1, 1, ['Full']], ['Green Frame', 'data/images/storybook/storybookFrameG.png', 0, 0, 1, 1, ['Full']],
['Colorless Frame', 'data/images/storybook/storybookFrameC.png', 0, 0, 1, 1, ['Full']] ['Colorless Frame', 'data/images/storybook/storybookFrameC.png', 0, 0, 1, 1, ['Full']],
['White Power/Toughness', 'data/images/storybook/storybookPTW.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']],
['Blue Power/Toughness', 'data/images/storybook/storybookPTU.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']],
['Black Power/Toughness', 'data/images/storybook/storybookPTB.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']],
['Red Power/Toughness', 'data/images/storybook/storybookPTR.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']],
['Green Power/Toughness', 'data/images/storybook/storybookPTG.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']],
['Colorless Power/Toughness', 'data/images/storybook/storybookPTC.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']]
], 'frameClassStorybookRegular') ], 'frameClassStorybookRegular')
} }

View File

@@ -2,17 +2,21 @@
if (!loadedVersions.includes('storybook')) { if (!loadedVersions.includes('storybook')) {
loadedVersions.push('storybook') loadedVersions.push('storybook')
// loadMaskImages([['Storybook Right Half', 'data/images/storybook/maskStorybookRightHalf.png']]) // loadMaskImages([['Storybook Right Half', 'data/images/storybook/maskStorybookRightHalf.png']])
//special additional mana cost, title, and type
} }
if (currentVersion != 'storybook') { if (currentVersion != 'storybook') {
currentVersion = 'storybook' currentVersion = 'storybook'
loadTextOptions([ loadTextOptions([
new cardText('Card Title', '', 222/1500, 187/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']), new cardText('Card Title', '', 222/1500, 188/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']),
new cardText('Card Type', '', 345/1500, 1268/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']), new cardText('Card Type', '', 345/1500, 1269/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']),
new cardText('Rules Text', '', 124/1500, 1348/2100, 600/1500, 624/2100, 'mplantin', 74/2100, 'black'), new cardText('Rules Text', '', 125/1500, 1500/2100, 597/1500, 500/2100, 'mplantin', 74/2100, 'black'),
new cardText('Rules Text (Right)', '', 780/1500, 1348/2100, 600/1500, 624/2100, 'mplantin', 74/2100, 'black'), new cardText('Rules Text (Right)', '', 796/1500, 1370/2100, 570/1500, 600/2100, 'mplantin', 74/2100, 'black'),
new cardText('Power/Toughness', '', 1190/1500, 1950/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"']) new cardText('Power/Toughness', '', 1190/1500, 1957/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"']),
new cardText('Adventure Title', '', 122/1500, 1386/2100, 600/1500, 62/2100, 'belerenb', 62/2100, 'white', ['oneLine=true']),
new cardText('Adventure Type', '', 122/1500, 1480/2100, 600/1500, 62/2100, 'belerenb', 62/2100, 'white', ['oneLine=true']),
new cardText('Adventure Mana Cost', '', 122/1500, 1394/2100, 600/1500, 82/2100, 'belerenb', 82/2100, 'black', ['oneLine=true','manaCost=true','canWriteText=false','textAlign="right"'])
]) ])
artX = scaleX(50/1500) artX = scaleX(50/1500)
@@ -51,11 +55,14 @@ function bottomInfoStorybook() {
ptBoxShift = 36/2100 ptBoxShift = 36/2100
} }
} }
if (ptBoxShift == 0) {
Array.from(cardMaster.children).forEach(element => {if (element.children[2].innerHTML.includes('Power/Toughness')) {ptBoxShift = 36/2100}})
}
writeText( writeText(
[ [
{text: document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + ' {saveTextX}{artistbrush}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 97/1500, y: 2036/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, {text: document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + ' {saveTextX}{artistbrush}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 97/1500, y: 2034/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
{text: document.getElementById('inputInfoNumber').value + '{loadTextX}' + document.getElementById('inputInfoRarity').value, x: 97/1500, y: 2000/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, {text: document.getElementById('inputInfoNumber').value + '{loadTextX}' + document.getElementById('inputInfoRarity').value, x: 97/1500, y: 1998/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
{text: '{right}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 97/1500, y: 2000/2100 + ptBoxShift, width: 1306/1500, height: 35/2100, font: 'mplantin', fontSize: 35/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, {text: '{right}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 97/1500, y: 1998/2100 + ptBoxShift, width: 1306/1500, height: 35/2100, font: 'mplantin', fontSize: 35/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
{text: 'NOT FOR SALE', x: 97/1500, y: 2066/2100, width: 1306/1500, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, {text: 'NOT FOR SALE', x: 97/1500, y: 2066/2100, width: 1306/1500, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
{text: '{right}CardConjurer.com', x: 97/1500, y: 2030/2100 + ptBoxShift, width: 1306/1500, height: 30/2100, font: 'mplantin', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']} {text: '{right}CardConjurer.com', x: 97/1500, y: 2030/2100 + ptBoxShift, width: 1306/1500, height: 30/2100, font: 'mplantin', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}
], bottomInfoContext) ], bottomInfoContext)