Added GameSettingsGui and GuiAnnouncements

This commit is contained in:
Cooldude2606
2018-10-09 19:51:14 +01:00
parent 6df973eb5c
commit 4375671c9b
22 changed files with 183 additions and 118 deletions

View File

@@ -4,7 +4,6 @@
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Game = require('FactorioStdLib.Game@^0.8.0')
local Gui = require('ExpGamingCore.Gui@^4.0.0')
local Role -- ExpGamingCore.Role@^4.0.0
local Sync -- ExpGamingCore.Sync@^4.0.0

View File

@@ -48,7 +48,7 @@ function ThisModule.update(tick)
end
end
local back_btn = Gui.inputs.add{
local back_btn = Gui.inputs{
type='button',
caption='utility/enter',
name='player-list-back'
@@ -57,7 +57,7 @@ local back_btn = Gui.inputs.add{
event.element.parent.destroy()
end)
Gui.left.add{
ThisModule.Gui = Gui.left{
name='player-list',
caption='entity/player',
tooltip={'ExpGamingPlayer-playerList.tooltip'},
@@ -96,7 +96,7 @@ Gui.left.add{
end
if Admin and Admin.report_btn then
if not rank[4] and player.index ~= frame.player_index then
local btn = Admin.report_btn:draw(flow)
local btn = Admin.report_btn(flow)
btn.style.height = 20
btn.style.width = 20
end
@@ -110,7 +110,7 @@ Gui.left.add{
script.on_event(defines.events.on_tick,function(event)
if event.tick > global.update then
Gui.left.update('player-list')
ThisModule.Gui()
global.update = event.tick + global.intervial
end
end)
@@ -136,5 +136,6 @@ script.on_event(defines.events.on_player_joined_game,ThisModule.update)
script.on_event(defines.events.on_player_left_game,ThisModule.update)
script.on_event(defines.events.rank_change,ThisModule.update)
ThisModule.force_update = function() return Gui.left.update('player-list') end
return ThisModule
ThisModule.force_update = function() return ThisModule.Gui() end
-- when called it will queue an update to the player list
return setmetatable(ThisModule,{__call=function(self,...) self.update(...) end})

View File

@@ -91,7 +91,7 @@ local opption_drop_down = Gui.inputs.add_drop_down('opption-drop-down-polls',_op
element.parent.answer.caption = 'Your Answer: '..selected
end)
local prev = Gui.inputs.add{
local prev = Gui.inputs{
type='button',
name='prev-poll',
caption='utility/hint_arrow_left'
@@ -105,7 +105,7 @@ local prev = Gui.inputs.add{
draw_poll(parent.parent.poll_area)
end)
local next = Gui.inputs.add{
local next = Gui.inputs{
type='button',
name='next-poll',
caption='utility/hint_arrow_right'
@@ -132,7 +132,7 @@ local poll_option_input = Gui.inputs.add_text('poll-option-input',true,'Enter Op
else options[element.parent.name].caption = text end
if options.last.caption == element.parent.name then
options.last.caption = tonumber(options.last.caption)+1
_self_referace_poll_option_input:draw(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200
_self_referace_poll_option_input(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200
end
end)
_self_referace_poll_option_input = poll_option_input
@@ -142,13 +142,13 @@ local function poll_assembler(frame)
local options = frame.add{type='flow',name='options'}
options.style.visible = false
options.add{type='label',name='last',caption='2'}
poll_question_input:draw(frame).style.minimal_width = 200
poll_question_input(frame).style.minimal_width = 200
local flow = frame.add{type='flow',direction='vertical'}
poll_option_input:draw(flow.add{type='flow',name='1'}).style.minimal_width = 200
poll_option_input:draw(flow.add{type='flow',name='2'}).style.minimal_width = 200
poll_option_input(flow.add{type='flow',name='1'}).style.minimal_width = 200
poll_option_input(flow.add{type='flow',name='2'}).style.minimal_width = 200
end
local create_poll = Gui.inputs.add{
local create_poll = Gui.inputs{
type='button',
name='create-poll',
caption='utility/add'
@@ -182,7 +182,7 @@ local create_poll = Gui.inputs.add{
end
end)
Gui.popup.add{
ThisModule.Gui = Gui.popup{
name='polls',
caption={'polls.name'},
draw=function(frame,data)
@@ -248,4 +248,5 @@ Gui.popup.add{
-- Event Handlers Define
-- Module Return
return ThisModule
-- when called it will toogle the left gui for this player
return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end})