import {PanelBaseControl} from "../Control/PanelBaseControl";
import { DispatcherManager } from "../utils/DispatcherManager";
import {GameState} from "../utils/GameState";

/*
* name;
*/
export class WordTipsPanel extends PanelBaseControl
{
    public static key:string = "WordTipsPanel";
    text_word:fairygui.GTextField;
    t1:fairygui.Transition;
    public nowword:string = "";
    constructor(){
        super( "loading","wordTips" );
    }   

    

    /****************************************** */
    private showText(): void {
        var text:Laya. Text = new Laya.Text();

        text.text = "Orientation-Portrait";
        text.color = "gray";
        text.font = "Impact";
        text.fontSize = 50;

        text.x = Laya.stage.width - text.width >> 1;
        text.y = Laya.stage.height - text.height >> 1;

        Laya.stage.addChild(text);
    }
/****************************************** */


    public showWord( word:string ):void
    {
        this.nowword = word;
        this.text_word.text = word;
        this.t1.play( Laya.Handler.create( this, this.playEndCallback ),1 );
    }

    protected onInit():void
    {
        super.onInit();
        this.t1 = this.getpanelTransition("t1");
    }

    /*************************************************** */
	private rect:Laya. Sprite;
    private createCantralRect(): void {
        this.rect = new Laya.Sprite();
        this.rect.graphics.drawRect(-100, -100, 200, 200, "gray");
        Laya.stage.addChild(this.rect);

        this.updateRectPos();
    }

    private updateRectPos(): void {
        this.rect.x = Laya.stage.width / 2;
        this.rect.y = Laya.stage.height / 2;
    }
    /*************************************************** */

    private playEndCallback():void
    {
        DispatcherManager.dispatchEvent( GameState.removeselect,this );
    }
}