public static string GetMessage(string failureMessage, string expected)
 {
     object[] args = new object[] { failureMessage, Environment.NewLine, "Expected:", expected };
     return(GetMessage(UnityString.Format("{0}{1}{2} {3}", args)));
 }
Exemple #2
0
 public override string ToString()
 {
     return(UnityString.Format("Origin: {0}, Dir: {1}", (object)this.m_Origin, (object)this.m_Direction));
 }
Exemple #3
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-networkId:0x{1},name:{2},averageEloScore:{3},maxSize:{4},currentSize:{5},isPrivate:{6},matchAttributes.Count:{7},directConnectInfos.Count:{8}", base.ToString(), networkId.ToString("X"), name, averageEloScore, maxSize, currentSize, isPrivate, (matchAttributes != null) ? matchAttributes.Count : 0, directConnectInfos.Count));
 }
        public override string GetInfoString()
        {
            // TextureInspector code is reused for RenderTexture and Cubemap inspectors.
            // Make sure we can handle the situation where target is just a Texture and
            // not a Texture2D.
            Texture         t  = target as Texture;
            Texture2D       t2 = target as Texture2D;
            TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(t)) as TextureImporter;
            string          info            = t.width + "x" + t.height;

            bool           showSize              = true;
            bool           isPackedSprite        = textureImporter && textureImporter.qualifiesForSpritePacking;
            bool           isNormalmap           = IsNormalMap(t);
            bool           stillNeedsCompression = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(t));
            bool           isNPOT = t2 != null && TextureUtil.IsNonPowerOfTwo(t2);
            GraphicsFormat format = t.graphicsFormat;

            showSize = !stillNeedsCompression;
            if (isNPOT)
            {
                info += " (NPOT)";
            }
            if (stillNeedsCompression)
            {
                info += " (Not yet compressed)";
            }
            else
            {
                if (isNormalmap)
                {
                    switch (format)
                    {
                    case GraphicsFormat.RGBA_DXT5_SRGB:
                    case GraphicsFormat.RGBA_DXT5_UNorm:
                        info += "  DXTnm";
                        break;

                    case GraphicsFormat.R8G8B8A8_SRGB:
                    case GraphicsFormat.R8G8B8A8_UNorm:
                    case GraphicsFormat.B8G8R8A8_SRGB:
                    case GraphicsFormat.B8G8R8A8_UNorm:
                        info += "  Nm 32 bit";
                        break;

                    case GraphicsFormat.R4G4B4A4_UNormPack16:
                    case GraphicsFormat.B4G4R4A4_UNormPack16:
                        info += "  Nm 16 bit";
                        break;

                    default:
                        info += "  " + GraphicsFormatUtility.GetFormatString(format);
                        break;
                    }
                }
                else if (isPackedSprite)
                {
                    TextureFormat desiredFormat;
                    ColorSpace    dummyColorSpace;
                    int           dummyComressionQuality;
                    textureImporter.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out desiredFormat, out dummyColorSpace, out dummyComressionQuality);

                    info += "\n " + GraphicsFormatUtility.GetFormatString(format) + "(Original) " + TextureUtil.GetTextureFormatString(desiredFormat) + "(Atlas)";
                }
                else
                {
                    info += "  " + GraphicsFormatUtility.GetFormatString(format);
                }
            }

            if (showSize)
            {
                info += "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySizeLong(t));
            }

            if (TextureUtil.GetUsageMode(t) == TextureUsageMode.AlwaysPadded)
            {
                var glWidth  = TextureUtil.GetGPUWidth(t);
                var glHeight = TextureUtil.GetGPUHeight(t);
                if (t.width != glWidth || t.height != glHeight)
                {
                    info += UnityString.Format("\nPadded to {0}x{1}", glWidth, glHeight);
                }
            }
            else if (TextureUtil.GetUsageMode(t) == TextureUsageMode.BakedLightmapRGBM ||
                     TextureUtil.GetUsageMode(t) == TextureUsageMode.RealtimeLightmapRGBM ||
                     TextureUtil.GetUsageMode(t) == TextureUsageMode.RGBMEncoded)
            {
                info += "\nRGBM encoded";
            }
            else if (TextureUtil.GetUsageMode(t) == TextureUsageMode.DoubleLDR ||
                     TextureUtil.GetUsageMode(t) == TextureUsageMode.BakedLightmapDoubleLDR)
            {
                info += "\ndLDR encoded";
            }

            return(info);
        }
Exemple #5
0
 public override string ToString()
 {
     object[] args = new object[] { base.ToString(), this.name, this.size, this.publicAddress, this.privateAddress, this.eloScore, this.advertise, !string.IsNullOrEmpty(this.password) ? "YES" : "NO", (this.matchAttributes != null) ? this.matchAttributes.Count : 0 };
     return(UnityString.Format("[{0}]-name:{1},size:{2},publicAddress:{3},privateAddress:{4},eloScore:{5},advertise:{6},HasPassword:{7},matchAttributes.Count:{8}", args));
 }
 public override string ToString()
 {
     return(UnityString.Format("{0} @ {1}:{2} [{3},{4}]", networkId, address, port, nodeId, usingRelay));
 }
Exemple #7
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-address:{1},port:{2},networkId:0x{3},nodeId:0x{4},usingRelay:{5}", base.ToString(), address, port, networkId.ToString("X"), nodeId.ToString("X"), usingRelay));
 }
 public override string ToString()
 {
     return(UnityString.Format("{{ guid: {0}, fileID: {1}, type: {2}, path: {3}}}", m_GUID, m_LocalIdentifierInFile, m_FileType, m_FilePath));
 }
Exemple #9
0
        void CalculateRects(VisualElement container)
        {
            if (graphView == null)
            {
                // Nothing to do in this case.
                return;
            }

            m_ContentRect      = graphView.CalculateRectToFitAll(container);
            m_ContentRectLocal = m_ContentRect;

            // Retrieve viewport rectangle as if zoom and pan were inactive
            Matrix4x4 containerInvTransform   = container.worldTransformInverse;
            Vector4   containerInvTranslation = containerInvTransform.GetColumn(3);
            var       containerInvScale       = new Vector2(containerInvTransform.m00, containerInvTransform.m11);

            m_ViewportRect = graphView.rect;

            // Bring back viewport coordinates to (0,0), scale 1:1
            m_ViewportRect.x += containerInvTranslation.x;
            m_ViewportRect.y += containerInvTranslation.y;

            var graphViewWB = graphView.worldBound;

            m_ViewportRect.x      += graphViewWB.x * containerInvScale.x;
            m_ViewportRect.y      += graphViewWB.y * containerInvScale.y;
            m_ViewportRect.width  *= containerInvScale.x;
            m_ViewportRect.height *= containerInvScale.y;

            // Update label with new value
            var containerZoomFactor = container.worldTransform.m00;

            SetZoomFactorText(UnityString.Format("{0:F2}", containerZoomFactor) + "x");

            // Adjust rects for MiniMap
            float effectiveWidth  = layout.width - 1;
            float effectiveHeight = layout.height - 1;

            // Encompass viewport rectangle (as if zoom and pan were inactive)
            var totalRect     = RectUtils.Encompass(m_ContentRect, m_ViewportRect);
            var minimapFactor = effectiveWidth / totalRect.width;

            // Transform each rect to MiniMap coordinates
            ChangeToMiniMapCoords(ref totalRect, minimapFactor, Vector3.zero);

            var minimapTranslation = new Vector3(-totalRect.x, titleBarOffset - totalRect.y);

            ChangeToMiniMapCoords(ref m_ViewportRect, minimapFactor, minimapTranslation);
            ChangeToMiniMapCoords(ref m_ContentRect, minimapFactor, minimapTranslation);

            // Diminish and center everything to fit vertically
            if (totalRect.height > (effectiveHeight - titleBarOffset))
            {
                float totalRectFactor  = (effectiveHeight - titleBarOffset) / totalRect.height;
                float totalRectOffsetX = (effectiveWidth - (totalRect.width * totalRectFactor)) / 2.0f;
                float totalRectOffsetY = titleBarOffset - ((totalRect.y + minimapTranslation.y) * totalRectFactor);

                m_ContentRect.width  *= totalRectFactor;
                m_ContentRect.height *= totalRectFactor;
                m_ContentRect.x      *= totalRectFactor;
                m_ContentRect.y      *= totalRectFactor;
                m_ContentRect.x      += totalRectOffsetX;
                m_ContentRect.y      += totalRectOffsetY;

                m_ViewportRect.width  *= totalRectFactor;
                m_ViewportRect.height *= totalRectFactor;
                m_ViewportRect.x      *= totalRectFactor;
                m_ViewportRect.y      *= totalRectFactor;
                m_ViewportRect.x      += totalRectOffsetX;
                m_ViewportRect.y      += totalRectOffsetY;
            }
        }
Exemple #10
0
 public override string ToString()
 {
     return(UnityString.Format("Type {0} NameID {1} InstanceID {2}", m_Type, m_NameID, m_InstanceID));
 }
Exemple #11
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-networkId:0x{1},nodeId:0x{2}", base.ToString(), networkId.ToString("X"), nodeId.ToString("X")));
 }
Exemple #12
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-name:{1},size:{2},advertise:{3},HasPassword:{4},matchAttributes.Count:{5}", base.ToString(), name, size, advertise, (!(password == string.Empty)) ? "YES" : "NO", (matchAttributes != null) ? matchAttributes.Count : 0));
 }
 public override string ToString() { return UnityString.Format("({0}x{1}) {2}", width, height, description); }
 public static string NullFailureMessage(object value, bool expectNull)
 {
     object[] args      = new object[] { !expectNull ? "" : "not " };
     object[] objArray2 = new object[] { !expectNull ? "not " : "" };
     return(GetMessage(UnityString.Format("Value was {0}Null", args), UnityString.Format("Value was {0}Null", objArray2)));
 }
        /**
         *  Static function to handle the GUI and User input related to the cascade slider.
         *
         *  @param  normalizedCascadePartition      The array of partition sizes in the range 0.0f - 1.0f; expects ONE entry if cascades = 2, and THREE if cascades=4
         *                                          The last entry will be automatically determined by summing up the array, and doing 1.0f - sum
         */
        public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
        {
            GUILayout.Label("Cascade splits");

            // get the inspector width since we need it while drawing the partition rects.
            // Only way currently is to reserve the block in the layout using GetRect(), and then immediately drawing the empty box
            // to match the call to GetRect.
            // From this point on, we move to non-layout based code.
            var sliderRect = GUILayoutUtility.GetRect(GUIContent.none
                                                      , s_CascadeSliderBG
                                                      , GUILayout.Height(kSliderbarTopMargin + kSliderbarHeight + kSliderbarBottomMargin)
                                                      , GUILayout.ExpandWidth(true));

            GUI.Box(sliderRect, GUIContent.none);

            float currentX            = sliderRect.x;
            float cascadeBoxStartY    = sliderRect.y + kSliderbarTopMargin;
            float cascadeSliderWidth  = sliderRect.width - (normalizedCascadePartitions.Length * kPartitionHandleWidth);
            Color origTextColor       = GUI.color;
            Color origBackgroundColor = GUI.backgroundColor;
            int   colorIndex          = -1;

            // setup the array locally with the last partition
            float[] adjustedCascadePartitions = new float[normalizedCascadePartitions.Length + 1];
            Array.Copy(normalizedCascadePartitions, adjustedCascadePartitions, normalizedCascadePartitions.Length);
            adjustedCascadePartitions[adjustedCascadePartitions.Length - 1] = 1.0f - normalizedCascadePartitions.Sum();


            // check for user input on any of the partition handles
            // this mechanism gets the current event in the queue... make sure that the mouse is over our control before consuming the event
            int   sliderControlId         = GUIUtility.GetControlID(s_CascadeSliderId, FocusType.Passive);
            Event currentEvent            = Event.current;
            int   hotPartitionHandleIndex = -1; // the index of any partition handle that we are hovering over or dragging

            // draw each cascade partition
            for (int i = 0; i < adjustedCascadePartitions.Length; ++i)
            {
                float currentPartition = adjustedCascadePartitions[i];

                colorIndex          = (colorIndex + 1) % kCascadeColors.Length;
                GUI.backgroundColor = kCascadeColors[colorIndex];
                float boxLength = (cascadeSliderWidth * currentPartition);

                // main cascade box
                Rect partitionRect = new Rect(currentX, cascadeBoxStartY, boxLength, kSliderbarHeight);
                GUI.Box(partitionRect, GUIContent.none, s_CascadeSliderBG);
                currentX += boxLength;

                // cascade box percentage text
                GUI.color = Color.white;
                Rect textRect    = partitionRect;
                var  cascadeText = UnityString.Format("{0}\n{1:F1}%", i, currentPartition * 100.0f);

                GUI.Label(textRect, GUIContent.Temp(cascadeText, cascadeText), s_TextCenteredStyle);

                // no need to draw the partition handle for last box
                if (i == adjustedCascadePartitions.Length - 1)
                {
                    break;
                }

                // partition handle
                GUI.backgroundColor = Color.black;
                Rect handleRect = partitionRect;
                handleRect.x     = currentX;
                handleRect.width = kPartitionHandleWidth;
                GUI.Box(handleRect, GUIContent.none, s_CascadeSliderBG);
                // we want a thin handle visually (since wide black bar looks bad), but a slightly larger
                // hit area for easier manipulation
                Rect handleHitRect = handleRect;
                handleHitRect.xMin -= kPartitionHandleExtraHitAreaWidth;
                handleHitRect.xMax += kPartitionHandleExtraHitAreaWidth;
                if (handleHitRect.Contains(currentEvent.mousePosition))
                {
                    hotPartitionHandleIndex = i;
                }

                // add regions to slider where the cursor changes to Resize-Horizontal
                if (s_DragCache == null)
                {
                    EditorGUIUtility.AddCursorRect(handleHitRect, MouseCursor.ResizeHorizontal, sliderControlId);
                }

                currentX += kPartitionHandleWidth;
            }

            GUI.color           = origTextColor;
            GUI.backgroundColor = origBackgroundColor;

            EventType eventType = currentEvent.GetTypeForControl(sliderControlId);

            switch (eventType)
            {
            case EventType.MouseDown:
                if (hotPartitionHandleIndex >= 0)
                {
                    s_DragCache = new DragCache(hotPartitionHandleIndex, normalizedCascadePartitions[hotPartitionHandleIndex], currentEvent.mousePosition);
                    if (GUIUtility.hotControl == 0)
                    {
                        GUIUtility.hotControl = sliderControlId;
                    }
                    currentEvent.Use();

                    // Switch active scene view into shadow cascades visualization mode, once we start
                    // tweaking cascade splits.
                    if (s_RestoreSceneView == null)
                    {
                        s_RestoreSceneView = SceneView.lastActiveSceneView;
                        if (s_RestoreSceneView != null)
                        {
                            s_OldSceneDrawMode            = s_RestoreSceneView.cameraMode;
                            s_OldSceneLightingMode        = s_RestoreSceneView.sceneLighting;
                            s_RestoreSceneView.cameraMode = SceneView.GetBuiltinCameraMode(DrawCameraMode.ShadowCascades);
                        }
                    }
                }
                break;

            case EventType.MouseUp:
                // mouseUp event anywhere should release the hotcontrol (if it belongs to us), drags (if any)
                if (GUIUtility.hotControl == sliderControlId)
                {
                    GUIUtility.hotControl = 0;
                    currentEvent.Use();
                }
                s_DragCache = null;

                // Restore previous scene view drawing mode once we stop tweaking cascade splits.
                if (s_RestoreSceneView != null)
                {
                    s_RestoreSceneView.cameraMode    = s_OldSceneDrawMode;
                    s_RestoreSceneView.sceneLighting = s_OldSceneLightingMode;
                    s_RestoreSceneView = null;
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl != sliderControlId)
                {
                    break;
                }

                // convert the mouse movement to normalized cascade width. Make sure that we are safe to apply the delta before using it.
                float delta = (currentEvent.mousePosition - s_DragCache.m_LastCachedMousePosition).x / cascadeSliderWidth;
                bool  isLeftPartitionHappy  = ((adjustedCascadePartitions[s_DragCache.m_ActivePartition] + delta) > 0.0f);
                bool  isRightPartitionHappy = ((adjustedCascadePartitions[s_DragCache.m_ActivePartition + 1] - delta) > 0.0f);
                if (isLeftPartitionHappy && isRightPartitionHappy)
                {
                    s_DragCache.m_NormalizedPartitionSize += delta;
                    normalizedCascadePartitions[s_DragCache.m_ActivePartition] = s_DragCache.m_NormalizedPartitionSize;
                    if (s_DragCache.m_ActivePartition < normalizedCascadePartitions.Length - 1)
                    {
                        normalizedCascadePartitions[s_DragCache.m_ActivePartition + 1] -= delta;
                    }
                    GUI.changed = true;
                }
                s_DragCache.m_LastCachedMousePosition = currentEvent.mousePosition;
                currentEvent.Use();
                break;
            }
        }
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-nodeId:{1},publicAddress:{2},privateAddress:{3}", (object)base.ToString(), (object)this.nodeId, (object)this.publicAddress, (object)this.privateAddress));
 }
Exemple #17
0
 public override string ToString()
 {
     object[] args = new object[] { base.ToString(), this.networkId.ToString("X"), this.nodeId.ToString("X") };
     return(UnityString.Format("[{0}]-networkId:0x{1},nodeId:0x{2}", args));
 }
        private void ShowLODGUI()
        {
            m_ShowSmoothLODOptions.target      = m_EnableSmoothLOD.hasMultipleDifferentValues || m_EnableSmoothLOD.boolValue;
            m_ShowCrossFadeWidthOptions.target = m_AnimateCrossFading.hasMultipleDifferentValues || !m_AnimateCrossFading.boolValue;

            GUILayout.Label(Styles.LODHeader, EditorStyles.boldLabel);

            EditorGUILayout.PropertyField(m_EnableSmoothLOD, Styles.SmoothLOD);

            EditorGUI.indentLevel++;
            if (EditorGUILayout.BeginFadeGroup(m_ShowSmoothLODOptions.faded))
            {
                EditorGUILayout.PropertyField(m_AnimateCrossFading, Styles.AnimateCrossFading);
                if (EditorGUILayout.BeginFadeGroup(m_ShowCrossFadeWidthOptions.faded))
                {
                    EditorGUILayout.Slider(m_BillboardTransitionCrossFadeWidth, 0.0f, 1.0f, Styles.CrossFadeWidth);
                    EditorGUILayout.Slider(m_FadeOutWidth, 0.0f, 1.0f, Styles.FadeOutWidth);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;

            EditorGUILayout.Space();
            if (HasSameLODConfig())
            {
                EditorGUILayout.Space();

                var area = GUILayoutUtility.GetRect(0, LODGroupGUI.kSliderBarHeight, GUILayout.ExpandWidth(true));
                var lods = GetLODInfoArray(area);
                DrawLODLevelSlider(area, lods);

                EditorGUILayout.Space();
                EditorGUILayout.Space();

                if (m_SelectedLODRange != -1 && lods.Count > 0)
                {
                    EditorGUILayout.LabelField(lods[m_SelectedLODRange].LODName + " Options", EditorStyles.boldLabel);
                    bool isBillboard = (m_SelectedLODRange == lods.Count - 1) && importers.First().hasBillboard;

                    EditorGUILayout.PropertyField(m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("castShadows"), Styles.CastShadows);
                    EditorGUILayout.PropertyField(m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("receiveShadows"), Styles.ReceiveShadows);

                    var useLightProbes = m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("useLightProbes");
                    EditorGUILayout.PropertyField(useLightProbes, Styles.UseLightProbes);
                    if (!useLightProbes.hasMultipleDifferentValues && useLightProbes.boolValue && isBillboard)
                    {
                        EditorGUILayout.HelpBox("Enabling Light Probe for billboards breaks batched rendering and may cause performance problem.", MessageType.Warning);
                    }

                    // TODO: reflection probe support when PBS is implemented
                    //EditorGUILayout.PropertyField(m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("useReflectionProbes"), Styles.UseReflectionProbes);

                    EditorGUILayout.PropertyField(m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("enableBump"), Styles.EnableBump);
                    EditorGUILayout.PropertyField(m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("enableHue"), Styles.EnableHue);

                    if (m_AllAreV8)
                    {
                        EditorGUILayout.PropertyField(m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("enableSubsurface"), Styles.EnableSubsurface);
                    }

                    int bestWindQuality = importers.Min(im => im.bestWindQuality);
                    if (bestWindQuality > 0)
                    {
                        if (isBillboard)
                        {
                            bestWindQuality = bestWindQuality >= 1 ? 1 : 0; // billboard has only one level of wind quality
                        }
                        EditorGUILayout.Popup(
                            m_LODSettings.GetArrayElementAtIndex(m_SelectedLODRange).FindPropertyRelative("windQuality"),
                            SpeedTreeImporter.windQualityNames.Take(bestWindQuality + 1).Select(s => new GUIContent(s)).ToArray(),
                            Styles.WindQuality);
                    }
                }
            }
            else
            {
                if (CanUnifyLODConfig())
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    Rect buttonRect = GUILayoutUtility.GetRect(Styles.ResetLOD, EditorStyles.miniButton);
                    if (GUI.Button(buttonRect, Styles.ResetLOD, EditorStyles.miniButton))
                    {
                        var dropDownMenu = new GenericMenu();
                        foreach (var importer in targets.Cast <SpeedTreeImporter>())
                        {
                            var menuText = String.Format("{0}: {1}",
                                                         Path.GetFileNameWithoutExtension(importer.assetPath),
                                                         String.Join(" | ", importer.LODHeights.Select(height => UnityString.Format("{0:0}%", height * 100)).ToArray()));
                            dropDownMenu.AddItem(new GUIContent(menuText), false, OnResetLODMenuClick, importer);
                        }
                        dropDownMenu.DropDown(buttonRect);
                    }
                    EditorGUILayout.EndHorizontal();
                }
                var area = GUILayoutUtility.GetRect(0, LODGroupGUI.kSliderBarHeight, GUILayout.ExpandWidth(true));
                if (Event.current.type == EventType.Repaint)
                {
                    LODGroupGUI.DrawMixedValueLODSlider(area);
                }
            }

            EditorGUILayout.Space();
        }
Exemple #19
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-pageSize:{1},pageNum:{2},nameFilter:{3},matchAttributeFilterLessThan.Count:{4}, matchAttributeFilterGreaterThan.Count:{5}", base.ToString(), pageSize, pageNum, nameFilter, (matchAttributeFilterLessThan != null) ? matchAttributeFilterLessThan.Count : 0, (matchAttributeFilterGreaterThan != null) ? matchAttributeFilterGreaterThan.Count : 0));
 }
 public override string ToString()
 {
     object[] args = new object[] { base.ToString(), this.nodeId, this.publicAddress, this.privateAddress, this.hostPriority };
     return(UnityString.Format("[{0}]-nodeId:{1},publicAddress:{2},privateAddress:{3},hostPriority:{4}", args));
 }
 /// <summary>
 ///   <para>Provides string description of current class data.</para>
 /// </summary>
 public override string ToString()
 {
   return UnityString.Format("[{0}]-pageSize:{1},pageNum:{2},nameFilter:{3},matchAttributeFilterLessThan.Count:{4}, matchAttributeFilterGreaterThan.Count:{5}", (object) base.ToString(), (object) this.pageSize, (object) this.pageNum, (object) this.nameFilter, (object) (this.matchAttributeFilterLessThan != null ? this.matchAttributeFilterLessThan.Count : 0), (object) (this.matchAttributeFilterGreaterThan != null ? this.matchAttributeFilterGreaterThan.Count : 0));
 }
        public static void GameViewStatsGUI()
        {
            var evt = Event.current;

            if (evt.type != EventType.Layout && evt.type != EventType.Repaint)
            {
                return;
            }

            float w = 300, h = 229;

            GUILayout.BeginArea(new Rect(GUIView.current.position.width - w - 10, 27, w, h), "Statistics", GUI.skin.window);

            // Audio stats
            bool audioOutputSuspended = UnityStats.audioOutputSuspended;

            GUILayout.Label((audioOutputSuspended) ? "Audio (suspended):" : "Audio:", EditorStyles.boldLabel);
            using (new EditorGUI.DisabledScope(audioOutputSuspended))
            {
                StringBuilder audioStats = new StringBuilder(400);
                float         audioLevel = UnityStats.audioLevel;
                audioStats.Append("  Level: " + FormatDb(audioLevel) + (EditorUtility.audioMasterMute ? " (MUTED)\n" : "\n"));
                audioStats.Append(UnityString.Format("  Clipping: {0:F1}%", 100.0f * UnityStats.audioClippingAmount));
                GUILayout.Label(audioStats.ToString());
            }

            GUI.Label(new Rect(170, 40, 120, 20), UnityString.Format("DSP load: {0:F1}%", 100.0f * UnityStats.audioDSPLoad));
            GUI.Label(new Rect(170, 53, 120, 20), UnityString.Format("Stream load: {0:F1}%", 100.0f * UnityStats.audioStreamLoad));

            EditorGUILayout.Space();

            // Graphics stats
            Rect graphicsLabelRect    = GUILayoutUtility.GetRect(s_GraphicsText, EditorStyles.boldLabel);

            GUI.Label(graphicsLabelRect, s_GraphicsText, EditorStyles.boldLabel);

            // Time stats
            UpdateFrameTime();

            string timeStats          = UnityString.Format("- FPS (Playmode Off)");

            if (EditorApplication.isPlaying)
            {
                timeStats = UnityString.Format("{0:F1} FPS ({1:F1}ms)",
                                               1.0f / Mathf.Max(m_MaxFrameTime, 1.0e-5f), m_MaxFrameTime * 1000.0f);
            }
            GUI.Label(new Rect(170, graphicsLabelRect.y, 120, 20), timeStats);

            int screenBytes = UnityStats.screenBytes;
            int batchesSavedByDynamicBatching = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches;
            int batchesSavedByStaticBatching  = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches;
            int batchesSavedByInstancing      = UnityStats.instancedBatchedDrawCalls - UnityStats.instancedBatches;

            StringBuilder gfxStats = new StringBuilder(400);

            if (m_ClientFrameTime > m_RenderFrameTime)
            {
                gfxStats.Append(UnityString.Format("  CPU: main <b>{0:F1}</b>ms  render thread {1:F1}ms\n", m_ClientFrameTime * 1000.0f, m_RenderFrameTime * 1000.0f));
            }
            else
            {
                gfxStats.Append(UnityString.Format("  CPU: main {0:F1}ms  render thread <b>{1:F1}</b>ms\n", m_ClientFrameTime * 1000.0f, m_RenderFrameTime * 1000.0f));
            }

            gfxStats.Append(UnityString.Format("  Batches: <b>{0}</b> \tSaved by batching: {1}\n", UnityStats.batches, batchesSavedByDynamicBatching + batchesSavedByStaticBatching + batchesSavedByInstancing));
            gfxStats.Append(UnityString.Format("  Tris: {0} \tVerts: {1} \n", FormatNumber(UnityStats.trianglesLong), FormatNumber(UnityStats.verticesLong)));
            gfxStats.Append(UnityString.Format("  Screen: {0} - {1}\n", UnityStats.screenRes, EditorUtility.FormatBytes(screenBytes)));
            gfxStats.Append(UnityString.Format("  SetPass calls: {0} \tShadow casters: {1} \n", UnityStats.setPassCalls, UnityStats.shadowCasters));
            gfxStats.Append(UnityString.Format("  Visible skinned meshes: {0}\n", UnityStats.visibleSkinnedMeshes));
            gfxStats.Append(UnityString.Format("  Animation components playing: {0} \n", UnityStats.animationComponentsPlaying));
            gfxStats.Append(UnityString.Format("  Animator components playing: {0}", UnityStats.animatorComponentsPlaying));
            GUILayout.Label(gfxStats.ToString(), labelStyle);

            GUILayout.EndArea();
        }
 public override string ToString()
 {
     return(UnityString.Format("[StyleSelectorPart: value={0}, type={1}]", value, type));
 }
Exemple #24
0
 public override string ToString()
 {
     return(UnityString.Format("VerticalGrid: rows {0}, columns {1}, fixedWidth {2}, itemSize {3}", rows, columns, fixedWidth, itemSize));
 }
Exemple #25
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-SourceID:0x{1},AppID:0x{2},domain:{3}", base.ToString(), sourceId.ToString("X"), appId.ToString("X"), domain));
 }
Exemple #26
0
 public override string ToString()
 {
     return(UnityString.Format("[{0}]-SourceID:0x{1},projectId:{2},accessTokenString.IsEmpty:{3},domain:{4}", base.ToString(), sourceId.ToString("X"), projectId, string.IsNullOrEmpty(accessTokenString), domain));
 }
Exemple #27
0
 public string ToString(string format)
 {
     return(UnityString.Format("Origin: {0}, Dir: {1}", (object)this.m_Origin.ToString(format), (object)this.m_Direction.ToString(format)));
 }
Exemple #28
0
 /// <summary>
 /// Outputs a more readable representation of the timeline clip as a string
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(UnityString.Format("{0} ({1:F2}, {2:F2}):{3:F2} | {4}", displayName, start, end, clipIn, parentTrack));
 }
        void UpdateIfNeeded(HierarchyFrameDataView frameDataView, int selectedId)
        {
            var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView);

            if (!needReload)
            {
                return;
            }

            m_FrameDataView = frameDataView;
            m_SelectedID    = selectedId;

            callersAndCalleeData.UpdateData(m_FrameDataView, m_FrameDataView.GetItemMarkerID(m_SelectedID));

            m_CallersTreeView.SetCallsData(callersAndCalleeData.callersData);
            m_CalleesTreeView.SetCallsData(callersAndCalleeData.calleesData);

            m_TotalSelectedPropertyTimeLabel.text = m_FrameDataView.GetItemName(selectedId) + UnityString.Format(" - Total time: {0:f2} ms", callersAndCalleeData.totalSelectedPropertyTime);
        }
 public static string GetMessage(string failureMessage)
 {
     object[] args = new object[] { "Assertion failed.", failureMessage };
     return(UnityString.Format("{0} {1}", args));
 }