Skip to content

Commit

Permalink
Deploying to main from @ GamemakerChina/GameMaker-maunl-zh@29de1dc 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
LiarOnce committed Jun 3, 2024
1 parent e7a0c0f commit 39bc082
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" language="JavaScript">function reDo(){innerWidth==origWidth&&innerHeight==origHeight||location.reload()}4==parseInt(navigator.appVersion)&&"Netscape"==navigator.appName&&(origWidth=innerWidth,origHeight=innerHeight,onresize=reDo),onerror=null</script><style type="text/css">p.WebHelpNavBar{text-align:right}</style><script type="text/javascript">gCommonRootRelPath=gRootRelPath="../../../..",gTopicId="8.2.2.9.3"</script><script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script><script type="text/javascript" src="../../../../template/scripts/common.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script><script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script><link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"><link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"><meta name="topic-status" content="Draft"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>DS Maps</title><meta name="generator" content="Adobe RoboHelp 2022"><link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"><script src="../../../../assets/scripts/main_script.js" type="module"></script><meta name="rh-authors" content="Mark Alexander"><meta name="topic-comment" content="Reference section for DS Maps"><meta name="rh-index-keywords" content=""><meta name="search-keywords" content="DS Maps"><meta name="brsnext" value="GameMaker_Language/GML_Reference/Data_Structures/DS_Maps/ds_map_exists.htm"><meta name="brsprev" value="GameMaker_Language/GML_Reference/Data_Structures/DS_Lists/ds_list_is_map.htm"></head><body><div class="topic-header rh-hide" id="rh-topic-header"><div class="logo"></div><div class="nav"><div class="title" title="DS Maps"><span>DS Maps</span></div><div class="gotohome" title="Click here to see this page in full context"><a href="#" onclick="rh._.goToFullLayout()">Click here to see this page in full context</a></div></div></div><div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div><h1 id="h"><span data-field="title" data-format="default">DS Maps</span></h1><p>DS 地图数据结构可让您存储 <b>键</b> 和 <b>值</b> 对,这使其成为一种非常有用的数据结构。</p><p>例如,游戏中的角色可以拥有一定数量的不同物品 ( <i>键</i> ),并且对于每个单独的物品,他可以拥有一定数量的物品 ( <i>值</i> ),就像在 RPG 中一样,您可以拥有 10 种生命药水、5 种法力药水和 100 金币。地图将这些对全部保存在一个地方。您可以将对添加到映射中,搜索与某些键对应的值并使用一些简单的函数。</p><p>然而,在使用地图之前,您应该了解一些有关地图的知识!地图 <i>不</i> 以任何 (可识别的) 方式排序,这意味着要找到某个键​​,您可能必须遍历整个过程 (这 <b>非常</b> 慢)。也无法保存两个相同的键,也无法为一个键分配两个值。</p><p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"><span class="note">注意</span></span>&nbsp;推荐使用<a href="../../../GML_Overview/Structs.htm">结构</a>而不是DS 映射,因为它们具有相似的功能,更易于使用,并且会自动进行垃圾回收。</p><p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"><span class="note">注意</span></span> 与所有动态资源一样,数据结构会占用内存,因此在不再需要时应<b>始终</b>销毁以防止内存泄漏,因为内存泄漏会降低游戏速度并最终导致游戏崩溃。</p><div data-conref="../../../../assets/snippets/Note_Tip_Map_Key_Can_Be_Any.hts"><p class="note"><span data-conref="../../../../assets/snippets/Tag_tip.hts"><span class="tip">提示</span></span> 键不限于字符串,可以是任何类型,包括 <a href="../../../GML_Overview/Structs.htm#struct">结构体</a> 。</p></div><p>除了下面列出的特定函数外,您还可以使用<a class="tooltip" title="表达式是一个或多个常量,变量,运算符和/或函数的组合,这些常量根据特定的优先级和关联规则进行解释以返回另一个值。一个简单的表达式是(5 + 5),它返回10。">表达式</a>(称为<i>访问器</i>)来添加或修改DS映射的内容。此存取器类似于1D阵列,具有以下语法:</p><p class="code">map_index[? key]</p><p>您可以从<a href="../../../GML_Overview/Accessors.htm">访问器</a>的GML 概述页面中找到更多信息和示例。</p><h2 id="func_ref">Function Reference</h2><h3 id="func_ref_general">General</h3><ul class="colour"><li><a href="ds_map_exists.htm">ds_map_exists</a></li><li><a href="ds_map_create.htm">ds_map_create</a></li><li><a href="ds_map_destroy.htm">ds_map_destroy</a></li><li><a href="ds_map_add.htm">ds_map_add</a></li><li><a href="ds_map_clear.htm">ds_map_clear</a></li><li><a href="ds_map_copy.htm">ds_map_copy</a></li><li><a href="ds_map_replace.htm">ds_map_replace</a></li><li><a href="ds_map_delete.htm">ds_map_delete</a></li><li><a href="ds_map_empty.htm">ds_map_empty</a></li><li><a href="ds_map_size.htm">ds_map_size</a></li><li><a href="ds_map_find_first.htm">ds_map_find_first</a></li><li><a href="ds_map_find_last.htm">ds_map_find_last</a></li><li><a href="ds_map_find_next.htm">ds_map_find_next</a></li><li><a href="ds_map_find_previous.htm">ds_map_find_previous</a></li><li><a href="ds_map_find_value.htm">ds_map_find_value</a></li><li><a href="ds_map_keys_to_array.htm">ds_map_keys_to_array</a></li><li><a href="ds_map_values_to_array.htm">ds_map_values_to_array</a></li><li><a href="ds_map_set.htm">ds_map_set</a></li></ul><h3 id="func_ref_serialisation">Serialisation</h3><ul class="colour"><li><a href="ds_map_read.htm">ds_map_read</a></li><li><a href="ds_map_write.htm">ds_map_write</a></li></ul><h3 id="func_ref_loading_saving">Loading &amp; Saving</h3><p>These functions will obfuscate the map and store it in a secure location on the target platform using a file format that means that the final file is not able to be transferred between devices:</p><ul class="colour"><li><a href="ds_map_secure_save.htm">ds_map_secure_save</a></li><li><a href="ds_map_secure_save_buffer.htm">ds_map_secure_save_buffer</a></li><li><a href="ds_map_secure_load.htm">ds_map_secure_load</a></li><li><a href="ds_map_secure_load_buffer.htm">ds_map_secure_load_buffer</a></li></ul><h3 id="func_ref_json">JSON</h3><ul class="colour"><li><a href="ds_map_add_list.htm">ds_map_add_list</a></li><li><a href="ds_map_add_map.htm">ds_map_add_map</a></li><li><a href="ds_map_replace_list.htm">ds_map_replace_list</a></li><li><a href="ds_map_replace_map.htm">ds_map_replace_map</a></li><li><a href="ds_map_is_list.htm">ds_map_is_list</a></li><li><a href="ds_map_is_map.htm">ds_map_is_map</a></li></ul><p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"><span class="note">注意</span></span> 虽然这些函数允许您在映射中添加列表和映射,但它们对于JSON以外的任何内容都是无用的,并且如果将嵌套映射和列表写入磁盘或以任何其他方式进行访问,将无法正确读取。</p><p>&nbsp;</p><p>&nbsp;</p><div class="footer"><div class="buttons"><div class="clear"><div style="float:left">Back:&nbsp;<a href="../Data_Structures.htm">数据结构</a></div><div style="float:right">Next:&nbsp;<a href="../DS_Priority_Queues/DS_Priority_Queues.htm">优先队列 Priority Queues</a></div></div></div><h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2024 All Rights Reserved</span></h5></div></body></html>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" language="JavaScript">function reDo(){innerWidth==origWidth&&innerHeight==origHeight||location.reload()}4==parseInt(navigator.appVersion)&&"Netscape"==navigator.appName&&(origWidth=innerWidth,origHeight=innerHeight,onresize=reDo),onerror=null</script><style type="text/css">p.WebHelpNavBar{text-align:right}</style><script type="text/javascript">gCommonRootRelPath=gRootRelPath="../../../..",gTopicId="8.2.2.9.3"</script><script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script><script type="text/javascript" src="../../../../template/scripts/common.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script><script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script><link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"><link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"><meta name="topic-status" content="Draft"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>DS Maps</title><meta name="generator" content="Adobe RoboHelp 2022"><link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"><script src="../../../../assets/scripts/main_script.js" type="module"></script><meta name="rh-authors" content="Mark Alexander"><meta name="topic-comment" content="Reference section for DS Maps"><meta name="rh-index-keywords" content=""><meta name="search-keywords" content="DS Maps"><meta name="brsnext" value="GameMaker_Language/GML_Reference/Data_Structures/DS_Maps/ds_map_exists.htm"><meta name="brsprev" value="GameMaker_Language/GML_Reference/Data_Structures/DS_Lists/ds_list_is_map.htm"></head><body><div class="topic-header rh-hide" id="rh-topic-header"><div class="logo"></div><div class="nav"><div class="title" title="DS Maps"><span>DS Maps</span></div><div class="gotohome" title="Click here to see this page in full context"><a href="#" onclick="rh._.goToFullLayout()">Click here to see this page in full context</a></div></div></div><div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div><h1 id="h"><span data-field="title" data-format="default">DS Maps</span></h1><p>DS 映射数据结构可让您存储<b>键</b>和<b>值</b>对,这使其成为一种非常有用的数据结构。</p><p>例如,游戏中的角色可以拥有一定数量的不同物品 ( <i>键</i> ),并且对于每个单独的物品,他可以拥有一定数量的物品 ( <i>值</i> ),就像在 RPG 中一样,您可以拥有 10 种生命药水、5 种法力药水和 100 金币。地图将这些对全部保存在一个地方。您可以将对添加到映射中,搜索与某些键对应的值并使用一些简单的函数。</p><p>然而,在使用地图之前,您应该了解一些有关地图的知识!地图 <i>不</i> 以任何 (可识别的) 方式排序,这意味着要找到某个键​​,您可能必须遍历整个过程 (这 <b>非常</b> 慢)。也无法保存两个相同的键,也无法为一个键分配两个值。</p><p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"><span class="note">注意</span></span>&nbsp;推荐使用<a href="../../../GML_Overview/Structs.htm">结构</a>而不是DS 映射,因为它们具有相似的功能,更易于使用,并且会自动进行垃圾回收。</p><p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"><span class="note">注意</span></span> 与所有动态资源一样,数据结构会占用内存,因此在不再需要时应<b>始终</b>销毁以防止内存泄漏,因为内存泄漏会降低游戏速度并最终导致游戏崩溃。</p><div data-conref="../../../../assets/snippets/Note_Tip_Map_Key_Can_Be_Any.hts"><p class="note"><span data-conref="../../../../assets/snippets/Tag_tip.hts"><span class="tip">提示</span></span> 键不限于字符串,可以是任何类型,包括 <a href="../../../GML_Overview/Structs.htm#struct">结构体</a> 。</p></div><p>除了下面列出的特定函数外,您还可以使用<a class="tooltip" title="表达式是一个或多个常量,变量,运算符和/或函数的组合,这些常量根据特定的优先级和关联规则进行解释以返回另一个值。一个简单的表达式是(5 + 5),它返回10。">表达式</a>(称为<i>访问器</i>)来添加或修改DS映射的内容。此存取器类似于1D阵列,具有以下语法:</p><p class="code">map_index[? key]</p><p>您可以从<a href="../../../GML_Overview/Accessors.htm">访问器</a>的GML 概述页面中找到更多信息和示例。</p><h2 id="func_ref">Function Reference</h2><h3 id="func_ref_general">General</h3><ul class="colour"><li><a href="ds_map_exists.htm">ds_map_exists</a></li><li><a href="ds_map_create.htm">ds_map_create</a></li><li><a href="ds_map_destroy.htm">ds_map_destroy</a></li><li><a href="ds_map_add.htm">ds_map_add</a></li><li><a href="ds_map_clear.htm">ds_map_clear</a></li><li><a href="ds_map_copy.htm">ds_map_copy</a></li><li><a href="ds_map_replace.htm">ds_map_replace</a></li><li><a href="ds_map_delete.htm">ds_map_delete</a></li><li><a href="ds_map_empty.htm">ds_map_empty</a></li><li><a href="ds_map_size.htm">ds_map_size</a></li><li><a href="ds_map_find_first.htm">ds_map_find_first</a></li><li><a href="ds_map_find_last.htm">ds_map_find_last</a></li><li><a href="ds_map_find_next.htm">ds_map_find_next</a></li><li><a href="ds_map_find_previous.htm">ds_map_find_previous</a></li><li><a href="ds_map_find_value.htm">ds_map_find_value</a></li><li><a href="ds_map_keys_to_array.htm">ds_map_keys_to_array</a></li><li><a href="ds_map_values_to_array.htm">ds_map_values_to_array</a></li><li><a href="ds_map_set.htm">ds_map_set</a></li></ul><h3 id="func_ref_serialisation">Serialisation</h3><ul class="colour"><li><a href="ds_map_read.htm">ds_map_read</a></li><li><a href="ds_map_write.htm">ds_map_write</a></li></ul><h3 id="func_ref_loading_saving">Loading &amp; Saving</h3><p>These functions will obfuscate the map and store it in a secure location on the target platform using a file format that means that the final file is not able to be transferred between devices:</p><ul class="colour"><li><a href="ds_map_secure_save.htm">ds_map_secure_save</a></li><li><a href="ds_map_secure_save_buffer.htm">ds_map_secure_save_buffer</a></li><li><a href="ds_map_secure_load.htm">ds_map_secure_load</a></li><li><a href="ds_map_secure_load_buffer.htm">ds_map_secure_load_buffer</a></li></ul><h3 id="func_ref_json">JSON</h3><ul class="colour"><li><a href="ds_map_add_list.htm">ds_map_add_list</a></li><li><a href="ds_map_add_map.htm">ds_map_add_map</a></li><li><a href="ds_map_replace_list.htm">ds_map_replace_list</a></li><li><a href="ds_map_replace_map.htm">ds_map_replace_map</a></li><li><a href="ds_map_is_list.htm">ds_map_is_list</a></li><li><a href="ds_map_is_map.htm">ds_map_is_map</a></li></ul><p class="note"><span data-conref="../../../../assets/snippets/Tag_note.hts"><span class="note">注意</span></span> 虽然这些函数允许您在映射中添加列表和映射,但它们对于JSON以外的任何内容都是无用的,并且如果将嵌套映射和列表写入磁盘或以任何其他方式进行访问,将无法正确读取。</p><p>&nbsp;</p><p>&nbsp;</p><div class="footer"><div class="buttons"><div class="clear"><div style="float:left">Back:&nbsp;<a href="../Data_Structures.htm">数据结构</a></div><div style="float:right">Next:&nbsp;<a href="../DS_Priority_Queues/DS_Priority_Queues.htm">优先队列 Priority Queues</a></div></div></div><h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2024 All Rights Reserved</span></h5></div></body></html>
Loading

0 comments on commit 39bc082

Please sign in to comment.