Skip to content

Commit

Permalink
Merge pull request #6554 from planetarium/feature/simulator-test
Browse files Browse the repository at this point in the history
Introduce ArenaSimulation Test scene
  • Loading branch information
sonohoshi authored Dec 11, 2024
2 parents b440f44 + a76477c commit 425fe6e
Show file tree
Hide file tree
Showing 38 changed files with 60,917 additions and 13 deletions.
64 changes: 64 additions & 0 deletions nekoyume/Assets/Editor/AvatarAddressQueryEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Libplanet.Action.State;
using Libplanet.Crypto;
using Nekoyume;
using Nekoyume.Model.EnumType;
using Nekoyume.Model.State;
using UnityEditor;
using UnityEngine;

namespace Editor
{
public class AvatarAddressQueryEditor : EditorWindow
{
private static string _avatarAddress;
private static string _avatarQuery;
private static string _inventoryQuery;
private static string _allRuneQuery;
private static string _runeSlotQuery;
private static string _collectionQuery;

[MenuItem("Tools/Show AvatarAddressQuery Editor")]
private static void Init()
{
_avatarAddress = string.Empty;
var window = GetWindow(typeof(AvatarAddressQueryEditor));
window.Show();
}

private void OnGUI()
{
GUILayout.Label("아바타 주소로 시뮬레이션에 필요한 상태를 가져오는 쿼리를 생성해줍니다.");
_avatarAddress = EditorGUILayout.TextField("avatar address: ", _avatarAddress);
if (GUILayout.Button("try to generate gql"))
{
Debug.Log("Trying...");
const string query =
"state(accountAddress:\"{0}\", address:\"{1}\")";
_avatarQuery = $"query {{ {string.Format(format: query, Addresses.Avatar.ToString(), _avatarAddress)} }}";
_inventoryQuery = $"query {{ {string.Format(format: query, Addresses.Inventory.ToString(), _avatarAddress)} }}";
_allRuneQuery = $"query {{ {string.Format(format: query, Addresses.RuneState.ToString(), _avatarAddress)} }}";
_runeSlotQuery = $"query {{ {string.Format(format: query, ReservedAddresses.LegacyAccount.ToString(), RuneSlotState.DeriveAddress(new Address(_avatarAddress), BattleType.Arena))} }}";
_collectionQuery = $"query {{ {string.Format(format: query, Addresses.Collection.ToString(), _avatarAddress)} }}";
}

CopyableLabelField("avatar state: ", _avatarQuery);
CopyableLabelField("inventory state: ", _inventoryQuery);
CopyableLabelField("all rune state: ", _allRuneQuery);
CopyableLabelField("rune slot state: ", _runeSlotQuery);
CopyableLabelField("collection state: ", _collectionQuery);
}

private static void CopyableLabelField(string label, string value)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, value);
var icon = EditorGUIUtility.IconContent("clipboard", "Copy to clipboard");
if (GUILayout.Button(icon, GUILayout.ExpandWidth(false)))
{
EditorGUIUtility.systemCopyBuffer = value;
}

EditorGUILayout.EndHorizontal();
}
}
}
3 changes: 3 additions & 0 deletions nekoyume/Assets/Editor/AvatarAddressQueryEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_allrune1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions nekoyume/Assets/StreamingAssets/serialized_allrune1.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_allrune2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions nekoyume/Assets/StreamingAssets/serialized_allrune2.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_avatar1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions nekoyume/Assets/StreamingAssets/serialized_avatar1.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_avatar2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions nekoyume/Assets/StreamingAssets/serialized_avatar2.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_collection1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_collection2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_inventory1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_inventory2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_runeslot1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions nekoyume/Assets/StreamingAssets/serialized_runeslot1.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nekoyume/Assets/StreamingAssets/serialized_runeslot2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions nekoyume/Assets/StreamingAssets/serialized_runeslot2.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 425fe6e

Please sign in to comment.