

let GameController = (
    function()
    {
        var _modelMap = {};
        var _modelConsturctFun = {};

        var registerModelContruct = function(modelName,constructFun)
        {
            _modelConsturctFun[modelName] = constructFun;
        };

        // registerModelContruct('ConfigData',ConfigData);
        // registerModelContruct('BootOptionData',BootOptionData);
        // registerModelContruct('PlayerInfoModel',PlayerInfoModel);

        return {
           getModel(modelName)
           { 
               if(_modelMap[modelName])
               {
                   return _modelMap[modelName];
               }
               else
               {
                   if(_modelConsturctFun[modelName])
                   {
                       _modelMap[modelName] =  new _modelConsturctFun[modelName];
                       return  _modelMap[modelName];
                   }
                   else
                   {
                      
                   }
               }
           },
       
           destroyModel(modelName)
           {
             if(_modelMap[modelName])
             {
                _modelMap[modelName].destroy();
                delete _modelMap[modelName];
             }
           }

        };
    }
)();

export default GameController;