Added Glitch Room Source code to Gitty
This commit is contained in:
commit
1ac9eb5644
505 files changed
+28504
No files matched your search
@@ -0,0 +1,53 @@
|
||||
@tool
|
||||
class_name ValidationResult
|
||||
extends RefCounted
|
||||
|
||||
|
||||
var errors: Array[String] = []
|
||||
var warnings: Array[String] = []
|
||||
|
||||
|
||||
func add_error(message: String) -> void:
|
||||
errors.append(message)
|
||||
|
||||
|
||||
func add_warning(message: String) -> void:
|
||||
warnings.append(message)
|
||||
|
||||
|
||||
func is_valid() -> bool:
|
||||
return errors.is_empty()
|
||||
|
||||
|
||||
func has_warnings() -> bool:
|
||||
return not warnings.is_empty()
|
||||
|
||||
|
||||
func get_summary() -> String:
|
||||
if not is_valid():
|
||||
return "%d error(s), %d warning(s)" % [
|
||||
errors.size(),
|
||||
warnings.size()
|
||||
]
|
||||
|
||||
if has_warnings():
|
||||
return "Valid with %d warning(s)" % warnings.size()
|
||||
|
||||
return "Valid"
|
||||
|
||||
func merge(
|
||||
other: ValidationResult
|
||||
) -> void:
|
||||
|
||||
if other == null:
|
||||
return
|
||||
|
||||
errors.append_array(
|
||||
other.errors
|
||||
)
|
||||
|
||||
warnings.append_array(
|
||||
other.warnings
|
||||
)
|
||||
|
||||
var result := ValidationResult.new()
|
||||
Reference in new issue
Block a user