• 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

Revision59 (tree)
Time2016-09-23 23:45:09
Authorc477

Log Message

旧CommandUI,CommandEntiy関連の削除と整理

Change Summary

Incremental Difference

--- trunk/TestLauncher/test/TestGeometric.cs (nonexistent)
+++ trunk/TestLauncher/test/TestGeometric.cs (revision 59)
@@ -0,0 +1,71 @@
1+using System;
2+using System.Collections;
3+using System.Diagnostics;
4+using nft.core;
5+using nft.core.geometry;
6+using nft.framework;
7+
8+namespace nft.debug
9+{
10+ /// <summary>
11+ /// TestGeometric の概要の説明です。
12+ /// </summary>
13+ public class TestGeometric
14+ {
15+ [TestEntry]
16+ public static void TestDirection()
17+ {
18+ Array da = Enum.GetValues(typeof(Direction16));
19+ Debug.WriteLine("--test1--");
20+ foreach(Direction16 d in da)
21+ {
22+ Direction dir = Direction.Get(d);
23+ Debug.Write(string.Format("{0}:c={1},ic={2},mj={3},",dir.LocalizedName,dir.IsCardinal,dir.IsInterCardinal,dir.IsMajor));
24+ Debug.WriteLine(string.Format("opposite={0},left={1},left_q={2},right={3},right_q={4}",dir.Opposite.LocalizedName,dir.Left.LocalizedName,dir.LeftQuater.LocalizedName,dir.Right.LocalizedName,dir.RightQuater.LocalizedName));
25+ }
26+ Debug.WriteLine("--test2--");
27+ for(int i=0; i<da.Length; i++)
28+ {
29+ for(int j=0; j<da.Length; j++)
30+ {
31+ Direction d1 = (Direction16)da.GetValue(i);
32+ Direction d2 = (Direction16)da.GetValue(j);
33+ Debug.Write(string.Format("{0}<->{1}:",d1.LocalizedName,d2.LocalizedName));
34+ Debug.WriteIf(d1==d2,"==,");
35+ Debug.WriteIf(d1.Equals(d2),"Equals,");
36+ Debug.WriteIf(d1.IsParallel(d2),"Parallel,");
37+ Debug.WriteIf(d1.IsOpposite(d2),"Opposite,");
38+ Debug.WriteIf(d1.IsPerpendiculerTo(d2),"RightAngle,");
39+ Debug.WriteLine(string.Format("Angle={0}", Direction.AngleStepCount(d1,d2)));
40+ }
41+ }
42+
43+ // cast test
44+ Direction direction;
45+ direction = Direction4.EAST;
46+ direction = Direction8.NORTHEAST;
47+ direction = Direction16.NORTHNORTHWEST;
48+ //Direction4 d4 = direction; // compile error
49+ //Direction8 d8 = direction; // compile error
50+ Direction16 d16 = direction;
51+ }
52+
53+ [TestEntry]
54+ public static void TestLocation() {
55+ Show(new Location(1, 2, 3), new Location(3, 2, 1));
56+ Show(new Location(2, 3, 1), new Location(3, 2, 1));
57+ Show(new LocationF(1, 1, 3), new LocationF(2, 4, 3));
58+ Show(new LocationF(4, 2, 1), new LocationF(1, 1, 3));
59+ }
60+
61+ private static void Show(Location l1, Location l2) {
62+ Debug.WriteLine(string.Format("from {0} to {1}", l1, l2));
63+ Debug.WriteLine(string.Format("dir={0}, distance={1}", l1.GetDirectionTo(l2), l1.GetDistanceTo(l2)));
64+ }
65+
66+ private static void Show(LocationF l1, LocationF l2) {
67+ Debug.WriteLine(string.Format("from {0} to {1}", l1, l2));
68+ Debug.WriteLine(string.Format("dir={0}, distance={1}", l1.GetDirectionTo(l2), l1.GetDistanceTo(l2)));
69+ }
70+ }
71+}
--- trunk/core/debug/TestDirection.cs (revision 58)
+++ trunk/core/debug/TestDirection.cs (nonexistent)
@@ -1,54 +0,0 @@
1-using System;
2-using System.Collections;
3-using System.Diagnostics;
4-using nft.core;
5-using nft.core.geometry;
6-using nft.ui.command;
7-
8-namespace nft.debug
9-{
10- /// <summary>
11- /// TestDirection の概要の説明です。
12- /// </summary>
13- public class TestDirection : ICommandEntity_Old
14- {
15- public TestDirection(){}
16- public void CommandExecuted( CommandUI_Old cmdUI,object sender )
17- {
18- Array da = Enum.GetValues(typeof(Direction16));
19- Debug.WriteLine("--test1--");
20- foreach(Direction16 d in da)
21- {
22- Direction dir = Direction.Get(d);
23- Debug.Write(string.Format("{0}:c={1},ic={2},mj={3},",dir.LocalizedName,dir.IsCardinal,dir.IsInterCardinal,dir.IsMajor));
24- Debug.WriteLine(string.Format("opposite={0},left={1},left_q={2},right={3},right_q={4}",dir.Opposite.LocalizedName,dir.Left.LocalizedName,dir.LeftQuater.LocalizedName,dir.Right.LocalizedName,dir.RightQuater.LocalizedName));
25- }
26- Debug.WriteLine("--test2--");
27- for(int i=0; i<da.Length; i++)
28- {
29- for(int j=0; j<da.Length; j++)
30- {
31- Direction d1 = (Direction16)da.GetValue(i);
32- Direction d2 = (Direction16)da.GetValue(j);
33- Debug.Write(string.Format("{0}<->{1}:",d1.LocalizedName,d2.LocalizedName));
34- Debug.WriteIf(d1==d2,"==,");
35- Debug.WriteIf(d1.Equals(d2),"Equals,");
36- Debug.WriteIf(d1.IsParallel(d2),"Parallel,");
37- Debug.WriteIf(d1.IsOpposite(d2),"Opposite,");
38- Debug.WriteIf(d1.IsPerpendiculerTo(d2),"RightAngle,");
39- Debug.WriteLine(string.Format("Angle={0}", Direction.AngleStepCount(d1,d2)));
40- }
41- }
42-
43- // cast test
44- Direction direction;
45- direction = Direction4.EAST;
46- direction = Direction8.NORTHEAST;
47- direction = Direction16.NORTHNORTHWEST;
48- //Direction4 d4 = direction; // compile error
49- //Direction8 d8 = direction; // compile error
50- Direction16 d16 = direction;
51-
52- }
53- }
54-}
--- trunk/core/debug/TestLocation.cs (revision 58)
+++ trunk/core/debug/TestLocation.cs (nonexistent)
@@ -1,37 +0,0 @@
1-using System;
2-using System.Collections;
3-using System.Diagnostics;
4-using nft.core;
5-using nft.core.geometry;
6-using nft.ui.command;
7-
8-namespace nft.debug
9-{
10- /// <summary>
11- /// TestDirection の概要の説明です。
12- /// </summary>
13- public class TestLocation : ICommandEntity_Old
14- {
15- public TestLocation(){}
16- public void CommandExecuted( CommandUI_Old cmdUI,object sender )
17- {
18- Show(new Location(1,2,3),new Location(3,2,1));
19- Show(new Location(2,3,1),new Location(3,2,1));
20- Show(new LocationF(1,1,3),new LocationF(2,4,3));
21- Show(new LocationF(4,2,1),new LocationF(1,1,3));
22- }
23-
24- private void Show(Location l1, Location l2)
25- {
26- Debug.WriteLine(string.Format("from {0} to {1}",l1,l2));
27- Debug.WriteLine(string.Format("dir={0}, distance={1}", l1.GetDirectionTo(l2), l1.GetDistanceTo(l2)));
28- }
29-
30- private void Show(LocationF l1, LocationF l2)
31- {
32- Debug.WriteLine(string.Format("from {0} to {1}",l1,l2));
33- Debug.WriteLine(string.Format("dir={0}, distance={1}", l1.GetDirectionTo(l2), l1.GetDistanceTo(l2)));
34- }
35-
36- }
37-}
--- trunk/core/debug/TestGame.cs (revision 58)
+++ trunk/core/debug/TestGame.cs (nonexistent)
@@ -1,91 +0,0 @@
1-using System;
2-using System.IO;
3-using System.Diagnostics;
4-using System.Runtime.Serialization;
5-using System.Runtime.Serialization.Formatters.Binary;
6-using nft.framework;
7-using nft.framework.plugin;
8-using nft.core.game;
9-using nft.ui.command;
10-using nft.impl.game;
11-using nft.ui.mainframe_old;
12-using nft.core.schedule;
13-
14-namespace nft.debug
15-{
16- /// <summary>
17- /// 使われてません
18- /// </summary>
19- [Obsolete]
20- public class TestGame : ICommandEntity_Old
21- {
22- static TestGame theInstance;
23-
24- static public TestGame GetCommandEntity(string id)
25- {
26- return theInstance;
27- }
28-
29- static protected IGame theGame
30- {
31- get{ return GameManager.theInstance.CurrentGame; }
32- set{
33- if(GameManager.theInstance.CurrentGame!=value)
34- GameManager.theInstance.SetGame(value, BuiltInGameMode.FreeBuild, false);
35- }
36-
37- }
38-
39- static TestGame()
40- {
41- theInstance = new TestGame();
42- theGame = new GameImpl(null, Calendar.ActiveCalendar);
43- }
44- #region ICommandEntity メンバ
45-
46- public void CommandExecuted(CommandUI_Old cmdUI, object sender)
47- {
48- Debug.WriteLine(cmdUI.ID);
49- if(cmdUI.ID.EndsWith("C_TestGameStart"))
50- theGame.Start();
51- else if(cmdUI.ID.EndsWith("C_TestGameSave"))
52- {
53- Stream stream = null;
54- FileInfo fi = new FileInfo(FileName);
55- try
56- {
57- stream = fi.OpenWrite();
58- BinaryFormatter f = new BinaryFormatter();
59- f.Serialize(stream,theGame);
60- }
61- finally
62- {
63- if(stream!=null)
64- stream.Close();
65- }
66-
67- }
68- else if(cmdUI.ID.EndsWith("C_TestGameLoad"))
69- {
70- Stream stream = null;
71- FileInfo fi = new FileInfo(FileName);
72- try
73- {
74- stream = fi.OpenRead();
75- BinaryFormatter f = new BinaryFormatter();
76- f.Binder = PluginSerializationBinder.theInstance;
77- theGame = (IGame)f.Deserialize(stream);
78- }
79- finally
80- {
81- if(stream!=null)
82- stream.Close();
83- }
84- }
85- }
86-
87- #endregion
88- static private string FileName { get { return Directories.WorkDir+"test.sav"; } }
89-
90- }
91-}
--- trunk/framework/ui/command/_CommandUI2.cs (revision 58)
+++ trunk/framework/ui/command/_CommandUI2.cs (nonexistent)
@@ -1,123 +0,0 @@
1-using System;
2-using System.Collections;
3-using nft.util;
4-using nft.framework;
5-
6-namespace nft.ui.command
7-{
8- /// <summary>
9- /// the interface that the module you want to be called should be implement.
10- /// </summary>
11- public interface ICommandEntity_Old
12- {
13- void CommandExecuted( CommandUI_Old cmdUI,object sender );
14- }
15-
16- /// <summary>
17- /// CommandUI manages state of all related GUI controls.
18- /// Set EventHandler of related controls to call ICommandEntity.
19- /// </summary>
20- public class CommandUI_Old
21- {
22- static private Hashtable table = new Hashtable();
23- static public CommandUI_Old GetCommandUI(string id)
24- {
25- return (CommandUI_Old)table[id];
26- }
27-
28- public readonly string ID;
29- protected bool _checked;
30- protected bool enabled;
31- protected object optionState = null;
32- protected ICommandEntity_Old entity;
33- protected ArrayList triggers = new ArrayList();
34-
35- public CommandUI_Old(string id, ICommandEntity_Old _entity, bool _checked, bool _enabled )
36- {
37- if(table.ContainsKey(id))
38- throw new InvalidOperationException("Duplicate command ID");
39- this.ID = id;
40- this.entity = _entity;
41- this._checked = _checked;
42- enabled = _enabled;
43- table.Add(id,this);
44- }
45-
46- public CommandUI_Old(string id, ICommandEntity_Old _entity)
47- : this( id, _entity, false, true )
48- {
49- }
50-
51-
52- #region getters / setters
53- public bool Checked
54- {
55- get{ return _checked; }
56- set
57- {
58- _checked = value;
59- foreach(ICommandTrigger trigger in triggers )
60- trigger.Checked = _checked;
61- }
62- }
63- public bool Enabled
64- {
65- get{ return enabled; }
66- set
67- {
68- enabled = value;
69- foreach(ICommandTrigger trigger in triggers )
70- trigger.Enabled = enabled;
71- }
72- }
73- public object OptionState
74- {
75- get{ return optionState; }
76- set
77- {
78- optionState = value;
79- foreach(ICommandTrigger trigger in triggers )
80- trigger.OptionStateChanged(optionState);
81- }
82- }
83- #endregion
84-
85- internal protected void Update()
86- {
87- foreach(ICommandTrigger trigger in triggers )
88- {
89- trigger.Checked = _checked;
90- trigger.Enabled = enabled;
91- }
92- }
93-
94- internal protected void AddTrigger( ICommandTrigger trigger )
95- {
96- if( triggers.Contains( trigger ) ) return;
97- triggers.Add(trigger);
98- trigger.AddEventHandler(new EventHandler(TriggerEventHandler));
99- }
100-
101- internal protected void RemoveTrigger( ICommandTrigger trigger )
102- {
103- trigger.RemoveEventHandler(new EventHandler(TriggerEventHandler));
104- triggers.Remove(trigger);
105- }
106-
107- protected void TriggerEventHandler(object sender, EventArgs args)
108- {
109- try
110- {
111- entity.CommandExecuted(this, sender);
112- }
113- catch(Exception e)
114- {
115- string msg = I18n.T("Exception raised while executing the command[ID={0}].",ID);
116- if(UIUtil.ShowException(msg,e,UIInformLevel.normal))
117- throw;
118- }
119- }
120- }
121-
122-
123-}
--- trunk/plugins/system/plugin.xml (revision 58)
+++ trunk/plugins/system/plugin.xml (revision 59)
@@ -222,17 +222,7 @@
222222 <command type="ModelessForm" menupath="HELP\DEBUG|CACHEDIR" />
223223 </contribution>
224224
225- <!--contribution type="Command" id="C_TestLocation">
226- <name>TestLocation</name>
227- <class name="nft.debug.TestLocation" codebase=".Core"/>
228- <command menupath="HELP\DEBUG|TEST" />
229- </contribution-->
230- <!--contribution type="Command" id="C_TestGameStart">
231- <name>TestGame Start</name>
232- <class name="nft.debug.TestGame" codebase=".Core"/>
233- <method name="GetCommandEntity" static="true"/>
234- <command menupath="HELP\DEBUG|TEST" />
235- </contribution>
225+ <!--
236226 <contribution type="Command" id="C_TestGameSave">
237227 <name>TestGame Save</name>
238228 <class name="nft.debug.TestGame" codebase=".Core"/>
@@ -249,7 +239,8 @@
249239 <name>Que in events</name>
250240 <class name="nft.debug.TestClockEvent" codebase="..\..\TestSerialize"/>
251241 <command menupath="HELP\DEBUG|TEST" />
252- </contribution-->
242+ </contribution>
243+ -->
253244
254245 <contribution type="Anonymous" id="Test_CtbAnonymous">
255246 <name>匿名コントリビューション</name>