我正在制作一个选择主题的选择器,我想知道是否有比我使用的更好的方法,谢谢。
我现在就这样存钱 var saveSettings = "000";
,0为真1为假,对于我用0,1,2…4,5保存的主题
下面的代码来自函数start(){}
function Start() {
var savedSettings = app.LoadText(saveName, null, fileSettings);
if(savedSettings.charAt(2) == 0 ) NumButtons="#969696", CountIcons="#616161", equalIcon="#ED9135";
else if(savedSettings.charAt(2) == 1 ) NumButtons="#4285F4", CountIcons="#1f498c", equalIcon="#ED9135";
}
下面的代码来自函数picker(){}
function Picker() {
if( themeName=="Material" )
{
savedSettings = savedSettings.replaceAt(2, "1");
app.SaveText("Theme", themeName, fileSettings);
corIcon="#1f498c", corButton="#4285F4", corEqual="#ED9135", fonteButton="White",
fonteIcon="White", fonteSpecial="#ba472b", fonteEqual="White";
//BTNs Theme
btnShow0.SetStyle(corIcon, corIcon); //+
btnShow0.SetTextColor(fonteIcon); //+
btnShow1.SetStyle(corButton, corButton); //1
btnShow1.SetTextColor(fonteButton); //1
btnShow2.SetStyle(corButton, corButton); //2
btnShow2.SetTextColor(fonteButton); //2
btnShow3.SetStyle(corButton, corButton); //3
btnShow3.SetTextColor(fonteButton); //3
btnShow4.SetStyle(corEqual, corEqual);//=
btnShow4.SetTextColor(fonteEqual); //=
}
else if(themeName == "...") {}
else if(themeName == "...") {}
else if(themeName == "...") {}
else if(themeName == "...") {}
}
我应该使用数组,但我不知道这是否是最好的策略。
var data = [{Name : "Material", color1="#....", color2="#....", colorFont1="#....", colorFont1="#...."},
{Name : "Material2", color1="#....", color2="#....", colorFont1="#....", colorFont1="#...."}];
...
function picker() {
...
btnShow0.SetStyle(Material[color1]);
btnShow0.SetStyle(Material[0.....4]);
}
有人能帮我吗?
暂无答案!
目前还没有任何答案,快来回答吧!