Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 554:7d88e0656c18
Updated and Added
author | MURAKAMI Masaki <c112124@h.koeki-u.ac.jp> |
---|---|
date | Wed, 23 Jul 2014 14:11:18 +0900 |
parents | 391e47aa3ae4 |
children | e10d78e1c170 |
files | minato2014/Bingo.css minato2014/Bingo.rb minato2014/accountcheck.rb minato2014/png/hanabu.png |
diffstat | 4 files changed, 57 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/minato2014/Bingo.css Tue Jul 22 20:53:34 2014 +0900 +++ b/minato2014/Bingo.css Wed Jul 23 14:11:18 2014 +0900 @@ -28,16 +28,6 @@ margin-left: 1%; } -/* ------------------------- -div.center-l{ - background: #67bdff; - width: 100px; - height: 100%; - border: thin solid; - float:left; -} -============================ */ - div.center{ border: thin solid #1d38ff; background: #1d38ff; @@ -51,31 +41,10 @@ background: white; margin-left: auto; margin-right: auto; - margin-top: 3%; + margin-top: 1%; margin-bottom: auto; } -/* ------------------------ -div.center-c li{ - width: 150px; - height: 150px; - float: left; - margin: auto; - border: thin solid; - list-style-type: none; -} -=========================== */ - -/* ------------------------- -div.center-r{ - background:#67bdff; - width: 100px; - height: 100%; - border: thin solid; - float: right; -} -============================ */ - div.bottom{ background: #45e2fe; background-image: url("png/bottom.png");
--- a/minato2014/Bingo.rb Tue Jul 22 20:53:34 2014 +0900 +++ b/minato2014/Bingo.rb Wed Jul 23 14:11:18 2014 +0900 @@ -10,8 +10,8 @@ c = CGI.new(:tag_maker => "html5", :accept_charest => "UTF-8") db = SQLite3::Database.new("sql/stamp.sq3") -#id = c[id] # uidの取得 id = c.cookies["id"][0].to_i +magic = c.cookies["magic"][0].to_i #id = 1 # test err = 0 # 不正な動きであれば負の値になる sidesize = 3 @@ -19,11 +19,34 @@ print("Content-type: text/html; charset=UTF-8 \n\n") -#p id +### DROP TABLE ### + +getcom = ARGV[0].to_s +drop = 'DROP TABLE main ;' +if getcom == 'ududlrllba' + db.execute(drop) +end + +###### + +### DELETE TABLE ### + +del = 'DELETE FROM main WHERE id=?' +if getcom == 'ududlrlrba' + db.execute(del, id) +end + +###### + ##### CHECKING UID ##### -sql = "SELECT stamp_status, stamp_img, name, job, sex, exp FROM main WHERE id=?" -user_data = db.execute(sql, id) +sql = "SELECT stamp_status, stamp_img, name, job, sex, exp FROM main WHERE id=? AND magic=?" +begin + user_data = db.execute(sql, id, magic) +rescue + user_data = [] +end + if user_data == [] # ログインエラー(-1) err -= 1 end @@ -213,6 +236,20 @@ reach = [] end + ### ビンゴしたラインを判定(decision = 0) ### + bingo = [] + # 横 + bingocheck(0, sidesize, 1, stamp_st, 0, bingo) + # 縦 + bingocheck(0, sidesize, sidesize, stamp_st, 0, bingo) + # 左斜め + bingocheck(0, sidesize, sidesize+1, stamp_st, 0, bingo) + # 右斜め + bingocheck(sidesize-1, sidesize, sidesize-1, stamp_st, 0, bingo) + ####### + + bingo = bingo.length # ビンゴの数 + # Updating stamp_st # if stamp_img.include?(rightAC) == true # 既に同名のスタンプが入っていたら if stamp_st[stamp_img.index(rightAC)] < 9 @@ -223,8 +260,9 @@ end else if reach != [] && bingo == 0 # はじめのビンゴは必ず3回で完成 - stamp_st[reach] # ビンゴになる数字を代入 + stamp_st[reach] += 1# ビンゴになる数字を代入 stamp_img[reach] = rightAC + message = "新しいスタンプをGETしました!" # Top message else randam_number = index_st[rand(index_st.length)] # スタンプの入っていない個所のなかからランダムにひとつ選ぶ stamp_st[randam_number] += 1 # 選ばれた個所に1足す @@ -233,8 +271,6 @@ end end ## - - ## ### ビンゴしたラインを判定(decision = 0) ### bingo = [] @@ -250,6 +286,9 @@ bingo = bingo.length # ビンゴの数 + + ## + # Convert to string # stamp_st_string = stamp_st.join @@ -303,8 +342,6 @@ ' ###### - - ### CENTER ### print' <div class="center"> @@ -314,9 +351,9 @@ print'<tr>' 3.times do |n| if stamp_st[3*i+n].to_i > 0 - printf("<td width=160 height=160><img src=\"png/%s.png\" alt=\"stamped\" width=\"150\" height=\"150\"><span style=\"color: green; font-weight: 900;\">%d</span></td>\n", stamp_img[3*i+n], stamp_st[3*i+n]) + printf("<td width=170 height=170><img src=\"png/%s.png\" alt=\"stamped\" width=\"160\" height=\"160\"><span style=\"color: green; font-weight: 900;\">%d</span></td>\n", stamp_img[3*i+n], stamp_st[3*i+n]) else - print"<td width=150 height=150></td>\n" + print"<td width=170 height=170></td>\n" end end print'<tr>' @@ -349,6 +386,13 @@ charST = rpg(job, sex, stamp, bingo, sumexp) # ユーザーのキャラクタステータス +## UPDATE EXP ## + +update_exp = 'UPDATE main SET exp=? WHERE id=?;' +db.execute(update_exp, charST[2], id) + +#### + ## GETTING EXP SUM ## sum_sql = 'SELECT SUM(exp) FROM main ;' @@ -361,15 +405,6 @@ charST = rpg(job, sex, stamp, bingo, sumexp) # ユーザーのキャラクタステータス -## UPDATE EXP ## - -update_exp = 'UPDATE main SET exp=? WHERE id=?;' -db.execute(update_exp, charST[2], id) - -#### -#p charST[2] -#p sumexp - printf(" <!-- キャラクターイメージの設定 --> <div class=\"charIMG\">
--- a/minato2014/accountcheck.rb Tue Jul 22 20:53:34 2014 +0900 +++ b/minato2014/accountcheck.rb Wed Jul 23 14:11:18 2014 +0900 @@ -29,7 +29,7 @@ mg = code[id] sql = "insert into main values (?,?,?,?,?,?,?,?,?,?,?);" -db.execute(sql,id,name,sex,age,aria,job,'000010000','n,n,n,n,kamo,n,n,n,n','0','0',mg); #初期値 +db.execute(sql,id,name,sex,age,aria,job,'000010000','n,n,n,n,kamo,n,n,n,n','1','0',mg); #初期値 expires = "Sun, 27 Jul 2016 00:00:00 GMT"