54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
|
|
// MapBox間Box参照3引数テスト
|
||
|
|
|
||
|
|
print("=== Cross MapBox Reference Test ===")
|
||
|
|
|
||
|
|
// TargetBox - MapBoxを持つ受信側
|
||
|
|
box TargetBox {
|
||
|
|
init { handlers }
|
||
|
|
|
||
|
|
setup() {
|
||
|
|
print("TargetBox setup start")
|
||
|
|
me.handlers = new MapBox()
|
||
|
|
print("TargetBox setup complete with MapBox")
|
||
|
|
}
|
||
|
|
|
||
|
|
deliver(messageType, data, from) {
|
||
|
|
print("deliver: " + from + " -> " + messageType + " = " + data)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// CallerBox - MapBoxを持つ送信側
|
||
|
|
box CallerBox {
|
||
|
|
init { target, nodeId, myData }
|
||
|
|
|
||
|
|
setup(targetRef) {
|
||
|
|
print("CallerBox setup start")
|
||
|
|
me.target = targetRef
|
||
|
|
me.nodeId = "TestNode"
|
||
|
|
me.myData = new MapBox() // CallerBoxもMapBoxを持つ
|
||
|
|
print("CallerBox setup complete with MapBox")
|
||
|
|
}
|
||
|
|
|
||
|
|
testCall() {
|
||
|
|
print("About to call 3-arg method across MapBox-containing Boxes...")
|
||
|
|
me.target.deliver("hello", "data", me.nodeId)
|
||
|
|
print("Cross MapBox 3-arg call completed")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
print("Creating TargetBox with MapBox...")
|
||
|
|
local target
|
||
|
|
target = new TargetBox()
|
||
|
|
target.setup()
|
||
|
|
|
||
|
|
print("Creating CallerBox with MapBox...")
|
||
|
|
local caller
|
||
|
|
caller = new CallerBox()
|
||
|
|
caller.setup(target)
|
||
|
|
|
||
|
|
print("Executing cross-MapBox 3-arg call...")
|
||
|
|
caller.testCall()
|
||
|
|
|
||
|
|
print("If you see this, cross-MapBox worked!")
|
||
|
|
|
||
|
|
print("All cross-MapBox reference tests completed!")
|