| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import LogicUnitManager from './LogicUnitManager'
- import DataModelManager from 'DataModelManager'
- import GameProcessManager from '../net/GameProcessManager'
- import PlayerInfoModel from '../model/PlayerInfoModel';
- cc.Class({
- extends: cc.Component,
- properties: {
- },
- ctor: function () {
- // behavior
- this._behaviorEventIDMap = {};
- this.lum = LogicUnitManager;
- this._behaviorEvent_index = 0;
-
- // data model
- this._dataEventIDMap = {};
- this.dmm = DataModelManager;
- this._dataEvent_index = 0;
-
- },
- onBehaviorEvent(behaviorName,eventName,callbackFun)
- {
- let behavior = this.lum.getBehavior(behaviorName);
- if(behavior)
- {
- let eventId = behavior.on(eventName,callbackFun,this);
- this._behaviorEventIDMap[this._behaviorEvent_index++] = {'behavior':behavior,'id':eventId};
- }
- },
- onDataModelChange(modelName,attributename,callbackFun)
- {
- let model = this.dmm.getModel(modelName);
- if(model && typeof model.on !== 'undefined')
- {
- let eventId = model.on(attributename,callbackFun,this);
- this._dataEventIDMap[this._dataEvent_index++] = {'m':model,'id':eventId};
- }
- },
- onLoad () {
- },
- start () {
- },
-
- onDestroy()
- {
- // behavior destroy
- for(let val in this._behaviorEventIDMap)
- {
- let eid = this._behaviorEventIDMap[val]['id'];
- let behavior = this._behaviorEventIDMap[val]['behavior'];
- if(behavior)
- {
- behavior.off(eid);
- }
- }
- // data model destroy
- for(let val in this._dataEventIDMap)
- {
- let m = this._dataEventIDMap[val]['m'],eid = this._dataEventIDMap[val]['id'];
- if(m)
- {
- m.off(eid);
- }
-
- }
- },
- playShow(callbackFun)
- {
- this.node.opacity=0;
- this.node.runAction(cc.fadeIn(1.0));
- },
- playEnd(nextSence)
- {
- var callbackFun = null
- if (nextSence) {
- callbackFun = function(){
- cc.director.loadScene(nextSence)
- };
- }
- this.node.runAction(cc.sequence(cc.fadeOut(1.0),cc.callFunc(callbackFun)));
- }
-
- });
|