ChangeHistoryService

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스

플러그인 개발자 레코딩을 통해 플러그인이 경험에 적용하는 변경을 취소하고 다시 수행하도록 Studio에 알리기 위해 ChangeHistoryService 사용해야 합니다.변경하기 전에 플러그인은 ChangeHistoryService:TryBeginRecording() 을 호출하여 할당된 식별자를 기억하고, 변경 사항을 적용한 후에는 플러그인이 ChangeHistoryService:FinishRecording() 를 호출하여 녹음을 완료합니다.

플러그인은 또한 ChangeHistoryService:Undo() 또는 ChangeHistoryService:Redo()를 통해 실행 취소 또는 다시 실행을 프로그래밍 방식으로 호출할 수 있습니다.

ChangeHistoryService 는 런타임에 활성화되지 않으므로 실행 중인 경험에서 메서드를 호출하면 효과가 없습니다.

요약

메서드

  • FinishRecording(identifier : string,operation : Enum.FinishRecordingOperation,finalOptions : Dictionary?):()
    플러그인 보안

    식별된 레코딩이 완료되었으며 최종 작업을 수행하여 레코딩을 완료하도록 Studio에 통신합니다.

  • 플러그인 보안

    되돌릴 수 있는 작업이 있는지 여부를 반환하고, 있으면 마지막 작업을 반환합니다.

  • 플러그인 보안

    취소할 수 있는 작업이 있는지 여부를 반환하고, 있으면 마지막 작업을 반환합니다.

  • 플러그인 보안
  • Redo():()
    플러그인 보안

    취소된 마지막 작업을 실행합니다.

  • 플러그인 보안

    기록을 지우고 모든 실행 취소/다시 실행 경로가 제거됩니다.

  • SetEnabled(state : boolean):()
    플러그인 보안

    변경 내역 서비스를 활성화할지 여부를 설정합니다.

  • SetWaypoint(name : string):()
    플러그인 보안

    실행 취소나 다시 실행할 수 있는 새로운 웨이포인트를 설정합니다.

  • TryBeginRecording(name : string,displayName : string?):string?
    플러그인 보안

    데이터 모델에 적용된 변경 사항을 기록으로 추적하기 시작합니다.

  • Undo():()
    플러그인 보안

    방향점이 있는 마지막 행동을 취소합니다.

이벤트

속성

메서드

FinishRecording

()
플러그인 보안

매개 변수

identifier: string
기본값: ""
기본값: ""
finalOptions: Dictionary
기본값: ""

반환

()

코드 샘플

ChangeHistoryService:TryBeginRecording

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Example Plugin")
local button = toolbar:CreateButton("Neon it up", "", "")
button.Click:Connect(function()
local parts = {}
for _, part in pairs(Selection:Get()) do
if part:IsA("BasePart") then
parts[#parts + 1] = part
end
end
if #parts < 1 then
-- Nothing to do.
return
end
local recording = ChangeHistoryService:TryBeginRecording("Set selection to neon")
if not recording then
-- Handle error here. This indidcates that your plugin began a previous
-- recording and never completed it. You may only have one recording
-- per plugin active at a time.
return
end
for _, part in pairs(parts) do
part.Material = Enum.Material.Neon
end
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
end)

GetCanRedo

플러그인 보안

반환

GetCanUndo

플러그인 보안

반환

IsRecordingInProgress

플러그인 보안

매개 변수

identifier: string
기본값: ""

반환

Redo

()
플러그인 보안

반환

()

ResetWaypoints

()
플러그인 보안

반환

()

SetEnabled

()
플러그인 보안

매개 변수

state: boolean
기본값: ""

반환

()

SetWaypoint

()
플러그인 보안

매개 변수

name: string
기본값: ""

반환

()

코드 샘플

변경 기록 서비스: 웨이포인트 설정

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Example Plugin")
local button = toolbar:CreateButton("Neon it up", "", "")
button.Click:Connect(function()
local parts = {}
for _, part in pairs(Selection:Get()) do
if part:IsA("BasePart") then
parts[#parts + 1] = part
end
end
if #parts > 0 then
-- 그러나 작업 전에 SetWaypoint를 호출하면 문제가 발생하지 않습니다.
-- 작업 이후에만 호출이 필요하므로 중복됩니다.
--변경 내역 서비스: 웨이포인트 설정("네온으로 선택 설정")
for _, part in pairs(parts) do
part.Material = Enum.Material.Neon
end
-- 작업을 완료한 후 SetWaypoint 호출
ChangeHistoryService:SetWaypoint("Set selection to neon")
else
-- 할 일은 없습니다. 경우에 따라 SetWaypoint를 호출할 필요가 없습니다.
-- 행동이 경험에 변경을 일으키지 않았습니다.
end
end)

TryBeginRecording

플러그인 보안

매개 변수

name: string
기본값: ""
displayName: string
기본값: ""

반환

코드 샘플

ChangeHistoryService:TryBeginRecording

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Example Plugin")
local button = toolbar:CreateButton("Neon it up", "", "")
button.Click:Connect(function()
local parts = {}
for _, part in pairs(Selection:Get()) do
if part:IsA("BasePart") then
parts[#parts + 1] = part
end
end
if #parts < 1 then
-- Nothing to do.
return
end
local recording = ChangeHistoryService:TryBeginRecording("Set selection to neon")
if not recording then
-- Handle error here. This indidcates that your plugin began a previous
-- recording and never completed it. You may only have one recording
-- per plugin active at a time.
return
end
for _, part in pairs(parts) do
part.Material = Enum.Material.Neon
end
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
end)

Undo

()
플러그인 보안

반환

()

이벤트

OnRecordingFinished

플러그인 보안

매개 변수

name: string
displayName: string
identifier: string
finalOptions: Dictionary

OnRecordingStarted

플러그인 보안

매개 변수

name: string
displayName: string

OnRedo

플러그인 보안

매개 변수

waypoint: string

OnUndo

플러그인 보안

매개 변수

waypoint: string