Skip to content

Commit

Permalink
Update hitokoto link
Browse files Browse the repository at this point in the history
  • Loading branch information
bajdcc committed Mar 30, 2017
1 parent 0b66bec commit c7ae886
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CCGameFramework/script/scene/web/hitokoto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ function M:init_event()
if id == 5 then
Web.get('http://www.bing.com/HPImageArchive.aspx?format=js&n=1&idx=' .. this.bgidx, 101)
elseif id == 2 then
Web.get('http://api.hitokoto.us/rand?cat=a&length=30', 100)
--Web.get('http://api.hitokoto.us/rand?cat=a&length=30', 100)
Web.get('http://api.hitokoto.cn/?c=a&length=30&encode=json', 100)
end
end
self.handler[self.win_event.httpget] = function(this, id, code, text)
if id == 100 then
local obj = JSON.decode(text, 1, nil)
if obj ~= nil then
local disp = obj.hitokoto .. ' \n !!〆' .. obj.source .. ''
--local disp = obj.hitokoto .. ' \n !!〆' .. obj.source .. '〇'
local disp = '' .. obj.from .. '\n\n' .. obj.hitokoto
this.layers.text.text = disp
this.layers.text:update_and_paint()
end
Expand Down

0 comments on commit c7ae886

Please sign in to comment.