├── .gitignore ├── LICENSE ├── README.md ├── README_zh.md ├── Test.gd ├── Test.tscn ├── addons └── config_table_plugin │ ├── config_table │ ├── ConfigHelperBase.gd │ └── ConfigTable.gd │ ├── plugin.cfg │ ├── plugin.gd │ ├── templates │ ├── ConfigHelper.gd.template │ └── ConfigTable.gd.template │ └── tools │ ├── config_helper_generator │ └── ConfigHelperGenerator.gd │ └── gdscript_config_table_tool │ ├── .gdignore │ ├── BouncyCastle.Crypto.dll │ ├── GDScriptConfigTableTool.deps.json │ ├── GDScriptConfigTableTool.dll │ ├── GDScriptConfigTableTool.exe │ ├── GDScriptConfigTableTool.runtimeconfig.dev.json │ ├── GDScriptConfigTableTool.runtimeconfig.json │ ├── ICSharpCode.SharpZipLib.dll │ ├── Microsoft.Win32.SystemEvents.dll │ ├── NPOI.OOXML.dll │ ├── NPOI.OpenXml4Net.dll │ ├── NPOI.OpenXmlFormats.dll │ ├── NPOI.dll │ ├── Newtonsoft.Json.dll │ ├── System.Configuration.ConfigurationManager.dll │ ├── System.Drawing.Common.dll │ ├── System.Security.Cryptography.ProtectedData.dll │ ├── System.Security.Permissions.dll │ └── runtimes │ ├── unix │ └── lib │ │ └── netcoreapp2.0 │ │ └── System.Drawing.Common.dll │ └── win │ └── lib │ ├── netcoreapp2.0 │ ├── Microsoft.Win32.SystemEvents.dll │ └── System.Drawing.Common.dll │ └── netstandard2.0 │ └── System.Security.Cryptography.ProtectedData.dll ├── config_table ├── ConfigHelper.gd ├── configs │ ├── item.gd │ └── test.gd ├── defs │ ├── item.json │ └── test.json ├── excels │ ├── item.xlsx │ └── test.xlsx └── templates │ ├── ConfigHelper.gd.template │ └── ConfigTable.gd.template ├── default_env.tres ├── icon.png ├── icon.png.import └── project.godot /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .import 3 | *.translation 4 | export_presets.cfg 5 | .mono 6 | .DS_Store 7 | *.pdb 8 | .godot -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2021 Raiix 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Config Table Plugin 2 | 3 | A plugin for Godot 4 (GDScript 2.0) that can convert Excel files to GDScripts. 4 | 5 | [The source of the tool](https://github.com/rayxuln/GDScriptConfigTableTool) 6 | 7 | [简体中文](./README_zh.md) 8 | 9 | ## License 10 | 11 | MIT 12 | -------------------------------------------------------------------------------- /README_zh.md: -------------------------------------------------------------------------------- 1 | # 配置表格工具 2 | 3 | 用于Godot4的插件,可将Excel表格文件转换成GDScript文件,以便在Godot中使用。 4 | 5 | [转换工具的源码](https://github.com/rayxuln/GDScriptConfigTableTool) 6 | 7 | ## 许可证 8 | 9 | MIT 10 | 11 | ## 其他 12 | 13 | B站地址:https://space.bilibili.com/15155009 14 | 15 | 爱发电主页:https://afdian.net/@raiix 16 | 17 | 欢迎赞助支持哟~ 18 | 19 | 蘩的游戏开发交流QQ群:837298758 20 | 21 | 来分享你刚编的游戏创意或者展现你的游戏开发技术吧~ 22 | -------------------------------------------------------------------------------- /Test.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | 3 | 4 | func _ready() -> void: 5 | var data := ConfigHelper.item.by_id(2) 6 | print("物品: %s, 价格: %.2f" % [data.name, data.cost]) 7 | -------------------------------------------------------------------------------- /Test.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://dtec3ksvdrb5t"] 2 | 3 | [ext_resource type="Script" path="res://Test.gd" id="1"] 4 | 5 | [node name="Test" type="Node"] 6 | script = ExtResource("1") 7 | -------------------------------------------------------------------------------- /addons/config_table_plugin/config_table/ConfigHelperBase.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | class_name ConfigHelperBase 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /addons/config_table_plugin/config_table/ConfigTable.gd: -------------------------------------------------------------------------------- 1 | extends RefCounted 2 | class_name ConfigTable 3 | 4 | class Iterator: 5 | extends RefCounted 6 | 7 | var current_index:int 8 | 9 | var that:WeakRef 10 | func _init(t) -> void: 11 | that = t 12 | 13 | func _iter_init(arg): 14 | current_index = 0 15 | return current_index < that.get_ref().data_list.size() 16 | 17 | func _iter_next(arg): 18 | current_index += 1 19 | return current_index < that.get_ref().data_list.size() 20 | 21 | func _iter_get(arg): 22 | return that.get_ref().data_list[current_index] 23 | 24 | var data_list:Array 25 | 26 | func _init() -> void: 27 | data_list = _get_data_table() 28 | 29 | func _get_data_table(): 30 | return [] 31 | 32 | func _by(field_name, v): 33 | for data in data_list: 34 | if data[field_name] == v: 35 | return data 36 | var p:String = get_script().get_path() 37 | p = p.get_file().get_basename() 38 | printerr('No field "%s" has value: "%s" in table: %s' % [field_name, v, p]) 39 | return null 40 | 41 | func _all_by(field_name, v): 42 | var res := [] 43 | for data in data_list: 44 | if data[field_name] == v: 45 | res.append(data) 46 | return res 47 | 48 | func has(field_name, v) -> bool: 49 | for data in data_list: 50 | if data[field_name] == v: 51 | return true 52 | return false 53 | 54 | func get_iterator() -> Iterator: 55 | return Iterator.new(weakref(self)) 56 | -------------------------------------------------------------------------------- /addons/config_table_plugin/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="Config Table Plugin" 4 | description="Features: 5 | 1. define a data table 6 | 2. edit it as Excel file 7 | 3. export GDScripts from Excel files." 8 | author="Raiix" 9 | version="2.0" 10 | script="plugin.gd" 11 | -------------------------------------------------------------------------------- /addons/config_table_plugin/plugin.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends EditorPlugin 3 | 4 | const ROOT_DIR_SETTING := 'config_table_plugin/root_directory' 5 | const CONFIG_TABLE_TEMPLATE_PATH_SETTING := 'config_table_plugin/config_table_template_path' 6 | const CONFIG_HELPER_SAVE_PATH_SETTING := 'config_table_plugin/config_helper_save_path' 7 | 8 | const CONFIG_TABLES_DIR := 'configs' 9 | const EXCELS_DIR := 'excels' 10 | const DEFS_DIR := 'defs' 11 | const TEMPLATES_DIR := 'templates' 12 | 13 | var root_dir := 'res://config_table' 14 | var config_tables_dir:String 15 | var excels_dir:String 16 | var defs_dir:String 17 | var templates_dir:String 18 | 19 | var config_table_template_path := path_combine(TEMPLATES_DIR, 'ConfigTable.gd.template') 20 | var config_table_template_actual_path:String 21 | var CONFIG_TABLE_TEMPLATE_ACTUAL_PATH := path_combine(TEMPLATES_DIR, 'ConfigTable.gd.template') 22 | var GDSCRIPT_CONFIG_TABLE_TOOL_PATH := 'tools/gdscript_config_table_tool/GDScriptConfigTableTool.exe' 23 | 24 | var config_helper_template_path := path_combine(TEMPLATES_DIR, 'ConfigHelper.gd.template') 25 | var config_helper_template_actual_path:String 26 | var CONFIG_HELPER_TEMPLATE_ACTUAL_PATH := path_combine(TEMPLATES_DIR, 'ConfigHelper.gd.template') 27 | const ConfigHelperGenerator := preload('./tools/config_helper_generator/ConfigHelperGenerator.gd') 28 | var config_helper_generator:ConfigHelperGenerator 29 | 30 | var config_helper_save_path := 'ConfigHelper.gd' 31 | const GDSCRIPT_EXT := 'gd' 32 | 33 | const TOOL_MENU_NAME := 'Config Table' 34 | var tool_menu:PopupMenu 35 | var EXPORT_ALL_EXCELS_MENU_NAME := tr('Export All Excels') 36 | var EXPORT_ALL_GDSCRIPTS_MENU_NAME := tr('Export All GDScripts') 37 | var EXPORT_CONFIG_HELPER_NAME := tr('Export Config Helper') 38 | var EXPORT_ALL_NAME := tr('Export All') 39 | var CLEAN_ALL_CONFIG_TABLES_NAME := tr('Clean All Config Tables') 40 | 41 | const CONFIG_HELPER_AUTOLOAD_NAME := 'ConfigHelper' 42 | 43 | enum { 44 | EXPORT_ALL_EXCELS_MENU_ID = 0, 45 | EXPORT_ALL_GDSCRIPTS_MENU_ID, 46 | EXPORT_CONFIG_HELPER_MENU_ID, 47 | EXPORT_ALL_MENU_ID, 48 | CLEAN_ALL_CONFIG_TABLES_MENU_ID, 49 | } 50 | 51 | 52 | func _enter_tree() -> void: 53 | load_project_settings() 54 | check_and_create_directories() 55 | check_and_copy_config_table_template() 56 | check_gdscript_config_table_tool() 57 | check_and_copy_config_helper_template() 58 | create_config_helper_genreator() 59 | 60 | get_editor_interface().get_resource_filesystem().scan() 61 | 62 | create_tool_menu() 63 | 64 | check_and_update_config_helper_singleton() 65 | 66 | func _exit_tree() -> void: 67 | destory_tool_menu() 68 | 69 | if ProjectSettings.has_setting('autoload/%s' % CONFIG_HELPER_AUTOLOAD_NAME): 70 | remove_autoload_singleton(CONFIG_HELPER_AUTOLOAD_NAME) 71 | 72 | #---- Methods ----- 73 | func check_and_update_config_helper_singleton(): 74 | if ProjectSettings.has_setting('autoload/%s' % CONFIG_HELPER_AUTOLOAD_NAME): 75 | remove_autoload_singleton(CONFIG_HELPER_AUTOLOAD_NAME) 76 | var path = ProjectSettings.localize_path(root_dir) 77 | path = path_combine(path, config_helper_save_path) 78 | if FileAccess.file_exists(path): 79 | call_deferred('add_autoload_singleton', CONFIG_HELPER_AUTOLOAD_NAME, path) 80 | 81 | func create_tool_menu(): 82 | tool_menu = PopupMenu.new() 83 | add_tool_submenu_item(TOOL_MENU_NAME, tool_menu) 84 | 85 | tool_menu.connect('id_pressed', Callable(self, '_on_tool_menu_pressed')) 86 | 87 | tool_menu.add_item(EXPORT_ALL_EXCELS_MENU_NAME, EXPORT_ALL_EXCELS_MENU_ID) 88 | tool_menu.add_item(EXPORT_ALL_GDSCRIPTS_MENU_NAME, EXPORT_ALL_GDSCRIPTS_MENU_ID) 89 | tool_menu.add_item(EXPORT_CONFIG_HELPER_NAME, EXPORT_CONFIG_HELPER_MENU_ID) 90 | tool_menu.add_item(CLEAN_ALL_CONFIG_TABLES_NAME, CLEAN_ALL_CONFIG_TABLES_MENU_ID) 91 | tool_menu.add_separator() 92 | tool_menu.add_item(EXPORT_ALL_NAME, EXPORT_ALL_MENU_ID) 93 | 94 | 95 | func destory_tool_menu(): 96 | if tool_menu: 97 | remove_tool_menu_item(TOOL_MENU_NAME) 98 | 99 | func get_current_workdirectory(): 100 | var s := get_script() as GDScript; 101 | return ProjectSettings.globalize_path(s.get_path().get_base_dir()) 102 | 103 | func load_project_settings(): 104 | if ProjectSettings.has_setting(ROOT_DIR_SETTING): 105 | root_dir = ProjectSettings.get_setting(ROOT_DIR_SETTING) 106 | else: 107 | ProjectSettings.set_setting(ROOT_DIR_SETTING, root_dir) 108 | 109 | if ProjectSettings.has_setting(CONFIG_TABLE_TEMPLATE_PATH_SETTING): 110 | config_table_template_path = ProjectSettings.get_setting(CONFIG_TABLE_TEMPLATE_PATH_SETTING) 111 | else: 112 | ProjectSettings.set_setting(CONFIG_TABLE_TEMPLATE_PATH_SETTING, config_table_template_path) 113 | 114 | if ProjectSettings.has_setting(CONFIG_HELPER_SAVE_PATH_SETTING): 115 | config_helper_save_path = ProjectSettings.get_setting(CONFIG_HELPER_SAVE_PATH_SETTING) 116 | else: 117 | ProjectSettings.set_setting(CONFIG_HELPER_SAVE_PATH_SETTING, config_helper_save_path) 118 | 119 | func path_combine(base_dir, dir_name) -> String: 120 | return '%s/%s' % [base_dir, dir_name] 121 | 122 | func check_and_create_directories(): 123 | root_dir = ProjectSettings.globalize_path(root_dir) 124 | if not DirAccess.dir_exists_absolute(root_dir): 125 | var err = DirAccess.make_dir_recursive_absolute(root_dir) 126 | if err != OK: 127 | printerr('Can\'t make dir for root: %s' % root_dir) 128 | return 129 | 130 | config_tables_dir = path_combine(root_dir, CONFIG_TABLES_DIR) 131 | excels_dir = path_combine(root_dir, EXCELS_DIR) 132 | defs_dir = path_combine(root_dir, DEFS_DIR) 133 | templates_dir = path_combine(root_dir, TEMPLATES_DIR) 134 | 135 | if not DirAccess.dir_exists_absolute(config_tables_dir): 136 | var err = DirAccess.make_dir_recursive_absolute(config_tables_dir) 137 | if err != OK: 138 | printerr('Can\'t make dir for: %s' % config_tables_dir) 139 | return 140 | if not DirAccess.dir_exists_absolute(excels_dir): 141 | var err = DirAccess.make_dir_recursive_absolute(excels_dir) 142 | if err != OK: 143 | printerr('Can\'t make dir for: %s' % excels_dir) 144 | return 145 | if not DirAccess.dir_exists_absolute(defs_dir): 146 | var err = DirAccess.make_dir_recursive_absolute(defs_dir) 147 | if err != OK: 148 | printerr('Can\'t make dir for: %s' % defs_dir) 149 | return 150 | if not DirAccess.dir_exists_absolute(templates_dir): 151 | var err = DirAccess.make_dir_recursive_absolute(templates_dir) 152 | if err != OK: 153 | printerr('Can\'t make dir for: %s' % templates_dir) 154 | return 155 | 156 | 157 | func check_and_copy_config_table_template(): 158 | config_table_template_actual_path = path_combine(root_dir, config_table_template_path) 159 | var source = path_combine(get_current_workdirectory(), CONFIG_TABLE_TEMPLATE_ACTUAL_PATH) 160 | var do_copy = not FileAccess.file_exists(config_table_template_actual_path) 161 | if do_copy: 162 | var err = DirAccess.copy_absolute(source, config_table_template_actual_path) 163 | if err != OK: 164 | printerr('Can\'t copy template file from %s to: %s' % [source, config_table_template_actual_path]) 165 | return 166 | 167 | func check_and_copy_config_helper_template(): 168 | config_helper_template_actual_path = path_combine(root_dir, config_helper_template_path) 169 | var source = path_combine(get_current_workdirectory(), CONFIG_HELPER_TEMPLATE_ACTUAL_PATH) 170 | var do_copy = not FileAccess.file_exists(config_helper_template_actual_path) 171 | if do_copy: 172 | var err = DirAccess.copy_absolute(source, config_helper_template_actual_path) 173 | if err != OK: 174 | printerr('Can\'t copy template file from %s to: %s' % [source, config_helper_template_actual_path]) 175 | return 176 | 177 | func execute_gdscript_config_table_tool(args:=[], show_output:=false): 178 | var e = path_combine(get_current_workdirectory(), GDSCRIPT_CONFIG_TABLE_TOOL_PATH) 179 | e = ProjectSettings.globalize_path(e) 180 | var output := [] 181 | var code = OS.execute(e, args, output, true, true) 182 | if code != 0: 183 | printerr('Execute the gdscript config table tool failed: %s' % e) 184 | printerr('Code: %s' % code) 185 | printerr('Output: %s' % [output]) 186 | else: 187 | if show_output and not output.is_empty(): 188 | if output.size() != 1 or output[0] != '': 189 | print(output) 190 | get_editor_interface().get_resource_filesystem().scan() 191 | 192 | func check_gdscript_config_table_tool(): 193 | execute_gdscript_config_table_tool(['-h']) 194 | 195 | func create_config_helper_genreator(): 196 | config_helper_generator = ConfigHelperGenerator.new(config_helper_template_actual_path) 197 | 198 | func get_config_table_path_list(): 199 | var dir = DirAccess.open(config_tables_dir) 200 | if dir == null: 201 | printerr('Can\'t access config tables dir: %s, code: %s' % [config_tables_dir, DirAccess.get_open_error()]) 202 | return [] 203 | var err = dir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547 204 | if err != OK: 205 | printerr('Can\'t list dir begin at: %s, code: %s' % [config_tables_dir, err]) 206 | return [] 207 | var res := [] 208 | var file_name = dir.get_next() 209 | while file_name != '': 210 | if not dir.current_is_dir(): 211 | if file_name.ends_with('.%s' % GDSCRIPT_EXT): 212 | res.append(path_combine(CONFIG_TABLES_DIR, file_name)) 213 | file_name = dir.get_next() 214 | dir.list_dir_end() 215 | return res 216 | 217 | func get_config_helper_save_path(): 218 | var path:String = config_helper_save_path 219 | if path.is_absolute_path(): 220 | path = ProjectSettings.globalize_path(path) 221 | if path.is_relative_path(): 222 | path = path_combine(root_dir, path) 223 | return path 224 | 225 | func export_all_excels(scan:=true): 226 | execute_gdscript_config_table_tool(['export_all_excel', '-od', (excels_dir), '-dd', (defs_dir)], true) 227 | print('Export all excels done!') 228 | if scan: 229 | get_editor_interface().get_resource_filesystem().scan() 230 | 231 | func export_all_gdscripts(scan:=true): 232 | execute_gdscript_config_table_tool(['export_all_gdscript', '-od', (config_tables_dir), '-ed', (excels_dir), '-dd', (defs_dir), '-tp', (config_table_template_actual_path)], true) 233 | print('Export all gdscripts done!') 234 | if scan: 235 | get_editor_interface().get_resource_filesystem().scan() 236 | 237 | func export_config_helper(scan:=true): 238 | config_helper_generator.create(get_config_table_path_list()) 239 | config_helper_generator.save_to(get_config_helper_save_path()) 240 | print('Export config helper done!') 241 | if scan: 242 | get_editor_interface().get_resource_filesystem().scan() 243 | check_and_update_config_helper_singleton() 244 | 245 | func export_all(scan:=true): 246 | export_all_excels(false) 247 | clean_all_config_tables(false, false) 248 | export_all_gdscripts(false) 249 | export_config_helper(false) 250 | print('Export all done!') 251 | if scan: 252 | get_editor_interface().get_resource_filesystem().scan() 253 | 254 | func clean_all_config_tables(scan:=true, with_config_helper:=true): 255 | var dir = DirAccess.open(config_tables_dir) 256 | if dir == null: 257 | printerr('Can\'t open config tables directory: %s, code: %s' % [config_tables_dir, DirAccess.get_open_error()]) 258 | return 259 | var err = dir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547 260 | if err != OK: 261 | printerr('Can\'t list dir begin of: %s, code: %s' % [config_tables_dir, err]) 262 | return 263 | 264 | var file_name = dir.get_next() 265 | var file_list := [] 266 | while file_name != "": 267 | if not dir.current_is_dir(): 268 | if file_name.ends_with('.%s' % GDSCRIPT_EXT): 269 | file_list.append(file_name) 270 | file_name = dir.get_next() 271 | dir.list_dir_end() 272 | 273 | for f in file_list: 274 | err = dir.remove(f) 275 | if err != OK: 276 | printerr('Can\'t remove file: %s, code: %s' % [f, err]) 277 | continue 278 | 279 | if with_config_helper: 280 | export_config_helper(false) 281 | print('Clean all config tables done!') 282 | if scan: 283 | get_editor_interface().get_resource_filesystem().scan() 284 | #----- Signals ----- 285 | func _on_tool_menu_pressed(id): 286 | match id: 287 | EXPORT_ALL_EXCELS_MENU_ID: 288 | export_all_excels() 289 | EXPORT_ALL_GDSCRIPTS_MENU_ID: 290 | export_all_gdscripts() 291 | EXPORT_CONFIG_HELPER_MENU_ID: 292 | export_config_helper() 293 | EXPORT_ALL_MENU_ID: 294 | export_all() 295 | CLEAN_ALL_CONFIG_TABLES_MENU_ID: 296 | clean_all_config_tables() 297 | -------------------------------------------------------------------------------- /addons/config_table_plugin/templates/ConfigHelper.gd.template: -------------------------------------------------------------------------------- 1 | extends ConfigHelperBase 2 | 3 | {CONFIG_TABLE_LIST} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /addons/config_table_plugin/templates/ConfigTable.gd.template: -------------------------------------------------------------------------------- 1 | extends ConfigTable 2 | 3 | class DataType: 4 | extends RefCounted 5 | {FIELD_DEC_LIST} 6 | func _init(field_value_map := {}): 7 | for key in field_value_map.keys(): 8 | set(key, field_value_map[key]) 9 | 10 | func _get_data_table(): 11 | # DataType.new({}) 12 | return [ 13 | {DATA_LIST} ] 14 | 15 | func by(field_name, v) -> DataType: 16 | return super._by(field_name, v) as DataType 17 | 18 | func _get_data_head_def(): 19 | return [ 20 | {DATA_HEAD_DEF} ] 21 | 22 | # func by_field1(v) -> DataType: 23 | # return by("field1", v) 24 | {BY_FIELD_FUNC_LIST} -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/config_helper_generator/ConfigHelperGenerator.gd: -------------------------------------------------------------------------------- 1 | extends RefCounted 2 | 3 | var template_path:String 4 | 5 | var template_code:String 6 | var source_code:String 7 | 8 | 9 | func _init(t:String) -> void: 10 | template_path = t 11 | #----- Methods ----- 12 | func clear_code(): 13 | source_code = '' 14 | 15 | func create(config_table_path_list:Array): 16 | var gen_map := {} 17 | gen_map['CONFIG_TABLE_LIST'] = gen_table_list(config_table_path_list) 18 | 19 | clear_code() 20 | gen_decription() 21 | gen_code(gen_map) 22 | 23 | func gen_decription(): 24 | var date:String = '{year}-{month}-{day} {hour}:{minute}:{second}'.format(Time.get_datetime_dict_from_system()) 25 | var empty_str = ' ' 26 | var left_pad = floor((empty_str.length() - date.length()) / 2) 27 | var right_pad = ceil((empty_str.length() - date.length()) / 2) 28 | for i in left_pad: 29 | date = ' ' + date 30 | for i in right_pad: 31 | date = date + ' ' 32 | source_code += "#====================================#\n" 33 | source_code += "# #\n" 34 | source_code += "# The file is auto-generated by tool #\n" 35 | source_code += "#%s#\n" % date 36 | source_code += "# #\n" 37 | source_code += "#====================================#\n\n" 38 | 39 | func gen_table_list(config_table_path_list:Array): 40 | var INDENT := 0 41 | var TEMPLATE := '{0}var {1} := preload("{2}").new()' 42 | var indent = gen_indent(INDENT) 43 | var res := '' 44 | for p in config_table_path_list: 45 | var path:String = p 46 | var table_name = path.get_file().trim_suffix('.%s' % path.get_extension()) 47 | res += TEMPLATE.format([indent, table_name, path]) + '\n' 48 | return res 49 | 50 | func gen_code(gen_map:Dictionary): 51 | read_template() 52 | source_code += template_code 53 | for k in gen_map: 54 | source_code = source_code.replace('{%s}' % k, gen_map[k]) 55 | 56 | func gen_indent(n:int): 57 | var res = '' 58 | for i in n: 59 | res += '\t' 60 | return res 61 | 62 | func read_template(): 63 | var file = FileAccess.open(template_path, FileAccess.READ) 64 | var err = FileAccess.get_open_error() 65 | if err != OK: 66 | printerr('Can\'t open tempalte file: %s, code: %s' % [template_path, err]) 67 | return 68 | template_code = file.get_as_text() 69 | file.close() 70 | 71 | func save_to(path): 72 | var err 73 | if FileAccess.file_exists(path): 74 | err = DirAccess.remove_absolute(path) 75 | if err != OK: 76 | printerr('Can\'t remove the old file: %s, code: %s' % [path, err]) 77 | return 78 | var file = FileAccess.open(path, FileAccess.WRITE) 79 | err = FileAccess.get_open_error() 80 | if err != OK: 81 | printerr('Can\'t open file: %s, code: %s' % [path, err]) 82 | return 83 | file.store_string(source_code) 84 | file.flush() 85 | file.close() 86 | #----- Signals ----- 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/.gdignore: -------------------------------------------------------------------------------- 1 | *.pdb -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/BouncyCastle.Crypto.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/BouncyCastle.Crypto.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v3.1", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v3.1": { 9 | "GDScriptConfigTableTool/1.0.0": { 10 | "dependencies": { 11 | "NPOI": "2.5.5", 12 | "Newtonsoft.Json": "13.0.1" 13 | }, 14 | "runtime": { 15 | "GDScriptConfigTableTool.dll": {} 16 | } 17 | }, 18 | "Microsoft.NETCore.Platforms/2.0.0": {}, 19 | "Microsoft.Win32.SystemEvents/4.5.0": { 20 | "dependencies": { 21 | "Microsoft.NETCore.Platforms": "2.0.0" 22 | }, 23 | "runtime": { 24 | "lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll": { 25 | "assemblyVersion": "4.0.0.0", 26 | "fileVersion": "4.6.26515.6" 27 | } 28 | }, 29 | "runtimeTargets": { 30 | "runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll": { 31 | "rid": "win", 32 | "assetType": "runtime", 33 | "assemblyVersion": "4.0.0.0", 34 | "fileVersion": "4.6.26515.6" 35 | } 36 | } 37 | }, 38 | "Newtonsoft.Json/13.0.1": { 39 | "runtime": { 40 | "lib/netstandard2.0/Newtonsoft.Json.dll": { 41 | "assemblyVersion": "13.0.0.0", 42 | "fileVersion": "13.0.1.25517" 43 | } 44 | } 45 | }, 46 | "NPOI/2.5.5": { 47 | "dependencies": { 48 | "Portable.BouncyCastle": "1.8.9", 49 | "SharpZipLib": "1.3.2", 50 | "System.Configuration.ConfigurationManager": "4.5.0", 51 | "System.Drawing.Common": "4.5.0" 52 | }, 53 | "runtime": { 54 | "lib/netstandard2.1/NPOI.OOXML.dll": { 55 | "assemblyVersion": "2.5.5.0", 56 | "fileVersion": "2.5.5.0" 57 | }, 58 | "lib/netstandard2.1/NPOI.OpenXml4Net.dll": { 59 | "assemblyVersion": "2.5.5.0", 60 | "fileVersion": "2.5.5.0" 61 | }, 62 | "lib/netstandard2.1/NPOI.OpenXmlFormats.dll": { 63 | "assemblyVersion": "2.5.5.0", 64 | "fileVersion": "2.5.5.0" 65 | }, 66 | "lib/netstandard2.1/NPOI.dll": { 67 | "assemblyVersion": "2.5.5.0", 68 | "fileVersion": "2.5.5.0" 69 | } 70 | } 71 | }, 72 | "Portable.BouncyCastle/1.8.9": { 73 | "runtime": { 74 | "lib/netstandard2.0/BouncyCastle.Crypto.dll": { 75 | "assemblyVersion": "1.8.9.0", 76 | "fileVersion": "1.8.9.1" 77 | } 78 | } 79 | }, 80 | "SharpZipLib/1.3.2": { 81 | "runtime": { 82 | "lib/netstandard2.1/ICSharpCode.SharpZipLib.dll": { 83 | "assemblyVersion": "1.3.2.10", 84 | "fileVersion": "1.3.2.10" 85 | } 86 | } 87 | }, 88 | "System.Configuration.ConfigurationManager/4.5.0": { 89 | "dependencies": { 90 | "System.Security.Cryptography.ProtectedData": "4.5.0", 91 | "System.Security.Permissions": "4.5.0" 92 | }, 93 | "runtime": { 94 | "lib/netstandard2.0/System.Configuration.ConfigurationManager.dll": { 95 | "assemblyVersion": "4.0.1.0", 96 | "fileVersion": "4.6.26515.6" 97 | } 98 | } 99 | }, 100 | "System.Drawing.Common/4.5.0": { 101 | "dependencies": { 102 | "Microsoft.NETCore.Platforms": "2.0.0", 103 | "Microsoft.Win32.SystemEvents": "4.5.0" 104 | }, 105 | "runtime": { 106 | "lib/netstandard2.0/System.Drawing.Common.dll": { 107 | "assemblyVersion": "4.0.0.0", 108 | "fileVersion": "4.6.26515.6" 109 | } 110 | }, 111 | "runtimeTargets": { 112 | "runtimes/unix/lib/netcoreapp2.0/System.Drawing.Common.dll": { 113 | "rid": "unix", 114 | "assetType": "runtime", 115 | "assemblyVersion": "4.0.0.0", 116 | "fileVersion": "4.6.26515.6" 117 | }, 118 | "runtimes/win/lib/netcoreapp2.0/System.Drawing.Common.dll": { 119 | "rid": "win", 120 | "assetType": "runtime", 121 | "assemblyVersion": "4.0.0.0", 122 | "fileVersion": "4.6.26515.6" 123 | } 124 | } 125 | }, 126 | "System.Security.AccessControl/4.5.0": { 127 | "dependencies": { 128 | "Microsoft.NETCore.Platforms": "2.0.0", 129 | "System.Security.Principal.Windows": "4.5.0" 130 | } 131 | }, 132 | "System.Security.Cryptography.ProtectedData/4.5.0": { 133 | "runtime": { 134 | "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { 135 | "assemblyVersion": "4.0.3.0", 136 | "fileVersion": "4.6.26515.6" 137 | } 138 | }, 139 | "runtimeTargets": { 140 | "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { 141 | "rid": "win", 142 | "assetType": "runtime", 143 | "assemblyVersion": "4.0.3.0", 144 | "fileVersion": "4.6.26515.6" 145 | } 146 | } 147 | }, 148 | "System.Security.Permissions/4.5.0": { 149 | "dependencies": { 150 | "System.Security.AccessControl": "4.5.0" 151 | }, 152 | "runtime": { 153 | "lib/netstandard2.0/System.Security.Permissions.dll": { 154 | "assemblyVersion": "4.0.1.0", 155 | "fileVersion": "4.6.26515.6" 156 | } 157 | } 158 | }, 159 | "System.Security.Principal.Windows/4.5.0": { 160 | "dependencies": { 161 | "Microsoft.NETCore.Platforms": "2.0.0" 162 | } 163 | } 164 | } 165 | }, 166 | "libraries": { 167 | "GDScriptConfigTableTool/1.0.0": { 168 | "type": "project", 169 | "serviceable": false, 170 | "sha512": "" 171 | }, 172 | "Microsoft.NETCore.Platforms/2.0.0": { 173 | "type": "package", 174 | "serviceable": true, 175 | "sha512": "sha512-VdLJOCXhZaEMY7Hm2GKiULmn7IEPFE4XC5LPSfBVCUIA8YLZVh846gtfBJalsPQF2PlzdD7ecX7DZEulJ402ZQ==", 176 | "path": "microsoft.netcore.platforms/2.0.0", 177 | "hashPath": "microsoft.netcore.platforms.2.0.0.nupkg.sha512" 178 | }, 179 | "Microsoft.Win32.SystemEvents/4.5.0": { 180 | "type": "package", 181 | "serviceable": true, 182 | "sha512": "sha512-LuI1oG+24TUj1ZRQQjM5Ew73BKnZE5NZ/7eAdh1o8ST5dPhUnJvIkiIn2re3MwnkRy6ELRnvEbBxHP8uALKhJw==", 183 | "path": "microsoft.win32.systemevents/4.5.0", 184 | "hashPath": "microsoft.win32.systemevents.4.5.0.nupkg.sha512" 185 | }, 186 | "Newtonsoft.Json/13.0.1": { 187 | "type": "package", 188 | "serviceable": true, 189 | "sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==", 190 | "path": "newtonsoft.json/13.0.1", 191 | "hashPath": "newtonsoft.json.13.0.1.nupkg.sha512" 192 | }, 193 | "NPOI/2.5.5": { 194 | "type": "package", 195 | "serviceable": true, 196 | "sha512": "sha512-xTCJOXdcBWV9GUAVRJTC73L5bU3Ahgtuk13U/rOix8Gi05XWf9E4K+vGx63JZt35WoroXq+hM0RZ+aad2y8Ceg==", 197 | "path": "npoi/2.5.5", 198 | "hashPath": "npoi.2.5.5.nupkg.sha512" 199 | }, 200 | "Portable.BouncyCastle/1.8.9": { 201 | "type": "package", 202 | "serviceable": true, 203 | "sha512": "sha512-wlJo8aFoeyl+W93iFXTK5ShzDYk5WBqoUPjTNEM0Xv9kn1H+4hmuCjF0/n8HLm9Nnp1aY6KNndWqQTNk+NGgRQ==", 204 | "path": "portable.bouncycastle/1.8.9", 205 | "hashPath": "portable.bouncycastle.1.8.9.nupkg.sha512" 206 | }, 207 | "SharpZipLib/1.3.2": { 208 | "type": "package", 209 | "serviceable": true, 210 | "sha512": "sha512-WSdeDReL8eugMCw5BH/tFAZpgR+YsYMwm6kIvqg3J8LbfRjbbebmEzn63AbEveqyMOljBO68g6tCCv165wMkSg==", 211 | "path": "sharpziplib/1.3.2", 212 | "hashPath": "sharpziplib.1.3.2.nupkg.sha512" 213 | }, 214 | "System.Configuration.ConfigurationManager/4.5.0": { 215 | "type": "package", 216 | "serviceable": true, 217 | "sha512": "sha512-UIFvaFfuKhLr9u5tWMxmVoDPkFeD+Qv8gUuap4aZgVGYSYMdERck4OhLN/2gulAc0nYTEigWXSJNNWshrmxnng==", 218 | "path": "system.configuration.configurationmanager/4.5.0", 219 | "hashPath": "system.configuration.configurationmanager.4.5.0.nupkg.sha512" 220 | }, 221 | "System.Drawing.Common/4.5.0": { 222 | "type": "package", 223 | "serviceable": true, 224 | "sha512": "sha512-AiJFxxVPdeITstiRS5aAu8+8Dpf5NawTMoapZ53Gfirml24p7HIfhjmCRxdXnmmf3IUA3AX3CcW7G73CjWxW/Q==", 225 | "path": "system.drawing.common/4.5.0", 226 | "hashPath": "system.drawing.common.4.5.0.nupkg.sha512" 227 | }, 228 | "System.Security.AccessControl/4.5.0": { 229 | "type": "package", 230 | "serviceable": true, 231 | "sha512": "sha512-vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==", 232 | "path": "system.security.accesscontrol/4.5.0", 233 | "hashPath": "system.security.accesscontrol.4.5.0.nupkg.sha512" 234 | }, 235 | "System.Security.Cryptography.ProtectedData/4.5.0": { 236 | "type": "package", 237 | "serviceable": true, 238 | "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==", 239 | "path": "system.security.cryptography.protecteddata/4.5.0", 240 | "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512" 241 | }, 242 | "System.Security.Permissions/4.5.0": { 243 | "type": "package", 244 | "serviceable": true, 245 | "sha512": "sha512-9gdyuARhUR7H+p5CjyUB/zPk7/Xut3wUSP8NJQB6iZr8L3XUXTMdoLeVAg9N4rqF8oIpE7MpdqHdDHQ7XgJe0g==", 246 | "path": "system.security.permissions/4.5.0", 247 | "hashPath": "system.security.permissions.4.5.0.nupkg.sha512" 248 | }, 249 | "System.Security.Principal.Windows/4.5.0": { 250 | "type": "package", 251 | "serviceable": true, 252 | "sha512": "sha512-U77HfRXlZlOeIXd//Yoj6Jnk8AXlbeisf1oq1os+hxOGVnuG+lGSfGqTwTZBoORFF6j/0q7HXIl8cqwQ9aUGqQ==", 253 | "path": "system.security.principal.windows/4.5.0", 254 | "hashPath": "system.security.principal.windows.4.5.0.nupkg.sha512" 255 | } 256 | } 257 | } -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.exe -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\imbos\\.dotnet\\store\\|arch|\\|tfm|", 5 | "C:\\Users\\imbos\\.nuget\\packages", 6 | "C:\\Users\\imbos\\AppData\\Roaming\\Godot\\mono\\GodotNuGetFallbackFolder", 7 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" 8 | ] 9 | } 10 | } -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/GDScriptConfigTableTool.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "netcoreapp3.1", 4 | "framework": { 5 | "name": "Microsoft.NETCore.App", 6 | "version": "3.1.0" 7 | }, 8 | "configProperties": { 9 | "System.Reflection.Metadata.MetadataUpdater.IsSupported": false 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/ICSharpCode.SharpZipLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/ICSharpCode.SharpZipLib.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/Microsoft.Win32.SystemEvents.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/Microsoft.Win32.SystemEvents.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.OOXML.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.OOXML.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.OpenXml4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.OpenXml4Net.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.OpenXmlFormats.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.OpenXmlFormats.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/NPOI.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/System.Configuration.ConfigurationManager.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/System.Configuration.ConfigurationManager.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/System.Drawing.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/System.Drawing.Common.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/System.Security.Cryptography.ProtectedData.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/System.Security.Cryptography.ProtectedData.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/System.Security.Permissions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/System.Security.Permissions.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/unix/lib/netcoreapp2.0/System.Drawing.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/unix/lib/netcoreapp2.0/System.Drawing.Common.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/win/lib/netcoreapp2.0/System.Drawing.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/win/lib/netcoreapp2.0/System.Drawing.Common.dll -------------------------------------------------------------------------------- /addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/addons/config_table_plugin/tools/gdscript_config_table_tool/runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll -------------------------------------------------------------------------------- /config_table/ConfigHelper.gd: -------------------------------------------------------------------------------- 1 | #====================================# 2 | # # 3 | # The file is auto-generated by tool # 4 | # 2023-4-1 16:55:12 # 5 | # # 6 | #====================================# 7 | 8 | extends ConfigHelperBase 9 | 10 | var item := preload("configs/item.gd").new() 11 | var test := preload("configs/test.gd").new() 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /config_table/configs/item.gd: -------------------------------------------------------------------------------- 1 | 2 | #===============================================# 3 | # # 4 | # This file is auto-generated by tool # 5 | # 2023-04-01 04:55:12 # 6 | # # 7 | #===============================================# 8 | 9 | extends ConfigTable 10 | 11 | class DataType: 12 | extends RefCounted 13 | var id: float 14 | var name: String 15 | var attr: Dictionary 16 | var cost: float 17 | 18 | func _init(field_value_map := {}): 19 | for key in field_value_map.keys(): 20 | set(key, field_value_map[key]) 21 | 22 | func _get_data_table(): 23 | # DataType.new({}) 24 | return [ 25 | DataType.new({'id': 1,'name': '钥匙','cost': 10,}), 26 | DataType.new({'id': 2,'name': '金色斧头','cost': 12,}), 27 | DataType.new({'id': 3,'name': '银色斧头','cost': 13,}), 28 | DataType.new({'id': 4,}), 29 | DataType.new({'id': 5,}), 30 | DataType.new({'id': 6,}), 31 | DataType.new({'id': 7,}), 32 | DataType.new({'id': 8,}), 33 | DataType.new({'id': 9,}), 34 | DataType.new({'id': 10,}), 35 | DataType.new({'id': 11,}), 36 | DataType.new({'id': 12,}), 37 | DataType.new({'id': 13,}), 38 | ] 39 | 40 | func by(field_name, v) -> DataType: 41 | return super._by(field_name, v) as DataType 42 | 43 | func _get_data_head_def(): 44 | return [ 45 | "id", 46 | "name", 47 | "attr", 48 | "cost", 49 | ] 50 | 51 | # func by_field1(v) -> DataType: 52 | # return by("field1", v) 53 | func by_id(v) -> DataType: 54 | return by("id", v) 55 | 56 | func by_name(v) -> DataType: 57 | return by("name", v) 58 | 59 | func by_attr(v) -> DataType: 60 | return by("attr", v) 61 | 62 | func by_cost(v) -> DataType: 63 | return by("cost", v) 64 | 65 | -------------------------------------------------------------------------------- /config_table/configs/test.gd: -------------------------------------------------------------------------------- 1 | 2 | #===============================================# 3 | # # 4 | # This file is auto-generated by tool # 5 | # 2023-04-01 04:55:12 # 6 | # # 7 | #===============================================# 8 | 9 | extends ConfigTable 10 | 11 | class DataType: 12 | extends RefCounted 13 | var test_name_1: String 14 | var test_name_2: float 15 | var test_name_3: Dictionary 16 | var test_name_4: String 17 | 18 | func _init(field_value_map := {}): 19 | for key in field_value_map.keys(): 20 | set(key, field_value_map[key]) 21 | 22 | func _get_data_table(): 23 | # DataType.new({}) 24 | return [ 25 | DataType.new({'test_name_1': '中文',}), 26 | DataType.new({'test_name_1': 'english','test_name_2': 1.23,'test_name_3': {},'test_name_4': '456456',}), 27 | ] 28 | 29 | func by(field_name, v) -> DataType: 30 | return super._by(field_name, v) as DataType 31 | 32 | func _get_data_head_def(): 33 | return [ 34 | "test_name_1", 35 | "test_name_2", 36 | "test_name_3", 37 | "test_name_4", 38 | ] 39 | 40 | # func by_field1(v) -> DataType: 41 | # return by("field1", v) 42 | func by_test_name_1(v) -> DataType: 43 | return by("test_name_1", v) 44 | 45 | func by_test_name_2(v) -> DataType: 46 | return by("test_name_2", v) 47 | 48 | func by_test_name_3(v) -> DataType: 49 | return by("test_name_3", v) 50 | 51 | func by_test_name_4(v) -> DataType: 52 | return by("test_name_4", v) 53 | 54 | -------------------------------------------------------------------------------- /config_table/defs/item.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "ID", 4 | "id": "id", 5 | "type": "Real" 6 | }, 7 | { 8 | "name": "物品名", 9 | "id": "name", 10 | "type": "String" 11 | }, 12 | { 13 | "name": "属性", 14 | "id": "attr", 15 | "type": "Dictionary" 16 | }, 17 | { 18 | "name": "价格", 19 | "id": "cost", 20 | "type": "Real" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /config_table/defs/test.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "测试名1", 4 | "id": "test_name_1", 5 | "type": "String" 6 | }, 7 | { 8 | "name": "测试名2", 9 | "id": "test_name_2", 10 | "type": "Real" 11 | }, 12 | { 13 | "name": "数组类型", 14 | "id": "test_name_3", 15 | "type": "Dictionary" 16 | }, 17 | { 18 | "name": "bu666", 19 | "id": "test_name_4" 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /config_table/excels/item.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/config_table/excels/item.xlsx -------------------------------------------------------------------------------- /config_table/excels/test.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/config_table/excels/test.xlsx -------------------------------------------------------------------------------- /config_table/templates/ConfigHelper.gd.template: -------------------------------------------------------------------------------- 1 | extends ConfigHelperBase 2 | 3 | {CONFIG_TABLE_LIST} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /config_table/templates/ConfigTable.gd.template: -------------------------------------------------------------------------------- 1 | extends ConfigTable 2 | 3 | class DataType: 4 | extends RefCounted 5 | {FIELD_DEC_LIST} 6 | func _init(field_value_map := {}): 7 | for key in field_value_map.keys(): 8 | set(key, field_value_map[key]) 9 | 10 | func _get_data_table(): 11 | # DataType.new({}) 12 | return [ 13 | {DATA_LIST} ] 14 | 15 | func by(field_name, v) -> DataType: 16 | return super._by(field_name, v) as DataType 17 | 18 | func _get_data_head_def(): 19 | return [ 20 | {DATA_HEAD_DEF} ] 21 | 22 | # func by_field1(v) -> DataType: 23 | # return by("field1", v) 24 | {BY_FIELD_FUNC_LIST} -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=3 uid="uid://cw80wqur5vqg5"] 2 | 3 | [sub_resource type="Sky" id="1"] 4 | 5 | [resource] 6 | background_mode = 2 7 | sky = SubResource("1") 8 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayxuln/Config-Table-Plugin/7abfbf1852f16a0a078cbe80bd9f9782c8d4e9c5/icon.png -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://c2on1rx60jfjq" 6 | path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://icon.png" 14 | dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=5 10 | 11 | [application] 12 | 13 | config/name="Config Table Plugin" 14 | run/main_scene="res://Test.tscn" 15 | config/features=PackedStringArray("4.0") 16 | config/icon="res://icon.png" 17 | 18 | [autoload] 19 | 20 | ConfigHelper="*res://config_table//ConfigHelper.gd" 21 | 22 | [config_table_plugin] 23 | 24 | root_directory="res://config_table" 25 | config_table_template_path="templates/ConfigTable.gd.template" 26 | config_helper_save_path="ConfigHelper.gd" 27 | 28 | [editor_plugins] 29 | 30 | enabled=PackedStringArray("res://addons/config_table_plugin/plugin.cfg") 31 | 32 | [mono] 33 | 34 | project/assembly_name="Config Table Plugin" 35 | 36 | [physics] 37 | 38 | common/enable_pause_aware_picking=true 39 | 40 | [rendering] 41 | 42 | environment/defaults/default_environment="res://default_env.tres" 43 | --------------------------------------------------------------------------------