Class TMessaging
Unit
CastleMessaging
Declaration
type TMessaging = class(TObject)
Description
Message system to communicate between native code (Pascal) and other languages (Java on Android, Objective-C on iOS). Use through auto-created Messaging singleton. On platforms other than Android / iOS, it simply does nothing — messsages are not send anywhere.
To make this work, on Android you need to declare your Android project type as "integrated". See https://github.com/castle-engine/castle-engine/wiki/Android-Project-Components-Integrated-with-Castle-Game-Engine . For iOS, you don't need to do anything. You should also use the game_units attribute in CastleEngineManifest.xml , so that the build tool automatically generates a proper Android / iOS library code, exporting the proper functions.
All the communication is asynchronous on all platforms – Pascal code sends a message, and any answers will come asynchronously later. This means that e.g. TGameService.RequestSignedIn will never call TGameService.OnStatusChanged right inside, the call to TGameService.OnStatusChanged will always happen at a later time.
This is used automatically by various engine classes like TGooglePlayGames, TAds, TAnalytics, TInAppPurchases.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
constructor Create; |
|
 |
destructor Destroy; override; |
|
 |
procedure Send(const Strings: array of string); |
Send a message to a service (implemented in other language, like Java on Android or Objective-C on iOS).
|
 |
class function BoolToStr(const Value: boolean): string; |
Convert boolean to 'true' or 'false' string, which will be understood correctly by the service receiving the messages.
|
 |
class function TimeToStr(const Value: TFloatTime): string; |
Convert float time (in seconds) to integer miliseconds, which are understood correctly by the service receiving the messages.
|
Properties
 |
property Log: boolean read FLog write FLog default false; |
Log each message send/received from/to service. Note that this is sometimes quite verbose, and it also allows cheaters to easier debug what happens in your game (e.g. how to fake getting some achievement), so in general don't leave it "on" in production.
|
Generated by PasDoc 0.15.0.
|