跳转至

AssetSetInteractCBFunc 交互

格式

AssetSetInteractCBFunc(asset, callback)

简介

当与资源类的资源对象进行交互时执行回调函数,资源对象的交互类型详见INTERACT

参数

名称 类型 描述
asset 资源类
callback 回调函数

实例

当对场景内的逻辑方块“stone”按下鼠标左键时打印123。

import fg

asset = fg.AssetCreate()
asset.name = 'stone'
asset.state = fg.STATE.BLOCK
asset.blockSort = wx.BLOCK.STONE

fg.AssetRegister(asset)

def onInteract(self, interact):
    if interact==fg.INTERACT.MOUSE_LEFT:
        print(123)

fg.AssetSetInteractCBFunc(asset,onInteract)