mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-29 00:31:53 +08:00
create and configure callback handlers for state updates
add $.Dispatch to handle object events add subscribe calls to files update SM fireUpdate to use new Dispatch There are some NaN issues right now, no time to bug hunt right now, it does kind of function though
This commit is contained in:
+7
-7
@@ -49,6 +49,9 @@ var Path = {
|
||||
Path.outfit = {};
|
||||
|
||||
Engine.updateSlider();
|
||||
|
||||
//subscribe to stateUpdates
|
||||
$.Dispatch('stateUpdate').subscribe(Path.handleStateUpdates);
|
||||
},
|
||||
|
||||
openPath: function() {
|
||||
@@ -131,7 +134,7 @@ var Path = {
|
||||
armour = "steel";
|
||||
else if($SM.get('stores[\'i armour\']', true) > 0)
|
||||
armour = "iron";
|
||||
else if($SM.get('stores[\'l armour']', true) > 0)
|
||||
else if($SM.get('stores[\'l armour\']', true) > 0)
|
||||
armour = "leather";
|
||||
var aRow = $('#armourRow');
|
||||
if(aRow.length == 0) {
|
||||
@@ -301,11 +304,8 @@ var Path = {
|
||||
},
|
||||
|
||||
handleStateUpdates: function(e){
|
||||
if(e.stateName.indexOf('character.perks') == 0 && Engine.activeModule == Path){
|
||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') == 0 && Engine.activeModule == Path){
|
||||
Path.updatePerks();
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
//listener for StateManager update events
|
||||
$(Path).on('stateUpdate', Path.handleStateUpdates);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user