Esempio n. 1
0
      sjs.loggr.debug("game over.  you lose.");
      node.blocks.grid=[];
      sh.fire('/hud/end');
    }

    return shape;
  },
  /**
   * @method previewNextShape
   * @private
   */
  previewNextShape(node, layer) {
    let info = this.randNext(),
    gbox= node.gbox,
    cw = ccsx.center(),
    wb = ccsx.vbox(),
    shape,
    sz = (1 + info.model.dim) * csts.TILE,
    x = cw.x + (wb.right - cw.x) * 0.5,
    y = wb.top * 0.7;

    x -= sz * 0.5;
    y += sz * 0.5;

    utils.disposeShape(this.nextShape);
    this.nextShape= null;
    shape= new cobjs.Shape(x,y, info);
    this.nextShapeInfo= info;
    this.nextShape= utils.previewShape(layer, shape);
  },
  /**
Esempio n. 2
0
   * Add Audio icon to UI.
   * @memberof module:zotohlab/asx/scenes~XLayer
   * @method addAudioIcon
   * @param {Object} options
   */
  addAudioIcon(options) {
    let off= new cc.MenuItemSprite(new cc.Sprite('#sound_off.png'),
                                   new cc.Sprite('#sound_off.png'),
                                   new cc.Sprite('#sound_off.png'),
                                   sjs.NILFUNC, this),
    on= new cc.MenuItemSprite(new cc.Sprite('#sound_on.png'),
                              new cc.Sprite('#sound_on.png'),
                              new cc.Sprite('#sound_on.png'),
                              sjs.NILFUNC, this),
    audio, menu,
    wb = ccsx.vbox();

    if (!!options.color) {
      off.setColor(options.color);
      on.setColor(options.color);
    }

    if (!!options.scale) {
      off.setScale(options.scale);
      on.setScale(options.scale);
    }

    audio= new cc.MenuItemToggle(on, off, (sender) => {
      if (sender.getSelectedIndex() === 0) {
        sh.toggleSfx(true);
      } else {
Esempio n. 3
0
File: hud.js Progetto: llnek/cocos2d
   * @method initScores
   * @protected
   */
  initScores() {
    this.scores= {};
    this.scores[csts.P2_COLOR] =  0;
    this.scores[csts.P1_COLOR] =  0;
  },
  /**
   * @method initLabels
   * @protected
   */
  initLabels() {
    const cw= ccsx.center(),
    c= this.color,
    wb= ccsx.vbox();

    this.title = ccsx.bmfLabel({
      fontPath: sh.getFont('font.JellyBelly'),
      text: '',
      color: c,
      anchor: ccsx.acs.Top,
      scale: xcfg.game.scale * 0.6,
      pos: cc.p(cw.x, wb.top - 2*csts.TILE)
    });
    this.addItem(this.title);

    this.score1= ccsx.bmfLabel({
      fontPath: sh.getFont('font.SmallTypeWriting'),
      text: '0',
      scale: xcfg.game.scale,
Esempio n. 4
0
  /**
   * @method onDone
   * @private
   */
  onDone() {
    this.options.running=false;
    sh.sfxCancel();
    this.reset();
    this.getHUD().enableReplay();
  },
  /**
   * @method getEnclosureBox
   * @private
   */
  getEnclosureBox() {
    const wb= ccsx.vbox();
    return {
      bottom: wb.bottom,
      left: wb.left,
      top: wb.top + 10,
      right: wb.right
    };
  },
  /**
   * @method ctor
   * @constructs
   */
  ctor(options) {
    this._super(options);
  }