當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ekkiog-editing.drawWire函數代碼示例

本文整理匯總了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;
}
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:11,代碼來源:forest.ts

示例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;
  }
}
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:25,代碼來源:forest.ts

示例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;
}
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:10,代碼來源:forest.ts

示例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;
  }
}
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:18,代碼來源:selection.ts

示例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;
}
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:21,代碼來源:and.ts

示例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;
}
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:41,代碼來源:xor.ts


注:本文中的ekkiog-editing.drawWire函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。