コード例 #1
0
        private void OnGUI()
        {
            _source  = (Source)EditorGUILayout.EnumPopup("Source", _source);
            itemGuid = EditorGUILayout.TextField("Item GUID", itemGuid);

            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, true);

            if (string.IsNullOrEmpty(itemGuid))
            {
                if (_source == Source.Server)
                {
                    var items = ServerItemRegistry.GetAll();
                    foreach (var item in items)
                    {
                        DrawItemInfo(item);
                    }
                }
                else if (_source == Source.Client)
                {
                    var items = ItemRegistry.GetAll();
                    foreach (var item in items)
                    {
                        DrawItemInfo(item);
                    }
                }
            }
            else
            {
                System.Guid guid;
                if (System.Guid.TryParse(itemGuid, out guid))
                {
                    if (_source == Source.Server)
                    {
                        var item = ServerItemRegistry.Get(guid);
                        DrawItemInfo(item);
                    }
                    else if (_source == Source.Client)
                    {
                        var col = ItemRegistry.Get(guid);
                        DrawItemInfo(col);
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("guid is not a valid parsable GUID value");
                }
            }

            EditorGUILayout.EndScrollView();
        }