var MyClass = cc.Class.extend({
ctor:function()
{
},
init:function(){},
print:function(){cc.log("MyClass");}
});
var classNameString = 'MyClass';
var myObject = new window[classNameString]();
myObject.print();
var methodName = "FuncName";
this[methodName].apply(this, args);
function show(foo, bar) {
window.alert(foo+' '+bar);
}
function run(f) {
// use splice to get all the arguments after 'f'
var args = Array.prototype.splice.call(arguments, 1);
f.apply(null, args);
}
run(show, 'foo', 'bar');
btn.addTouchOnceEventListener(this.onClickChallenge, this, 1, "paramStr");
// ...
onClickChallenge:function(idx, str){}
//...
addTouchOnceEventListener: function(selector, target) {
this._touchEndEventSelector = selector;
this._touchEndEventListener = target;
this._params = Array.prototype.splice.call(arguments, 2);
}
// invoke
this._touchEndEventSelector.apply(this._touchEndEventListener, this._params);
var TimeTick = cc.Class.extend({
ctor:function(onUpdate, totalTimeMilliseconds){
cc.assert(onUpdate != null && totalTimeMilliseconds > 0);
this._onUpdate = onUpdate;
this._totalTime = totalTimeMilliseconds;
this._elapsedTime = 0;
},
start:function(){
var that = this;
function CountDown(){
var elapsedTime = that._elapsedTime;
var curTime = that._totalTime - elapsedTime;
cc.log("CountDown elapsedTime=" + elapsedTime + ", that._totalTime=" + that._totalTime + ", curTime=" + curTime);
if (curTime > 0){
setTimeout(CountDown,1000);
elapsedTime += 1000;
that._onUpdate(curTime - 1);
}
that._elapsedTime = elapsedTime;
}
setTimeout(CountDown,1000);
that._onUpdate(that._totalTime - that._elapsedTime);
},
_endLine:function(){}
});
// invoke
var tk = new TimeTick(this.updateTick, 10000);
tk.start();
//...
updateTick:function(curTime){
cc.log("updateTick curTime=" + curTime);
},
printf:function(){
var as=[].slice.call(arguments),fmt=as.shift(),i=0;
return fmt.replace(/%(\w)?(\d)?([dfsx])/ig,function(_,a,b,c){
var s=b?new Array(b-0+1).join(a||''):'';
if(c=='d') s+=parseInt(as[i++]);
return b?s.slice(b*-1):s;
})
},
// invoke
return this.printf("%02d",minutes) + ":" + this.printf("%02d", seconds);
var HomeView = BaseView.extend({
Init: function () {
// todo:display view
//this.setContentSize(1920,1080);
//this.setEnabled(true);
this.m_scenePanel = ccs.uiReader.widgetFromJsonFile(res.MainPanelScene_Json); // res使用的是下面定义的res
this.addChild(this.m_scenePanel);
var t = 1;
var res = ProtocolErrorCode.OK;
cc.log("res === t" + (res === t));
},
});
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; # password使用你的密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
密码不符合规则