This commit is contained in:
Kyle
2019-12-26 15:27:42 -08:00
parent 8df3d4028a
commit 35df768865
2 changed files with 35 additions and 19 deletions

View File

@@ -499,13 +499,13 @@ CanvasRenderingContext2D.prototype.writeText = function(text = "", textX = 0, te
lineContext.font = textSize + "px " + textFont lineContext.font = textSize + "px " + textFont
lineContext.fillStyle = textColor lineContext.fillStyle = textColor
var otherParameters = other.split(",") var otherParameters = other.split(",")
var outline, shadow = 0, oneLine = false, outlineWidth = 2, textAlign = "left", verticalAlign = true, lineSpace = 1 var outline, shadow = 0, oneLine = false, outlineWidth = 2, textAlign = "left", verticalAlign = true, lineSpace = 1, userHorizontalShift = 0
for (var i = 0; i < otherParameters.length; i ++) { for (var i = 0; i < otherParameters.length; i ++) {
eval(otherParameters[i]) eval(otherParameters[i])
} }
lineContext.strokeStyle = outline lineContext.strokeStyle = outline
lineContext.lineWidth = outlineWidth lineContext.lineWidth = outlineWidth
var currentLineX = textCanvasesPadding var currentLineX = textCanvasesPadding + userHorizontalShift
var currentLineY = textY + (textSize * 0.45) //+ textCanvasesPadding var currentLineY = textY + (textSize * 0.45) //+ textCanvasesPadding
var uniqueSplitter = "9dn57gwbt4sh" var uniqueSplitter = "9dn57gwbt4sh"
var splitString = text.replace(/\n/g, "{line}").replace(/ /g, uniqueSplitter + " " + uniqueSplitter).replace(/{/g, uniqueSplitter + "{").replace(/}/g, "}" + uniqueSplitter).split(uniqueSplitter) var splitString = text.replace(/\n/g, "{line}").replace(/ /g, uniqueSplitter + " " + uniqueSplitter).replace(/{/g, uniqueSplitter + "{").replace(/}/g, "}" + uniqueSplitter).split(uniqueSplitter)
@@ -551,9 +551,11 @@ CanvasRenderingContext2D.prototype.writeText = function(text = "", textX = 0, te
} else if (possibleCodeLower.includes("down")) { } else if (possibleCodeLower.includes("down")) {
currentLineY += (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length))) currentLineY += (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length)))
} else if (possibleCodeLower.includes("left")) { } else if (possibleCodeLower.includes("left")) {
currentLineX -= (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length))) userHorizontalShift -= (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length)));
currentLineX -= (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length)));
} else if (possibleCodeLower.includes("right")) { } else if (possibleCodeLower.includes("right")) {
currentLineX += (parseInt(possibleCodeLower.slice(5, possibleCodeLower.length))) userHorizontalShift += (parseInt(possibleCodeLower.slice(5, possibleCodeLower.length)));
currentLineX += (parseInt(possibleCodeLower.slice(5, possibleCodeLower.length)));
} else if (possibleCodeLower == "artistbrush") { } else if (possibleCodeLower == "artistbrush") {
var artistBrushWidth = textSize * 1.2 var artistBrushWidth = textSize * 1.2
lineContext.drawImage(manaSymbolImageList[62], currentLineX, currentLineY - artistBrushWidth * 0.58, artistBrushWidth, artistBrushWidth * 13 / 21) lineContext.drawImage(manaSymbolImageList[62], currentLineX, currentLineY - artistBrushWidth * 0.58, artistBrushWidth, artistBrushWidth * 13 / 21)
@@ -606,7 +608,7 @@ CanvasRenderingContext2D.prototype.writeText = function(text = "", textX = 0, te
paragraphContext.drawImage(lineCanvas, 0 + alignAdjust - textCanvasesPadding, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding) paragraphContext.drawImage(lineCanvas, 0 + alignAdjust - textCanvasesPadding, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding)
lineContext.clearRect(0, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding) lineContext.clearRect(0, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding)
currentLineY += textSize * lineSpace currentLineY += textSize * lineSpace
currentLineX = textCanvasesPadding currentLineX = textCanvasesPadding + userHorizontalShift
if (wordToWrite == " ") { if (wordToWrite == " ") {
currentWordWidth = 0 currentWordWidth = 0
} }
@@ -980,15 +982,32 @@ function inputCardNameNumberTextImport(index) {
if (importCardTextResponse.includes('"loyalty":"') && version.currentVersion == "planeswalker") { if (importCardTextResponse.includes('"loyalty":"') && version.currentVersion == "planeswalker") {
importText(beforeAfter(importCardTextResponse, '"loyalty":"', '",'), "Loyalty"); importText(beforeAfter(importCardTextResponse, '"loyalty":"', '",'), "Loyalty");
var abilityList = beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D').split(/\\n/g); var abilityList = beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D').split(/\\n/g);
abilityList.push("", "", "", ""); for (var i = 0; i < abilityList.length; i++) {
importText(abilityList[0].split(/: (.+)?/)[1], "First Ability"); var stringVersion = ""
document.getElementById("inputPlaneswalker1Icon").value = abilityList[0].split(/: (.+)?/)[0]; switch(i) {
importText(abilityList[1].split(/: (.+)?/)[1], "Second Ability"); case 3:
document.getElementById("inputPlaneswalker2Icon").value = abilityList[1].split(/: (.+)?/)[0]; stringVersion = "Fourth"
importText(abilityList[2].split(/: (.+)?/)[1], "Third Ability"); break;
document.getElementById("inputPlaneswalker3Icon").value = abilityList[2].split(/: (.+)?/)[0]; case 2:
importText(abilityList[3].split(/: (.+)?/)[1], "Fourth Ability"); stringVersion = "Third"
document.getElementById("inputPlaneswalker4Icon").value = abilityList[3].split(/: (.+)?/)[0]; break;
case 1:
stringVersion = "Second"
break;
default:
stringVersion = "First"
}
if (abilityList[i].slice(0, 4).includes(":")) {
importText(abilityList[i].split(/: (.+)?/)[1], stringVersion + " Ability");
document.getElementById("inputPlaneswalker" + (i + 1) + "Icon").value = abilityList[i].split(/: (.+)?/)[0];
} else {
importText("{left24}" + abilityList[i], stringVersion + " Ability");
document.getElementById("inputPlaneswalker" + (i + 1) + "Icon").value = "";
}
if (document.getElementById("inputPlaneswalker" + (i + 1)).value < 1) {
document.getElementById("inputPlaneswalker" + (i + 1)).value = 1;
}
}
} }
document.getElementById("inputManaCost").value = beforeAfter(importCardTextResponse, '"mana_cost":"', '",'); document.getElementById("inputManaCost").value = beforeAfter(importCardTextResponse, '"mana_cost":"', '",');
document.getElementById("inputCardArtName").value = beforeAfter(importCardTextResponse, '"name":"', '",'); document.getElementById("inputCardArtName").value = beforeAfter(importCardTextResponse, '"name":"', '",');

View File

@@ -71,12 +71,13 @@ if (!version.addedPlaneswalker) {
darkToLightPlaneswalker.crossOrigin = "anonymous"; darkToLightPlaneswalker.crossOrigin = "anonymous";
darkToLightPlaneswalker.onload = function() {planeswalkerAbilities()} darkToLightPlaneswalker.onload = function() {planeswalkerAbilities()}
darkToLightPlaneswalker.src = "data/images/planeswalker/abilityLineEven.png" darkToLightPlaneswalker.src = "data/images/planeswalker/abilityLineEven.png"
setTimeout(planeswalkerAbilities, 1000);
} }
m15PlaneswalkerBottomInfo() m15PlaneswalkerBottomInfo()
finishChangingVersion("data/images/planeswalker/planeswalkerCSV.csv") finishChangingVersion("data/images/planeswalker/planeswalkerCSV.csv")
var planeswalkerAbilityLayout = [[0], [0, scale(784)], [0, scale(730), scale(863)], [0, scale(697), scale(784), scale(878)], [0, scale(100), scale(200), scale(300), scale(400)]] var planeswalkerAbilityLayout = [[0], [0, scale(784)], [0, scale(730), scale(863)], [0, scale(697), scale(784), scale(878)], [0, scale(683), scale(756), scale(830), scale(904)]]
var planeswalkerAbilityCount = 3; var planeswalkerAbilityCount = 3;
var ability1Y = 0, ability2Y = 0, ability3Y = 0, ability4Y = 0, ability5Y = cardHeight; var ability1Y = 0, ability2Y = 0, ability3Y = 0, ability4Y = 0, ability5Y = cardHeight;
//planeswalkerContext.writeText(version.textList[2][1], 64, ability1Y, 616, 0, "mplantin", 38, "black", "lineSpace=0.97"); //planeswalkerContext.writeText(version.textList[2][1], 64, ability1Y, 616, 0, "mplantin", 38, "black", "lineSpace=0.97");
@@ -165,7 +166,3 @@ function changePlaneswalkerAbilityLayout() {
} }
planeswalkerAbilities() planeswalkerAbilities()
} }