Override public void run while true 判断道具类型 if type == 0 image_type = image_type == 1 0 1; show = StaticValuemggetimage_type;
/**
-
该方法是一个线程的run方法,用于循环判断道具类型并显示对应的图片。 */ @Override public void run() { while (true) { //判断道具类型 if (type == 0) { //如果类型为0,则切换显示图片类型 image_type = image_type == 1 ? 0 : 1; show = StaticValue.mg.get(image_type); }
//判断是否是小花道具 if (type == 1) { //如果类型为1,则显示小花图片 show = StaticValue.xh; } //判断是否是金币道具 if (type == 2) { //如果类型为2,则切换显示图片类型 image_type = image_type == 1 ? 0 : 1; show = StaticValue.jinBi.get(image_type); } try { //线程休眠50毫秒 Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); }}
原文地址: http://www.cveoy.top/t/topic/g0RZ 著作权归作者所有。请勿转载和采集!