ABAP版连连看
网上看到的,感觉不错,借来装13。。。
*&---------------------------------------------------------------------*
*& Report ZGAME_LLK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT zgame_llk.
INCLUDE <icon>.
TYPE-POOLS: slis.
TABLES: sscrfields.
CLASS lcl_event_handler DEFINITION DEFERRED. DATA: lt_icon TYPE TABLE OF icon WITH HEADER LINE.
DATA: go_timer TYPE REF TO cl_gui_timer, "进度条计时器
go_evt_hndl TYPE REF TO lcl_event_handler,
twinkle_timer TYPE REF TO cl_gui_timer, "闪烁计时器
twinkle_evt_hndl TYPE REF TO lcl_event_handler.
DATA: l_left_time TYPE i VALUE , "剩余时间
l_times TYPE i, "用来控制进度条的黑方框数目
l_start_time TYPE i, "开始时间
l_end_time TYPE i, "结束时间
l_cost_time TYPE i. "所用时间
TYPES: BEGIN OF score_line,
user LIKE sy-uname,
time() TYPE c,
hintcount() TYPE c,
reformcount() TYPE c,
END OF score_line.
DATA: high_scores TYPE TABLE OF score_line WITH HEADER LINE,
database_id LIKE indx-srtfd VALUE 'Z0324491X'. " export/import to database ID
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_timer FOR EVENT finished OF cl_gui_timer,
handle_twinkle FOR EVENT finished OF cl_gui_timer.
ENDCLASS. "lcl_event_handler DEFINITION
*&---------------------------------------------------------------------*
*& CLASS lcl_event_handler IMPLEMENTATION
*&---------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_timer."进度条
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'RFSH'.
CALL METHOD go_timer->run "必须重新激活定时器
EXCEPTIONS
OTHERS = .
ENDMETHOD. "handle_timer METHOD handle_twinkle."提示闪烁
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'TWNK'.
CALL METHOD twinkle_timer->run "必须重新激活定时器
EXCEPTIONS
OTHERS = .
ENDMETHOD. "handle_timer
ENDCLASS. "lcl_event_handler IMPLEMENTATION DEFINE displ_hsline.
selection-screen: begin of line.
selection-screen: comment () hs1_&.
selection-screen: comment () hs2_&.
selection-screen: comment () hs3_&.
selection-screen: comment () hs4_&.
selection-screen: comment () hs5_&.
selection-screen: end of line.
END-OF-DEFINITION. SELECTION-SCREEN BEGIN OF SCREEN .
*功能按钮
SELECTION-SCREEN PUSHBUTTON () bt_hint USER-COMMAND bt_hint.
SELECTION-SCREEN COMMENT () usedtime.
SELECTION-SCREEN PUSHBUTTON () bt_rfm USER-COMMAND bt_reform.
SELECTION-SCREEN PUSHBUTTON () bt_rec USER-COMMAND bt_record.
*SELECTION-SCREEN PUSHBUTTON 28(10) refresh USER-COMMAND bt_refresh.
*时间条
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT () progress.
SELECTION-SCREEN END OF LINE.
*图片按钮
SELECTION-SCREEN SKIP .
SELECTION-SCREEN PUSHBUTTON () bto01 USER-COMMAND bto01 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto02 USER-COMMAND bto02 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc01 USER-COMMAND btc01 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc02 USER-COMMAND btc02 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc03 USER-COMMAND btc03 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc04 USER-COMMAND btc04 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc05 USER-COMMAND btc05 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc06 USER-COMMAND btc06 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc07 USER-COMMAND btc07 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc08 USER-COMMAND btc08 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc09 USER-COMMAND btc09 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc10 USER-COMMAND btc10 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc11 USER-COMMAND btc11 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc12 USER-COMMAND btc12 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto03 USER-COMMAND bto03 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto04 USER-COMMAND bto04 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() bto05 USER-COMMAND bto05 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto06 USER-COMMAND bto06 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr01 USER-COMMAND btr01 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb001 USER-COMMAND pb001 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb002 USER-COMMAND pb002 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb003 USER-COMMAND pb003 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb004 USER-COMMAND pb004 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb005 USER-COMMAND pb005 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb006 USER-COMMAND pb006 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb007 USER-COMMAND pb007 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb008 USER-COMMAND pb008 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb009 USER-COMMAND pb009 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb010 USER-COMMAND pb010 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb011 USER-COMMAND pb011 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb012 USER-COMMAND pb012 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr13 USER-COMMAND btr13 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr02 USER-COMMAND btr02 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb013 USER-COMMAND pb013 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb014 USER-COMMAND pb014 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb015 USER-COMMAND pb015 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb016 USER-COMMAND pb016 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb017 USER-COMMAND pb017 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb018 USER-COMMAND pb018 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb019 USER-COMMAND pb019 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb020 USER-COMMAND pb020 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb021 USER-COMMAND pb021 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb022 USER-COMMAND pb022 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb023 USER-COMMAND pb023 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb024 USER-COMMAND pb024 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr14 USER-COMMAND btr14 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr03 USER-COMMAND btr03 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb025 USER-COMMAND pb025 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb026 USER-COMMAND pb026 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb027 USER-COMMAND pb027 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb028 USER-COMMAND pb028 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb029 USER-COMMAND pb029 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb030 USER-COMMAND pb030 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb031 USER-COMMAND pb031 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb032 USER-COMMAND pb032 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb033 USER-COMMAND pb033 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb034 USER-COMMAND pb034 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb035 USER-COMMAND pb035 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb036 USER-COMMAND pb036 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr15 USER-COMMAND btr15 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr04 USER-COMMAND btr04 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb037 USER-COMMAND pb037 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb038 USER-COMMAND pb038 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb039 USER-COMMAND pb039 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb040 USER-COMMAND pb040 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb041 USER-COMMAND pb041 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb042 USER-COMMAND pb042 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb043 USER-COMMAND pb043 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb044 USER-COMMAND pb044 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb045 USER-COMMAND pb045 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb046 USER-COMMAND pb046 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb047 USER-COMMAND pb047 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb048 USER-COMMAND pb048 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr16 USER-COMMAND btr16 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr05 USER-COMMAND btr05 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb049 USER-COMMAND pb049 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb050 USER-COMMAND pb050 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb051 USER-COMMAND pb051 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb052 USER-COMMAND pb052 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb053 USER-COMMAND pb053 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb054 USER-COMMAND pb054 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb055 USER-COMMAND pb055 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb056 USER-COMMAND pb056 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb057 USER-COMMAND pb057 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb058 USER-COMMAND pb058 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb059 USER-COMMAND pb059 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb060 USER-COMMAND pb060 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr17 USER-COMMAND btr17 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr06 USER-COMMAND btr06 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb061 USER-COMMAND pb061 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb062 USER-COMMAND pb062 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb063 USER-COMMAND pb063 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb064 USER-COMMAND pb064 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb065 USER-COMMAND pb065 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb066 USER-COMMAND pb066 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb067 USER-COMMAND pb067 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb068 USER-COMMAND pb068 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb069 USER-COMMAND pb069 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb070 USER-COMMAND pb070 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb071 USER-COMMAND pb071 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb072 USER-COMMAND pb072 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr18 USER-COMMAND btr18 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr07 USER-COMMAND btr07 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb073 USER-COMMAND pb073 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb074 USER-COMMAND pb074 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb075 USER-COMMAND pb075 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb076 USER-COMMAND pb076 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb077 USER-COMMAND pb077 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb078 USER-COMMAND pb078 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb079 USER-COMMAND pb079 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb080 USER-COMMAND pb080 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb081 USER-COMMAND pb081 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb082 USER-COMMAND pb082 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb083 USER-COMMAND pb083 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb084 USER-COMMAND pb084 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr19 USER-COMMAND btr19 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr08 USER-COMMAND btr08 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb085 USER-COMMAND pb085 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb086 USER-COMMAND pb086 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb087 USER-COMMAND pb087 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb088 USER-COMMAND pb088 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb089 USER-COMMAND pb089 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb090 USER-COMMAND pb090 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb091 USER-COMMAND pb091 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb092 USER-COMMAND pb092 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb093 USER-COMMAND pb093 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb094 USER-COMMAND pb094 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb095 USER-COMMAND pb095 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb096 USER-COMMAND pb096 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr20 USER-COMMAND btr20 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr09 USER-COMMAND btr09 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb097 USER-COMMAND pb097 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb098 USER-COMMAND pb098 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb099 USER-COMMAND pb099 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb100 USER-COMMAND pb100 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb101 USER-COMMAND pb101 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb102 USER-COMMAND pb102 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb103 USER-COMMAND pb103 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb104 USER-COMMAND pb104 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb105 USER-COMMAND pb105 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb106 USER-COMMAND pb106 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb107 USER-COMMAND pb107 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb108 USER-COMMAND pb108 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr21 USER-COMMAND btr21 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr10 USER-COMMAND btr10 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb109 USER-COMMAND pb109 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb110 USER-COMMAND pb110 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb111 USER-COMMAND pb111 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb112 USER-COMMAND pb112 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb113 USER-COMMAND pb113 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb114 USER-COMMAND pb114 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb115 USER-COMMAND pb115 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb116 USER-COMMAND pb116 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb117 USER-COMMAND pb117 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb118 USER-COMMAND pb118 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb119 USER-COMMAND pb119 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb120 USER-COMMAND pb120 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr22 USER-COMMAND btr22 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr11 USER-COMMAND btr11 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb121 USER-COMMAND pb121 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb122 USER-COMMAND pb122 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb123 USER-COMMAND pb123 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb124 USER-COMMAND pb124 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb125 USER-COMMAND pb125 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb126 USER-COMMAND pb126 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb127 USER-COMMAND pb127 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb128 USER-COMMAND pb128 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb129 USER-COMMAND pb129 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb130 USER-COMMAND pb130 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb131 USER-COMMAND pb131 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb132 USER-COMMAND pb132 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr23 USER-COMMAND btr23 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() btr12 USER-COMMAND btr12 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb133 USER-COMMAND pb133 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb134 USER-COMMAND pb134 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb135 USER-COMMAND pb135 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb136 USER-COMMAND pb136 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb137 USER-COMMAND pb137 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb138 USER-COMMAND pb138 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb139 USER-COMMAND pb139 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb140 USER-COMMAND pb140 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb141 USER-COMMAND pb141 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb142 USER-COMMAND pb142 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb143 USER-COMMAND pb143 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () pb144 USER-COMMAND pb144 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btr24 USER-COMMAND btr24 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() bto07 USER-COMMAND bto07 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto08 USER-COMMAND bto08 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON /() bto09 USER-COMMAND bto09 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto10 USER-COMMAND bto10 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc13 USER-COMMAND btc13 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc14 USER-COMMAND btc14 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc15 USER-COMMAND btc15 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc16 USER-COMMAND btc16 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc17 USER-COMMAND btc17 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc18 USER-COMMAND btc18 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc19 USER-COMMAND btc19 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc20 USER-COMMAND btc20 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc21 USER-COMMAND btc21 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc22 USER-COMMAND btc22 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc23 USER-COMMAND btc23 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () btc24 USER-COMMAND btc24 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto11 USER-COMMAND bto11 VISIBLE LENGTH .
SELECTION-SCREEN PUSHBUTTON () bto12 USER-COMMAND bto12 VISIBLE LENGTH .
SELECTION-SCREEN COMMENT /() c_topic.
SELECTION-SCREEN ULINE /() .
displ_hsline .
SELECTION-SCREEN ULINE /() .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
displ_hsline .
SELECTION-SCREEN END OF SCREEN . START-OF-SELECTION.
CALL SCREEN . DATA: l_chars() TYPE c VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. DATA: BEGIN OF lt_game OCCURS , "游戏区域
value() TYPE c,
END OF lt_game. DATA: BEGIN OF lt_number OCCURS , "1~144
number TYPE i,
END OF lt_number. DATA: BEGIN OF lt_area OCCURS ,
chr() TYPE c,
row TYPE i,
col TYPE i,
top TYPE i,
left TYPE i,
bottom TYPE i,
right TYPE i,
END OF lt_area. DATA: BEGIN OF lt_pic OCCURS ,
id() TYPE c,
END OF lt_pic. DATA: lt_last_area LIKE lt_area OCCURS ,
lt_cur_area LIKE lt_area OCCURS . DATA: randnum TYPE i, "随机数
randchr() TYPE c, "随即字母
linecount TYPE i. "lt_number的行数 DATA: last_pb() TYPE c,
cur_pb() TYPE c,
connected() TYPE c,
left_pbs TYPE i VALUE , "剩余个数
l_pb_chr() TYPE c, "按钮对应的字母
l_hint_count() TYPE c, "提示次数
l_reform_count() TYPE c, "重排次数
l_dead() TYPE c, "是否还可以消除
l_gameover() TYPE c. "时间耗尽、游戏结束 DATA: l_hint_pb1() TYPE c, "提示按钮1
l_hint_pb2() TYPE c, "提示按钮2
l_hint_icon1() TYPE c,
l_hint_icon2() TYPE c. INITIALIZATION. bt_hint = '提示'.
bt_rfm = '重排'.
bt_rec = '排行榜'.
* refresh = '刷新图片'.
btc01 = btc13 = btr01 = btr13 = ''.
btc02 = btc14 = btr02 = btr14 = ''.
btc03 = btc15 = btr03 = btr15 = ''.
btc04 = btc16 = btr04 = btr16 = ''.
btc05 = btc17 = btr05 = btr17 = ''.
btc06 = btc18 = btr06 = btr18 = ''.
btc07 = btc19 = btr07 = btr19 = ''.
btc08 = btc20 = btr08 = btr20 = ''.
btc09 = btc21 = btr09 = btr21 = ''.
btc10 = btc22 = btr10 = btr22 = ''.
btc11 = btc23 = btr11 = btr23 = ''.
btc12 = btc24 = btr12 = btr24 = ''. c_topic = '================:: HIGH SCORES ::================'.
hs2_0 = '用户名'.
hs3_0 = '时间'.
hs4_0 = '提示次数'.
hs5_0 = '重排次数'. PERFORM high_scores_read. PERFORM high_scores_show. DO TIMES.
CONCATENATE progress '█' INTO progress.
ENDDO. * 初始化时间
PERFORM init_timer_progress. *1.初始化lt_game、lt_number、lt_pic.
DO TIMES. "为lt_number赋值:1~144
lt_number-number = sy-index.
APPEND lt_number.
ENDDO. l_hint_count = ''.
l_reform_count = ''.
l_gameover = ''. DO TIMES. "初始化lt_game为14个#
lt_game-value = '##############'.
APPEND lt_game.
ENDDO. DATA: l_icon_count TYPE i,
l_get_icon TYPE c.
SELECT * INTO TABLE lt_icon FROM icon.
DELETE lt_icon WHERE
id = icon_green_light OR
id = icon_yellow_light OR
id = icon_red_light OR
id = icon_message_information OR
id = icon_message_warning OR
id = icon_message_error OR
id = icon_message_question OR
id = icon_message_critical OR
id = icon_space OR
id = icon_include_in_selection OR
id = icon_light_out OR
id = icon_remove_from_selection OR
id = icon_wf_workitem_ol OR
id = icon_new_handling_unit OR
id = icon_new_handling_if_full OR
id = icon_set_sum_undo OR
id = icon_sort_undo OR
id = icon_bw_process OR
id = icon_bw_simulate OR
id = icon_bw_process_cancel OR
id = icon_bw_simulate_cancel OR
id = icon_org_unit OR
id = icon_incomplete OR
id = icon_aew_project
. l_icon_count = LINES( lt_icon[] ).
REFRESH: lt_pic.
DO TIMES.
CLEAR: l_get_icon.
WHILE l_get_icon = ''.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
ran_int_max = l_icon_count
ran_int_min =
IMPORTING
ran_int = randnum
EXCEPTIONS
invalid_input =
OTHERS = .
READ TABLE lt_icon INDEX randnum.
READ TABLE lt_pic WITH KEY id = lt_icon-id.
IF sy-subrc <> .
l_get_icon = 'X'.
lt_pic-id = lt_icon-id.
APPEND lt_pic.
ENDIF.
ENDWHILE.
ENDDO. *2.生成随机数
DO TIMES. "执行72次,每次生成一个字母,并在lt_number中取出两个随机数字,确定其在lt_game中的位置,放入。
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
ran_int_max =
ran_int_min =
IMPORTING
ran_int = randnum
EXCEPTIONS
invalid_input =
OTHERS = .
randnum = randnum - .
randchr = l_chars+randnum().
DO TIMES.
DESCRIBE TABLE lt_number LINES linecount.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
ran_int_max = linecount
ran_int_min =
IMPORTING
ran_int = randnum
EXCEPTIONS
invalid_input =
OTHERS = .
PERFORM update_internaltable_and_icon USING randchr.
ENDDO.
ENDDO. *3.检查是否有可以连接的
PERFORM check_dead. *4.设置开始时间
GET RUN TIME FIELD l_start_time. AT SELECTION-SCREEN. *时间递减
IF sy-ucomm = 'RFSH' AND l_left_time > .
l_left_time = l_left_time - .
IF l_left_time = .
CALL METHOD go_timer->free. "删除定时器
l_gameover = 'X'.
MESSAGE '时间已经耗尽,你失败了!' TYPE 'E'.
ENDIF.
ENDIF. GET RUN TIME FIELD l_end_time.
l_cost_time = ( l_end_time - l_start_time ) / .
usedtime = l_cost_time.
CONDENSE usedtime NO-GAPS.
CONCATENATE '已用时' usedtime '秒' INTO usedtime. "更新comment IF sy-ucomm = 'TWNK'.
PERFORM pb_twinkle.
CALL METHOD twinkle_timer->free.
FREE twinkle_timer.
ENDIF. *更新时间条
CLEAR progress.
l_times = l_left_time / .
DO l_times TIMES.
CONCATENATE progress '█' INTO progress.
ENDDO.
l_times = - l_times.
DO l_times TIMES.
CONCATENATE progress '口' INTO progress.
ENDDO. CHECK l_gameover = ''. IF sscrfields-ucomm = 'BT_HINT'.
PERFORM get_hint USING 'X'.
ELSEIF sscrfields-ucomm = 'BT_REFORM'.
PERFORM reform USING ''.
* ELSEIF sscrfields-ucomm = 'BT_REFRESH'.
* PERFORM update_pb_visible.
ELSEIF sscrfields-ucomm = 'BT_RECORD'.
PERFORM alv_show_record.
ENDIF.
CHECK sscrfields-ucomm CS 'PB'. *图片按钮事件处理
IF last_pb IS NOT INITIAL.
CHECK sscrfields-ucomm NE last_pb.
cur_pb = sscrfields-ucomm.
PERFORM get_area TABLES lt_last_area USING last_pb '' ''.
PERFORM get_area TABLES lt_cur_area USING cur_pb '' ''.
PERFORM check_connect TABLES lt_last_area lt_cur_area CHANGING connected.
IF connected EQ 'X'.
PERFORM clear_pb USING last_pb.
PERFORM clear_pb USING cur_pb.
last_pb = ''.
cur_pb = ''.
ELSE.
last_pb = cur_pb.
ENDIF.
REFRESH: lt_last_area, lt_cur_area.
ELSE.
last_pb = sscrfields-ucomm.
ENDIF. AT SELECTION-SCREEN OUTPUT.
PERFORM update_pb_visible. *&---------------------------------------------------------------------*
*& Form SET_CHAR
*&---------------------------------------------------------------------*
* 在lt_game中设置相应字母,
* 并在lt_number中删除对应行,并更新按钮图片
*----------------------------------------------------------------------*
* -->P_LT_GAME text
* -->P_LT_NUMBER text
* -->P_RANDNUM1 text
*----------------------------------------------------------------------*
FORM update_internaltable_and_icon USING p_chr.
DATA: row TYPE p,
col TYPE p,
left TYPE p,
right TYPE p,
pbname() TYPE c,
pbnum() TYPE c,
chr_index TYPE i.
FIELD-SYMBOLS <pbname> TYPE ANY. READ TABLE lt_number INDEX randnum. *修改lt_game
row = FLOOR( ( lt_number-number - ) / ) + .
col = ( lt_number-number - ) MOD + .
left = col - .
right = - col. READ TABLE lt_game INDEX row.
CONCATENATE lt_game-value+(left) p_chr lt_game-value+col(right) INTO lt_game-value.
MODIFY lt_game INDEX row. *在lt_number中删除对应行
DELETE lt_number INDEX randnum. *更新图片
pbnum = lt_number-number.
PERFORM get_pb_name USING pbnum CHANGING pbname.
ASSIGN (pbname) TO <pbname>. FIND p_chr IN SECTION OFFSET OF l_chars
MATCH OFFSET chr_index.
chr_index = chr_index + .
READ TABLE lt_pic INDEX chr_index.
IF <pbname> IS ASSIGNED.
<pbname> = lt_pic-id.
ENDIF.
ENDFORM. " SET_CHAR
*&---------------------------------------------------------------------*
*& Form GET_AREA
*&---------------------------------------------------------------------*
* 根据button或p_row、p_col获取其area
*----------------------------------------------------------------------*
* -->AREA text
* -->PB_UCOMM text
*----------------------------------------------------------------------*
FORM get_area TABLES area STRUCTURE lt_area USING pb_ucomm p_row p_col.
DATA: num TYPE p,
row TYPE p,
col TYPE p,
tmprow TYPE p,
tmpcol TYPE p,
chr() TYPE c. IF pb_ucomm NE ''.
num = pb_ucomm+().
row = FLOOR( ( num - ) / ) + .
col = ( num - ) MOD + .
ELSE.
row = p_row.
col = p_col.
ENDIF. READ TABLE lt_game INDEX row.
tmpcol = col - .
area-chr = lt_game-value+tmpcol(). area-row = row.
area-col = col. *取Top
tmprow = row - .
tmpcol = col - .
READ TABLE lt_game INDEX tmprow.
chr = lt_game-value+tmpcol().
WHILE chr EQ '#'.
IF tmprow = .
EXIT.
ENDIF.
tmprow = tmprow - .
READ TABLE lt_game INDEX tmprow.
chr = lt_game-value+tmpcol().
ENDWHILE.
area-top = tmprow + . *取Left
tmprow = row.
tmpcol = col - .
READ TABLE lt_game INDEX tmprow.
chr = lt_game-value+tmpcol().
WHILE chr EQ '#'.
IF tmpcol = .
EXIT.
ENDIF.
tmpcol = tmpcol - .
chr = lt_game-value+tmpcol().
ENDWHILE.
IF tmpcol = .
area-left = .
ELSE.
area-left = tmpcol + .
ENDIF. *取Bottom
tmprow = row + .
tmpcol = col - .
READ TABLE lt_game INDEX tmprow.
chr = lt_game-value+tmpcol().
WHILE chr EQ '#'.
IF tmprow = .
EXIT.
ENDIF.
tmprow = tmprow + .
READ TABLE lt_game INDEX tmprow.
chr = lt_game-value+tmpcol().
ENDWHILE.
area-bottom = tmprow - . *取Right
tmprow = row.
tmpcol = col.
READ TABLE lt_game INDEX tmprow.
chr = lt_game-value+tmpcol().
WHILE chr EQ '#'.
IF tmpcol = .
EXIT.
ENDIF.
tmpcol = tmpcol + .
chr = lt_game-value+tmpcol().
ENDWHILE.
IF tmpcol = .
area-right = .
ELSE.
area-right = tmpcol.
ENDIF. APPEND area.
ENDFORM. "GET_AREA
*&---------------------------------------------------------------------*
*& Form check_connected
*&---------------------------------------------------------------------*
* 查看是否可以连接
*----------------------------------------------------------------------*
* -->LASTPB text
* -->CURPB text
*----------------------------------------------------------------------*
FORM check_connect TABLES lt_area1 STRUCTURE lt_area
lt_area2 STRUCTURE lt_area
CHANGING connect.
DATA: tmpnum TYPE i. READ TABLE lt_area1 INDEX .
READ TABLE lt_area2 INDEX . IF lt_area1-chr EQ '#' OR lt_area2-chr EQ '#'.
connect = ''.
EXIT.
ENDIF. IF lt_area1-chr NE lt_area2-chr.
connect = ''.
EXIT.
ENDIF. *相邻情况下的判断
tmpnum = ABS( lt_area1-row - lt_area2-row ) + ABS( lt_area1-col - lt_area2-col ).
IF tmpnum = .
connect = 'X'.
EXIT.
ENDIF. DATA: j TYPE i,
k TYPE i,
l TYPE i,
m TYPE i,
n TYPE i,
flag_failed() TYPE c,
tmpchr() TYPE c. *不相邻的时候,判断方式一
j = lt_area1-top.
WHILE j <= lt_area1-bottom.
k = lt_area2-top.
WHILE k <= lt_area2-bottom.
IF j EQ k.
READ TABLE lt_game INDEX j.
IF lt_area1-col < lt_area2-col.
l = lt_area1-col + .
m = lt_area2-col - .
flag_failed = ''.
WHILE l <= m.
n = l - .
tmpchr = lt_game-value+n().
IF tmpchr NE '#'.
flag_failed = 'X'.
EXIT.
ENDIF.
l = l + .
ENDWHILE.
IF flag_failed = ''.
connect = 'X'.
RETURN.
ENDIF.
ELSE.
l = lt_area2-col + .
m = lt_area1-col - .
flag_failed = ''.
WHILE l <= m.
n = l - .
tmpchr = lt_game-value+n().
IF tmpchr NE '#'.
flag_failed = 'X'.
EXIT.
ENDIF.
l = l + .
ENDWHILE.
IF flag_failed = ''.
connect = 'X'.
RETURN.
ENDIF.
ENDIF.
ENDIF.
k = k + .
ENDWHILE.
j = j + .
ENDWHILE. *不相邻的时候,判断方式二
j = lt_area1-left.
WHILE j <= lt_area1-right.
k = lt_area2-left.
WHILE k <= lt_area2-right.
IF j EQ k.
IF lt_area1-row < lt_area2-row.
l = lt_area1-row + .
m = lt_area2-row - .
flag_failed = ''.
WHILE l <= m.
n = j - .
READ TABLE lt_game INDEX l.
tmpchr = lt_game-value+n().
IF tmpchr NE '#'.
flag_failed = 'X'.
EXIT.
ENDIF.
l = l + .
ENDWHILE.
IF flag_failed = ''.
connect = 'X'.
RETURN.
ENDIF.
ELSE.
l = lt_area2-row + .
m = lt_area1-row - .
flag_failed = ''.
WHILE l <= m.
n = j - .
READ TABLE lt_game INDEX l.
tmpchr = lt_game-value+n().
IF tmpchr NE '#'.
flag_failed = 'X'.
EXIT.
ENDIF.
l = l + .
ENDWHILE.
IF flag_failed = ''.
connect = 'X'.
RETURN.
ENDIF.
ENDIF.
ENDIF.
k = k + .
ENDWHILE.
j = j + .
ENDWHILE.
connect = ''.
ENDFORM. "check_connected
*&---------------------------------------------------------------------*
*& Form CLEAR_PIC
*&---------------------------------------------------------------------*
* 隐藏按钮,并更新lt_game
*----------------------------------------------------------------------*
* -->P_LAST_PB text
*----------------------------------------------------------------------*
FORM clear_pb USING pbname.
FIELD-SYMBOLS <pbname> TYPE ANY.
ASSIGN (pbname) TO <pbname>.
<pbname> = icon_space. DATA: row TYPE p,
col TYPE p,
left TYPE p,
right TYPE p,
modnum TYPE p,
costtime() TYPE c,
msg() TYPE c. row = FLOOR( ( pbname+() - ) / ) + .
col = ( pbname+() - ) MOD + .
left = col - .
right = - col. READ TABLE lt_game INDEX row.
CONCATENATE lt_game-value+(left) '#' lt_game-value+col(right) INTO lt_game-value.
MODIFY lt_game INDEX row. left_pbs = left_pbs - .
IF left_pbs = .
msg = ''.
GET RUN TIME FIELD l_end_time.
l_cost_time = ( l_end_time - l_start_time ) / + l_reform_count * + l_hint_count * .
costtime = l_cost_time.
CONCATENATE '恭喜你!用时为:' costtime '秒!' INTO msg.
CONDENSE msg NO-GAPS.
MESSAGE msg TYPE 'S'.
PERFORM high_scores_read.
PERFORM high_scores_update.
PERFORM high_scores_show.
EXIT.
ENDIF. modnum = left_pbs MOD .
IF modnum = .
PERFORM check_dead.
ENDIF. ENDFORM. " CLEAR_PIC
*&---------------------------------------------------------------------*
*& Form get_pb_chr
*&---------------------------------------------------------------------*
* 根据pbname获取其代表的字母
*----------------------------------------------------------------------*
* -->PBNAME text
*----------------------------------------------------------------------*
FORM get_pb_chr USING pbname.
DATA: num TYPE p,
row TYPE p,
col TYPE p,
tmpcol TYPE p. num = pbname+().
row = FLOOR( ( num - ) / ) + .
col = ( num - ) MOD + . READ TABLE lt_game INDEX row.
tmpcol = col - .
l_pb_chr = lt_game-value+tmpcol().
ENDFORM. "get_pb_chr *&---------------------------------------------------------------------*
*& Form get_chr
*&---------------------------------------------------------------------*
* 根据p_row、p_col获取相应位置的字母
*----------------------------------------------------------------------*
* -->P_ROW text
* -->P_COL text
*----------------------------------------------------------------------*
FORM get_chr USING p_row p_col CHANGING p_chr.
DATA: row TYPE p,
col TYPE p.
row = p_row.
col = p_col - .
READ TABLE lt_game INDEX row.
p_chr = lt_game-value+col().
ENDFORM. "get_chr
*&---------------------------------------------------------------------*
*& Form GET_HINT
*&---------------------------------------------------------------------*
* 获取提示。
* 若成功,则hintcount每次加一。
* 如果没有可供消除的,更新l_dead为'X'。
*----------------------------------------------------------------------*
* -->HINTCOUNT text
* -->RESULT text
*----------------------------------------------------------------------*
FORM get_hint USING flag_show_msg. "
DATA: row1 TYPE p VALUE ,
col1 TYPE p VALUE ,
row2 TYPE p,
col2 TYPE p,
crow1() TYPE c,
ccol1() TYPE c,
crow2() TYPE c,
ccol2() TYPE c,
area1 LIKE lt_area OCCURS ,
area2 LIKE lt_area OCCURS ,
can_connect() TYPE c,
msg() TYPE c,
chr1() TYPE c,
chr2() TYPE c. WHILE row1 <= .
WHILE col1 <= .
PERFORM get_chr USING row1 col1 CHANGING chr1.
IF chr1 NE '#'.
IF col1 = .
IF row1 = .
l_dead = 'X'.
RETURN.
ELSE.
row2 = row1 + .
col2 = .
ENDIF.
ELSE.
row2 = row1.
col2 = col1 + .
ENDIF.
WHILE row2 <= .
WHILE col2 <= .
PERFORM get_chr USING row2 col2 CHANGING chr2.
IF chr2 EQ chr1.
REFRESH: area1, area2.
PERFORM get_area TABLES area1 USING '' row1 col1.
PERFORM get_area TABLES area2 USING '' row2 col2.
PERFORM check_connect TABLES area1 area2 CHANGING can_connect.
IF can_connect = 'X'.
IF flag_show_msg EQ 'X'.
crow1 = row1 - .
ccol1 = col1 - .
crow2 = row2 - .
ccol2 = col2 - .
l_hint_count = l_hint_count + .
CONCATENATE '第' l_hint_count '次提示:第' crow1 '行第'
ccol1 '列----第' crow2 '行第' ccol2 '列' ',耗时增加5秒!' INTO msg.
CONDENSE msg NO-GAPS.
MESSAGE msg TYPE 'S'.
"闪烁
DATA: pbnum() TYPE c.
l_hint_pb1 = l_hint_pb1 = ''.
pbnum = ( crow1 - ) * + ccol1.
PERFORM get_pb_name USING pbnum CHANGING l_hint_pb1.
pbnum = ( crow2 - ) * + ccol2.
PERFORM get_pb_name USING pbnum CHANGING l_hint_pb2.
IF l_hint_icon1 EQ ''.
PERFORM pb_twinkle.
PERFORM init_timer_twinkle.
ENDIF.
ENDIF.
l_dead = ''.
RETURN.
ENDIF.
ENDIF.
col2 = col2 + .
ENDWHILE.
row2 = row2 + .
col2 = .
ENDWHILE.
ENDIF.
col1 = col1 + .
ENDWHILE.
row1 = row1 + .
col1 = .
ENDWHILE.
l_dead = 'X'.
ENDFORM. "GET_HINT *&---------------------------------------------------------------------*
*& Form reform
*&---------------------------------------------------------------------*
* 重排
*----------------------------------------------------------------------*
FORM reform USING p_flag. "系统自动重拍时,不累计重排次数
DATA: BEGIN OF ft_chars OCCURS ,
chr() TYPE c,
END OF ft_chars.
DATA: f_counts TYPE i,
j TYPE i VALUE ,
k TYPE i VALUE ,
msg() TYPE c. *所有剩余的字母放入fm_chars.
WHILE j <= .
READ TABLE lt_game INDEX j.
WHILE k <= .
IF lt_game-value+k() NE '#'.
ft_chars-chr = lt_game-value+k().
APPEND ft_chars.
ENDIF.
k = k + .
ENDWHILE.
j = j + .
k = .
ENDWHILE. *初始化lt_game以及lt_number.
REFRESH: lt_game, lt_number.
DO TIMES. "初始化lt_game为14个#
lt_game-value = '##############'.
APPEND lt_game.
ENDDO.
DO TIMES. "为lt_number赋值:1~144
lt_number-number = sy-index.
APPEND lt_number.
ENDDO. *随机将数据放入lt_game
LOOP AT ft_chars.
DESCRIBE TABLE lt_number LINES linecount.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
ran_int_max = linecount
ran_int_min =
IMPORTING
ran_int = randnum
EXCEPTIONS
invalid_input =
OTHERS = .
PERFORM update_internaltable_and_icon USING ft_chars-chr.
ENDLOOP. PERFORM update_pb_visible. IF p_flag = ''.
l_reform_count = l_reform_count + .
msg = l_reform_count.
CONCATENATE '第' msg '次重排,耗时增加20秒!' INTO msg.
CONDENSE msg NO-GAPS.
MESSAGE msg TYPE 'S'.
ENDIF.
ENDFORM. "reform
*&---------------------------------------------------------------------*
*& Form check_dead
*&---------------------------------------------------------------------*
* 检查是否还有可以消除的,如果没有,自动执行重排直至有可以消除的为止
*----------------------------------------------------------------------*
FORM check_dead.
PERFORM get_hint USING ''.
WHILE l_dead EQ 'X'.
MESSAGE '没有可以消除的图片,自动进行重排' TYPE 'S'.
PERFORM reform USING 'X'.
PERFORM get_hint USING ''.
ENDWHILE.
ENDFORM. "check_dead
*&---------------------------------------------------------------------*
*& Form Update_pb_visible
*&---------------------------------------------------------------------*
* 重排后,刷新按钮的可见性
*----------------------------------------------------------------------*
FORM update_pb_visible.
LOOP AT SCREEN.
CHECK screen-name+() EQ 'PB'.
PERFORM get_pb_chr USING screen-name.
IF l_pb_chr EQ '#'.
screen-invisible = ''.
ELSE.
screen-invisible = ''.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDFORM. "Update_pb_visible
*&---------------------------------------------------------------------*
*& Form init_timer_progress
*&---------------------------------------------------------------------*
* 初始化进度条计时器
*----------------------------------------------------------------------*
FORM init_timer_progress.
CHECK go_timer IS INITIAL.
CREATE OBJECT go_timer
EXCEPTIONS
OTHERS = .
CREATE OBJECT go_evt_hndl.
SET HANDLER go_evt_hndl->handle_timer FOR go_timer.
go_timer->interval = . "设置间隔为6秒
CALL METHOD go_timer->run "激活定时器
EXCEPTIONS
OTHERS = .
ENDFORM. " init_timer_progress
*&---------------------------------------------------------------------*
*& Form init_timer_twinkle
*&---------------------------------------------------------------------*
* 初始化闪烁计时器
*----------------------------------------------------------------------*
FORM init_timer_twinkle.
CREATE OBJECT twinkle_timer
EXCEPTIONS
OTHERS = .
CREATE OBJECT twinkle_evt_hndl.
SET HANDLER twinkle_evt_hndl->handle_twinkle FOR twinkle_timer.
twinkle_timer->interval = . "设置间隔为1秒
CALL METHOD twinkle_timer->run "激活定时器
EXCEPTIONS
OTHERS = .
ENDFORM. "init_timer_twinkle
*&---------------------------------------------------------------------*
*& Form high_scores_read
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM high_scores_read.
REFRESH high_scores.
IMPORT lines = high_scores[] FROM DATABASE indx(st) ID database_id.
ENDFORM. "high_scores_read
*&---------------------------------------------------------------------*
*& Form high_scores_show
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM high_scores_show.
DATA: s() TYPE c, line() TYPE c.
FIELD-SYMBOLS: <fs0> TYPE c,
<fs1> TYPE c,
<fs2> TYPE c,
<fs3> TYPE c,
<fs4> TYPE c. DO TIMES.
line = sy-index.
CONDENSE line NO-GAPS.
CONCATENATE 'hs1_' line INTO s.
ASSIGN (s) TO <fs0>.
CONCATENATE 'hs2_' line INTO s.
ASSIGN (s) TO <fs1>.
CONCATENATE 'hs3_' line INTO s.
ASSIGN (s) TO <fs2>.
CONCATENATE 'hs4_' line INTO s.
ASSIGN (s) TO <fs3>.
CONCATENATE 'hs5_' line INTO s.
ASSIGN (s) TO <fs4>.
READ TABLE high_scores INDEX sy-index.
IF high_scores-user = 'AC-LSUN'.
high_scores-user = '************'.
ENDIF.
IF sy-subrc EQ .
<fs0> = line.
<fs1> = high_scores-user.
<fs2> = high_scores-time.
<fs3> = high_scores-hintcount.
<fs4> = high_scores-reformcount.
CONDENSE <fs3> NO-GAPS.
CONDENSE <fs4> NO-GAPS.
IF <fs1> <> '' AND <fs3> = ''.
<fs3> = ''.
ENDIF.
IF <fs1> <> '' AND <fs4> = ''.
<fs4> = ''.
ENDIF.
ELSE.
CLEAR: <fs0>, <fs1>, <fs2>, <fs3>.
EXIT.
ENDIF.
ENDDO.
ENDFORM. "high_scores_show
*&---------------------------------------------------------------------*
*& Form high_scores_update
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM high_scores_update.
high_scores-user = sy-uname.
WRITE l_cost_time TO high_scores-time RIGHT-JUSTIFIED.
WRITE l_hint_count TO high_scores-hintcount.
WRITE l_reform_count TO high_scores-reformcount.
APPEND high_scores.
SORT high_scores BY time user hintcount reformcount.
* LOOP AT high_scores FROM 11.
* DELETE high_scores INDEX sy-tabix.
* ENDLOOP.
EXPORT lines = high_scores[] TO DATABASE indx(st) ID database_id.
ENDFORM. "high_scores_update
*&---------------------------------------------------------------------*
*& Form PB_TWINKLE
*&---------------------------------------------------------------------*
* 闪烁
*----------------------------------------------------------------------*
* -->P_CROW1 text
* -->P_CCOL1 text
* -->P_CROW2 text
* -->P_CCOL2 text
*----------------------------------------------------------------------*
FORM pb_twinkle.
FIELD-SYMBOLS: <pbname1> TYPE ANY,
<pbname2> TYPE ANY. ASSIGN (l_hint_pb1) TO <pbname1>.
ASSIGN (l_hint_pb2) TO <pbname2>.
IF <pbname1> NE icon_space.
l_hint_icon1 = <pbname1>.
<pbname1> = icon_space.
ELSE.
<pbname1> = l_hint_icon1.
l_hint_icon1 = ''.
ENDIF.
IF <pbname2> NE icon_space.
l_hint_icon2 = <pbname2>.
<pbname2> = icon_space.
ELSE.
<pbname2> = l_hint_icon2.
l_hint_icon1 = ''.
ENDIF.
ENDFORM. " PB_TWINKLE
*&---------------------------------------------------------------------*
*& Form get_pb_name
*&---------------------------------------------------------------------*
* 根据pushbutton的编号获取其名字
*----------------------------------------------------------------------*
* -->P_PBNUM text
* -->P_PBNAME text
*----------------------------------------------------------------------*
FORM get_pb_name USING p_pbnum CHANGING p_pbname.
DATA: pbnum() TYPE c.
pbnum = p_pbnum.
CONDENSE pbnum NO-GAPS.
IF STRLEN( pbnum ) EQ .
CONCATENATE 'PB00' pbnum INTO p_pbname.
ELSEIF STRLEN( pbnum ) EQ .
CONCATENATE 'PB0' pbnum INTO p_pbname.
ELSE.
CONCATENATE 'PB' pbnum INTO p_pbname.
ENDIF.
ENDFORM. "get_pb_name
*&---------------------------------------------------------------------*
*& Form ALV_SHOW_RECORD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM alv_show_record .
DATA: ls_layout TYPE slis_layout_alv.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_fieldcat TYPE slis_fieldcat_alv.
DATA: BEGIN OF lt_data OCCURS .
DATA: num TYPE i.
INCLUDE TYPE score_line.
DATA: END OF lt_data.
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'. DEFINE append_fieldcat.
ls_fieldcat-fieldname = &.
ls_fieldcat-seltext_l = &.
ls_fieldcat-seltext_m = &.
ls_fieldcat-seltext_s = &.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION. append_fieldcat 'NUM' '排名' .
append_fieldcat 'USER' 'User' .
append_fieldcat 'TIME' '时间' .
append_fieldcat 'HINTCOUNT' '提示次数' .
append_fieldcat 'REFORMCOUNT' '重排次数' . PERFORM high_scores_read. LOOP AT high_scores.
MOVE-CORRESPONDING high_scores TO lt_data.
lt_data-num = sy-tabix.
IF lt_data-user = 'AC-LSUN'.
lt_data-user = '************'.
ENDIF.
APPEND lt_data.
ENDLOOP. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* i_callback_program = sy-repid
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_grid_title = '排行榜'
TABLES
t_outtab = lt_data[]
EXCEPTIONS
program_error =
OTHERS = .
ENDFORM. " ALV_SHOW_RECORD
。。。我手机没玩过,所以总是连不完
ABAP版连连看的更多相关文章
- Android 绿豆蛙版连连看(简陋版)
(里面有六张绿豆蛙的图片) 1.选中会有红色框 2.可以直线连(横竖相邻或是横竖间隔空格) 3.可以拐一次弯连接 4.可以拐两次弯连接 5.连接时会有线显示 6.绿色代表进度条,蓝色代表时间条 imp ...
- cocos2d-x 3.6版连连看版本号控制
为了以后的开发和管理.源代码开发必须要使用版本号控制.我们当然选择git来做版本号控制了. 假设你在终端输入git,提示不是一个命令的话.那就说明你的机器没有安装git工具.那就安装一个,百度之有非常 ...
- cocos2d-x 3.6版连连看载入资源
网上找了一个梦幻连连看的资源.大家能够百度一下.然后整理一下加到project里面去.包含声音和图片文件.后面解释怎样整理能够方便管理. 我不推荐在代码里面直接引用资源文件名称,我称之为硬编码. 做i ...
- cocos2d-x 3.6版连连看
写个连连看来讲游戏开发,我认为实例解说效果会好一些. 终端以下cd到源代码文件夹,敲命令: cocos new LLK -p com.goonear.llk -l cpp -d ./Goonear 脚 ...
- Java版连连看
连连看大家应该都玩过,不多说直接上一个做好的界面截图吧,所有的功能都在上面的,要做的就只是如何去实现它们了. 差不多就是这个样子.先说一下大致的思路吧.首先编写基本的界面:把什么按钮啊,表格啊什么的都 ...
- C#源码大汇总
C#高仿QQ2013可在广域网部署聊天系统GG叽叽 动态显示硬盘分区容量饼图 自定义ProgressBar控件高仿Win8进度条 多皮肤精美在线QQ悬浮客服插件 jQuery仿天猫首页多格焦点图片轮播 ...
- 推荐几本WinCE 6程序开发的书
因为学校期中考试和课程设计的原因,winCE6的项目开发耽误了一个多月的时间,现在学校没什么事情了,公司这边杂事也差不多办完了,可以专心的搞开发了,同时这也成了我的毕业设计,我不得不上心喽. 今天在卓 ...
- 【ABAP系列】SAP F4搜索帮助的高级版
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP F4搜索帮助的高级版 ...
- abap调vb写的dll实现电子天平的读数(带控件版)
废话不多说,直接上. 鉴于abap调研的dll文件需要在wins注册,自己尝试过delphi和C#感觉不是很好,最后毅然选择了VB来写 因为需要用到MScomm控件,所以对于将要写的dll需要带for ...
随机推荐
- [CF733D]Kostya the Sculptor(贪心)
题目链接:http://codeforces.com/contest/733/problem/D 题意:给n个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少 ...
- 【转】在网页中运行VB6程序
用VB6做的程序在网页里运行, 需要把程序做成OCX格式,下面简单做一介绍: 首先新建一个工程, 选择ActivX控件: 然后添加控件和代码: 然后F5运行 然后按下图设置,去掉弹出消息阻止 这样 ...
- 关于STM32库中 __IO 修饰符(volatile修饰符,反复无常的意思)
STM32例子代码中会有像这样的代码 static __IO uint32_t TimingDelay; 这里边的__IO修饰符不好理解,单从字面可以看出是为IO相关,查其标准库可以得知这个__IO ...
- Oracle 怎么让id自增加
--自增长序列 create table test( tid int not null, tname ), tsex ), tbz ) ) --添加主键约束 alter table test add ...
- Deep Learning: Activation Function
Sigmoid Function ReLU Function Tanh Function
- iOS - OC 术语表
1.术语表
- SAP接口编程 之 JCo3.0系列(05) : Exception Handling
JCO3.0的Exception,常用的Exception如下: JCoException 继承自java.lang.Exception,是JCo3中Exception的基类. JCoRuntimeE ...
- URLConnection 使用
统一资源定位符URL(Uniform Resource Locator)是www客户机访问Internet时用来标识资源的名字和地址.超文本链路由统一资源定位符URL维持.URL的格式是: <M ...
- SpringAop学习
Spring Aop (jdk动态代理和cglib代理) Aop 的概念 aop即面向切面编程,一般解决具有横切面性质的体统(事务,缓存,安全) JDK动态代理: 可以使用实现proxy 类,实现jd ...
- (转)接口自动化测试 – Java+TestNG 测试 Restful Web Service
本文主要介绍如何用Java针对Restful web service 做接口自动化测试(数据驱动),相比UI自动化,接口自动化稳定性可靠性高,实施难易程度低,做自动化性价比高.所用到的工具或类库有 T ...