• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FreeTrainの進化系を目指す


Commit MetaInfo

Revision12 (tree)
Time2014-01-03 18:24:59
Authorc477

Log Message

匿名コントリビューション CtbAnonymous の定義とサンプル実装

Change Summary

Incremental Difference

--- trunk/plugins/system/plugin.xml (revision 11)
+++ trunk/plugins/system/plugin.xml (revision 12)
@@ -15,6 +15,11 @@
1515 <name>TestBinaryModule</name>
1616 <class name="nft.debug.TestBinaryModule" codebase=".Core"/>
1717 </contribution>
18+ <contribution type="factory" id="F_Anonymous">
19+ <name>Anonymous</name>
20+ <description>Independent contributions decrared without specific factroy.</description>
21+ <implementation name="nft.framework.plugin.CtbAnonymousCtbFactory"/>
22+ </contribution>
1823 <contribution type="factory" id="F_SubForm">
1924 <name>SubForm</name>
2025 <description>Child GUI forms</description>
@@ -269,6 +274,12 @@
269274 <command menupath="HELP\DEBUG|TEST" />
270275 </contribution-->
271276
277+ <contribution type="Anonymous" id="Test_CtbAnonymous">
278+ <name>匿名コントリビューション</name>
279+ <description>ファクトリ宣言を必要としない、孤立したコントリビューションのサンプル</description>
280+ <class name="nft.debug.TestAnonymousCtb" codebase=".Core"/>
281+ </contribution>
282+
272283 <contribution type="Command" id="C_CreateNewMap">
273284 <name>新規マップ作成</name>
274285 <class name="nft.ui.core.CreateMapForm" codebase=".UI"/>
--- trunk/core/core_modules.xml (revision 11)
+++ trunk/core/core_modules.xml (revision 12)
@@ -14,4 +14,23 @@
1414 <class name="nft.ui.WinFormManager" codebase=".UI"/>
1515 <description>Form Manager based on System.Windows.Forms</description>
1616 </module>
17+ <module name="Game Time Calendar">
18+ <class name="nft.core.schedule.GameCalender" codebase=".Core"/>
19+ <description>Calendar For Game World</description>
20+ <preference>
21+ <param name="UseRealDaysInMonth" type="Boolean">
22+ <comment>If false, Each month have %SimpefiedDaysInMonth% days</comment>
23+ <default>false</default>
24+ </param>
25+ <param name="SimplifiedDaysInMonth" type="Integer">
26+ <comment>Not used if %UseRealDaysInMonth% is true</comment>
27+ <default>7</default>
28+ </param>
29+ <param name="RevisonWeightForDaysInMonth" type="Float">
30+ <note>Not used if UseRealDaysInMonth is true</note>
31+ <!--Not used if UseRealDaysInMonth is true-->
32+ <default>7</default>
33+ </param>
34+ </preference>
35+ </module>
1736 </modules>
\ No newline at end of file
--- trunk/core/contributions/graphics/CtbConditionFactory.cs (nonexistent)
+++ trunk/core/contributions/graphics/CtbConditionFactory.cs (revision 12)
@@ -0,0 +1,48 @@
1+using System;
2+using System.Collections;
3+using System.Diagnostics;
4+using System.Drawing;
5+using System.Reflection;
6+using System.Xml;
7+using nft.framework;
8+using nft.framework.plugin;
9+using nft.core.game;
10+using nft.core.geometry;
11+using nft.core.structure;
12+using nft.util;
13+using nft.framework.drawing;
14+using System.Text;
15+using System.IO;
16+using System.Collections.Generic;
17+using nft.core.view;
18+
19+namespace nft.contributions.graphics
20+{
21+ /// <summary>
22+ /// CtbCliffTextureFactory の概要の説明です。
23+ /// </summary>
24+ public class CtbDefaultSceneConditionFactory : CtbCustomCtbFactory, IConditionFactory
25+ {
26+ public CtbDefaultSceneConditionFactory(Plugin p, ParamsReader contrib)
27+ : base(p, contrib) {
28+ }
29+
30+ protected override Contribution Create(Plugin owner, ParamsReader e)
31+ {
32+ ParamsReader src = e["src"];
33+ if(!src.IsNull){
34+ e.OverWrite("name","Image:"+src.InnerText);
35+ } else {
36+ e.OverWrite("name","<unknown>");
37+ }
38+ return new CtbImageResource(owner, e);
39+ }
40+
41+
42+
43+ public ISceneCondition CreateCondition(ParamsReader reader)
44+ {
45+ throw new NotImplementedException();
46+ }
47+ }
48+}
--- trunk/core/debug/TestAnonymousCtb.cs (nonexistent)
+++ trunk/core/debug/TestAnonymousCtb.cs (revision 12)
@@ -0,0 +1,16 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using nft.framework.plugin;
5+using nft.framework;
6+using System.Diagnostics;
7+
8+namespace nft.debug
9+{
10+ public class TestAnonymousCtb : CtbAnonymous
11+ {
12+ public TestAnonymousCtb(Plugin owner, ParamsReader contrib):base(owner, contrib) {
13+ Debug.WriteLine("TestAnonymousCtb instance created.");
14+ }
15+ }
16+}
--- trunk/core/core/view/ISceneCondition.cs (revision 11)
+++ trunk/core/core/view/ISceneCondition.cs (revision 12)
@@ -3,6 +3,7 @@
33 using System.Text;
44 using nft.framework.drawing;
55 using nft.framework;
6+using nft.core.schedule;
67
78 namespace nft.core.view
89 {
@@ -14,7 +15,8 @@
1415
1516 public interface ISceneParams
1617 {
17- DateTime Datetime { get; }
18+ //DateTime Datetime { get; }
19+ Time Time { get; }
1820 Object Weather { get; }
1921 ZoomScale ZoomScale { get; }
2022 }
@@ -21,7 +23,10 @@
2123
2224 public interface IConditionFactory
2325 {
26+ string Name { get; }
27+
2428 ISceneCondition CreateCondition(ParamsReader reader);
29+
2530 }
2631
2732 public interface ISceneCondition
--- trunk/framework/framework/plugin/CtbAnonymousCtbFactory.cs (nonexistent)
+++ trunk/framework/framework/plugin/CtbAnonymousCtbFactory.cs (revision 12)
@@ -0,0 +1,56 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using System.Xml;
5+using nft.util;
6+using System.Diagnostics;
7+
8+namespace nft.framework.plugin {
9+ /// <summary>
10+ /// Instantiate a Contribution class by custom method (maybe according to the description of XML element)
11+ /// The Contribution should be an instance of specified baseType.
12+ /// <seealso cref="CustomContributionFactory"/>
13+ /// </summary>
14+ [PrimitiveContribution]
15+ public sealed class CtbAnonymousCtbFactory : Contribution, IContributionFactory {
16+ public CtbAnonymousCtbFactory(Plugin p, ParamsReader e)
17+ : base(p, e) {
18+ }
19+
20+ #region IContributionFactory メンバ
21+ public Type OutputType { get { return typeof(CtbAnonymous); } }
22+
23+ public Contribution load(Plugin owner, ParamsReader reader) {
24+ Type required = OutputType;
25+ Type t = PluginUtil.loadTypeFromManifest(reader["class"]);
26+ if (!t.IsSubclassOf(required))
27+ {
28+ string templ = Main.resources["xml.class_cast_error"].stringValue;
29+ object[] a2 = new object[] { t.FullName, required.Name, reader.SourceURI };
30+ throw new InvalidCastException(string.Format(templ, a2));
31+ }
32+ CtbAnonymous result = null;
33+ try
34+ {
35+ // give XmlNode as first argument of constructor.
36+ result = Activator.CreateInstance(t, new object[] { reader }) as CtbAnonymous;
37+ }
38+ catch (Exception e)
39+ {
40+ Debug.WriteLine(e.Message);
41+ Debug.WriteLine(e.StackTrace);
42+ string templ = Main.resources["xml.class_load_error"].stringValue;
43+ throw new Exception(string.Format(templ, t.FullName, reader.SourceURI), e);
44+ }
45+ return result;
46+ }
47+ #endregion
48+ }
49+
50+ public class CtbAnonymous : Contribution {
51+ public CtbAnonymous(Plugin owner, ParamsReader contrib)
52+ : base(owner, contrib)
53+ {
54+ }
55+ }
56+}