weixin_46870449 2022-04-28 15:15 采纳率: 50%
浏览 31
已结题

请问这段代码是什么意思

public void setNextCardLocation(Point point){
PKCard card = main.getNextCard(this);
if (card != null){
if (point == null){
card.setNextCardLocation(null);
main.table.remove(card.getLocation());
card.setLocation(card.initPoint);
main.table.put(card.initPoint, card);
}
else{
point = new Point(point);
point.y += 20;
card.setNextCardLocation(point);
point.y -= 20;
main.table.remove(card.getLocation());
card.setLocation(point);
main.table.put(card.getLocation(), card);
card.initPoint = card.getLocation();
}
}
}

  • 写回答

1条回答 默认 最新

  • 吕布辕门 后端领域新星创作者 2022-04-28 15:31
    关注

    你好,望采纳!
    处理card位置的逻辑

    
    public void setNextCardLocation(Point point){
    PKCard card = main.getNextCard(this);//获取下一个pkcard
    if (card != null){//如果card存在
    if (point == null){//如果point不存在,设置默认值
    card.setNextCardLocation(null);
    main.table.remove(card.getLocation());
    card.setLocation(card.initPoint);
    main.table.put(card.initPoint, card);
    }
    else{//如果存在,x和y坐标各加20
    point = new Point(point);
    point.y += 20;
    card.setNextCardLocation(point);
    point.y -= 20;
    main.table.remove(card.getLocation());
    card.setLocation(point);
    main.table.put(card.getLocation(), card);
    card.initPoint = card.getLocation();
    }
    }
    }
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 5月12日
  • 已采纳回答 5月4日
  • 创建了问题 4月28日

悬赏问题

  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事: