Skip to content

Commit

Permalink
dotnet-format
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed Jan 5, 2025
1 parent 50e8ef9 commit f314720
Showing 1 changed file with 81 additions and 81 deletions.
162 changes: 81 additions & 81 deletions Assets/Scripts/API/GUI/ScriptsPanel.cs
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
// Copyright 2022 The Tilt Brush Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;

namespace TiltBrush
{
public class ScriptsPanel : BasePanel
{

public BaseButton SymmetryScriptButton;
public BaseButton PointerScriptButton;
public BaseButton ToolScriptButton;
public ToggleButton BackgroundScriptsButton;

protected override void OnEnablePanel()
{
base.OnEnablePanel();
// Safe to run multiple times as it checks m_IsInitialized
LuaManager.Instance?.Init();
}

public void InitScriptUiNav()
{
foreach (var nav in GetComponentsInChildren<ScriptUiNav>())
{
nav.Init();
}
foreach (var nav in GetComponentsInChildren<ScriptUiNavMultiple>())
{
nav.Init();
}
}

public void TogglePointerScript(ToggleButton btn)
{
LuaManager.Instance.EnablePointerScript(btn.IsToggledOn);
}

public void ToggleBackgroundScripts(ToggleButton btn)
{
LuaManager.Instance.EnableBackgroundScripts(btn.IsToggledOn);
}

public void ConfigureScriptButton(LuaApiCategory category, string scriptName, string description)
{
BaseButton btn = category switch
{
LuaApiCategory.PointerScript => PointerScriptButton,
LuaApiCategory.ToolScript => ToolScriptButton,
LuaApiCategory.SymmetryScript => SymmetryScriptButton,
_ => throw new ArgumentOutOfRangeException(nameof(category), category, null)
};
btn.SetDescriptionText($"{category}: {scriptName}");
if (description != null)
{
btn.SetExtraDescriptionText(description);
}
}

public void HandleGoogleDriveSync()
{
if (!App.DriveSync.IsFolderOfTypeSynced(DriveSync.SyncedFolderType.Scripts))
{
App.DriveSync.ToggleSyncOnFolderOfType(DriveSync.SyncedFolderType.Scripts);
}
App.DriveSync.SyncLocalFilesAsync().AsAsyncVoid();
}
}
}
// Copyright 2022 The Tilt Brush Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;

namespace TiltBrush
{
public class ScriptsPanel : BasePanel
{

public BaseButton SymmetryScriptButton;
public BaseButton PointerScriptButton;
public BaseButton ToolScriptButton;
public ToggleButton BackgroundScriptsButton;

protected override void OnEnablePanel()
{
base.OnEnablePanel();
// Safe to run multiple times as it checks m_IsInitialized
LuaManager.Instance?.Init();
}

public void InitScriptUiNav()
{
foreach (var nav in GetComponentsInChildren<ScriptUiNav>())
{
nav.Init();
}
foreach (var nav in GetComponentsInChildren<ScriptUiNavMultiple>())
{
nav.Init();
}
}

public void TogglePointerScript(ToggleButton btn)
{
LuaManager.Instance.EnablePointerScript(btn.IsToggledOn);
}

public void ToggleBackgroundScripts(ToggleButton btn)
{
LuaManager.Instance.EnableBackgroundScripts(btn.IsToggledOn);
}

public void ConfigureScriptButton(LuaApiCategory category, string scriptName, string description)
{
BaseButton btn = category switch
{
LuaApiCategory.PointerScript => PointerScriptButton,
LuaApiCategory.ToolScript => ToolScriptButton,
LuaApiCategory.SymmetryScript => SymmetryScriptButton,
_ => throw new ArgumentOutOfRangeException(nameof(category), category, null)
};
btn.SetDescriptionText($"{category}: {scriptName}");
if (description != null)
{
btn.SetExtraDescriptionText(description);
}
}

public void HandleGoogleDriveSync()
{
if (!App.DriveSync.IsFolderOfTypeSynced(DriveSync.SyncedFolderType.Scripts))
{
App.DriveSync.ToggleSyncOnFolderOfType(DriveSync.SyncedFolderType.Scripts);
}
App.DriveSync.SyncLocalFilesAsync().AsAsyncVoid();
}
}
}

0 comments on commit f314720

Please sign in to comment.