Don't Starve Revision History Viewer

Comparing Six Feet Under (Rev 86935) to All's Well That Maxwell (Rev 88237)

screens/pausescreen.lua

67891011121314
local Image = require "widgets/image" local UIAnim = require "widgets/uianim" local Widget = require "widgets/widget" local OptionsScreen = require "screens/optionsscreen" local PopupDialogScreen = require "screens/popupdialog" local ControlsScreen = require "screens/controlsscreen" local function dorestart() local player = GetPlayer()
6789101112131415161718192021
local Image = require "widgets/image" local UIAnim = require "widgets/uianim" local Widget = require "widgets/widget" local PopupDialogScreen = require "screens/popupdialog" local ControlsScreen = nil local OptionsScreen = nil if PLATFORM == "PS4" then ControlsScreen = require "screens/controlsscreen_ps4" OptionsScreen = require "screens/optionsscreen_ps4" else ControlsScreen = require "screens/controlsscreen" OptionsScreen = require "screens/optionsscreen" end local function dorestart() local player = GetPlayer()
51525354555657
local PauseScreen = Class(Screen, function(self) Screen._ctor(self, "PauseScreen") self.was_paused = IsPaused() SetPause(true,"pause") --darken everything behind the dialog
58596061626364
local PauseScreen = Class(Screen, function(self) Screen._ctor(self, "PauseScreen") self.active = true SetPause(true,"pause") --darken everything behind the dialog
8687888990919293949596979899100101102103104105106
local can_save = player and player:IsValid() and player.components.health and not player.components.health:IsDead() and IsGamePurchased() local button_w = 160 local buttons = { {text=STRINGS.UI.PAUSEMENU.CONTINUE, cb=function() TheFrontEnd:PopScreen(self) if not self.was_paused then SetPause(false) end end }, {text=STRINGS.UI.PAUSEMENU.CONTROLS, cb=function() TheFrontEnd:PushScreen( ControlsScreen(true)) end }, {text=STRINGS.UI.PAUSEMENU.OPTIONS, cb=function() TheFrontEnd:PushScreen( OptionsScreen(true)) end }, {text=can_save and STRINGS.UI.PAUSEMENU.SAVEANDQUIT or STRINGS.UI.PAUSEMENU.QUIT, cb=function() self:doconfirmquit() end}, } self.menu = self.proot:AddChild(Menu(buttons, button_w, true)) self.menu:SetPosition(-(button_w*(#buttons-1))/2, -65, 0) self.default_focus = self.menu end) function PauseScreen:doconfirmquit() local player = GetPlayer() local can_save = player and player:IsValid() and player.components.health and not player.components.health:IsDead() and IsGamePurchased() local function doquit()
93949596979899100101102103104105106107108109110111112113
local can_save = player and player:IsValid() and player.components.health and not player.components.health:IsDead() and IsGamePurchased() local button_w = 160 local buttons = {} table.insert(buttons, {text=STRINGS.UI.PAUSEMENU.CONTINUE, cb=function() TheFrontEnd:PopScreen(self) if not self.was_paused then SetPause(false) end end }) table.insert(buttons, {text=STRINGS.UI.PAUSEMENU.CONTROLS, cb=function() TheFrontEnd:PushScreen( ControlsScreen(true)) end }) table.insert(buttons, {text=STRINGS.UI.PAUSEMENU.OPTIONS, cb=function() TheFrontEnd:PushScreen( OptionsScreen(true)) end }) table.insert(buttons, {text=can_save and STRINGS.UI.PAUSEMENU.SAVEANDQUIT or STRINGS.UI.PAUSEMENU.QUIT, cb=function() self:doconfirmquit() end}) self.menu = self.proot:AddChild(Menu(buttons, button_w, true)) self.menu:SetPosition(-(button_w*(#buttons-1))/2, -65, 0) TheInputProxy:SetCursorVisible(true) self.default_focus = self.menu end) function PauseScreen:doconfirmquit() self.active = false local player = GetPlayer() local can_save = player and player:IsValid() and player.components.health and not player.components.health:IsDead() and IsGamePurchased() local function doquit()
119120121122123124125126127128129130131
if PauseScreen._base.OnControl(self,control, down) then return true end if (control == CONTROL_PAUSE or control == CONTROL_CANCEL) and not down then TheFrontEnd:PopScreen() if not self.was_paused then SetPause(false) end return true end end return PauseScreen
126127128129130131132133134135136137138139140141142143
if PauseScreen._base.OnControl(self,control, down) then return true end if (control == CONTROL_PAUSE or control == CONTROL_CANCEL) and not down then self.active = false TheFrontEnd:PopScreen() SetPause(false) return true end end function PauseScreen:OnUpdate(dt) if self.active then SetPause(true) end end return PauseScreen