コード例 #1
0
ファイル: Diff.cs プロジェクト: Yanov-P/TestUnityProject
        private void OnGUI()
        {
            rect = GUILayout.BeginScrollView(rect);
            try {
                string[]  arr   = patch.Split("\n".ToCharArray());
                Texture2D oldBG = GUI.skin.label.normal.background;

                foreach (string s in arr)
                {
                    if (s.StartsWith("-"))
                    {
                        GUI.skin.label.normal.background = UncommitedChangesWindow.getGenericTexture(1, 1, new Color(Color.red.r, Color.red.g, Color.red.b, 0.25f));
                    }
                    else if (s.StartsWith("+"))
                    {
                        GUI.skin.label.normal.background = UncommitedChangesWindow.getGenericTexture(1, 1, new Color(Color.green.r, Color.green.g, Color.green.b, 0.25f));
                    }
                    else
                    {
                        GUI.skin.label.normal.background = oldBG;
                    }

                    GUILayout.Label(s);
                }
            } catch {}
            GUILayout.EndScrollView();
        }
コード例 #2
0
        public ChangesetViewWindow()
        {
            highlightTexture = UncommitedChangesWindow.getGenericTexture(1, 1, new Color(71f / 255f, 71f / 255f, 71f / 255f));
            noTexture        = UncommitedChangesWindow.getGenericTexture(1, 1, new Color(46f / 255f, 46f / 255f, 46f / 255f));

            statusStyle           = new GUIStyle("Label");
            statusStyle.alignment = TextAnchor.LowerRight;

            highlightStyle = new GUIStyle("Label");
            highlightStyle.normal.background = highlightTexture;

            noStyle = new GUIStyle("Label");
            noStyle.normal.background = noTexture;

            treeView = new TreeView();
        }