コード例 #1
0
        public void ConnectToPort(IPort port)
        {
            if (!IsPossibleToConnect(port))
            {
                DisplayMethod?.Invoke("Unable to Connect to Port");
                return;
            }

            Mapping.MergeTelephoneAndPortBehaviorWhenConnecting(this, port as IPort);

            var connectionEvent = new ConnectionEvent(port); // initialize new connection event

            OnConnectedToPort(connectionEvent);              // invoke connection event (switch port status)

            if (connectionEvent.Port == null)
            {
                DisplayMethod?.Invoke("Another Telephone is Already Connected to This Port");
                return;
            }

            Mapping.ConnectTelephoneToPort(this, connectionEvent.Port as IPort);

            TelephoneStatus = TelephoneStatus.Inaction;

            DisplayMethod?.Invoke($"{this.SerialNumber} was connected to {port.IdentificationNumber}");
        }
コード例 #2
0
        private void Manager_MessageArrivedEvent(object sender, MessageDictionary e)
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                if (messageListSP.Children.Count >= maxMesListLen)
                {
                    messageListSP.Children.RemoveAt(0);
                }
                if ((CommandType)Enum.Parse(typeof(CommandType), e[MesKeyStr.CommandType]) == CommandType.GroupMessage)
                {
                    e.Add(MesKeyStr.Remark, "群聊消息");
                }
                else
                {
                    e.Add(MesKeyStr.Remark, "私聊消息,目标:" + e[MesKeyStr.UserID]);
                }

                DisplayMethod displayMethod = DisplayMethod.OnlyRemark;
                if (displayStyle)
                {
                    displayMethod = DisplayMethod.Both;
                }
                MessageUC messageUC = new MessageUC(e, displayMethod);
                messageListSP.Children.Add(messageUC);
                messageListSV.ScrollToEnd();
            });
        }
コード例 #3
0
    public static void Init()
    {
        blacklist = new List <string>();
        blacklist.Add("Editor");

        sortMethod         = (SortMethod)EditorPrefs.GetInt("LC_SortMethod", 0);
        displayMethod      = (DisplayMethod)EditorPrefs.GetInt("LC_DisplayMode", 0);
        ignoreEmptyLines   = EditorPrefs.GetBool("LC_IgnoreEmptyLines", false);
        displayMatchesOnly = EditorPrefs.GetBool("LC_DisplayMatchesOnly", true);
        comparisonMode     = EditorPrefs.GetBool("LC_ComparisonMode", false);

        oldSortMethod       = sortMethod;
        oldDisplayMethod    = displayMethod;
        oldIgnoreEmptyLines = ignoreEmptyLines;

        if (displayMethod != DisplayMethod.Graph)
        {
            search = EditorPrefs.GetString("LC_SavedSearch", string.Empty);
        }

        LineCounter window = GetWindow <LineCounter>("Line Counter");

        window.Show();
        window.Focus();
        window.CountLines();
    }
コード例 #4
0
        public void NotifyUserAboutError(object sender, FailureEvent e)
        {
            TelephoneStatus = TelephoneStatus.Inaction;

            switch (e.FailureType)
            {
            case FailureType.InsufficientFunds:
                DisplayMethod?.Invoke("You don't have enough funds to make a call");
                break;

            case FailureType.AbonentIsBusy:
                DisplayMethod?.Invoke($"{e.PhoneNumber} - Abonent is Busy");
                break;

            case FailureType.AbonentDoesNotExist:
                DisplayMethod?.Invoke($"{e.PhoneNumber} - Abonent Doesn't Exist");
                break;

            case FailureType.AbonentIsNotResponding:
                DisplayMethod?.Invoke(sender is IPort port && port.PhoneNumber == e.PhoneNumber
                        ? "You Have Missed Call"
                        : $"{e.PhoneNumber} - Abonent Is Not Responding");
                break;

            default:
                DisplayMethod?.Invoke("Unknown Error");
                break;
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: svd62rus/EmployeeList-2.0
        //Загрузка
        private Exception LoadTables(ref EmployeeList list, DisplayMethod <Department> displayDeps,
                                     DisplayMethod <Employee> displayEmps)
        {
            BinaryFormatter formatter = new BinaryFormatter
            {
                AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple
            };

            try
            {
                using (FileStream fs = new FileStream(nameOfFile, FileMode.Open))
                {
                    list = (EmployeeList)formatter.Deserialize(fs);
                    displayDeps(DataGridDeps, list.Departments); //выводим данные отделов в соответствующий датагрид
                    displayEmps(DataGridEmps, list.Employees);   //выводим данные cотрудников в соответствующий датагрид
                }
            }
            catch (Exception ex)
            {
                return(ex);
            }

            RefreshTotalInfo();             //обновляем общую инфу
            FillDepsList(list.Departments); //заполняем список отделов
            return(null);
        }
コード例 #6
0
        public DisplayMethodViewModel(Person person, DisplayMethod displayAs)
        {
            _person    = person;
            _displayAs = displayAs;

            _person.PropertyChanged += new PropertyChangedEventHandler(PersonPropertyChanged);
        }
コード例 #7
0
        public DisplayMethodViewModel(Person person, DisplayMethod displayAs)
        {
            _person = person;
            _displayAs = displayAs;

            _person.PropertyChanged += new PropertyChangedEventHandler(PersonPropertyChanged);
        }
コード例 #8
0
        private void GUIAwake()
        {
            Timer      = new Timer(OnMessageHasDecayed);
            TickerText = FindTickerTextComponent();

            Display            = DisplayWithTicker;
            ModeSpecificUpdate = GUIUpdate;
        }
コード例 #9
0
ファイル: Person.cs プロジェクト: michaellperry/HandsOnMVVMSL
 public string DisplayUsingMethod(DisplayMethod method)
 {
     if (method == DisplayMethod.LastFirst)
         return string.Format("{0}, {1}", LastName, FirstName);
     else if (method == DisplayMethod.FirstLast)
         return string.Format("{0} {1}", FirstName, LastName);
     else if (method == DisplayMethod.Email)
         return Email;
     else
         return string.Format("Unknown display method {0}", method);
 }
コード例 #10
0
    void Update()
    {
        if (sortMethod != oldSortMethod || displayMethod != oldDisplayMethod || ignoreEmptyLines != oldIgnoreEmptyLines)
        {
            CountLines();

            oldSortMethod       = sortMethod;
            oldDisplayMethod    = displayMethod;
            oldIgnoreEmptyLines = ignoreEmptyLines;
        }
    }
コード例 #11
0
        public CompareViewRecord(KeyValuePair<ParameterID, Dictionary<String, object>> p_parameterValues, CompareUserControl p_owner, DisplayMethod howToDisplay)
        {
            InitializeComponent();
            this.Size = new System.Drawing.Size(this.Size.Width, 18);
            this.Dock = DockStyle.Top;
            this.BackColor = System.Drawing.Color.White;
            this.parameterValues = p_parameterValues;

            this.Set(howToDisplay);
            this.owner = p_owner;
        }
コード例 #12
0
        public void Answer()
        {
            if (TelephoneStatus != TelephoneStatus.IncomingCall)
            {
                return;
            }

            TelephoneStatus = TelephoneStatus.Conversation;

            DisplayMethod?.Invoke("You Answered Call");

            OnNotifyPortAboutAnsweredCall(new AnsweredCallEvent("")
            {
                CallStartTime = DateTime.Now
            });
        }
コード例 #13
0
        public void Reject()
        {
            if (TelephoneStatus == TelephoneStatus.Inaction || TelephoneStatus == TelephoneStatus.Disabled)
            {
                return;
            }

            TelephoneStatus = TelephoneStatus.Inaction;

            DisplayMethod?.Invoke("You Rejected Call");

            OnNotifyPortAboutRejectionOfCall(new RejectedCallEvent("")
            {
                CallRejectionTime = DateTime.Now
            });
        }
コード例 #14
0
 public void Set(DisplayMethod displayType)
 {
     this.labelParameterName.Text = this.parameterValues.Key.Group + "." + this.parameterValues.Key.Name; // possible to change to add group name inside
     switch (displayType)
     {
         case DisplayMethod.RANGE:
             if (this.parameterValues.Key.IsAString)
             {
                 // printing only distinct values of parameter
                 foreach (string entry in this.parameterValues.Value.Values.Distinct())
                 {
                     this.labelParameterValues.Text += "\"" + entry + "\";  ";
                 }
             }
             else
             {
                 this.labelParameterValues.Text = "Min: " + this.parameterValues.Value.Values.Min() + ", Max: " + this.parameterValues.Value.Values.Max();
             }
             break;
         case DisplayMethod.OCCURENCES:
             var counts = from entry in this.parameterValues.Value
                          group entry by entry.Value into distinctValue
                          select new { ParameterValue = distinctValue.Key, Occurences = distinctValue.Count() };
             foreach (var entry in counts)
             {
                 if (this.parameterValues.Key.IsAString)
                 {
                     this.labelParameterValues.Text += System.String.Format("{0} occurrences of \"{1}\"; ", entry.Occurences, entry.ParameterValue);
                 }
                 else
                 {
                     this.labelParameterValues.Text += System.String.Format("{0} occurrences of {1}; ", entry.Occurences, entry.ParameterValue);
                 }
             }
             break;
         case DisplayMethod.FULLLIST:
              foreach (double entry in this.parameterValues.Value.Values)
                 {
                     this.labelParameterValues.Text += System.String.Format("{0}; ", entry);
                 }
          break;
         default:
             break;
     }
 }
コード例 #15
0
        public string GetDisplayName(MethodInfo methodInfo, object[] data)
        {
            if (DisplayMethod == null)
            {
                if (string.IsNullOrEmpty(DisplayMethodName))
                {
                    return(null);
                }

                DisplayMethod = MethodClass.GetMethod(DisplayMethodName, BindingFlags.Static
                                                      | BindingFlags.Public | BindingFlags.NonPublic);
                if (DisplayMethodName == null)
                {
                    throw new InvalidOperationException($"could not resolve test data display method:"
                                                        + $" class=[{MethodClass.FullName}]"
                                                        + $" method=[{DisplayMethodName}]");
                }
            }
            if (TestMethod == null)
            {
                TestMethod = methodInfo;
            }

            object[] methodParams = null;
            var      paramInfos   = DisplayMethod.GetParameters();
            var      paramLen     = paramInfos.Length;

            if (paramLen == 2 && paramInfos[1].ParameterType == typeof(object[]))
            {
                methodParams = new object[] { this, data };
            }
            else if (paramLen > 1)
            {
                methodParams    = new object[data.Length + 1];
                methodParams[0] = this;
                Array.Copy(data, 0, methodParams, 1, data.Length);
            }
            else if (paramLen > 0)
            {
                methodParams = new object[] { this };
            }

            return((string)DisplayMethod.Invoke(null, methodParams));
        }
コード例 #16
0
ファイル: Person.cs プロジェクト: michaellperry/HandsOnMVVMSL
 public string DisplayUsingMethod(DisplayMethod method)
 {
     if (method == DisplayMethod.LastFirst)
     {
         return(string.Format("{0}, {1}", LastName, FirstName));
     }
     else if (method == DisplayMethod.FirstLast)
     {
         return(string.Format("{0} {1}", FirstName, LastName));
     }
     else if (method == DisplayMethod.Email)
     {
         return(Email);
     }
     else
     {
         return(string.Format("Unknown display method {0}", method));
     }
 }
コード例 #17
0
        public void DisconnectFromPort()
        {
            if (TelephoneStatus == TelephoneStatus.Disabled)
            {
                DisplayMethod?.Invoke($"{this.SerialNumber} is Already Disconnected");
                return;
            }

            var connectionEvent = new ConnectionEvent(null);

            OnDisconnectedFromPort(connectionEvent);

            Mapping.SeparateTelephoneAndPortBehaviorWhenDisconnecting(this, connectionEvent.Port as IPort);

            Mapping.DisconnectTelephoneFromPort(this, connectionEvent.Port as IPort);

            TelephoneStatus = TelephoneStatus.Disabled;

            DisplayMethod?.Invoke($"{this.SerialNumber} was disconnected");
        }
コード例 #18
0
ファイル: Form1.cs プロジェクト: watset1/IN710watset1
 private void gigDisplayMethod(DisplayMethod displayMethod)
 {
     dataGridView1.Rows.Clear();
     foreach (XElement gig in gigDoc.Element("Event_Guide").Elements("Gig"))
     {
         GigInfo currentGig = new GigInfo();
         displayMethod(gig, currentGig);
     }
 }
コード例 #19
0
 private MessageUC(MessageDictionary message)
 {
     InitializeComponent();
     DisplayMethodP = DisplayMethod.OnlyStyle;
     ChatMessageP   = message;
 }
コード例 #20
0
 public MessageUC(MessageDictionary message, DisplayMethod displayMethod) : this(message)
 {
     DisplayMethodP = displayMethod;
     Display();
 }
コード例 #21
0
    void OnGUI()
    {
        GUILayout.Space(7f);

        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
        if (stringStats != null)
        {
            EditorGUILayout.HelpBox(stringStats.ToString(), MessageType.None);
            GUILayout.Space(5f);

            sortMethod       = (SortMethod)EditorGUILayout.EnumPopup("Sort Method:", sortMethod);
            displayMethod    = (DisplayMethod)EditorGUILayout.EnumPopup("Display Mode:", displayMethod);
            ignoreEmptyLines = EditorGUILayout.Toggle("Ignore Empty Lines:", ignoreEmptyLines);

            GUILayout.Space(4f);

            if (displayMethod != DisplayMethod.Graph)
            {
                search = EditorGUILayout.TextField("Search Script Name:", search);

                if (displayMethod == DisplayMethod.Default)
                {
                    EditorGUI.indentLevel += 1;
                    displayMatchesOnly     = EditorGUILayout.Toggle("Display Matches Only:", displayMatchesOnly);

                    if (displayMatchesOnly)
                    {
                        comparisonMode = EditorGUILayout.Toggle("Comparison Mode:", comparisonMode);
                    }
                    else
                    {
                        comparisonMode = false;
                    }
                    EditorGUI.indentLevel -= 1;
                }
            }
            else
            {
                search = string.Empty;
            }

            GUILayout.Space(5f);
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            if (fileStats != null)
            {
                string    builtString  = string.Empty;
                int       displayCount = 0;
                Texture2D barTex       = Texture2D.whiteTexture;

                for (int i = 0; i < fileStats.Count; i++)
                {
                    float alphaMod    = 1f;
                    float finalHeight = 15f;
                    if (!string.IsNullOrEmpty(search) && !fileStats[i].displayName.ToLowerInvariant().Contains(search.ToLowerInvariant()))
                    {
                        if (displayMethod == DisplayMethod.TextOnly)
                        {
                            continue;
                        }

                        if (comparisonMode)
                        {
                            finalHeight = 1f;
                            alphaMod    = 0.5f;
                        }
                        else if (displayMatchesOnly)
                        {
                            continue;
                        }
                        else
                        {
                            alphaMod = 0.3f;
                        }
                    }

                    displayCount++;

                    if (displayMethod == DisplayMethod.TextOnly)
                    {
                        builtString += (i + 1).ToString() + ": " + fileStats[i].displayName + " [" + fileStats[i].numLines.ToString() + "]";

                        if (i < fileStats.Count - 1)
                        {
                            builtString += "\n";
                        }
                    }
                    else
                    {
                        if (displayMethod == DisplayMethod.Graph)
                        {
                            finalHeight = 1f;
                        }

                        Rect  displayRect = EditorGUILayout.GetControlRect(true, GUILayout.MaxHeight(finalHeight));
                        float oddFactor   = (i % 2 == 1) ? 0.3f : 0f;

                        GUI.color = new Color(oddFactor, oddFactor, oddFactor, alphaMod * 0.1f);
                        GUI.DrawTexture(displayRect, barTex);
                        GUI.color = new Color(1f, 1f, 1f, alphaMod);

                        GUI.depth += 1;

                        GUI.color = (EditorGUIUtility.isProSkin) ? new Color(0.375f, 0.6f, 0.3f, alphaMod * 0.5f) : new Color(0.475f, 0.725f, 0.35f, alphaMod * 0.75f);
                        float oldWidth = displayRect.width;
                        displayRect.width *= (fileStats[i].numLines / (float)largestLineCountRef.numLines);
                        displayRect.width  = Mathf.Round(displayRect.width);

                        if (Event.current.type == EventType.Repaint && displayRect.width > 1f)
                        {
                            GUI.DrawTexture(displayRect, barTex);
                        }

                        displayRect.width = oldWidth;

                        GUI.depth += 1;

                        GUI.color = (EditorGUIUtility.isProSkin) ? new Color(0.6f, 0.5f, 0.3f, alphaMod * 0.5f) : new Color(0.75f, 0.6f, 0.45f, alphaMod * 0.75f);
                        float oldWidth2 = displayRect.width;
                        displayRect.width *= (fileStats[i].numLines / (float)totalLines);
                        displayRect.width  = Mathf.Round(displayRect.width);

                        if (Event.current.type == EventType.Repaint && displayRect.width > 1f)
                        {
                            GUI.DrawTexture(displayRect, barTex);
                        }

                        displayRect.width = oldWidth2;
                        GUI.color         = new Color(1f, 1f, 1f, alphaMod);

                        GUI.depth += 1;

                        displayRect.y += 1;

                        if (displayMethod != DisplayMethod.Graph)
                        {
                            int oldFontSize = GUI.skin.label.fontSize;
                            GUI.skin.label.fontSize  = 9;
                            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                            GUI.Label(displayRect, (i + 1).ToString() + ": " + fileStats[i].displayName);
                            GUI.skin.label.alignment = TextAnchor.MiddleRight;
                            GUI.Label(displayRect, "[" + fileStats[i].numLines.ToString() + " lines]  (" + (fileStats[i].numLines * 100 / (float)totalLines).ToString("F3") + "%)");
                            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                            GUI.skin.label.fontSize  = oldFontSize;
                        }

                        GUI.depth -= 3;
                    }
                }

                if (displayCount <= 0)
                {
                    EditorGUILayout.HelpBox("No results...", MessageType.None);
                }
                else if (!string.IsNullOrEmpty(builtString) && displayMethod == DisplayMethod.TextOnly)
                {
                    EditorGUILayout.TextArea(builtString);
                }
            }

            EditorGUILayout.EndScrollView();
        }
        else
        {
            for (int y = 0; y < Screen.height / 18; y++)
            {
                EditorGUILayout.BeginHorizontal();

                for (int x = 0; x <= Screen.width / 370; x++)
                {
                    EditorGUILayout.LabelField("REFRESH THE WINDOW BY PRESSING CTRL+ALT+C", EditorStyles.boldLabel, GUILayout.Width(370f));
                }

                EditorGUILayout.EndHorizontal();
            }
        }

        if (GUI.changed)
        {
            EditorPrefs.SetString("LC_SavedSearch", search);
            EditorPrefs.SetBool("LC_DisplayMatchesOnly", displayMatchesOnly);
            EditorPrefs.SetBool("LC_ComparisonMode", comparisonMode);
        }
    }
コード例 #22
0
        public void NotifyUserAboutIncomingCall(object sender, IncomingCallEvent e)
        {
            TelephoneStatus = TelephoneStatus.IncomingCall;

            DisplayMethod?.Invoke($"{e.SenderPhoneNumber} - is calling you");
        }
コード例 #23
0
        public void NotifyUserAboutRejectedCall(object sender, RejectedCallEvent e)
        {
            TelephoneStatus = TelephoneStatus.Inaction;

            DisplayMethod?.Invoke($"{e.PhoneNumberOfPersonRejectedCall} - canceled the call");
        }
コード例 #24
0
 public static void DisplayRoute(bool[,] map, string title, IEnumerable <Point> path, SearchParameters searchParameters, DisplayMethod func = null)
 {
     if (func == null)
     {
         func = DisplayConsolError;
     }
     func(string.Format("{0}\r\n", title));
     for (int y = map.GetLength(1) - 1; y >= 0; y--) // Invert the Y-axis so that coordinate 0,0 is shown in the bottom-left
     {
         for (int x = 0; x < map.GetLength(0); x++)
         {
             if (searchParameters.StartLocation.Equals(new Point(x, y)))
             {
                 // Show the start position
                 func('S');
             }
             else if (searchParameters.EndLocation.Equals(new Point(x, y)))
             {
                 // Show the end position
                 func('F');
             }
             else if (map[x, y] == false)
             {
                 // Show any barriers
                 func('░');
             }
             else if (path.Where(p => p.X == x && p.Y == y).Any())
             {
                 // Show the path in between
                 func('*');
             }
             else
             {
                 // Show nodes that aren't part of the path
                 func('·');
             }
         }
         func();
     }
 }
コード例 #25
0
ファイル: LineCounter.cs プロジェクト: Kevinsomnia/Darkraze
    void OnGUI()
    {
        GUILayout.Space(7f);

        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
        if (stringStats != null)
        {
            EditorGUILayout.HelpBox(stringStats.ToString(), MessageType.None);

            GUILayout.Space(5f);
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            sortMethod       = (SortMethod)EditorGUILayout.EnumPopup("Sort Method:", sortMethod);
            displayMethod    = (DisplayMethod)EditorGUILayout.EnumPopup("Display Mode:", displayMethod);
            ignoreEmptyLines = EditorGUILayout.Toggle("Ignore Empty Lines:", ignoreEmptyLines);

            GUILayout.Space(4f);

            if (displayMethod != DisplayMethod.Graph)
            {
                search = EditorGUILayout.TextField("Search Script Name:", search);

                if (GUI.changed)
                {
                    EditorPrefs.SetString("LC_SavedSearch", search);
                }

                if (displayMethod == DisplayMethod.Default)
                {
                    EditorGUI.indentLevel += 1;
                    displayMatchesOnly     = EditorGUILayout.Toggle("Display Matches Only:", displayMatchesOnly);

                    if (displayMatchesOnly)
                    {
                        comparisonMode = EditorGUILayout.Toggle("Comparison Mode:", comparisonMode);
                    }
                    else
                    {
                        comparisonMode = false;
                    }
                    EditorGUI.indentLevel -= 1;
                }
            }
            else
            {
                search = "";
            }

            if (GUI.changed)
            {
                EditorPrefs.SetInt("LC_SortMethod", (int)sortMethod);
                EditorPrefs.SetInt("LC_DisplayMode", (int)displayMethod);
                EditorPrefs.SetBool("LC_IgnoreEmptyLines", ignoreEmptyLines);
                EditorPrefs.SetBool("LC_DisplayMatchesOnly", displayMatchesOnly);
                EditorPrefs.SetBool("LC_ComparisonMode", comparisonMode);

                CountLines();
            }

            GUILayout.Space(5f);

            if (fileStats != null)
            {
                string builtString  = "";
                int    displayCount = 0;
                for (int i = 0; i < fileStats.Count; i++)
                {
                    float alphaMod    = 1f;
                    float finalHeight = 15f;
                    if (!string.IsNullOrEmpty(search) && !fileStats[i].displayName.ToLower().Contains(search.ToLower()))
                    {
                        if (displayMethod == DisplayMethod.TextOnly)
                        {
                            continue;
                        }

                        if (comparisonMode)
                        {
                            finalHeight = 1f;
                            alphaMod    = 0.5f;
                        }
                        else if (displayMatchesOnly)
                        {
                            continue;
                        }
                        else
                        {
                            alphaMod = 0.3f;
                        }
                    }

                    displayCount++;

                    if (displayMethod == DisplayMethod.TextOnly)
                    {
                        builtString += (i + 1).ToString() + " - " + fileStats[i].displayName + " -> [" + fileStats[i].numLines.ToString() + "]";

                        if (i < fileStats.Count - 1)
                        {
                            builtString += "\n";
                        }
                    }
                    else
                    {
                        if (displayMethod == DisplayMethod.Graph)
                        {
                            finalHeight = 1f;
                        }

                        Rect displayRect = EditorGUILayout.GetControlRect(true, GUILayout.MaxHeight(finalHeight));

                        GUI.color = new Color(0f, 0f, 0f, ((displayMethod == DisplayMethod.Default) ? 0.3f : 0.05f) * alphaMod);
                        GUI.Box(displayRect, "");
                        GUI.color = new Color(1f, 1f, 1f, alphaMod);

                        GUI.depth += 1;

                        GUI.color = new Color(0.5f, 0.8f, 0.4f, GUI.color.a);
                        float oldWidth = displayRect.width;
                        displayRect.width *= (fileStats[i].numLines / (float)largestLineCountRef.numLines);
                        displayRect.width  = Mathf.Round(displayRect.width);

                        if (Event.current.type == EventType.Repaint && displayRect.width > 1f)
                        {
                            GUI.Box(displayRect, "");
                        }

                        displayRect.width = oldWidth;

                        GUI.depth += 1;

                        GUI.color = new Color(0.8f, 0.8f, 0.4f, GUI.color.a);
                        float oldWidth2 = displayRect.width;
                        displayRect.width *= (fileStats[i].numLines / (float)totalLines);
                        displayRect.width  = Mathf.Round(displayRect.width);

                        if (Event.current.type == EventType.Repaint && displayRect.width > 1f)
                        {
                            GUI.Box(displayRect, "");
                        }

                        displayRect.width = oldWidth2;
                        GUI.color         = new Color(1f, 1f, 1f, GUI.color.a);

                        GUI.depth += 1;

                        displayRect.y += 1;

                        if (displayMethod != DisplayMethod.Graph)
                        {
                            int oldFontSize = GUI.skin.label.fontSize;
                            GUI.skin.label.fontSize  = 9;
                            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                            GUI.Label(displayRect, (i + 1).ToString() + ": " + fileStats[i].displayName);
                            GUI.skin.label.alignment = TextAnchor.MiddleRight;
                            GUI.Label(displayRect, "[" + fileStats[i].numLines.ToString() + " lines]  (" + (fileStats[i].numLines * 100 / (float)totalLines).ToString("F3") + "%)");
                            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                            GUI.skin.label.fontSize  = oldFontSize;
                        }

                        GUI.depth -= 3;
                    }
                }

                if (displayCount <= 0)
                {
                    EditorGUILayout.HelpBox("No results...", MessageType.None);
                }
                else if (!string.IsNullOrEmpty(builtString) && displayMethod == DisplayMethod.TextOnly)
                {
                    EditorGUILayout.HelpBox(builtString, MessageType.None);
                }
            }

            EditorGUILayout.EndScrollView();
        }
        else
        {
            EditorGUILayout.HelpBox("REFRESH THE WINDOW BY PRESSING CTRL+ALT+C", MessageType.None);
        }
    }
コード例 #26
0
 private void CLIAwake()
 {
     Display            = DisplayWithConsole;
     ModeSpecificUpdate = CLIUpdate;
 }