-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+26 i18n, skill editor work, history for skill,...
Skill_cooldown_type enum added BaseSkill >> + cooldown type (milli, sec, or min) Lot of UI work linking UI with backend
- Loading branch information
Showing
38 changed files
with
1,820 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"godotTools.editorPath.godot4": "c:\\Users\\Malywan\\Desktop\\Godot\\Godot_v4.2.1-stable_mono_win64.exe" | ||
"godotTools.editorPath.godot4": "c:\\Users\\Malywan\\Desktop\\Godot4.2\\Godot_v4.2.1-stable_mono_win64.exe" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
extends HistoryBase | ||
class_name HistorySkill | ||
|
||
var skill_idx: String = "" | ||
var edited_data: Dictionary = {} | ||
|
||
func _init(_action: EnumRegister.HistoryAction, _skill_idx: String, _edited_data: Dictionary = {}): | ||
location = EnumRegister.HistoryLocation.DB_SKILL | ||
action = _action | ||
skill_idx = _skill_idx | ||
edited_data = _edited_data | ||
|
||
func undo_change() -> void: | ||
print("Undo changement to skill") | ||
var skill: BaseSkill = SkillRegister.get_skill(skill_idx) | ||
|
||
for key in edited_data: | ||
skill.set(key, edited_data[key]) | ||
|
||
SkillRegister.set_skill(skill_idx, skill) | ||
|
||
func redo_change() -> void: | ||
print("Redo changement to skill") | ||
var skill: BaseSkill = SkillRegister.get_skill(skill_idx) | ||
|
||
for key in edited_data: | ||
skill.set(key, edited_data[key]) | ||
|
||
SkillRegister.set_skill(skill_idx, skill) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ enum HistoryLocation { | |
NONE, | ||
DB_CHARACTERSLIST, | ||
DB_CHARACTER, | ||
|
||
DB_SKILLSLIST, | ||
DB_SKILL, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
enum SkillCooldownType { | ||
MS, | ||
SEC, | ||
MIN, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
extends Base | ||
class_name EffectRegister | ||
# This class is used to register all the effects in the game | ||
|
||
func _init(): | ||
need_register = false # Set it to false to avoid registering this class in the class register | ||
|
||
set_custom_name("EffectRegister") | ||
|
||
static var data: Dictionary = {} | ||
|
||
static func set_effects(effects: Dictionary) -> void: | ||
# Set the effects data | ||
data = effects | ||
|
||
static func set_effect(effect_id: String, effect: BaseEffect) -> void: | ||
# Set a effect data | ||
data[effect_id] = effect | ||
|
||
static func get_effect(effect_id: String) -> BaseEffect: | ||
# Get a effect data | ||
return data[effect_id] | ||
|
||
static func get_all_effects() -> Dictionary: | ||
# Get all effects data | ||
return data | ||
|
||
static func get_all_effects_names() -> Array: | ||
# Get all effects names | ||
var names = [] | ||
for effect in data.values(): | ||
names.append(effect.name) | ||
return names | ||
|
||
static func get_all_effects_ids() -> Array: | ||
# Get all effects ids | ||
return data.keys() | ||
|
||
static func get_all_effects_name_by_ids() -> Array: | ||
# Get all effects names by ids | ||
var names = [] | ||
for effect_id in data.keys(): | ||
names.append({"name": data[effect_id].name, "value": effect_id}) | ||
return names | ||
|
||
static func remove_effect(effect_id: String) -> bool: | ||
# Remove a effect data | ||
return data.erase(effect_id) | ||
|
||
static func add_effect(effect: BaseEffect) -> String: | ||
# Add a effect data | ||
|
||
# Check if the effect has an id, if not, generate one | ||
if effect.id == "": | ||
effect.id = IdGenerator.new().generate_id() | ||
|
||
var effect_id = effect.id | ||
data[effect_id] = effect | ||
return effect_id | ||
|
||
static func new_effect() -> BaseEffect: | ||
# Create a new effect | ||
|
||
var id = IdGenerator.new().generate_id() | ||
|
||
var effect = BaseEffect.new() | ||
|
||
effect.id = id | ||
effect.name = "New Effect" | ||
effect.set_custom_name("Effect") | ||
|
||
add_effect(effect) | ||
|
||
return effect | ||
|
||
static func get_effect_by_name(name: String) -> BaseEffect: | ||
# Get a effect by name | ||
for effect in data.values(): | ||
if effect.name == name: | ||
return effect | ||
return null | ||
|
||
static func effects_to_string() -> String: | ||
# Convert the skills data to a string | ||
return var_to_str(data) | ||
|
||
static func has_effect(effect_id: String) -> bool: | ||
# Check if the effect exists | ||
return data.has(effect_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
extends Base | ||
class_name SkillRegister | ||
# This class is used to register all the skills in the game | ||
|
||
func _init(): | ||
need_register = false # Set it to false to avoid registering this class in the class register | ||
|
||
set_custom_name("SkillRegister") | ||
|
||
static var data: Dictionary = {} | ||
|
||
static func set_skills(skills: Dictionary) -> void: | ||
# Set the skills data | ||
data = skills | ||
|
||
static func set_skill(skill_id: String, skill: BaseSkill) -> void: | ||
# Set a skill data | ||
data[skill_id] = skill | ||
|
||
static func get_skill(skill_id: String) -> BaseSkill: | ||
# Get a skill data | ||
return data[skill_id] | ||
|
||
static func get_all_skills() -> Dictionary: | ||
# Get all skills data | ||
return data | ||
|
||
static func get_all_skills_names() -> Array: | ||
# Get all skills names | ||
var names = [] | ||
for skill in data.values(): | ||
names.append(skill.name) | ||
return names | ||
|
||
static func get_all_skills_ids() -> Array: | ||
# Get all skills ids | ||
return data.keys() | ||
|
||
static func get_all_skills_name_by_ids() -> Array: | ||
# Get all skills names by ids | ||
var names = [] | ||
for skill_id in data.keys(): | ||
names.append({"name": data[skill_id].name, "value": skill_id}) | ||
return names | ||
|
||
static func remove_skill(skill_id: String) -> bool: | ||
# Remove a skill data | ||
return data.erase(skill_id) | ||
|
||
static func add_skill(skill: BaseSkill) -> String: | ||
# Add a skill data | ||
|
||
# Check if the skill has an id, if not, generate one | ||
if skill.id == "": | ||
skill.id = IdGenerator.new().generate_id() | ||
|
||
var skill_id = skill.id | ||
data[skill_id] = skill | ||
return skill_id | ||
|
||
static func new_skill() -> BaseSkill: | ||
# Create a new skill | ||
|
||
var id: String = IdGenerator.new().generate_id() | ||
|
||
var skill = BaseSkill.new() | ||
|
||
skill.id = id | ||
skill.name = "Skill" | ||
skill.set_custom_name(id) | ||
|
||
add_skill(skill) | ||
|
||
return skill | ||
|
||
static func skills_to_string() -> String: | ||
# Convert the skills data to a string | ||
return var_to_str(data) | ||
|
||
static func has_skill(skill_id: String) -> bool: | ||
# Check if a skill exists | ||
return data.has(skill_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
extends CustomListTemplateBase | ||
|
||
var idx: String | ||
var label: Label | ||
|
||
|
||
func load(): # This function will be called first when the list is created. | ||
label = get_node("Panel/MarginContainer/HBoxContainer/Label") | ||
pass | ||
|
||
func set_data(_data: Dictionary): # This function will be called at third when the list is created. | ||
|
||
print(_data) | ||
|
||
label.text = _data["val"] | ||
|
||
func set_idx(_idx: String): # This function will be called at second when the list is created. The IDX is the unique id of the item. | ||
idx = _idx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
extends VBoxContainer | ||
class_name CustomListV2Base | ||
|
||
@onready var create_button: Button = get_node("MarginContainer2/menu/create") | ||
@onready var add_button: Button = get_node("MarginContainer2/menu/add") | ||
@onready var title_label: Label = get_node("TitleContainer/Title") | ||
@onready var title_container: HBoxContainer = get_node("TitleContainer") | ||
|
||
|
||
@export var show_create_button: bool = true | ||
@export var show_add_button: bool = true | ||
@export var show_title: bool = true | ||
|
||
@export var title: String = "Title" | ||
|
||
func _ready(): | ||
|
||
if !show_create_button: | ||
create_button.hide() | ||
|
||
if !show_add_button: | ||
add_button.hide() | ||
|
||
if !show_title: | ||
title_container.hide() | ||
|
||
title_label.text = tr(title) |
Oops, something went wrong.