欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

options.lua

时间太紧了
LUA
第 1 页 / 共 2 页
字号:
			frame:Show();
			pamamNum = pamamNum + 1;
			Yoffset = Yoffset - 50;
		end
	end
end
function DSCT_Support_NewFont()
	local aniFont = DSCTOptionsFrameListFrames ["FONT"];
	local mesFont = DSCTOptionsFrameListFrames ["MESSAGEFONT"];
	if aniFont.max == 4 and mesFont.max == 4 then
		if EU_Fonts_List then
			for key,value in EU_Fonts_List do
				if value.name and value.path then
					aniFont.max = aniFont.max + 1;
					mesFont.max = mesFont.max + 1;
					DSCT_FONTLIST[aniFont.max] = {};
					DSCT_FONTLIST[aniFont.max] = value;
					aniFont.list[aniFont.max] = {};
					aniFont.list[aniFont.max].name = value.name;
					aniFont.list[aniFont.max].val = aniFont.max;
					mesFont.list[mesFont.max] = {};
					mesFont.list[mesFont.max].name = value.name;
					mesFont.list[mesFont.max].val = mesFont.max;
				end
			end
			DSCT_aniInit();--reload with Current Config	
			DSCT_cusMessInit();
		end		
	end
end
----------------------
--Called when option page loads
function DSCTOptionsFrame_OnShow()
	--support for EU_Fonts
	DSCT_Support_NewFont();
	-- Initial Values
	-- Set Options values	
	for key, value in DSCTOptionsFrameEventFrames do
		DSCT_RefreshEventFrames(key);
	end
	
	-- Set CheckButton states
	for key, value in DSCTOptionsFrameCheckButtons do
		DSCT_RefreshCheckButton(key);
	end

	--Set Sliders
	for key, value in DSCTOptionsFrameSliders do
		DSCT_RefreshFrameSliders(key);
	end
	
	for key, value in DSCTOptionsColorPickerEx do
		DSCT_RefreshColorPickerEx(key);
	end
	for key, value in DSCTOptionsFrameListFrames do
		DSCT_RefreshFrameList(key);
	end
end

----------------------
--Sets the colors of the config from a color swatch
function DSCTOptionsFrame_SetColor(name)
	local r,g,b = ColorPickerFrame:GetColorRGB();
	local swatch,frame;
	swatch = getglobal(name.."_ColorSwatchNormalTexture");
	frame = getglobal(name);
	swatch:SetVertexColor(r,g,b);
	frame.r = r;
	frame.g = g;
	frame.b = b;
	--update back to config
	DSCT_SetColor(name, r, g, b)
end

----------------------
-- Cancels the color selection
function DSCTOptionsFrame_CancelColor(name, prev)
	local r = prev.r;
	local g = prev.g;
	local b = prev.b;
	local swatch, frame;
	swatch = getglobal(name.."_ColorSwatchNormalTexture");
	frame = getglobal(name);
	swatch:SetVertexColor(r, g, b);
	frame.r = r;
	frame.g = g;
	frame.b = b;
	-- Update back to config
	DSCT_SetColor(name, r, g, b)
end

----------------------

function DSCT_OptionsSliderRefreshTitle(name)
	local slider = getglobal(name);
	local str = getglobal(name.."Text");
	local txt;
	local val = slider:GetValue();
	if name == "LOWHP" or name == "LOWMANA" or name == "ALPHA" or name == "MESSAGEALPHA" then
		if val < 1 then			
			txt = format("%d",val * 100);
		else
			txt = 100;
		end
	elseif name == "ANIMATIONSPEED" or name == "ANIMODE_Param1" or name == "ANIMODE_Param2" then
		txt = format("%d",val * 100);
		txt	= txt.." %";	
	else
		txt = val;
	end	
	str:SetText(slider.titlebak..": "..txt);
end
--Sets the silder values in the config
function DSCT_OptionsSliderOnValueChanged()
	DSCT_OptionsSliderRefreshTitle(this:GetName());
end
function DSCT_OptionsSliderMouseUp()
	DSCT_Set(this:GetName(),this:GetValue());
	local paramList = DSCT_Get("ANIMODE_ParamList");
	local type = DSCT_Get("ANIMODE");
	paramList[type][1] = DSCT_Get("ANIMODE_Param1");
	paramList[type][2] = DSCT_Get("ANIMODE_Param2");
	DSCT_cusMessInit();
	DSCT_aniInit();
	DSCT_openPreView();
end

function DSCT_Event_Button_Click(name)
	for name in string.gfind( name, "(.+)_Button" ) do	
		local val = DSCT_Get(name);	
		val = val + 1;
		if val > 4 then val = 0;end
		if DSCT_Get("ANIMODE") == 0 or DSCT_Get("ANIMODE") == 1 or DSCT_Get("ANIMODE") == 2 then
			if val + 1 == 4 then
				val = 4;
			end
		end
		DSCT_Set(name,val);
		DSCT_RefreshEventFrames(name);
		DSCT_RefreshAllEvent();
	end
end
----------------------
--Sets the checkbox values in the config
function DSCT_OptionsCheckButtonOnClick(name,checkboxname)
	local button = getglobal(checkboxname);
	local val;
	if button:GetChecked() then val = 1;else val = 0;end
	DSCT_Set(checkboxname,val);	
	DSCT_RefreshAllEvent();
end

----------------------
--Open the color selector using show/hide
function DSCT_OpenColorPicker(button)
	CloseMenus();
	if ( not button ) then
		button = this;
	end
	ColorPickerFrame.func = button.swatchFunc;
	ColorPickerFrame:SetColorRGB(button.r, button.g, button.b);
	ColorPickerFrame.previousValues = {r = button.r, g = button.g, b = button.b, opacity = button.opacity};
	ColorPickerFrame.cancelFunc = button.cancelFunc;
	ColorPickerFrame:Show();
end

function DSCT_ButtonToggle(name,v)
	name = string.sub(name,1,string.len(name) - 2);
	local curVal = DSCT_Get(name);
	local p = DSCTOptionsFrameListFrames[name];	
	curVal = curVal + v;
	if curVal > p.max then curVal = p.min;end
	if curVal < p.min then curVal = p.max;end
	DSCT_Set(name,curVal);
	DSCT_RefreshFrameList(name);
	if name == "ANIMODE" then
		for key, value in DSCTOptionsFrameEventFrames do
			DSCT_RefreshEventFrames(key);
		end
	end
end

function DSCT_MouseUp()	
	if ( this.isMoving ) then
		this:StopMovingOrSizing();
		this.isMoving = false;			end
end

function DSCT_MouseDown(button)	
	if button == "LeftButton" then
		this:StartMoving();
		this.isMoving = true;		
	end
end

function DSCT_SaveCustom()
	DSCT_NEWCONFIG["CUSTOM_SETTING".." of ".."DSCT"] = nil;
	DSCT_NEWCONFIG["CUSTOM_SETTING".." of ".."DSCT"] = DSCT_clone(DSCT_Config_GetPlayer());
	DSCT_Debug("Save OK!");
end

function DSCT_LoadCustom()
	if DSCT_NEWCONFIG["CUSTOM_SETTING".." of ".."DSCT"] ~= nil then
		DSCT_Load(DSCT_NEWCONFIG["CUSTOM_SETTING".." of ".."DSCT"]);	
		DSCT_hideMenu();
		DSCT_showMenu();		
		DSCT_Debug("Load OK!");
	end	
end

function DSCT_PreMessMouseUp()	
	if ( this.isMoving ) then
		this:StopMovingOrSizing();
		this.isMoving = false;
		local x,y = this:GetCenter();
		x = x - GetScreenWidth() / 2;
		y = y - GetScreenHeight() / 2;
		DSCT_Set("MESSAGEPOSX",x);
		DSCT_Set("MESSAGEPOSY",y);	
	end
end

function DSCT_PreMessMouseDown(button)
	if button == "LeftButton" then
		this:StartMoving();
		this.isMoving = true;		
	end
end

function DSCT_PreAniMouseUp()	
	if ( this.isMoving ) then
		this:StopMovingOrSizing();
		this.isMoving = false;
		local x,y = this:GetCenter();
		x = x - GetScreenWidth() / 2;
		y = y - GetScreenHeight() / 2;
		DSCT_Set("ANIPOSX",x);
		DSCT_Set("ANIPOSY",y);	
	end
end

function DSCT_PreAniMouseDown(button)
	if button == "LeftButton" then
		this:StartMoving();
		this.isMoving = true;		
	end
end

⌨️ 快捷键说明

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