RemoveFromRoomCache









How do I use Remove From Room Cache
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: NetworkingPeer.cs Copy
2592     private void ServerCleanInstantiateAndDestroy(int instantiateId, int creatorId, bool isRuntimeInstantiated)
2593     {
2594         Hashtable removeFilter = new Hashtable();
2595         removeFilter[(byte)7] = instantiateId;
2596
2597         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache, TargetActors = new int[] { creatorId } };
2598         this.OpRaiseEvent(PunEvent.Instantiation, removeFilter, true, options);
2599         //this.OpRaiseEvent(PunEvent.Instantiation, removeFilter, true, 0, new int[] { actorNr }, EventCaching.RemoveFromRoomCache);
2600
2601         Hashtable evData = new Hashtable();
2602         evData[(byte)0] = instantiateId;
2603         options = null;
2604         if (!isRuntimeInstantiated)
2605         {
2606             // if the view got loaded with the scene, the EvDestroy must be cached (there is no Instantiate-msg which we can remove)
2607             // reason: joining players will load the obj and have to destroy it (too)
2608             options = new RaiseEventOptions();
2609             options.CachingOption = EventCaching.AddToRoomCacheGlobal;
2610             Debug.Log("Destroying GO as global. ID: " + instantiateId);
2611         }
2612         this.OpRaiseEvent(PunEvent.Destroy, evData, true, options);
2613     }
File name: NetworkingPeer.cs Copy
2634     private void OpRemoveFromServerInstantiationsOfPlayer(int actorNr)
2635     {
2636         // removes all "Instantiation" events of player actorNr. this is not an event for anyone else
2637         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache, TargetActors = new int[] { actorNr } };
2638         this.OpRaiseEvent(PunEvent.Instantiation, null, true, options);
2639         //this.OpRaiseEvent(PunEvent.Instantiation, null, true, 0, new int[] { actorNr }, EventCaching.RemoveFromRoomCache);
2640     }
File name: NetworkingPeer.cs Copy
2754     public void OpCleanRpcBuffer(int actorNumber)
2755     {
2756         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache, TargetActors = new int[] { actorNumber } };
2757         this.OpRaiseEvent(PunEvent.RPC, null, true, options);
2758         //this.OpRaiseEvent(PunEvent.RPC, null, true, 0, new int[] { actorNumber }, EventCaching.RemoveFromRoomCache);
2759     }
File name: NetworkingPeer.cs Copy
2765     public void OpRemoveCompleteCacheOfPlayer(int actorNumber)
2766     {
2767         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache, TargetActors = new int[] { actorNumber } };
2768         this.OpRaiseEvent(0, null, true, options);
2769         //this.OpRaiseEvent(0, null, true, 0, new int[] { actorNumber }, EventCaching.RemoveFromRoomCache);
2770     }
File name: NetworkingPeer.cs Copy
2773     public void OpRemoveCompleteCache()
2774     {
2775         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache, Receivers = ReceiverGroup.MasterClient };
2776         this.OpRaiseEvent(0, null, true, options);
2777         //this.OpRaiseEvent(0, null, true, 0, EventCaching.RemoveFromRoomCache, ReceiverGroup.MasterClient); // TODO: check who gets this event?
2778     }
File name: NetworkingPeer.cs Copy
2780     /// This clears the cache of any player/actor who's no longer in the room (making it a simple clean-up option for a new master)
2781     private void RemoveCacheOfLeftPlayers()
2782     {
2783         Dictionary opParameters = new Dictionary();
2784         opParameters[ParameterCode.Code] = (byte)0; // any event
2785         opParameters[ParameterCode.Cache] = (byte)EventCaching.RemoveFromRoomCacheForActorsLeft; // option to clear the room cache of all events of players who left
2786
2787         this.OpCustom((byte)OperationCode.RaiseEvent, opParameters, true, 0);
2788     }
File name: NetworkingPeer.cs Copy
2803     public void OpCleanRpcBuffer(PhotonView view)
2804     {
2805         Hashtable rpcFilterByViewId = new Hashtable();
2806         rpcFilterByViewId[(byte)0] = view.viewID;
2807
2808         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache };
2809         this.OpRaiseEvent(PunEvent.RPC, rpcFilterByViewId, true, options);
2810         //this.OpRaiseEvent(PunEvent.RPC, rpcFilterByViewId, true, 0, EventCaching.RemoveFromRoomCache, ReceiverGroup.Others);
2811     }

RemoveFromRoomCache 265 lượt xem

Gõ tìm kiếm nhanh...