(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/ShaderController.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'bc87dQx+bpGMqqF6PZDvR6K', 'ShaderController', __filename);
// Script/ShaderController.ts

Object.defineProperty(exports, "__esModule", { value: true });
var ShaderComponent_1 = require("./ShaderComponent");
var ShaderManager_1 = require("./ShaderManager");
// Learn TypeScript:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var ShaderController = /** @class */ (function (_super) {
    __extends(ShaderController, _super);
    function ShaderController() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.shaderArray = [];
        return _this;
        // update (dt) {}
    }
    ShaderController_1 = ShaderController;
    // LIFE-CYCLE CALLBACKS:
    ShaderController.prototype.onLoad = function () {
        ShaderController_1.instance = this;
    };
    ShaderController.prototype.setToGrayByName = function (name) {
        this.shaderArray.forEach(function (item) {
            if (item.shaderObjectName == name) {
                item.applyShader(ShaderManager_1.ShaderType.Gray);
                console.log("shaderObject finded.");
                return;
            }
        });
    };
    ShaderController.prototype.setToNormalByName = function (name) {
        this.shaderArray.forEach(function (item) {
            if (item.shaderObjectName == name) {
                item.applyShader(ShaderManager_1.ShaderType.Normal);
                console.log("shaderObject finded.");
                return;
            }
        });
    };
    ShaderController.prototype.setToGray = function (target, index) {
        this.setToGrayByName(index);
    };
    ShaderController.prototype.setToNormal = function (target, index) {
        this.setToNormalByName(index);
    };
    var ShaderController_1;
    ShaderController.instance = null;
    __decorate([
        property(ShaderComponent_1.default)
    ], ShaderController.prototype, "shaderArray", void 0);
    ShaderController = ShaderController_1 = __decorate([
        ccclass
    ], ShaderController);
    return ShaderController;
}(cc.Component));
exports.default = ShaderController;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=ShaderController.js.map
        