Skip to content

Commit

Permalink
Merge pull request #3 from CloudSixteen/master
Browse files Browse the repository at this point in the history
Merge from cloudsixteen/Clockwork
  • Loading branch information
minikanyas committed Oct 2, 2017
2 parents 7008b1c + 1981619 commit f3338c6
Show file tree
Hide file tree
Showing 42 changed files with 651 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function THEME:Initialize()
Clockwork.option:SetColor("scoreboard_name", Color(0, 0, 0, 255));
Clockwork.option:SetColor("scoreboard_desc", Color(0, 0, 0, 255));
Clockwork.option:SetColor("scoreboard_item_background", Color(255, 255, 255, 50));
Clockwork.option:SetColor("scoreboard_item_background", Color(255, 255, 255, 255));
Clockwork.option:SetColor("positive_hint", Color(100, 175, 100, 255));
Clockwork.option:SetColor("negative_hint", Color(175, 100, 100, 255));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,17 @@ function PANEL:Init()
self.titleLabel = vgui.Create("cwLabelButton", self);
self.titleLabel:SetDisabled(true);
self.titleLabel:SetFont(hugeTextFont);
self.titleLabel:SetText(string.upper(Schema:GetName()));
local schemaLogo = Clockwork.option:GetKey("schema_logo");
self.subLabel = vgui.Create("cwLabelButton", self);
self.subLabel:SetDisabled(true);
self.subLabel:SetFont(smallTextFont);
self.subLabel:SetText(L(string.upper(Schema:GetDescription())));
self.subLabel:SizeToContents();
if (schemaLogo == "") then
self.titleLabel:SetVisible(true);
self.titleLabel:SizeToContents();
self.titleLabel:SetPos((scrW / 2) - (self.titleLabel:GetWide() / 2), scrH * 0.4);
self.subLabel:SetPos((scrW / 2) - (self.subLabel:GetWide() / 2), self.titleLabel.y + self.titleLabel:GetTall() + 8);
else
self.titleLabel:SetVisible(false);
self.titleLabel:SetSize(512, 256);
self.titleLabel:SetPos((scrW / 2) - (self.titleLabel:GetWide() / 2), scrH * 0.4 - 128);
self.subLabel:SetPos(self.titleLabel.x + (self.titleLabel:GetWide() / 2) - (self.subLabel:GetWide() / 2), self.titleLabel.y + self.titleLabel:GetTall() + 8);
end;
self.authorLabel = vgui.Create("cwLabelButton", self);
self.authorLabel:SetDisabled(true);
self.authorLabel:SetFont(tinyTextFont);
self.authorLabel:SetText(L("DevelopedBy", string.upper(Schema:GetAuthor())));
self.authorLabel:SizeToContents();
self.authorLabel:SetPos(self.subLabel.x + (self.subLabel:GetWide() - self.authorLabel:GetWide()), self.subLabel.y + self.subLabel:GetTall() + 4);
self.createButton = vgui.Create("cwLabelButton", self);
self.createButton:SetFont(smallTextFont);
self.createButton:SetText(L("CharacterMenuNew"));
self.createButton:FadeIn(0.5);
self.createButton:SetCallback(function(panel)
if (table.Count(Clockwork.character:GetAll()) >= Clockwork.player:GetMaximumCharacters()) then
Expand All @@ -79,26 +58,21 @@ function PANEL:Init()
Clockwork.character:ResetCreationInfo();
Clockwork.character:OpenNextCreationPanel();
end);
self.createButton:SizeToContents();
self.createButton:SetMouseInputEnabled(true);
self.createButton:SetPos(scrW * 0.25, 16);
self.loadButton = vgui.Create("cwLabelButton", self);
self.loadButton:SetFont(smallTextFont);
self.loadButton:SetText(L("CharacterMenuLoad"));
self.loadButton:FadeIn(0.5);
self.loadButton:SetCallback(function(panel)
self:OpenPanel("cwCharacterList", nil, function(panel)
Clockwork.character:RefreshPanelList();
end);
end);
self.loadButton:SizeToContents();
self.loadButton:SetMouseInputEnabled(true);
self.loadButton:SetPos(scrW * 0.75, 16);
self.disconnectButton = vgui.Create("cwLabelButton", self);
self.disconnectButton:SetFont(smallTextFont);
self.disconnectButton:SetText(L("CharacterMenuLeave"));
self.disconnectButton:FadeIn(0.5);
self.disconnectButton:SetCallback(function(panel)
if (Clockwork.Client:HasInitialized() and !Clockwork.character:IsMenuReset()) then
Expand All @@ -108,13 +82,11 @@ function PANEL:Init()
RunConsoleCommand("disconnect");
end;
end);
self.disconnectButton:SizeToContents();
self.disconnectButton:SetPos((scrW / 2) - (self.disconnectButton:GetWide() / 2), 16);
self.disconnectButton:SetMouseInputEnabled(true);
self.previousButton = vgui.Create("cwLabelButton", self);
self.previousButton:SetFont(tinyTextFont);
self.previousButton:SetText(L("CharacterMenuPrevious"));
self.previousButton:SetCallback(function(panel)
if (!Clockwork.character:IsCreationProcessActive()) then
local activePanel = Clockwork.character:GetActivePanel();
Expand All @@ -126,13 +98,10 @@ function PANEL:Init()
Clockwork.character:OpenPreviousCreationPanel()
end;
end);
self.previousButton:SizeToContents();
self.previousButton:SetMouseInputEnabled(true);
self.previousButton:SetPos((scrW * 0.2) - (self.previousButton:GetWide() / 2), scrH * 0.9);
self.nextButton = vgui.Create("cwLabelButton", self);
self.nextButton:SetFont(tinyTextFont);
self.nextButton:SetText(L("CharacterMenuNext"));
self.nextButton:SetCallback(function(panel)
if (!Clockwork.character:IsCreationProcessActive()) then
local activePanel = Clockwork.character:GetActivePanel();
Expand All @@ -144,32 +113,86 @@ function PANEL:Init()
Clockwork.character:OpenNextCreationPanel()
end;
end);
self.nextButton:SizeToContents();
self.nextButton:SetMouseInputEnabled(true);
self.nextButton:SetPos((scrW * 0.8) - (self.nextButton:GetWide() / 2), scrH * 0.9);
self.cancelButton = vgui.Create("cwLabelButton", self);
self.cancelButton:SetFont(tinyTextFont);
self.cancelButton:SetText(L("CharacterMenuCancel"));
self.cancelButton:SetCallback(function(panel)
self:ReturnToMainMenu();
end);
self.cancelButton:SizeToContents();
self.cancelButton:SetMouseInputEnabled(true);
self.cancelButton:SetPos((scrW * 0.5) - (self.cancelButton:GetWide() / 2), scrH * 0.9);
local modelSize = math.min(ScrW() * 0.4, ScrH() * 0.9);
local modelSize = math.min(ScrW() * 0.5, ScrH() * 0.75);
self.characterModel = vgui.Create("cwCharacterModel", self);
self.characterModel:SetSize(modelSize, modelSize);
self.characterModel:SetAlpha(0);
self.characterModel:SetModel("models/error.mdl");
self.createTime = SysTime();
Clockwork.theme:Call("PostCharacterMenuInit", self)
Clockwork.theme:Call("PostCharacterMenuInit", self);
self:ResetTextAndPositions();
cvars.AddChangeCallback("cwLang", function()
self:ResetTextAndPositions();
end);
end;
end;
-- A function to reset text and positions.
function PANEL:ResetTextAndPositions()
local scrH = ScrH();
local scrW = ScrW();
self.titleLabel:SetText(string.upper(Schema:GetName()));
self.subLabel:SetText(L(string.upper(Schema:GetDescription())));
self.subLabel:SizeToContents();
local schemaLogo = Clockwork.option:GetKey("schema_logo");
if (schemaLogo == "") then
self.titleLabel:SetVisible(true);
self.titleLabel:SizeToContents();
self.titleLabel:SetPos((scrW / 2) - (self.titleLabel:GetWide() / 2), scrH * 0.4);
self.subLabel:SetPos((scrW / 2) - (self.subLabel:GetWide() / 2), self.titleLabel.y + self.titleLabel:GetTall() + 8);
else
self.titleLabel:SetVisible(false);
self.titleLabel:SetSize(512, 256);
self.titleLabel:SetPos((scrW / 2) - (self.titleLabel:GetWide() / 2), scrH * 0.4 - 128);
self.subLabel:SetPos(self.titleLabel.x + (self.titleLabel:GetWide() / 2) - (self.subLabel:GetWide() / 2), self.titleLabel.y + self.titleLabel:GetTall() + 8);
end;
self.authorLabel:SetText(L("DevelopedBy", string.upper(Schema:GetAuthor())));
self.authorLabel:SizeToContents();
self.authorLabel:SetPos(self.subLabel.x + (self.subLabel:GetWide() - self.authorLabel:GetWide()), self.subLabel.y + self.subLabel:GetTall() + 4);
self.createButton:SetText(L("CharacterMenuNew"));
self.createButton:SizeToContents();
self.createButton:SetPos(scrW * 0.25, 16);
self.loadButton:SetText(L("CharacterMenuLoad"));
self.loadButton:SizeToContents();
self.loadButton:SetPos(scrW * 0.75, 16);
self.disconnectButton:SetText(L("CharacterMenuLeave"));
self.disconnectButton:SizeToContents();
self.disconnectButton:SetPos((scrW / 2) - (self.disconnectButton:GetWide() / 2), 16);
self.previousButton:SetText(L("CharacterMenuPrevious"));
self.previousButton:SizeToContents();
self.previousButton:SetPos((scrW * 0.2) - (self.previousButton:GetWide() / 2), scrH * 0.9);
self.nextButton:SetText(L("CharacterMenuNext"));
self.nextButton:SizeToContents();
self.nextButton:SetPos((scrW * 0.8) - (self.nextButton:GetWide() / 2), scrH * 0.9);
self.cancelButton:SetText(L("CharacterMenuCancel"));
self.cancelButton:SizeToContents();
self.cancelButton:SetPos((scrW * 0.5) - (self.cancelButton:GetWide() / 2), scrH * 0.9);
end;
-- A function to fade in the model panel.
function PANEL:FadeInModelPanel(model)
if (ScrH() < 768) then
Expand Down Expand Up @@ -285,7 +308,7 @@ function PANEL:OpenPanel(vguiName, childData, Callback)
if (!Clockwork.theme:Call("PreCharacterMenuOpenPanel", self, vguiName, childData, Callback)) then
local panel = Clockwork.character:GetActivePanel();
local y = ScrH() * 0.275;
local y = ScrH() * 0.2;
if (ScrH() < 768) then
y = ScrH() * 0.11;
Expand Down Expand Up @@ -1808,7 +1831,7 @@ end;
function PANEL:PerformLayout(w, h)
self.categoryList:StretchToParent(0, 0, 0, 0);
self:SetSize(512, math.min(self.categoryList.pnlCanvas:GetTall() + 8, ScrH() * 0.6));
self:SetSize(512, math.min(self.categoryList.pnlCanvas:GetTall() + 8, ScrH() * 0.5));
end;
vgui.Register("cwCharacterStageTwo", PANEL, "EditablePanel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ local PANEL = {};
function PANEL:Init()
SCOREBOARD_PANEL = true;
self:SetSize(self:GetParent():GetWide(), 48);
self:SetSize(self:GetParent():GetWide(), 52);
-- local nameFont = Clockwork.fonts:GetSize(Clockwork.option:GetFont("scoreboard_name"), 20);
-- local descFont = Clockwork.fonts:GetSize(Clockwork.option:GetFont("scoreboard_desc"), 16);
Expand Down Expand Up @@ -184,6 +184,12 @@ function PANEL:Init()
self.nameLabel:SetFont(nameFont);
self.nameLabel:SetTextColor(Clockwork.option:GetColor("scoreboard_name"));
self.nameLabel:SizeToContents();
local class = Clockwork.class:FindByID(self.player:Team());
if (class and class.color) then
self.nameLabel:SetColor(class.color);
end;
self.factionLabel = vgui.Create("DLabel", self);
self.factionLabel:SetText(info.faction);
Expand All @@ -202,7 +208,7 @@ function PANEL:Init()
self.spawnIcon:SetSize(40, 40);
else
self.spawnIcon = Clockwork.kernel:CreateMarkupToolTip(vgui.Create("DImageButton", self));
self.spawnIcon:SetImage("clockwork/unknown.png");
self.spawnIcon:SetImage("clockwork/unknown2.png");
self.spawnIcon:SetSize(40, 40);
end;
Expand All @@ -217,7 +223,7 @@ function PANEL:Init()
self.avatarImage = vgui.Create("AvatarImage", self);
self.avatarImage:SetSize(40, 40);
self.avatarButton = vgui.Create("DButton", self.avatarImage);
self.avatarButton = Clockwork.kernel:CreateMarkupToolTip(vgui.Create("DButton", self.avatarImage));
self.avatarButton:Dock(FILL);
self.avatarButton:SetText("");
self.avatarButton:SetDrawBorder(false);
Expand All @@ -238,7 +244,13 @@ function PANEL:Init()
end;
function PANEL:Paint(width, height)
INFOTEXT_SLICED:Draw(0, 0, width, height, 8, Clockwork.option:GetColor("scoreboard_item_background"));
local slice = SCOREBOARD_ITEM_SLICED;
if (not slice) then
slice = INFOTEXT_SLICED;
end;
slice:Draw(0, 0, width, height, nil, Clockwork.option:GetColor("scoreboard_item_background"));
return true;
end;
Expand All @@ -252,22 +264,19 @@ function PANEL:Think()
self.spawnIcon:SetToolTip(L("ScoreboardMenuPing", self.player:Ping()));
end;
end;
self.spawnIcon:SetPos(4, 4);
self.spawnIcon:SetSize(40, 40);
end;
-- Called when the layout should be performed.
function PANEL:PerformLayout(w, h)
self.factionLabel:SizeToContents();
self.spawnIcon:SetPos(4, 4);
self.spawnIcon:SetPos(6, 6);
self.spawnIcon:SetSize(40, 40);
self.avatarImage:SetPos(44, 4);
self.avatarImage:SetPos(46, 6);
self.avatarImage:SetSize(40, 40);
self.nameLabel:SetPos(92, 4);
self.factionLabel:SetPos(92, self.nameLabel.y + self.nameLabel:GetTall() + 2);
self.nameLabel:SetPos(94, 2);
self.factionLabel:SetPos(94, self.nameLabel.y + self.nameLabel:GetTall() - 2);
end;
vgui.Register("cwScoreboardItem", PANEL, "DPanel");
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function PANEL:Setup(player)
if (self.Recognises) then
self.Avatar:SetPlayer(player);
else
self.Avatar:SetImage("clockwork/unknown.png");
self.Avatar:SetImage("clockwork/unknown2.png");
end;
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ CW_ENGLISH["FaultNeedGender"] = "You did not choose a gender, or the gender that
CW_ENGLISH["FaultNeedClass"] = "You did not choose a class, or the class that you chose is not valid!";
CW_ENGLISH["FaultNotOnWhitelist"] = "You are not on the #1 whitelist!";
CW_ENGLISH["FaultTooManyInFaction"] = "You cannot create any more characters in this faction.";
CW_ENGLISH["FaultTooManyCharacters"] = "You cannot create any more characters !";
CW_ENGLISH["FaultTooManyCharacters"] = "You cannot create any more characters!";
CW_ENGLISH["FaultGenericError"] = "There was an error creating this character!";
CW_ENGLISH["FaultCharNameExists"] = "A character with the name '#1' already exists!";
CW_ENGLISH["FaultDidNotChooseFaction"] = "You did not choose a faction or the one you have chosen is not valid!";
Expand Down Expand Up @@ -1017,11 +1017,11 @@ CW_ENGLISH["CmdWDesc"] = "<string Text>";
CW_ENGLISH["CmdY"] = "Yell to characters near you.";
CW_ENGLISH["CmdYDesc"] = "<string Text>";
CW_ENGLISH["PlayerInfoCash"] = "Cash: %1";
CW_ENGLISH["PlayerInfoWages"] = "Wages: %1";
CW_ENGLISH["PlayerInfoName"] = "%1";
CW_ENGLISH["PlayerInfoClass"] = "%1";
CW_ENGLISH["PlayerInfoCash"] = "Cash: #1";
CW_ENGLISH["PlayerInfoWages"] = "Wages: #1";
CW_ENGLISH["PlayerInfoName"] = "#1";
CW_ENGLISH["PlayerInfoClass"] = "#1";
CW_ENGLISH["CashAmountSingular"] = "$%1";
CW_ENGLISH["CashAmount"] = "%1 Cash";
CW_ENGLISH["CashAmountSingular"] = "$#1";
CW_ENGLISH["CashAmount"] = "#1 Cash";
CW_ENGLISH["Cash"] = "Cash";
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function CLASS_TABLE:IsDataNetworked(key)
end;
if (SERVER) then
-- A function to deduct neccessary funds from a plater after ordering.
-- A function to deduct neccessary funds from a player after ordering.
function CLASS_TABLE:DeductFunds(player)
if (#self.recipes > 0) then
for k, v in pairs(self.recipes) do
Expand Down Expand Up @@ -598,8 +598,8 @@ if (SERVER) then
end;
-- A function to drop an item from a player.
function Clockwork.item:Drop(player, itemTable, position, noSound, bNoTake)
if (itemTable and (bNoTake or player:HasItemInstance(itemTable))) then
function Clockwork.item:Drop(player, itemTable, position, noSound, dontTake)
if (itemTable and (dontTake or player:HasItemInstance(itemTable))) then
local traceLine = nil;
local entity = nil;
Expand All @@ -613,7 +613,7 @@ if (SERVER) then
return false;
end;
if (!bNoTake) then
if (!dontTake) then
player:TakeItem(itemTable);
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ resource.AddWorkshop("474315121");
AddCSLuaFile(cwKernel:GetSchemaGamemodePath().."/cl_init.lua");
--[[ Add any requires resource files from the server. --]]
Clockwork.kernel:AddFile("materials/clockwork/unknown2.png");
Clockwork.kernel:AddFile("materials/clockwork/decrease.png");
Clockwork.kernel:AddFile("materials/clockwork/increase.png");
Clockwork.kernel:AddDirectory("materials/clockwork/sliced/*.png");
Expand Down
Binary file removed Clockwork/garrysmod/materials/clockwork/unknown.png
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Tools/AttributeTranslator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
attributes/*
sh_language.lua

0 comments on commit f3338c6

Please sign in to comment.