
cc.Class({
    extends: cc.Component,

    properties: {

        listItemAddress: {
            default: null,
            type: cc.Label,
            serializable: true,
        },
    
        otherUserItem: {
            default: null,
            serializable: false,
            visible:false
        },

        bLoadUserInfo:false
    },

    setInfo(context) {
        let { item } = context;
        this.otherUserItem = item;
        this.listItemAddress.string = item.address;
    },

    /**
     * 进入其他用户的农场偷菜
     */
    onEnterOtherFarm() {
        GlobalD.OtherUserInfo = this.otherUserItem;
        if (GlobalD.OtherUserInfo.length <= 0) {
            console.log('没有用户', GlobalD.OtherUserInfo);
        }
        if(this.bLoadUserInfo)return;
        this.bLoadUserInfo = true;
        GlobalD.GameData.getOtherUserLandList(GlobalD.OtherUserInfo.userId,()=>{
            this.bLoadUserInfo = false;
        });
        
    }


});
