Exemple #1
0
        /// <summary>
        /// 注册所有工具的相应部分上下文
        /// </summary>
        private void Init()
        {
            _cursor = new Dictionary <string, Cursor>();
            _cursor["Tool_Drag"]      = Cursors.Arrow;
            _cursor["Tool_Rectangle"] = Cursors.Cross;
            _cursor["Tool_Triangle"]  = Cursors.Cross;
            _cursor["Tool_Image"]     = Cursors.Cross;
            _cursor["Tool_QRCode"]    = Cursors.Cross;
            _cursor["Tool_Circle"]    = Cursors.Cross;
            _cursor["Tool_Text"]      = Cursors.IBeam;
            _cursor["Tool_Line"]      = Cursors.Cross;

            _toolType = new Dictionary <string, ToolType>();
            _toolType["Tool_Drag"]      = ToolType.Drag;
            _toolType["Tool_Rectangle"] = ToolType.Rectangle;
            _toolType["Tool_Triangle"]  = ToolType.Triangle;
            _toolType["Tool_Image"]     = ToolType.Image;
            _toolType["Tool_QRCode"]    = ToolType.QRCode;
            _toolType["Tool_Circle"]    = ToolType.Circle;
            _toolType["Tool_Text"]      = ToolType.Text;
            _toolType["Tool_Line"]      = ToolType.Line;

            _paintTool = new Dictionary <string, PaintToolBase>();
            _paintTool["Tool_Line"]      = new LineTool();
            _paintTool["Tool_Drag"]      = new DragTool();
            _paintTool["Tool_Triangle"]  = new TriangleTool();
            _paintTool["Tool_Circle"]    = new CircleTool();
            _paintTool["Tool_Rectangle"] = new RectangleTool();
            _paintTool["Tool_Image"]     = new ImageTool();
            _paintTool["Tool_Text"]      = new TextTool();
        }
Exemple #2
0
        static void Main()
        {
            //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            //AppDomain.CurrentDomain.UnhandledException += DumpMaker.CurrentDomain_UnhandledException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DictonariesDir = Path.Combine(Application.StartupPath, "Dictonaries");
            if (!Directory.Exists(DictonariesDir))
            {
                Directory.CreateDirectory(DictonariesDir);
            }
            TransDict    = new TranslationDictonary();
            tools        = new TextTool(Application.StartupPath);
            TessManager  = new TesseractManager();
            IconDB       = new IconManager(Application.StartupPath);
            ColorManager = new ColorSchemeManager();
            ColorManager.Load(Path.Combine(Application.StartupPath, "ColorScheme.json"));
            string testDbPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Appdata\\LocalLow\\Cygames\\umamusume\\master\\master.mdb";

            if (File.Exists(testDbPath))
            {
                DbPath = testDbPath;
            }
            else
            {
                DbPath = "master.db";
            }
            DbPath = "master.db"; //временно принудительный выбор базы и папки с программой, пока есть проблемы с определением новейшей версии
            if (IsDebug)
            {
                fLog = new Form_log();
                fLog.Show();
            }
            Application.Run(new Form1());
        }
Exemple #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     TextInfo.UpdateLayout();
     TextState.UpdateLayout();
     TextHistoryJobPieceBar.UpdateLayout();
     TextMessaggi.UpdateLayout();
     TextVariabili.UpdateLayout();
     TextTool.UpdateLayout();
 }
Exemple #4
0
 private static void SetData()
 {
     DbPath  = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Appdata\\LocalLow\\Cygames\\umamusume\\meta";
     ResPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Appdata\\LocalLow\\Cygames\\umamusume\\dat";
     tools   = new TextTool(Application.StartupPath);
     if (!Directory.Exists(ResPath) || !File.Exists(DbPath))
     {
         MessageBox.Show("Каталог с ресурсами не найден!");
         Application.Exit();
     }
 }
 static void Main()
 {
     if (TextTool.CountStringOccurrences(Filetest, "\\") >= 2)
     {
         //You have more than one folder
     }
     else
     {
         //One file no folder
     }
 }
Exemple #6
0
    /// <summary>
    /// 输入错误内容回调
    /// </summary>
    private void OnInputWrong()
    {
        TextTool.RefreshText(_promptText, _wrongPromptStr);
        Tweener tweener = _promptText.DOFade(0, _promptFadeoutTime);

        tweener.OnComplete(() =>
        {
            TextTool.ClearText(_promptText);
            TextTool.SetTextAlpha(_promptText, 1);
            _nameInput.text = string.Empty;
            SetInputInteractable(true);
        });
    }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DictonariesDir = Path.Combine(Application.StartupPath, "Dictonaries");
            if (!Directory.Exists(DictonariesDir))
            {
                Directory.CreateDirectory(DictonariesDir);
            }
            TransDict = new TranslationDictonary();
            tools     = new TextTool(Application.StartupPath);

            Application.Run(new Form1());
        }
Exemple #8
0
    /// <summary>
    /// 开场动画
    /// </summary>
    /// <returns></returns>
    private void PlayContentTextAnim()
    {
        string welcomeStr = _welcomeText.text;

        TextTool.ClearText(_welcomeText);
        TweenCallback callback = () =>
        {
            TypeWriter(_nameInput.placeholder.GetComponent <Text>(), _placeHolderStr, 2.5f, () =>
            {
                SetInputInteractable(true);
            }, ScrambleMode.None);
        };

        TypeWriter(_welcomeText, welcomeStr, 6.5f, callback, ScrambleMode.Numerals);
    }
Exemple #9
0
        protected virtual TextTool CreateTextTool()
        {
            TextTool tool = new TextTool(canvas);

            BindingOperations.SetBinding(tool, TextTool.ColorProperty, new Binding("Color")
            {
                Source = swatchesEdit, Mode = BindingMode.TwoWay
            });
            BindingOperations.SetBinding(tool, TextTool.SizeProperty, new Binding("EditValue")
            {
                Source = fontSizeEdit
            });
            BindingOperations.SetBinding(tool, TextTool.FontFamilyProperty, new Binding("EditValue")
            {
                Source = fontFamilyEdit
            });
            tool.Color = fontColorEdit.Color;
            return(tool);
        }
Exemple #10
0
        //获取卡牌描述
        private string GetCardDesc(string orignDesc)
        {
            //处理攻击
            FighterData selfData = BattleModel.Inst.selfData;

            foreach (Match match in Regex.Matches(orignDesc, PAT_ATTACK))
            {
                int damage;
                int.TryParse(Regex.Match(match.Value, @"\d+").Value, out damage);
                int    newDamage   = BattleTool.AdjustAttackVal(selfData, null, damage);
                string colorDamage = newDamage.ToString();
                if (newDamage > damage)
                {
                    colorDamage = TextTool.FormatUBBColor(colorDamage, "#00FF00");
                }
                else if (newDamage < damage)
                {
                    colorDamage = TextTool.FormatUBBColor(colorDamage, "#FF0000");
                }

                orignDesc = orignDesc.Replace(match.Value, string.Format(GameText.CARD_DAMAGE, colorDamage));
            }

            //处理防御
            foreach (Match match in Regex.Matches(orignDesc, PAT_DEFENCE))
            {
                int defence;
                int.TryParse(Regex.Match(match.Value, @"\d+").Value, out defence);
                int    newDefence   = BattleTool.AdjustArmorVal(selfData, defence);
                string colorDefence = newDefence.ToString();
                if (newDefence > defence)
                {
                    colorDefence = TextTool.FormatUBBColor(colorDefence, "#00FF00");
                }
                else if (newDefence < defence)
                {
                    colorDefence = TextTool.FormatUBBColor(colorDefence, "#FF0000");
                }
                orignDesc = orignDesc.Replace(match.Value, string.Format(GameText.CARD_DEFENCE, colorDefence));
            }

            return(orignDesc);
        }
Exemple #11
0
    /// <summary>
    /// 内容开场出现动画效果
    /// </summary>
    /// <returns></returns>
    IEnumerator PlayContentTextAnim()
    {
        string str = _contentText.text;

        TextTool.ClearText(_contentText);
        string[] strArr = str.Split('\n');
        Text[]   txtArr = new Text[strArr.Length];
        for (int i = 0; i < txtArr.Length; i++)
        {
            txtArr[i] = _contentText.transform.GetChild(i).GetComponent <Text>();
            TextTool.RefreshText(txtArr[i], strArr[i]);
            TextTool.SetTextAlpha(txtArr[i], 0);
        }

        yield return(new WaitForSeconds(1.5f));

        TweenCallback callback = () =>
        {
            _lineButton.enabled = true;
        };

        AllTextDoFade(txtArr, txtArr.Length, 2, callback);
    }
Exemple #12
0
 private void btnText_Click(object sender, EventArgs e)
 {
     canvasView1.Canvas.Tool = TextTool.GetInstance();
 }
        public IToolContext CreateToolContext()
        {
            var editorToolContext = new EditorToolContext()
            {
                ContainerFactory = this
            };

            var hitTest = new HitTest();

            var tools = new ObservableCollection <ITool>();

            var noneTool = new NoneTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    },
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    }
                },
                Settings = new NoneToolSettings()
            };

            var selectionTool = new SelectionTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new SelectionToolSettings()
                {
                    Mode                  = SelectionMode.Point | SelectionMode.Shape,
                    Targets               = SelectionTargets.Shapes,
                    SelectionModifier     = Modifier.Control,
                    ConnectionModifier    = Modifier.Shift,
                    SelectionStyle        = "Selection",
                    ClearSelectionOnClean = false,
                    HitTestRadius         = 7.0,
                    ConnectPoints         = true,
                    ConnectTestRadius     = 10.0,
                    DisconnectPoints      = true,
                    DisconnectTestRadius  = 10.0
                }
            };

            var pointTool = new PointTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new PointToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var lineTool = new LineTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new LineToolSettings()
                {
                    ConnectPoints      = true,
                    HitTestRadius      = 7.0,
                    SplitIntersections = false
                }
            };

            var polyLineTool = new PolyLineTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new PolyLineToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var cubicBezierTool = new CubicBezierTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new CubicBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var quadraticBezierTool = new QuadraticBezierTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new QuadraticBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var conicTool = new ConicTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new ConicToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0,
                    Weight        = 1.0
                }
            };

            var pathTool = new PathTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new PathToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0,
                    FillType      = PathFillType.Winding,
                    IsFilled      = true,
                    IsClosed      = true
                }
            };

            pathTool.Settings.Tools = new ObservableCollection <ITool>
            {
                new LineTool(),
                new CubicBezierTool(),
                new QuadraticBezierTool(),
                new ConicTool(),
                new MoveTool(pathTool)
            };
            pathTool.Settings.CurrentTool = pathTool.Settings.Tools[0];

            var scribbleTool = new ScribbleTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new ScribbleToolSettings()
                {
                    Simplify = true,
                    Epsilon  = 1.0,
                    FillType = PathFillType.Winding,
                    IsFilled = false,
                    IsClosed = false
                }
            };

            var rectangleTool = new RectangleTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new RectangleToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var ellipseTool = new EllipseTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new EllipseToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var textTool = new TextTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new TextToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            void SetToolDefaults(ITool tool)
            {
                tool.CurrentIntersection = tool.Intersections.Count > 0 ? tool.Intersections[0] : null;
                tool.CurrentFilter       = tool.Filters.Count > 0 ? tool.Filters[0] : null;
            }

            SetToolDefaults(noneTool);
            SetToolDefaults(selectionTool);
            SetToolDefaults(pointTool);
            SetToolDefaults(lineTool);
            SetToolDefaults(polyLineTool);
            SetToolDefaults(cubicBezierTool);
            SetToolDefaults(quadraticBezierTool);
            SetToolDefaults(conicTool);
            SetToolDefaults(pathTool);
            SetToolDefaults(scribbleTool);
            SetToolDefaults(rectangleTool);
            SetToolDefaults(ellipseTool);
            SetToolDefaults(textTool);

            tools.Add(noneTool);
            tools.Add(selectionTool);
            tools.Add(pointTool);
            tools.Add(lineTool);
            tools.Add(polyLineTool);
            tools.Add(cubicBezierTool);
            tools.Add(quadraticBezierTool);
            tools.Add(conicTool);
            tools.Add(pathTool);
            tools.Add(scribbleTool);
            tools.Add(rectangleTool);
            tools.Add(ellipseTool);
            tools.Add(textTool);

            editorToolContext.Selection        = selectionTool;
            editorToolContext.HitTest          = hitTest;
            editorToolContext.CurrentDirectory = null;
            editorToolContext.Files            = new ObservableCollection <string>();

            editorToolContext.StyleLibrary = null;
            editorToolContext.GroupLibrary = null;

            var pointTemplate = new RectangleShape(new PointShape(-4, -4, null), new PointShape(4, 4, null))
            {
                Points  = new ObservableCollection <IPointShape>(),
                Text    = new Text(),
                StyleId = "PointTemplate"
            };

            pointTemplate.StartPoint.Owner = pointTemplate;
            pointTemplate.Point.Owner      = pointTemplate;

            editorToolContext.PointTemplate = pointTemplate;

            editorToolContext.ContainerViews = new ObservableCollection <IContainerView>();
            editorToolContext.ContainerView  = null;
            editorToolContext.Tools          = tools;
            editorToolContext.CurrentTool    = selectionTool;
            editorToolContext.EditMode       = EditMode.Mouse;

            return(editorToolContext);
        }
Exemple #14
0
        public LayerContainerViewModel CreateDemoViewModel()
        {
            var hitTest = new HitTest();

            hitTest.Register(new PointHitTest());
            hitTest.Register(new LineHitTest());
            hitTest.Register(new CubicBezierHitTest());
            hitTest.Register(new QuadraticBezierHitTest());
            hitTest.Register(new GroupHitTest());
            hitTest.Register(new PathHitTest());
            hitTest.Register(new RectangleHitTest());
            hitTest.Register(new EllipseHitTest());
            hitTest.Register(new TextHitTest());

            var gridSnapPointFilter = new GridSnapPointFilter()
            {
                Settings = new GridSnapSettings()
                {
                    IsEnabled    = true,
                    EnableGuides = false,
                    Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                    GridSizeX    = 15.0,
                    GridSizeY    = 15.0,
                    GuideStyle   = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                }
            };

            var lineSnapPointFilter = new LineSnapPointFilter()
            {
                Settings = new LineSnapSettings()
                {
                    IsEnabled    = true,
                    EnableGuides = false,
                    Target       = LineSnapTarget.Guides | LineSnapTarget.Shapes,
                    Mode         = LineSnapMode.Point
                                   | LineSnapMode.Middle
                                   | LineSnapMode.Nearest
                                   | LineSnapMode.Intersection
                                   | LineSnapMode.Horizontal
                                   | LineSnapMode.Vertical,
                    Threshold  = 10.0,
                    GuideStyle = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                }
            };

            var tools = new ObservableCollection <ToolBase>();

            var noneTool = new NoneTool()
            {
                Settings = new NoneToolSettings()
            };

            var selectionTool = new SelectionTool()
            {
                Filters = new List <PointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                        }
                    }
                },
                Settings = new SelectionToolSettings()
                {
                    Mode                  = SelectionMode.Point | SelectionMode.Shape,
                    Targets               = SelectionTargets.Shapes | SelectionTargets.Guides,
                    SelectionModifier     = Modifier.Control,
                    ConnectionModifier    = Modifier.Shift,
                    SelectionStyle        = new ShapeStyle(new ArgbColor(255, 0, 120, 215), new ArgbColor(60, 170, 204, 238), 2.0, true, true),
                    ClearSelectionOnClean = false,
                    HitTestRadius         = 7.0,
                    ConnectPoints         = true,
                    ConnectTestRadius     = 10.0,
                    DisconnectPoints      = true,
                    DisconnectTestRadius  = 10.0
                }
            };

            var guideTool = new GuideTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new GuideToolSettings()
                {
                    GuideStyle = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                }
            };

            var pointTool = new PointTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new PointToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var lineTool = new LineTool()
            {
                Intersections = new List <PointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Settings = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Settings = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Settings = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new LineToolSettings()
                {
                    ConnectPoints      = true,
                    HitTestRadius      = 7.0,
                    SplitIntersections = false
                }
            };

            var polyLineTool = new PolyLineTool()
            {
                Intersections = new List <PointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Settings = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Settings = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Settings = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new PolyLineToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var cubicBezierTool = new CubicBezierTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new CubicBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var quadraticBezierTool = new QuadraticBezierTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new QuadraticBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var pathTool = new PathTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new PathToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0,
                    FillRule      = PathFillRule.EvenOdd,
                    IsFilled      = true,
                    IsClosed      = true
                }
            };

            pathTool.Settings.Tools = new ObservableCollection <ToolBase>
            {
                new LineTool(),
                new CubicBezierTool(),
                new QuadraticBezierTool(),
                new MoveTool(pathTool)
            };
            pathTool.Settings.CurrentTool = pathTool.Settings.Tools[0];

            var scribbleTool = new ScribbleTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter
                },
                Settings = new ScribbleToolSettings()
                {
                    Simplify = true,
                    Epsilon  = 1.0,
                    FillRule = PathFillRule.EvenOdd,
                    IsFilled = false,
                    IsClosed = false
                }
            };

            var rectangleTool = new RectangleTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new RectangleToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var ellipseTool = new EllipseTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new EllipseToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var textTool = new TextTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new TextToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            tools.Add(noneTool);
            tools.Add(selectionTool);
            tools.Add(guideTool);
            tools.Add(pointTool);
            tools.Add(lineTool);
            tools.Add(polyLineTool);
            tools.Add(cubicBezierTool);
            tools.Add(quadraticBezierTool);
            tools.Add(pathTool);
            tools.Add(scribbleTool);
            tools.Add(rectangleTool);
            tools.Add(ellipseTool);
            tools.Add(textTool);

            var currentTool = tools.FirstOrDefault(t => t.Title == "Selection");

            var presenter = new DefaultShapePresenter()
            {
                Helpers = new Dictionary <Type, ShapeHelper>
                {
                    { typeof(PointShape), new PointHelper() },
                    { typeof(LineShape), new LineHelper() },
                    { typeof(CubicBezierShape), new CubicBezierHelper() },
                    { typeof(QuadraticBezierShape), new QuadraticBezierHelper() },
                    { typeof(PathShape), new PathHelper() },
                    { typeof(RectangleShape), new RectangleHelper() },
                    { typeof(EllipseShape), new EllipseHelper() },
                    { typeof(TextShape), new TextHelper() }
                }
            };

            return(new LayerContainerViewModel()
            {
                Tools = tools,
                CurrentTool = currentTool,
                Mode = EditMode.Mouse,
                Presenter = presenter,
                Renderer = null,
                HitTest = hitTest,
                CurrentContainer = null,
                WorkingContainer = null,
                CurrentStyle = null,
                PointShape = null,
                Capture = null,
                Release = null,
                Invalidate = null,
                Reset = null,
                AutoFit = null,
                StretchNone = null,
                StretchFill = null,
                StretchUniform = null,
                StretchUniformToFill = null
            });
        }
Exemple #15
0
 private void InitDataFromKeys(UILevel003Key key)
 {
     TextTool.RefreshText(_promptText, key.promptStr);
 }
Exemple #16
0
 /// <summary>
 /// 输入正确内容回调
 /// </summary>
 private void OnInputRight()
 {
     TextTool.RefreshText(_promptText, _rightPromptStr);
     TextTool.SetTextAlpha(_promptText, 0);
     _promptText.DOFade(1, 2f).onComplete = () => { _touchButton.enabled = true; };
 }
Exemple #17
0
    private static void CreateWindow()
    {
        TextTool window = GetWindowWithRect <TextTool>(new Rect(0, 0, 450, 720), false, "Text工具");

        window.Show();
    }
Exemple #18
0
        public void run2()
        {
            // listBox4_blk.Items.Clear();

            // calcu get cost/size keyword | for example www.taiol.ir= 400
            //  textBox1.Text = key_web(AcquireHTML(textBox2.Text));
            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                int keyword_firstpage = 0;
                int Feature_Url       = 0;

                txthtml = AcquireHTML(listBox1.Items[i].ToString());

                //بررسی وجود کلمات کلیدی تبلیغاتی در توضیحات وب سایت
                // c_k = info_link_count(key_web(txthtml));

                //بررسی وجود کلمات کلیدی در صفحه اول
                // c_k += info_link_count(txthtml);
                c_k = 0;

                // feature url
                //بررسی ویژگی های یو آر ال

                Feature_Url = info_link_url(listBox1.Items[i].ToString());

                // c_k= in_lik(txthtml).ToString();



                // calcu get cost/size description website | for example www.taiol.ir= 290

                // بررسی و محاسبه تعداد کلمات کلیدی در صفحه اول
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "تبلیغات");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "آگهی");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "رایگان");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "تومان");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "خرید");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "درج آگهی");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "برنده");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, " تبلیغات رایگان");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "فروش");
                keyword_firstpage += TextTool.CountStringOccurrences(txthtml, "ماهانه فقط");
                //j += TextTool.CountStringOccurrences(AcquireHTML(listBox1.Items[i].ToString()), "پردا");
                txthtml = "";



                // check is or is'nt website in blacklist | for example www.taiol.ir= false



                ///clacu get count of local link each link
                ///
                string g = "null";

                //  search2("site:" + listBox1.Items[i].ToString() + " " + "تومان + آگهی + تبلیغات + خرید", listBox1.Items[i].ToString() ,out g);

                link_count = g;



                //textBox8.Text += i + ":" + listBox1.Items[i].ToString() + ": " + keyword_firstpage + "-" + c_k + Environment.NewLine;

                //  listBox4.Items.Insert(i, j +" - "+ int.Parse(c_k) + " - " + link_count);


                // check in black list

                int blk = 0;


                blk = chech_blk_list(listBox1.Items[i].ToString());

                textBox6.Text += i + ":" + listBox1.Items[i].ToString() + " --->      keyword_firstpage:" + keyword_firstpage + " blk_list:" + blk + " Feature_Url:" + Feature_Url + Environment.NewLine;



                c_adv(keyword_firstpage, c_k, Feature_Url, i, listBox1.Items[i].ToString(), blk);

                //  j.ToString(), c_k.ToString(), link_count, link_feature

                // c_adv(c_k,j,i);

                //if (c_k > 70 & j > 30 || j > 70 & c_k > 30)
                //{

                //     listBox4.Items.Insert(i, listBox1.Items[i].ToString());
                // textBox8.Text += i + ":" + listBox1.Items[i].ToString() + ": " + j + "-" + c_k + Environment.NewLine;

                //   }

                // string blk = "0";
                //  insert_gt(i.ToString(), listBox1.Items[i].ToString(), keyword_firstpage.ToString(), "", Feature_Url,"");

                //   insert_gt(i.ToString(), listBox1.Items[i].ToString(), blk.ToString(), keyword_firstpage.ToString(),Feature_Url.ToString(),"0");


                // label1.Text = i2 + "";

                // c_k = 0;
            }
        }