FreeTrainの進化系を目指す
建物建設ツールの下準備中
| @@ -16,9 +16,15 @@ | ||
| 16 | 16 | </contribution> |
| 17 | 17 | <contribution type="Command" id="C_BuildTool"> |
| 18 | 18 | <name>建造物設置フォーム</name> |
| 19 | - <class name="nft.ui.core.BuildToolForm" codebase=".UI"/> | |
| 19 | + <class name="nft.ui.core.BuildTool" codebase=".UI"/> | |
| 20 | 20 | <command type="ModelessForm" menupath="BUILD\STRUCTURES" /> |
| 21 | 21 | </contribution> |
| 22 | + <contribution type="GameTool" id="BuildTool"> | |
| 23 | + <name>建造物設置ツール</name> | |
| 24 | + <controller modeless="true"> | |
| 25 | + <class name="nft.core.controller.BuildTool" codebase=".Core"/> | |
| 26 | + </controller> | |
| 27 | + </contribution> | |
| 22 | 28 | |
| 23 | 29 | <contribution type="image" id="pic.ModernDepartment"> |
| 24 | 30 | <default src="stationMDNDepart.bmp"/> |
| @@ -30,6 +30,12 @@ | ||
| 30 | 30 | <description>Child GUI forms</description> |
| 31 | 31 | <class name="nft.contributions.ui.CtbSubform"/> |
| 32 | 32 | </declare-contribution> |
| 33 | + <declare-contribution> | |
| 34 | + <name>GameTool</name> | |
| 35 | + <description>provide control for player on current game.</description> | |
| 36 | + <class name="nft.contributions.game.CtbGameTool" codebase=".Core"/> | |
| 37 | + </declare-contribution> | |
| 38 | + | |
| 33 | 39 | <declare-contribution type="MenuItems"> |
| 34 | 40 | <name>Menu items</name> |
| 35 | 41 | <class name="nft.contributions.ui.CtbMenuItem"/> |
| @@ -16,12 +16,13 @@ | ||
| 16 | 16 | /// <summary> |
| 17 | 17 | /// CommandEntityContributuion の概要の説明です。 |
| 18 | 18 | /// </summary> |
| 19 | - public class CtbGameTool : CtbSubform | |
| 19 | + public class CtbGameTool : Contribution | |
| 20 | 20 | { |
| 21 | 21 | public CtbGameTool(Plugin p, ParamsReader e) |
| 22 | 22 | : base(p, e) |
| 23 | 23 | { |
| 24 | - | |
| 24 | + ParamsReader ctrl = e["controller"]; | |
| 25 | + object o = PluginUtil.loadObjectFromManifest(ctrl, new object[]{this}); | |
| 25 | 26 | } |
| 26 | 27 | } |
| 27 | 28 |
| @@ -12,12 +12,12 @@ | ||
| 12 | 12 | using nft.core; |
| 13 | 13 | using System.Drawing; |
| 14 | 14 | using nft.core.graphics; |
| 15 | +using ConditionedTextureSrc = nft.core.view.ConditionedResource<nft.core.graphics.TextureSrc>; | |
| 15 | 16 | |
| 16 | - | |
| 17 | 17 | namespace nft.contributions.graphics { |
| 18 | 18 | public class CtbStructureSkin : Contribution{ |
| 19 | 19 | protected ISiteDefiner site; |
| 20 | - protected ConditionedResource<TextureSrc>[] textures = new ConditionedResource<TextureSrc>[4]; | |
| 20 | + protected DirectionalTextureSet textures; | |
| 21 | 21 | //protected |
| 22 | 22 | |
| 23 | 23 | public static InterCardinalDirection ToDirection(int rotate_val) { |
| @@ -26,7 +26,7 @@ | ||
| 26 | 26 | if (Math.Abs(rotate_val) > 4) { |
| 27 | 27 | // Normalize degree value into PI multiplier (form -3 to 3). |
| 28 | 28 | rotate_val /= 90; |
| 29 | - rotate_val %= 4; | |
| 29 | + rotate_val %= 4; | |
| 30 | 30 | } |
| 31 | 31 | // Normalize negative multiplier to positive. |
| 32 | 32 | if (rotate_val < 0) rotate_val += 4; |
| @@ -35,21 +35,44 @@ | ||
| 35 | 35 | return ret; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public CtbStructureSkin(Plugin owenr, ParamsReader reader) | |
| 39 | - : base(owenr, reader) { | |
| 40 | - site = ParseSite(reader); | |
| 38 | + public static DirectionalTextureSet CreateDirectionalTextureSet(ParamsReader reader, ResourceParser<TextureSrc> parser) { | |
| 39 | + ConditionedTextureSrc[] array = new ConditionedTextureSrc[4]; | |
| 41 | 40 | foreach (ParamsReader pr in reader["sprite"].Each) { |
| 42 | - string[] args = pr["rotation"].InnerTextOr("0").Split(','); | |
| 43 | - ConditionedResource<TextureSrc> _texture | |
| 44 | - = ConditionedResourceFactory.LoadAsConditiondResources<TextureSrc>(pr, new ResourceParser<TextureSrc>(ParseTexture)); | |
| 41 | + string[] args = pr["rotation"].InnerTextOr("0").Split(','); | |
| 42 | + ConditionedTextureSrc _texture | |
| 43 | + = ConditionedResourceFactory.LoadAsConditiondResources<TextureSrc>(pr,parser); | |
| 45 | 44 | foreach (string arg in args) { |
| 46 | 45 | int rotate = int.Parse(arg); |
| 47 | 46 | InterCardinalDirection dir = CtbStructureSkin.ToDirection(rotate); |
| 48 | - textures[Direction.ToZeroBaseIndex(dir)] = _texture; | |
| 47 | + int idx = Direction.ToZeroBaseIndex(dir); | |
| 48 | + if (array[idx] != null) { | |
| 49 | + string msg = String.Format("Duplicate rotaion '{0}' in the series of sprite elements."); | |
| 50 | + throw new PluginXmlException(reader, msg); | |
| 51 | + } | |
| 52 | + array[idx] = _texture; | |
| 49 | 53 | } |
| 50 | 54 | } |
| 55 | + if (array[0] == null) { | |
| 56 | + throw new PluginXmlException(reader, "There mast be a 'sprite' element which rotation=0."); | |
| 57 | + } else { | |
| 58 | + | |
| 59 | + } | |
| 60 | + return DirectionalTextureSet.Create(array); | |
| 51 | 61 | } |
| 52 | 62 | |
| 63 | + public CtbStructureSkin(Plugin owenr, ParamsReader reader) | |
| 64 | + : base(owenr, reader) { | |
| 65 | + site = ParseSite(reader); | |
| 66 | + try { | |
| 67 | + textures = CreateDirectionalTextureSet(reader, ParseTexture); | |
| 68 | + } catch (ArgumentException ae){ | |
| 69 | + throw new PluginXmlException(this, reader, ae.Message); | |
| 70 | + } catch (PluginXmlException pe) { | |
| 71 | + pe.AttachContribution(this); | |
| 72 | + throw; | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 53 | 76 | protected virtual ISiteDefiner ParseSite(ParamsReader reader) { |
| 54 | 77 | ParamsReader pr2 = reader["site"]; |
| 55 | 78 | return new BasicSiteDefiner(pr2); |
| @@ -71,15 +94,18 @@ | ||
| 71 | 94 | } |
| 72 | 95 | } |
| 73 | 96 | |
| 74 | - public ConditionedResource<TextureSrc>[] TextureSources { | |
| 97 | + public DirectionalTextureSet TextureSet { | |
| 75 | 98 | get { |
| 76 | 99 | return textures; |
| 77 | 100 | } |
| 78 | 101 | } |
| 79 | 102 | |
| 80 | - public StructureSkin GetRotated(InterCardinalDirection view_upper) { | |
| 81 | - return new StructureSkin(this, view_upper); | |
| 103 | + public StructureSkin NewSkin(InterCardinalDirection rotation_offset) { | |
| 104 | + return new StructureSkin(this, rotation_offset); | |
| 82 | 105 | } |
| 83 | 106 | |
| 107 | + public virtual ICatalogSource<ConditionedTextureSrc> GetCatalogSource(){ | |
| 108 | + return TextureSet; | |
| 109 | + } | |
| 84 | 110 | } |
| 85 | 111 | } |
| @@ -3,6 +3,7 @@ | ||
| 3 | 3 | using System.Text; |
| 4 | 4 | using nft.contributions.graphics; |
| 5 | 5 | using System.Drawing; |
| 6 | +using nft.core.view; | |
| 6 | 7 | |
| 7 | 8 | namespace nft.core.graphics { |
| 8 | 9 | public class TextureSrc { |
| @@ -14,4 +15,14 @@ | ||
| 14 | 15 | this.Region = rect; |
| 15 | 16 | } |
| 16 | 17 | } |
| 18 | + | |
| 19 | + /* | |
| 20 | + /// <summary> | |
| 21 | + /// 今のところはusingで代用 | |
| 22 | + /// </summary> | |
| 23 | + public class ConditionedTextureSrc : ConditionedResource<TextureSrc> { | |
| 24 | + public ConditionedTextureSrc(TextureSrc _default) : base(_default){ | |
| 25 | + } | |
| 26 | + } | |
| 27 | + */ | |
| 17 | 28 | } |
| @@ -0,0 +1,151 @@ | ||
| 1 | +using nft.core.geometry; | |
| 2 | +using nft.core.structure; | |
| 3 | +using nft.core.view; | |
| 4 | +using System; | |
| 5 | +using System.Collections.Generic; | |
| 6 | +using System.Text; | |
| 7 | +using ConditionedTextureSrc = nft.core.view.ConditionedResource<nft.core.graphics.TextureSrc>; | |
| 8 | + | |
| 9 | +namespace nft.core.graphics { | |
| 10 | + public abstract class DirectionalTextureSet : ICatalogSource<ConditionedTextureSrc> { | |
| 11 | + public static DirectionalTextureSet Create(params ConditionedTextureSrc[] _textures) { | |
| 12 | + switch(_textures.Length){ | |
| 13 | + case 1: | |
| 14 | + return new Rotation4FoldSymmetricTextureSet(_textures[0]); | |
| 15 | + case 2: | |
| 16 | + return new Rotation2FoldSymmetricTextureSet(_textures[0], _textures[1]); | |
| 17 | + case 4: | |
| 18 | + if (_textures[0] == _textures[2] && _textures[1] == _textures[3]) { | |
| 19 | + if (_textures[0] == _textures[1]) { | |
| 20 | + return new Rotation4FoldSymmetricTextureSet(_textures[0]); | |
| 21 | + } else { | |
| 22 | + return new Rotation2FoldSymmetricTextureSet(_textures[0], _textures[1]); | |
| 23 | + } | |
| 24 | + } else { | |
| 25 | + if (_textures[2] == null && _textures[3] == null) { | |
| 26 | + if (_textures[1] == null) { | |
| 27 | + return new Rotation4FoldSymmetricTextureSet(_textures[0]); | |
| 28 | + } else { | |
| 29 | + return new Rotation2FoldSymmetricTextureSet(_textures[0], _textures[1]); | |
| 30 | + } | |
| 31 | + } else { | |
| 32 | + return new DefaultDirectionalTextureSet(_textures); | |
| 33 | + } | |
| 34 | + } | |
| 35 | + default: | |
| 36 | + string msg = String.Format("Cannot create from the array with {0} elements (only 1,2,4 is acceptable).", _textures.Length); | |
| 37 | + throw new ArgumentException(msg, "_textrues"); | |
| 38 | + } | |
| 39 | + } | |
| 40 | + | |
| 41 | + public virtual ConditionedTextureSrc this[InterCardinalDirection upperDir] { | |
| 42 | + get { | |
| 43 | + //return this[Direction.ToZeroBaseIndex(upperDir)]; | |
| 44 | + // 本来は↑とするのが正しいが、無駄な計算を省くため簡略化。 | |
| 45 | + // ToZeroBaseIndexは4を引くだけなので、4の剰余を採ればどのみち結果は同じ。 | |
| 46 | + return this[(int)upperDir]; | |
| 47 | + } | |
| 48 | + } | |
| 49 | + /// <summary> | |
| 50 | + /// Returns TextureSrc for specific rotation. | |
| 51 | + /// </summary> | |
| 52 | + /// <param name="rotation">Rotation step, 1 for 90 degrees.</param> | |
| 53 | + /// <returns></returns> | |
| 54 | + public abstract ConditionedTextureSrc this[int rotation] { get; } | |
| 55 | + | |
| 56 | + protected abstract ConditionedTextureSrc[] ArrayForCatalogVariable { get; } | |
| 57 | + | |
| 58 | + public virtual IEnumerable<KeyValuePair<string, ICatalogVariable>> CatalogVariables { | |
| 59 | + get { | |
| 60 | + ConditionedTextureSrc[] array = ArrayForCatalogVariable; | |
| 61 | + if (array != null && array.Length > 1) { | |
| 62 | + ICatalogVariable var = new IndexVariable(array.Length, true); | |
| 63 | + yield return new KeyValuePair<string, ICatalogVariable>(CatalogVarNameConstants.Direction, var); | |
| 64 | + } else { | |
| 65 | + yield break; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + public virtual bool Select(CatalogVariableCollection.ValueMap valueMap, out ConditionedTextureSrc result, out ICatalogSource<ConditionedTextureSrc> child) { | |
| 71 | + ConditionedTextureSrc[] array = ArrayForCatalogVariable; | |
| 72 | + int idx = (int)valueMap[CatalogVarNameConstants.Direction]; | |
| 73 | + child = null; | |
| 74 | + result = this[idx]; | |
| 75 | + return result!=null; | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | + public class DefaultDirectionalTextureSet : DirectionalTextureSet { | |
| 80 | + protected ConditionedTextureSrc[] textures; | |
| 81 | + public DefaultDirectionalTextureSet(params ConditionedTextureSrc[] _textures) { | |
| 82 | + if (_textures.Length != 4) { | |
| 83 | + throw new ArgumentException("the Array must has 4 elements.", "_textrues"); | |
| 84 | + } | |
| 85 | + this.textures = _textures; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public override ConditionedTextureSrc this[int rotation] { | |
| 89 | + get{ | |
| 90 | + return textures[rotation&3]; | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + protected override ConditionedTextureSrc[] ArrayForCatalogVariable { | |
| 95 | + get { return textures; } | |
| 96 | + } | |
| 97 | + } | |
| 98 | + | |
| 99 | + /// <summary> | |
| 100 | + /// 東西方向と南北方向の2パターンで構成されるテクスチャ | |
| 101 | + /// </summary> | |
| 102 | + public class Rotation2FoldSymmetricTextureSet : DirectionalTextureSet { | |
| 103 | + protected ConditionedTextureSrc[] textures; | |
| 104 | + public Rotation2FoldSymmetricTextureSet(params ConditionedTextureSrc[] _textures) { | |
| 105 | + if (_textures.Length != 2) { | |
| 106 | + throw new ArgumentException("the Array must has 2 elements.", "_textrues"); | |
| 107 | + } | |
| 108 | + this.textures = _textures; | |
| 109 | + } | |
| 110 | + public override ConditionedTextureSrc this[int rotation] { | |
| 111 | + get { | |
| 112 | + return textures[rotation & 1]; | |
| 113 | + } | |
| 114 | + } | |
| 115 | + protected override ConditionedTextureSrc[] ArrayForCatalogVariable { | |
| 116 | + get { return textures; } | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + /// <summary> | |
| 121 | + /// 4方向どこから見ても同じテクスチャ | |
| 122 | + /// </summary> | |
| 123 | + public class Rotation4FoldSymmetricTextureSet : DirectionalTextureSet { | |
| 124 | + protected ConditionedTextureSrc texture; | |
| 125 | + | |
| 126 | + public Rotation4FoldSymmetricTextureSet(ConditionedTextureSrc _texture) { | |
| 127 | + this.texture = _texture; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public override ConditionedTextureSrc this[int rotation] { | |
| 131 | + get { return texture; } | |
| 132 | + } | |
| 133 | + | |
| 134 | + public override IEnumerable<KeyValuePair<string, ICatalogVariable>> CatalogVariables { | |
| 135 | + get { | |
| 136 | + yield break; | |
| 137 | + } | |
| 138 | + } | |
| 139 | + protected override ConditionedTextureSrc[] ArrayForCatalogVariable { | |
| 140 | + // このクラスは CatalogVariablesを返さないので、このメソッドも呼ばれないはず。 | |
| 141 | + get { throw new NotSupportedException(); } | |
| 142 | + } | |
| 143 | + | |
| 144 | + public override bool Select(CatalogVariableCollection.ValueMap valueMap, out ConditionedTextureSrc result, out ICatalogSource<ConditionedTextureSrc> child) { | |
| 145 | + result = texture; | |
| 146 | + child = null; | |
| 147 | + return true; | |
| 148 | + } | |
| 149 | + } | |
| 150 | + | |
| 151 | +} |
| @@ -11,7 +11,7 @@ | ||
| 11 | 11 | |
| 12 | 12 | namespace nft.core.graphics { |
| 13 | 13 | public interface IStructureSkin { |
| 14 | - ITexture this[ISceneParams p] { | |
| 14 | + ITexture this[ISceneParams p, InterCardinalDirection upperDir] { | |
| 15 | 15 | get; |
| 16 | 16 | } |
| 17 | 17 |
| @@ -26,11 +26,11 @@ | ||
| 26 | 26 | |
| 27 | 27 | public class StructureSkin : IStructureSkin { |
| 28 | 28 | private CtbStructureSkin contrib; |
| 29 | - private InterCardinalDirection view_upper; | |
| 29 | + private InterCardinalDirection rotationOffset; | |
| 30 | 30 | |
| 31 | - public StructureSkin(CtbStructureSkin ctb, InterCardinalDirection upper) { | |
| 31 | + public StructureSkin(CtbStructureSkin ctb, InterCardinalDirection rotation_offset) { | |
| 32 | 32 | this.contrib = ctb; |
| 33 | - this.view_upper = upper; | |
| 33 | + this.rotationOffset = rotation_offset; | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public CtbStructureSkin Contribution { |
| @@ -39,10 +39,10 @@ | ||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public virtual ITexture this[ISceneParams p] { | |
| 42 | + public virtual ITexture this[ISceneParams p, InterCardinalDirection upperDir] { | |
| 43 | 43 | get { |
| 44 | - int rot_idx = (int)view_upper; | |
| 45 | - TextureSrc src = Contribution.TextureSources[rot_idx][p]; | |
| 44 | + int rot_idx = (int)upperDir - (int)rotationOffset; | |
| 45 | + TextureSrc src = Contribution.TextureSet[rot_idx][p]; | |
| 46 | 46 | GraphicManagerEx gm = GraphicManagerEx.GraphicManager; |
| 47 | 47 | ResourceKey key = ResourceKey.CreateKey(Contribution, (ushort)rot_idx); |
| 48 | 48 | ITexture tex = gm.CreateStaticTexture(key, src.ImageResource.Data[p].ImageSrc, src.Region); |
| @@ -0,0 +1,92 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Text; | |
| 4 | +using _ElementState = nft.core.structure.CatalogVariableCollection.ElementState; | |
| 5 | + | |
| 6 | +namespace nft.core.structure { | |
| 7 | + public delegate void CatalogVarCollectionElementEventHandler(CatalogVarCollectionElementEventArgs arg); | |
| 8 | + | |
| 9 | + /// <summary> | |
| 10 | + /// CatalogVariableCollectionの要素としてICatalogVariableをホストするオブジェクト | |
| 11 | + /// </summary> | |
| 12 | + public class CatalogVarCollectionElement { | |
| 13 | + protected string id; | |
| 14 | + protected string name; | |
| 15 | + protected ICatalogVariable var; | |
| 16 | + protected IList<string> influences; | |
| 17 | + protected bool bLoop, bRand, bAuto; | |
| 18 | + | |
| 19 | + public CatalogVarCollectionElement(string _id, string _name, bool loop = true, bool rand = true, bool auto = false) | |
| 20 | + : this(_id, _name, null, loop, rand, auto) { | |
| 21 | + } | |
| 22 | + | |
| 23 | + public CatalogVarCollectionElement(string _id, string _name, ICatalogVariable catvar, bool loop = true, bool rand = true, bool auto = false) { | |
| 24 | + this.id = _id; | |
| 25 | + this.name = _name; | |
| 26 | + this.bLoop = loop; | |
| 27 | + this.bRand = rand; | |
| 28 | + this.bAuto = auto; | |
| 29 | + this.var = catvar; | |
| 30 | + } | |
| 31 | + public bool AllowLoop { get { return bLoop; } } | |
| 32 | + public bool AllowRandom { get { return bRand; } } | |
| 33 | + public bool AllowAuto { get { return bAuto; } } | |
| 34 | + | |
| 35 | + public string ID { get { return id; } } | |
| 36 | + public string Name { get { return name; } } | |
| 37 | + public ICatalogVariable Variable { | |
| 38 | + get { return var; } | |
| 39 | + set { | |
| 40 | + if (var != value) { | |
| 41 | + UnsetProxyHandlers(var); | |
| 42 | + var = value; | |
| 43 | + SetProxyHandlers(var); | |
| 44 | + if (VariableModelChanged != null) { | |
| 45 | + VariableModelChanged(new CatalogVarCollectionElementEventArgs(this)); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + #region internal event handler management | |
| 52 | + protected void SetProxyHandlers(ICatalogVariable var) { | |
| 53 | + var.ValueChanged += VariableCurrentChangedProxy; | |
| 54 | + var.OptionChanged += VariableOptionChangedProxy; | |
| 55 | + } | |
| 56 | + | |
| 57 | + protected void UnsetProxyHandlers(ICatalogVariable var) { | |
| 58 | + if (var != null) { | |
| 59 | + var.ValueChanged -= VariableCurrentChangedProxy; | |
| 60 | + var.OptionChanged -= VariableOptionChangedProxy; | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + protected void VariableOptionChangedProxy(CatalogVariableEventArgs arg) { | |
| 65 | + if (VariableOptionChanged != null) { | |
| 66 | + VariableOptionChanged(new CatalogVarCollectionElementEventArgs(this, arg)); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + protected void VariableCurrentChangedProxy(CatalogVariableEventArgs arg) { | |
| 71 | + if (VariableCurrentChanged != null) { | |
| 72 | + VariableCurrentChanged(new CatalogVarCollectionElementEventArgs(this, arg)); | |
| 73 | + } | |
| 74 | + } | |
| 75 | + #endregion | |
| 76 | + | |
| 77 | + public IList<string> InfluenceIDs { get { return influences; } } | |
| 78 | + | |
| 79 | + public event CatalogVarCollectionElementEventHandler VariableModelChanged; | |
| 80 | + public event CatalogVarCollectionElementEventHandler VariableCurrentChanged; | |
| 81 | + public event CatalogVarCollectionElementEventHandler VariableOptionChanged; | |
| 82 | + } | |
| 83 | + public class CatalogVarCollectionElementEventArgs : EventArgs { | |
| 84 | + public readonly CatalogVarCollectionElement Source; | |
| 85 | + public readonly CatalogVariableEventArgs OriginalEvent; | |
| 86 | + public CatalogVarCollectionElementEventArgs(CatalogVarCollectionElement src, CatalogVariableEventArgs args) { | |
| 87 | + this.Source = src; | |
| 88 | + this.OriginalEvent = args; | |
| 89 | + } | |
| 90 | + public CatalogVarCollectionElementEventArgs(CatalogVarCollectionElement src) : this(src,null) {} | |
| 91 | + } | |
| 92 | +} |
| @@ -0,0 +1,273 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Text; | |
| 4 | +using _ElementState = nft.core.structure.CatalogVariableCollection.ElementState; | |
| 5 | + | |
| 6 | +namespace nft.core.structure { | |
| 7 | + public delegate void CatalogVarCollectionEventHandler(CatalogVarCollectionEventArgs arg); | |
| 8 | + | |
| 9 | + /// <summary> | |
| 10 | + /// 設置する構造物の選択肢などを保持し、ツールフォームのモデルとするためのコレクション。 | |
| 11 | + /// ICatalogVariableと付随情報をリスト化して保持する。インデックスと名前検索併用可能 | |
| 12 | + /// </summary> | |
| 13 | + public class CatalogVariableCollection { | |
| 14 | + public enum ElementState { Added, Removed, Replaced, ModelUpdated }; | |
| 15 | + protected IList<string> order; | |
| 16 | + protected ValueMap valMap; | |
| 17 | + protected IDictionary<String, CatalogVarCollectionElement> map; | |
| 18 | + protected IDictionary<String, object> current_cache; | |
| 19 | + protected bool susupendModelEvent = false; | |
| 20 | + protected List<KeyValuePair<string, ElementState>> modifications; | |
| 21 | + protected bool listDirty = false; | |
| 22 | + public event CatalogVarCollectionEventHandler ListElementsChanged; | |
| 23 | + public event CatalogVarCollectionEventHandler VariableCurrentChanged; | |
| 24 | + public event CatalogVarCollectionEventHandler VariableOptionChanged; | |
| 25 | + | |
| 26 | + public CatalogVariableCollection() { | |
| 27 | + this.order = new List<string>(); | |
| 28 | + this.valMap = new ValueMap(this); | |
| 29 | + this.map = new Dictionary<string, CatalogVarCollectionElement>(); | |
| 30 | + this.current_cache = new Dictionary<string, object>(); | |
| 31 | + this.modifications = new List<KeyValuePair<string, ElementState>>(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + public CatalogVarCollectionElement this[string key] { | |
| 35 | + get { return map[key]; } | |
| 36 | + } | |
| 37 | + public CatalogVarCollectionElement this[int index] { | |
| 38 | + get { | |
| 39 | + return this[order[index]]; | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void SuspendModelEvent(){ | |
| 44 | + susupendModelEvent = true; | |
| 45 | + } | |
| 46 | + public void ResumeModelEvent() { | |
| 47 | + susupendModelEvent = false; | |
| 48 | + FireEventIfDirty(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + protected void FireEventIfDirty() { | |
| 52 | + if (modifications.Count > 0) { | |
| 53 | + if (ListElementsChanged != null) { | |
| 54 | + ListElementsChanged(CreateModelEvent()); | |
| 55 | + } | |
| 56 | + modifications.Clear(); | |
| 57 | + } | |
| 58 | + } | |
| 59 | + | |
| 60 | + protected void SetElementModified(string key, ElementState state) { | |
| 61 | + modifications.Add(new KeyValuePair<string, ElementState>(key, state)); | |
| 62 | + if (!susupendModelEvent) { | |
| 63 | + FireEventIfDirty(); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + protected CatalogVarModelEventArgs CreateModelEvent() { | |
| 68 | + return new CatalogVarModelEventArgs(this, new List<KeyValuePair<string, ElementState>>(modifications)); | |
| 69 | + } | |
| 70 | + | |
| 71 | + public int AddElement(CatalogVarCollectionElement elm){ | |
| 72 | + string key = elm.Name; | |
| 73 | + if (map.ContainsKey(key)) { | |
| 74 | + //throw new InvalidOperationException("The Element of the name '"+key+"' is already exist."); | |
| 75 | + return ReplaceElement(elm); | |
| 76 | + } else { | |
| 77 | + order.Add(key); | |
| 78 | + SetElementInternal(elm); | |
| 79 | + return order.Count-1; | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 83 | + public int InsertElementAt(CatalogVarCollectionElement elm, int index) { | |
| 84 | + string key = elm.Name; | |
| 85 | + if (map.ContainsKey(key)) { | |
| 86 | + //throw new InvalidOperationException("The Element of the name '" + key + "' is already exist."); | |
| 87 | + return ReplaceElement(elm, index); | |
| 88 | + } else { | |
| 89 | + order.Insert(index, key); | |
| 90 | + SetElementInternal(elm); | |
| 91 | + return index; | |
| 92 | + } | |
| 93 | + } | |
| 94 | + | |
| 95 | + public int ReplaceElement(CatalogVarCollectionElement elm, int newIndex = -1) { | |
| 96 | + string key = elm.Name; | |
| 97 | + int idx = order.IndexOf(key); | |
| 98 | + if (idx>=0) { | |
| 99 | + if (newIndex >= 0 && idx != newIndex) { | |
| 100 | + order.RemoveAt(idx); | |
| 101 | + order.Insert(newIndex, key); | |
| 102 | + } | |
| 103 | + UnsetProxyHandlers(map[key]); | |
| 104 | + SetElementInternal(elm, ElementState.Replaced); | |
| 105 | + return newIndex; | |
| 106 | + } else { | |
| 107 | + if (newIndex >= 0) { | |
| 108 | + return InsertElementAt(elm, newIndex); | |
| 109 | + } else { | |
| 110 | + return AddElement(elm); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + } | |
| 114 | + | |
| 115 | + public int RemoveElement(CatalogVarCollectionElement elm) { | |
| 116 | + string key = elm.Name; | |
| 117 | + int idx = order.IndexOf(key); | |
| 118 | + if (idx >= 0) { | |
| 119 | + order.RemoveAt(idx); | |
| 120 | + } | |
| 121 | + UnsetProxyHandlers(elm); | |
| 122 | + map.Remove(key); | |
| 123 | + SetElementModified(key, ElementState.Removed); | |
| 124 | + return idx; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public int RemoveElementAt(int index) { | |
| 128 | + CatalogVarCollectionElement elm = this[index]; | |
| 129 | + return RemoveElement(elm); | |
| 130 | + } | |
| 131 | + | |
| 132 | + public ValueMap Values { | |
| 133 | + get { return valMap; } | |
| 134 | + } | |
| 135 | + | |
| 136 | + protected virtual void SetElementInternal(CatalogVarCollectionElement elm, ElementState es = ElementState.Added) { | |
| 137 | + string key = elm.Name; | |
| 138 | + map[key] = elm; | |
| 139 | + TryRestoreCurrentCache(elm); | |
| 140 | + SetProxyHandlers(elm); | |
| 141 | + SetElementModified(key, es); | |
| 142 | + } | |
| 143 | + | |
| 144 | + /// <summary> | |
| 145 | + /// 直前に選択されていた値のヒントを渡す | |
| 146 | + /// </summary> | |
| 147 | + /// <param name="elm"></param> | |
| 148 | + protected void TryRestoreCurrentCache(CatalogVarCollectionElement elm) { | |
| 149 | + string key = elm.Name; | |
| 150 | + if (current_cache.ContainsKey(key)) { | |
| 151 | + elm.Variable.CurrentHint = current_cache[key]; | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + #region internal event handler management | |
| 156 | + protected void SetProxyHandlers(CatalogVarCollectionElement elm) { | |
| 157 | + elm.VariableCurrentChanged += VariableCurrentChangedProxy; | |
| 158 | + elm.VariableOptionChanged += VariableOptionChangedProxy; | |
| 159 | + elm.VariableModelChanged += VariableModelChangedProxy; | |
| 160 | + } | |
| 161 | + | |
| 162 | + protected void UnsetProxyHandlers(CatalogVarCollectionElement elm) { | |
| 163 | + if (elm != null) { | |
| 164 | + elm.VariableCurrentChanged -= VariableCurrentChangedProxy; | |
| 165 | + elm.VariableOptionChanged -= VariableOptionChangedProxy; | |
| 166 | + elm.VariableModelChanged -= VariableModelChangedProxy; | |
| 167 | + } | |
| 168 | + } | |
| 169 | + | |
| 170 | + protected void VariableModelChangedProxy(CatalogVarCollectionElementEventArgs arg) { | |
| 171 | + TryRestoreCurrentCache(arg.Source); | |
| 172 | + SetElementModified(arg.Source.Name, ElementState.ModelUpdated); | |
| 173 | + } | |
| 174 | + | |
| 175 | + protected void VariableOptionChangedProxy(CatalogVarCollectionElementEventArgs arg) { | |
| 176 | + if (VariableOptionChanged != null) { | |
| 177 | + VariableOptionChanged(new CatalogVarViewEventArgs(this, arg.Source, arg.OriginalEvent)); | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + protected void VariableCurrentChangedProxy(CatalogVarCollectionElementEventArgs arg) { | |
| 182 | + if (VariableCurrentChanged != null) { | |
| 183 | + string key = arg.Source.Name; | |
| 184 | + /// ビュー側から変更された場合に限り、現在の値のヒントを名前をキーにして保存 | |
| 185 | + current_cache.Add(arg.Source.Name, arg.OriginalEvent.Source.CurrentHint); | |
| 186 | + VariableCurrentChanged(new CatalogVarViewEventArgs(this, arg.Source, arg.OriginalEvent)); | |
| 187 | + } | |
| 188 | + } | |
| 189 | + #endregion | |
| 190 | + | |
| 191 | + public class ValueMap : IEnumerable<KeyValuePair<string, object>> { | |
| 192 | + CatalogVariableCollection owner; | |
| 193 | + | |
| 194 | + internal ValueMap(CatalogVariableCollection collection) { | |
| 195 | + this.owner = collection; | |
| 196 | + } | |
| 197 | + | |
| 198 | + public object this[string key] { | |
| 199 | + get { | |
| 200 | + CatalogVarCollectionElement elm = owner.map[key]; | |
| 201 | + return elm.Variable.Current; | |
| 202 | + } | |
| 203 | + } | |
| 204 | + public object this[int index] { | |
| 205 | + get { | |
| 206 | + return this[owner.order[index]]; | |
| 207 | + } | |
| 208 | + } | |
| 209 | + | |
| 210 | + public IEnumerator<KeyValuePair<string, object>> GetEnumerator() { | |
| 211 | + foreach (string key in owner.order) { | |
| 212 | + CatalogVarCollectionElement elm; | |
| 213 | + if (owner.map.TryGetValue(key, out elm) && elm.Variable != null) { | |
| 214 | + KeyValuePair<string, object> pair = new KeyValuePair<string, object>(key, elm.Variable.Current); | |
| 215 | + yield return pair; | |
| 216 | + } | |
| 217 | + } | |
| 218 | + } | |
| 219 | + | |
| 220 | + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { | |
| 221 | + return GetEnumerator(); | |
| 222 | + } | |
| 223 | + } | |
| 224 | + } | |
| 225 | + | |
| 226 | + public class CatalogVarCollectionEventArgs : EventArgs { | |
| 227 | + public readonly CatalogVariableCollection Source; | |
| 228 | + public CatalogVarCollectionEventArgs(CatalogVariableCollection src) { | |
| 229 | + this.Source = src; | |
| 230 | + } | |
| 231 | + } | |
| 232 | + | |
| 233 | + public class CatalogVarModelEventArgs : CatalogVarCollectionEventArgs { | |
| 234 | + public readonly IList<KeyValuePair<string, _ElementState>> Modifications; | |
| 235 | + public CatalogVarModelEventArgs(CatalogVariableCollection src, IList<KeyValuePair<string, _ElementState>> list) | |
| 236 | + : base(src) { | |
| 237 | + this.Modifications = list; | |
| 238 | + } | |
| 239 | + | |
| 240 | + CatalogVarCollectionElement this[string key] { | |
| 241 | + get { | |
| 242 | + return Source[key]; | |
| 243 | + } | |
| 244 | + } | |
| 245 | + } | |
| 246 | + | |
| 247 | + public class CatalogVarViewEventArgs : CatalogVarCollectionEventArgs { | |
| 248 | + public readonly CatalogVarCollectionElement Element; | |
| 249 | + public readonly CatalogVariableEventArgs CatalogVariableEventArgs; | |
| 250 | + public CatalogVarViewEventArgs(CatalogVariableCollection src, CatalogVarCollectionElement elm, CatalogVariableEventArgs evt) : base(src) { | |
| 251 | + this.CatalogVariableEventArgs = evt; | |
| 252 | + this.Element = elm; | |
| 253 | + } | |
| 254 | + | |
| 255 | + public ICatalogVariable CatalogVariable { | |
| 256 | + get { | |
| 257 | + return (CatalogVariableEventArgs != null) ? CatalogVariableEventArgs.Source : null; | |
| 258 | + } | |
| 259 | + } | |
| 260 | + | |
| 261 | + public object CurrentValue { | |
| 262 | + get { | |
| 263 | + return (CatalogVariableEventArgs != null) ? CatalogVariableEventArgs.Source.Current : null; | |
| 264 | + } | |
| 265 | + } | |
| 266 | + | |
| 267 | + public string ElementName { | |
| 268 | + get { | |
| 269 | + return Element.Name; | |
| 270 | + } | |
| 271 | + } | |
| 272 | + } | |
| 273 | +} |
| @@ -0,0 +1,272 @@ | ||
| 1 | +using System; | |
| 2 | +using nft.framework; | |
| 3 | +using nft.core.geometry; | |
| 4 | +using System.Collections.Generic; | |
| 5 | +using System.Collections; | |
| 6 | + | |
| 7 | +namespace nft.core.structure | |
| 8 | +{ | |
| 9 | + public delegate void CatelogVariableEventHandler(CatalogVariableEventArgs arg); | |
| 10 | + | |
| 11 | + // ジェネリック型を無視してまとめて扱いたい時のためのベースインターフェース | |
| 12 | + public interface ICatalogVariable { | |
| 13 | + bool Auto { get; set; } | |
| 14 | + bool Random { get; set; } | |
| 15 | + bool AllowLoop { get; } | |
| 16 | + | |
| 17 | + event CatelogVariableEventHandler ValueChanged; | |
| 18 | + | |
| 19 | + event CatelogVariableEventHandler OptionChanged; | |
| 20 | + | |
| 21 | + /// <summary> | |
| 22 | + /// 現在の選択状況を保存/復元するために使用 | |
| 23 | + /// setでは復元できなくてもエラーにせず現状維持 | |
| 24 | + /// </summary> | |
| 25 | + object CurrentHint { get; set; } | |
| 26 | + object Current { get; } | |
| 27 | + } | |
| 28 | + | |
| 29 | + public interface ICatalogVariable<U> : ICatalogVariable, IEnumerable<U> { | |
| 30 | + int Count { get; } | |
| 31 | + new U Current { get; } | |
| 32 | + U Next(); | |
| 33 | + U Prev(); | |
| 34 | + U First(); | |
| 35 | + U Last(); | |
| 36 | + | |
| 37 | + /// <summary> | |
| 38 | + /// 取り得る値からランダムに取得 | |
| 39 | + /// ゲームモデル側から利用されるため、ValueChangedは発生しない | |
| 40 | + /// </summary> | |
| 41 | + /// <returns></returns> | |
| 42 | + U NextRandom(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + public abstract class CatalogVariable<U> : ICatalogVariable<U> { | |
| 46 | + protected static Random rand = new Random(); | |
| 47 | + protected int current; | |
| 48 | + private bool bAuto = false; | |
| 49 | + private bool bRandom = false; | |
| 50 | + private readonly bool bLoop; | |
| 51 | + protected bool dirty = false; | |
| 52 | + public event CatelogVariableEventHandler ValueChanged; | |
| 53 | + public event CatelogVariableEventHandler OptionChanged; | |
| 54 | + | |
| 55 | + public CatalogVariable(bool allowLoop) { | |
| 56 | + this.bLoop = allowLoop; | |
| 57 | + } | |
| 58 | + | |
| 59 | + protected abstract int Max { get; } | |
| 60 | + protected abstract int Min { get; } | |
| 61 | + protected abstract int Step { get; } | |
| 62 | + | |
| 63 | + public virtual int Count { | |
| 64 | + get{ | |
| 65 | + return (Max - Min)/Step +1; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + object ICatalogVariable.Current { | |
| 70 | + get { return Current; } | |
| 71 | + } | |
| 72 | + | |
| 73 | + public abstract U Current { get; } | |
| 74 | + | |
| 75 | + public U Next() { | |
| 76 | + if (current < Max) { | |
| 77 | + dirty = true; | |
| 78 | + current+=Step; | |
| 79 | + } else if (AllowLoop) { | |
| 80 | + return First(); | |
| 81 | + } | |
| 82 | + U ret = Current; | |
| 83 | + FireValueChangedEvent(); | |
| 84 | + return ret; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public U Prev() { | |
| 88 | + if (current > Min) { | |
| 89 | + current -= Step; | |
| 90 | + } else if (AllowLoop) { | |
| 91 | + return Last(); | |
| 92 | + } | |
| 93 | + U ret = Current; | |
| 94 | + FireValueChangedEvent(); | |
| 95 | + return ret; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public U First() { | |
| 99 | + int _min = Min; | |
| 100 | + if (current != _min) { | |
| 101 | + current = _min; | |
| 102 | + dirty = true; | |
| 103 | + } | |
| 104 | + U ret = Current; | |
| 105 | + FireValueChangedEvent(); | |
| 106 | + return ret; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public U Last() { | |
| 110 | + int _max = Max; | |
| 111 | + if (current != _max) { | |
| 112 | + current = _max; | |
| 113 | + dirty = true; | |
| 114 | + } | |
| 115 | + U ret = Current; | |
| 116 | + FireValueChangedEvent(); | |
| 117 | + return ret; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public U NextRandom() { | |
| 121 | + if (Random) { | |
| 122 | + int _min = Min/Step; | |
| 123 | + int _max = Max/Step; | |
| 124 | + int r = rand.Next(_min, _max + 1); | |
| 125 | + return PickForRandom(r * Step); | |
| 126 | + } else { | |
| 127 | + throw new InvalidOperationException(); | |
| 128 | + } | |
| 129 | + } | |
| 130 | + | |
| 131 | + protected abstract U PickForRandom(int val); | |
| 132 | + | |
| 133 | + public abstract IEnumerator<U> GetEnumerator(); | |
| 134 | + | |
| 135 | + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { | |
| 136 | + return GetEnumerator(); | |
| 137 | + } | |
| 138 | + | |
| 139 | + public bool Auto | |
| 140 | + { | |
| 141 | + get { return bAuto; } | |
| 142 | + set { | |
| 143 | + if (bAuto != value) { | |
| 144 | + bAuto = value; | |
| 145 | + FireOptionChangedEvent(); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + } | |
| 149 | + public bool Random | |
| 150 | + { | |
| 151 | + get { return bRandom; } | |
| 152 | + set { | |
| 153 | + if (bRandom != value) { | |
| 154 | + bRandom = value; | |
| 155 | + FireOptionChangedEvent(); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + | |
| 160 | + public bool AllowLoop { | |
| 161 | + get { return bLoop; } | |
| 162 | + } | |
| 163 | + public virtual object CurrentHint { | |
| 164 | + get { | |
| 165 | + return current; | |
| 166 | + } | |
| 167 | + set { | |
| 168 | + if (value is IConvertible) { | |
| 169 | + current = ((IConvertible)value).ToInt32(null); | |
| 170 | + } | |
| 171 | + } | |
| 172 | + } | |
| 173 | + | |
| 174 | + protected void FireOptionChangedEvent() { | |
| 175 | + if (dirty && OptionChanged != null) OptionChanged(new CatalogVariableEventArgs(this)); | |
| 176 | + } | |
| 177 | + | |
| 178 | + protected void FireValueChangedEvent() { | |
| 179 | + if (ValueChanged != null) ValueChanged(new CatalogVariableEventArgs(this)); | |
| 180 | + } | |
| 181 | + | |
| 182 | + } | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + public class CatListVariable<U> : CatalogVariable<U> { | |
| 187 | + protected IList<U> list; | |
| 188 | + | |
| 189 | + public CatListVariable(IList<U> source, bool allowLoop) : base(allowLoop) { | |
| 190 | + list = source; | |
| 191 | + current = 0; | |
| 192 | + } | |
| 193 | + | |
| 194 | + public override int Count { | |
| 195 | + get { return list.Count; } | |
| 196 | + } | |
| 197 | + | |
| 198 | + public override U Current { | |
| 199 | + get { return list[current]; } | |
| 200 | + } | |
| 201 | + | |
| 202 | + protected override U PickForRandom(int val) { | |
| 203 | + return list[val]; | |
| 204 | + } | |
| 205 | + | |
| 206 | + public override IEnumerator<U> GetEnumerator() { | |
| 207 | + return list.GetEnumerator(); | |
| 208 | + } | |
| 209 | + | |
| 210 | + protected override int Max { | |
| 211 | + get { return list.Count-1; } | |
| 212 | + } | |
| 213 | + | |
| 214 | + protected override int Min { | |
| 215 | + get { return 0; } | |
| 216 | + } | |
| 217 | + | |
| 218 | + protected override int Step { | |
| 219 | + get { return 1; } | |
| 220 | + } | |
| 221 | + } | |
| 222 | + | |
| 223 | + public class IndexVariable : CatalogVariable<int> { | |
| 224 | + protected int min, max; | |
| 225 | + protected int step; | |
| 226 | + | |
| 227 | + public IndexVariable(int min, int max, int step, bool allowLoop) | |
| 228 | + : base(allowLoop) { | |
| 229 | + this.min = min; | |
| 230 | + this.max = max; | |
| 231 | + this.step = step; | |
| 232 | + this.current = min; | |
| 233 | + } | |
| 234 | + public IndexVariable(int min, int max, bool allowLoop) | |
| 235 | + : this(min, max, 1, allowLoop) { | |
| 236 | + } | |
| 237 | + public IndexVariable(int max, bool allowLoop) | |
| 238 | + : this(0, max, 1, allowLoop) { | |
| 239 | + } | |
| 240 | + | |
| 241 | + public override int Current { | |
| 242 | + get { throw new NotImplementedException(); } | |
| 243 | + } | |
| 244 | + protected override int PickForRandom(int val) { | |
| 245 | + return val; | |
| 246 | + } | |
| 247 | + | |
| 248 | + public override IEnumerator<int> GetEnumerator() { | |
| 249 | + throw new NotImplementedException(); | |
| 250 | + } | |
| 251 | + | |
| 252 | + protected override int Max { | |
| 253 | + get { return max; } | |
| 254 | + } | |
| 255 | + | |
| 256 | + protected override int Min { | |
| 257 | + get { return min; } | |
| 258 | + } | |
| 259 | + | |
| 260 | + protected override int Step { | |
| 261 | + get { return step; } | |
| 262 | + } | |
| 263 | + | |
| 264 | + } | |
| 265 | + | |
| 266 | + public class CatalogVariableEventArgs : EventArgs { | |
| 267 | + public readonly ICatalogVariable Source; | |
| 268 | + public CatalogVariableEventArgs(ICatalogVariable src) { | |
| 269 | + this.Source = src; | |
| 270 | + } | |
| 271 | + } | |
| 272 | +} |
| @@ -0,0 +1,51 @@ | ||
| 1 | +using nft.contributions.graphics; | |
| 2 | +using nft.core.graphics; | |
| 3 | +using nft.framework.plugin; | |
| 4 | +using System; | |
| 5 | +using System.Collections.Generic; | |
| 6 | +using System.Text; | |
| 7 | +using ConditionedTextureSrc = nft.core.view.ConditionedResource<nft.core.graphics.TextureSrc>; | |
| 8 | + | |
| 9 | +namespace nft.core.structure { | |
| 10 | + public class SkinCatalog : ICatalogSource<ConditionedTextureSrc> { | |
| 11 | + static protected WeakReference Cache = new WeakReference(null); | |
| 12 | + | |
| 13 | + public static SkinCatalog Get() { | |
| 14 | + if (!Cache.IsAlive || Cache.Target==null) { | |
| 15 | + Cache.Target = new SkinCatalog(); | |
| 16 | + } | |
| 17 | + return Cache.Target as SkinCatalog; | |
| 18 | + } | |
| 19 | + | |
| 20 | + protected CatalogVariableCollection varCollection; | |
| 21 | + protected CatalogVarCollectionElement varElement; | |
| 22 | + | |
| 23 | + protected SkinCatalog() { | |
| 24 | + } | |
| 25 | + protected void init(){ | |
| 26 | + varCollection = new CatalogVariableCollection(); | |
| 27 | + PluginManager pm = PluginManager.theInstance; | |
| 28 | + IEnumerable<CtbStructureSkin> contribs = pm.EnumContributions<CtbStructureSkin>(); | |
| 29 | + List<CtbStructureSkin> list = new List<CtbStructureSkin>(contribs); | |
| 30 | + CatListVariable<CtbStructureSkin> var = new CatListVariable<CtbStructureSkin>(list, true); | |
| 31 | + varElement = new CatalogVarCollectionElement(CatalogVarNameConstants.Design,"種類"); | |
| 32 | + varElement.Variable = var; | |
| 33 | + varCollection.AddElement(varElement); | |
| 34 | + } | |
| 35 | + | |
| 36 | + public CatalogVariableCollection VariableCollection { | |
| 37 | + get { return varCollection; } | |
| 38 | + } | |
| 39 | + | |
| 40 | + #region ICatalogSource implementation | |
| 41 | + public IEnumerable<KeyValuePair<string, ICatalogVariable>> CatalogVariables { | |
| 42 | + get { throw new NotImplementedException(); } | |
| 43 | + } | |
| 44 | + | |
| 45 | + public bool Select(CatalogVariableCollection.ValueMap valueMap, out ConditionedTextureSrc result, out ICatalogSource<ConditionedTextureSrc> child) { | |
| 46 | + throw new NotImplementedException(); | |
| 47 | + } | |
| 48 | + #endregion | |
| 49 | + } | |
| 50 | + | |
| 51 | +} |
| @@ -0,0 +1,44 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Text; | |
| 4 | + | |
| 5 | +namespace nft.core.structure { | |
| 6 | + public class CatalogVarNameConstants { | |
| 7 | + /// <summary> | |
| 8 | + /// カラーバリエーション | |
| 9 | + /// Index of the color variations of the structure. | |
| 10 | + /// An option for color variable sprite skins. | |
| 11 | + /// </summary> | |
| 12 | + public static readonly string Color = "color"; | |
| 13 | + | |
| 14 | + /// <summary> | |
| 15 | + /// デザインバリエーション | |
| 16 | + /// Index of the outlook design variations of the structure. | |
| 17 | + /// Complete replacement of the skin sprite. | |
| 18 | + /// Sub category of the same named stractures? | |
| 19 | + /// </summary> | |
| 20 | + public static readonly string Design = "design"; | |
| 21 | + | |
| 22 | + /// <summary> | |
| 23 | + /// 方向による回転パターン | |
| 24 | + /// Index of the rotated patterns of the structure. | |
| 25 | + /// The most primitive variable for structures. | |
| 26 | + /// </summary> | |
| 27 | + public static readonly string Direction = "direction"; | |
| 28 | + | |
| 29 | + /// <summary> | |
| 30 | + /// 高さ可変ビルの高さ | |
| 31 | + /// Variable for the height parameter of the structure. | |
| 32 | + /// An option for height variable tall buildings. | |
| 33 | + /// </summary> | |
| 34 | + public static readonly string Height = "height"; | |
| 35 | + | |
| 36 | + /// <summary> | |
| 37 | + /// 敷地面積可変ビルの広さ | |
| 38 | + /// Index of the lot size variations of the structure. | |
| 39 | + /// An option for size variable extendable buildings. | |
| 40 | + /// </summary> | |
| 41 | + public static readonly string LotSize = "lot_size"; | |
| 42 | + | |
| 43 | + } | |
| 44 | +} |
| @@ -0,0 +1,13 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Text; | |
| 4 | + | |
| 5 | +namespace nft.core.structure { | |
| 6 | + public interface ICatalogSource<T> { | |
| 7 | + IEnumerable<KeyValuePair<String,ICatalogVariable>> CatalogVariables { | |
| 8 | + get; | |
| 9 | + } | |
| 10 | + | |
| 11 | + bool Select(CatalogVariableCollection.ValueMap valueMap, out T result, out ICatalogSource<T> child); | |
| 12 | + } | |
| 13 | +} |
| @@ -9,6 +9,13 @@ | ||
| 9 | 9 | |
| 10 | 10 | の29行目"AssemblyVersion"をコメントアウトした。最終リリースではコメント外すべき。 |
| 11 | 11 | |
| 12 | +■Contribution寄生パーサー | |
| 13 | +他のコントリビューションのパースに割り込んで追加処理をするためのパーサー | |
| 14 | +Genericパラメータ指定で特定クラスのコントリビューションに絞り込めるものとする。 | |
| 15 | +PluginManager読み込み時に、Ctbサブクラス毎に、適用すべき寄生パーサーのリストのキャッシュを作るのはどうか? | |
| 16 | +読み込み完了時にこのキャッシュリストは破棄する。 | |
| 17 | + | |
| 18 | + | |
| 12 | 19 | ■線路・道路の基本パターン |
| 13 | 20 | 斜めは1:1対角線(45゚)と1:2(30゚)および2:1(60゚)対角線の3種類 |
| 14 | 21 | 1:1線の太さは、TTDX式『1/√2』ではなく、A列車式改『√2』とする |
| @@ -543,10 +543,21 @@ | ||
| 543 | 543 | return list.ToArray(contributionType); |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - public IEnumerable<Contribution> EnumContributions(Type contributionType, bool hideDisabled) { | |
| 547 | - return new ContributionEnumerator(contributionType, hideDisabled); | |
| 546 | + public IEnumerable<U> EnumContributions<U>(bool hideDisabled) where U:Contribution { | |
| 547 | + return new ContributionEnumerator<U>(hideDisabled); | |
| 548 | 548 | } |
| 549 | + public IEnumerable<U> EnumContributions<U>() where U : Contribution { | |
| 550 | + return EnumContributions<U>(true); | |
| 551 | + } | |
| 549 | 552 | |
| 553 | + public IEnumerable<Contribution> EnumContributions(Type t, bool hideDisabled) { | |
| 554 | + if (!t.IsSubclassOf(typeof(Contribution))) { | |
| 555 | + throw new ArgumentException("Mast be a subclass of Contribution.","t"); | |
| 556 | + } | |
| 557 | + Type t2 = typeof(ContributionEnumerator<>); | |
| 558 | + t2 = t2.MakeGenericType(t); | |
| 559 | + return Activator.CreateInstance(t2, hideDisabled) as IEnumerable<Contribution>; | |
| 560 | + } | |
| 550 | 561 | |
| 551 | 562 | /// <summary> |
| 552 | 563 | /// Gets all contributions. |
| @@ -553,7 +564,7 @@ | ||
| 553 | 564 | /// </summary> |
| 554 | 565 | public IEnumerable<Contribution> Contributions { |
| 555 | 566 | get { |
| 556 | - return new ContributionEnumerator(false); | |
| 567 | + return new ContributionEnumerator<Contribution>(false); | |
| 557 | 568 | } |
| 558 | 569 | } |
| 559 | 570 |
| @@ -649,26 +660,25 @@ | ||
| 649 | 660 | } |
| 650 | 661 | } |
| 651 | 662 | |
| 652 | - internal class ContributionEnumerator : IEnumerable<Contribution> | |
| 663 | + internal class ContributionEnumerator<T> : IEnumerable<T> where T : Contribution | |
| 653 | 664 | { |
| 654 | 665 | readonly Type type; |
| 655 | 666 | readonly bool hideDisabled; |
| 656 | - public ContributionEnumerator(bool hideDisable) : this(null, hideDisable) { } | |
| 657 | 667 | |
| 658 | - public ContributionEnumerator(Type t) : this(t, true) { } | |
| 668 | + public ContributionEnumerator() : this(true) { } | |
| 659 | 669 | |
| 660 | - public ContributionEnumerator(Type t, bool hideDisable) { | |
| 661 | - this.type = t; | |
| 670 | + public ContributionEnumerator(bool hideDisable) { | |
| 671 | + this.type = this.type.GetGenericArguments()[0]; | |
| 662 | 672 | this.hideDisabled = hideDisable; |
| 663 | 673 | } |
| 664 | 674 | |
| 665 | - public IEnumerator<Contribution> GetEnumerator() { | |
| 675 | + public IEnumerator<T> GetEnumerator() { | |
| 666 | 676 | if (type == null) { |
| 667 | - foreach (Contribution c in PluginManager.theInstance.contributionMap.Values) | |
| 677 | + foreach (T c in PluginManager.theInstance.contributionMap.Values) | |
| 668 | 678 | if (!hideDisabled || c.IsAttached) |
| 669 | 679 | yield return c; |
| 670 | 680 | } else { |
| 671 | - foreach (Contribution c in PluginManager.theInstance.contributionMap.Values) { | |
| 681 | + foreach (T c in PluginManager.theInstance.contributionMap.Values) { | |
| 672 | 682 | if (type.IsInstanceOfType(c)) { |
| 673 | 683 | if (!hideDisabled || c.IsAttached) |
| 674 | 684 | yield return c; |
| @@ -93,10 +93,8 @@ | ||
| 93 | 93 | public class ContribListControlHelper<T> where T:Contribution { |
| 94 | 94 | |
| 95 | 95 | public int Set(ComboBox combo, bool hideDisabled, IListContribFilter filter) { |
| 96 | - Array arr = GetArray(hideDisabled); | |
| 97 | - if (arr == null) return -1; | |
| 98 | 96 | int n = 0; |
| 99 | - foreach (Contribution c in arr) | |
| 97 | + foreach (T c in GetArray(hideDisabled)) | |
| 100 | 98 | if (filter.IsValid(c)) { |
| 101 | 99 | combo.Items.Add(new AbstractItem(c)); |
| 102 | 100 | n++; |
| @@ -142,9 +140,9 @@ | ||
| 142 | 140 | } |
| 143 | 141 | } |
| 144 | 142 | |
| 145 | - private Array GetArray(bool hideDisabled) { | |
| 143 | + private IEnumerable<T> GetArray(bool hideDisabled) { | |
| 146 | 144 | PluginManager pm = PluginManager.theInstance; |
| 147 | - return pm.ListContributions(typeof(T), hideDisabled); | |
| 145 | + return pm.EnumContributions<T>(hideDisabled); | |
| 148 | 146 | } |
| 149 | 147 | } |
| 150 | 148 |
| @@ -1,17 +0,0 @@ | ||
| 1 | -using System; | |
| 2 | -using System.Collections.Generic; | |
| 3 | -using System.ComponentModel; | |
| 4 | -using System.Data; | |
| 5 | -using System.Drawing; | |
| 6 | -using System.Text; | |
| 7 | -using System.Windows.Forms; | |
| 8 | - | |
| 9 | -namespace nft.ui.core | |
| 10 | -{ | |
| 11 | - public partial class InspectToolForm : Form | |
| 12 | - { | |
| 13 | - public InspectToolForm() { | |
| 14 | - InitializeComponent(); | |
| 15 | - } | |
| 16 | - } | |
| 17 | -} |
| @@ -1,70 +0,0 @@ | ||
| 1 | -namespace nft.ui.core | |
| 2 | -{ | |
| 3 | - partial class InspectToolForm | |
| 4 | - { | |
| 5 | - /// <summary> | |
| 6 | - /// Required designer variable. | |
| 7 | - /// </summary> | |
| 8 | - private System.ComponentModel.IContainer components = null; | |
| 9 | - | |
| 10 | - /// <summary> | |
| 11 | - /// Clean up any resources being used. | |
| 12 | - /// </summary> | |
| 13 | - /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |
| 14 | - protected override void Dispose(bool disposing) { | |
| 15 | - if (disposing && (components != null)) { | |
| 16 | - components.Dispose(); | |
| 17 | - } | |
| 18 | - base.Dispose(disposing); | |
| 19 | - } | |
| 20 | - | |
| 21 | - #region Windows Form Designer generated code | |
| 22 | - | |
| 23 | - /// <summary> | |
| 24 | - /// Required method for Designer support - do not modify | |
| 25 | - /// the contents of this method with the code editor. | |
| 26 | - /// </summary> | |
| 27 | - private void InitializeComponent() { | |
| 28 | - this.lbStatus = new System.Windows.Forms.Label(); | |
| 29 | - this.renderViewPanel = new nft.framework.drawing.RenderViewPanel(); | |
| 30 | - this.SuspendLayout(); | |
| 31 | - // | |
| 32 | - // lbStatus | |
| 33 | - // | |
| 34 | - this.lbStatus.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; | |
| 35 | - this.lbStatus.Dock = System.Windows.Forms.DockStyle.Bottom; | |
| 36 | - this.lbStatus.Location = new System.Drawing.Point(0, 190); | |
| 37 | - this.lbStatus.Name = "lbStatus"; | |
| 38 | - this.lbStatus.Size = new System.Drawing.Size(232, 78); | |
| 39 | - this.lbStatus.TabIndex = 1; | |
| 40 | - this.lbStatus.Text = "..."; | |
| 41 | - // | |
| 42 | - // renderViewPanel | |
| 43 | - // | |
| 44 | - this.renderViewPanel.Dock = System.Windows.Forms.DockStyle.Fill; | |
| 45 | - this.renderViewPanel.Location = new System.Drawing.Point(0, 0); | |
| 46 | - this.renderViewPanel.Name = "renderViewPanel"; | |
| 47 | - this.renderViewPanel.Size = new System.Drawing.Size(232, 268); | |
| 48 | - this.renderViewPanel.SurfaceUsage = nft.framework.drawing.SurfaceUsage.Normal; | |
| 49 | - this.renderViewPanel.TabIndex = 0; | |
| 50 | - // | |
| 51 | - // InspectToolForm | |
| 52 | - // | |
| 53 | - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |
| 54 | - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |
| 55 | - this.ClientSize = new System.Drawing.Size(232, 268); | |
| 56 | - this.Controls.Add(this.lbStatus); | |
| 57 | - this.Controls.Add(this.renderViewPanel); | |
| 58 | - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; | |
| 59 | - this.Name = "InspectToolForm"; | |
| 60 | - this.Text = "InspectToolForm"; | |
| 61 | - this.ResumeLayout(false); | |
| 62 | - | |
| 63 | - } | |
| 64 | - | |
| 65 | - #endregion | |
| 66 | - | |
| 67 | - private framework.drawing.RenderViewPanel renderViewPanel; | |
| 68 | - private System.Windows.Forms.Label lbStatus; | |
| 69 | - } | |
| 70 | -} | |
| \ No newline at end of file |
| @@ -1,15 +0,0 @@ | ||
| 1 | -using System; | |
| 2 | -using System.Collections.Generic; | |
| 3 | -using System.ComponentModel; | |
| 4 | -using System.Data; | |
| 5 | -using System.Drawing; | |
| 6 | -using System.Text; | |
| 7 | -using System.Windows.Forms; | |
| 8 | - | |
| 9 | -namespace nft.ui.core { | |
| 10 | - public partial class BuildToolForm : Form { | |
| 11 | - public BuildToolForm() { | |
| 12 | - InitializeComponent(); | |
| 13 | - } | |
| 14 | - } | |
| 15 | -} |
| @@ -1,68 +0,0 @@ | ||
| 1 | -namespace nft.ui.core { | |
| 2 | - partial class BuildToolForm { | |
| 3 | - /// <summary> | |
| 4 | - /// Required designer variable. | |
| 5 | - /// </summary> | |
| 6 | - private System.ComponentModel.IContainer components = null; | |
| 7 | - | |
| 8 | - /// <summary> | |
| 9 | - /// Clean up any resources being used. | |
| 10 | - /// </summary> | |
| 11 | - /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |
| 12 | - protected override void Dispose(bool disposing) { | |
| 13 | - if (disposing && (components != null)) { | |
| 14 | - components.Dispose(); | |
| 15 | - } | |
| 16 | - base.Dispose(disposing); | |
| 17 | - } | |
| 18 | - | |
| 19 | - #region Windows Form Designer generated code | |
| 20 | - | |
| 21 | - /// <summary> | |
| 22 | - /// Required method for Designer support - do not modify | |
| 23 | - /// the contents of this method with the code editor. | |
| 24 | - /// </summary> | |
| 25 | - private void InitializeComponent() { | |
| 26 | - this.renderView = new nft.framework.drawing.RenderViewPanel(); | |
| 27 | - this.lbStructures = new System.Windows.Forms.ListBox(); | |
| 28 | - this.SuspendLayout(); | |
| 29 | - // | |
| 30 | - // renderView | |
| 31 | - // | |
| 32 | - this.renderView.Location = new System.Drawing.Point(0, 80); | |
| 33 | - this.renderView.Name = "renderView"; | |
| 34 | - this.renderView.Size = new System.Drawing.Size(192, 195); | |
| 35 | - this.renderView.SurfaceUsage = nft.framework.drawing.SurfaceUsage.Normal; | |
| 36 | - this.renderView.TabIndex = 0; | |
| 37 | - // | |
| 38 | - // lbStructures | |
| 39 | - // | |
| 40 | - this.lbStructures.FormattingEnabled = true; | |
| 41 | - this.lbStructures.ItemHeight = 12; | |
| 42 | - this.lbStructures.Location = new System.Drawing.Point(0, 1); | |
| 43 | - this.lbStructures.Name = "lbStructures"; | |
| 44 | - this.lbStructures.Size = new System.Drawing.Size(192, 76); | |
| 45 | - this.lbStructures.TabIndex = 1; | |
| 46 | - // | |
| 47 | - // BuildToolForm | |
| 48 | - // | |
| 49 | - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |
| 50 | - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |
| 51 | - this.ClientSize = new System.Drawing.Size(192, 274); | |
| 52 | - this.Controls.Add(this.lbStructures); | |
| 53 | - this.Controls.Add(this.renderView); | |
| 54 | - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; | |
| 55 | - this.Name = "BuildToolForm"; | |
| 56 | - this.ShowInTaskbar = false; | |
| 57 | - this.Text = "建造物設置"; | |
| 58 | - this.ResumeLayout(false); | |
| 59 | - | |
| 60 | - } | |
| 61 | - | |
| 62 | - #endregion | |
| 63 | - | |
| 64 | - private framework.drawing.RenderViewPanel renderView; | |
| 65 | - private System.Windows.Forms.ListBox lbStructures; | |
| 66 | - | |
| 67 | - } | |
| 68 | -} | |
| \ No newline at end of file |
| @@ -56,7 +56,7 @@ | ||
| 56 | 56 | if (si != null) { |
| 57 | 57 | StringBuilder sb = new StringBuilder(); |
| 58 | 58 | sb.AppendLine(String.Format("Location({0},{1}), Height={2}", si.Location.X, si.Location.Y, si.Location.Z)); |
| 59 | - sb.AppendLine(String.Format("ViewGrid({0:f1},{1:f1},{2:f1})", si.WorldPosition.X / Geocon.UnitWidthPixel, si.WorldPosition.Z / Geocon.UnitWidthPixel, si.WorldPosition.Y / Geocon.UnitHeightPixel)); | |
| 59 | + //sb.AppendLine(String.Format("ViewGrid({0:f1},{1:f1},{2:f1})", si.WorldPosition.X / Geocon.UnitWidthPixel, si.WorldPosition.Z / Geocon.UnitWidthPixel, si.WorldPosition.Y / Geocon.UnitHeightPixel)); | |
| 60 | 60 | sb.Append(String.Format("HT={0:X6}", si.HitTestValue)); |
| 61 | 61 | if (si.TerrainPiece != null) { |
| 62 | 62 | sb.Append(String.Format(",TID={0:X6}", si.TerrainPiece.Template.ID)); |
| @@ -80,10 +80,11 @@ | ||
| 80 | 80 | Point3DV pv = (Point3DV)si.WorldPosition; |
| 81 | 81 | IEnumerable<I3DObject> terrains = si.SceneBuilder.GetTerrainsAt(si.Location); |
| 82 | 82 | int h = si.TerrainPiece.BaseHeight * Geocon.UnitHeightPixel; |
| 83 | - PointF3D pt; | |
| 83 | + PointF3D pt; | |
| 84 | 84 | foreach (I3DObject obj in terrains) { |
| 85 | 85 | ITerrainPlate p = obj as ITerrainPlate; |
| 86 | 86 | pt = p.Location; |
| 87 | + // 水平座標を(0,0)に、高さを地形の基準位置にあわせる | |
| 87 | 88 | p.Location = new PointF3D(0, 0, pt.Z - h); |
| 88 | 89 | yield return p; |
| 89 | 90 | } |
| @@ -0,0 +1,116 @@ | ||
| 1 | +namespace nft.ui.core { | |
| 2 | + partial class BuildTool { | |
| 3 | + /// <summary> | |
| 4 | + /// 必要なデザイナー変数です。 | |
| 5 | + /// </summary> | |
| 6 | + private System.ComponentModel.IContainer components = null; | |
| 7 | + | |
| 8 | + /// <summary> | |
| 9 | + /// 使用中のリソースをすべてクリーンアップします。 | |
| 10 | + /// </summary> | |
| 11 | + /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param> | |
| 12 | + protected override void Dispose(bool disposing) { | |
| 13 | + if (disposing && (components != null)) { | |
| 14 | + components.Dispose(); | |
| 15 | + } | |
| 16 | + base.Dispose(disposing); | |
| 17 | + } | |
| 18 | + | |
| 19 | + #region コンポーネント デザイナーで生成されたコード | |
| 20 | + | |
| 21 | + /// <summary> | |
| 22 | + /// デザイナー サポートに必要なメソッドです。このメソッドの内容を | |
| 23 | + /// コード エディターで変更しないでください。 | |
| 24 | + /// </summary> | |
| 25 | + private void InitializeComponent() { | |
| 26 | + this.panel1 = new System.Windows.Forms.Panel(); | |
| 27 | + this.panel2 = new System.Windows.Forms.Panel(); | |
| 28 | + this.renderView = new nft.framework.drawing.RenderViewPanel(); | |
| 29 | + this.lbCaption = new System.Windows.Forms.Label(); | |
| 30 | + this.tbInfo = new System.Windows.Forms.TextBox(); | |
| 31 | + this.panel1.SuspendLayout(); | |
| 32 | + this.panel2.SuspendLayout(); | |
| 33 | + this.SuspendLayout(); | |
| 34 | + // | |
| 35 | + // panel1 | |
| 36 | + // | |
| 37 | + this.panel1.AutoSize = true; | |
| 38 | + this.panel1.Controls.Add(this.lbCaption); | |
| 39 | + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; | |
| 40 | + this.panel1.Location = new System.Drawing.Point(0, 0); | |
| 41 | + this.panel1.Name = "panel1"; | |
| 42 | + this.panel1.Size = new System.Drawing.Size(200, 20); | |
| 43 | + this.panel1.TabIndex = 3; | |
| 44 | + // | |
| 45 | + // panel2 | |
| 46 | + // | |
| 47 | + this.panel2.AutoSize = true; | |
| 48 | + this.panel2.Controls.Add(this.tbInfo); | |
| 49 | + this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; | |
| 50 | + this.panel2.Location = new System.Drawing.Point(0, 177); | |
| 51 | + this.panel2.Name = "panel2"; | |
| 52 | + this.panel2.Size = new System.Drawing.Size(200, 60); | |
| 53 | + this.panel2.TabIndex = 4; | |
| 54 | + // | |
| 55 | + // renderView | |
| 56 | + // | |
| 57 | + this.renderView.Dock = System.Windows.Forms.DockStyle.Fill; | |
| 58 | + this.renderView.Location = new System.Drawing.Point(0, 20); | |
| 59 | + this.renderView.Name = "renderView"; | |
| 60 | + this.renderView.Size = new System.Drawing.Size(200, 157); | |
| 61 | + this.renderView.SurfaceUsage = nft.framework.drawing.SurfaceUsage.Normal; | |
| 62 | + this.renderView.TabIndex = 5; | |
| 63 | + // | |
| 64 | + // lbCaption | |
| 65 | + // | |
| 66 | + this.lbCaption.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |
| 67 | + | System.Windows.Forms.AnchorStyles.Right))); | |
| 68 | + this.lbCaption.AutoEllipsis = true; | |
| 69 | + this.lbCaption.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; | |
| 70 | + this.lbCaption.Location = new System.Drawing.Point(0, 0); | |
| 71 | + this.lbCaption.Name = "lbCaption"; | |
| 72 | + this.lbCaption.Size = new System.Drawing.Size(200, 20); | |
| 73 | + this.lbCaption.TabIndex = 0; | |
| 74 | + this.lbCaption.Text = "label1"; | |
| 75 | + this.lbCaption.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; | |
| 76 | + // | |
| 77 | + // tbInfo | |
| 78 | + // | |
| 79 | + this.tbInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |
| 80 | + | System.Windows.Forms.AnchorStyles.Right))); | |
| 81 | + this.tbInfo.Location = new System.Drawing.Point(0, 0); | |
| 82 | + this.tbInfo.Multiline = true; | |
| 83 | + this.tbInfo.Name = "tbInfo"; | |
| 84 | + this.tbInfo.ReadOnly = true; | |
| 85 | + this.tbInfo.ScrollBars = System.Windows.Forms.ScrollBars.Both; | |
| 86 | + this.tbInfo.ShortcutsEnabled = false; | |
| 87 | + this.tbInfo.Size = new System.Drawing.Size(200, 57); | |
| 88 | + this.tbInfo.TabIndex = 0; | |
| 89 | + // | |
| 90 | + // BuildTool | |
| 91 | + // | |
| 92 | + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |
| 93 | + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |
| 94 | + this.Controls.Add(this.renderView); | |
| 95 | + this.Controls.Add(this.panel2); | |
| 96 | + this.Controls.Add(this.panel1); | |
| 97 | + this.Name = "BuildTool"; | |
| 98 | + this.Size = new System.Drawing.Size(200, 237); | |
| 99 | + this.panel1.ResumeLayout(false); | |
| 100 | + this.panel2.ResumeLayout(false); | |
| 101 | + this.panel2.PerformLayout(); | |
| 102 | + this.ResumeLayout(false); | |
| 103 | + this.PerformLayout(); | |
| 104 | + | |
| 105 | + } | |
| 106 | + | |
| 107 | + #endregion | |
| 108 | + | |
| 109 | + private System.Windows.Forms.Panel panel1; | |
| 110 | + private System.Windows.Forms.Label lbCaption; | |
| 111 | + private System.Windows.Forms.Panel panel2; | |
| 112 | + private System.Windows.Forms.TextBox tbInfo; | |
| 113 | + private framework.drawing.RenderViewPanel renderView; | |
| 114 | + | |
| 115 | + } | |
| 116 | +} |
| @@ -0,0 +1,15 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.ComponentModel; | |
| 4 | +using System.Drawing; | |
| 5 | +using System.Data; | |
| 6 | +using System.Text; | |
| 7 | +using System.Windows.Forms; | |
| 8 | + | |
| 9 | +namespace nft.ui.core { | |
| 10 | + public partial class BuildTool : UserControl { | |
| 11 | + public BuildTool() { | |
| 12 | + InitializeComponent(); | |
| 13 | + } | |
| 14 | + } | |
| 15 | +} |