FreeTrainの進化系を目指す
SkinCatalog実装中
| @@ -71,7 +71,7 @@ | ||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public virtual bool Select(CatalogVariableCollection.ValueMap valueMap, out ConditionedTextureSrc result, out ICatalogSource<ConditionedTextureSrc> child) { |
| 74 | - ConditionedTextureSrc[] array = ArrayForCatalogVariable; | |
| 74 | + //ConditionedTextureSrc[] array = ArrayForCatalogVariable; | |
| 75 | 75 | int idx = (int)valueMap[CatalogVarNameConstants.Direction]; |
| 76 | 76 | child = null; |
| 77 | 77 | result = this[idx]; |
| @@ -27,6 +27,7 @@ | ||
| 27 | 27 | varCollection = new CatalogVariableCollection(); |
| 28 | 28 | PluginManager pm = PluginManager.theInstance; |
| 29 | 29 | IEnumerable<CtbStructureSkin> contribs = pm.EnumContributions<CtbStructureSkin>(); |
| 30 | + // TODO: 同名でグループ化したツリー構造化 | |
| 30 | 31 | List<CtbStructureSkin> list = new List<CtbStructureSkin>(contribs); |
| 31 | 32 | CatListVariable<CtbStructureSkin> var = new CatListVariable<CtbStructureSkin>(list, true); |
| 32 | 33 | varElement = new CatalogVarCollectionElement(CatalogVarNameConstants.Design,"種類"); |
| @@ -40,11 +41,21 @@ | ||
| 40 | 41 | |
| 41 | 42 | #region ICatalogSource implementation |
| 42 | 43 | public IEnumerable<KeyValuePair<string, ICatalogVariable>> CatalogVariables { |
| 43 | - get { throw new NotImplementedException(); } | |
| 44 | + get { | |
| 45 | + yield return new KeyValuePair<string, ICatalogVariable>(varElement.Name, varElement.Variable); | |
| 46 | + yield break; | |
| 47 | + } | |
| 44 | 48 | } |
| 45 | 49 | |
| 46 | 50 | public bool Select(CatalogVariableCollection.ValueMap valueMap, out ConditionedTextureSrc result, out ICatalogSource<ConditionedTextureSrc> child) { |
| 47 | - throw new NotImplementedException(); | |
| 51 | + object val = valueMap[CatalogVarNameConstants.Design]; | |
| 52 | + CatListVariable<CtbStructureSkin> var = valueMap[CatalogVarNameConstants.Design] as CatListVariable<CtbStructureSkin>; | |
| 53 | + CtbStructureSkin ctbSkin = var.Current; | |
| 54 | + result = null; | |
| 55 | + child = null; | |
| 56 | + if (ctbSkin == null) return false; | |
| 57 | + child = ctbSkin.TextureSet; | |
| 58 | + return true; | |
| 48 | 59 | } |
| 49 | 60 | #endregion |
| 50 | 61 | } |
| @@ -8,6 +8,13 @@ | ||
| 8 | 8 | get; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | + /// <summary> | |
| 12 | + /// カタログ変数に応じて、エントリを選択する | |
| 13 | + /// </summary> | |
| 14 | + /// <param name="valueMap">現在の選択状態を保持するパラメーターマップ</param> | |
| 15 | + /// <param name="result">選択結果、見つからなければnull</param> | |
| 16 | + /// <param name="child">さらに子の要素があれば返す</param> | |
| 17 | + /// <returns>選択結果がnullでなければtrue</returns> | |
| 11 | 18 | bool Select(CatalogVariableCollection.ValueMap valueMap, out T result, out ICatalogSource<T> child); |
| 12 | 19 | } |
| 13 | 20 | } |