Commit fe365417 authored by techird's avatar techird

merge

parent f2d230d1
......@@ -12,6 +12,8 @@
"MinderNode",
"MinderEvent",
"require",
"km"
"km",
"console",
"Command"
]
}
\ No newline at end of file
var mindermoduleDefaultTest = function(){
console.log("test loaded");
var stroredData="stored";
var TestCommand = kity.createClass({
});
TestCommand.queryState = function() {};
return {
"commands": {
//todo:command字典,name-action 键值对模式编写
"testCommand":kity.createClass("testCommand",{
base:Command,
"execute":function(km,arg1,arg2,arg3){
console.log(arg1,arg2,arg3);
}
......
......@@ -29,10 +29,10 @@ var Command = kity.createClass( "Command", {
}
});
Command.queryState: function(km) {
Command.queryState = function(km) {
return 0;
}
Command.queryValue: function(km) {
Command.queryValue = function(km) {
return 0;
}
\ No newline at end of file
......@@ -40,22 +40,25 @@ kity.extendClass(KityMinder, {
_modules[key].call(me);
console.log(moduleDeals);
moduleDeals["ready"]&&moduleDeals["ready"].call(this);
if(moduleDeals.ready)
{
moduleDeals.ready.call(me);
}
//command加入命令池子
var moduleDealsCommands = moduleDeals["commands"];
var moduleDealsCommands = moduleDeals.commands;
if(moduleDealsCommands){
for(var _key in moduleDealsCommands){
me.commands[_key] = moduleDealsCommands[_key];
for(var _keyC in moduleDealsCommands){
me.commands[_keyC] = moduleDealsCommands[_keyC];
}
}
//绑定事件
var moduleDealsEvents = moduleDeals["events"];
var moduleDealsEvents = moduleDeals.events;
if(moduleDealsEvents){
for(var _key in moduleDealsEvents){
var bindEvs = _key.split(" ");
var func = moduleDealsEvents[_key];
for(var _keyE in moduleDealsEvents){
var bindEvs = _keyE.split(" ");
var func = moduleDealsEvents[_keyE];
for (var _i = 0; _i < bindEvs.length; _i++){
me.on(bindEvs[_i],func);
}
......@@ -223,17 +226,20 @@ kity.extendClass(KityMinder, {
var _action = new this.commands[name]();
console.log(_action);
var args = arguments;
arguments[0] = this;
_action["execute"]&&_action["execute"].apply(null,args);
args[0] = this;
if(_action.execute){
_action.execute.apply(null,args);
}
this.actions.push(_action);
},
queryCommandState: function( name ) {
this.commands[name].queryState(this);
console.log(this.commands[name]);
(this.commands[name].queryState||Command.queryState)(this);
},
queryCommandValue: function( name ) {
this.commands[name].queryValue(this);
(this.commands[name].queryValue||Command.queryValue)(this);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment