--默认值可以不传
local ConfigHelpers = {}

--设置物体高亮  target:设置对象   isLigth:是否高亮   seeThrough:是否穿透(默认为true,穿透) startColor:高亮开始颜色(默认初始化)  endColor:高亮结束颜色(默认初始化)  flashingFrequency:闪烁频率(默认为2)  flashingDelay:闪烁延迟(默认为0) nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetHeightLight( target , isLight , seeThrough , startColor , endColor , flashingFrequency , flashingDelay  , nextConfigIdList )
    local target = ConfigHelpers.FindGameObject(target)
    if target then
        flashingFrequency = flashingFrequency or 0.5
        flashingDelay = flashingDelay
        seeThrough = (seeThrough == ]
        startColor = startColor or Color.green
        endColor = endColor or Color.red
        GameUtils.SetHeightLight( target , isLight, seeThrough, startColor , endColor , flashingFrequency , flashingDelay )
        local shla = target:GetComponent("SyncHighLightAction")
        if shla == nil then
            shla = target:AddComponent(typeof(SyncHighLightAction))
        end
        shla:UpdateStatus(isLight, seeThrough , startColor , endColor , flashingFrequency , flashingDelay)
        if nextConfigIdList then
            ConfigHelpers.ExecIdList(nextConfigIdList)
        end
    end
end

--播放动画  target:设置对象  clipName:动画名称  nextConfigIdList:完成过后要执行的id集合  speed:速度(默认为1)   normalizedTime:动画从哪播放(默认为0,从头开始播放)
function ConfigHelpers.PlayAnimation( target , clipName , nextConfigIdList , speed , normalizedTime )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local anima = target:GetComponent('Animation')
            if anima then
                local saa = target:GetComponent("SyncAnimationAction")
                if saa == nil then
                    saa = target:AddComponent(typeof(SyncAnimationAction))
                end
                speed = speed
                normalizedTime = normalizedTime
                local clip = anima:GetClip(clipName)
                if clip then
                    anima.clip = clip
                    local tClip = anima:get_Item(clipName)
                    tClip.speed = speed
                    tClip.normalizedTime = normalizedTime
                    anima:Play()
                    saa:SendMsgToServer()
                    if nextConfigIdList then
                        local allTime = anima.clip.length / math.abs(speed)
                        GameUtils.StartCoroutineDelaySec(function ( ... )
                            ConfigHelpers.ExecIdList(nextConfigIdList)
                        end,allTime)
                    end
                else
                    Print_t('<color=red>发生错误:</color>找不到动画对象='..clipName)
                end
            end
        end
    end
end

--播放动画  target:设置对象  clipName:动画名称  nextConfigIdList:完成过后要执行的id集合  speed:速度(默认为1)   normalizedTime:动画从哪播放(默认为0,从头开始播放)
function ConfigHelpers.PlayAnimator( target , clipName , layer , speed , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local anima = target:GetComponent('Animator')
            if anima then
                local saa = target:GetComponent("SyncAnimatorAction")
                if saa == nil then
                    target:AddComponent(typeof(SyncAnimatorAction))
                end
                speed = speed
                if clipName then
                    anima:Play(clipName,layer)
                    anima.speed = speed
                    if nextConfigIdList then
                        local allTime = anima:GetCurrentAnimatorStateInfo(layer).length / math.abs(speed)
                        GameUtils.StartCoroutineDelaySec(function ( ... )
                            ConfigHelpers.ExecIdList(nextConfigIdList)
                        end,allTime)
                    end
                else
                    Print_t('<color=red>发生错误:</color>找不到动画对象='..clipName)
                end
            end
        end
    end
end

--延迟几秒执行     sec:延迟秒数    nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.DelaySec( sec , nextConfigIdList )
    GameUtils.StartCoroutineDelaySec(function ( ... )
        if nextConfigIdList then
            ConfigHelpers.ExecIdList(nextConfigIdList)
        end
    end,sec)
end

--播放声音  audioName:音频名称   delaySec:延迟几秒播放(默认为0)  nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.PlayAudio( audioName , delaySec , nextConfigIdList )
    local audioLibrary = AudioLibrary.instance
    local audioClip = audioLibrary:GetAudioClip(audioName)
    if audioClip then
        delaySec = delaySec
        AudioSourceGlobal.clip = audioClip
        AudioSourceGlobal:PlayDelayed(delaySec)
        audioLibrary:SendSyncAudio(audioName,delaySec)
        if nextConfigIdList then
            GameUtils.StartCoroutineDelaySec(function ( ... )
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end,delaySec + audioClip.length)
        end
    else
        Print_t('<color=red>发生错误:</color>找不到音频对象='..audioName)
    end
end

--关闭音频播放   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.CloseAudio( nextConfigIdList )
    AudioSourceGlobal:Stop()
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--设置组件状态  target:设置对象  enabled:是否关闭   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetComponentEnabled( target , componentName , enabled , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local component = target:GetComponent(componentName)
            if component then
                component.enabled = enabled
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            else
                Print_t('<color=red>发生错误:</color>找不到组件对象='..clipName)
            end
        end
    end
end

--开始计时    nextConfigIdList:完成过后要执行的id集合
local isEndTime = false

function ConfigHelpers.StartTime( nextConfigIdList )
    tempTime =
    isEndTime = false
    GameUtils.StartCoroutineWaitUntil(function (  )
        tempTime = tempTime + Time.deltaTime
        return isEndTime
    end)
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--计时结束      nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.EndTime( target , nextConfigIdList )
    isEndTime = true
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local textObj = target:GetComponent('Text')
            if textObj then
                textObj.text = ConfigHelpers.FormatSecond(tempTime)
                local sta = target:GetComponent("SyncTextAction")
                if sta == nil then
                    target:AddComponent(typeof(SyncTextAction))
                end
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            end
        end
    end
end

--初始化总分    nextConfigIdList:完成过后要执行的id集合

function ConfigHelpers.InitScore( score , nextConfigIdList )
    allScore = score
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--更新分数     nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.UpdateScore( value , nextConfigIdList )
    allScore = allScore + value
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--获取分数并显示      nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.GetScore( nextConfigIdList )
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
    return allScore
end

--计时器  target:设置对象    direction:(1为正计时,-1为倒计时) startCount:起始点  endCount:目标点  nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.Timer( target , direction , startCount , endCount , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local textObj = target:GetComponent('Text')
            if textObj then
                GameUtils.StartCoroutineWaitUntil(function (  )
                     then
                        startCount = startCount + Time.deltaTime
                        if startCount >= endCount then
                            if nextConfigIdList then
                                ConfigHelpers.ExecIdList(nextConfigIdList)
                            end
                            Print_t('正计时结束')
                        end
                        textObj.text = tostring(math.floor(startCount))
                    else
                        startCount = startCount - Time.deltaTime
                        if startCount <= endCount then
                            if nextConfigIdList then
                                ConfigHelpers.ExecIdList(nextConfigIdList)
                            end
                            Print_t('倒计时结束')
                        end
                        textObj.text = tostring(math.ceil(startCount))
                    end
                    local sta = target:GetComponent("SyncTextAction")
                    if sta == nil then
                        target:AddComponent(typeof(SyncTextAction))
                    end
                     ]
                    return result
                end)
            end
        end
    end
end

--淡入淡出  finishNextConfigIdList:淡出后要执行的id集合    stayNextConfigIdList:黑屏时要执行的集合   fadeInTime:淡入花费时间   stayTime:黑屏花费时间  fadeOutTime:弹出花费时间
function ConfigHelpers.FadeInOut( finishNextConfigIdList , stayNextConfigIdList , fadeInTime , stayTime , fadeOutTime )
    fadeInTime = fadeInTime or 1.5
    stayTime = stayTime or 0.5
    fadeOutTime = fadeOutTime or 1.5
    GameUtils.FadeInOut(BlackBgGlobal,fadeInTime,stayTime,fadeOutTime,function ( ... )
        if finishNextConfigIdList then
            ConfigHelpers.ExecIdList(finishNextConfigIdList)
        end
    end,function ( ... )
        if stayNextConfigIdList then
            ConfigHelpers.ExecIdList(stayNextConfigIdList)
        end
    end)
end

--设置对象激活状态   target:设置对象   isActive:是否激活    nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetGameObjectActive( target , isActive , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local saa = target:GetComponent("SyncActiveAction")
            if saa == nil then
                target:AddComponent(typeof(SyncActiveAction))
            end
            target.gameObject:SetActive(isActive)
            if nextConfigIdList then
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end
        end
    end
end

--设置对象旋转   target:设置对象   isLocal:是否本地坐标旋转  time:旋转所需时间    nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.Rotation( target , isLocal , time , rx , ry , rz , nextConfigIdList )
     if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local tween
            if isLocal then
                tween = target.transform:DOLocalRotate(Vector3(rx, ry, rz), time):SetEase(Ease.Linear)
            else
                tween = target.transform:DORotate(Vector3(rx, ry, rz), time):SetEase(Ease.Linear)
            end
            local sta = target:GetComponent("SyncTransformAction")
            if sta == nil then
                target:AddComponent(typeof(SyncTransformAction))
            end
            tween:OnComplete(function ( ... )
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            end)
        end
    end
end

--设置对象缩放   target:设置对象   time:缩放所需时间    nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.Scale( target , time , sx , sy , sz , nextConfigIdList )
     if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local tween
            tween = target.transform:DOScale(Vector3(sx, sy, sz), time):SetEase(Ease.Linear)
            local sta = target:GetComponent("SyncTransformAction")
            if sta == nil then
                target:AddComponent(typeof(SyncTransformAction))
            end
            tween:OnComplete(function ( ... )
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            end)
        end
    end
end

--设置主角位置  target:设置对象   px:x值   py:y值   pz:z值   lookTarget:面对的对象   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetPlayerTransform( px , py , pz , lookTarget , nextConfigIdList )
    local target = ConfigHelpers.FindGameObject(lookTarget)
    GameUtils.SetPlayerTransform(px,py,pz,target and target.transform or nil)
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--设置文本内容  target:设置对象   content:内容    nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetText( target , content , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local text = target:GetComponent('Text')
            if text then
                local sta = target:GetComponent("SyncTextAction")
                if sta == nil then
                    target:AddComponent(typeof(SyncTextAction))
                end
                text.text = tostring(content)
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            end
        end
    end
end

--移动位置   target:设置对象   isLocal:是否是本地坐标   time:移动所需时间  nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.MoveToTarget( target , isLocal , px , py , pz , rx , ry , rz , time , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            rx = rx
            ry = ry
            rz = rz
            local sta = target:GetComponent("SyncTransformAction")
            if sta == nil then
                target:AddComponent(typeof(SyncTransformAction))
            end
            GameUtils.MoveToTarget(target,isLocal,px,py,pz,rx,ry,rz ,time,function ( ... )
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            end)
        end
    end
end

local dataLibrary = {}
--设置数据   dataName:数据名称   dataValue:数据的值   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetData( dataName , dataValue , nextConfigIdList )
    dataLibrary[dataName] = dataValue
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--获取数据   dataName:数据名称   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.GetData( dataName , nextConfigIdList )
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
    return dataLibrary[dataName]
end

-- local needExecNextConfigIdList
-- function ConfigHelpers.SceneLoaded( scene , mode )
--     LoadConfig(scene.name,needExecNextConfigIdList)
--     SceneManager.sceneLoaded('-', ConfigHelpers.SceneLoaded)
-- end

--切换场景    sceneName:要切换的场景    nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.ChangeScene( sceneName , nextConfigIdList )
    -- needExecNextConfigIdList = nextConfigIdList
    -- SceneManager.sceneLoaded('+', ConfigHelpers.SceneLoaded)
    -- SceneManager.LoadSceneAsync(sceneName)
    ConfigHelpers.CloseAudio()
    ConfigHelpers.ClearLongPressMove()
    followMeDic = {}
    lookAtDic = {}
    MF.Route.ClearUpdate()
    GameUtils.SetRaySelectListenerStatus(true)
    GameUtils.StopAllCoroutine()
    GameUtils.LoadScene(sceneName,nextConfigIdList,nil,nil)
end

--为按钮注册事件  target:设置对象   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.RegisterClick( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target and nextConfigIdList then
            GameUtils.RegisterClick(target,function ( ... )
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end)
        end
    end
end

function ConfigHelpers.RemoveClick( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            GameUtils.RemoveClick(target)
        end
        if nextConfigIdList then
            ConfigHelpers.ExecIdList(nextConfigIdList)
        end
    end
end

function ConfigHelpers.OnMouseEnter( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target and nextConfigIdList then
            GameUtils.OnMouseEnter(target,function ( ... )
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end)
        end
    end
end

function ConfigHelpers.RemoveMouseEnter( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            GameUtils.RemoveMouseEnter(target)
        end
        if nextConfigIdList then
            ConfigHelpers.ExecIdList(nextConfigIdList)
        end
    end
end

function ConfigHelpers.OnMouseExit( target , nextConfigIdList )
   if target then
        target = ConfigHelpers.FindGameObject(target)
        if target and nextConfigIdList then
            GameUtils.OnMouseExit(target,function ( ... )
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end)
        end
    end
end

function ConfigHelpers.RemoveMouseExit( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            GameUtils.RemoveMouseExit(target)
        end
        if nextConfigIdList then
            ConfigHelpers.ExecIdList(nextConfigIdList)
        end
    end
end

function ConfigHelpers.SetRaySelectListenerStatus( active , nextConfigIdList )
    GameUtils.SetRaySelectListenerStatus(active)
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--设置父物体    target:设置对象   parent:父物体   nextConfigIdList:完成过后要执行的id集合
function ConfigHelpers.SetParent( target , parent , px , py , pz , rx , ry , rz , sx , sy , sz , nextConfigIdList )
    if target and parent then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            parent = ConfigHelpers.FindGameObject(parent)
            if parent then
                local sta = target:GetComponent("SyncTransformAction")
                if sta == nil then
                    target:AddComponent(typeof(SyncTransformAction))
                end
                local t = target.transform
                t:SetParent(parent.transform)
                t.localPosition = Vector3( px , py , pz )
                t.localEulerAngles = Vector3( rx , ry , rz )
                t.localScale = Vector3( sx , sy , sz )
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            end
        end
    end
end

--跟随摄像机   target:目标对象  isFollow:是否跟随  distance:面向的距离  nextConfigIdList:执行的id集合
local followMeDic = {}
function ConfigHelpers.FollowMe( target , isFollow , distance , nextConfigIdList)
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            if isFollow then
                local player = GameObject.Find('FrameWork/Customs/ViveFocus/WaveVR/head').transform
                distance = distance
                local spanEulerAngles = target.transform.eulerAngles - player.eulerAngles
                followMeDic[target] = true
                GameUtils.StartCoroutineWaitUntil(function ( ... )
                    local result = player.position + (player.forward * distance)
                    target.transform.position = result
                    target.transform.eulerAngles = spanEulerAngles + player.eulerAngles
                    return not followMeDic[target]
                end)
            else
                followMeDic[target] = nil
            end
            if nextConfigIdList then
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end
        end
    end
end

--跟随摄像机   target:目标对象  isStop:是否停止面向自己(默认为false)
local lookAtDic = {}
function ConfigHelpers.LookMe( target , isStop , nextConfigIdList)
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local player = GameObject.Find('FrameWork/Customs/ViveFocus/WaveVR/head').transform
            if not isStop then
                lookAtDic[target] = true
                local rtf = target:GetComponent('RectTransform')
                GameUtils.StartCoroutineWaitUntil(function ( ... )
                    target.transform:LookAt(player.position)
                    target.transform:Rotate(Vector3.up, )
                    return not lookAtDic[target]
                end)
            else
                lookAtDic[target] = nil
            end
            if nextConfigIdList then
                ConfigHelpers.ExecIdList(nextConfigIdList)
            end
        end
    end
end

--播放视频   target:目标对象   videoName:视频名称(视频放到StreamingAssets文件夹下才有效)  isLoop:是否重复播放(默认重复)  nextConfigIdList:如果isLoop是true的话,那么会立马执行id集合,否则会等视频播放完才执行id集合
function ConfigHelpers.PlayVedio( target , videoName , isLoop , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            target:SetActive(false)
            isLoop = (isLoop == ]
            local mp = target:GetComponent('MediaPlayerCtrl')
            if mp == nil then
                mp = target:AddComponent(typeof(MediaPlayerCtrl))
            end
            mp.m_TargetMaterial = { target }
            -- mp.m_objResize = { target }
            mp:Load(videoName)
            mp.m_bLoop = isLoop
            mp:Play()
            target:SetActive(true)
            if isLoop then
                if nextConfigIdList then
                    ConfigHelpers.ExecIdList(nextConfigIdList)
                end
            else
                mp.OnEnd = function ( ... )
                    if nextConfigIdList then
                        ConfigHelpers.ExecIdList(nextConfigIdList)
                    end
                end
            end
        end
    end
end

--获取手柄在圆形区域的触摸点
function ConfigHelpers.GetTouchPadPosition( nextConfigIdList )
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
    return GameUtils.GetTouchPadPosition()
end

--判断手柄上某键是否按下或者鼠标左键是否按下
function ConfigHelpers.GetKeyDown( keycode , nextConfigIdList )
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
    return GameUtils.GetKeyDown(keycode)
end

--判断手柄上某键是否抬起或者鼠标左键是否抬起
function ConfigHelpers.GetKeyUp( keycode , nextConfigIdList )
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
    return GameUtils.GetKeyUp(keycode)
end

--增加物体长按拖动
function ConfigHelpers.AddLongPressMove( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            local sta = target:GetComponent("SyncTransformAction")
            if sta == nil then
                target:AddComponent(typeof(SyncTransformAction))
            end
            GameUtils.AddLongPressMove(target)
        end
    end
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--移除物体长按拖动
function ConfigHelpers.RemoveLongPressMove( target , nextConfigIdList )
    if target then
        target = ConfigHelpers.FindGameObject(target)
        if target then
            GameUtils.RemoveLongPressMove(target)
        end
    end
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

--清除所有能拖拽物体的状态,使之不能被拖拽
function ConfigHelpers.ClearLongPressMove( nextConfigIdList )
    GameUtils.ClearLongPressMove()
    if nextConfigIdList then
        ConfigHelpers.ExecIdList(nextConfigIdList)
    end
end

function ConfigHelpers.ExecId( id )
    if id == nil then
        Print_t('此id非法')
        return
    end
    if ConfigGlobal[id] == nil then
        Print_t('不存在此id'..id)
        return
    end
    Print_t(id..' = '..ConfigGlobal[id].action)
    if ConfigGlobal[id].action then
        -- assert(load(ConfigGlobal[id].action))()
        xpcall(load(ConfigGlobal[id].action),function ( ... )
            Print_t(debug.traceback(),'<color=red>发生错误</color>')
        end)
    end
end

function ConfigHelpers.ExecIdList( idList )
    if idList then
        if type(idList) == 'table' then
            for i,id in ipairs(idList) do
                ConfigHelpers.ExecId(id)
            end
        else
            idList()
        end
    end
end

function ConfigHelpers.FindGameObject( path )
    if path and path ~= '' then
        local target = GameObject.Find(path)
        if target then
            return target
        else
            local startIndex = string.find(path,'/')
            if startIndex then
                ,startIndex-)
                local root = GameObject.Find('/'..rootPath)
                if root then
                    ,path.length)
                    local result = root.transform:Find(childPath)
                    if result then
                        return result.gameObject
                    end
                end
            end
        end
    end
    Print_t('<color=red>发生错误:</color>找不到对象='..(path or ''))
    return nil
end

--总秒数格式化   传总秒数   返回的时间格式为 59:34   第二个参数表示是否显示小时
function ConfigHelpers.FormatSecond( senconds , isShowHour )
    )
    )

    sec = )
     then
       sec = '..sec
    end
     then
       hour = '..hour
    end
    local t = min ..':'..sec
    return isShowHour and hour..t or t
end

return ConfigHelpers

ConfigHelpers的更多相关文章

  1. Lua工具类

    1.打印table --一个用以打印table的函数 function print_r (t, name) print(pr(t,name)) end function pr (t, name, in ...

  2. 使用IDEA开发Spark程序

    一.分布式估算圆周率 1.计算原理 假设正方形的面积S等于x²,而正方形的内切圆的面积C等于Pi×(x/2)²,因此圆面积与正方形面积之比C/S就为Pi/4,于是就有Pi=4×C/S. 可以利用计算机 ...

随机推荐

  1. iOS之序列化与反序列化

    所谓的序列化和反序列化就是将数据结构或对象和二进制串之间相互转换的过程: 本人的理解是当你于写数据需要本地存储时,即将你的数据写到硬盘上的时候,你就必须对他进行序列化,转换成二进制文件,从而便于在磁盘 ...

  2. 在网页中使用Markdown

    在网站中使用markdown有两种方式,一种是通过后端(php等)把markdown语法文本转换为html代码,输出到浏览器:另一种是通过javascript代码直接在浏览器中转换. 我在这里使用的是 ...

  3. 使用@AspectJ注解开发Spring AOP

    一.实体类: Role public class Role { private int id; private String roleName; private String note; @Overr ...

  4. wshShell.SendKeys模拟键盘操作

    Dim wshShellSet wshShell = CreateObject("Wscript.Shell")wshShell.SendKeys "{ENTER}&qu ...

  5. MyBatis之Mapper XML 文件详解(二)-sql和入参

    sql 这个元素可以被用来定义可重用的 SQL 代码段,可以包含在其他语句中.它可以被静态地(在加载参数) 参数化. 不同的属性值通过包含的实例变化. 比如: <sql id="use ...

  6. wpf中使用cefsharp加载本地html网页并实现cs和js的交互,并且cefsharp支持any cpu

    废话少说,直接上代码: 第一步: 第二步: 第三步: 第四步: App.xaml.cs对应的代码: using CefSharp; using CefSharp.Wpf; using System; ...

  7. jquery 插件学习

    练习jquery上的一个插件编写 1.标准的3个基本内容,根目录里面创建2个文件夹(存放css和js)和1个html页面文件: 2.测试的主html页面代码 <!DOCTYPE html> ...

  8. 前端jQuery实现瀑布流

    瀑布流是我们经常会见到的东西,一直刷新一直有,其实它实现起来是很简单的.具体代码如下 1.css代码 <style> *{ margin:; padding:; } .container{ ...

  9. Spring : Spring Security

    ==========================================================================spring-security-过滤器: 顶级Fil ...

  10. 如何判断一个 APP页面是否是H5页面(转载)

    1.无网络断开网络,显示404或则错误页面的是H5 2.页面布局a.在手机设置.开发者选项中开启显示布局边界功能:b.进入应用查看布局边界:c.原生应用可以看到各个控件的布局边界,H5只有整个页面的一 ...