Unsupported









How do I use Unsupported
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: NetworkingPeer.cs Copy
2890     /// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
2891     /// (byte)1 -> (short) prefix (level)
2895     /// (byte)5 -> (byte) method shortcut (alternative to name)
2899     internal void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
2900     {
2901         if (this.blockSendingGroups.Contains(view.group))
2902         {
2903             return; // Block sending on this group
2904         }
2905
2906         if (view.viewID < 1)
2907         {
2908             Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
2909         }
2910
2911         if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
2912             Debug.Log("Sending RPC \"" + methodName + "\" to " + target);
2913
2914
2915         //ts: changed RPCs to a one-level hashtable as described in internal.txt
2916         Hashtable rpcEvent = new Hashtable();
2917         rpcEvent[(byte)0] = (int)view.viewID; // LIMITS NETWORKVIEWS&PLAYERS
2918         if (view.prefix > 0)
2919         {
2920             rpcEvent[(byte)1] = (short)view.prefix;
2921         }
2922         rpcEvent[(byte)2] = this.ServerTimeInMilliSeconds;
2923
2924
2925         // send name or shortcut (if available)
2926         int shortcut = 0;
2927         if (rpcShortcuts.TryGetValue(methodName, out shortcut))
2928         {
2929             rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
2930         }
2931         else
2932         {
2933             rpcEvent[(byte)3] = methodName;
2934         }
2935
2936         if (parameters != null && parameters.Length > 0)
2937         {
2938             rpcEvent[(byte)4] = (object[])parameters;
2939         }
2940
2941         // Check scoping
2942         if (target == PhotonTargets.All)
2943         {
2944             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Encrypt = encrypt };
2945             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2946
2947             // Execute local
2948             this.ExecuteRPC(rpcEvent, this.mLocalActor);
2949         }
2950         else if (target == PhotonTargets.Others)
2951         {
2952             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Encrypt = encrypt };
2953             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2954         }
2955         else if (target == PhotonTargets.AllBuffered)
2956         {
2957             RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
2958             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2959
2960             // Execute local
2961             this.ExecuteRPC(rpcEvent, this.mLocalActor);
2962         }
2963         else if (target == PhotonTargets.OthersBuffered)
2964         {
2965             RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
2966             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2967         }
2968         else if (target == PhotonTargets.MasterClient)
2969         {
2970             if (this.mMasterClient == this.mLocalActor)
2971             {
2972                 this.ExecuteRPC(rpcEvent, this.mLocalActor);
2973             }
2974             else
2975             {
2976                 RaiseEventOptions options = new RaiseEventOptions() { Receivers = ReceiverGroup.MasterClient, Encrypt = encrypt };
2977                 this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2978             }
2979         }
2980         else if (target == PhotonTargets.AllViaServer)
2981         {
2982             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Receivers = ReceiverGroup.All, Encrypt = encrypt };
2983             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2984             if (PhotonNetwork.offlineMode)
2985             {
2986                 this.ExecuteRPC(rpcEvent, this.mLocalActor);
2987             }
2988         }
2989         else if (target == PhotonTargets.AllBufferedViaServer)
2990         {
2991             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Receivers = ReceiverGroup.All, CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
2992             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2993             if (PhotonNetwork.offlineMode)
2994             {
2995                 this.ExecuteRPC(rpcEvent, this.mLocalActor);
2996             }
2997         }
2998         else
2999         {
3000             Debug.LogError("Unsupported target enum: " + target);
3001         }
3002     }
File name: AnimationBuilder.cs Copy
112         private void MakeAnimationCurves(GameObject root, AnimationClip animClip, Animation animation)
113         {
114             acb = new AnimationCurveBuilder();
115
116             //Get a list of all sprites on this GO
117             var allSprites = root.GetComponentsInChildren(true).Select(sr => AnimationUtility.CalculateTransformPath(sr.transform, root.transform));
118
119             //Add a key for all objects on the first frame
120             SetGameObjectForKey(root, animClip, animation.MainlineKeys.First(), 0);
121
122             foreach (var mainlineKey in animation.MainlineKeys)
123             {
124
125                 var visibleSprites = SetGameObjectForKey(root, animClip, mainlineKey);
126                 var hiddenSprites = allSprites.Except(visibleSprites);
127                 HideSprites(root, hiddenSprites, mainlineKey.Time);
128             }
129
130             switch (animation.LoopType)
131             {
132                 case LoopType.True:
133                     //Cycle back to first frame
134                     SetGameObjectForKey(root, animClip, animation.MainlineKeys.First(), animation.Length);
135                     break;
136                 case LoopType.False:
137                     //Duplicate the last key at the end time of the animation
138                     SetGameObjectForKey(root, animClip, animation.MainlineKeys.Last(), animation.Length);
139                     break;
140                 default:
141                     Debug.LogWarning("Unsupported loop type: " + animation.LoopType.ToString());
142                     break;
143             }
144
145             //Add the curves to our animation clip
146             //NOTE: This MUST be done before modifying the settings, thus the double switch statement
147             acb.AddCurves(animClip);
148
149             foreach (var sprite in spriteChangeKeys)
150             {
151                 if (sprite.Value.Count > 0)
152                 {
153                     BuildSpriteChangeCurve(ref animClip, sprite);
154                 }
155             }
156
157             //Set the loop/wrap settings for the animation clip
158             var animSettings = AnimationUtility.GetAnimationClipSettings(animClip);
159             switch(animation.LoopType)
160             {
161                 case LoopType.True:
162                     animClip.wrapMode = WrapMode.Loop;
163                     animSettings.loopTime = true;
164                     break;
165                 case LoopType.False:
166                     animClip.wrapMode = WrapMode.ClampForever;
167                     break;
168                 case LoopType.PingPong:
169                     animClip.wrapMode = WrapMode.PingPong;
170                     animSettings.loopTime = true;
171                     break;
172                 default:
173                     Debug.LogWarning("Unsupported loop type: " + animation.LoopType.ToString());
174                     break;
175             }
176
177             animClip.SetAnimationSettings(animSettings);
178
179             //Debug.Log(string.Format("Setting animation {0} to {1} loop mode (WrapMode:{2} LoopTime:{3}) ", animClip.name, animation.LoopType, animClip.wrapMode, animSettings.loopTime));
180         }

Unsupported 128 lượt xem

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