Class CivicPowersManager
Helpers for determining a user's 'Civic Powers', which is the various governmental actions they are
allowed to take, based on the settlement (used to be called Civic Duties).
Inheritance
System.Object
CivicPowersManager
Assembly: Eco.Gameplay.dll
Syntax
public static class CivicPowersManager : Object
Fields
CivicPowersChangedEvent
Called when powers change for a user for a given settlement.
Declaration
public static ThreadSafeAction<Settlement, IEnumerable<User>> CivicPowersChangedEvent
Field Value
Methods
DoPeriodicErrorCheck()
In QA mode, we periodically check to make sure that the last civic powers we made are what we expected them to be.
Declaration
public static void DoPeriodicErrorCheck()
GetCivicPower(Settlement, User, Type)
Returns what powers the given users has for the given civic type (can be a Civic Action or an IPropsoable type),
within the given settlement.
Declaration
public static Eval<CivicPowerFlags> GetCivicPower(this Settlement settlement, User user, Type type)
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
User |
user |
|
System.Type |
type |
|
Returns
GetPowers(Settlement, User, IEnumerable<Type>)
Returns an enumerable corresponding to the passed types, listing the powers the given user has in the given settlement for each action in that list.
Declaration
public static IEnumerable<Eval<CivicPowerFlags>> GetPowers(Settlement settlement, User user, IEnumerable<Type> types)
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
User |
user |
|
System.Collections.Generic.IEnumerable<System.Type> |
types |
|
Returns
GetPowersDesc(Settlement, User, IEnumerable<Type>, Boolean)
Returns a multiline description for a list of types, ignoring non-constitutional types.
Declaration
public static LocString GetPowersDesc(Settlement settlement, User user, IEnumerable<Type> types, bool isSettlementFromJurisdiction)
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
User |
user |
|
System.Collections.Generic.IEnumerable<System.Type> |
types |
|
System.Boolean |
isSettlementFromJurisdiction |
True if settlement was selected using jurisdiction component. False if it was selected based on position.
|
Returns
GetSubmitButtonText(User, Settlement, Type, LocString, LocString)
When editing an IProposable, we color the button based on what civic power we have, execution or election.
Declaration
public static (Color, LocString) GetSubmitButtonText(User user, Settlement settlement, Type type, LocString actionText, LocString typeName)
Parameters
Returns
Initialize()
Declaration
public static void Initialize()
WatchCivicPowers(ISubscriptions<ThreadSafeSubscriptions>, Func<Settlement>, Action)
Declaration
public static void WatchCivicPowers(ISubscriptions<ThreadSafeSubscriptions> subs, Func<Settlement> watchingSettlement, Action callback)
Parameters
WatchCivicPowersAndCall(ISubscriptions<ThreadSafeSubscriptions>, Func<Settlement>, Action)
Subscribe to civic powers for a given settlement only.
Declaration
public static void WatchCivicPowersAndCall(ISubscriptions<ThreadSafeSubscriptions> subs, Func<Settlement> watchingSettlement, Action callback)
Parameters