Ejemplo n.º 1
0
 public BulletEmission(double w, double c, Trajectory[] bulletTrajectory, BulletStyle sty)
 {
     this.Warmup      = w;
     this.Cooldown    = c;
     this.BulletPaths = bulletTrajectory;
     this.bSty        = sty;
 }
Ejemplo n.º 2
0
    public static EnemyBulletController Create(BulletStyle bulletStyle, float bulletSpeed, Rigidbody2D playerRb, Rigidbody2D enemyRb,
                                               GameObject bulletPrefab, float minDeltaT, float maxDeltaT)
    {
        EnemyBulletController obj = null;


        switch (bulletStyle)
        {
        case BulletStyle.DirectDown:
            obj = new BulletDirectDown();
            break;

        case BulletStyle.At45DegreesToAquarium:
            obj = new BulletAt45DegreesToAquarium();
            break;

        default:
            return(null);
        }

        obj.bulletSpeed     = bulletSpeed;
        obj.playerRb        = playerRb;
        obj.enemyRb         = enemyRb;
        obj.bulletFrequency = Random.Range(minDeltaT, maxDeltaT);
        obj.bulletPrefab    = bulletPrefab;
        return(obj);
    }
Ejemplo n.º 3
0
        protected void BulletedList1_Click(object sender, BulletedListEventArgs e)
        {
            string      styleName = BulletedList1.Items[e.Index].Text;
            BulletStyle style     = (BulletStyle)Enum.Parse(typeof(BulletStyle), styleName);

            BulletedList1.BulletStyle = style;
        }
Ejemplo n.º 4
0
        private BulletStyle GetBulletStyle()
        {
            SelectionState selected = IsSourceSelected();

            BulletStyle style = _listStyle.BulletStyle;

            switch (selected)
            {
            case SelectionState.Selected:
                style = _listStyle.SelectedBulletStyle;
                break;

            case SelectionState.NotSelected:
                style = _listStyle.UnselectedBulletStyle;
                break;

            case SelectionState.NotSelectable:
                style = _listStyle.BulletStyle;
                break;
            }

            //	If either the selected or unselected bullet style was chosen, but is null, then
            //	use the regular bullet style
            if (style == null)
            {
                style = _listStyle.BulletStyle;
            }
            return(style);
        }
Ejemplo n.º 5
0
        private void SetNumber(int number)
        {
            //	The bullet layout must become _subLayouts[1]
            if (_subLayouts.Count == 0)
            {
                throw new InvalidOperationException("Must set content before setting the bullet number.");
            }
            if (_subLayouts.Count != 1)
            {
                throw new InvalidOperationException("Bullet number is already set.");
            }

            _number = number;

            //	Get the bullet style, which can vary based on whether the source control
            //	is selected, and then construct a corresponding text style
            BulletStyle bulletStyle = GetBulletStyle();
            TextStyle   style       = new TextStyle();

            style.Base         = _listStyle.ItemStyle;
            style.Font         = bulletStyle.Font;
            style.Color        = bulletStyle.Color;
            style.Padding      = bulletStyle.Padding;
            style.Name         = bulletStyle.Name;
            style.LineNumber   = bulletStyle.LineNumber;
            style.LinePosition = bulletStyle.LinePosition;

            //	Get the bullet text, which is defined by the bullet style
            string text = GetBulletText(bulletStyle);

            //	Create the bullet layout
            _bulletLayout = new     TextLayout(text, style, _generator, _trackingInfo.LineNumber, _trackingInfo.LinePosition);
            AddSubLayout(_bulletLayout);             // must become _subLayouts[1]
        }
Ejemplo n.º 6
0
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     style  = gameObject.GetComponent <BulletStyle>();
     GetWorldLimit();
     maxHp = hitPoint;
     touchDamageInterval /= (int)Title.mode;
 }
Ejemplo n.º 7
0
        public BulletStyle MakeStyle(string s, Drawable d, PhysicsShape ps)
        {
            BulletStyle ans = (t, path, pc) =>
            {
                return(new Bullet(t, path, d, ps, pc, null));
            };

            savedStyles[s] = ans;
            return(ans);
        }
Ejemplo n.º 8
0
        public BulletStyle MakeStyle(string s, PhysicsShape p, GraphicsStyle sty)
        {
            BulletStyle ans = (t, path, pc) =>
            {
                return(new Bullet(t, path, p.MakeDrawable(sty), p, pc, null));
            };

            savedStyles[s] = ans;
            return(ans);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Get template of each attribute type
        /// it is used in TextRangeFindDialog.
        /// </summary>
        /// <returns></returns>
        public static IList <TemplateData> GetTemplate()
        {
            var boolList = new List <KeyValuePair <bool, string> >()
            {
                new KeyValuePair <bool, string>(false, "False"), new KeyValuePair <bool, string>(true, "True")
            };

            return(new List <TemplateData>
            {
                CreateTemplateData <int>(UIA_AnimationStyleAttributeId, AnimationStyle.GetInstance()),
                CreateTemplateData <int>(UIA_BackgroundColorAttributeId),
                CreateTemplateData <int>(UIA_BulletStyleAttributeId, BulletStyle.GetInstance()),
                CreateTemplateData <int>(UIA_CapStyleAttributeId, CapStyle.GetInstance()),
                CreateTemplateData <int>(UIA_CultureAttributeId, CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures).Select(c => new KeyValuePair <int, string>(c.LCID, c.EnglishName)).ToList()),
                CreateTemplateData <string>(UIA_FontNameAttributeId),
                CreateTemplateData <double>(UIA_FontSizeAttributeId),
                CreateTemplateData <int>(UIA_FontWeightAttributeId, FontWeight.GetInstance()),
                CreateTemplateData <int>(UIA_ForegroundColorAttributeId),
                CreateTemplateData <int>(UIA_HorizontalTextAlignmentAttributeId, HorizontalTextAlignment.GetInstance()),
                CreateTemplateData <int>(UIA_IndentationFirstLineAttributeId),
                CreateTemplateData <int>(UIA_IndentationLeadingAttributeId),
                CreateTemplateData <int>(UIA_IndentationTrailingAttributeId),
                CreateTemplateData <bool>(UIA_IsHiddenAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsItalicAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsReadOnlyAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsSubscriptAttributeId, boolList),
                CreateTemplateData <bool>(UIA_IsSuperscriptAttributeId, boolList),
                CreateTemplateData <int>(UIA_MarginBottomAttributeId),
                CreateTemplateData <int>(UIA_MarginLeadingAttributeId),
                CreateTemplateData <int>(UIA_MarginTopAttributeId),
                CreateTemplateData <int>(UIA_MarginTrailingAttributeId),
                CreateTemplateData <int>(UIA_OutlineStylesAttributeId, OutlineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_OverlineColorAttributeId),
                CreateTemplateData <int>(UIA_OverlineStyleAttributeId, TextDecorationLineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_StrikethroughColorAttributeId),
                CreateTemplateData <int>(UIA_StrikethroughStyleAttributeId, TextDecorationLineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_TabsAttributeId),
                CreateTemplateData <int>(UIA_TextFlowDirectionsAttributeId, FlowDirection.GetInstance()),
                CreateTemplateData <int>(UIA_UnderlineColorAttributeId),
                CreateTemplateData <int>(UIA_UnderlineStyleAttributeId, TextDecorationLineStyle.GetInstance()),
                CreateTemplateData <int>(UIA_AnnotationTypesAttributeId, AnnotationType.GetInstance()),
                //CreateTemplateData<int>(UIA_AnnotationObjectsAttributeId, AnimationStyles.GetInstance()),
                CreateTemplateData <string>(UIA_StyleNameAttributeId),
                CreateTemplateData <int>(UIA_StyleIdAttributeId, StyleId.GetInstance()),
                //CreateTemplateData<int>(UIA_LinkAttributeId, AnimationStyles.GetInstance()),
                CreateTemplateData <bool>(UIA_IsActiveAttributeId, boolList),
                CreateTemplateData <int>(UIA_SelectionActiveEndAttributeId, ActiveEnd.GetInstance()),
                CreateTemplateData <int>(UIA_CaretPositionAttributeId, CaretPosition.GetInstance()),
                CreateTemplateData <int>(UIA_CaretBidiModeAttributeId, CaretBidiMode.GetInstance()),
                CreateTemplateData <string>(UIA_LineSpacingAttributeId),
                CreateTemplateData <double>(UIA_BeforeParagraphSpacingAttributeId),
                CreateTemplateData <double>(UIA_AfterParagraphSpacingAttributeId),
                CreateTemplateData <int>(UIA_SayAsInterpretAsAttributeId, SayAsInterpretAs.GetInstance()),
            });
        }
Ejemplo n.º 10
0
        public Bullet(object tt, float x, float y, int size, double deg, double sp, BulletStyle bs, Color cc) : base(tt)
        {
            Width      = size;
            Height     = size;
            X          = x - size / 2;
            Y          = y - size / 2;
            thisClolor = cc;
            Degree     = deg;
            Speed      = sp;

            style = bs;

            canCheck  = false;
            canBreak  = true;
            canAttack = true;
            canShoot  = false;
        }
Ejemplo n.º 11
0
        private string GetBulletText(BulletStyle style)
        {
            string number = null;

            switch (style.NumberStyle)
            {
            case ListNumberStyle.Bullet:
                number = style.BulletText;
                break;

            case ListNumberStyle.Number:
                number = _number.ToString();
                break;

            case ListNumberStyle.AlphaLower:
                number = Alpha(_number);
                break;

            case ListNumberStyle.AlphaUpper:
                number = Alpha(_number).ToUpperInvariant();
                break;

            case ListNumberStyle.RomanLower:
                number = Roman(_number);
                break;

            case ListNumberStyle.RomanUpper:
                number = Roman(_number).ToUpperInvariant();
                break;

            case ListNumberStyle.GreekLower:
                number = Greek(_number);
                break;

            case ListNumberStyle.GreekUpper:
                number = Greek(_number).ToUpperInvariant();
                break;

            default:
                number = _number.ToString();
                break;
            }

            return(style.BulletText.Replace(BulletNumberProperty, number));
        }
Ejemplo n.º 12
0
        public MainChar(Drawable d, BulletStyle sty, double x0, double y0, double s = 20, GraphicsStyle g = null) : base(0, null, d, new Point(2), new EntityClass("MainChar", "Character"), null, g)
        {
            speed    = s;
            this.x0  = x0;
            this.y0  = y0;
            vxf      = new PolyFunc <double, double>(0);
            vyf      = new PolyFunc <double, double>(0);
            xp       = t => x0;
            yp       = t => y0;
            Position = new Particle(t => xp(t), t => yp(t));
            BulletEmission em = new BulletEmission(0, 0.25,
                                                   sty,
                                                   TrajectoryFactory.SimpleVel(2, -40, 5),
                                                   TrajectoryFactory.SimpleVel(-2, -40, -5)
                                                   );

            BulletPattern pat = new BulletPattern(new EntityClass("MainCharBullet", "Bullet"), em);

            Emitter = new BulletEmitter(-1, pat);
            Time    = 0;
        }
Ejemplo n.º 13
0
        protected void Button_Click(object sender, EventArgs e)
        {
            if (StylesList.SelectedItem == null)
            {
                return;
            }

            string styleName = StylesList.SelectedItem.Text;

            object      temp   = Enum.Parse(typeof(BulletStyle), styleName);
            BulletStyle bStyle = (BulletStyle)temp;

            BullettedList1.BulletStyle = bStyle;

            // или так

            /*
             * switch (styleName)
             * {
             *  case "Numbered":
             *      BullettedList1.BulletStyle = BulletStyle.Numbered;
             *      break;
             *  case "LowerAlpha":
             *      BullettedList1.BulletStyle = BulletStyle.LowerAlpha;
             *      break;
             *  case "UpperAlpha":
             *      BullettedList1.BulletStyle = BulletStyle.UpperAlpha;
             *      break;
             *
             *  .......
             *
             *
             *  default:
             *      break;
             * }
             */
        }
Ejemplo n.º 14
0
 public BulletEmission(double w, double c, BulletStyle sty, params Trajectory[] trajs)
     : this(w, c, trajs, sty)
 {
 }
Ejemplo n.º 15
0
        public static MvcHtmlString BulletList(this HtmlHelper helper, IEnumerable <string> items, BulletStyle bulletStyle = BulletStyle.Disk)
        {
            string html       = "<ul style='list-style-type:{0}'>{1}</ul>";
            string bulletType = "disk";

            switch (bulletStyle)
            {
            case BulletStyle.Disk:
                bulletType = "disk";
                break;

            case BulletStyle.Square:
                bulletType = "square";
                break;

            case BulletStyle.Circle:
                bulletType = "circle";
                break;

            case BulletStyle.LowerRoman:
                bulletType = "lower-roman";
                break;

            case BulletStyle.UpperRoman:
                bulletType = "upper-roman";
                break;

            default:
                break;
            }

            string liTemplate = "<li>{0}</li>";
            string liHtml     = "";

            foreach (var item in items)
            {
                var itemLi = string.Format(liTemplate, item);
                liHtml = liHtml + itemLi;
            }
            html = string.Format(html, bulletType, liHtml);
            return(new MvcHtmlString(html));
        }
        private List <TextAttributeViewModel> GetTextRangeAttributeKeyValuePair(TextRange tr, KeyValuePair <int, string> kv, bool collapse)
        {
            List <TextAttributeViewModel> list = new List <TextAttributeViewModel>();

            dynamic value = tr.GetAttributeValue(kv.Key);

            switch (kv.Key)
            {
            case TextAttributeType.UIA_AnimationStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnimationStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_BackgroundColorAttributeId:
            case TextAttributeType.UIA_ForegroundColorAttributeId:
            case TextAttributeType.UIA_OverlineColorAttributeId:
            case TextAttributeType.UIA_StrikethroughColorAttributeId:
            case TextAttributeType.UIA_UnderlineColorAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, string.Format("#{0:X8}", value)));
                }
                break;

            case TextAttributeType.UIA_BulletStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, BulletStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CapStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CapStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CultureAttributeId:
                if (value is int culture)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Invariant($"{CultureInfo.GetCultureInfo(culture).EnglishName} ({culture})")));
                }
                break;

            case TextAttributeType.UIA_StyleIdAttributeId:
            case TextAttributeType.UIA_SayAsInterpretAsAttributeId:
                // VT_I4
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, SayAsInterpretAs.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_FontNameAttributeId:
            case TextAttributeType.UIA_StyleNameAttributeId:
            case TextAttributeType.UIA_LineSpacingAttributeId:
                // VT_BSTR
                if (value is string)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value));
                }
                break;

            case TextAttributeType.UIA_FontSizeAttributeId:
            case TextAttributeType.UIA_IndentationFirstLineAttributeId:
            case TextAttributeType.UIA_IndentationLeadingAttributeId:
            case TextAttributeType.UIA_IndentationTrailingAttributeId:
            case TextAttributeType.UIA_MarginBottomAttributeId:
            case TextAttributeType.UIA_MarginLeadingAttributeId:
            case TextAttributeType.UIA_MarginTopAttributeId:
            case TextAttributeType.UIA_MarginTrailingAttributeId:
            case TextAttributeType.UIA_BeforeParagraphSpacingAttributeId:
            case TextAttributeType.UIA_AfterParagraphSpacingAttributeId:
                // VT_R8
                if (value is double || value is long)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString()));
                }
                break;

            case TextAttributeType.UIA_FontWeightAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_HorizontalTextAlignmentAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_IsHiddenAttributeId:
            case TextAttributeType.UIA_IsItalicAttributeId:
            case TextAttributeType.UIA_IsReadOnlyAttributeId:
            case TextAttributeType.UIA_IsSubscriptAttributeId:
            case TextAttributeType.UIA_IsSuperscriptAttributeId:
            case TextAttributeType.UIA_IsActiveAttributeId:
                if (value is bool)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString()));
                }
                break;

            case TextAttributeType.UIA_OutlineStylesAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, OutlineStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_OverlineStyleAttributeId:
            case TextAttributeType.UIA_StrikethroughStyleAttributeId:
            case TextAttributeType.UIA_UnderlineStyleAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, TextDecorationLineStyle.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_TabsAttributeId:
                var txt = ConvertArrayToString(value);

                if (txt != null)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, txt));
                }
                break;

            case TextAttributeType.UIA_TextFlowDirectionsAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FlowDirection.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_AnnotationTypesAttributeId:
                StringBuilder sb = new StringBuilder();
                if (value is double)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnnotationType.GetInstance().GetNameById((int)value)));
                }
                else if (value is Array arr)
                {
                    if (collapse && arr.Length > 0)     // collapse the array into a single row
                    {
                        var count = new Dictionary <string, int>();
                        foreach (var val in arr)
                        {
                            var key = AnnotationType.GetInstance().GetNameById((int)val);
                            if (count.ContainsKey(key))
                            {
                                count[key]++;
                            }
                            else
                            {
                                count[key] = 1;
                            }
                        }

                        StringBuilder strBuild = new StringBuilder();
                        foreach (var item in count)
                        {
                            strBuild.Append(Invariant($"{item.Key}: {item.Value}, "));
                        }
                        strBuild.Length -= 2;   //remove final , and <space>
                        list.Add(new TextAttributeViewModel(kv.Key, kv.Value, strBuild.ToString()));
                    }
                    else     // create a row for each array value
                    {
                        if (arr.Length > 0)
                        {
                            for (int i = 0; i < arr.Length; i++)
                            {
                                list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", kv.Value, i), AnnotationType.GetInstance().GetNameById((int)arr.GetValue(i))));
                            }
                        }
                    }
                }
                break;

            case TextAttributeType.UIA_SelectionActiveEndAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, ActiveEnd.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CaretPositionAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretPosition.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_CaretBidiModeAttributeId:
                if (value is int)
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretBidiMode.GetInstance().GetNameById(value)));
                }
                break;

            case TextAttributeType.UIA_AnnotationObjectsAttributeId:
                if (value is IUIAutomationElementArray)
                {
                    IUIAutomationElementArray arr = value;
                    if (arr.Length > 0)
                    {
                        for (int i = 0; i < arr.Length; i++)
                        {
                            list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, Resources.TextRangeViewModel_GetTextRangeAttributeKeyValuePair_AnnotationObjects_0, i), new DesktopElement((IUIAutomationElement)arr.GetElement(i))));
                        }
                    }
                }
                break;

            case TextAttributeType.UIA_LinkAttributeId:
                // do nothing for now until it is shown as necessary information.
                //try
                //{
                //    IUIAutomationTextRange lnk = Marshal.GetObjectForIUnknown(value) as IUIAutomationTextRange;
                //    list.Add(new TextAttributeViewModel(kv.Value, new TextRangeViewModel(new TextRange(lnk))));
                //}
                //catch (Exception e)
                //{
                //    e.ReportException();
                //}
                break;

            default:
                // need to make a decision for these Attributes since it return Object.
                if (value.GetType().Name != "__ComObject")
                {
                    list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value));
                }
                break;
            }

            return(list);
        }