Алгоритмы, Наработки и Способности
Способ реализации:
Jass
Тип:
Алгоритм
Версия Warcraft:
UjAPI v1.0.28.102+

О системе

Относительно краткий пример движения фрейма за виджетом/мировой координатой, на CSimpleFrame фрейме используя UjAPI и Frame API.
Система основывается на использовании GetWidgetScreenX/Y, есть конечно же и GetUnitScreenX/Y, всё это доступно с патча 1.0.28.102, потом советую ознакомиться с чейнджлогом.
Данная система конечно же работает в онлайне и не вызывает десинха, иначе это не имело бы смысла.

Код

раскрыть
globals
    unit uTest = null
    framehandle FH_Temp = null
endglobals

function OnMoveButtonOnUnit takes nothing returns nothing
    local framehandle frm = GetCSimpleFrameByName( "ATTACHED_FRAME", 0 )
    local real x = .0
    local real y = .0
    
    if uTest != null then
        set x = GetWidgetScreenX( uTest )
        set y = GetWidgetScreenY( uTest )
        
        call ClearTextMessages( )
        call BJDebugMsg( "x = " + R2S( x ) + " | y = " + R2S( y ) )
        
        call ClearFrameAllPoints( frm )
        call SetFrameAbsolutePoint( frm, FRAMEPOINT_TOP, x, y + 100. / GetClientHeight( ) )
    endif

    set frm = null
endfunction

function InitMoveFrameOnUnit takes nothing returns nothing
    set uTest = CreateUnit( Player( 0 ), 'Hamg', .0, .0, .0 )
    call TimerStart( CreateTimer( ), .05, true, function OnMoveButtonOnUnit )
endfunction

function CreateFrameForWorldAxis takes string icon, integer contextId returns framehandle
    local framehandle consoleUI = GetOriginFrame( ORIGIN_FRAME_CONSOLE_UI, 0 )
    local framehandle frame = null

    set frame = CreateFrameByType( "SIMPLEFRAME", "ATTACHED_FRAME", consoleUI, "", contextId )
    call ClearFrameAllPoints( frame )

    call SetFrameTexture( frame, icon, 0, false )
    call SetFrameSize( frame, .038, .038 )
    call SetFramePriority( frame, 5 )
    call SetFrameParent( frame, consoleUI )
    call ShowFrame( frame, true )
    call SetFrameRelativePoint( frame, FRAMEPOINT_CENTER, consoleUI, FRAMEPOINT_CENTER, .0, .0 )

    set FH_Temp = frame

    set consoleUI = null
    set frame = null

    return FH_Temp
endfunction

function OnInitSystemDelayed takes nothing returns nothing
    local framehandle frame = null

    set frame = CreateFrameForWorldAxis( "ReplaceableTextures\\CommandButtons\\BTNDivineIntervention", 0 )
    call InitMoveFrameOnUnit( )

    set frame = null
endfunction

//===========================================================================
function InitTrig_AttachedFrameExample takes nothing returns nothing
    //set gg_trg_AttachedFrameExample = CreateTrigger(  )

    call FogEnable( false )
    call FogMaskEnable( false )
    call PanCameraToTimed( 0., 0., 0. )
    call EnableOperationLimit( false )
    call TimerStart( CreateTimer( ), .5, false, function OnInitSystemDelayed )
endfunction

Превью

`
ОЖИДАНИЕ РЕКЛАМЫ...