48 lines
995 B
Plaintext
48 lines
995 B
Plaintext
|
|
// 両方のBoxがMapBoxを持つケース
|
||
|
|
|
||
|
|
print("=== Double MapBox Test ===")
|
||
|
|
|
||
|
|
box BoxA {
|
||
|
|
init { data, message }
|
||
|
|
|
||
|
|
setup() {
|
||
|
|
print("BoxA setup start")
|
||
|
|
me.data = new MapBox()
|
||
|
|
me.message = "Hello from A"
|
||
|
|
print("BoxA setup complete with MapBox")
|
||
|
|
}
|
||
|
|
|
||
|
|
callOther(other) {
|
||
|
|
print("BoxA calling other...")
|
||
|
|
other.receive(me.message) // フィールドアクセス含む
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
box BoxB {
|
||
|
|
init { storage }
|
||
|
|
|
||
|
|
setup() {
|
||
|
|
print("BoxB setup start")
|
||
|
|
me.storage = new MapBox() // こちらもMapBox
|
||
|
|
print("BoxB setup complete with MapBox")
|
||
|
|
}
|
||
|
|
|
||
|
|
receive(message) {
|
||
|
|
print("BoxB received: " + message)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
print("Creating BoxA with MapBox...")
|
||
|
|
local boxA
|
||
|
|
boxA = new BoxA()
|
||
|
|
boxA.setup()
|
||
|
|
|
||
|
|
print("Creating BoxB with MapBox...")
|
||
|
|
local boxB
|
||
|
|
boxB = new BoxB()
|
||
|
|
boxB.setup()
|
||
|
|
|
||
|
|
print("Testing cross-box call (both have MapBox)...")
|
||
|
|
boxA.callOther(boxB)
|
||
|
|
|
||
|
|
print("Double MapBox test completed!")
|