コード例 #1
0
 private void UpdateSizing()
 {
     if (ActualWidth > 900)
     {
         InputSection.SetValue(Grid.RowSpanProperty, 2);
         InputSection.SetValue(Grid.ColumnSpanProperty, 1);
         PreviewSection.SetValue(Grid.RowSpanProperty, 2);
         PreviewSection.SetValue(Grid.ColumnSpanProperty, 1);
         PreviewSection.SetValue(Grid.ColumnProperty, 1);
         PreviewSection.SetValue(Grid.RowProperty, 0);
         InputScroll.IsVerticalRailEnabled  = true;
         GlobalScroll.IsVerticalRailEnabled = false;
         PreviewHeader.Visibility           = Visibility.Collapsed;
     }
     else
     {
         InputSection.SetValue(Grid.RowSpanProperty, 1);
         InputSection.SetValue(Grid.ColumnSpanProperty, 2);
         PreviewSection.SetValue(Grid.RowSpanProperty, 1);
         PreviewSection.SetValue(Grid.ColumnSpanProperty, 2);
         PreviewSection.SetValue(Grid.ColumnProperty, 0);
         PreviewSection.SetValue(Grid.RowProperty, 1);
         InputScroll.IsVerticalRailEnabled  = false;
         GlobalScroll.IsVerticalRailEnabled = true;
         PreviewHeader.Visibility           = Visibility.Visible;
     }
 }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            DrawImageHeader();

            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));
            serializedObject.Update();

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(camera);

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Abilities Input", (section == InputSection.Ability) ? active : normal))
            {
                section = (section == InputSection.Ability) ? InputSection.Noone : InputSection.Ability;
            }

            if (GUILayout.Button("Extra Input", (section == InputSection.Extra) ? active : normal))
            {
                section = (section == InputSection.Extra) ? InputSection.Noone : InputSection.Extra;
            }

            if (GUILayout.Button("Shooter Input", (section == InputSection.Shooter) ? active : normal))
            {
                section = (section == InputSection.Shooter) ? InputSection.Noone : InputSection.Shooter;
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical();

            switch (section)
            {
            case InputSection.Ability:
                DrawAbilitiesInput();
                break;

            case InputSection.Shooter:
                DrawShooterInput();
                break;

            case InputSection.Extra:
                DrawExtraInput();
                break;

            case InputSection.Noone:
                break;

            default:
                break;
            }

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

            serializedObject.ApplyModifiedProperties();
        }
コード例 #3
0
        public ColorTableManager(GLWindow glcontrol)
        {
            this.glcontrol = glcontrol;
            this.Bounds = new Rectangle(Point.Empty, glcontrol.Size);
            SetCursor(CursorType.Default);

            ShowColormapPickerAction = ActionManager.CreateAction("Show colormap picker", "show picker", delegate(object[] parameters) {
                pickerVisible = true;
                return null;
            });
            HideColormapPickerAction = ActionManager.CreateAction("Hide colormap picker", "hide picker", delegate(object[] parameters) {
                pickerVisible = false;
                return null;
            });

            // Create shaders as singleton
            /*if(colortableshader == null)
                colortableshader = new GLShader(new string[] {COLOR_TABLE_SHADER.VS}, new string[] {COLOR_TABLE_SHADER.FS});*/
            if(lineshader == null)
                lineshader = new GLShader(new string[] {LINE_SHADER.VS}, new string[] {LINE_SHADER.FS});
            if(cmpreviewshader == null)
                cmpreviewshader = new GLShader(new string[] {COLORMAP_PREVIEW_SHADER.VS}, new string[] {COLORMAP_PREVIEW_SHADER.FS});

            // Create input section
            input = new InputSection(this, new GLTextFont2(new Font("Lucida Sans Unicode", 12.0f)));
            input.Bounds = new Rectangle(130, 60, glcontrol.Width - 260, 200);//new Rectangle(100, glcontrol.Height - 60, glcontrol.Width - 400, 40);
            input.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            this.Controls.Add(input);

            // Create colormap picker
            picker = new ColorMapPicker(new GLTextFont2(new Font("Lucida Sans Unicode", 12.0f/*, FontStyle.Bold*/)));
            picker.bounds = new Rectangle(0, 0, glcontrol.Width, input.Bounds.Top);
            picker.ColormapDragStart += ColorMapPicker_ColormapDragStart;

            // Create/load colormaps
            AddColormap(ColorTableFromSolidColor(Color4.Red, Vector3.Zero, "Red"));
            AddColormap(ColorTableFromSolidColor(Color4.Orange, Vector3.Zero, "Orange"));
            AddColormap(ColorTableFromSolidColor(Color4.Yellow, Vector3.Zero, "Yellow"));
            AddColormap(ColorTableFromSolidColor(Color4.Green, Vector3.Zero, "Green"));
            AddColormap(ColorTableFromSolidColor(new Color4(0.215686f, 0.278431f, 0.082353f, 1.0f), Vector3.Zero, "Green2"));
            AddColormap(ColorTableFromSolidColor(Color4.Blue, Vector3.Zero, "Blue"));
            AddColormap(ColorTableFromSolidColor(new Color4(0.082353f, 0.133333f, 0.278431f, 1.0f), Vector3.Zero, "Blue2"));
            AddColormap(ColorTableFromSolidColor(Color4.White, Vector3.Zero, "White"));
            AddColormap(ColorTableFromSolidColor(Color4.Gray, Vector3.Zero, "Gray"));
            AddColormap(ColorTableFromSolidColor(Color4.Black, Vector3.Zero, "Black"));
            AddColormap(ColorTableFromSolidColor(new Color4(1.0f, 1.0f, 1.0f, 0.25f), Vector3.Zero, "25% White", "Transparent"));
            AddColormap(ColorTableFromSolidColor(new Color4(1.0f, 1.0f, 1.0f, 0.5f), Vector3.Zero, "50% White", "Transparent"));
            AddColormap(ColorTableFromSolidColor(new Color4(0.0f, 0.0f, 0.0f, 0.25f), Vector3.Zero, "25% Black", "Transparent"));
            AddColormap(ColorTableFromSolidColor(new Color4(0.0f, 0.0f, 0.0f, 0.5f), Vector3.Zero, "50% Black", "Transparent"));
            AddColormap(ColorTableFromSolidColor(new Color4(1.0f, 0.0f, 0.0f, 0.25f), Vector3.Zero, "25% Red", "Transparent"));
            AddColormap(ColorTableFromSolidColor(new Color4(1.0f, 0.0f, 0.0f, 0.5f), Vector3.Zero, "50% Red", "Transparent"));
            /*ColorMapCreator.Vector3 C0 = new ColorMapCreator.Vector3(58.650f, 76.245f, 192.270f);
            ColorMapCreator.Vector3 C1 = new ColorMapCreator.Vector3(180.030f, 4.080f, 38.250f);
            AddColormap(ColorTableFromRange(C0, C1, new Vector3(65.0f / 255.0f, 68.0f / 255.0f, 91.0f / 255.0f), "Moreland cool/warm", "Divergent"));*/
            AddColormaps(ColorTableFromXml(Global.EXE_DIR + "ColorMaps.xml"));
            //AddColormap(NamedColorTable.None);

            // Overwrite default //EDIT: DELETE
            //colormaps.Remove("_default"); //EDIT: DELETE
            //colormaps.Add("_default", colormaps["KineticEnergy"]); //EDIT: DELETE

            ActionManager.Do(HideColormapPickerAction);
            Reset();
            input.UpdateColormap();

            // Create buttons
            buttons = new GLButton[5];
            buttons[0] = new GLButton(Global.EXE_DIR + "splitterButton.png", new Rectangle(4, 100, 0, 0), AnchorStyles.Bottom | AnchorStyles.Left, "CreateSplitter", "Create colormap splitter");
            buttons[0].Click = SplitterButton_Click;
            buttons[1] = new GLButton(Global.EXE_DIR + "interjectorButton.png", new Rectangle(4, 100 - buttons[0].Bounds.Height, 0, 0), AnchorStyles.Bottom | AnchorStyles.Left, "CreateInterjector", "Create colormap interjector");
            buttons[1].Click = InterjectorButton_Click;
            buttons[2] = new GLButton(Global.EXE_DIR + "colorMapButton.png", new Rectangle(4, 100, 0, 0), AnchorStyles.Bottom | AnchorStyles.Right, "ShowColormapPicker", "Show colormap picker");
            buttons[2].Click = ColorMapButton_Click;
            buttons[3] = new GLButton(Global.EXE_DIR + "saveColorMapButton.png", new Rectangle(4, 100 - buttons[2].Bounds.Height, 0, 0), AnchorStyles.Bottom | AnchorStyles.Right, "SaveColormap", "Save colormap to disk");
            buttons[3].Click = SplitterButton_Click;
            buttons[3].Visible = false;
            buttons[4] = new GLButton(Global.EXE_DIR + "trashButton.png", new Rectangle(4, 100, 0, 0), AnchorStyles.Bottom | AnchorStyles.Left, "RemoveSplitter", "Remove colormap splitter");
            buttons[4].MouseUp = TrashButton_MouseUp;
            buttons[4].Visible = false;

            // Create cursors
            cursors = new GLCursor[2];
            cursors[0] = new GLCursor(Global.EXE_DIR + "splitterCursor.png", new Point(2, 54));
            cursors[1] = new GLCursor(Global.EXE_DIR + "interjectorCursor.png", new Point(8, 51));

            /*HISTORY_PATH = System.Reflection.Assembly.GetEntryAssembly().Location;
            HISTORY_PATH = HISTORY_PATH.Substring(0, Math.Max(HISTORY_PATH.LastIndexOf('/'), HISTORY_PATH.LastIndexOf('\\')) + 1);
            HISTORY_PATH += ".colormap";

            if(System.IO.File.Exists(HISTORY_PATH))
            {
                System.IO.StreamReader sr = new System.IO.StreamReader(HISTORY_PATH);
                while(sr.Peek() != -1)
                    history.Add(sr.ReadLine());
                sr.Close();
                history_idx = history.Count;
            }*/
        }