You've already forked rimworld-font-replacer
Initial commit
This commit is contained in:
365
.editorconfig
Normal file
365
.editorconfig
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
# All files
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
max_line_length = 80
|
||||||
|
|
||||||
|
# Xml files
|
||||||
|
[*.xml]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# C# files
|
||||||
|
[*.cs]
|
||||||
|
|
||||||
|
#### Core EditorConfig Options ####
|
||||||
|
|
||||||
|
# Indentation and spacing
|
||||||
|
indent_size = 4
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
|
# New line preferences
|
||||||
|
end_of_line = crlf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
#### .NET Coding Conventions ####
|
||||||
|
[*.{cs,vb}]
|
||||||
|
|
||||||
|
# Organize usings
|
||||||
|
dotnet_separate_import_directive_groups = true
|
||||||
|
dotnet_sort_system_directives_first = true
|
||||||
|
file_header_template = unset
|
||||||
|
|
||||||
|
# this. and Me. preferences
|
||||||
|
dotnet_style_qualification_for_event = false:silent
|
||||||
|
dotnet_style_qualification_for_field = false:silent
|
||||||
|
dotnet_style_qualification_for_method = false:silent
|
||||||
|
dotnet_style_qualification_for_property = false:silent
|
||||||
|
|
||||||
|
# Language keywords vs BCL types preferences
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||||
|
dotnet_style_predefined_type_for_member_access = true:silent
|
||||||
|
|
||||||
|
# Parentheses preferences
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||||
|
|
||||||
|
# Modifier preferences
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||||
|
|
||||||
|
# Expression-level preferences
|
||||||
|
dotnet_style_coalesce_expression = true:suggestion
|
||||||
|
dotnet_style_collection_initializer = true:suggestion
|
||||||
|
dotnet_style_explicit_tuple_names = true:suggestion
|
||||||
|
dotnet_style_null_propagation = true:suggestion
|
||||||
|
dotnet_style_object_initializer = true:suggestion
|
||||||
|
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||||
|
dotnet_style_prefer_auto_properties = true:suggestion
|
||||||
|
dotnet_style_prefer_compound_assignment = true:suggestion
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||||
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||||
|
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
||||||
|
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||||
|
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||||
|
|
||||||
|
# Field preferences
|
||||||
|
dotnet_style_readonly_field = true:warning
|
||||||
|
|
||||||
|
# Parameter preferences
|
||||||
|
dotnet_code_quality_unused_parameters = all:suggestion
|
||||||
|
|
||||||
|
# Suppression preferences
|
||||||
|
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||||
|
|
||||||
|
#### C# Coding Conventions ####
|
||||||
|
[*.cs]
|
||||||
|
|
||||||
|
# var preferences
|
||||||
|
csharp_style_var_elsewhere = false:silent
|
||||||
|
csharp_style_var_for_built_in_types = false:silent
|
||||||
|
csharp_style_var_when_type_is_apparent = false:silent
|
||||||
|
|
||||||
|
# Expression-bodied members
|
||||||
|
csharp_style_expression_bodied_accessors = true:silent
|
||||||
|
csharp_style_expression_bodied_constructors = false:silent
|
||||||
|
csharp_style_expression_bodied_indexers = true:silent
|
||||||
|
csharp_style_expression_bodied_lambdas = true:suggestion
|
||||||
|
csharp_style_expression_bodied_local_functions = false:silent
|
||||||
|
csharp_style_expression_bodied_methods = false:silent
|
||||||
|
csharp_style_expression_bodied_operators = false:silent
|
||||||
|
csharp_style_expression_bodied_properties = true:silent
|
||||||
|
|
||||||
|
# Pattern matching preferences
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||||
|
csharp_style_prefer_not_pattern = true:suggestion
|
||||||
|
csharp_style_prefer_pattern_matching = true:silent
|
||||||
|
csharp_style_prefer_switch_expression = true:suggestion
|
||||||
|
|
||||||
|
# Null-checking preferences
|
||||||
|
csharp_style_conditional_delegate_call = true:suggestion
|
||||||
|
|
||||||
|
# Modifier preferences
|
||||||
|
csharp_prefer_static_local_function = true:warning
|
||||||
|
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||||
|
|
||||||
|
# Code-block preferences
|
||||||
|
csharp_prefer_braces = true:silent
|
||||||
|
csharp_prefer_simple_using_statement = true:suggestion
|
||||||
|
|
||||||
|
# Expression-level preferences
|
||||||
|
csharp_prefer_simple_default_expression = true:suggestion
|
||||||
|
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||||
|
csharp_style_inlined_variable_declaration = true:suggestion
|
||||||
|
csharp_style_pattern_local_over_anonymous_function = true:suggestion
|
||||||
|
csharp_style_prefer_index_operator = true:suggestion
|
||||||
|
csharp_style_prefer_range_operator = true:suggestion
|
||||||
|
csharp_style_throw_expression = true:suggestion
|
||||||
|
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||||
|
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||||
|
|
||||||
|
# 'using' directive preferences
|
||||||
|
csharp_using_directive_placement = outside_namespace:silent
|
||||||
|
|
||||||
|
#### C# Formatting Rules ####
|
||||||
|
|
||||||
|
# New line preferences
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
csharp_new_line_before_members_in_anonymous_types = true
|
||||||
|
csharp_new_line_before_members_in_object_initializers = true
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
|
|
||||||
|
# Indentation preferences
|
||||||
|
csharp_indent_block_contents = true
|
||||||
|
csharp_indent_braces = false
|
||||||
|
csharp_indent_case_contents = true
|
||||||
|
csharp_indent_case_contents_when_block = true
|
||||||
|
csharp_indent_labels = one_less_than_current
|
||||||
|
csharp_indent_switch_labels = true
|
||||||
|
|
||||||
|
# Space preferences
|
||||||
|
csharp_space_after_cast = false
|
||||||
|
csharp_space_after_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_after_comma = true
|
||||||
|
csharp_space_after_dot = false
|
||||||
|
csharp_space_after_keywords_in_control_flow_statements = true
|
||||||
|
csharp_space_after_semicolon_in_for_statement = true
|
||||||
|
csharp_space_around_binary_operators = before_and_after
|
||||||
|
csharp_space_around_declaration_statements = false
|
||||||
|
csharp_space_before_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_before_comma = false
|
||||||
|
csharp_space_before_dot = false
|
||||||
|
csharp_space_before_open_square_brackets = false
|
||||||
|
csharp_space_before_semicolon_in_for_statement = false
|
||||||
|
csharp_space_between_empty_square_brackets = false
|
||||||
|
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||||
|
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||||
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_parentheses = false
|
||||||
|
csharp_space_between_square_brackets = false
|
||||||
|
|
||||||
|
# Wrapping preferences
|
||||||
|
csharp_preserve_single_line_blocks = true
|
||||||
|
csharp_preserve_single_line_statements = true
|
||||||
|
|
||||||
|
#### Naming styles ####
|
||||||
|
[*.{cs,vb}]
|
||||||
|
|
||||||
|
# Naming rules
|
||||||
|
|
||||||
|
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
|
||||||
|
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
|
||||||
|
dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
|
||||||
|
dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
|
||||||
|
dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
|
||||||
|
dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.events_should_be_pascalcase.symbols = events
|
||||||
|
dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
|
||||||
|
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
|
||||||
|
dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
|
||||||
|
dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
|
||||||
|
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
|
||||||
|
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
|
||||||
|
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
|
||||||
|
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
|
||||||
|
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
|
||||||
|
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
|
||||||
|
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
|
||||||
|
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
|
||||||
|
dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
|
||||||
|
|
||||||
|
# Symbol specifications
|
||||||
|
|
||||||
|
dotnet_naming_symbols.interfaces.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.interfaces.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.enums.applicable_kinds = enum
|
||||||
|
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.enums.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.events.applicable_kinds = event
|
||||||
|
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.events.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.methods.applicable_kinds = method
|
||||||
|
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.methods.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.properties.applicable_kinds = property
|
||||||
|
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.properties.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.public_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
|
||||||
|
dotnet_naming_symbols.public_fields.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.private_fields.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
||||||
|
|
||||||
|
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
|
||||||
|
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
|
||||||
|
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.type_parameters.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
|
||||||
|
|
||||||
|
dotnet_naming_symbols.local_variables.applicable_kinds = local
|
||||||
|
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
|
||||||
|
dotnet_naming_symbols.local_variables.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||||
|
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||||
|
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||||
|
|
||||||
|
dotnet_naming_symbols.parameters.applicable_kinds = parameter
|
||||||
|
dotnet_naming_symbols.parameters.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.parameters.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
|
||||||
|
dotnet_naming_symbols.public_constant_fields.required_modifiers = const
|
||||||
|
|
||||||
|
dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
|
||||||
|
dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
|
||||||
|
|
||||||
|
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
|
||||||
|
|
||||||
|
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||||
|
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.local_functions.required_modifiers =
|
||||||
|
|
||||||
|
# Naming styles
|
||||||
|
|
||||||
|
dotnet_naming_style.pascalcase.required_prefix =
|
||||||
|
dotnet_naming_style.pascalcase.required_suffix =
|
||||||
|
dotnet_naming_style.pascalcase.word_separator =
|
||||||
|
dotnet_naming_style.pascalcase.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.ipascalcase.required_prefix = I
|
||||||
|
dotnet_naming_style.ipascalcase.required_suffix =
|
||||||
|
dotnet_naming_style.ipascalcase.word_separator =
|
||||||
|
dotnet_naming_style.ipascalcase.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.tpascalcase.required_prefix = T
|
||||||
|
dotnet_naming_style.tpascalcase.required_suffix =
|
||||||
|
dotnet_naming_style.tpascalcase.word_separator =
|
||||||
|
dotnet_naming_style.tpascalcase.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style._camelcase.required_prefix = _
|
||||||
|
dotnet_naming_style._camelcase.required_suffix =
|
||||||
|
dotnet_naming_style._camelcase.word_separator =
|
||||||
|
dotnet_naming_style._camelcase.capitalization = camel_case
|
||||||
|
|
||||||
|
dotnet_naming_style.camelcase.required_prefix =
|
||||||
|
dotnet_naming_style.camelcase.required_suffix =
|
||||||
|
dotnet_naming_style.camelcase.word_separator =
|
||||||
|
dotnet_naming_style.camelcase.capitalization = camel_case
|
||||||
|
|
||||||
|
dotnet_naming_style.s_camelcase.required_prefix = s_
|
||||||
|
dotnet_naming_style.s_camelcase.required_suffix =
|
||||||
|
dotnet_naming_style.s_camelcase.word_separator =
|
||||||
|
dotnet_naming_style.s_camelcase.capitalization = camel_case
|
||||||
|
|
||||||
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
*.cache
|
||||||
|
*.dtbcache.v2
|
||||||
|
*.pdb
|
||||||
|
*.suo
|
||||||
|
.suo
|
||||||
|
*.testlog
|
||||||
|
*.user
|
||||||
|
*.ide
|
||||||
|
|
||||||
|
**/.vs/Release
|
||||||
|
**/.vs
|
||||||
|
**/obj/Debug
|
||||||
|
**/obj
|
||||||
|
obj/
|
||||||
|
.vs/
|
||||||
|
bin
|
||||||
|
Assemblies/**/*.dll
|
||||||
29
About/About.xml
Normal file
29
About/About.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ModMetaData>
|
||||||
|
<name>RimWorld font replacer</name>
|
||||||
|
<author>rapture.party</author>
|
||||||
|
<modVersion>1.2.0</modVersion>
|
||||||
|
<supportedVersions>
|
||||||
|
<li>1.4</li>
|
||||||
|
<li>1.5</li>
|
||||||
|
<li>1.6</li>
|
||||||
|
</supportedVersions>
|
||||||
|
<url>https://git.rapture.party/rapture-party/rimworld-font-replacer</url>
|
||||||
|
<modDependencies>
|
||||||
|
<li>
|
||||||
|
<packageId>brrainz.harmony</packageId>
|
||||||
|
<displayName>Harmony</displayName>
|
||||||
|
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
|
||||||
|
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
|
||||||
|
</li>
|
||||||
|
</modDependencies>
|
||||||
|
<forceLoadAfter>
|
||||||
|
<li>brrainz.harmony</li>
|
||||||
|
</forceLoadAfter>
|
||||||
|
<packageId>raptureparty.rimworldfontreplacer</packageId>
|
||||||
|
<description>
|
||||||
|
Replace the default UI font of Arial (:nauseated_face:) with any font installed on your system. It can also change the font sizes.
|
||||||
|
|
||||||
|
Note for Mac users: Unity's font loader is bugged and cannot load fonts installed under </System/Library/Fonts/Supplemental>. You can symlink or copy fonts installed here to </Library/Fonts> to access them.
|
||||||
|
</description>
|
||||||
|
</ModMetaData>
|
||||||
BIN
About/preview.png
Normal file
BIN
About/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
11
LICENSE
Normal file
11
LICENSE
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Copyright 2026 rapture.party
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
18
Languages/English/Keyed/Translations.xml
Normal file
18
Languages/English/Keyed/Translations.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<LanguageData>
|
||||||
|
<RWFR.Fonts>Fonts</RWFR.Fonts>
|
||||||
|
<RWFR.ChooseFont>Choose Font</RWFR.ChooseFont>
|
||||||
|
<RWFR.Font_family>Font family</RWFR.Font_family>
|
||||||
|
<RWFR.Font_size>Font size</RWFR.Font_size>
|
||||||
|
<RWFR.Tiny>Tiny</RWFR.Tiny>
|
||||||
|
<RWFR.Small>Small</RWFR.Small>
|
||||||
|
<RWFR.Medium>Medium</RWFR.Medium>
|
||||||
|
<RWFR.Planet>Planet</RWFR.Planet>
|
||||||
|
<RWFR.Not_found>Not found</RWFR.Not_found>
|
||||||
|
<RWFR.Unsupported>Unsupported</RWFR.Unsupported>
|
||||||
|
<RWFR.ChooseFont_For>Choose {0} font</RWFR.ChooseFont_For>
|
||||||
|
<RWFR.Current>Current</RWFR.Current>
|
||||||
|
<RWFR.Filter>Filter</RWFR.Filter>
|
||||||
|
<RWFR.Previews>Previews</RWFR.Previews>
|
||||||
|
<RWFR.Preview_text>Back in Jugust, we delivered oxygen equipment of the same size. 0123456789 $</RWFR.Preview_text>
|
||||||
|
</LanguageData>
|
||||||
18
Languages/Japanese/Keyed/Translations.xml
Normal file
18
Languages/Japanese/Keyed/Translations.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<LanguageData>
|
||||||
|
<RWFR.Fonts>フォント</RWFR.Fonts>
|
||||||
|
<RWFR.ChooseFont>フォントを選択</RWFR.ChooseFont>
|
||||||
|
<RWFR.Font_family>フォントファミリー</RWFR.Font_family>
|
||||||
|
<RWFR.Font_size>フォントサイズ</RWFR.Font_size>
|
||||||
|
<RWFR.Tiny>極小</RWFR.Tiny>
|
||||||
|
<RWFR.Small>小</RWFR.Small>
|
||||||
|
<RWFR.Medium>中</RWFR.Medium>
|
||||||
|
<RWFR.Planet>惑星</RWFR.Planet>
|
||||||
|
<RWFR.Not_found>見つかりません</RWFR.Not_found>
|
||||||
|
<RWFR.Unsupported>非対応</RWFR.Unsupported>
|
||||||
|
<RWFR.ChooseFont_For>{0}フォントを選択</RWFR.ChooseFont_For>
|
||||||
|
<RWFR.Current>現在</RWFR.Current>
|
||||||
|
<RWFR.Filter>絞り込み</RWFR.Filter>
|
||||||
|
<RWFR.Previews>プレビュー</RWFR.Previews>
|
||||||
|
<RWFR.Preview_text>いろはにほへと ちりぬるを わかよたれそ 0123456789 $</RWFR.Preview_text>
|
||||||
|
</LanguageData>
|
||||||
14
LoadFolders.xml
Normal file
14
LoadFolders.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<loadFolders>
|
||||||
|
<v1.4>
|
||||||
|
<li>/</li>
|
||||||
|
<li>1.4</li>
|
||||||
|
</v1.4>
|
||||||
|
<v1.5>
|
||||||
|
<li>/</li>
|
||||||
|
<li>1.5</li>
|
||||||
|
</v1.5>
|
||||||
|
<v1.6>
|
||||||
|
<li>/</li>
|
||||||
|
<li>Current</li>
|
||||||
|
</v1.6>
|
||||||
|
</loadFolders>
|
||||||
8
README.md
Normal file
8
README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# RimWorld font replacer
|
||||||
|
|
||||||
|
This mod allows you to replace the default RimWorld font of Arial (🤢) with any font installed on your system.
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- RimWorld 1.4+
|
||||||
|
- Harmony ([GitHub](https://github.com/pardeike/HarmonyRimWorld), [Steam Workshop](https://steamcommunity.com/workshop/filedetails/?id=2009463077))
|
||||||
121
Source/CustomGUIStyles.cs
Normal file
121
Source/CustomGUIStyles.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
using Verse;
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace raptureparty.RimWorldFontReplacer
|
||||||
|
{
|
||||||
|
[StaticConstructorOnStartup]
|
||||||
|
static class CustomGUIStyles
|
||||||
|
{
|
||||||
|
public static GUIStyle[] fontStyles;
|
||||||
|
|
||||||
|
public static GUIStyle[] textFieldStyles;
|
||||||
|
|
||||||
|
public static GUIStyle[] textAreaStyles;
|
||||||
|
|
||||||
|
public static GUIStyle[] textAreaReadOnlyStyles;
|
||||||
|
|
||||||
|
public static void UpdateFonts()
|
||||||
|
{
|
||||||
|
if (fontStyles != null)
|
||||||
|
{
|
||||||
|
fontStyles[0].font = FontLoader.FontTiny;
|
||||||
|
fontStyles[0].fontSize = FontLoader.FontTinySize;
|
||||||
|
fontStyles[1].font = FontLoader.FontSmall;
|
||||||
|
fontStyles[1].fontSize = FontLoader.FontSmallSize;
|
||||||
|
fontStyles[2].font = FontLoader.FontMedium;
|
||||||
|
fontStyles[2].fontSize = FontLoader.FontMediumSize;
|
||||||
|
}
|
||||||
|
if (textFieldStyles != null)
|
||||||
|
{
|
||||||
|
textFieldStyles[0].font = FontLoader.FontTiny;
|
||||||
|
textFieldStyles[0].fontSize = FontLoader.FontTinySize;
|
||||||
|
textFieldStyles[1].font = FontLoader.FontSmall;
|
||||||
|
textFieldStyles[1].fontSize = FontLoader.FontSmallSize;
|
||||||
|
textFieldStyles[2].font = FontLoader.FontMedium;
|
||||||
|
textFieldStyles[2].fontSize = FontLoader.FontMediumSize;
|
||||||
|
}
|
||||||
|
if (textAreaStyles != null)
|
||||||
|
{
|
||||||
|
textAreaStyles[0].font = FontLoader.FontTiny;
|
||||||
|
textAreaStyles[0].fontSize = FontLoader.FontTinySize;
|
||||||
|
textAreaStyles[1].font = FontLoader.FontSmall;
|
||||||
|
textAreaStyles[1].fontSize = FontLoader.FontSmallSize;
|
||||||
|
textAreaStyles[2].font = FontLoader.FontMedium;
|
||||||
|
textAreaStyles[2].fontSize = FontLoader.FontMediumSize;
|
||||||
|
}
|
||||||
|
if (textAreaReadOnlyStyles != null)
|
||||||
|
{
|
||||||
|
textAreaReadOnlyStyles[0].font = FontLoader.FontTiny;
|
||||||
|
textAreaReadOnlyStyles[0].fontSize = FontLoader.FontTinySize;
|
||||||
|
textAreaReadOnlyStyles[1].font = FontLoader.FontSmall;
|
||||||
|
textAreaReadOnlyStyles[1].fontSize = FontLoader.FontSmallSize;
|
||||||
|
textAreaReadOnlyStyles[2].font = FontLoader.FontMedium;
|
||||||
|
textAreaReadOnlyStyles[2].fontSize = FontLoader.FontMediumSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Create()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fontStyles = new GUIStyle[3];
|
||||||
|
textFieldStyles = new GUIStyle[3];
|
||||||
|
textAreaStyles = new GUIStyle[3];
|
||||||
|
textAreaReadOnlyStyles = new GUIStyle[3];
|
||||||
|
fontStyles[0] = new GUIStyle(GUI.skin.label);
|
||||||
|
fontStyles[0].font = FontLoader.FontTiny;
|
||||||
|
fontStyles[0].fontSize = FontLoader.FontTinySize;
|
||||||
|
fontStyles[1] = new GUIStyle(GUI.skin.label);
|
||||||
|
fontStyles[1].font = FontLoader.FontSmall;
|
||||||
|
fontStyles[1].fontSize = FontLoader.FontSmallSize;
|
||||||
|
fontStyles[1].contentOffset = new Vector2(0f, -1f);
|
||||||
|
fontStyles[2] = new GUIStyle(GUI.skin.label);
|
||||||
|
fontStyles[2].font = FontLoader.FontMedium;
|
||||||
|
fontStyles[2].fontSize = FontLoader.FontMediumSize;
|
||||||
|
for (int i = 0; i < textFieldStyles.Length; i++)
|
||||||
|
{
|
||||||
|
textFieldStyles[i] = new GUIStyle(GUI.skin.textField);
|
||||||
|
textFieldStyles[i].alignment = TextAnchor.MiddleLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
textFieldStyles[0].font = FontLoader.FontTiny;
|
||||||
|
textFieldStyles[0].fontSize = FontLoader.FontTinySize;
|
||||||
|
textFieldStyles[1].font = FontLoader.FontSmall;
|
||||||
|
textFieldStyles[1].fontSize = FontLoader.FontSmallSize;
|
||||||
|
textFieldStyles[2].font = FontLoader.FontMedium;
|
||||||
|
textFieldStyles[2].fontSize = FontLoader.FontMediumSize;
|
||||||
|
for (int j = 0; j < textAreaStyles.Length; j++)
|
||||||
|
{
|
||||||
|
textAreaStyles[j] = new GUIStyle(textFieldStyles[j])
|
||||||
|
{
|
||||||
|
fontSize = textFieldStyles[j].fontSize,
|
||||||
|
alignment = TextAnchor.UpperLeft,
|
||||||
|
wordWrap = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < textAreaReadOnlyStyles.Length; k++)
|
||||||
|
{
|
||||||
|
textAreaReadOnlyStyles[k] = new GUIStyle(textAreaStyles[k]);
|
||||||
|
textAreaReadOnlyStyles[k].fontSize = textAreaStyles[k].fontSize;
|
||||||
|
GUIStyle obj = textAreaReadOnlyStyles[k];
|
||||||
|
obj.normal.background = null;
|
||||||
|
obj.active.background = null;
|
||||||
|
obj.onHover.background = null;
|
||||||
|
obj.hover.background = null;
|
||||||
|
obj.onFocused.background = null;
|
||||||
|
obj.focused.background = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Message("Could not create GUI styles, " + ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
110
Source/FontLoader.cs
Normal file
110
Source/FontLoader.cs
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace raptureparty.RimWorldFontReplacer
|
||||||
|
{
|
||||||
|
[StaticConstructorOnStartup]
|
||||||
|
class FontLoader
|
||||||
|
{
|
||||||
|
public static string TargetTinyFontName;
|
||||||
|
|
||||||
|
public static string TargetSmallFontName;
|
||||||
|
|
||||||
|
public static string TargetMediumFontName;
|
||||||
|
|
||||||
|
public static string TargetPlanetFontName;
|
||||||
|
|
||||||
|
public static int FontTinySize = 11;
|
||||||
|
|
||||||
|
public static int FontSmallSize = 14;
|
||||||
|
|
||||||
|
public static int FontMediumSize = 18;
|
||||||
|
|
||||||
|
static private Font s_fontTiny;
|
||||||
|
static private string s_fontTinySearchedName;
|
||||||
|
static public bool FontTinyFound
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private Font s_fontSmall;
|
||||||
|
static private string s_fontSmallSearchedName;
|
||||||
|
static public bool FontSmallFound
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private Font s_fontMedium;
|
||||||
|
static private string s_fontMediumSearchedName;
|
||||||
|
static public bool FontMediumFound
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private Font s_fontPlanet;
|
||||||
|
static private string s_fontPlanetSearchedName;
|
||||||
|
static public bool FontPlanetFound
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public Font FontTiny
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (s_fontTinySearchedName != TargetTinyFontName)
|
||||||
|
{
|
||||||
|
s_fontTiny = Font.CreateDynamicFontFromOSFont(TargetTinyFontName, FontTinySize);
|
||||||
|
s_fontTinySearchedName = TargetTinyFontName;
|
||||||
|
FontTinyFound = Font.GetOSInstalledFontNames().Contains(TargetTinyFontName);
|
||||||
|
}
|
||||||
|
return FontTinyFound ? s_fontTiny : Text.fontStyles[0].font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public Font FontSmall
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (s_fontSmallSearchedName != TargetSmallFontName)
|
||||||
|
{
|
||||||
|
s_fontSmall = Font.CreateDynamicFontFromOSFont(TargetSmallFontName, FontSmallSize);
|
||||||
|
s_fontSmallSearchedName = TargetSmallFontName;
|
||||||
|
FontSmallFound = Font.GetOSInstalledFontNames().Contains(TargetSmallFontName);
|
||||||
|
}
|
||||||
|
return FontSmallFound ? s_fontSmall : Text.fontStyles[1].font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public Font FontMedium
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (s_fontMediumSearchedName != TargetMediumFontName)
|
||||||
|
{
|
||||||
|
s_fontMedium = Font.CreateDynamicFontFromOSFont(TargetMediumFontName, FontMediumSize);
|
||||||
|
s_fontMediumSearchedName = TargetMediumFontName;
|
||||||
|
FontMediumFound = Font.GetOSInstalledFontNames().Contains(TargetMediumFontName); ;
|
||||||
|
}
|
||||||
|
return FontMediumFound ? s_fontMedium : Text.fontStyles[2].font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public Font FontPlanet
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (s_fontPlanetSearchedName != TargetPlanetFontName)
|
||||||
|
{
|
||||||
|
s_fontPlanet = Font.CreateDynamicFontFromOSFont(TargetPlanetFontName, Text.fontStyles[2].font.fontSize); // TODO: find correct size
|
||||||
|
s_fontPlanetSearchedName = TargetPlanetFontName;
|
||||||
|
FontPlanetFound = Font.GetOSInstalledFontNames().Contains(TargetPlanetFontName); ;
|
||||||
|
}
|
||||||
|
return FontPlanetFound ? s_fontPlanet : Text.fontStyles[2].font; // TODO: find correct size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
160
Source/FontPatches.cs
Normal file
160
Source/FontPatches.cs
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
using Verse;
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using RimWorld.Planet;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
namespace raptureparty.RimWorldFontReplacer
|
||||||
|
{
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class Text_CurFontStyle_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(Text), nameof(Text.CurFontStyle), MethodType.Getter)]
|
||||||
|
public static bool Prefix(ref GUIStyle __result)
|
||||||
|
{
|
||||||
|
if (CustomGUIStyles.fontStyles == null)
|
||||||
|
{
|
||||||
|
CustomGUIStyles.Create();
|
||||||
|
}
|
||||||
|
GUIStyle guistyle;
|
||||||
|
switch (Text.Font)
|
||||||
|
{
|
||||||
|
case GameFont.Tiny:
|
||||||
|
guistyle = CustomGUIStyles.fontStyles[0];
|
||||||
|
break;
|
||||||
|
case GameFont.Small:
|
||||||
|
guistyle = CustomGUIStyles.fontStyles[1];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case GameFont.Medium:
|
||||||
|
guistyle = CustomGUIStyles.fontStyles[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
guistyle.alignment = Text.Anchor;
|
||||||
|
guistyle.wordWrap = Text.WordWrap;
|
||||||
|
__result = guistyle;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class Text_CurTextFieldStyle_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(Text), nameof(Text.CurTextFieldStyle), MethodType.Getter)]
|
||||||
|
static bool Prefix(ref GUIStyle __result)
|
||||||
|
{
|
||||||
|
if (CustomGUIStyles.fontStyles == null)
|
||||||
|
{
|
||||||
|
CustomGUIStyles.Create();
|
||||||
|
}
|
||||||
|
GUIStyle guistyle;
|
||||||
|
switch (Text.Font)
|
||||||
|
{
|
||||||
|
case GameFont.Tiny:
|
||||||
|
guistyle = CustomGUIStyles.textFieldStyles[0];
|
||||||
|
break;
|
||||||
|
case GameFont.Small:
|
||||||
|
guistyle = CustomGUIStyles.textFieldStyles[1];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case GameFont.Medium:
|
||||||
|
guistyle = CustomGUIStyles.textFieldStyles[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__result = guistyle;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class Text_CurTextAreaStyle_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(Text), nameof(Text.CurTextAreaStyle), MethodType.Getter)]
|
||||||
|
static bool Prefix(ref GUIStyle __result)
|
||||||
|
{
|
||||||
|
if (CustomGUIStyles.fontStyles == null)
|
||||||
|
{
|
||||||
|
CustomGUIStyles.Create();
|
||||||
|
}
|
||||||
|
GUIStyle guistyle;
|
||||||
|
switch (Text.Font)
|
||||||
|
{
|
||||||
|
case GameFont.Tiny:
|
||||||
|
guistyle = CustomGUIStyles.textAreaStyles[0];
|
||||||
|
break;
|
||||||
|
case GameFont.Small:
|
||||||
|
guistyle = CustomGUIStyles.textAreaStyles[1];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case GameFont.Medium:
|
||||||
|
guistyle = CustomGUIStyles.textAreaStyles[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__result = guistyle;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class Text_CurTextAreaReadOnlyStyle_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(Text), nameof(Text.CurTextAreaReadOnlyStyle), MethodType.Getter)]
|
||||||
|
static bool Prefix(ref GUIStyle __result)
|
||||||
|
{
|
||||||
|
if (CustomGUIStyles.fontStyles == null)
|
||||||
|
{
|
||||||
|
CustomGUIStyles.Create();
|
||||||
|
}
|
||||||
|
GUIStyle guistyle;
|
||||||
|
switch (Text.Font)
|
||||||
|
{
|
||||||
|
case GameFont.Tiny:
|
||||||
|
guistyle = CustomGUIStyles.textAreaReadOnlyStyles[0];
|
||||||
|
break;
|
||||||
|
case GameFont.Small:
|
||||||
|
guistyle = CustomGUIStyles.textAreaReadOnlyStyles[1];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case GameFont.Medium:
|
||||||
|
guistyle = CustomGUIStyles.textAreaReadOnlyStyles[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__result = guistyle;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class WorldFeatureTextMesh_TextMeshLegacy_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(WorldFeatureTextMesh_Legacy), nameof(WorldFeatureTextMesh_Legacy.Init))]
|
||||||
|
public static void Postfix(ref TextMesh ___textMesh)
|
||||||
|
{
|
||||||
|
Log.Message("Patching TextMesh init");
|
||||||
|
___textMesh.font = FontLoader.FontMedium;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
static class WorldFeatureTextMesh_TextMeshPro_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(WorldFeatureTextMesh_TextMeshPro), nameof(WorldFeatureTextMesh_TextMeshPro.Init))]
|
||||||
|
public static void Postfix(ref TextMeshPro ___textMesh)
|
||||||
|
{
|
||||||
|
Log.Message("Patching TextMeshPro init");
|
||||||
|
TMP_FontAsset asset = TMP_FontAsset.CreateFontAsset(FontLoader.FontPlanet);
|
||||||
|
___textMesh.font = asset;
|
||||||
|
___textMesh.UpdateFontAsset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Source/Main.cs
Normal file
27
Source/Main.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
using Verse;
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace raptureparty.RimWorldFontReplacer
|
||||||
|
{
|
||||||
|
[StaticConstructorOnStartup]
|
||||||
|
class RimWorldFontReplacer : Mod
|
||||||
|
{
|
||||||
|
public RimWorldFontReplacer(ModContentPack content) : base(content)
|
||||||
|
{
|
||||||
|
base.GetSettings<Settings>();
|
||||||
|
var inst = new Harmony("rimworld.raptureparty.RimWorldFontReplacer");
|
||||||
|
inst.PatchAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save() => LoadedModManager.GetMod<RimWorldFontReplacer>().GetSettings<Settings>().Write();
|
||||||
|
|
||||||
|
public override string SettingsCategory() => "RimWorld Font Replacer";
|
||||||
|
|
||||||
|
public override void DoSettingsWindowContents(Rect inRect) => Settings.Build(inRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
287
Source/RimWorldFontReplacer.csproj
Normal file
287
Source/RimWorldFontReplacer.csproj
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
|
||||||
|
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
|
||||||
|
<OutputPath>../Assemblies/Current</OutputPath>
|
||||||
|
<DebugSymbols>false</DebugSymbols>
|
||||||
|
<DebugType>None</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
RimWorld DLL references.
|
||||||
|
To override:
|
||||||
|
dotnet build -p:RimWorldManaged=/path/to/Managed -p:HarmonyAssemblies=/path/to/0Harmony
|
||||||
|
-->
|
||||||
|
<PropertyGroup>
|
||||||
|
<RimWorldManaged Condition="'$(RimWorldManaged)' == ''">/Applications/RimWorld.app/Contents/Resources/Data/Managed</RimWorldManaged>
|
||||||
|
<HarmonyAssemblies Condition="'$(HarmonyAssemblies)' == ''">/Applications/RimWorld.app/Mods/HarmonyMod/Current/Assemblies</HarmonyAssemblies>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="0Harmony">
|
||||||
|
<HintPath>$(HarmonyAssemblies)/0Harmony.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Assembly-CSharp">
|
||||||
|
<HintPath>$(RimWorldManaged)\Assembly-CSharp.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Unity.TextMeshPro">
|
||||||
|
<HintPath>$(RimWorldManaged)\Unity.TextMeshPro.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AccessibilityModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.AccessibilityModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AIModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.AIModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AndroidJNIModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.AndroidJNIModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AnimationModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.AnimationModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ARModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ARModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AssetBundleModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AudioModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.AudioModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ClothModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ClothModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ClusterInputModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ClusterInputModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ClusterRendererModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ClusterRendererModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.CoreModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.CoreModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.CrashReportingModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.CrashReportingModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.DirectorModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.DirectorModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.DSPGraphModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.DSPGraphModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.GameCenterModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.GameCenterModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.GridModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.GridModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.HotReloadModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.HotReloadModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ImageConversionModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ImageConversionModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.IMGUIModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.IMGUIModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.InputLegacyModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.InputModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.InputModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.JSONSerializeModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.JSONSerializeModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.LocalizationModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.LocalizationModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ParticleSystemModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ParticleSystemModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.PerformanceReportingModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.PerformanceReportingModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.Physics2DModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.Physics2DModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.PhysicsModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ProfilerModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ProfilerModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.ScreenCaptureModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.ScreenCaptureModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.SharedInternalsModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.SharedInternalsModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.SpriteMaskModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.SpriteMaskModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.SpriteShapeModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.SpriteShapeModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.StreamingModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.StreamingModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.SubstanceModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.SubstanceModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TerrainModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.TerrainModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TerrainPhysicsModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.TerrainPhysicsModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TilemapModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.TilemapModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TLSModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.TLSModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UI">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UI.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UIElementsModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UIElementsModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UIModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UIModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UmbraModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UmbraModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityAnalyticsModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityAnalyticsModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityConnectModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityConnectModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityTestProtocolModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityTestProtocolModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityWebRequestAssetBundleModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityWebRequestAssetBundleModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityWebRequestModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityWebRequestModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityWebRequestTextureModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityWebRequestTextureModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.VehiclesModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.VehiclesModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.VFXModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.VFXModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.VideoModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.VideoModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.VRModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.VRModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.WindModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.WindModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.XRModule">
|
||||||
|
<HintPath>$(RimWorldManaged)\UnityEngine.XRModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="CustomGUIStyles.cs" />
|
||||||
|
<Compile Include="FontLoader.cs" />
|
||||||
|
<Compile Include="FontPatches.cs" />
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="Settings.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Target Name="CopyToVersionDirs" AfterTargets="Build">
|
||||||
|
<ItemGroup>
|
||||||
|
<BuiltAssemblies Include="$(OutputPath)\*" />
|
||||||
|
</ItemGroup>
|
||||||
|
<MakeDir Directories="$(OutputPath)\..\1.4;$(OutputPath)\..\1.5" />
|
||||||
|
<Copy SourceFiles="@(BuiltAssemblies)" DestinationFolder="$(OutputPath)\..\1.4" />
|
||||||
|
<Copy SourceFiles="@(BuiltAssemblies)" DestinationFolder="$(OutputPath)\..\1.5" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
257
Source/Settings.cs
Normal file
257
Source/Settings.cs
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using Verse;
|
||||||
|
using System;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace raptureparty.RimWorldFontReplacer
|
||||||
|
{
|
||||||
|
|
||||||
|
public class FontListDialog : Window
|
||||||
|
{
|
||||||
|
protected Vector2 scrollPosition = Vector2.zero;
|
||||||
|
|
||||||
|
protected string[] _fonts = new string[0];
|
||||||
|
|
||||||
|
protected float bottomAreaHeight;
|
||||||
|
|
||||||
|
protected string _filterText = "";
|
||||||
|
|
||||||
|
private string _prevFilterText = null;
|
||||||
|
|
||||||
|
public uint FontIndex = 0;
|
||||||
|
|
||||||
|
public FontListDialog()
|
||||||
|
{
|
||||||
|
doCloseButton = true;
|
||||||
|
doCloseX = true;
|
||||||
|
forcePause = true;
|
||||||
|
absorbInputAroundWindow = true;
|
||||||
|
closeOnAccept = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PreOpen()
|
||||||
|
{
|
||||||
|
base.PreOpen();
|
||||||
|
_fonts = Font.GetOSInstalledFontNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PostClose()
|
||||||
|
{
|
||||||
|
base.PostClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CurrentFontName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (FontIndex)
|
||||||
|
{
|
||||||
|
case 0: return FontLoader.TargetTinyFontName;
|
||||||
|
case 1: return FontLoader.TargetSmallFontName;
|
||||||
|
case 2: return FontLoader.TargetMediumFontName;
|
||||||
|
case 3: return FontLoader.TargetPlanetFontName;
|
||||||
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string FontTypeLabel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (FontIndex)
|
||||||
|
{
|
||||||
|
case 0: return "RWFR.Tiny".Translate();
|
||||||
|
case 1: return "RWFR.Small".Translate();
|
||||||
|
case 2: return "RWFR.Medium".Translate();
|
||||||
|
case 3: return "RWFR.Planet".Translate();
|
||||||
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DoWindowContents(Rect inRect)
|
||||||
|
{
|
||||||
|
float y = inRect.y;
|
||||||
|
|
||||||
|
// Title
|
||||||
|
Verse.Text.Font = GameFont.Medium;
|
||||||
|
Widgets.Label(new Rect(inRect.x, y, inRect.width, 32f), "RWFR.ChooseFont_For".Translate(FontTypeLabel));
|
||||||
|
Verse.Text.Font = GameFont.Small;
|
||||||
|
y += 36f;
|
||||||
|
|
||||||
|
// Current selection
|
||||||
|
string current = CurrentFontName;
|
||||||
|
if (!string.IsNullOrEmpty(current))
|
||||||
|
{
|
||||||
|
GUI.color = new Color(0.7f, 0.7f, 0.7f);
|
||||||
|
Widgets.Label(new Rect(inRect.x, y, inRect.width, 24f), "RWFR.Current".Translate() + ": " + current);
|
||||||
|
GUI.color = Color.white;
|
||||||
|
y += 26f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter box
|
||||||
|
Widgets.Label(new Rect(inRect.x, y + 2f, 60f, 28f), "RWFR.Filter".Translate());
|
||||||
|
string newFilter = Widgets.TextField(new Rect(inRect.x + 64f, y, inRect.width - 64f, 28f), _filterText);
|
||||||
|
if (newFilter != _prevFilterText)
|
||||||
|
{
|
||||||
|
scrollPosition = Vector2.zero;
|
||||||
|
_prevFilterText = newFilter;
|
||||||
|
}
|
||||||
|
_filterText = newFilter;
|
||||||
|
y += 34f;
|
||||||
|
|
||||||
|
// Build filtered list
|
||||||
|
string[] filtered = string.IsNullOrEmpty(_filterText)
|
||||||
|
? _fonts
|
||||||
|
: System.Array.FindAll(_fonts, f => f.IndexOf(_filterText, StringComparison.OrdinalIgnoreCase) >= 0);
|
||||||
|
|
||||||
|
float listHeight = filtered.Length * 36f;
|
||||||
|
Rect outRect = new Rect(inRect.x, y, inRect.width, inRect.height - (y - inRect.y) - bottomAreaHeight - 50f);
|
||||||
|
Rect viewRect = new Rect(0f, 0f, outRect.width - 16f, listHeight);
|
||||||
|
|
||||||
|
Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect, true);
|
||||||
|
|
||||||
|
for (int i = 0; i < filtered.Length; i++)
|
||||||
|
{
|
||||||
|
bool isSelected = filtered[i] == current;
|
||||||
|
if (isSelected)
|
||||||
|
GUI.color = new Color(0.8f, 1f, 0.8f);
|
||||||
|
|
||||||
|
if (Widgets.ButtonText(new Rect(0f, i * 36f, viewRect.width, 26f), filtered[i]))
|
||||||
|
{
|
||||||
|
switch (FontIndex)
|
||||||
|
{
|
||||||
|
case 0: FontLoader.TargetTinyFontName = filtered[i]; break;
|
||||||
|
case 1: FontLoader.TargetSmallFontName = filtered[i]; break;
|
||||||
|
case 2: FontLoader.TargetMediumFontName = filtered[i]; break;
|
||||||
|
case 3: FontLoader.TargetPlanetFontName = filtered[i]; break;
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSelected)
|
||||||
|
GUI.color = Color.white;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widgets.EndScrollView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Settings : ModSettings
|
||||||
|
{
|
||||||
|
public static Vector2 scrollPosition = Vector2.zero;
|
||||||
|
|
||||||
|
private static string s_fontTinySizeBuffer = FontLoader.FontTinySize.ToString();
|
||||||
|
private static string s_fontSmallSizeBuffer = FontLoader.FontSmallSize.ToString();
|
||||||
|
private static string s_fontMediumSizeBuffer = FontLoader.FontMediumSize.ToString();
|
||||||
|
|
||||||
|
public static void Build(Rect inRect)
|
||||||
|
{
|
||||||
|
|
||||||
|
inRect.yMin += 15f;
|
||||||
|
inRect.yMax -= 15f;
|
||||||
|
|
||||||
|
var defaultColumnWidth = inRect.width - 50;
|
||||||
|
Listing_Standard list = new Listing_Standard() { ColumnWidth = defaultColumnWidth };
|
||||||
|
|
||||||
|
var outRect = new Rect(inRect.x, inRect.y, inRect.width, inRect.height);
|
||||||
|
var scrollRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + 200);
|
||||||
|
Widgets.BeginScrollView(outRect, ref scrollPosition, scrollRect, true);
|
||||||
|
|
||||||
|
list.Begin(scrollRect);
|
||||||
|
|
||||||
|
list.Label("RWFR.Fonts".Translate());
|
||||||
|
list.GapLine();
|
||||||
|
|
||||||
|
list.Label("RWFR.Tiny".Translate());
|
||||||
|
list.Indent();
|
||||||
|
FontLoader.TargetTinyFontName = list.TextEntryLabeled("RWFR.Font_family".Translate(), FontLoader.TargetTinyFontName, 1);
|
||||||
|
list.TextFieldNumericLabeled<int>("RWFR.Font_size".Translate(), ref FontLoader.FontTinySize, ref s_fontTinySizeBuffer, 1);
|
||||||
|
if (list.ButtonTextLabeled("", "RWFR.ChooseFont".Translate()))
|
||||||
|
{
|
||||||
|
var selector = new FontListDialog { FontIndex = 0 };
|
||||||
|
Find.WindowStack.Add(selector);
|
||||||
|
}
|
||||||
|
list.Label(FontLoader.FontTinyFound ? "" : (string)"RWFR.Not_found".Translate());
|
||||||
|
list.Outdent();
|
||||||
|
|
||||||
|
list.Label("RWFR.Small".Translate());
|
||||||
|
list.Indent();
|
||||||
|
FontLoader.TargetSmallFontName = list.TextEntryLabeled("RWFR.Font_family".Translate(), FontLoader.TargetSmallFontName, 1);
|
||||||
|
list.TextFieldNumericLabeled<int>("RWFR.Font_size".Translate(), ref FontLoader.FontSmallSize, ref s_fontSmallSizeBuffer, 1);
|
||||||
|
if (list.ButtonTextLabeled("", "RWFR.ChooseFont".Translate()))
|
||||||
|
{
|
||||||
|
var selector = new FontListDialog { FontIndex = 1 };
|
||||||
|
Find.WindowStack.Add(selector);
|
||||||
|
}
|
||||||
|
list.Label(FontLoader.FontSmallFound ? "" : (string)"RWFR.Not_found".Translate());
|
||||||
|
list.Outdent();
|
||||||
|
|
||||||
|
list.Label("RWFR.Medium".Translate());
|
||||||
|
list.Indent();
|
||||||
|
FontLoader.TargetMediumFontName = list.TextEntryLabeled("RWFR.Font_family".Translate(), FontLoader.TargetMediumFontName, 1);
|
||||||
|
list.TextFieldNumericLabeled<int>("RWFR.Font_size".Translate(), ref FontLoader.FontMediumSize, ref s_fontMediumSizeBuffer, 1);
|
||||||
|
if (list.ButtonTextLabeled("", "RWFR.ChooseFont".Translate()))
|
||||||
|
{
|
||||||
|
var selector = new FontListDialog { FontIndex = 2 };
|
||||||
|
Find.WindowStack.Add(selector);
|
||||||
|
}
|
||||||
|
list.Label(FontLoader.FontMediumFound ? "" : (string)"RWFR.Not_found".Translate());
|
||||||
|
list.Outdent();
|
||||||
|
|
||||||
|
list.Gap(12f);
|
||||||
|
list.Label("RWFR.Previews".Translate());
|
||||||
|
list.GapLine();
|
||||||
|
|
||||||
|
string previewText = "RWFR.Preview_text".Translate();
|
||||||
|
|
||||||
|
list.Label("RWFR.Tiny".Translate(), 28f);
|
||||||
|
list.Indent();
|
||||||
|
if (CustomGUIStyles.fontStyles != null)
|
||||||
|
{
|
||||||
|
float h = Mathf.Max(FontLoader.FontTinySize, 12) + 10f;
|
||||||
|
GUI.Label(list.GetRect(h), previewText, CustomGUIStyles.fontStyles[0]);
|
||||||
|
}
|
||||||
|
list.Outdent();
|
||||||
|
|
||||||
|
list.Label("RWFR.Small".Translate(), 28f);
|
||||||
|
list.Indent();
|
||||||
|
if (CustomGUIStyles.fontStyles != null)
|
||||||
|
{
|
||||||
|
float h = Mathf.Max(FontLoader.FontSmallSize, 12) + 10f;
|
||||||
|
GUI.Label(list.GetRect(h), previewText, CustomGUIStyles.fontStyles[1]);
|
||||||
|
}
|
||||||
|
list.Outdent();
|
||||||
|
|
||||||
|
list.Label("RWFR.Medium".Translate(), 28f);
|
||||||
|
list.Indent();
|
||||||
|
if (CustomGUIStyles.fontStyles != null)
|
||||||
|
{
|
||||||
|
float h = Mathf.Max(FontLoader.FontMediumSize, 12) + 10f;
|
||||||
|
GUI.Label(list.GetRect(h), previewText, CustomGUIStyles.fontStyles[2]);
|
||||||
|
}
|
||||||
|
list.Outdent();
|
||||||
|
|
||||||
|
list.End();
|
||||||
|
Widgets.EndScrollView();
|
||||||
|
CustomGUIStyles.UpdateFonts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ExposeData()
|
||||||
|
{
|
||||||
|
base.ExposeData();
|
||||||
|
Scribe_Values.Look(ref FontLoader.FontTinySize, "fontSizeTiny", 11);
|
||||||
|
Scribe_Values.Look(ref FontLoader.FontSmallSize, "fontSizeSmall", 14);
|
||||||
|
Scribe_Values.Look(ref FontLoader.FontMediumSize, "fontSizeMedium", 18);
|
||||||
|
Scribe_Values.Look(ref FontLoader.TargetTinyFontName, "fontNameTiny", "Helvetica");
|
||||||
|
Scribe_Values.Look(ref FontLoader.TargetSmallFontName, "fontNameSmall", "Helvetica");
|
||||||
|
Scribe_Values.Look(ref FontLoader.TargetMediumFontName, "fontNameMedium", "Helvetica");
|
||||||
|
Scribe_Values.Look(ref FontLoader.TargetPlanetFontName, "fontNamePlanet", "Helvetica");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
omnisharp.json
Normal file
17
omnisharp.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"fileOptions": {
|
||||||
|
"systemExcludeSearchPatterns": [
|
||||||
|
"**/node_modules/**/*",
|
||||||
|
"**/bin/**/*",
|
||||||
|
"**/obj/**/*"
|
||||||
|
],
|
||||||
|
"excludeSearchPatterns": []
|
||||||
|
},
|
||||||
|
"msbuild": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"FormattingOptions": {
|
||||||
|
"EnableEditorConfigSupport": true,
|
||||||
|
"OrganizeImports": true
|
||||||
|
}
|
||||||
|
}
|
||||||
39
rimworld-font-replacer.sln
Normal file
39
rimworld-font-replacer.sln
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.0.31903.59
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{B8EFCA5F-814F-285C-A8CB-F00F14650265}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RimWorldFontReplacer", "Source\RimWorldFontReplacer.csproj", "{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{FEDB45A9-FE14-4856-BEC0-0FF75B120BE6} = {B8EFCA5F-814F-285C-A8CB-F00F14650265}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
Reference in New Issue
Block a user