Show / Hide Table of Contents

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
Namespace: Eco.Gameplay.Civics.Constitutional
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
Type Description
ThreadSafeAction<Settlement, System.Collections.Generic.IEnumerable<User>>

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
Type Description
Eval<CivicPowerFlags>

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
Type Description
System.Collections.Generic.IEnumerable<Eval<CivicPowerFlags>>

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
Type Description
LocString

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
Type Name Description
User user
Settlement settlement
System.Type type
LocString actionText
LocString typeName
Returns
Type Description
System.ValueTuple<Color, LocString>

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
Type Name Description
ISubscriptions<ThreadSafeSubscriptions> subs
System.Func<Settlement> watchingSettlement
System.Action callback

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
Type Name Description
ISubscriptions<ThreadSafeSubscriptions> subs
System.Func<Settlement> watchingSettlement
System.Action callback
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾