Example #1
0
	def Generate (self, generationArguments: CycleEvents.SpermGeneratingArguments) -> None:
		"""
		Fill the sperm object's attributes with instruction from the input.
		:param generationArguments: Event arguments to instruct how to set the sperm's attributes.
		:type generationArguments: EventsSperm.SpermGeneratingArguments
		"""

		if not isinstance(generationArguments, CycleEvents.SpermGeneratingArguments):
			raise Exceptions.IncorrectTypeException(generationArguments, "generationArguments", (CycleEvents.SpermGeneratingArguments,))

		generationArguments.PreGenerationEvent.Invoke(generationArguments, Events.EventArguments())
		self._GenerateInternal(generationArguments)
		generationArguments.PostGenerationEvent.Invoke(generationArguments, Events.EventArguments())
Example #2
0
def _InvokeOnLoadWrapperEvent () -> Events.EventArguments:
	eventArguments = Events.EventArguments()  # type: Events.EventArguments

	for updateCallback in _onUpdateWrapper:  # type: typing.Callable[[types.ModuleType, Events.EventArguments], None]
		try:
			updateCallback(sys.modules[__name__], eventArguments)
		except:
			Debug.Log("Failed to run the 'OnLoadWrapper' callback '" + Types.GetFullName(updateCallback) + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__)

	return eventArguments
Example #3
0
    def _InvokeOnLoadEvent(self) -> Events.EventArguments:
        eventArguments = Events.EventArguments()  # type: Events.EventArguments

        for loadCallback in self.OnLoad:  # type: typing.Callable[[PersistentBranched, Events.EventArguments], None]
            try:
                loadCallback(self, eventArguments)
            except:
                Debug.Log("Failed to run the 'OnLoad' callback '" +
                          Types.GetFullName(loadCallback) + "'.",
                          This.Mod.Namespace,
                          Debug.LogLevels.Exception,
                          group=This.Mod.Namespace,
                          owner=__name__)

        return eventArguments