{"id":21358830,"url":"https://github.com/gameframex/com.gameframex.unity.setting","last_synced_at":"2025-03-16T06:17:52.811Z","repository":{"id":232570549,"uuid":"784171419","full_name":"GameFrameX/com.gameframex.unity.setting","owner":"GameFrameX","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-20T12:09:40.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-20T13:25:08.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GameFrameX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-09T10:24:27.000Z","updated_at":"2025-01-20T12:09:42.000Z","dependencies_parsed_at":"2024-04-10T10:56:46.327Z","dependency_job_id":"e100b10b-f1ec-4b4c-9d4b-849566ef9102","html_url":"https://github.com/GameFrameX/com.gameframex.unity.setting","commit_stats":null,"previous_names":["alianblank/com.alianblank.gameframex.unity.setting","gameframex/com.gameframex.unity.setting"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.setting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.setting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.setting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.setting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GameFrameX","download_url":"https://codeload.github.com/GameFrameX/com.gameframex.unity.setting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830950,"owners_count":20354856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T05:22:31.654Z","updated_at":"2025-03-16T06:17:52.789Z","avatar_url":"https://github.com/GameFrameX.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿## HOMEPAGE\n\nGameFrameX 的 Setting 配置信息组件\n\n**Setting 配置信息组件 (Setting Component)** - 负责管理游戏的配置信息，允许您保存和获取各种类型的配置数据。\n\n# 使用文档(文档编写于GPT4)\n\n# SettingComponent 类说明文档\n\n**SettingComponent** 是游戏框架的一个核心组件，它负责管理游戏的配置信息，允许您保存和获取各种类型的配置数据。\n\n## 功能概述\n\n- 负责管理游戏设置，提供保存和加载的功能。\n- 提供对设置项的查询、添加、删除操作。\n- 支持不同数据类型的设置项，如布尔值、整数、浮点数、字符串及对象。\n\n## 主要方法和属性\n\n### 属性\n\n- **Count**  \n  获取游戏配置项的数量。\n\n### 方法\n\n- **Awake()**  \n  初始化设置管理器和设置助手。\n\n- **Start()**  \n  负责加载设置。\n\n- **Save()**  \n  保存当前所有游戏配置项。\n\n- **GetAllSettingNames() / GetAllSettingNames(List\u003cstring\u003e)**  \n  获取所有游戏配置项的名称，可选列表形式返回。\n\n- **HasSetting(string)**  \n  检查是否存在指定名称的游戏配置项。\n\n- **RemoveSetting(string)**  \n  移除指定的游戏配置项。\n\n- **RemoveAllSettings()**  \n  清空所有游戏配置项。\n\n- **GetBool(string), GetBool(string, bool)**  \n  获取布尔类型的配置信息，可以提供默认值。\n\n- **SetBool(string, bool)**  \n  设置布尔类型的配置信息。\n\n- **GetInt(string), GetInt(string, int)**  \n  获取整数类型的配置信息，可以提供默认值。\n\n- **SetInt(string, int)**  \n  设置整数类型的配置信息。\n\n- **GetFloat(string), GetFloat(string, float)**  \n  获取浮点数类型的配置信息，可以提供默认值。\n\n- **SetFloat(string, float)**  \n  设置浮点数类型的配置信息。\n\n- **GetString(string), GetString(string, string)**  \n  获取字符串类型的配置信息，可以提供默认值。\n\n- **SetString(string, string)**  \n  设置字符串类型的配置信息。\n\n- **GetObject\u003cT\u003e(string), GetObject(Type, string), GetObject\u003cT\u003e(string, T), GetObject(Type, string, object)**  \n  获取对象类型的配置信息，可以指定类型和默认值。\n\n- **SetObject\u003cT\u003e(string, T), SetObject(string, object)**  \n  设置对象类型的配置信息。\n\n## 使用示例\n\n通过 **SettingComponent**，您可以轻松地管理游戏设置。以下是一些使用示例：\n\n### 保存和加载设置\n\n```cs\n// 创建SettingComponent实例\nSettingComponent settingComponent = new SettingComponent();\n\n// 加载设置\nsettingComponent.Start();\n\n// 修改一些设置\nsettingComponent.SetBool(\"IsFullScreen\", true);\nsettingComponent.SetInt(\"ResolutionWidth\", 1920);\nsettingComponent.SetFloat(\"Volume\", 0.8f);\nsettingComponent.SetString(\"PlayerName\", \"PlayerOne\");\n\n// 保存修改后的设置\nsettingComponent.Save();\n```\n\n### 查询和获取设置值\n\n```cs\n// 检查是否存在某个设置\nbool hasVolumeSetting = settingComponent.HasSetting(\"Volume\");\n\n// 获取设置项的值\nfloat volume = settingComponent.GetFloat(\"Volume\", 0.5f); // 如果不存在，则返回0.5f\n```\n\n### 删除设置\n\n```cs\n// 移除某个设置\nsettingComponent.RemoveSetting(\"PlayerName\");\n\n// 移除所有设置\nsettingComponent.RemoveAllSettings();\n```\n\n请注意，本示例仅用于演示目的，实际使用时您需要将 **SettingComponent** 添加到您的游戏对象中，并通过Unity的生命周期管理其状态。\n\n# 使用方式(任选其一)\n\n1. 直接在 `manifest.json` 的文件中的 `dependencies` 节点下添加以下内容\n   ```json\n      {\"com.gameframex.unity.setting\": \"https://github.com/AlianBlank/com.gameframex.unity.setting.git\"}\n    ```\n2. 在Unity 的`Packages Manager` 中使用`Git URL` 的方式添加库,地址为：https://github.com/AlianBlank/com.gameframex.unity.setting.git\n\n3. 直接下载仓库放置到Unity 项目的`Packages` 目录下。会自动加载识别","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgameframex%2Fcom.gameframex.unity.setting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgameframex%2Fcom.gameframex.unity.setting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgameframex%2Fcom.gameframex.unity.setting/lists"}