Inheritance: EditorWindow
Beispiel #1
0
        void SetEditorStatus()
        {
            // If we already have a working collider then we're in the middle of Editing
            if (workingCollider != null)
            {
                this.editorStatus = EditorStatus.Editing;
            }
            else if (Selection.activeGameObject != null)
            {
                var t = Selection.activeGameObject.transform;

                // Check for non-uniform scale on target object and all its ancestors
                while (t != null)
                {
                    var targetObjectScale = t.localScale;

                    if (Math.Abs(targetObjectScale.x - targetObjectScale.y) > 0.0001f ||
                        Math.Abs(targetObjectScale.x - targetObjectScale.z) > 0.0001f)
                    {
                        this.editorStatus = EditorStatus.NonUniformScale;
                        return;
                    }

                    t = t.parent;
                }

                this.editorStatus = EditorStatus.Ready;
            }
            else
            {
                // This usually means that nothing is selected in the editor
                this.editorStatus = EditorStatus.InvalidSelection;
            }
        }
Beispiel #2
0
        public void ShowEditor(CellItem p_cell, EditorStatus p_status)
        {
            ResetEditorCell(p_cell, p_status);

            // 双击显示光标,IsHitTestVisible为false可控制光标不显示
            // 保证Editor再次点击时不失去焦点
            Editor.IsHitTestVisible = true;
            Editor.Opacity          = 1.0;

            var       cell = _editingCell.BindingCell;
            StyleInfo info = cell.Worksheet.GetActualStyleInfo(cell.Row.Index, cell.Column.Index, cell.SheetArea, true);

            if (info == null)
            {
                return;
            }

            // Enter状态表示因键盘输入触发,不需要给Editor设置Cell原有的Text
            // Edit状态表示双击触发
            bool isFormula = false;

            if (p_status != EditorStatus.Enter)
            {
                isFormula = ApplyEditorText(info);
            }
            ApplyEditorStyle(info, isFormula);
            Editor.Focus(FocusState.Programmatic);

            InvalidateMeasure();
            InvalidateArrange();
        }
        private void updateEditorStatus()
        {
            // Updates editor status label, lights, and error messages (if time has passed since last keystroke)
            if (DateTime.Now.Subtract(lastTime).Milliseconds / 1000.0f > statusDelay)
            {
                // Try to interpret scripts
                StatusText = "Status: Interpreting...";
                bool valid = true;

                if (valid)
                {
                    // If valid, save
                    StatusText = "Status: Saved.";
                    _status    = EditorStatus.Green;
                }
                else
                {
                    // Otherwise, highlight errors
                    StatusText = "Status: Errors Found";
                    _status    = EditorStatus.Red;
                }
            }
            else
            {
                // Status label should instead report cursor position
                Point pos = CursorPosition;
                StatusText = "Cursor position: Row " + pos.Y + ", Col " + pos.X;
                _status    = EditorStatus.Yellow;
            }
        }
    /// <summary>
    /// 设置编辑状态
    /// </summary>
    public void SetEditorStatus()
    {
        // 如果已经有了碰撞盒
        if (WorkingCollider != null)
        {
            EditorStatus = EditorStatus.编辑;
        }
        else if (Selection.activeGameObject != null)
        {
            var selectTrans = Selection.activeGameObject.transform;

            // 检查非均匀尺度目标对象和它的所有父物体
            while (selectTrans != null)
            {
                var targetObjectScale = selectTrans.localScale;
                if (Math.Abs(targetObjectScale.x - targetObjectScale.y) > 0.0001f ||
                    Math.Abs(targetObjectScale.x - targetObjectScale.z) > 0.0001f)
                {
                    EditorStatus = EditorStatus.非均匀尺度;
                    return;
                }

                selectTrans = selectTrans.parent;
            }

            EditorStatus = EditorStatus.准备;
        }
        else
        {
            // 没有选择任何内容
            EditorStatus = EditorStatus.无效的选择;
        }
    }
        public EditorStatus clone()
        {
            EditorStatus ret = new EditorStatus();

            for (int i = 0; i < renderRequired.Length; i++)
            {
                ret.renderRequired[i] = renderRequired[i];
            }
            return(ret);
        }
Beispiel #6
0
 /// <summary>
 /// 解析驱动内容
 /// </summary>
 /// <param name="content">内容</param>
 public void ParseContent(string content)
 {
     ability = DataDrivenFactory.ParseConfig(content);
     if (ability == null)
     {
         this.ShowNotification(new GUIContent("解析驱动失败!!!"));
         return;
     }
     _status = EditorStatus.Editor;
 }
Beispiel #7
0
        void ResetEditorCell(CellItem p_cell, EditorStatus p_status)
        {
            _editingCell = p_cell;
            EditorDirty  = false;
            int row    = p_cell.Row;
            int column = p_cell.Column;

            if (p_cell.CellLayout != null)
            {
                row    = p_cell.CellLayout.Row;
                column = p_cell.CellLayout.Column;
            }
            EditingColumnIndex = column;
            EditingRowIndex    = row;
            EditorStatus       = p_status;
        }
Beispiel #8
0
 /// <summary>
 /// gui渲染
 /// </summary>
 private void OnGUI()
 {
     if (_status == EditorStatus.Welcome)
     {
         DDWelcome.OnGUI(this);
     }
     else if (_status == EditorStatus.Editor)
     {
         if (ability == null)
         {
             _status = EditorStatus.Welcome;
             return;
         }
         DDEditor.OnGUI(this, ability);
     }
 }
Beispiel #9
0
        public bool StartTextInput(int row, int column, EditorStatus status, bool canModifyTextBox, bool selectAll = false, string defaultText = null)
        {
            if (IsEditing())
            {
                return(true);
            }

            CellItem cell = GetViewportCell(row, column, true);

            if (cell == null)
            {
                return(false);
            }

            ShowSheetCell(row, column);
            if (Excel.RaiseEditStarting(row, column))
            {
                return(false);
            }

            _editorLayer.ShowEditor(cell, status);
            _editorLayer.EditingChanged += new EventHandler(_editorPanel_EdtingChanged);

            if (canModifyTextBox)
            {
                var editor = _editorLayer.Editor;
                if (defaultText != null)
                {
                    editor.Text = defaultText;
                }

                if (selectAll)
                {
                    editor.SelectAll();
                }
                else
                {
                    editor.SelectionStart = editor.Text.Length;
                }
            }
            return(true);
        }
        public SerializedExpressionEditor(SerializedObject serializedObject, VRM10Expression targetObject,
                                          PreviewSceneManager previewSceneManager, EditorStatus status)
        {
            m_status = status;
            this.m_serializedObject = serializedObject;
            this.m_targetObject     = targetObject;

            m_expressionNameProp = serializedObject.FindProperty("expressionName");
            m_presetProp         = serializedObject.FindProperty("Preset");
            m_isBinaryProp       = serializedObject.FindProperty("IsBinary");
            m_ignoreBlinkProp    = serializedObject.FindProperty("IgnoreBlink");
            m_ignoreLookAtProp   = serializedObject.FindProperty("IgnoreLookAt");
            m_ignoreMouthProp    = serializedObject.FindProperty("IgnoreMouth");

            m_morphTargetBindings   = new ReorderableMorphTargetBindingList(serializedObject, previewSceneManager, 20);
            m_materialColorBindings = new ReorderableMaterialColorBindingList(serializedObject, previewSceneManager?.MaterialNames, 20);
            m_materialUVBindings    = new ReorderableMaterialUVBindingList(serializedObject, previewSceneManager?.MaterialNames, 20);

            m_items = previewSceneManager.EnumRenderItems
                      .Where(x => x.SkinnedMeshRenderer != null)
                      .ToArray();
        }
 public SerializedExpressionEditor(VRM10Expression expression,
                                   PreviewSceneManager previewSceneManager, EditorStatus status) : this(
         new SerializedObject(expression), expression, previewSceneManager, status)
 {
 }
Beispiel #12
0
        //********************************************************************************
        // OnInspectorGUI
        //********************************************************************************
        public override void OnInspectorGUI()
        {
            EditorBehaviour.BehaviourSelectIndex = 0;
            Info.HelpButtonIndex = 0;

            if (m_creature_debug != null)
            {
                m_creature_control.Display.ShowDebug = m_creature_debug.enabled;
            }
            else
            {
                m_creature_control.Display.ShowDebug = false;
            }

            GUI.changed = false;

            EditorGUILayout.Separator();

            Info.HelpEnabled        = m_creature_control.Display.ShowHelp;
            Info.DescriptionEnabled = m_creature_control.Display.ShowHelpDescription;

            // COCKPIT
            EditorRegister.Print(m_creature_control.gameObject.name);
            EditorDisplay.Print(m_creature_control.Display);
            EditorInfo.Print(m_creature_control);

            // ESSENTIALS
            EditorEssentials.Print(m_creature_control);

            // STATUS
            EditorStatus.Print(m_creature_control);

            // MISSIONS
            EditorMissions.Print(m_creature_control);

            // INTERACTION
            EditorInteraction.Print(m_creature_control);

            // ENVIRONMENT
            EditorEnvironment.Print(m_creature_control);

            //BEHAVIOURS
            EditorBehaviour.Print(m_creature_control);


            if (m_creature_control.Display.ShowDebug)
            {
                if (m_creature_debug == null)
                {
                    m_creature_debug = m_creature_control.gameObject.AddComponent <ICECreatureControlDebug>();
                }
                else if (m_creature_debug.enabled == false)
                {
                    m_creature_debug.enabled = true;
                }
            }
            else if (m_creature_debug != null)
            {
                m_creature_debug.enabled = false;

                /*
                 * DestroyImmediate( m_creature_control.GetComponent<ICECreatureControlDebug>() );
                 * EditorGUIUtility.ExitGUI();*/
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(m_creature_control);
            }
        }
Beispiel #13
0
 public bool StartTextInput(int row, int column, EditorStatus status)
 {
     return(StartTextInput(row, column, status, false, false, null));
 }
Beispiel #14
0
 public bool StartCellEditing(int row, int column, bool selectAll, string defaultText, EditorStatus status)
 {
     return(StartTextInput(row, column, status, true, selectAll, defaultText));
 }
 public SerializedBlendShapeEditor(BlendShapeClip blendShapeClip,
                                   PreviewSceneManager previewSceneManager, EditorStatus status) : this(
         new SerializedObject(blendShapeClip), blendShapeClip, previewSceneManager, status)
 {
 }
Beispiel #16
0
        public override int GetHashCode()
        {
            var sum = Color.GetHashCode() + CurrentOperation.GetHashCode() + EditorStatus.GetHashCode();

            return(sum.GetHashCode());
        }