あなたの世界を作りなさい
経済
製品サンプルの活用
17 分
ステップ 1 zepeto製品サンプルの開始 zepeto製品サンプル https //github com/naverz/world tutorial/tree/main/product zepeto製品apiリファレンス https //developer zepeto me/docs/product/ 以下はzepeto製品のサンプル実装です。 zepeto製品システムを理解するために、サンプルの実装を理解するためのガイドに従うことをお勧めします。 サンプルには、通貨システム、在庫システム、アイテム取得、購入、uiリソースの例が含まれています。 ❗️ 注意 zepetoワールドを作成する際に、サンプルで提供されているuiリソースやスクリプトを自由に使用してください。 ただし、zepetoワールド以外の公開サンプルのリソースを使用することは禁止されています。 zepeto製品のサンプルを適用する方法 サンプルで使用されているのと同じ名前の通貨と製品をzepeto studioに登録してください。(通貨idと製品idが異なる場合、サンプルとリンクできません。) 通貨 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type アイテム製品 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 通貨パッケージ製品 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type アイテムパッケージ製品 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 2\) アセット/productsystem/prefabにある製品キャンバスをシーンにインポートします。 3\) プロジェクトのプロジェクト設定 > zepetoサービスを開いて、ワールドが正しく接続されているか確認してください。 4\) unityメニューバー > zepeto > 製品 > 設定を実行します。 通貨と製品リストが正しく表示されていれば、リンクは成功します。 assets>product>resourcesフォルダー内のアイコン画像が設定されていることを確認できます。 お好きな画像を使用して製品のアイコン写真を登録できます。 ❗️ 注意 製品が正しく表示されない場合は、以下を確認してください。 unity editorにログインしているアカウント情報が、world idの作成者の情報と同じであることを確認してください。 project settings > zepeto serviceの接続されたworld id情報が正しいことを確認してください。 サンプルで使用されているのと同じid通貨と製品を登録していることを確認してください。 5\) マルチサーバーをオンにして、サンプルを実行するために再生ボタンを押してください。 ステップ2 zepeto製品サンプルの理解 https //www youtube com/watch?v=jizxeaq nv8 ◦ エネルギーを得る ボタンをクリックすると、エネルギー製品が1つ得られます。 ◦ エネルギーを使用する ボタンをクリックすると、エネルギーアイテムを1つ差し引くことができます。 ◦ expを増加させる ボタンをクリックして、経験値を10得ます。経験値を得てレベルが上がると、5つのスター通貨が得られます。 ◦ ランダムアイテムを取得する ボタンをクリックして、4つのポーションアイテムのうちの1つをランダムにインベントリに追加します。 ◦ 即時購入 ボタンをクリックすると、エネルギーアイテムを1つ差し引いてポーション1を購入できます。購入ウィンドウは表示されず、購入したアイテムはすぐにインベントリに入ります。 ◦ uiを通じて購入 ボタンをクリックすると、購入ウィンドウが表示されます。購入ウィンドウから10スター通貨を差し引いてノート1を購入できます。 ◦ アイテムパッケージを購入 ボタンをクリックすると、購入ウィンドウが表示されます。購入ウィンドウからzepeto zemを差し引いてポーションパッケージ製品を購入できます。 バッグアイコン:ボタンをクリックすると、インベントリウィンドウが表示されます。所持しているアイテムのリストを確認し、選択して使用することができます。 ショッピングカートアイコン:ボタンをクリックすると、エネルギー通貨の購入ウィンドウが表示されます。購入ウィンドウからzepeto zemを差し引いて通貨パッケージ商品を購入できます。 zepeto製品テストの注意事項 マルチサーバーがオンのとき、zepeto製品テストはサンドボックスサーバーで可能です。 エディターで行った変更はzepetoスタジオに反映されません。 プレテストおよびリリースされたワールドに対する変更はzepetoスタジオに反映されます。 マルチサーバーがオフのとき、サンドボックステスト環境が初期化されます。(zepetoスタジオのデータで初期化されます。) 消耗品でないアイテムのテスト マルチサーバーがオンの場合、一度購入すると再度購入することはできません。 マルチサーバーをオフにすると、テスト環境が初期化されるため、再度マルチサーバーをオンにすると購入できます。 ワールドカバー画像を登録しないと、製品テストを適切に行うことができません。ワールドカバー画像がzepetoスタジオに正しく登録されているか確認してください。 ステップ 3 商品購入後のコンテンツの実装 サンプルは、アイテム使用後のコンテンツを実装しません。 その部分は、世界の製作者が意図した通りに直接実装する必要があります。 uicommonbtn tsのスクリプトを参照してください。 this multiplay room addmessagehandler\<inventorysync>("syncinventories", (message) => { this openinformation(`${message productid} がインベントリで ${inventoryaction\[message inventoryaction]} されました。`); // アイテム使用サンプル if(message inventoryaction == inventoryaction used){ if(message productid == "potion1"){ console log("ポーション使用!"); } } }); 商品の使用時に、商品idに応じてコンテンツコードを実装することが重要です。 potion2を使用する際に実装したい場合は、以下の変更を行ってください this multiplay room addmessagehandler\<inventorysync>("syncinventories", (message) => { this openinformation(`${message productid} がインベントリで ${inventoryaction\[message inventoryaction]} されました。`); // アイテム使用サンプル if(message inventoryaction == inventoryaction used){ if(message productid == "potion2"){ console log("ポーション2使用!"); } } }); zepeto製品を使用した経済システムをサーバーと通信するには、サーバースクリプトとクライアントスクリプトを別々に実装する必要があります。 スクリプトの実装については、zepeto製品サンプルおよびzepeto製品apiに実装された例のスクリプトを参照してください。

