function InputLaserCode(num)
    if Params_h.LASER_TMP_CODE[2]> 999 then
        --防止寄存器输入数据溢出
        return
    end
    if Params_h.LASER_EDIT_CODE[2]==1 then
        local str = string.format('%.0f%.0f',Params_h.LASER_TMP_CODE[2],num)--字符串拼接法
        Params_h.LASER_TMP_CODE[2] = tonumber(str)
    else
        Params_h.LASER_TMP_CODE[2] = 0
    end
end

function CheckInputLaserCode()
    if Params_h.LASER_EDIT_CODE[2]==1 then
        if Params_h.LASER_TMP_CODE[2] > 0 and Params_h.LASER_TMP_CODE[2] < 100 then
            Params_h.LASER_CODE[2] = Params_h.LASER_TMP_CODE[2]
            Params_h.LASER_EDIT_CODE[2] = 0
            Params_h.LASER_TMP_CODE[2] = 0
        else
            --错误频道
            Params_h.LASER_TMP_CODE[2] = 0
            Params_h.LASER_ERR_CODE[2] = 1
        end
    else
        Params_h.LASER_TMP_CODE[2] = 0
    end
end

function SetCommandCombat(cmd,val)
    if cmd > UFCP_click_cmd.key0_up-1 and cmd < UFCP_click_cmd.key9_dn + 1 then
        local num = math.floor((cmd - UFCP_click_cmd.key0_up)*0.5)
        if Params_h.LASER_EDIT_CODE[2]==1 then
            InputLaserCode(num)
        end
    elseif cmd == UFCP_click_cmd.Enter_dn then
        if Params_h.LASER_EDIT_CODE[2]==1 then
            CheckInputLaserCode()
        end
    elseif cmd == UFCP_click_cmd.Clear_dn then
        Params_h.LASER_TMP_CODE[2] = 0
        Params_h.LASER_ERR_CODE[2] = 0
    end
end

function HandleL1Combat()
    --Params_h.IFF_STATUS[2] = 1 - Params_h.IFF_STATUS[2]	
end

function HandleR1Combat()

end

function HandleL2Combat()
    --local old = Params_h.NCTR_STATUS[2] or 0
    --local new = 1 - old
    --Params_h.NCTR_STATUS[2] = new
    --Log_and_print(string.format("[NCTR] set from combat.lua HandleL2Combat: %d -> %d", old, new))
end

function HandleR2Combat()

end

function HandleL3Combat()
    if Params_h.LASER_EDIT_CODE[2] == 1 then
        Params_h.LASER_EDIT_CODE[2] = 0--结束激光编码编辑模式
        Params_h.LASER_TMP_CODE[2] = 0--清空寄存器激光编码
        Params_h.LASER_ERR_CODE[2] = 0--隐藏错误激光编码提示
    elseif Params_h.LASER_EDIT_CODE[2] == 0 then
        Params_h.LASER_EDIT_CODE[2] = 1--开启激光编码编辑模式
    end
end

function HandleR3Combat()

end

function HandleL4Combat()

end

function HandleR4Combat()

end