<commit_before>/**
 * Created by michael on 28/08/15.
 */
define([
    'gameobjects/Dialog',
    'gameobjects/ProgressDialog',
    'gameobjects/InputDialog'
],function(Dialog,ProgressDialog,InputDialog){
    function BaseState(){
        Phaser.State.call(this);

        this.app = null;
        this.filterSrc = [

            "precision mediump float;",

            "uniform float     timeN;",
            "uniform vec2      resolution;",

            "void main( void ) {",

            "vec2 normalPos = gl_FragCoord.xy / resolution.xy;",
            "float pos = (gl_FragCoord.y / resolution.y);",

            "float c = sin(pos * 400.0) * 0.4 + 0.4;",
            "c = pow(c, 0.2);",
            "c *= 0.2;",

            "float band_pos = fract(timeN * 0.1) * 3.0 - 1.0;",
            "c += clamp( (1.0 - abs(band_pos - pos) * 10.0), 0.0, 1.0) * 0.1;",

            "gl_FragColor = vec4( 0.0, c, 0.0, 1.0 );",
            "}"
        ];
    }

    BaseState.prototype = Object.create(Phaser.State.prototype);
    BaseState.prototype.constructor = BaseState;

    BaseState.prototype.init = function(){
        this.app = require('app');
        this.pd = null;
        this.ind = null;
        this.dg = null;
        this.inputEnabled = true;
        this.inputBlockCount = 0;
    };

    BaseState.prototype.createOnClick = function(object,handler){
        object.inputEnabled = true;
        if(!object.clickHandlers){
            object.clickHandlers = [];
            object.events.onInputDown.add(function(){
                object.alpha = 0.2;
                object.lastPos = {
                    x: this.input.activePointer.x,
                    y: this.input.activePointer.y
                };
            },this);
            object.events.onInputUp.add(function(){
                object.alpha = 0.5;
                if(Math.abs(this.input.activePointer.x-object.lastPos.x) <= 5 && Math.abs(this.input.activePointer.y-object.lastPos.y) <= 5){
                    for(var i=0; i<object.clickHandlers.length;i++){
                        object.clickHandlers[i].call(this);
                    }
                }
            },this);
        }

        object.clickHandlers.push(handler);
    };

    BaseState.prototype.showDialog = function(title,text,callbackOk,callbackCancel) {
        if (this.pd == null && this.ind == null && this.dg == null) {
            this.dg = new Dialog(this.app.game,this,title,text,callbackOk,callbackCancel);
        }
    };

    BaseState.prototype.closeDialog = function(){
        if(this.dg != null){
            this.dg.close();
            this.dg = null;
        }
    };

    BaseState.prototype.showProgress = function(){
        if(this.pd == null && this.ind == null && this.dg == null){
            this.pd = new ProgressDialog(this.app.game,this);
        }<commit_msg>clickhandler werden jetzt auch geblockt<commit_after>/**
 * Created by michael on 28/08/15.
 */
define([
    'gameobjects/Dialog',
    'gameobjects/ProgressDialog',
    'gameobjects/InputDialog'
],function(Dialog,ProgressDialog,InputDialog){
    function BaseState(){
        Phaser.State.call(this);

        this.app = null;
        this.filterSrc = [

            "precision mediump float;",

            "uniform float     timeN;",
            "uniform vec2      resolution;",

            "void main( void ) {",

            "vec2 normalPos = gl_FragCoord.xy / resolution.xy;",
            "float pos = (gl_FragCoord.y / resolution.y);",

            "float c = sin(pos * 400.0) * 0.4 + 0.4;",
            "c = pow(c, 0.2);",
            "c *= 0.2;",

            "float band_pos = fract(timeN * 0.1) * 3.0 - 1.0;",
            "c += clamp( (1.0 - abs(band_pos - pos) * 10.0), 0.0, 1.0) * 0.1;",

            "gl_FragColor = vec4( 0.0, c, 0.0, 1.0 );",
            "}"
        ];
    }

    BaseState.prototype = Object.create(Phaser.State.prototype);
    BaseState.prototype.constructor = BaseState;

    BaseState.prototype.init = function(){
        this.app = require('app');
        this.pd = null;
        this.ind = null;
        this.dg = null;
        this.inputEnabled = true;
        this.inputBlockCount = 0;
    };

    BaseState.prototype.createOnClick = function(object,handler){
        object.inputEnabled = true;
        if(!object.clickHandlers){
            object.clickHandlers = [];
            object.events.onInputDown.add(function(){
                object.alpha = 0.2;
                object.lastPos = {
                    x: this.input.activePointer.x,
                    y: this.input.activePointer.y
                };
            },this);
            object.events.onInputUp.add(function(){
                object.alpha = 0.5;
                if(Math.abs(this.input.activePointer.x-object.lastPos.x) <= 5 && Math.abs(this.input.activePointer.y-object.lastPos.y) <= 5 && this.isInputEnabled()){
                    for(var i=0; i<object.clickHandlers.length;i++){
                        object.clickHandlers[i].call(this);
                    }
                }
            },this);
        }

        object.clickHandlers.push(handler);
    };

    BaseState.prototype.showDialog = function(title,text,callbackOk,callbackCancel) {
        if (this.pd == null && this.ind == null && this.dg == null) {
            this.dg = new Dialog(this.app.game,this,title,text,callbackOk,callbackCancel);
        }
    };

    BaseState.prototype.closeDialog = function(){
        if(this.dg != null){
            this.dg.close();
            this.dg = null;
        }
    };

    BaseState.prototype.showProgress = function(){
        if(this.pd == null && this.ind == null && this.dg == null){
            this.pd = new ProgressDialog(this.app.game,this);
        }
{'fraction_non_alphanumeric': 0.14768962510897995, 'fraction_numerical': 0.018134263295553617, 'mean_word_length': 1.710775047258979, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1058811', 'n_tokens_mistral': 1844, 'n_tokens_neox': 1718, 'n_words': 295}