GetInt









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

Featured Snippets


File name: DemoMecanimGUI.cs Copy
61     public void OnGUI()
62     {
63         GUI.skin = Skin;
64
65         string[] synchronizeTypeContent = new string[] { "Disabled", "Discrete", "Continuous" };
66
67         GUILayout.BeginArea( new Rect( Screen.width - 200 * m_FoundPlayerSlideIn - 400 * m_SlideIn, 0, 600, Screen.height ), GUI.skin.box );
68         {
69             GUILayout.Label( "Mecanim Demo", GUI.skin.customStyles[ 0 ] );
70
71             GUI.color = Color.white;
72             string label = "Settings";
73
74             if( m_IsOpen == true )
75             {
76                 label = "Close";
77             }
78
79             if( GUILayout.Button( label, GUILayout.Width( 110 ) ) )
80             {
81                 m_IsOpen = !m_IsOpen;
82             }
83
84             string parameters = "";
85
86             if( m_AnimatorView != null )
87             {
88                 parameters += "Send Values:\n";
89
90                 for( int i = 0; i < m_AnimatorView.GetSynchronizedParameters().Count; ++i )
91                 {
92                     PhotonAnimatorView.SynchronizedParameter parameter = m_AnimatorView.GetSynchronizedParameters()[ i ];
93
94                     try
95                     {
96                         switch( parameter.Type )
97                         {
98                         case PhotonAnimatorView.ParameterType.Bool:
99                             parameters += parameter.Name + " (" + ( m_AnimatorView.GetComponent().GetBool( parameter.Name ) ? "True" : "False" ) + ")\n";
100                             break;
101                         case PhotonAnimatorView.ParameterType.Int:
102                             parameters += parameter.Name + " (" + m_AnimatorView.GetComponent().GetInteger( parameter.Name ) + ")\n";
103                             break;
104                         case PhotonAnimatorView.ParameterType.Float:
105                             parameters += parameter.Name + " (" + m_AnimatorView.GetComponent().GetFloat( parameter.Name ).ToString( "0.00" ) + ")\n";
106                             break;
107                         }
108                     }
109                     catch
110                     {
111                         Debug.Log( "derrrr for " + parameter.Name );
112                     }
113                 }
114             }
115
116             if( m_RemoteAnimator != null )
117             {
118                 parameters += "\nReceived Values:\n";
119
120                 for( int i = 0; i < m_AnimatorView.GetSynchronizedParameters().Count; ++i )
121                 {
122                     PhotonAnimatorView.SynchronizedParameter parameter = m_AnimatorView.GetSynchronizedParameters()[ i ];
123
124                     try
125                     {
126                         switch( parameter.Type )
127                         {
128                         case PhotonAnimatorView.ParameterType.Bool:
129                             parameters += parameter.Name + " (" + ( m_RemoteAnimator.GetBool( parameter.Name ) ? "True" : "False" ) + ")\n";
130                             break;
131                         case PhotonAnimatorView.ParameterType.Int:
132                             parameters += parameter.Name + " (" + m_RemoteAnimator.GetInteger( parameter.Name ) + ")\n";
133                             break;
134                         case PhotonAnimatorView.ParameterType.Float:
135                             parameters += parameter.Name + " (" + m_RemoteAnimator.GetFloat( parameter.Name ).ToString( "0.00" ) + ")\n";
136                             break;
137                         }
138                     }
139                     catch
140                     {
141                         Debug.Log( "derrrr for " + parameter.Name );
142                     }
143                 }
144             }
145
146             GUIStyle style = new GUIStyle( GUI.skin.label );
147             style.alignment = TextAnchor.UpperLeft;
148
149             GUI.color = new Color( 1f, 1f, 1f, 1 - m_SlideIn );
150             GUI.Label( new Rect( 10, 100, 600, Screen.height ), parameters, style );
151
152             if( m_AnimatorView != null )
153             {
154                 GUI.color = new Color( 1f, 1f, 1f, m_SlideIn );
155
156                 GUILayout.Space( 20 );
157                 GUILayout.Label( "Synchronize Parameters" );
158
159                 for( int i = 0; i < m_AnimatorView.GetSynchronizedParameters().Count; ++i )
160                 {
161                     GUILayout.BeginHorizontal();
162                     {
163                         PhotonAnimatorView.SynchronizedParameter parameter = m_AnimatorView.GetSynchronizedParameters()[ i ];
164
165                         GUILayout.Label( parameter.Name, GUILayout.Width( 100 ), GUILayout.Height( 36 ) );
166
167                         int selectedValue = (int)parameter.SynchronizeType;
168                         int newValue = GUILayout.Toolbar( selectedValue, synchronizeTypeContent );
169
170                         if( newValue != selectedValue )
171                         {
172                             m_AnimatorView.SetParameterSynchronized( parameter.Name, parameter.Type, (PhotonAnimatorView.SynchronizeType)newValue );
173                         }
174                     }
175                     GUILayout.EndHorizontal();
176                 }
177             }
178         }
179         GUILayout.EndArea();
180     }
File name: PhotonTransformViewEditor.cs Copy
96     private void DrawSynchronizePositionData()
97     {
98         if (this.m_SynchronizePositionProperty == null || this.m_SynchronizePositionProperty.boolValue == false)
99         {
100             return;
101         }
102
103         SerializedProperty interpolatePositionProperty = serializedObject.FindProperty("m_PositionModel.InterpolateOption");
104         PhotonTransformViewPositionModel.InterpolateOptions interpolateOption = (PhotonTransformViewPositionModel.InterpolateOptions)interpolatePositionProperty.enumValueIndex;
105
106         SerializedProperty extrapolatePositionProperty = serializedObject.FindProperty("m_PositionModel.ExtrapolateOption");
107         PhotonTransformViewPositionModel.ExtrapolateOptions extrapolateOption = (PhotonTransformViewPositionModel.ExtrapolateOptions)extrapolatePositionProperty.enumValueIndex;
108
109         float containerHeight = 155;
110
111         switch (interpolateOption)
112         {
113             case PhotonTransformViewPositionModel.InterpolateOptions.FixedSpeed:
114             case PhotonTransformViewPositionModel.InterpolateOptions.Lerp:
115                 containerHeight += EDITOR_LINE_HEIGHT;
116                 break;
117             /*case PhotonTransformViewPositionModel.InterpolateOptions.MoveTowardsComplex:
118                 containerHeight += EDITOR_LINE_HEIGHT*3;
119                 break;*/
120         }
121
122         if (extrapolateOption != PhotonTransformViewPositionModel.ExtrapolateOptions.Disabled)
123         {
124             containerHeight += EDITOR_LINE_HEIGHT;
125         }
126
127         switch (extrapolateOption)
128         {
129             case PhotonTransformViewPositionModel.ExtrapolateOptions.FixedSpeed:
130                 containerHeight += EDITOR_LINE_HEIGHT;
131                 break;
132         }
133
134         if (this.m_InterpolateHelpOpen == true)
135         {
136             containerHeight += GetInterpolateHelpBoxHeight();
137         }
138
139         if (this.m_ExtrapolateHelpOpen == true)
140         {
141             containerHeight += GetExtrapolateHelpBoxHeight();
142         }
143
144         // removed Gizmo Options. -3 lines, -1 splitter
145         containerHeight -= EDITOR_LINE_HEIGHT * 2;
146
147         Rect rect = PhotonGUI.ContainerBody(containerHeight);
148
149         Rect propertyRect = new Rect(rect.xMin + 5, rect.yMin + 2, rect.width - 10, EditorGUIUtility.singleLineHeight);
150
151         DrawTeleport(ref propertyRect);
152         DrawSplitter(ref propertyRect);
153
154         DrawSynchronizePositionDataInterpolation(ref propertyRect, interpolatePositionProperty, interpolateOption);
155         DrawSplitter(ref propertyRect);
156
157         DrawSynchronizePositionDataExtrapolation(ref propertyRect, extrapolatePositionProperty, extrapolateOption);
158         DrawSplitter(ref propertyRect);
159
160         DrawSynchronizePositionDataGizmos(ref propertyRect);
161     }
File name: PhotonTransformViewEditor.cs Copy
163     private float GetInterpolateHelpBoxHeight()
164     {
165         return PhotonGUI.RichLabel.CalcHeight(new GUIContent(INTERPOLATE_HELP), Screen.width - 54) + 35;
166     }
File name: PhotonTransformViewEditor.cs Copy
264         PhotonTransformViewPositionModel.InterpolateOptions interpolateOption)
265     {
266         DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateHelpOpen, interpolatePositionProperty, INTERPOLATE_TOOLTIP);
267         DrawHelpBox(ref propertyRect, this.m_InterpolateHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);
268
269         switch (interpolateOption)
270         {
271             case PhotonTransformViewPositionModel.InterpolateOptions.FixedSpeed:
272                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsSpeed"),
273                     new GUIContent("MoveTowards Speed"));
274                 propertyRect.y += EDITOR_LINE_HEIGHT;
275                 break;
276
277             case PhotonTransformViewPositionModel.InterpolateOptions.Lerp:
278                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
279                 propertyRect.y += EDITOR_LINE_HEIGHT;
280                 break;
281
282             /*case PhotonTransformViewPositionModel.InterpolateOptions.MoveTowardsComplex:
283                 Rect curveRect = new Rect(propertyRect.xMin, propertyRect.yMin, propertyRect.width - 100, propertyRect.height);
284                 EditorGUI.PropertyField(curveRect, serializedObject.FindProperty("m_PositionModel.InterpolateSpeedCurve"), new GUIContent("MoveTowards Speed Curve"));
285
286                 Rect labelRect = new Rect(propertyRect.xMax - 95, propertyRect.yMin, 10, propertyRect.height);
287                 GUI.Label(labelRect, "x");
288
289                 Rect multiplierRect = new Rect(propertyRect.xMax - 80, propertyRect.yMin, 80, propertyRect.height);
290                 EditorGUI.PropertyField(multiplierRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsSpeed"), GUIContent.none);
291                 propertyRect.y += EDITOR_LINE_HEIGHT;
292
293                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsAcceleration"),
294                     new GUIContent("Acceleration"));
295                 propertyRect.y += EDITOR_LINE_HEIGHT;
296
297                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsDeceleration"),
298                     new GUIContent("Deceleration"));
299                 propertyRect.y += EDITOR_LINE_HEIGHT;
300                 break;*/
301         }
302     }
File name: PhotonTransformViewEditor.cs Copy
309     private void DrawSynchronizeRotationData()
310     {
311         if (this.m_SynchronizeRotationProperty == null || this.m_SynchronizeRotationProperty.boolValue == false)
312         {
313             return;
314         }
315
316         SerializedProperty interpolateRotationProperty = serializedObject.FindProperty("m_RotationModel.InterpolateOption");
317         PhotonTransformViewRotationModel.InterpolateOptions interpolateOption =
318             (PhotonTransformViewRotationModel.InterpolateOptions) interpolateRotationProperty.enumValueIndex;
319
320         float containerHeight = 20;
321
322         switch (interpolateOption)
323         {
324             case PhotonTransformViewRotationModel.InterpolateOptions.RotateTowards:
325             case PhotonTransformViewRotationModel.InterpolateOptions.Lerp:
326                 containerHeight += EDITOR_LINE_HEIGHT;
327                 break;
328         }
329
330         if (this.m_InterpolateRotationHelpOpen == true)
331         {
332             containerHeight += GetInterpolateHelpBoxHeight();
333         }
334
335         Rect rect = PhotonGUI.ContainerBody(containerHeight);
336         Rect propertyRect = new Rect(rect.xMin + 5, rect.yMin + 2, rect.width - 10, EditorGUIUtility.singleLineHeight);
337
338         DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateRotationHelpOpen, interpolateRotationProperty, INTERPOLATE_TOOLTIP);
339         DrawHelpBox(ref propertyRect, this.m_InterpolateRotationHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);
340
341         switch (interpolateOption)
342         {
343             case PhotonTransformViewRotationModel.InterpolateOptions.RotateTowards:
344                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_RotationModel.InterpolateRotateTowardsSpeed"),
345                     new GUIContent("RotateTowards Speed"));
346                 break;
347             case PhotonTransformViewRotationModel.InterpolateOptions.Lerp:
348                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_RotationModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
349                 break;
350         }
351     }
File name: PhotonTransformViewEditor.cs Copy
358     private void DrawSynchronizeScaleData()
359     {
360         if (this.m_SynchronizeScaleProperty == null || this.m_SynchronizeScaleProperty.boolValue == false)
361         {
362             return;
363         }
364
365         SerializedProperty interpolateScaleProperty = serializedObject.FindProperty("m_ScaleModel.InterpolateOption");
366         PhotonTransformViewScaleModel.InterpolateOptions interpolateOption = (PhotonTransformViewScaleModel.InterpolateOptions) interpolateScaleProperty.enumValueIndex;
367
368         float containerHeight = EDITOR_LINE_HEIGHT;
369
370         switch (interpolateOption)
371         {
372             case PhotonTransformViewScaleModel.InterpolateOptions.MoveTowards:
373             case PhotonTransformViewScaleModel.InterpolateOptions.Lerp:
374                 containerHeight += EDITOR_LINE_HEIGHT;
375                 break;
376         }
377
378         if (this.m_InterpolateScaleHelpOpen == true)
379         {
380             containerHeight += GetInterpolateHelpBoxHeight();
381         }
382
383         Rect rect = PhotonGUI.ContainerBody(containerHeight);
384         Rect propertyRect = new Rect(rect.xMin + 5, rect.yMin + 2, rect.width - 10, EditorGUIUtility.singleLineHeight);
385
386         DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateScaleHelpOpen, interpolateScaleProperty, INTERPOLATE_TOOLTIP);
387         DrawHelpBox(ref propertyRect, this.m_InterpolateScaleHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);
388
389         switch (interpolateOption)
390         {
391             case PhotonTransformViewScaleModel.InterpolateOptions.MoveTowards:
392                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_ScaleModel.InterpolateMoveTowardsSpeed"),
393                     new GUIContent("MoveTowards Speed"));
394                 break;
395             case PhotonTransformViewScaleModel.InterpolateOptions.Lerp:
396                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_ScaleModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
397                 break;
398         }
399     }
File name: PhotonAnimatorView.cs Copy
234     void SerializeDataContinuously()
235     {
236         if( m_Animator == null )
237         {
238             return;
239         }
240
241         for( int i = 0; i < m_SynchronizeLayers.Count; ++i )
242         {
243             if( m_SynchronizeLayers[ i ].SynchronizeType == SynchronizeType.Continuous )
244             {
245                 m_StreamQueue.SendNext( m_Animator.GetLayerWeight( m_SynchronizeLayers[ i ].LayerIndex ) );
246             }
247         }
248
249         for( int i = 0; i < m_SynchronizeParameters.Count; ++i )
250         {
251             SynchronizedParameter parameter = m_SynchronizeParameters[ i ];
252
253             if( parameter.SynchronizeType == SynchronizeType.Continuous )
254             {
255
256                 switch( parameter.Type )
257                 {
258                 case ParameterType.Bool:
259                     m_StreamQueue.SendNext( m_Animator.GetBool( parameter.Name ) );
260                     break;
261                 case ParameterType.Float:
262                     m_StreamQueue.SendNext( m_Animator.GetFloat( parameter.Name ) );
263                     break;
264                 case ParameterType.Int:
265                     m_StreamQueue.SendNext( m_Animator.GetInteger( parameter.Name ) );
266                     break;
267                 case ParameterType.Trigger:
268
269                     break;
270                 }
271             }
272         }
273     }
File name: PhotonAnimatorView.cs Copy
315     void SerializeDataDiscretly( PhotonStream stream )
316     {
317         for( int i = 0; i < m_SynchronizeLayers.Count; ++i )
318         {
319             if( m_SynchronizeLayers[ i ].SynchronizeType == SynchronizeType.Discrete )
320             {
321                 stream.SendNext( m_Animator.GetLayerWeight( m_SynchronizeLayers[ i ].LayerIndex ) );
322             }
323         }
324
325         for( int i = 0; i < m_SynchronizeParameters.Count; ++i )
326         {
327             SynchronizedParameter parameter = m_SynchronizeParameters[ i ];
328
329             if( parameter.SynchronizeType == SynchronizeType.Discrete )
330             {
331                 switch( parameter.Type )
332                 {
333                 case ParameterType.Bool:
334                     stream.SendNext( m_Animator.GetBool( parameter.Name ) );
335                     break;
336                 case ParameterType.Float:
337                     stream.SendNext( m_Animator.GetFloat( parameter.Name ) );
338                     break;
339                 case ParameterType.Int:
340                     stream.SendNext( m_Animator.GetInteger( parameter.Name ) );
341                     break;
342                 case ParameterType.Trigger:
343
344                     break;
345                 }
346             }
347         }
348     }
File name: NetworkingPeer.cs Copy
82     {
83         get
84         {
85             if (this.mRoomToGetInto != null && this.mRoomToGetInto.isLocalClientInside)
86             {
87                 return this.mRoomToGetInto;
88             }
89
90             return null;
91         }
92     }
File name: NetworkingPeer.cs Copy
97     internal Room mRoomToGetInto { get; set; }

GetInt 115 lượt xem

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