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


TypeScript SimpleText.setText方法代碼示例

本文整理匯總了TypeScript中athenajs.SimpleText.setText方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SimpleText.setText方法的具體用法?TypeScript SimpleText.setText怎麽用?TypeScript SimpleText.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在athenajs.SimpleText的用法示例。


在下文中一共展示了SimpleText.setText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: increaseScore

  /**
   * Updates the player's score using line number & current level
   *
   */
  increaseScore(lines: number) {
    this.score +=
      this.scoreTable[lines - 1] + this.level * this.scoreTable[lines - 1];
    this.lines += lines;
    this.linesString.setText("Lines: " + this.lines);
    this.scoreString.setText("Score: " + this.score);

    if (lines === 4) {
      AM.play("lines_tetris");
    } else {
      AM.play("lines");
    }
  }
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:17,代碼來源:grid.ts

示例2: reset

  reset() {
    this.score = 0;
    this.level = 0;
    this.lines = 0;
    this.timing = START_TIMING;
    this.resetMap();
    this.shape.moveToTop();

    this.shape.setRandomShape();
    this.nextShape.setRandomShape();
    this.linesString.setText("Lines: " + this.lines);
    this.scoreString.setText("Score: " + this.score);
    this.levelString.setText("Level: " + this.level);

    this.shape.movable = true;
    this.shape.behavior.reset();
  }
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:17,代碼來源:grid.ts

示例3: updateLevel

 /**
  * Updates level + level object's text
  */
 updateLevel() {
   const oldLevel = this.level;
   this.level = Math.floor(this.lines / 10);
   this.levelString.setText("Level: " + this.level);
   this.timing = START_TIMING - this.level * LEVEL_TIMING;
   this.shape.data['speed'] = this.timing;
   oldLevel !== this.level && AM.play("level");
 }
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:11,代碼來源:grid.ts

示例4: SimpleText

import { SimpleText } from 'athenajs';

const myText: SimpleText = new SimpleText('MyText', {
    text: 'yop',
    width: 100,
    height: 200,
    fontFace: 'Arial',
    fontSize: '20px',
    fontStyle: 'italic',
    fontWeight: '300',
    align: 'center',
    color: 'white'
});

myText.setSize(100, 200);
myText.setText('Hi!');
myText.setColor('rgba(0,0,0,.4');
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:17,代碼來源:simpletext.ts


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