{"id":8,"date":"2023-10-02T14:24:44","date_gmt":"2023-10-02T05:24:44","guid":{"rendered":"https:\/\/yotsuba-soft.net\/?p=8"},"modified":"2023-10-05T14:58:36","modified_gmt":"2023-10-05T05:58:36","slug":"defold-collection-proxy","status":"publish","type":"post","link":"https:\/\/yotsuba-soft.net\/?p=8","title":{"rendered":"defold\u3067\u306e\u30b7\u30fc\u30f3\u79fb\u52d5\u300cCollection Proxy\u300d"},"content":{"rendered":"\n\n\n\n\n<h2>Collection Proxy\u3068\u306f\u4f55\u304b\uff1f<\/h2>\n\n<p>Collection Proxy\u306f\u3001Defold\u306e\u30b2\u30fc\u30e0\u30a8\u30f3\u30b8\u30f3\u3067\u4f7f\u7528\u3055\u308c\u308b\u7279\u6b8a\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3059\u3002\u3053\u308c\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u7570\u306a\u308b\u30b2\u30fc\u30e0\u30b7\u30fc\u30f3\u3084\u30ec\u30d9\u30eb\u9593\u3067\u30b7\u30fc\u30e0\u30ec\u30b9\u306b\u79fb\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n<h2>\u5177\u4f53\u7684\u306b\u306f\u3069\u3046\u3044\u3046\u3053\u3068\u3092\u3059\u308b\u306e\uff1f<\/h2>\n\n<p>\u30b2\u30fc\u30e0\u3092\u4f5c\u6210\u3059\u308b\u3068\u304d\u3001\u305f\u3068\u3048\u3070\u300c\u30bf\u30a4\u30c8\u30eb\u753b\u9762\u300d\u300c\u30b2\u30fc\u30e0\u30d7\u30ec\u30a4\u753b\u9762\u300d\u300c\u30ea\u30b6\u30eb\u30c8\u753b\u9762\u300d\u3068\u3044\u3063\u305f\u7570\u306a\u308b\u30b7\u30fc\u30f3\u3084\u753b\u9762\u304c\u5b58\u5728\u3057\u307e\u3059\u3088\u306d\u3002\u3053\u308c\u3089\u306e\u5404\u30b7\u30fc\u30f3\u3092\u500b\u5225\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3068\u3057\u3066\u7ba1\u7406\u3057\u3001Collection Proxy\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u3089\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u52d5\u7684\u306b\u30ed\u30fc\u30c9\u3057\u305f\u308a\u3001\u30a2\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n<h2>Collection Proxy\u306e\u30e1\u30ea\u30c3\u30c8\u306f\uff1f<\/h2>\n\n<ol>\n    <li><strong>\u30e1\u30e2\u30ea\u306e\u52b9\u7387\u7684\u306a\u4f7f\u7528<\/strong>: \u5fc5\u8981\u306a\u6642\u3060\u3051\u7279\u5b9a\u306e\u30b2\u30fc\u30e0\u30b7\u30fc\u30f3\u3092\u30e1\u30e2\u30ea\u306b\u30ed\u30fc\u30c9\u3067\u304d\u308b\u305f\u3081\u3001\u5168\u3066\u306e\u30b7\u30fc\u30f3\u3092\u540c\u6642\u306b\u30e1\u30e2\u30ea\u306b\u4fdd\u6301\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u5927\u304d\u306a\u30b2\u30fc\u30e0\u3067\u3082\u30b9\u30e0\u30fc\u30ba\u306b\u52d5\u4f5c\u3059\u308b\u3002<\/li>\n    <li><strong>\u30b2\u30fc\u30e0\u306e\u30d5\u30ed\u30fc\u306e\u67d4\u8edf\u6027<\/strong>: \u30bf\u30a4\u30c8\u30eb\u753b\u9762\u304b\u3089\u30b2\u30fc\u30e0\u30d7\u30ec\u30a4\u753b\u9762\u306b\u79fb\u884c\u3057\u305f\u308a\u3001\u9006\u306b\u30b2\u30fc\u30e0\u30d7\u30ec\u30a4\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u306b\u623b\u308b\u3053\u3068\u306a\u3069\u304c\u5bb9\u6613\u306b\u306a\u308b\u3002<\/li>\n<\/ol>\n\n<h2>\u4f7f\u3044\u65b9\u306e\u57fa\u672c<\/h2>\n\n<ol>\n    <li>\u307e\u305a\u3001\u5404\u30b2\u30fc\u30e0\u306e\u30b7\u30fc\u30f3\u3092\u500b\u5225\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3068\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002<\/li>\n    <li>\u30e1\u30a4\u30f3\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\uff08\u4f8b\u3048\u3070\u30b2\u30fc\u30e0\u306e\u30bf\u30a4\u30c8\u30eb\u753b\u9762\u306a\u3069\uff09\u306b\u300cCollection Proxy\u300d\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/li>\n    <li>Collection Proxy\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u3001\u30ed\u30fc\u30c9\u3057\u305f\u3044\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n    <li>\u30b2\u30fc\u30e0\u306e\u30ed\u30b8\u30c3\u30af\u306b\u5408\u308f\u305b\u3066\u3001\u305d\u306eProxy\u3092\u4f7f\u3063\u3066\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u30ed\u30fc\u30c9\u3001\u521d\u671f\u5316\u3001\u6709\u52b9\u5316\u3001\u30a2\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u3067\u64cd\u4f5c\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n\n<h2>\u7d50\u8ad6<\/h2>\n\n<p>Collection Proxy\u306f\u3001\u5927\u304d\u306a\u30b2\u30fc\u30e0\u3084\u8907\u96d1\u306a\u30b2\u30fc\u30e0\u306e\u30d5\u30ed\u30fc\u3092\u6301\u3064\u30b2\u30fc\u30e0\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u975e\u5e38\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002\u6b63\u3057\u304f\u4f7f\u3046\u3053\u3068\u3067\u3001\u30b2\u30fc\u30e0\u306e\u30ed\u30fc\u30c9\u6642\u9593\u3092\u77ed\u7e2e\u3057\u305f\u308a\u3001\u30e1\u30e2\u30ea\u306e\u4f7f\u7528\u3092\u6700\u9069\u5316\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n<h2>Collection Proxy\u306b\u95a2\u3059\u308b\u5909\u6570\u306e\u6271\u3044<\/h2>\n\n<p>Defold\u306e<code>Collection Proxy<\/code>\u3092\u4f7f\u3063\u3066\u30b7\u30fc\u30f3\u3092\u79fb\u52d5\u3059\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u70b9\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n<ol>\n    <li>\n        <strong>\u5909\u6570\u306e\u7dad\u6301<\/strong>: \n        <p><code>Collection Proxy<\/code>\u3092\u7528\u3044\u3066\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001\u305d\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u5185\u306e\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u65b0\u305f\u306b\u521d\u671f\u5316\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u5909\u6570\u306f\u305d\u308c\u305e\u308c\u306e\u521d\u671f\u72b6\u614b\u306b\u623b\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u524d\u56de\u30a2\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u969b\u306e\u5909\u6570\u306e\u5024\u3092\u4fdd\u6301\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n    <\/li>\n\n    <li>\n        <strong>\u7570\u306a\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u306e\u901a\u4fe1<\/strong>: \n        <p>\u901a\u5e38\u3001\u7570\u306a\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u306e\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u76f4\u63a5\u7684\u306b\u901a\u4fe1\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3057\u304b\u3057\u3001<code>msg.post()<\/code>\u3092\u7528\u3044\u3066\u7279\u5b9a\u306e\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u3042\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304b\u3089\u5225\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u7279\u5b9a\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u547d\u4ee4\u3092\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n    <\/li>\n\n    <li>\n        <strong>\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u4f7f\u7528<\/strong>: \n        <p>Defold\u3067\u306f\u3001<code>sys.set\/get<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u8a2d\u5b9a\u30fb\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u7570\u306a\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u3067\u5909\u6570\u3092\u5171\u6709\u3057\u305f\u308a\u3001\u7279\u5b9a\u306e\u5909\u6570\u306e\u5024\u3092\u7dad\u6301\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n    <\/li>\n\n    <li>\n        <strong>Lua\u30e2\u30b8\u30e5\u30fc\u30eb<\/strong>: \n        <p>Lua\u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u306e\u5909\u6570\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u3067\u3042\u308a\u3001\u305d\u308c\u306f\u30a2\u30f3\u30ed\u30fc\u30c9\u6642\u306b\u30ea\u30bb\u30c3\u30c8\u3055\u308c\u307e\u305b\u3093\u3002\u3053\u308c\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u3067\u60c5\u5831\u3092\u5171\u6709\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n    <\/li>\n\n    <li>\n        <strong>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u72ec\u7acb\u6027<\/strong>: \n        <p>\u305d\u308c\u305e\u308c\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u72ec\u7acb\u3057\u305f\u74b0\u5883\u3067\u52d5\u4f5c\u3059\u308b\u306e\u3067\u3001\u540d\u524d\u304c\u540c\u3058\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u5909\u6570\u304c\u5b58\u5728\u3057\u3066\u3082\u3001\u305d\u308c\u3089\u306f\u7570\u306a\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u3067\u5e72\u6e09\u3059\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n    <\/li>\n<\/ol>\n\n<p>\u8981\u3059\u308b\u306b\u3001<code>Collection Proxy<\/code>\u3092\u4f7f\u3063\u3066\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u5207\u308a\u66ff\u3048\u308b\u3068\u304d\u3001\u5404\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u72ec\u7acb\u3057\u305f\u74b0\u5883\u3067\u52d5\u4f5c\u3057\u307e\u3059\u304c\u3001\u7279\u5b9a\u306e\u65b9\u6cd5\uff08\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u9001\u4fe1\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u4f7f\u7528\u3001Lua\u30e2\u30b8\u30e5\u30fc\u30eb\u306a\u3069\uff09\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u3067\u306e\u901a\u4fe1\u3084\u30c7\u30fc\u30bf\u306e\u5171\u6709\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n\n\n\n\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30ed\u30fc\u30c9\u3068\u30a2\u30f3\u30ed\u30fc\u30c9<\/p>\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=\"\">-- main.script\nfunction init(self)\n    -- \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u975e\u540c\u671f\u3067\u30ed\u30fc\u30c9\n    msg.post(\"my_collection_proxy#proxy\", \"load\")\nend\nfunction on_message(self, message_id, message, sender)\n    if message_id == hash(\"proxy_loaded\") then\n        -- \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304c\u30ed\u30fc\u30c9\u3055\u308c\u305f\u3089\u3001\u305d\u308c\u3092\u6709\u52b9\u5316\n        msg.post(sender, \"enable\")\n    end\nend\nfunction unload_collection(self)\n    -- \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u30a2\u30f3\u30ed\u30fc\u30c9\n    msg.post(\"my_collection_proxy#proxy\", \"unload\")\nend<\/pre>\n\n\n\n<p>\u7570\u306a\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u9593\u306e\u901a\u4fe1<\/p>\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=\"\">-- collectionA.script\nfunction on_input(self, action_id, action)\n    if action_id == hash(\"touch\") and action.pressed then\n        -- \u30b3\u30ec\u30af\u30b7\u30e7\u30f3B\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u4fe1\n        msg.post(\"collectionB#script\", \"hello_from_A\")\n    end\nend\n-- collectionB.script\nfunction on_message(self, message_id, message, sender)\n    if message_id == hash(\"hello_from_A\") then\n        print(\"Hello from Collection A!\")\n    end\nend<\/pre>\n\n\n\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u4f7f\u7528<\/p>\n\n\n\n<p><code>sys.set<\/code>\u3068<code>sys.get<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u8a2d\u5b9a\u30fb\u53d6\u5f97\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\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=\"\">-- set_global.script\nfunction set_global_score(score)\n    sys.set(\"global_score\", score)\nend\n-- get_global.script\nfunction get_global_score()\n    local score = sys.get(\"global_score\")\n    return score\nend<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Collection Proxy\u3068\u306f\u4f55\u304b\uff1f Collection Proxy\u306f\u3001Defold\u306e\u30b2\u30fc\u30e0\u30a8\u30f3\u30b8\u30f3\u3067\u4f7f\u7528\u3055\u308c\u308b\u7279\u6b8a\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3059\u3002\u3053\u308c\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u7570\u306a\u308b\u30b2\u30fc\u30e0\u30b7\u30fc\u30f3\u3084\u30ec\u30d9\u30eb\u9593\u3067\u30b7\u30fc\u30e0\u30ec\u30b9\u306b\u79fb\u884c\u3059\u308b\u3053\u3068\u304c [&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],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-defold","category-development-diary","tag-defold"],"_links":{"self":[{"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts\/8","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=8"}],"version-history":[{"count":4,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":26,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions\/26"}],"wp:attachment":[{"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yotsuba-soft.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}