This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from TheIdealShipAU/develop
更新到0.3.3
- Loading branch information
Showing
16 changed files
with
176 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ name: dotnet-build | |
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**.yml' | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System.Xml.Schema; | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using static TheIdealShip.Languages.Language; | ||
using static TheIdealShip.Roles.RoleInfo; | ||
using RoleTeam = TheIdealShip.Roles.RoleInfo.RoleTeam; | ||
|
||
namespace TheIdealShip.Roles | ||
{ | ||
public static class RoleHelpers | ||
{ | ||
public static RoleInfo GetRoleInfo(PlayerControl player, bool isModifier = false) | ||
{ | ||
var info = getRoleInfoForPlayer(player, isModifier, false).FirstOrDefault(); | ||
return info; | ||
} | ||
public static string GetRoleTeam(PlayerControl p) | ||
{ | ||
string roleTeam; | ||
string cre = GetString("Crewmate"); | ||
string imp = GetString("Impostor"); | ||
string neu = GetString("Neutral"); | ||
var info = GetRoleInfo(p); | ||
switch (info.team) | ||
{ | ||
case RoleTeam.Crewmate: | ||
roleTeam = cre; | ||
break; | ||
|
||
case RoleTeam.Impostor: | ||
roleTeam = imp; | ||
break; | ||
|
||
case RoleTeam.Neutral: | ||
roleTeam = neu; | ||
break; | ||
|
||
default: | ||
roleTeam = ""; | ||
break; | ||
} | ||
return roleTeam; | ||
} | ||
|
||
public static bool Is(this PlayerControl player, RoleId id) | ||
{ | ||
var info = GetRoleInfo(player); | ||
return id == info.roleId; | ||
} | ||
|
||
public static bool Is(this PlayerControl player, RoleTeam team) | ||
{ | ||
var info = GetRoleInfo(player); | ||
return team == info.team; | ||
} | ||
|
||
public static bool Is(this RoleId id, RoleType type) | ||
{ | ||
var info = allRoleInfos.Where(x => x.roleId == id).FirstOrDefault(); | ||
return info.type == type; | ||
} | ||
|
||
public static String GetRolesString(PlayerControl p, bool useColors = true, bool isModifier = false) | ||
{ | ||
string roleName; | ||
roleName = String.Join("", getRoleInfoForPlayer(p, isModifier).Select(x => useColors ? Helpers.cs(x.color, GetString(x.namekey)) : GetString(x.namekey)).ToArray()); | ||
return roleName; | ||
} | ||
} | ||
} |
Oops, something went wrong.