OpSetPropertiesOfActor
How do I use Op Set Properties Of Actor
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: LoadbalancingPeer.cs
Copy
282 public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties, bool broadcast, byte channelId)
283 {
284 return this.OpSetPropertiesOfActor(actorNr, actorProperties.StripToStringKeys(), broadcast, channelId);
285 }
File name: LoadbalancingPeer.cs
Copy
287 protected bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, bool broadcast, byte channelId)
288 {
289 if (this.DebugOut >= DebugLevel.INFO)
290 {
291 this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor()");
292 }
293
294 if (actorNr <= 0 || actorProperties == null)
295 {
296 if (this.DebugOut >= DebugLevel.INFO)
297 {
298 this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor not sent. ActorNr must be > 0 and actorProperties != null.");
299 }
300 return false;
301 }
302
303 Dictionary
304 opParameters.Add(ParameterCode.Properties, actorProperties);
305 opParameters.Add(ParameterCode.ActorNr, actorNr);
306 if (broadcast)
307 {
308 opParameters.Add(ParameterCode.Broadcast, broadcast);
309 }
310
311 return this.OpCustom((byte)OperationCode.SetProperties, opParameters, broadcast, channelId);
312 }
File name: NetworkingPeer.cs
Copy
800 private void SendPlayerName()
801 {
802 if (this.State == global::PeerState.Joining)
803 {
804 // this means, the join on the gameServer is sent (with an outdated name). send the new when in game
805 this.mPlayernameHasToBeUpdated = true;
806 return;
807 }
808
809 if (this.mLocalActor != null)
810 {
811 this.mLocalActor.name = this.PlayerName;
812 Hashtable properties = new Hashtable();
813 properties[ActorProperties.PlayerName] = this.PlayerName;
814 if (this.mLocalActor.ID > 0)
815 {
816 this.OpSetPropertiesOfActor(this.mLocalActor.ID, properties, true, (byte)0);
817 this.mPlayernameHasToBeUpdated = false;
818 }
819 }
820 }
OpSetPropertiesOfActor 169 lượt xem
Gõ tìm kiếm nhanh...