Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Rivet/Editor/RivetToolchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static bool AbortTask(ulong taskId)

public static void Shutdown()
{
shutdown();
// shutdown();
}

public static string PtrToString(IntPtr ptr)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Rivet/Editor/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task StartTask()
}

// Kill old task
StopTask();
_ = StopTask();

// Start new task
var config = await _getStartConfig();
Expand Down
5 changes: 3 additions & 2 deletions Assets/Rivet/Editor/UI/Dock/Dock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public void OnEnable()
// Bootstrap
_ = RivetGlobal.Singleton.Bootstrap();

// TODO:
// Start backend
// _ = BackendManager.StartTask();
}
Expand All @@ -212,8 +213,8 @@ private void ShutdownPlugin()
{

RivetLogger.Log("Shutdown Plugin");
_ = LocalGameServerManager.StopTask();
_ = BackendManager.StopTask();
// _ = LocalGameServerManager.StopTask();
// _ = BackendManager.StopTask();
}

void SetTab(MainTab tab)
Expand Down
53 changes: 29 additions & 24 deletions Assets/Rivet/Editor/UI/Dock/Tabs/DevelopController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public class DevelopController
private DropdownField _environmentTypeDropdown;
private DropdownField _remoteEnvironmentDropdown;

private DropdownField _playTypeDropdown;
private SliderInt _playerCount;
private Button _lgsStart;
private Button _lgsStop;
private Button _lgsRestart;
private VisualElement _lgsShowLogs;

private SliderInt _playerCount;
private Button _playerStart;

private Button _buildDeployButton;
private DropdownField _stepsDropdown;
Expand All @@ -58,14 +58,14 @@ void InitUI()
_environmentTypeDropdown = _root.Q("EnvironmentBody").Q<DropdownField>("TypeDropdown");
_remoteEnvironmentDropdown = _root.Q("EnvironmentBody").Q<DropdownField>("EnvironmentDropdown");

_playTypeDropdown = _root.Q("PlayBody").Q<DropdownField>("TypeDropdown");
_playerCount = _root.Q("PlayBody").Q<SliderInt>("PlayerCountSlider");

_lgsStart = _root.Q("PlayBody").Q("ButtonRow").Q("StartButton").Q<Button>("Button");
_lgsStop = _root.Q("PlayBody").Q("ButtonRow").Q("StopButton").Q<Button>("Button");
_lgsRestart = _root.Q("PlayBody").Q("ButtonRow").Q("RestartButton").Q<Button>("Button");
_lgsShowLogs = _root.Q("PlayBody").Q("ServerLogsButton");

_playerCount = _root.Q("PlayBody").Q<SliderInt>("PlayerCountSlider");
_playerStart = _root.Q("PlayBody").Q("StartButton").Q<Button>("Button");

_buildDeployButton = _root.Q("BuildDeployButton").Q<Button>("Button");
_stepsDropdown = _root.Q<DropdownField>("StepsDropdown");

Expand Down Expand Up @@ -97,12 +97,10 @@ void InitUI()
});

_lgsStart.RegisterCallback<ClickEvent>(ev => { OnLocalGameServerStart(); });
_lgsStop.RegisterCallback<ClickEvent>(ev => _dock.LocalGameServerManager.StopTask());
_lgsStop.RegisterCallback<ClickEvent>(ev => { _ = _dock.LocalGameServerManager.StopTask(); });
_lgsRestart.RegisterCallback<ClickEvent>(ev => { OnLocalGameServerStart(); });
_lgsShowLogs.RegisterCallback<ClickEvent>(ev => GameServerWindow.ShowGameServer());

_playerStart.RegisterCallback<ClickEvent>(ev => OnPlayerStart());

_buildDeployButton.RegisterCallback<ClickEvent>(ev => OnBuildAndDeploy());
}

Expand Down Expand Up @@ -146,26 +144,33 @@ private void OnLocalGameServerStateChange(bool running)

private void OnLocalGameServerStart()
{
string serverPath;
try
{
serverPath = Builder.BuildDevDedicatedServer();
}
catch (Exception e)
var canPlayClient = _playTypeDropdown.index == 0 || _playTypeDropdown.index == 1;
var canPlayServer = _playTypeDropdown.index == 0 || _playTypeDropdown.index == 2;

// Server
if (canPlayServer)
{
EditorUtility.DisplayDialog("Server Build Failed", e.Message, "Dismiss");
return;
}
string serverPath;
try
{
serverPath = Builder.BuildDevDedicatedServer();
}
catch (Exception e)
{
EditorUtility.DisplayDialog("Server Build Failed", e.Message, "Dismiss");
return;
}

RivetGlobal.Singleton.LocalGameServerExecutablePath = serverPath;
RivetGlobal.Singleton.LocalGameServerExecutablePath = serverPath;

_ = _dock.LocalGameServerManager.StartTask();
}
_ = _dock.LocalGameServerManager.StartTask();
}

private void OnPlayerStart()
{
int instanceCount = (int)_playerCount.value;
Builder.BuildAndRunMultipleDevPlayers(instanceCount);
// Client
if (canPlayClient)
{
Builder.BuildAndRunMultipleDevPlayers(_playerCount.value);
}
}

private void OnBuildAndDeploy()
Expand Down
2 changes: 1 addition & 1 deletion Assets/Rivet/Editor/UI/Dock/Tabs/Settings.uxml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<AttributeOverrides element-name="Title" text="Modules Backend" />
</ui:Instance>
<ui:VisualElement name="BackendBody" style="flex-grow: 0; flex-shrink: 0; flex-direction: column;">
<ui:Label tabindex="-1" text="Locally running backend for your module logic, Rivet Editor, and SDK generation. Parts of the plugin will not work if stopped." parse-escape-sequences="true" display-tooltip-when-elided="true" style="white-space: normal;" />
<ui:Label tabindex="-1" text="Locally running backend for your module logic, Rivet Editor, and SDK generation. Parts of the plugin will not work if stopped." parse-escape-sequences="true" display-tooltip-when-elided="true" style="white-space: normal; margin-bottom: 8px;" />
<ui:VisualElement name="ButtonRow" style="flex-grow: 0; flex-shrink: 0; flex-direction: row;">
<ui:Button text="Start" parse-escape-sequences="true" display-tooltip-when-elided="true" name="StartButton" style="flex-grow: 1;" />
<ui:Button text="Stop" parse-escape-sequences="true" display-tooltip-when-elided="true" name="StopButton" style="flex-shrink: 1; flex-grow: 1;" />
Expand Down
2 changes: 2 additions & 0 deletions scripts/run_dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ if (!status.success) {
console.error("Failed to open Unity project");
Deno.exit(status.code);
}

// lldb -o 'process launch -- -projectPath /Users/nathan/rivet/plugin-unity -logfile -' /Applications/Unity/Hub/Editor/2022.3.38f1/Unity.app/Contents/MacOS/Unity