|
应用于空调控制界面
应用示例可查看_MATRIX 和_AUDIO方法,可自行修改相关方法属性及添加方法属性。有任何问题建议可在下方留言,功能持续改进更新
附:
function _AIR(vPort)
{
this.mode = 0; //0 auto 1 cool 2 hot 3 arefa 4 fan
this.power = 0;
this.temp = 26;
this.port = vPort;
this.irModeCMD = ["AIR_MODE_AUTO","AIR_MODE_COOL","AIR_MODE_HOT","AIR_MODE_ARERA","AIR_MODE_VENTE"];
this.btnModeName = ["btnAirModeAuto","btnAirModeCool","btnAirModeHot","btnAirModeArear","btnAirModeVente"];
this.modeImageOn = new Array();
this.modeImageOff= new Array();
this.txtTemp = "btnAirTemp"
this.irTempCMD = "AIR_TEMP_COOL_";
this.tempLevel = "btnAirLevel"
this.tempLevelImage = "bar01animate"
this.powerOnCMD = "AIR_POWER_ON";
this.powerOffCMD = "AIR_POWER_OFF";
this.btnPower = "btnAirPower"
this.btnPowerImageOn = "btn01airpoweron.png";
this.btnPowerImageOff = "btn01airpoweroff.png";
for(var i=0;i<this.btnModeName.length;i++)
{
if(FindGUIObject(this.btnModeName[i])!=null)
{
this.modeImageOn[i]=getImageOn(this.btnModeName[i])
this.modeImageOff[i]=getImage(this.btnModeName[i]);
}
}
if(FindGUIObject(this.btnPower)!=null)
{
this.btnPowerImageOn=getImageOn(this.btnPower)
this.btnPowerImageOff=getImage(this.btnPower);
}
this.setTemp = function(vTemp)
{
this.temp = vTemp;
sendIrName(this.port,this.irTempCMD+this.temp)
setText(this.txtTemp,this.temp)
setImage(this.tempLevel,this.tempLevelImage+this.temp+".png")
this.power = 1;
setImage(this.btnPower,this.btnPowerImageOn);
}
this.delayTemp = function(vSec,vTemp)
{
this.temp = vTemp;
delayIrName(this.port,this.irTempCMD+this.temp)
setImage(this.tempLevel,this.tempLevelImage+this.temp+".png")
}
this.up = function()
{
if(this.temp<32)
{
this.temp++;
}
//sendLog("this.temp",this.temp)
this.setTemp(this.temp);
}
this.down = function()
{
if(this.temp>16)
{
this.temp--;
}
this.setTemp(this.temp);
}
this.setPower = function(vPower)
{
if(arguments.length>=1)
{
if(vPower ==1)
{
this.power = vPower;
sendIrName(this.port,this.powerOnCMD);
setImage(this.btnPower,this.btnPowerImageOn);
}
else
{
sendIrName(this.port,this.powerOffCMD);
setImage(this.btnPower,this.btnPowerImageOff);
}
}
else
{
if(this.power ==0)
{
this.power = 1;
sendIrName(this.port,this.powerOnCMD);
setImage(this.btnPower,this.btnPowerImageOn);
}
else
{
this.power = 0;
sendIrName(this.port,this.powerOffCMD);
setImage(this.btnPower,this.btnPowerImageOff);
}
}
}
this.delayPower =function(vSec,vPower)
{
if(arguments.length>=1)
{
if(vPower ==1)
{
this.power = vPower;
delayIrName(vSec,this.port,this.powerOnCMD);
setImage(this.btnPower,this.btnPowerImageOn);
}
else
{
delayIrName(vSec,this.port,this.powerOffCMD);
setImage(this.btnPower,this.btnPowerImageOff);
}
}
else
{
if(this.power ==0)
{
this.power = 1;
delayIrName(vSec,this.port,this.powerOnCMD);
setImage(this.btnPower,this.btnPowerImageOn);
}
else
{
this.power = 0;
delayIrName(vSec,this.port,this.powerOffCMD);
setImage(this.btnPower,this.btnPowerImageOff);
}
}
}
this.setMode = function(vMode)
{
this.mode = vMode;
sendIrName(this.port,this.irModeCMD[vMode]);
for(var i=0;i<this.btnModeName.length;i++)
{
setImage(this.btnModeName[i],this.modeImageOff[i])
}
setImage(this.btnModeName[vMode],this.modeImageOn[vMode])
this.power = 1;
setImage(this.btnPower,this.btnPowerImageOn);
}
this.delayMode = function(vSec,vMode)
{
this.mode = vMode;
delayIrName(vSec,this.port,this.irModeCMD[vMode]);
for(var i=0;i<this.btnModeName.length;i++)
{
setImage(this.btnModeName[i],this.modeImageOff[i])
}
setImage(this.btnModeName[vMode],this.modeImageOn[vMode])
this.power = 1;
setImage(this.btnPower,this.btnPowerImageOn);
}
}
|
|