Example #1
0
        // Inspector 表示
        public override void OnInspectorGUI()
        {
            AssetCatalog t = this.target as AssetCatalog;
            Dictionary <string, AssetCatalog.SettingParam> dic = t.editParamDic;

            GUILayout.Space(5f);
            // Prefab 設定
            System.Array enumArray   = System.Enum.GetValues(typeof(U));
            int          objectCount = enumArray.Length;

            for (int i = 0; i < objectCount; ++i)
            {
                string key = enumArray.GetValue(i).ToString();
                AssetCatalog.SettingParam param = dic[key];
                GUILayout.BeginHorizontal();
                GUIContent content = new GUIContent(i.ToString("D3") + " " + key,
                                                    "Asset 指定");
                dic[key].origin = EditorGUILayout.ObjectField(content,
                                                              param.origin,
                                                              typeof(T),
                                                              false,
                                                              GUILayout.MinWidth(250f)) as T;
                dic[key].genCount = EditorGUILayout.IntField(param.genCount,
                                                             GUILayout.MaxWidth(100f));
                GUILayout.EndHorizontal();
            }
            if (GUI.changed || (objectCount != t.GetCatalogCount()))
            {
                t.UpdateSerializedList <U>();
                EditorUtility.SetDirty(t);
            }
        }
Example #2
0
        /// <summary>
        /// シリアライズデータの更新
        /// </summary>
        /// <typeparam name="U"></typeparam>
        public void UpdateSerializedList <U>() where U : struct
        {
            System.Array enumArray   = System.Enum.GetValues(typeof(U));
            int          objectCount = enumArray.Length;

            this.serializedParams = new SettingParam[objectCount];
            for (int i = 0; i < objectCount; ++i)
            {
                string       key   = enumArray.GetValue(i).ToString();
                SettingParam param = null;
                if (!this.editParamDic.TryGetValue(key, out param))
                {
                    param = new AssetCatalog.SettingParam(key, null, 1);
                }
                this.serializedParams[i] = param;
            }
        }