{"id":31,"date":"2023-10-10T22:58:53","date_gmt":"2023-10-10T13:58:53","guid":{"rendered":"https:\/\/yotsuba-soft.net\/?p=31"},"modified":"2023-10-10T22:58:54","modified_gmt":"2023-10-10T13:58:54","slug":"timer","status":"publish","type":"post","link":"https:\/\/yotsuba-soft.net\/?p=31","title":{"rendered":"\u95a2\u6570\u3092\u9045\u5ef6\u3055\u305b\u3066\u5b9f\u884c\u3055\u305b\u308btimer.delay() \u95a2\u6570"},"content":{"rendered":"\n<h2>Defold\u306e<code>timer<\/code>\u95a2\u6570\u306b\u3064\u3044\u3066<\/h2>\n\n<p>Defold\u30a8\u30f3\u30b8\u30f3\u306b\u306f\u3001\u6642\u9593\u30d9\u30fc\u30b9\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u7c21\u5358\u306b\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e <code>timer<\/code> \u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u4e2d\u3067\u3082\u3001\u7279\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b\u306e\u304c <code>timer.delay()<\/code> \u95a2\u6570\u3067\u3059\u3002<\/p>\n\n<h3>1. <code>timer.delay()<\/code><\/h3>\n\n<h4>\u8aac\u660e:<\/h4>\n<p>\u6307\u5b9a\u3057\u305f\u6642\u9593\uff08\u79d2\uff09\u5f8c\u306b\u95a2\u6570\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n<h4>\u5f15\u6570:<\/h4>\n<ul>\n    <li><strong>delay<\/strong>: \u5b9f\u884c\u307e\u3067\u306e\u9045\u5ef6\u6642\u9593\uff08\u79d2\uff09<\/li>\n    <li><strong>repeat<\/strong>: \u30bf\u30a4\u30de\u30fc\u3092\u30ea\u30d4\u30fc\u30c8\u3059\u308b\u304b\u3069\u3046\u304b\u306e\u771f\u507d\u5024\u3002true\u3067\u30ea\u30d4\u30fc\u30c8\u3001false\u3067\u4e00\u56de\u9650\u308a\u306e\u5b9f\u884c\u3002<\/li>\n    <li><strong>callback<\/strong>: \u9045\u5ef6\u6642\u9593\u7d4c\u904e\u5f8c\u306b\u5b9f\u884c\u3055\u308c\u308b\u95a2\u6570\u3002<\/li>\n<\/ul>\n\n<h4>\u4f7f\u7528\u4f8b:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"lua\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">local function on_timer_completed(self, handle, time_elapsed)\nprint(\"3\u79d2\u7d4c\u904e!\")\nend\n\ntimer.delay(3, false, on_timer_completed)<\/pre>\n\n\n\n<h3>2. <code>timer.cancel()<\/code><\/h3>\n\n<h4>\u8aac\u660e:<\/h4>\n<p>\u4ee5\u524d\u306b\u8a2d\u5b9a\u3055\u308c\u305f\u30bf\u30a4\u30de\u30fc\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n<h4>\u5f15\u6570:<\/h4>\n<ul>\n    <li><strong>handle<\/strong>: \u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u30bf\u30a4\u30de\u30fc\u306e\u30cf\u30f3\u30c9\u30eb\u3002\u3053\u308c\u306f\u901a\u5e38\u3001<code>timer.delay()<\/code> \u306e\u623b\u308a\u5024\u3068\u3057\u3066\u5f97\u3089\u308c\u307e\u3059\u3002<\/li>\n<\/ul>\n\n<h4>\u4f7f\u7528\u4f8b:<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"lua\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">local handle = timer.delay(3, false, on_timer_completed)\ntimer.cancel(handle) -- \u3053\u308c\u3067\u30bf\u30a4\u30de\u30fc\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002<\/pre>\n\n\n\n<h3>\u4f7f\u7528\u4e0a\u306e\u6ce8\u610f\u70b9:<\/h3>\n<ul>\n    <li><code>timer.delay()<\/code>\u306f\u3001\u30b2\u30fc\u30e0\u3084\u30a2\u30d7\u30ea\u306e\u72b6\u6cc1\u306b\u3088\u3063\u3066\u306f\u5b9f\u884c\u6642\u306b\u308f\u305a\u304b\u306a\u9045\u5ef6\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u7d76\u5bfe\u7684\u306a\u6642\u9593\u306e\u6b63\u78ba\u3055\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001\u4ed6\u306e\u624b\u6bb5\u3092\u691c\u8a0e\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/li>\n    <li>\u30bf\u30a4\u30de\u30fc\u304c\u5fc5\u8981\u306a\u304f\u306a\u3063\u305f\u3068\u304d\u3084\u3001\u30b7\u30fc\u30f3\u3092\u5909\u66f4\u3059\u308b\u524d\u306b\u306f\u3001\u5fd8\u308c\u305a\u306b<code>timer.cancel()<\/code>\u3067\u30bf\u30a4\u30de\u30fc\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h2>\u30bf\u30a4\u30de\u30fc\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u7406\u7531<\/h2>\n<p><code>timer.delay()<\/code> \u306a\u3069\u306e\u30bf\u30a4\u30de\u30fc\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u969b\u3001\u6307\u5b9a\u3057\u305f\u6642\u9593\u5f8c\u306b\u5b9f\u884c\u3055\u308c\u308b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u305d\u306e\u30bf\u30a4\u30de\u30fc\u304c\u5b9f\u969b\u306b\u30c8\u30ea\u30ac\u30fc\u3055\u308c\u308b\u524d\u306b\u30b7\u30fc\u30f3\u304c\u5909\u66f4\u3055\u308c\u305f\u5834\u5408\u3084\u3001\u95a2\u9023\u3059\u308b\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u524a\u9664\u3055\u308c\u305f\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u554f\u984c\u304c\u751f\u3058\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n<ol>\n    <li><strong>\u5b58\u5728\u3057\u306a\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/strong>: \u30bf\u30a4\u30de\u30fc\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u30c8\u30ea\u30ac\u30fc\u3055\u308c\u308b\u3068\u3001\u305d\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u5185\u3067\u53c2\u7167\u3055\u308c\u3066\u3044\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u65e2\u306b\u524a\u9664\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/li>\n    <li><strong>\u610f\u56f3\u3057\u306a\u3044\u52d5\u4f5c<\/strong>: \u30bf\u30a4\u30de\u30fc\u304c\u4e88\u671f\u3057\u306a\u3044\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u5b9f\u884c\u3055\u308c\u308b\u3068\u3001\u30b2\u30fc\u30e0\u306e\u52d5\u4f5c\u306b\u4e88\u671f\u3057\u306a\u3044\u526f\u4f5c\u7528\u3092\u5f15\u304d\u8d77\u3053\u3059\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n    <li><strong>\u30ea\u30bd\u30fc\u30b9\u306e\u6d6a\u8cbb<\/strong>: \u5fc5\u8981\u306a\u304f\u306a\u3063\u305f\u30bf\u30a4\u30de\u30fc\u304c\u30e1\u30e2\u30ea\u4e0a\u306b\u6b8b\u3063\u3066\u3057\u307e\u3046\u3053\u3068\u3067\u3001\u7121\u99c4\u306b\u30ea\u30bd\u30fc\u30b9\u3092\u6d88\u8cbb\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ol>\n\n<p>\u3053\u306e\u3088\u3046\u306a\u7406\u7531\u304b\u3089\u3001\u7279\u306b\u30b7\u30fc\u30f3\u306e\u5909\u66f4\u3084\u95a2\u9023\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u524a\u9664\u3092\u884c\u3046\u524d\u306b\u3001\u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30bf\u30a4\u30de\u30fc\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30a8\u30e9\u30fc\u3084\u4e88\u671f\u3057\u306a\u3044\u52d5\u4f5c\u306e\u30ea\u30b9\u30af\u3092\u4f4e\u6e1b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Defold\u306etimer\u95a2\u6570\u306b\u3064\u3044\u3066 Defold\u30a8\u30f3\u30b8\u30f3\u306b\u306f\u3001\u6642\u9593\u30d9\u30fc\u30b9\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u7c21\u5358\u306b\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e timer \u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u4e2d\u3067\u3082\u3001\u7279\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b\u306e\u304c timer.delay [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":"","_wp_rev_ctl_limit":""},"categories":[7,6],"tags":[9,8],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-defold","category-development-diary","tag-defold","tag-game-development"],"_links":{"self":[{"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":2,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}