• 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

Revision13 (tree)
Time2014-01-20 00:48:21
Authorc477

Log Message

画像オーバーライドの定義と管理(途上)

Change Summary

Incremental Difference

--- trunk/core/core_modules.xml (revision 12)
+++ trunk/core/core_modules.xml (revision 13)
@@ -15,8 +15,11 @@
1515 <description>Form Manager based on System.Windows.Forms</description>
1616 </module>
1717 <module name="Game Time Calendar">
18- <class name="nft.core.schedule.GameCalender" codebase=".Core"/>
18+ <class name="nft.core.schedule.Calender" codebase=".Core"/>
1919 <description>Calendar For Game World</description>
20+ <settings>
21+ <include>module_calender.xml</include>
22+ </settings>
2023 <preference>
2124 <param name="UseRealDaysInMonth" type="Boolean">
2225 <comment>If false, Each month have %SimpefiedDaysInMonth% days</comment>
--- trunk/core/module_calender.xml (nonexistent)
+++ trunk/core/module_calender.xml (revision 13)
@@ -0,0 +1,71 @@
1+<?xml version="1.0" encoding="utf-8" ?>
2+<calender>
3+ <named_conditons>
4+ <predefined_group name="DayNames" type="weekly" culture="en-US"/>
5+ <predefined_group name="AbbreviatedDayNames" type="weekly" culture="en-US"/>
6+ <predefined_group name="MonthNames" type="yearly" culture="en-US"/>
7+ <predefined_group name="AbbreviatedMonthNames" type="yearly" culture="en-US"/>
8+ <predefined_group name="DayNames" type="weekly"/>
9+ <predefined_group name="AbbreviatedDayNames" type="weekly"/>
10+ <!--formatに使える文字列-->
11+ <!--E 曜日をあらわす数値。(NeoFT固有。ほかはDateTimeの書式指定子準拠)-->
12+ <!--d その月の日付。1 桁の日付で、先行ゼロが付きません-->
13+ <!--dd その月の日付。1 桁の日には、先行ゼロが付きます-->
14+ <!--M 月を表す数値。1 桁の月で、先行ゼロが付きません-->
15+ <!--MM 月を表す数値。1 桁の月には、先行ゼロが付きます-->
16+ <!--H 24時間形式の時間 1桁の時刻で、先行ゼロが付きません-->
17+ <!--HH 24時間形式の時間 1桁の時刻で、先行ゼロが付きます-->
18+ <!--m 分 1桁の分で、先行ゼロが付きません-->
19+ <!--mm 分 1桁の分で、先行ゼロが付きます-->
20+ <group name="Season" type="yearly" format="M">
21+ <assign name="april" from="3" to="5"/>
22+ <assign name="summer" from="6" to="8"/>
23+ <assign name="fall" from="9" to="11"/>
24+ <assign name="winter" from="12" to="2"/>
25+ </group>
26+ <group name="DayNight" type="daily" format="H">
27+ <assign name="day" from="6" to="18"/>
28+ <assign name="night" from="19" to="5"/>
29+ </group>
30+ <group name="TimeOfDay" type="daily" format="H">
31+ <assign name="before-dawn" from="3" to="5"/>
32+ <assign name="sunrise" match="5"/>
33+ <assign name="daybreak" from="4" to="5"/>
34+ <assign name="dawn" from="5" to="7"/>
35+ <assign name="morning" from="7" to="11"/>
36+ <assign name="early-morning" from="5" to="7"/>
37+ <assign name="late-morning" from="8" to="11"/>
38+ <assign name="noon" from="11" to="13"/>
39+ <assign name="lunchtime" from="11" to="13"/>
40+ <assign name="highnoon" match="12"/>
41+ <assign name="afternoon" from="12" to="17"/>
42+ <assign name="early-afternoon" from="12" to="14"/>
43+ <assign name="late-afternoon" from="15" to="17"/>
44+ <assign name="sunset" match="18"/>
45+ <assign name="dusk" from="17" to="18"/>
46+ <assign name="evening" from="18" to="23"/>
47+ <assign name="dinner-time" from="18" to="20"/>
48+ <assign name="early-evening" from="18" to="20"/>
49+ <assign name="late-evening" from="21" to="23"/>
50+ <assign name="midnight" match="24"/>
51+ <assign name="around-midnight" from="23" to="2"/>
52+ <assign name="after-midnight" from="0" to="3"/>
53+ <assign name="dead-of-night" from="2" to="3"/>
54+ <assign name="bedtime" from="23" to="6"/>
55+ </group>
56+ <group name="DayOfWeek" type="weekly" format="E">
57+ <!--DateTimeのAbbreviatedDayNames /DayNames はデフォルトで有効 -->
58+ <assign name="日曜" match="0"/>
59+ <assign name="月曜" match="1"/>
60+ <assign name="火曜" match="2"/>
61+ <assign name="水曜" match="3"/>
62+ <assign name="木曜" match="4"/>
63+ <assign name="金曜" match="5"/>
64+ <assign name="土曜" match="6"/>
65+ </group>
66+ <group name="WorkDays" type="weekly" format="E">
67+ <assign name="weekdays" from="1" to="5"/>
68+ <assign name="weekends" from="6" to="0"/>
69+ </group>
70+ </named_conditons>
71+</calender>
\ No newline at end of file
--- trunk/core/contributions/graphics/CtbConditionFactory.cs (revision 12)
+++ trunk/core/contributions/graphics/CtbConditionFactory.cs (revision 13)
@@ -21,7 +21,7 @@
2121 /// <summary>
2222 /// CtbCliffTextureFactory の概要の説明です。
2323 /// </summary>
24- public class CtbDefaultSceneConditionFactory : CtbCustomCtbFactory, IConditionFactory
24+ public class CtbDefaultSceneConditionFactory : CtbCustomCtbFactory
2525 {
2626 public CtbDefaultSceneConditionFactory(Plugin p, ParamsReader contrib)
2727 : base(p, contrib) {
--- trunk/core/core/view/ISceneCondition.cs (revision 12)
+++ trunk/core/core/view/ISceneCondition.cs (revision 13)
@@ -4,14 +4,22 @@
44 using nft.framework.drawing;
55 using nft.framework;
66 using nft.core.schedule;
7+using TimeCycle = nft.core.schedule.Calendar.Cycles;
78
89 namespace nft.core.view
910 {
1011 /// <summary>
1112 /// Categorize type of conditions by its watch parameter and time cycle.
13+ /// 'TimeOfDay' is based on the sun movement (day/night range can vary), while 'Daily' is based on clock value.
1214 /// Array of same type conditions can be combined and optimized as Hashmap by ConditionResourceFactory
1315 /// </summary>
14- public enum ConditionTypes { Unknown, TimeOfDay, Daily, Weekly, Monthly, Yearly, Weather, Scale }
16+ public enum ConditionTypes {
17+ Unknown,
18+ Daily = (int)TimeCycle.Daily,
19+ Weekly = (int)TimeCycle.Weekly,
20+ Monthly = (int)TimeCycle.Monthly,
21+ Yearly = (int)TimeCycle.Yearly,
22+ TimeOfDay, Weather, Scale }
1523
1624 public interface ISceneParams
1725 {
@@ -18,7 +26,7 @@
1826 //DateTime Datetime { get; }
1927 Time Time { get; }
2028 Object Weather { get; }
21- ZoomScale ZoomScale { get; }
29+ Scaler Scaler { get; }
2230 }
2331
2432 public interface IConditionFactory
@@ -25,7 +33,7 @@
2533 {
2634 string Name { get; }
2735
28- ISceneCondition CreateCondition(ParamsReader reader);
36+ ISceneCondition GetCondition(ParamsReader reader);
2937
3038 }
3139
--- trunk/core/core/schedule/Calender.cs (nonexistent)
+++ trunk/core/core/schedule/Calender.cs (revision 13)
@@ -0,0 +1,121 @@
1+using System;
2+using System.Diagnostics;
3+using nft.framework;
4+using nft.util;
5+using nft.framework.plugin;
6+using System.Reflection;
7+using System.Globalization;
8+using nft.core.view;
9+
10+namespace nft.core.schedule
11+{
12+ /// <summary>
13+ /// Time instant.
14+ /// </summary>
15+ [Serializable]
16+ public class Calendar
17+ {
18+ private static Calendar the_calender;
19+ public static Calendar ActiveCalender {
20+ get {
21+ return the_calender;
22+ }
23+ set {
24+ the_calender = value;
25+ }
26+ }
27+
28+ public enum Cycles {
29+ Unknown, Hourly, Daily, Weekly, Monthly, Yearly
30+ }
31+
32+ private TimeLength[] condToLength;
33+
34+ public Calendar(ParamsReader node)
35+ {
36+ ParamsReader f = PluginUtil.LoadAnotherXml(node["settings"]["include"]);
37+ LoadSettingFile(f);
38+ ActiveCalender = this;
39+ }
40+
41+ public long GetCycleTotalTicks(Cycles cycle) {
42+ TimeLength tl = condToLength[(int)cycle];
43+ return tl.TotalSeconds;
44+ }
45+ /// <summary>
46+ /// Retruns reminder ticks (in seconds) divided by given cycle.
47+ /// </summary>
48+ /// <param name="t"></param>
49+ /// <param name="cycle"></param>
50+ /// <returns></returns>
51+ public long GetCyclicTicks(Time t, Cycles cycle) {
52+ TimeLength tl = condToLength[(int)cycle];
53+ return t.Ticks % tl.TotalSeconds;
54+ }
55+
56+ public void LoadSettingFile(ParamsReader reader){
57+ Debug.WriteLine("Load calender settings from:"+reader.SourceURI);
58+ ParamsReader cr = reader["calender"];
59+ ReadNamedConditions(cr["named_conditons"]);
60+ }
61+
62+ private void InitCondToLength(ParamsReader reader) {
63+ if (condToLength == null) {
64+ condToLength = new TimeLength[Enum.GetValues(typeof(Cycles)).Length];
65+ }
66+ condToLength.Initialize();
67+ condToLength[(int)Cycles.Unknown] = new TimeLength(long.MaxValue);
68+ condToLength[(int)Cycles.Daily] = TimeLength.FromHours(24);
69+ condToLength[(int)Cycles.Weekly] = TimeLength.FromDays(7);
70+ condToLength[(int)Cycles.Monthly] = TimeLength.FromHours(24);
71+ condToLength[(int)Cycles.Yearly] = TimeLength.FromDays(365);
72+ }
73+
74+
75+ private void ReadNamedConditions(ParamsReader r){
76+ foreach (ParamsReader r1 in r.EnumChildren("predefined_group")) {
77+ ReadPredefinedGroup(r1);
78+ }
79+ foreach (ParamsReader r2 in r.EnumChildren("group")) {
80+ ReadGroup(r2);
81+ }
82+ }
83+
84+ private void ReadGroup(ParamsReader r) {
85+ }
86+
87+ private void ReadPredefinedGroup(ParamsReader r) {
88+ string name = r["name"].InnerText;
89+ string tpnam = r["type"].InnerText;
90+ string culnam = r["culture"].InnerText;
91+ CultureInfo culture = culnam!=null ? CultureInfo.GetCultureInfo(culnam):CultureInfo.CurrentCulture;
92+ Type t = typeof(DateTimeFormatInfo);
93+ string[] arr = t.InvokeMember(name, BindingFlags.Default, null, culture.DateTimeFormat, null) as string[];
94+ if (arr.Length == 7) {
95+ PrepareDayOfWeekGroup(arr);
96+ } else if (arr.Length == 12) {
97+ PrepareMonthGroup(arr);
98+ } else {
99+ Debug.WriteLine("Unknown array: "+name);
100+ }
101+ }
102+
103+ private void PrepareDayOfWeekGroup(string[] arr) {
104+ for(int i=0; i<arr.Length; i++){
105+ PrimitiveConditions.CreateSceneCondition(arr[i], ConditionTypes.Weekly, i, Cycles.Daily);
106+ }
107+ }
108+
109+ private void PrepareMonthGroup(string[] arr) {
110+ for (int i = 0; i < arr.Length; i++) {
111+ PrimitiveConditions.CreateSceneCondition(arr[i], ConditionTypes.Yearly, i, Cycles.Monthly);
112+ }
113+ }
114+
115+ public static ISceneCondition CreateCondition(string name, ConditionTypes ctype, IComparable from, IComparable to) {
116+
117+ return null;
118+ }
119+
120+ }
121+}
--- trunk/core/core/schedule/Time.cs (revision 12)
+++ trunk/core/core/schedule/Time.cs (revision 13)
@@ -1,5 +1,6 @@
11 using System;
22 using System.Diagnostics;
3+using TimeCycle = nft.core.schedule.Calendar.Cycles;
34
45 namespace nft.core.schedule
56 {
@@ -9,7 +10,7 @@
910 [Serializable]
1011 public class Time : IComparable
1112 {
12- // well-defined time units.
13+ // well-defined time units.
1314 public const long SECOND=1;
1415 public const long MINUTE=60;
1516 public const long HOUR=3600;
--- trunk/core/core/schedule/TimeLength.cs (revision 12)
+++ trunk/core/core/schedule/TimeLength.cs (revision 13)
@@ -1,5 +1,6 @@
11 using System;
22 using nft.core.game;
3+using nft.core.view;
34
45 namespace nft.core.schedule
56 {
--- trunk/core/core/schedule/PrimitiveConditions.cs (nonexistent)
+++ trunk/core/core/schedule/PrimitiveConditions.cs (revision 13)
@@ -0,0 +1,192 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using nft.core.view;
5+using TimeCycle = nft.core.schedule.Calendar.Cycles;
6+
7+namespace nft.core.schedule {
8+ public class PrimitiveConditions {
9+ protected static Dictionary<string, ISceneCondition> conditions = new Dictionary<string, ISceneCondition>();
10+
11+ public static void RegisterCondtion(ISceneCondition cond) {
12+ conditions.Add(cond.ConditionName, cond);
13+ }
14+
15+ public static ISceneCondition GetByName(string name) {
16+ return conditions[name];
17+ }
18+
19+ public static ISceneCondition CreateSceneCondition(string name, ConditionTypes ctype, IComparable match, TimeCycle option_resol) {
20+ return CreateSceneConditionImpl(name, ctype, match, null, option_resol);
21+ }
22+
23+ public static ISceneCondition CreateSceneCondition(string name, ConditionTypes ctype, object match) {
24+ return CreateSceneConditionImpl(name, ctype, match, null, TimeCycle.Unknown);
25+ }
26+
27+ public static ISceneCondition CreateSceneCondition(string name, ConditionTypes ctype, IComparable from, IComparable to ) {
28+ return CreateSceneConditionImpl(name, ctype, from, to, TimeCycle.Unknown);
29+ }
30+
31+ public static ISceneCondition CreateSceneCondition(string name, ConditionTypes ctype, IComparable from, IComparable to, TimeCycle option_resol) {
32+ return CreateSceneConditionImpl(name, ctype, from, to, option_resol);
33+ }
34+
35+ protected static ISceneCondition CreateSceneConditionImpl(string name, ConditionTypes ctype, object from, object to, TimeCycle option_resol) {
36+ ISceneCondition cond = null;
37+ if (ctype == ConditionTypes.Weather) {
38+ cond = new WeatherCondition(from);
39+ } else {
40+ IComparable _from = from as IComparable;
41+ IComparable _to = to as IComparable;
42+ IConditionValueExtracter ex = CreateCondValueExtracter(ctype);
43+ if (_to == null || _to.CompareTo(_from) == 0) {
44+ cond = new EqualityCondition(name, ex, _from);
45+ } else if (_to.CompareTo(_from) > 0) {
46+ cond = new RangeCondition(name, ex, _from, _to);
47+ } else {
48+ cond= new BoudaryRangeCondition(name, ex, _from, _to);
49+ }
50+ }
51+ RegisterCondtion(cond);
52+ return cond;
53+ }
54+
55+ public static IConditionValueExtracter CreateCondValueExtracter(ConditionTypes ctype) {
56+ switch (ctype) {
57+ case ConditionTypes.Daily:
58+ return new TimeTicksConditionValueExtracter(ctype);
59+ case ConditionTypes.Weekly:
60+ return new TimeTicksConditionValueExtracter(ctype);
61+ case ConditionTypes.Monthly:
62+ return new TimeTicksConditionValueExtracter(ctype);
63+ case ConditionTypes.Yearly:
64+ return new TimeTicksConditionValueExtracter(ctype);
65+ case ConditionTypes.TimeOfDay:
66+ return new TimeTicksConditionValueExtracter(ctype);
67+ case ConditionTypes.Scale:
68+ return new ScaleConditionValueExtracter();
69+ case ConditionTypes.Weather:
70+ throw new ArgumentException("Weather type is not acceptable. Use WeatherConditon instead.");
71+ }
72+ return null;
73+ }
74+
75+ public static IConditionValueExtracter CreateCondValueExtracter(ConditionTypes ctype, TimeCycle resolution) {
76+ try {
77+ TimeCycle tc = (TimeCycle)ctype;
78+ } catch (Exception) {
79+ throw new ArgumentException(Enum.GetName(typeof(ConditionTypes), ctype) + " type is not acceptable.");
80+ }
81+
82+ switch (resolution) {
83+ case TimeCycle.Hourly:
84+ return new TimeInHoursConditionValueExtracter(ctype);
85+ case TimeCycle.Daily:
86+ return new TimeInDaysConditionValueExtracter(ctype);
87+ case TimeCycle.Weekly:
88+ return new TimeInWeeksConditionValueExtracter(ctype);
89+ case TimeCycle.Monthly:
90+ return new MonthConditionValueExtracter();
91+ }
92+ return null;
93+ }
94+ }
95+
96+ public abstract class ComparebleSceneCondition : ISceneCondition{
97+ protected readonly string name;
98+ protected IConditionValueExtracter extracter;
99+
100+ protected ComparebleSceneCondition(string name) {
101+ this.name = name;
102+ }
103+
104+ protected ComparebleSceneCondition(string cname, IConditionValueExtracter cvext) {
105+ this.name = cname;
106+ this.extracter = cvext;
107+ }
108+
109+ public string ConditionName {
110+ get {
111+ return name;
112+ }
113+ }
114+
115+ public virtual ConditionTypes ConditionType {
116+ get {
117+ return extracter.ConditionType;
118+ }
119+ }
120+
121+ public abstract bool IsMatch(ISceneParams p);
122+
123+ }
124+
125+ public class EqualityCondition : ComparebleSceneCondition {
126+ protected IComparable match;
127+ public EqualityCondition(string name, IConditionValueExtracter ext, IComparable v) : base(name, ext){
128+ this.match = v;
129+ }
130+
131+ public override bool IsMatch(ISceneParams p) {
132+ return extracter.GetTestValue(p).CompareTo(match)==0;
133+ }
134+ }
135+
136+ public class RangeCondition : ComparebleSceneCondition {
137+ protected IComparable from, to;
138+ public RangeCondition(string name, IConditionValueExtracter ext, IComparable from, IComparable to)
139+ : base(name, ext) {
140+ this.from = from;
141+ this.to = to;
142+ }
143+
144+ public override bool IsMatch(ISceneParams p) {
145+ IComparable v = extracter.GetTestValue(p);
146+ return v.CompareTo(from) >= 0 && v.CompareTo(to) <= 0; //from <= v && v <= to;
147+ }
148+ }
149+
150+ /// <summary>
151+ /// This condition is used for splited range around the boundery of cyclic period.
152+ /// For example, from at 23 o'clock to at 1 o'clock of the next day.
153+ /// This condition is given with arguments from=23, to=1.
154+ /// </summary>
155+ public class BoudaryRangeCondition : ComparebleSceneCondition {
156+ protected IComparable from, to;
157+ public BoudaryRangeCondition(string name, IConditionValueExtracter ext, IComparable from, IComparable to)
158+ : base(name, ext) {
159+ this.from = from;
160+ this.to = to;
161+ }
162+
163+ public override bool IsMatch(ISceneParams p) {
164+ IComparable v = extracter.GetTestValue(p);
165+ return v.CompareTo(to) <= 0 || v.CompareTo(from) >= 0; //v <= to || from <= v;
166+ }
167+ }
168+
169+ public class WeatherCondition : ISceneCondition {
170+ protected Object weather;
171+ internal protected WeatherCondition(Object weather) {
172+ this.weather = weather;
173+ }
174+
175+ public string ConditionName {
176+ get {
177+ return weather.ToString();
178+ }
179+ }
180+
181+ public ConditionTypes ConditionType {
182+ get {
183+ return ConditionTypes.Weather;
184+ }
185+ }
186+
187+ public bool IsMatch(ISceneParams p) {
188+ return weather.Equals(p.Weather);
189+ }
190+ }
191+
192+}
--- trunk/core/core/schedule/ConditionValueExtracter.cs (nonexistent)
+++ trunk/core/core/schedule/ConditionValueExtracter.cs (revision 13)
@@ -0,0 +1,108 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using nft.core.view;
5+using TimeCycle = nft.core.schedule.Calendar.Cycles;
6+
7+namespace nft.core.schedule {
8+ public interface IConditionValueExtracter {
9+ Type ComparableType { get; }
10+ IComparable GetTestValue(ISceneParams p);
11+ ConditionTypes ConditionType { get; }
12+ }
13+
14+ public abstract class LongConditionValueExtracter : IConditionValueExtracter {
15+ protected ConditionTypes condtype;
16+ public LongConditionValueExtracter(ConditionTypes ctype) {
17+ this.condtype = ctype;
18+ }
19+
20+ public ConditionTypes ConditionType {
21+ get {
22+ return condtype;
23+ }
24+ }
25+
26+ public Type ComparableType {
27+ get {
28+ return typeof(long);
29+ }
30+ }
31+
32+ public abstract IComparable GetTestValue(ISceneParams p);
33+ }
34+
35+ public class TimeTicksConditionValueExtracter : LongConditionValueExtracter {
36+ public TimeTicksConditionValueExtracter(ConditionTypes ctype) : base(ctype){
37+ }
38+
39+ public override IComparable GetTestValue(ISceneParams p) {
40+ long l1 = Calendar.ActiveCalender.GetCyclicTicks(p.Time, (TimeCycle)condtype);
41+ return l1;
42+ }
43+ }
44+
45+ public class TimeInHoursConditionValueExtracter : LongConditionValueExtracter {
46+ public TimeInHoursConditionValueExtracter(ConditionTypes ctype)
47+ : base(ctype) {
48+ }
49+
50+ public override IComparable GetTestValue(ISceneParams p) {
51+ decimal l1 = Calendar.ActiveCalender.GetCyclicTicks(p.Time, (TimeCycle)condtype);
52+ return (long)Math.Floor(l1 / Time.HOUR);
53+ }
54+ }
55+
56+ public class TimeInWeeksConditionValueExtracter : LongConditionValueExtracter {
57+ public TimeInWeeksConditionValueExtracter(ConditionTypes ctype)
58+ : base(ctype) {
59+ }
60+
61+ public override IComparable GetTestValue(ISceneParams p) {
62+ decimal l1 = Calendar.ActiveCalender.GetCyclicTicks(p.Time, (TimeCycle)condtype);
63+ return (long)Math.Floor(l1 / Time.DAY);
64+ }
65+ }
66+
67+ public class TimeInDaysConditionValueExtracter : LongConditionValueExtracter {
68+ public TimeInDaysConditionValueExtracter(ConditionTypes ctype)
69+ : base(ctype) {
70+ }
71+
72+ public override IComparable GetTestValue(ISceneParams p) {
73+ decimal l1 = Calendar.ActiveCalender.GetCyclicTicks(p.Time, (TimeCycle)condtype);
74+ return (long)Math.Floor(l1 / Time.DAY);
75+ }
76+ }
77+
78+ public class MonthConditionValueExtracter : LongConditionValueExtracter {
79+ public MonthConditionValueExtracter()
80+ : base(ConditionTypes.Yearly) {
81+ }
82+
83+ public override IComparable GetTestValue(ISceneParams p) {
84+ return p.Time.Month;
85+ }
86+ }
87+
88+ public class ScaleConditionValueExtracter : LongConditionValueExtracter {
89+ public ScaleConditionValueExtracter()
90+ : base(ConditionTypes.Scale) {
91+ }
92+ public override IComparable GetTestValue(ISceneParams p) {
93+ return p.Scaler.Value;
94+ }
95+
96+ public ConditionTypes ConditionType {
97+ get {
98+ return ConditionTypes.Scale;
99+ }
100+ }
101+
102+ public Type ComparableType {
103+ get {
104+ return typeof(double);
105+ }
106+ }
107+ }
108+}
--- trunk/framework/TODO.txt (revision 12)
+++ trunk/framework/TODO.txt (revision 13)
@@ -1,5 +1,4 @@
1-・プラグイン関連ファイルをParamReaderで抽象化、最終的にStreamで読み込むように
2-・前景と背景に分かれた3Dオブジェクト(線路など用)
1+・凹型(interior)/凸型(exterior)に分かれた3Dオブジェクト(線路など用)
32 ・選択UIの基本、ステータス表示の基本
43 ・MRT昼夜同時描画/HitTest用マップ
54
--- trunk/framework/framework/plugin/PluginUtil.cs (revision 12)
+++ trunk/framework/framework/plugin/PluginUtil.cs (revision 13)
@@ -7,6 +7,7 @@
77 using System.Collections.Generic;
88 using nft.util;
99 using nft.ui.command;
10+using nft.framework.loader;
1011
1112 namespace nft.framework.plugin
1213 {
@@ -156,5 +157,14 @@
156157 return Path.GetDirectoryName(node.OwnerDocument.BaseURI);
157158 }
158159
160+ public static ParamsReader LoadAnotherXml(ParamsReader source)
161+ {
162+ IFileSource fs = source.GetFileSource(source.InnerText);
163+ XmlDocument doc = XmlUtil.LoadFile(fs);
164+ XmlParamParser parser = new XmlParamParser(doc);
165+ ParamsReader reader = new ParamsReader(doc.BaseURI, parser);
166+ return reader;
167+ }
168+
159169 }
160170 }
--- trunk/framework/util/XmlUtil.cs (revision 12)
+++ trunk/framework/util/XmlUtil.cs (revision 13)
@@ -4,6 +4,7 @@
44 using System.Net;
55 using System.Xml;
66 using System.Diagnostics;
7+using nft.framework;
78
89 namespace nft.util
910 {
@@ -162,5 +163,18 @@
162163 }
163164 }
164165
166+ public static XmlDocument LoadFile(IFileSource fs)
167+ {
168+ // TODO: Language Localizeation implements here
169+ using (Stream file = fs.OpenRead())
170+ {
171+ XmlDocument doc = new XmlDocument();
172+ XmlReader reader = XmlReader.Create(new XmlTextReader(fs.Uri, file), null);
173+ //reader.ValidationType = ValidationType.None;
174+ doc.Load(reader);
175+ return doc;
176+ }
177+ }
178+
165179 }
166180 }
--- trunk/TestLauncher/test/DateTimeTest.cs (nonexistent)
+++ trunk/TestLauncher/test/DateTimeTest.cs (revision 13)
@@ -0,0 +1,43 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using nft.framework;
6+using System.Globalization;
7+using System.Diagnostics;
8+
9+namespace nft.test.test
10+{
11+ public class DateTimeTest
12+ {
13+ [TestEntry]
14+ public static bool CultureFormatTest()
15+ {
16+ CultureInfo current = CultureInfo.CurrentCulture;
17+ DumpCultureInfo(current);
18+ CultureInfo defcult = CultureInfo.GetCultureInfo("en-US");
19+ DumpCultureInfo(defcult);
20+ return true;
21+ }
22+
23+ private static void DumpCultureInfo(CultureInfo info){
24+ Debug.WriteLine("CultureName= " + info.DisplayName);
25+ Debug.Write("DayNames= ");
26+ foreach(string s in info.DateTimeFormat.DayNames)
27+ Debug.Write(" " + s);
28+ Debug.WriteLine("");
29+ Debug.Write("AbbreviatedDayNames= ");
30+ foreach (string s in info.DateTimeFormat.AbbreviatedDayNames)
31+ Debug.Write(" " + s);
32+ Debug.WriteLine("");
33+ Debug.Write("MonthNames= ");
34+ foreach (string s in info.DateTimeFormat.MonthNames)
35+ Debug.Write(" " + s);
36+ Debug.WriteLine("");
37+ Debug.Write("AbbreviatedMonthNames= ");
38+ foreach (string s in info.DateTimeFormat.AbbreviatedMonthNames)
39+ Debug.Write(" " + s);
40+ Debug.WriteLine("");
41+ }
42+ }
43+}