v0.13.0.11

This commit is contained in:
Joonas Rikkonen
2021-04-22 17:33:08 +03:00
parent 0697d7fc64
commit 8bb31f2893
391 changed files with 17271 additions and 5949 deletions
@@ -222,18 +222,20 @@ namespace Barotrauma
private bool ChangeSpawnType(GUIButton button, object obj)
{
GUITextBlock spawnTypeText = button.Parent.GetChildByUserData("spawntypetext") as GUITextBlock;
spawnType += (int)button.UserData;
var values = Enum.GetValues(typeof(SpawnType));
var values = (SpawnType[])Enum.GetValues(typeof(SpawnType));
int currIndex = values.IndexOf(spawnType);
currIndex += (int)button.UserData;
int firstIndex = 1;
int lastIndex = values.Length - 1;
if ((int)spawnType > lastIndex)
if (currIndex > lastIndex)
{
spawnType = (SpawnType)firstIndex;
currIndex = firstIndex;
}
if ((int)spawnType < firstIndex)
if (currIndex < firstIndex)
{
spawnType = (SpawnType)values.GetValue(lastIndex);
currIndex = lastIndex;
}
spawnType = values[currIndex];
spawnTypeText.Text = spawnType.ToString();
return true;
}