Example #1
0
File: hud.js Project: llnek/cocos2d
  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,
      color: ccsx.white,
      pos: cc.p(csts.TILE + csts.S_OFF + 2,
                wb.top - csts.TILE - csts.S_OFF),
Example #2
0
   * @private
   */
  onCancelPlay() {
    try {
      this.wss.close();
    } catch (e) {}
    this.wss=null;
    this.options.onback();
  },
  /**
   * @method showWaitOthers
   * @private
   */
  showWaitOthers() {
    let qn= new cc.LabelBMFont(sh.l10n('%waitother'),
                               sh.getFont('font.OCR')),
    cw= ccsx.center(),
    wz= ccsx.vrect(),
    wb = ccsx.vbox(),
    menu;

    this.removeAll();

    qn.setPosition(cw.x, wb.top * 0.75);
    qn.setScale(xcfg.game.scale * 0.3);
    qn.setOpacity(0.9*255);
    this.addItem(qn);

    menu= ccsx.vmenu([
      { nnn: '#cancel.png',
        cb() {
Example #3
0
File: hud.js Project: llnek/cocos2d
   * @protected
   */
  initAtlases() {
    this.regoAtlas('game-pics');
  },
  /**
   * @method initLabels
   * @protected
   */
  initLabels() {
    const cw= ccsx.center(),
    wz = ccsx.vrect(),
    wb = ccsx.vbox();

    this.scoreLabel = ccsx.bmfLabel({
      fontPath: sh.getFont('font.SmallTypeWriting'),
      text: '0',
      anchor: ccsx.acs.TopRight,
      scale: xcfg.game.scale// * 2
    });
    this.scoreLabel.setPosition(wb.right - (csts.TILE * wz.width/480),
      wb.top - (wz.height/320 * csts.TILE));

    this.addItem(this.scoreLabel);

    this.status= ccsx.bmfLabel({
      fontPath: sh.getFont('font.CoffeeBuzzed'),
      text: '',
      scale: xcfg.game.scale * 0.5,
      pos: cc.p(cw.x * 1.5, cw.y)
    });
Example #4
0
xcfg = sh.xcfg,
csts= xcfg.csts,
R= sjs.ramda,
undef,
//////////////////////////////////////////////////////////////////////////
/** * @class MainMenuLayer */
MainMenuLayer = scenes.XMenuLayer.extend({
  /**
   * @method title
   * @private
   */
  title() {
    const cw= ccsx.center(),
    wb=ccsx.vbox(),
    tt=ccsx.bmfLabel({
      fontPath: sh.getFont('font.JellyBelly'),
      text: sh.l10n('%mmenu'),
      pos: cc.p(cw.x, wb.top * 0.9),
      color: cc.color(246,177,127),
      scale: xcfg.game.scale
    });
    this.addItem(tt);
  },
  btns() {
    const cw = ccsx.center(),
    wb = ccsx.vbox(),
    menu= ccsx.vmenu([{
      nnn: '#player1.png',
      target: this,
      cb() {
          this.onplay({ mode: sh.gtypes.P1_GAME});