本文整理汇总了TypeScript中ekkiog-editing.drawWire函数的典型用法代码示例。如果您正苦于以下问题:TypeScript drawWire函数的具体用法?TypeScript drawWire怎么用?TypeScript drawWire使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawWire函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: drawUnderpassWithWires
function drawUnderpassWithWires(forest : Forest, x : number, y : number){
const forest1 = drawUnderpass(forest, x, y);
if(forest === forest1){
return forest;
}
const forest2 = drawWire(forest1, x, y-1);
const forest3 = drawWire(forest2, x, y+1);
const forest4 = drawWire(forest3, x-1, y);
const forest5 = drawWire(forest4, x+1, y);
return forest5;
}
示例2: tap
export function tap(forest : Forest, tool : Tool, direction : Direction, x : number, y : number) : Forest {
if(tool === WIRE){
const type = getTypeAt(forest.enneaTree, x, y);
if(type === WIRE || type === UNDERPASS){
return clear(forest, x, y);
}else{
return drawWire(forest, x, y);
}
}else if(tool === UNDERPASS){
const type = getTypeAt(forest.enneaTree, x, y);
if(type === UNDERPASS || type === WIRE){
return clear(forest, x, y);
}else{
return drawUnderpassWithWires(forest, x, y);
}
}else if(tool === GATE){
return drawGate(forest, x, y);
}else if(tool === BUTTON){
return drawButton(forest, x, y, direction);
}else if(tool === LIGHT){
return drawLight(forest, x, y, direction);
}else{
return forest;
}
}
示例3: underpassToWire
function underpassToWire(forest : Forest, x : number, y : number){
const type = getTypeAt(forest.enneaTree, x, y);
if(type !== UNDERPASS) return forest;
const tempForest = clear(forest, x, y);
const result = drawWire(tempForest, x, y);
if(result === tempForest) return forest;
return result;
}
示例4: drawItem
function drawItem(forest : Forest, item : Item, x : number, y : number) : Forest {
switch(item.type){
case WIRE:
return drawWire(forest, x, y);
case UNDERPASS:
return drawUnderpass(forest, x, y);
case LIGHT:
return drawLight(forest, x+1, y+1, item.direction);
case BUTTON:
return drawButton(forest, x+1, y+1, item.direction);
case GATE:
return drawGate(forest, x+3, y+1);
case COMPONENT:
return drawComponent(forest, x+(item.package.width>>1), y+(item.package.height>>1), item.package);
default:
return forest;
}
}
示例5: and
export default function and(){
let forest = createForest();
forest = drawButton(forest, 58, 62);
forest = drawWire(forest, 60, 62);
forest = drawWire(forest, 60, 63);
forest = drawButton(forest, 58, 66);
forest = drawWire(forest, 60, 66);
forest = drawWire(forest, 60, 65);
forest = drawGate(forest, 64, 64);
forest = drawWire(forest, 65, 63);
forest = drawWire(forest, 65, 64);
forest = drawWire(forest, 65, 65);
forest = drawGate(forest, 69, 64);
forest = drawLight(forest, 71, 64);
return forest;
}
示例6: xor
export default function xor(){
let forest = createForest();
forest = drawButton(forest, 58, 62);
forest = drawButton(forest, 58, 66);
forest = drawWire(forest, 60, 63);
forest = drawWire(forest, 60, 62);
forest = drawWire(forest, 60, 61);
forest = drawWire(forest, 61, 61);
forest = drawWire(forest, 62, 61);
forest = drawWire(forest, 63, 61);
forest = drawWire(forest, 64, 61);
forest = drawWire(forest, 65, 61);
forest = drawWire(forest, 60, 65);
forest = drawWire(forest, 60, 66);
forest = drawWire(forest, 60, 67);
forest = drawWire(forest, 61, 67);
forest = drawWire(forest, 62, 67);
forest = drawWire(forest, 63, 67);
forest = drawWire(forest, 64, 67);
forest = drawWire(forest, 65, 67);
forest = drawGate(forest, 64, 64);
forest = drawWire(forest, 65, 63);
forest = drawWire(forest, 65, 64);
forest = drawWire(forest, 65, 65);
forest = drawGate(forest, 69, 62);
forest = drawGate(forest, 69, 66);
forest = drawWire(forest, 70, 62);
forest = drawWire(forest ,70, 63);
forest = drawWire(forest, 70, 65);
forest = drawWire(forest ,70, 66);
forest = drawGate(forest, 74, 64);
forest = drawLight(forest, 76, 64);
return forest;
}