⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myinventory_options.lua

📁 时间太紧了
💻 LUA
字号:
-- -----------------------------------------------------------------
-- File: MyInventory_Options.lua
--
-- Purpose: Functions for MyInventory WoW Window.
-- 
-- Author: Ramble - May, 2005
--         Svarten - MyInventory origional author.
-- 
-- Credits: 
--   Sarf, for the original concept.
--   Telo, for LootLink which I love.
--   Kaitlin, for showing me how a good code should look.
--   Pan and Nirre, for testing Svarten's corrupt code during development.
-- -----------------------------------------------------------------
function MyInventoryOptionsFrame_OnLoad()
	tinsert(UISpecialFrames, "MyInventoryOptionsFrame"); -- Esc Closes Inventory 
	UIPanelWindows["MyInventoryOptionsFrame"] = {area = "center", pushable = 0};

	MI_OptionsFrame_Slider_Cols:SetMinMaxValues(MYINVENTORY_COLUMNS_MIN, MYINVENTORY_COLUMNS_MAX);
	MI_OptionsFrame_Slider_Cols:SetValueStep(1);
	MI_OptionsFrame_Slider_ColsText:SetText("每行格数");
	MI_OptionsFrame_Slider_ColsLow:SetText(MYINVENTORY_COLUMNS_MIN);
	MI_OptionsFrame_Slider_ColsHigh:SetText(MYINVENTORY_COLUMNS_MAX);
	
	MI_OptionsFrame_Slider_Scale:SetMinMaxValues(0.5, 1.5);
	MI_OptionsFrame_Slider_Scale:SetValueStep(0.01);
	MI_OptionsFrame_Slider_ScaleText:SetText("缩放");
	MI_OptionsFrame_Slider_ScaleLow:SetText("0.5");
	MI_OptionsFrame_Slider_ScaleHigh:SetText("1.5");
	
end 
function MyInventoryOptionsFrame_OnShow()
	-- Load Checks
	MI_OptionsFrame_CheckButton_ReplaceBags:SetChecked(MyInventoryReplaceBags);
	MI_OptionsFrame_CheckButton_Graphics:SetChecked(MyInventoryGraphics); -- -LITE
	MI_OptionsFrame_CheckButton_Background:SetChecked(MyInventoryBackground);
	MI_OptionsFrame_CheckButton_HighlightBags:SetChecked(MyInventoryHighlightBags);
	MI_OptionsFrame_CheckButton_HighlightItems:SetChecked(MyInventoryHighlightItems);
	MI_OptionsFrame_CheckButton_ShowTitle:SetChecked(MyInventoryShowTitle);
	MI_OptionsFrame_CheckButton_Cash:SetChecked(MyInventoryCash);
	MI_OptionsFrame_CheckButton_Buttons:SetChecked(MyInventoryButtons);
	MI_OptionsFrame_CheckButton_Freeze:SetChecked(MyInventoryFreeze);
	MI_OptionsFrame_CheckButton_ItemBorder:SetChecked(MyInventoryItemBorder);
	if MyInventoryCount == 1 then
		MI_OptionsFrame_CheckButton_CountUsed:SetChecked(1);
		MI_OptionsFrame_CheckButton_CountFree:SetChecked(0);
		MI_OptionsFrame_CheckButton_CountOff:SetChecked(0);
	elseif MyInventoryCount == 0 then
		MI_OptionsFrame_CheckButton_CountUsed:SetChecked(0);
		MI_OptionsFrame_CheckButton_CountFree:SetChecked(1);
		MI_OptionsFrame_CheckButton_CountOff:SetChecked(0);
	else
		MI_OptionsFrame_CheckButton_CountUsed:SetChecked(0);
		MI_OptionsFrame_CheckButton_CountFree:SetChecked(0);
		MI_OptionsFrame_CheckButton_CountOff:SetChecked(1);
	end
	MI_OptionsFrame_Slider_ColsText:SetText("每行格数("..MyInventoryColumns..")");
	MI_OptionsFrame_Slider_Cols:SetValue(MyInventoryColumns);

	MI_OptionsFrame_Slider_ScaleText:SetText("缩放("..MyInventoryScale..")");
	MI_OptionsFrame_Slider_Scale:SetValue(MyInventoryScale);
end
function MyInventory_OptionCheck_OnLoad()
	local option = strsub(this:GetName(), 29);
	-- Set Check button text.
	local label = getglobal(this:GetName().."Text");
	local optiontext = "MYINVENTORY_CHECKTEXT_"..string.upper(option);
	if getglobal(optiontext) then
		label:SetText(getglobal(optiontext));
	else
		label:SetText(option);
	end
	-- Set tooltip text : 
	local optiontip = getglobal("MYINVENTORY_CHECKTIP_"..string.upper(option));
	if optiontip then
		this.tooltipText = optiontip;
	end
end

function MyInventory_OptionCheck_OnClick()
	local value;
	if ( this:GetChecked() ) then
		PlaySound("igMainMenuOptionCheckBoxOff");
		value = 1;
	else
		PlaySound("igMainMenuOptionCheckBoxOn");
		value = 0;
	end
	--Set Option
	local option = strsub(this:GetName(), 29);
	MyInventory_Toggle_Option(option, value, 1);
	MyInventoryFrame_UpdateLook(MyInventory_GetBagsTotalSlots());
end

function MyInventory_CountCheck_OnClick()
	local value;
	this:SetChecked(1);
	if MI_OptionsFrame_CheckButton_CountUsed ~= this then
		MI_OptionsFrame_CheckButton_CountUsed:SetChecked(0);
	else
		value = 1
	end
	if MI_OptionsFrame_CheckButton_CountFree ~= this then
		MI_OptionsFrame_CheckButton_CountFree:SetChecked(0);
	else
		value = 0
	end
	if MI_OptionsFrame_CheckButton_CountOff ~= this then
		MI_OptionsFrame_CheckButton_CountOff:SetChecked(0);
	else
		value = -1
	end
	MyInventory_Toggle_Option("Count", value, 1);
	MyInventoryFrame_UpdateLook(MyInventory_GetBagsTotalSlots());
end

function MI_OptionsFrame_Slider_Cols_OnValueChanged()
	if this:GetValue() ~= MyInventoryColumns then
		MI_OptionsFrame_Slider_ColsText:SetText("每行格数("..this:GetValue()..")");	
		MyInventoryFrame_SetColumns(this:GetValue());
	end
end

function MI_OptionsFrame_Slider_Scale_OnValueChanged()
	if this:GetValue() ~= MyInventoryScale then
		MI_OptionsFrame_Slider_ScaleText:SetText("缩放("..(math.floor(this:GetValue()*10)/10)..")");
		MyInventory_SetScale(math.floor(this:GetValue()*10)/10);
	end
end


function MI_Check_OnEnter()
	if ( this.tooltipText ) then
		MI_OptionsFrame_Help_Text:SetText(this.tooltipText);
		MI_OptionsFrame_Help_Text:SetWidth(350);
	end
end
function MI_Check_OnLeave()
	MI_OptionsFrame_Help_Text:SetText("");
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -