gui_comm_ends.lua
来自「这是整套横扫千军3D版游戏的源码」· LUA 代码 · 共 86 行
LUA
86 行
-------------------------------------------------------------------------------------------------------------------------------------------------------------------- file: gui_comm_ends.lua-- brief: shows a pre-game warning if commander-ends is enabled-- author: Dave Rodgers---- Copyright (C) 2007.-- Licensed under the terms of the GNU GPL, v2 or later.------------------------------------------------------------------------------------------------------------------------------------------------------------------function widget:GetInfo() return { name = "CommanderEnds", desc = "Indicator for the CommEnds state (at game start)", author = "trepan", date = "Jan 8, 2007", license = "GNU GPL, v2 or later", layer = -3, enabled = false -- loaded by default? }end------------------------------------------------------------------------------------------------------------------------------------------------------------------ Automatically generated local definitionslocal glPopMatrix = gl.PopMatrixlocal glPushMatrix = gl.PushMatrixlocal glRotate = gl.Rotatelocal glScale = gl.Scalelocal glText = gl.Textlocal glTranslate = gl.Translatelocal spGetGameSeconds = Spring.GetGameSeconds----------------------------------------------------------------------------------------------------------------------------------------------------------------include("colors.h.lua")local floor = math.floorlocal font = "LuaUI/Fonts/FreeSansBold_30"local fh = fontHandler.UseFont(font)local vsx, vsy = widgetHandler:GetViewSizes()function widget:ViewResize(viewSizeX, viewSizeY) vsx = viewSizeX vsy = viewSizeYendfunction widget:DrawScreen() if (spGetGameSeconds() > 1) then widgetHandler:RemoveWidget() end if (Game.commEnds) then local timer = widgetHandler:GetHourTimer() local colorStr if (math.mod(timer, 0.5) < 0.25) then colorStr = RedStr else colorStr = YellowStr end local msg = colorStr .. "Commander Ends Game!!!" glPushMatrix() glTranslate((vsx * 0.5), (vsy * 0.5) - 50, 0) glScale(1.5, 1.5, 1) glRotate(30 * math.sin(math.pi * 0.5 * timer), 0, 0, 1) if (fh) then fh = fontHandler.UseFont(font) fontHandler.DrawCentered(msg) else glText(msg, 0, 0, 24, "oc") end glPopMatrix() endend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?