/// <summary>
        /// 删除任务点
        /// </summary>
        private void DeletePoint(TaskContentAsset asset, TaskContentBase content)
        {
            int index = content.Points.IndexOf(this);

            for (int i = 0; i < content.Depends.Count; i++)
            {
                TaskDepend depend = content.Depends[i];
                if (depend.OriginalPoint == index || depend.DependPoint == index)
                {
                    content.Depends.RemoveAt(i);
                    i -= 1;
                }
                else
                {
                    if (depend.OriginalPoint > index)
                    {
                        depend.OriginalPoint -= 1;
                    }
                    if (depend.DependPoint > index)
                    {
                        depend.DependPoint -= 1;
                    }
                }
            }

            content.Points.Remove(this);
            TaskContentAsset.DestroySerializeSubObject(this, asset);
        }
Example #2
0
        /// <summary>
        /// 任务点依赖GUI
        /// </summary>
        private void OnDependGUI()
        {
            if (_isShowPoint)
            {
                if (_currentContent != null)
                {
                    for (int i = 0; i < _currentContent.Depends.Count; i++)
                    {
                        TaskDepend depend = _currentContent.Depends[i];
                        Handles.DrawBezier(_currentContent.Points[depend.OriginalPoint].LeftPosition, _currentContent.Points[depend.DependPoint].RightPosition
                                           , _currentContent.Points[depend.OriginalPoint].LeftTangent, _currentContent.Points[depend.DependPoint].RightTangent, Color.white, null, 3);

                        if (_isBreakDepend)
                        {
                            Vector2 center     = (_currentContent.Points[depend.OriginalPoint].LeftPosition + _currentContent.Points[depend.DependPoint].RightPosition) * 0.5f;
                            Rect    centerRect = new Rect(center.x - 8, center.y - 8, 20, 20);
                            if (GUI.Button(centerRect, "", EditorGlobalTools.Styles.OLMinus))
                            {
                                _currentContent.Depends.RemoveAt(i);
                                break;
                            }
                            EditorGUIUtility.AddCursorRect(centerRect, MouseCursor.ArrowMinus);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 任务点依赖GUI
 /// </summary>
 private void OnDependGUI()
 {
     if (_currentContent != null)
     {
         for (int i = 0; i < _currentContent.Depends.Count; i++)
         {
             TaskDepend depend = _currentContent.Depends[i];
             Handles.DrawBezier(_currentContent.Points[depend.OriginalPoint].LeftPosition, _currentContent.Points[depend.DependPoint].RightPosition
                                , _currentContent.Points[depend.OriginalPoint].LeftTangent, _currentContent.Points[depend.DependPoint].RightTangent, Color.white, null, 3);
         }
     }
 }