Skip to content

Commit

Permalink
添加 newscreen 新增侠客界面
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdea committed Mar 26, 2018
1 parent e4b5ada commit e1aa7e7
Show file tree
Hide file tree
Showing 8 changed files with 283 additions and 218 deletions.
4 changes: 3 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

403 changes: 192 additions & 211 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion MainScreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function MainScreen.new( )
function self:update( dt )
snow.update(dt)
end
local screenStr = { "game", "help", "main", "battle" }
local screenStr = { "new","game", "help", "main" }
function self:keypressed(key)
if key == keymap.U and index > 1 then
index = index - 1
Expand Down
74 changes: 74 additions & 0 deletions NewScreen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by apple.
--- DateTime: 18/3/26 下午8:39
---
local Screen = require("lib/Screen")
local assets = require("lib.cargo").init("assets")
local NewScreen = {}
local bg = love.graphics.newImage("bg.jpeg")
--local font = love.graphics.newFont("assets/font/myfont.ttf", 24)
local font = assets.font.myfont(24)
local titlefont = assets.font.myfont(48)
--local titlefont = love.graphics.newFont("assets/font/myfont.ttf", 48)
local index = 1
local indexY = 1
local newActor = {}
newActor.gui = {
{ name = "姓名", prop = "name", guiType = "text", contant = "东方未明", select = { "东方未明", "无名" }, color = { 255, 255, 255 } },
{ name = "性别", prop = "gender", guiType = "text", contant = "男性", select = { "男性", "女性", "无性" }, color = { 255, 255, 255 } },
{ name = "年龄", prop = "age", guiType = "int", contant = "16", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "臂力", prop = "Str", guiType = "int", contant = "20", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "根骨", prop = "Con", guiType = "int", contant = "20", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "身法", prop = "Dex", guiType = "int", contant = "20", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "悟性", prop = "Int", guiType = "int", contant = "20", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "五感", prop = "Cho", guiType = "int", contant = "20", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "魅力", prop = "Chn", guiType = "int", contant = "20", select = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25 }, color = { 255, 255, 255 } },
{ name = "气血", prop = "HP", guiType = "int", contant = "120", color = { 255, 255, 255 } },
{ name = "真气", prop = "MP", guiType = "int", contant = "120", color = { 255, 255, 255 } },
{ name = "确定", guiType = "text", contant = "再想想", select = { "再想想", "确定了" }, color = { 255, 255, 255 } }
}
function NewScreen.new()
love.graphics.setFont(font)
local self = Screen.new()
local title = love.graphics.newText(titlefont, { { 0, 0, 0 }, "前世身份" })
local t = love.graphics.newText(font)
function self:draw()
love.graphics.draw(bg, 0, 0, 0)
local num = 1
for i, v in pairs(newActor.gui) do
if i == index then
v.color = { 255, 0, 0 }
else
v.color = { 255, 255, 255 }
end
t:set({ v.color, v.name .. " " .. v.contant })
love.graphics.print(index, 200, 200)
love.graphics.draw(t, 100, 100 + 30 * num)
num = num + 1
end
love.graphics.draw(title, 300, 40)
love.graphics.setColor(255, 255, 255, 255)
end

function self:update(dt)

end

function self:keypressed(key)
if key == "e" and index > 1 then
index = index - 1
elseif key == "d" and index < #newActor.gui then
index = index + 1
elseif key == "f" then
local v = newActor.gui[index]
if v.select then
v.contant = v.select[math.random(#v.select)]
end
elseif key == "s" and indexY > 1 then
indexY = indexY - 1
end
end
return self
end
return NewScreen
8 changes: 5 additions & 3 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Timer = require( 'lib.Timer' )
local ScreenManager = require( "lib/ScreenManager" )
screens = {
main = require( "MainScreen" ),
new = require("NewScreen"),
help = require( "HelpScreen" ),
game = require( "GameScreen" ),
battle = require("BattleScreen")
Expand All @@ -42,12 +43,13 @@ end


function love.draw()
debug.sethook(hook,"c")
---@param hook
--debug.sethook(hook,"c")
ScreenManager.draw()
debug.sethook()
--debug.sethook()

graphicsStats()
drawHook()
--drawHook()
end

function love.keypressed( key )
Expand Down
2 changes: 1 addition & 1 deletion .idea/wxrpg.iml → wuxiaLove2d.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
Expand Down

0 comments on commit e1aa7e7

Please sign in to comment.