예제 #1
0
        private void UpdateTexture(IPdArray pdArray)
        {
            var level = pdArray.Data[index_];

            for (var i = 0; i < 100; ++i)
            {
                meterImageTexture_.SetPixel(0, i, i < level ? Color.green : Color.black);
            }
            meterImageTexture_.Apply();
        }
        public void SetUp()
        {
            dummyData_ = new float[100];
            pdArray_   = Substitute.For <IPdArray>();
            pdArray_.Data.Returns(dummyData_);
            selectionRect_ = new Rect {
                x = 9, y = 9, width = 3, height = 3
            };
            noSelectionRect_ = new Rect {
                width = 0, height = 0
            };

            standardColor_ = new Color(0f, 0f, 0f, 0.2f);
            selectedColor_ = new Color(0f, 0f, 0f, 1f);
        }
예제 #3
0
        public void Render(IPdArray pdArray)
        {
            UpdateTexture(pdArray);
            var rect  = EditorGUILayout.BeginVertical();
            var style = new GUIStyle(GUI.skin.label)
            {
                alignment   = TextAnchor.UpperCenter,
                fixedHeight = 120
            };

            GUILayout.Label(label_, style);
            rect.y      += 20;
            rect.height -= 20;
            EditorGUI.DrawPreviewTexture(rect, meterImageTexture_);
            EditorGUILayout.EndVertical();
        }