Class CivicsUtils
Inheritance
System.Object
CivicsUtils
Assembly: Eco.Gameplay.dll
Syntax
public static class CivicsUtils : Object
Fields
ProposableStateChangedEvent
Declaration
public static ThreadSafeAction<IProposable> ProposableStateChangedEvent
Field Value
Properties
ArchiveAddendum
Declaration
public static LocString ArchiveAddendum { get; }
Property Value
RevisionAddendum
Declaration
public static LocString RevisionAddendum { get; }
Property Value
Methods
Active(IProposable)
Declaration
public static bool Active(this IProposable proposable)
Parameters
Returns
Type |
Description |
System.Boolean |
|
All<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> All<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllActive<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllActive<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllActiveAndProposed<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllActiveAndProposed<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllActiveAndValid<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllActiveAndValid<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable, ICachesValidity
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllActiveDraftAndProposed<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllActiveDraftAndProposed<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllApplicable<T>(Settlement, Boolean)
Return active and valid if settlement is founded (or null), also includes draft and proposed and ignores vailidity if not founded.
Declaration
public static IEnumerable<T> AllApplicable<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable, ICachesValidity
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllDrafts<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllDrafts<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllInactive<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllInactive<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllInState<T>(ProposableState, Settlement, Boolean)
Declaration
public static IEnumerable<T> AllInState<T>(ProposableState state, Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AllOld<T>(Settlement, Boolean)
Declaration
public static IEnumerable<T> AllOld<T>(Settlement settlement, bool includeChildrenSettlement = false)
where T : IProposable
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.Boolean |
includeChildrenSettlement |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
AssociatedUsers(IHostedObject)
Returns the creator, owners, and accessors on the deed.
Declaration
public static IEnumerable<User> AssociatedUsers(this IHostedObject obj)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<User> |
|
CanBeAssignedToContainer(IProposable, IOrphanAssignment)
This is used to check whether we can assign an orphan proposable to a container or not.
Usually all classes that implement the IProposable interface have the same check that's why we just call this function when implementing IHostedObject.CanBeAssignedTo.
Declaration
public static bool CanBeAssignedToContainer(this IProposable prop, IOrphanAssignment container)
Parameters
Returns
Type |
Description |
System.Boolean |
|
ConstitutionElectionDraft(Settlement)
Declaration
public static Election ConstitutionElectionDraft(Settlement settlement)
Parameters
Returns
GetDistrictDescription(WorldPosition2i)
Declaration
public static LocString GetDistrictDescription(WorldPosition2i pos)
Parameters
Returns
GetHostedProposables(IEnumerable<Type>, WorldObject)
Returns objects that are currently hosted on this world object.
Declaration
public static IEnumerable<IProposable> GetHostedProposables(IEnumerable<Type> types, WorldObject obj)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Type> |
types |
|
WorldObject |
obj |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IProposable> |
|
GetHostedProposables(Type, WorldObject)
Declaration
public static IEnumerable<IProposable> GetHostedProposables(Type type, WorldObject obj)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<IProposable> |
|
GetOrCreateActiveElement<T>(Func<T, Boolean>, Settlement)
Declaration
public static T GetOrCreateActiveElement<T>(Func<T, bool> test, Settlement settlement)
where T : IProposable
Parameters
Type |
Name |
Description |
System.Func<T, System.Boolean> |
test |
|
Settlement |
settlement |
|
Returns
Type Parameters
GetPropertyTables(IProposableContainer)
Declaration
public static LocString[, ] GetPropertyTables(this IProposableContainer container)
Parameters
Returns
Open(IProposable, Player)
Open for read-only viewing (No need for a specific access type, everybody should be able to view a proposable).
Declaration
public static void Open(this IProposable prop, Player player)
Parameters
RemoveInvalidProposables(IRegistrar)
Declaration
public static void RemoveInvalidProposables(IRegistrar reg)
Parameters
SendMessage(IHostedObject, LocString, NotificationStyle)
Send a message to all 'associated users', that is the creator, owners, and accessors on the deed.
Declaration
public static void SendMessage(this IHostedObject obj, LocString l, NotificationStyle style)
Parameters
SetProposedState(IProposable, ProposableState, Boolean, Boolean, CivicsUtils.StateChangeDetailFlags)
Declaration
public static bool SetProposedState(this IProposable proposable, ProposableState newState, bool doScan = true, bool notify = true, CivicsUtils.StateChangeDetailFlags flags)
Parameters
Returns
Type |
Description |
System.Boolean |
|
ShouldStopBasicElectionVoting(Type, String, LawSection)
Declaration
public static Result ShouldStopBasicElectionVoting(Type action, string propName, LawSection section)
Parameters
Type |
Name |
Description |
System.Type |
action |
|
System.String |
propName |
|
LawSection |
section |
|
Returns
ShouldStopCaptiolChangingAction(Type, String, LawSection)
Declaration
public static Result ShouldStopCaptiolChangingAction(Type action, string propName, LawSection section)
Parameters
Type |
Name |
Description |
System.Type |
action |
|
System.String |
propName |
|
LawSection |
section |
|
Returns
TryDestroyProposable(IProposable, Player)
Declaration
public static bool TryDestroyProposable(this IProposable proposable, Player player)
Parameters
Returns
Type |
Description |
System.Boolean |
|
UpdateChildArticleStates(IEnumerable<CivicArticle>, IProposable, ProposableState)
Meant to be called when a SimpleProposable Object which contains a list of CivicArticles has changed it's state
i.e. a Constitution. This function changes the states of those child CivicArticles as well as update the parent
(if there is none) and HostObject. state
may differ from proposable
state in case
if we call this function right before parent state change.
Declaration
public static void UpdateChildArticleStates(this IEnumerable<CivicArticle> list, IProposable proposable, ProposableState state)
Parameters
UpdateNameSuffix(IProposable, Boolean)
Declaration
public static void UpdateNameSuffix(this IProposable proposable, bool allowRename = false)
Parameters
Type |
Name |
Description |
IProposable |
proposable |
|
System.Boolean |
allowRename |
|