[瑙﹀姩绮剧伒]瑙﹀姩绮剧伒瀹樻柟鎵嬪唽娴佹按璐?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[瑙﹀姩绮剧伒]瑙﹀姩绮剧伒瀹樻柟鎵嬪唽娴佹按璐?相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e8%87%aa%e5%8a%a8' title='鑷姩'>鑷姩   璁剧疆   鍏佽   style   limit   box   root   

瀹樻柟鎵嬪唽

http://www.touchsprite.com/helpdoc#/doc?id=2148


灏忕煡璇嗭細鎵嬪唽鐨勬煡璇㈠姛鑳?/p>

鎶€鏈浘鐗? width=

娉ㄦ剰 杩欓噷鑳界簿纭殑鏌ヨ瀵瑰簲鍑芥暟 浣嗘槸鏃犳硶妯$硦鏌ヨ 姣斿璁颁笉璧锋煇涓嚱鏁板悕 浣嗘槸璁板緱鍑芥暟鐨勮鏄庣殑鍑犱釜鍏抽敭瀛?nbsp; 杩欐牱鐨勬ā绯婃煡璇㈠苟涓嶆敮鎸?


瑙﹀姩绮剧伒鐨刲ua鐗堟湰鏄?.2.3

traceprint("lua鐗堟湰:[" .. tostring(_VERSION) .. "]")--  [init.lua]绗?0琛?nbsp; lua鐗堟湰:[Lua 5.2]


瑙﹀姩绮剧伒鐨勭紪鐮佹槸UTF8  涓€鏃﹁繍琛屾湡闂村嚭鐜颁贡鐮?寰堝彲鑳芥槸缂栫爜涓嶅鐨勯棶棰?/p>


閬嶅巻琛?/strong>鐨勬椂鍊欓『鎵嬪啓浜嗕竴涓?strong>鏄剧ず浠讳綍绫诲瀷鍙橀噺鐨勭被鍨?鍊?nbsp;  鐨勫嚱鏁?/strong>

--[[鍔熻兘:杈撳嚭鍙橀噺绫诲瀷鍊?鍖呭惈閬嶅巻琛?鍖呮嫭宓屽琛?--鍙傛暟 绗竴涓弬鏁板彲浠ユ槸浠讳綍绫诲瀷鍙橀噺 濡傛灉鏄痶able 绗簩涓弬鏁版槸璁剧疆琛ㄥ厓绱犵殑闂撮殧绗︾殑 涔熷彲浠ヤ笉鍐? --]]
function showInfo(t, tab)    
        return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?               
            local str = str or ""
            --print(type(t))
            --if not t then
            if type(t)~="table" then                
                --error("table is nil")
                return type(t) .. ":"  .. tostring(t)
            end
            tab = tab or "  "
            tab = tab .. "  "
            str = str .. "\n"

            if type(t) == "table" then
                for k, v in pairs(t) do
                    if type(k) == "number" then
                        str = str .. string.sub(tab, 2, string.len(tab)) .. "[" .. tostring(k) .. "]" .. " = "
                    else
                        str = str .. string.sub(tab, 2, string.len(tab)) .. "[\"" .. tostring(k) .. "\"]" .. " = "
                    end
                    if type(v) == "string" then
                        str = str .. "\"" .. v .. "\"" .. "\n"
                    elseif type(v) == "number" then
                        str = str .. tostring(v) .. "\n"
                    elseif type(v) == "boolean" then
                        str = str .. tostring(v) .. "\n"
                    elseif type(v) == "function" then
                        str = str .. tostring(v) .. "\n"
                    elseif type(v) == "thread" then
                        str = str .. "thread : " .. tostring(v) .. "\n"
                    elseif type(v) == "userdata" then
                        str = str .. "userdata : " .. tostring(v) .. "\n"
                    elseif type(v) == "table" then
                        str = str .. showInfo(v, tab) .. "\n"
                    else
                        str = str .. "unknow : " .. tostring(v) .. "\n"
                    end
                end
                str = str .. string.sub(tab, 2, string.len(tab) - 1) .. ""
            else
                str = t
            end
            return str
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("traversalTable") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
        
end


瓒婄嫳鍙?root 甯歌瘑 鐨勭‘寰堟湁鐢?/strong>

http://www.touchsprite.com/docs/5383


瑙﹀姩鐨勪笁娆捐蒋浠剁殑浼樺姡

鎶€鏈浘鐗? width=

涓変釜杞欢閮藉彲浠ュ疄鐜版垜浠殑鑴氭湰鍔熻兘 

灏忕簿鐏?鍏嶈垂鐨勪笉鏀寔缃戠粶鎻掍欢鍜岄珮绾ф墿灞曞簱 鏀惧純灏忕簿鐏?/strong>   鏀惰垂鐨勬瘡鏈?.5/鍙?/p>

瑙﹀姩浼佷笟鐗?nbsp; 鏀惰垂寰堣吹 鎸夊ぉ鏀惰垂 渚濈劧涓嶈€冭檻

瑙﹀姩绮剧伒app  瀹夊崜鍏嶈垂 IOS鏀惰垂 鎶婅剼鏈笂浼犲埌鎵嬫満涓婄洿鎺ヨ繍琛屽氨濂?鎴栬€呯敓鎴愪簩缁寸爜璁╂墜鏈烘壂鐮?nbsp; 闂鏄簮鐮佷篃鏈夋毚闇茬殑鍗遍櫓  鏆撮湶婧愮爜 浣嗘槸鍙互瀵规簮鐮佸姞瀵唗sp鏂囦欢 鍙兘鎺ㄨ崘杩欎釜浜?/p>

鎶€鏈浘鐗? width=


涓変釜杞欢鍦ㄥ姛鑳戒笂鍖哄埆

瑙﹀姩涓撲笟鐗?/strong>鍦ㄦ壒閲忔帶鍒跺氨鏄?strong>涓帶涓婂畼鏂瑰凡缁忔彁渚涗簡杩欐湇鍔?/strong> 鍏朵粬2涓病鏈?/p>

灏忕簿鐏靛厤璐圭増娌$綉缁滃嚱鏁板拰楂樼骇鎵╁睍搴?/strong> 寰堥毦鍙?/p>

杩樻槸閭d釜缁撹  渚濈劧鏄?strong>鐢ㄨЕ鍔ㄧ簿鐏礱pp鏉ヨ繍琛岃剼鏈?/strong>


瑙﹀姩绮剧伒 Android 浣跨敤鎵嬪唽锛堟帹鑽愪粩缁嗙湅鐪?寰堝浣跨敤缁嗚妭锛?/strong>

http://www.touchsprite.com/docs/4928 

瀹夎瑙﹀姩app

瑙﹀姩app鐨勮处鍙风櫥褰?鍥犱负杩愯tsp鑴氭湰蹇呴』鐧诲綍 lua鑴氭湰涓嶇敤

鎵捐剼鏈?nbsp; 瑙﹀姩鑴氭湰甯傚満鐨勪笅杞藉拰浣跨敤

瑙﹀姩app绔啓鑴氭湰 瑙﹀姩app宸︿笂鐐瑰紑 鏂板缓鑴氭湰

瑙﹀姩app褰曞埗鑴氭湰

tsp鑴氭湰鐨勭敓鎴愬拰涓婁紶      寮€鍙戣€呭钩鍙?-鏂板缓鑴氭湰---- 涓婁紶宸ョ▼鍘嬬缉鍖?nbsp; 璁颁綇鑴氭湰id ----鍦ㄨЕ鍔╝pp鐨勫彸涓婄涓€涓寜閽啓鍏ヨ剼鏈琲d 涓嬭浇鍗冲彲

鏇存柊鑴氭湰tsp  涓嶈繃杩樻槸鎺ㄨ崘鍒犻櫎鍐嶉噸鏂颁笅杞借剼鏈?nbsp; 灏辨槸鎸夐敭涓嬬殑鑷姩鏇存柊鑴氭湰

婵€娲昏剼鏈?nbsp; 鏀惰垂鑴氭湰鎵嶄細閬囧埌

瀹氭椂鑴氭湰鍜屽紑鏈哄惎鍔?/strong>鑴氭湰

鎺堟潈鐩稿叧

瑙﹀姩app 鎻掍欢 璁惧淇℃伅 鏃ュ織浣嶇疆绛夌瓑


瑙﹀姩绮剧伒 IOS浣跨敤鎵嬪唽

http://www.touchsprite.com/docs/4875


缁熻鏌愪釜鍖哄煙鐨勬寚瀹氶鑹叉暟閲?鐪嬪埌getColor鍑芥暟   鑾峰彇鏌愪釜鍧愭爣鐨勯鑹叉暟鍊?鎯宠捣鎸夐敭鏈変釜缁熻鏌愪釜鍖哄煙鐨勬寚瀹氶鑹叉暟閲?/strong> 杩欎釜鍑芥暟杩樻槸寰堟湁鐢ㄧ殑 椤烘墜鍐欎簡 涓嶈繃浠庢晥鐜囦笂鐪嬪緢涓€鑸?缁熻鍗婁釜灞忓箷鐨勭鍚堢殑棰滆壊鏁伴噺澶х害1-2绉?nbsp; 鏈夌偣鎱?鐩墠灏辩敤杩欎釜鍑戝悎鎶?/p>

--[[
鑾峰彇涓€瀹氬尯鍩熷唴 鍜屾寚瀹氶鑹茬浉浼肩殑棰滆壊鐐圭殑鏁伴噺
sim娉ㄦ剰鎸夌収瑙﹀姩鐨勪範鎯潵鎶?80 90 鑰屼笉鏄?.8 .09
colorStr 鏄崄鍏繘鍒剁殑棰滆壊鏁板€?涓嶈繃涔熷彲浠ユ槸棰滆壊瀛楃涓?getColorNum(5,164,347,479,0x00b98c,9
--]]
function getColorNum(x1,y1,x2,y2,colorStr,sim)
    return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=0
            local tempColor
            local tempPercent
            keepScreen(true);
            for y=y1,y2 do
                for x=x1,x2 do
                    tempColor=getColor(x, y)
                    if tempColor>=tonumber(colorStr) then
                        tempPercent=tonumber(colorStr)/tempColor
                    else
                        tempPercent=tempColor/tonumber(colorStr)
                    end
                    if tempPercent*100>tonumber(sim) then
                        result=result+1
                    end    
                    --mSleep(1)
                end                
            end
            keepScreen(false); 
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("getColorNum") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
        
end


鍙戠幇鎴戣嚜宸卞皝瑁呯殑traceprint 鏄剧ず褰撳墠鏂囦欢鍚嶅拰琛屽彿 鍦ㄥ疄闄呭彂甯冧綅TSP鏂囦欢鍚?鍙戠幇debug搴撳氨鏃犳晥浜?閭d箞杈撳嚭褰撳墠鏂囦欢鍚嶅拰琛屽彿涔熸槸绌轰簡

濡傛灉鍙樻垚浜員SP鏂囦欢 閭d箞灏变笉鏄剧ず鏂囦欢鍚嶅拰琛屽彿浜?鍥犱负鏃犳硶鑾峰彇鍒颁簡 traceprint涔熻鍙樺姩涓€涓?/p>

config=
----鏃ュ織鐩稿叧(鏆傛椂涓嶈€冭檻澶氭棩蹇楀苟瀛樼殑鎯呭喌)
config["isLog"]=true--鏄惁寮€鍚棩蹇楄緭鍑哄拰鏃ュ織鏂囦欢
config["logFileName"]=tostring(config["scriptName"]) .. tostring(os.date("%Y%m%d%H%M%S",os.time())) --鍙槸褰撳墠鏃ュ織鏂囦欢鍚嶅瓧涓嶆槸瀹屾暣璺緞骞存湀鏃ユ椂鍒嗙 濡俋XXX20190816112336 鍔犱簡涓墠缂€
config["logMode"]=0--0琛ㄧず鍐欏叆鏈湴鏃ュ織鏂囦欢--1 - 鐢熸垚 1 涓互鏃堕棿鎴冲懡鍚嶇殑鍚庣紑涓?.log 鐨勬枃浠跺埌 log 鏂囦欢澶逛笅 2 - 寮傛鍙戦€佸埌鏈嶅姟鍣紙鏀寔寮曟搸 v1.7.0 鍙?android v2.4.1 浠ヤ笂鐗堟湰锛? - 鍚屾鍙戦€佸埌鏈嶅姟鍣紙浠呮敮鎸佽Е鍔ㄧ簿鐏?ios v1.7.0 鍙婁互涓婄増鏈級
-----鏄惁寮€鍚棩蹇楄鍙峰拰鏂囦欢鍚嶆樉绀?涓嶉渶瑕佽缃級 娉ㄦ剰 杩欎釜鍙槸鍐嶈皟璇曠姸鎬佷笅鎵嶈兘鍑虹幇 姝e紡鑴氭湰涓媎ebug搴撴槸鏃犳晥鐨? 濡傛灉debug搴撻噷闈㈢殑鏂囦欢鍚嶉噷闈㈡病鎵惧埌.lua 鑷劧褰撳墠debug搴撴槸鏃犳晥鐨?閭d箞鏃ュ織杈撳嚭灏变笉瑕佸甫琛屽彿鍜屾枃浠跺悕
config["isAddLineAndFilename"]=(string.find(tostring(debug.getinfo(1).source),".lua") and true or false)[1]


--杈撳嚭鏃ュ織淇℃伅鍒版棩蹇楃獥鍙e拰鏃ュ織鏂囦欢 鏃ュ織鏂囦欢鐨勮緭鍑鸿繕鏈夋槸鍚︽湁琛屽彿鍜屾枃浠跺悕鐢遍厤缃〃鎺у埗 
function traceprint(str)
    local info 
    local tempStr=""
    if config["isAddLineAndFilename"] then--鏄笉鏄浜庤皟璇曟ā寮?/span>
        info = debug.getinfo(2)
        tempStr="[" .. tostring(info["source"]) .. "]" .. "绗?/span>" .. tostring(info["currentline"]) .. "琛? " .. tostring(str)
    else
        tempStr=tostring(str)
    end
    if config["isLog"] then
        wLog(config["logFileName"], tostring(tempStr))
    end
    nLog(tempStr)
    mSleep(5)--涓轰簡nLog鐨勬樉绀洪『搴忕殑鏆傛椂瑙e喅鍔炴硶
end


鎴浘鍑芥暟 鍙互鍗曠嫭鎴浘涓€寮?涔熷彲浠ュ湪瑙勫畾鏃堕棿鍐呰繛缁埅鍥惧寮?鎴浘涓€娆″ぇ绾﹀崰鐢?.4绉掓椂闂?绗簲涓弬鏁拌缃釜鎴浘鏃堕棿鍗冲彲 杩欎釜鏃堕棿鍐呭敖閲忓鐨勬埅鍥?nbsp; 鍥犱负瑙﹀姩娌℃湁杩炵画鎴浘鐨勫姛鑳?鍙兘鐢ㄨ繖涓嚱鏁版潵浠f浛

--[[
鎴浘宸ュ叿 
picname鍙渶瑕佹枃浠跺悕鍗冲彲 榛樿鏀惧埌瑙﹀姩鐨勮祫婧愭枃浠跺す涓?鏂囦欢鍚嶆槸褰撳墠鏃ユ湡鏃堕棿涓哄悕
x1, y1, x2, y2 娌′粈涔堣鐨?鏈€鍚?涓弬鏁?閮芥槸鐢ㄤ簬鐭椂闂村唴杩炵画鎴鍥?绗竴涓弬鏁版槸闄愬畾鐨勬椂闂? 绗簩涓弬鏁版槸鍦ㄨ繖涓檺瀹氭椂闂村唴鎴灏戝浘
鏀寔 闇€瑕乼s搴撶敓鎴愭椂闂存埑
缁忚繃瀹為檯娴嬭瘯 鎴浘鍑芥暟鏈韩闇€瑕?.4绉掑乏鍙崇殑鏃堕棿娑堣€? 鎵€浠ヤ笉璁剧疆鎴浘鍑犲紶浜?鍙缃埅鍥剧殑闄愬埗鏃堕棿灏辫
绀轰緥 snapshotEx(0,0,config["width"]-1,config["height"]-1)--鎴竴鍥?snapshotEx(0,0,config["width"]-1,config["height"]-1,3)--3绉掑唴灏藉彲鑳藉鐨勬埅鍥?--]]
function snapshotEx(x1, y1, x2, y2,...)
    local args=...
    return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime
            local tempPath=userPath() .. "/res/"
            local tempTime  local tempFileName local tempTable
            local tempStartTime
            local tempDelay
            local tempStr="鎴浘缁撴灉:" .. tempPath .. " ["
            if args[1]==nil then
                --琛ㄧず姝e父鎴浘鍗冲彲
                tempTime=ts.ms()
                tempTable=strSplit(tostring(tempTime),".")
                tempFileName=os.date("%Y%m%d%H%M%S",time) ..tostring(tempTable[2]) .. ".png"
                snapshot(tempPath .. tempFileName, x1, y1, x2, y2)
                tempStr=tempStr .. tempFileName .. "]"
                traceprint(tempStr)
            else
                --闇€瑕佽繛缁埅鍥句簡
                if type(args[1])=="number" then
                    --args[2]=(tonumber(args[2]) and tonumber(args[2]) or 5)[1]                       
                    startTime=os.clock()
                    --tempDelay=math.floor(tonumber(args[1])*1000/tonumber(args[2]))
                    while ((os.clock()-startTime)<args[1]) do
                        tempTime=ts.ms()
                        tempTable=strSplit(tostring(tempTime),".")
                        tempFileName=os.date("%Y%m%d%H%M%S",tempTime) .. tempTable[2] .. ".png"
                        snapshot(tempPath .. tempFileName, x1, y1, x2, y2)
                        tempStr=tempStr .. " " .. tempFileName                        
                    end
                    tempStr=tempStr .. "]"
                    traceprint(tempStr)
                else
                    --杩炵画鎴浘鍙傛暟涓嶅悎娉?灏变笉杩炵画鎴浘浜?灏卞崟鎴浘浜?/span>
                    tempTime=ts.ms()
                    tempTable=strSplit(tostring(tempTime),".")
                    tempFileName=os.date("%Y%m%d%H%M%S",time) .. tempTable1[2] .. ".png"
                    snapshot(tempPath .. tempFileName, x1, y1, x2, y2)
                    tempStr=tempStr .. tempFileName .. "]"
                    traceprint(tempStr)
                end
            end
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("snapshotEx") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
        
end


utf8搴撶殑鐩稿叧鍑芥暟

http://www.mytju.com/classcode/tools/encode_utf8.asp  utf8缂栫爜鍜屽瓧绗︾殑杞寲

utf8.char(35302,21160,58,31934,28789) ===銆嬭Е鍔?绮剧伒 鍏蜂綋瀵瑰簲鍘讳笂闈㈢綉鍧€鏌ヨ

鍏蜂綋鐨勮祫鏂欐病鎵惧埌澶氬皯  涓嶈繃搴撳唴鐨勫嚱鏁颁篃寰堝皯鐨?/p>


tsp/p4u 鏄Е鍔?甯綘鐜╁紑鍙戣€呭钩鍙板湪寮€鍙戣€呬笂浼犺剼鏈帇缂╁寘鏃跺皢鑴氭湰鍦ㄧ嚎鍔犲瘑鐢熸垚鐨勮剼鏈牸寮?/strong>


checkScriptAuth 鑴氭湰绫诲瀷鍜屾巿鏉?/strong>

鏈夌偣鎰忔€?鍙互鍒ゆ柇褰撳墠鑴氭湰鏄粈涔堢被鍨嬬殑 鏄姞瀵嗗悗鐨則sp/p4u 杩樻槸 lua婧愮爜 checkScriptAuth().type

涔熷彲浠ヨ幏寰楄剼鏈琲d  checkScriptAuth().id  娌″啀寮€鍙戣€呭钩鍙扮敓鎴愯剼鏈殑 灏辨病鏈夎繖涓?榛樿-1

鎴栬€呭綋鍓嶈剼鏈槸鍚︽巿鏉?


浠旂粏鐪嬩簡涓€涓媑etNetTime()鍑芥暟  杩欎釜鍑芥暟濡傛灉澶辫触杩斿洖0 杩欎釜鎯呭喌娌℃敞鎰忓埌

閭d箞鎴戜滑鍘熸潵鐨勫垽鏂埌鏈熸椂闂村嚱鏁板氨闇€瑕侀澶栫殑璋冩暣涓€涓?鍔?琛屼唬鐮佸嵆鍙?濡傛灉涓嶅姞 涓囦竴鏂綉鐘舵€佷笅 杩欎釜getNetTime鍑芥暟杩斿洖0 灏辨槸1970骞?璁や负褰撳墠鏃堕棿鏄?970骞?閭d箞鑴氭湰鑲畾涓嶄細杩囨湡浜?/strong>

--鑴氭湰鏄惁杩囨湡鍒ゆ柇 璁剧疆杩囨湡鏃堕棿鍦ㄩ厤缃〃鐨刢onfig["expireTime"]閲岄潰璁剧疆 鏍煎紡鏄?2019-10-02 12:30:12"鎴栬€呰〃2019,10,2,12,30,12 寮€鍚垽鏂槸 config["isExpireTime"] =true
--杩斿洖鍊兼病鏈?杩囨湡浜嗗氨寮瑰嚭绐楀彛鐒跺悗鍋滄鑴氭湰
function isExpireTime()
    return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?           
            local result=-1
            local nowTime
            local expireTime
            nowTime=getNetTime()
            if nowTime==0 then  
                error("鏃犳硶鑾峰彇鍒扮綉缁滄椂闂?璇锋鏌?)
            end
            
            expireTime=dataToTimeStamp(config["expireTime"])
            if nowTime>expireTime then
                --杩囨湡浜?                   
                result=1
                traceprint("鑴氭湰杩囨湡浜?璇锋鏌?/span>")
                dialog("鑴氭湰杩囨湡浜?璇锋鏌?/span>", 0)
                lua_exit()
            else
                --鍦ㄨ瘯鐢ㄦ湡鍐?/span>
                result=-1
                traceprint("鍦ㄨ瘯鐢ㄦ湡鍐?鍒版湡鏃堕棿[".. tostring(config["expireTime"])  .. "]")
            end        
            --return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("isExpireTime") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
        
end


inputText鐨勪娇鐢?/strong>

鍥犱负瑙﹀姩娌℃湁鎻愪緵绫讳技鎸夐敭鐨刱eypress鍑芥暟 鎴戜滑瑕?strong>瀹炵幇鐐瑰嚮del閿?/strong>

for i=1,15 do  --鐐瑰嚮15涓媎el閿?鍒犻櫎杈撳叆妗嗗唴鐨勫唴瀹?br>     inputText("\b")
     mSleep(10)
end

瀹炵幇娓呯悊鏂囨湰妗嗗唴瀹归敭

--娓呯悊杈撳叆妗嗙殑鍐呭 鍓嶆彁鏄綋鍓嶅厜鏍囧凡缁忓浜庤緭鍏ユ鐨勫熬閮ㄤ簡
--鍙傛暟涓嶅啓 榛樿鍒犻櫎15涓? 鍐欎簡灏辨寜鐓у弬鏁版暟閲忓垹闄?/span>
function clearInputBox(delNum)    
    return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?   
            delNum=tonumber(delNum) or 15--涓嶅啓灏辨槸榛樿鍒犻櫎15涓?/span>
            for i=1,delNum do
                inputText("\b")
                mSleep(10)
            end
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("clearInputBox") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
    
end


浜嗚В涓?nbsp;

isFrontApp 鍒ゆ柇鍓嶅彴搴旂敤    

frontAppBid 鑾峰彇鍓嶅彴搴旂敤   

appBundlePath 鑾峰彇搴旂敤瀹夎璺緞 

openURL 鎵撳紑缃戠粶鍦板潃   杩欎釜鎴戣寰楁寜閿殑灞辨捣甯堟彃浠舵湁鍏朵粬鐨勬祻瑙堝櫒鐨勬敮鎸?鍙互鍘荤湅涓?绱尗鎻掍欢鐨勪篃鏈夌被浼肩殑鍔熻兘

鍏跺疄鏈川灏辨槸鐢╫s.execute鎵ц绯荤粺鍛戒护 涓嬮潰鏄北娴峰笀瀵瑰簲鐨勫懡浠ゆ簮鐮?/strong>

function QMPlugin.OpenWeb(url)
     sh_init()
     if url:find(":") == nil then url = "http://"..url end
     os.execute(string.format("am start -a android.intent.action.VIEW -d "..url))
end


灏忕煡璇?鎸夐敭绮剧伒涓嬬殑灞辨捣甯堟彃浠?涓烘垜浠彁渚涗簡寰堝宸茬粡鍐欏ソ鐨刲ua鍑芥暟  鎰熻阿灞辨捣甯堣€佸笀 鏁翠釜鎻掍欢閮芥槸寮€婧愮殑 鏈夊緢楂樼殑鍙傝€冧环鍊?/strong>


椤烘墜鎶?鍙栨枃鏈腑闂?鍑芥暟鍐欎簡涓?/p>

--鍙栧墠鍚庝袱涓瓧绗︿覆涔嬮棿鐨勫唴瀹?灏辨槸鏄撹瑷€鐨勫彇鏂囨湰涓棿鍑芥暟
--杩斿洖鍊?娌′笢瑗胯繑鍥瀗il 鍙堢鍚堣姹傜殑杩斿洖瀵瑰簲瀛楃涓?/span>
--娉ㄦ剰鐨勬槸鍓嶇紑鍚庣紑閲岄潰濡傛灉澶规潅鐫€姝e垯鐨勫厓瀛楃 闇€瑕佽浆涔?涓嶇劧鑾峰彇鐨勭粨鏋滃氨鏈夎 --杩樻湁娉ㄦ剰澶勭悊鐨勫瓧绗︿覆濡傛灉鍑虹幇澶氫釜鍓嶇紑鍚庣紑 閭d箞鍙兘鍙栧埌绗竴涓鍚堣姹傜殑
function getTextCenterStr(str,prefixStr,suffixStr)    
    return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?   
            local result=""
            local tempTable
            str=tostring(str)  prefixStr=tostring(prefixStr)  suffixStr=tostring(suffixStr)
            tempTable=string.match(str,prefixStr .. "(.-)" .. suffixStr)
            result=tempTable
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("getTextCenterStr") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
    
end


浜嗚В涓?/p>

getDeviceType 鑾峰彇璁惧绫诲瀷 鏄湡鐨勬墜鏈?杩樻槸妯℃嫙鍣?杩樻槸鑻规灉

getDeviceID 鑾峰彇瑙﹀姩绮剧伒璁惧鍙?nbsp;  浠h〃褰撳墠璁惧鐨勫敮涓€鎬?/strong>

getMemoryInfo 鑾峰彇璁惧鍐呭瓨淇℃伅  涓昏鐢ㄦ潵鍒ゆ柇褰撳墠鐨勫唴瀛樺崰鐢ㄦ儏鍐?鍗犵敤澶ぇ鍒欐竻鐞嗕笅鍐呭瓨

getTSVer銆乬etOSVer 鑾峰彇寮曟搸鐗堟湰鍙枫€佽幏鍙栫郴缁熺増鏈彿  鑾峰彇瑙﹀姩鐗堟湰鍜屽綋鍓嶆墜鏈虹郴缁熺増鏈?鍥犱负瑙﹀姩寰堝鍑芥暟瀵圭郴缁熺増鏈垨鑰呰Е鍔ㄧ増鏈湁瑕佹眰

getOSType 鑾峰彇璁惧绯荤粺  鏄畨鍗撹繕鏄疘OS



浜嗚В涓?/p>

vibrator 鎵嬫満鎸姩

for var = 1,5 do
     vibrator();                --鎸姩
     mSleep(1000);            --寤惰繜 1 绉?br> end

鎾斁闊抽锛?/p>

playAudio 鎾斁闊抽  stopAudio 鍋滄鎾斁  鎾斁闊抽涔嬬被鐨?涓€鑸父鐢ㄤ簬鎻愰啋鐢ㄦ埛 鑴氭湰鍑虹幇浜嗛棶棰?鎴栬€呰剼鏈揩缁撴潫浜?鎴栬€呭叾浠栨彁閱?/p>

娉ㄦ剰 mp3鏂囦欢浠庣紪杈戝櫒涓婁紶鍒版墜鏈?鍙戦€侀兘鏄け璐?涓嶆槑鎵€浠?鍙兘鏁翠釜宸ョ▼鎵撳寘涓婁紶鎵嶅彲浠?涓嶆竻妤氭槸鏂囦欢澶ぇ涓嶈鍗曠嫭涓婁紶杩樻槸鏂囦欢鏍煎紡涓嶅厑璁镐笂浼?/strong>

--鎾斁闊充箰
--鍙傛暟 绗竴涓闊抽鐨勫畬鏁磋矾寰?涓€鑸槸鍦?config["userPath"] 鏂囦欢澶归噷闈?绗簩涓弬鏁板崟浣嶆槸绉?涓嶅啓榛樿10绉?/span>
--鏀寔 閰嶇疆琛?config["systype"] 鑾峰彇鏄畨鍗撹繕鏄疘OS
function playSound(videoPath,limitTime)    
    return try
        function ()            
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?   
            limitTime=tonumber(limitTime) or 10
            
            if fileExist(videoPath)==false then
             error("[" .. tostring(videoPath) .. "] 鏃犳硶鎵惧埌瀵瑰簲鏂囦欢 璇锋鏌?/span>")
            end
            
            if config["systype"]=="android" then 
                playAudio(videoPath);    --鎾斁 test.mp3
                mSleep(limitTime*1000)
                stopAudio(); --鍋滄鎾斁
            else
                playAudio(videoPath);    --鎾斁 test.mp3
                mSleep(limitTime*1000)
                playAudio(""); --iOS 鍋滄鎾斁锛孉ndroid 鍙傝€?stopAudio 鍑芥暟
            end
            
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                local tempStr=""
                tempStr="鍑芥暟[" .. tostring("playSound") .. "] 閿欒淇℃伅锛?/span>".. tostring(errors)
                traceprint(tempStr)
                dialog(tempStr, 3)
            end            
        
    
end




123

以上是关于[瑙﹀姩绮剧伒]瑙﹀姩绮剧伒瀹樻柟鎵嬪唽娴佹按璐?的主要内容,如果未能解决你的问题,请参考以下文章

2020骞存帹鑽愮郴缁熷伐绋嬪笀鐐间腹鎵嬪唽

RabbitMQ瀹樻柟鏁欑▼浜?Work Queues(GOLANG璇█瀹炵幇)

2020闃块噷宸村反瀹樻柟鏈€鏂癛edis寮€鍙戣鑼冿紒

Apache瑙f瀽婕忔礊

laravel-admin 闆嗘垚wangEditor,鎸夌収瀹樻柟鏂囨。鍘绘悶锛屼絾鏄笉鏄剧ず鍟婏紝鏄剧ず Error Field type [editor] does not exist.

Failed to connect to raw.githubusercontent.com port 443 瑙e喅鏂规

(c)2006-2024 SYSTEM All Rights Reserved IT常识