2023-01-07 20:26:17 +01:00
|
|
|
var _utils = load('res://addons/gut/utils.gd').get_instance()
|
2022-06-02 04:13:43 +02:00
|
|
|
var _params = null
|
|
|
|
var _call_count = 0
|
|
|
|
var _logger = null
|
|
|
|
|
2023-01-07 20:26:17 +01:00
|
|
|
func _init(params=null):
|
2022-06-02 04:13:43 +02:00
|
|
|
_params = params
|
|
|
|
_logger = _utils.get_logger()
|
2023-01-07 20:26:17 +01:00
|
|
|
if(typeof(_params) != TYPE_ARRAY):
|
|
|
|
_logger.error('You must pass an array to parameter_handler constructor.')
|
2022-06-02 04:13:43 +02:00
|
|
|
_params = null
|
|
|
|
|
|
|
|
|
|
|
|
func next_parameters():
|
|
|
|
_call_count += 1
|
2023-01-07 20:26:17 +01:00
|
|
|
return _params[_call_count -1]
|
2022-06-02 04:13:43 +02:00
|
|
|
|
|
|
|
func get_current_parameters():
|
|
|
|
return _params[_call_count]
|
|
|
|
|
|
|
|
func is_done():
|
|
|
|
var done = true
|
2023-01-07 20:26:17 +01:00
|
|
|
if(_params != null):
|
2022-06-02 04:13:43 +02:00
|
|
|
done = _call_count == _params.size()
|
|
|
|
return done
|
|
|
|
|
|
|
|
func get_logger():
|
|
|
|
return _logger
|
|
|
|
|
|
|
|
func set_logger(logger):
|
|
|
|
_logger = logger
|
|
|
|
|
|
|
|
func get_call_count():
|
|
|
|
return _call_count
|
|
|
|
|
|
|
|
func get_parameter_count():
|
|
|
|
return _params.size()
|