예제 #1
0
        public SpellForm(XmlNode node)
        {
            InitializeComponent();



            #region

            RangeBox.BeginUpdate();
            RangeBox.Items.Clear();
            foreach (string name in Enum.GetNames(typeof(SpellRange)))
            {
                RangeBox.Items.Add(name);
            }
            RangeBox.EndUpdate();
            #endregion



            Spell spell = new Spell();
            spell.Load(node);

            RangeBox.SelectedItem = spell.Range.ToString();
            DescriptionBox.Text   = spell.Description;
            DurationBox.Value     = (int)spell.Duration.TotalSeconds;
            CastingTimeBox.Value  = (int)spell.CastingTime.TotalSeconds;
            LevelBox.Value        = (int)spell.Level;
            ScriptBox.SetValues <ISpell>(spell.Script);
            ClassBox.SelectedItem = spell.Class.ToString();

            Spell = spell;
        }
예제 #2
0
        public void ParseScriptFile(string str)
        {
            var split   = Regex.Split(str, @"\[\[.+\]\]");
            var matches = Regex.Matches(str, @"\[\[.+\]\]");

            for (var i = 0;; i++)
            {
                var breakNow = true;
                if (split.Length > i)
                {
                    ScriptBox.AppendText(split[i]);
                    breakNow = false;
                }

                if (matches.Count > i)
                {
                    AddButton(ConvertRegexMatchIntoButton(matches[i].Value));
                    breakNow = false;
                }

                if (breakNow)
                {
                    break;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Update controls
        /// </summary>
        void UpdateControls()
        {
            // Populate comboboxes
            if (WeaponNameBox.Items.Count == 0)
            {
                WeaponNameBox.BeginUpdate();
                foreach (string name in ResourceManager.GetAssets <Item>())
                {
                    Item item = ResourceManager.CreateAsset <Item>(name);
                    if (item.Type == ItemType.Weapon)
                    {
                        WeaponNameBox.Items.Add(name);
                    }
                }
                WeaponNameBox.Items.Insert(0, "");
                WeaponNameBox.EndUpdate();
            }


            if (Monster != null)
            {
                EntityBox.Entity = Monster;
                TileSetBox.Text  = Monster.TileSetName;
                TileIDBox.Value  = Monster.Tile;
                PocketItemsBox.Items.AddRange(Monster.ItemsInPocket.ToArray());
                XPRewardBox.Value   = Monster.Reward;
                ArmorClassBox.Value = Monster.ArmorClass;
                ScriptBox.SetValues <IMonster>(Monster.Script);
                DamageBox.Dice                   = Monster.DamageDice;
                FleesBox.Checked                 = Monster.FleesAfterAttack;
                FlyingBox.Checked                = Monster.Flying;
                FillSquareBox.Checked            = Monster.FillSquare;
                NonMaterialBox.Checked           = Monster.NonMaterial;
                UseStairsBox.Checked             = Monster.UseStairs;
                BackRowAttackBox.Checked         = Monster.BackRowAttack;
                PoisonImmunityBox.Checked        = Monster.PoisonImmunity;
                ThrowWeaponsBox.Checked          = Monster.ThrowWeapons;
                SmartAIBox.Checked               = Monster.SmartAI;
                CanSeeInvisibleBox.Checked       = Monster.CanSeeInvisible;
                SightRangeBox.Value              = Monster.SightRange;
                PickupBox.Value                  = (decimal)Monster.PickupRate * 100;
                StealBox.Value                   = (decimal)Monster.StealRate * 100;
                CanSeeInvisibleBox.Checked       = Monster.CanSeeInvisible;
                TeleportsBox.Checked             = Monster.Teleports;
                DefaultBehaviourBox.SelectedItem = Monster.DefaultBehaviour;
                CurrentBehaviourBox.SelectedItem = Monster.CurrentBehaviour;
                DirectionBox.SelectedItem        = Monster.Direction;
                NameBox.Text               = Monster.Name;
                AttackSpeedBox.Value       = (int)Monster.AttackSpeed.TotalMilliseconds;
                WeaponNameBox.SelectedItem = Monster.WeaponName;
            }

            Draw();
        }
예제 #4
0
        public async Task <IActionResult> Recycle(string id)
        {
            var response = await _postService.RecycleAsync(id);

            if (!response.Result)
            {
                return(ScriptBox.ShowMessage(response.Message, MsgType.error));
            }

            return(ScriptBox.ReloadPage());
        }
예제 #5
0
        public async Task <IActionResult> Delete(string id)
        {
            var deletePost = await _postService.DeleteAsync(id);

            if (!deletePost.Result)
            {
                return(ScriptBox.ShowMessage(deletePost.Message, MsgType.error));
            }

            return(ScriptBox.RedirectToUrl(url: "/admin/posts"));
        }
예제 #6
0
        /// <summary>
        /// Run through the selected scripts and add them to the list.
        /// </summary>
        private void PopulateScriptList()
        {
            if ("All Scripts" == (string)ScriptBox.SelectedItems[0])
            {
                ScriptBox.ClearSelected();
                ScriptBox.SelectedIndex = 0;
            }

            for (int i = 0; i < ScriptBox.SelectedItems.Count; i++)
            {
                scriptlist.Add(ScriptBox.SelectedItems[i].ToString());
            }
        }
예제 #7
0
 //Here we just check to make sure which is checked and populate the appropriate
 //script options
 private void PopulateScriptBox()
 {
     if (radioButtonBuyGarmin.Checked == true)
     {
         ScriptBox.ClearSelected();
         ScriptBox.Items.Clear();
         for (int i = 0; i < buyscripts.Count; i++)
         {
             ScriptBox.Items.Add(buyscripts[i]);
         }
     }
     else if (radioButtonConnect.Checked == true)
     {
         ScriptBox.ClearSelected();
         ScriptBox.Items.Clear();
         for (int i = 0; i < connectscripts.Count; i++)
         {
             ScriptBox.Items.Add(connectscripts[i]);
         }
     }
     else if (radioButtonmyGarmin.Checked == true)
     {
         ScriptBox.ClearSelected();
         ScriptBox.Items.Clear();
         for (int i = 0; i < myscripts.Count; i++)
         {
             ScriptBox.Items.Add(myscripts[i]);
         }
     }
     else if (radioButtonElastic.Checked == true)
     {
         ScriptBox.ClearSelected();
         ScriptBox.Items.Clear();
         for (int i = 0; i < elasticscripts.Count; i++)
         {
             ScriptBox.Items.Add(elasticscripts[i]);
         }
     }
     else if (radioButtonAutoOEM.Checked == true)
     {
         ScriptBox.ClearSelected();
         ScriptBox.Items.Clear();
         for (int i = 0; i < oemscripts.Count; i++)
         {
             ScriptBox.Items.Add(oemscripts[i]);
         }
     }
 }
예제 #8
0
        public async Task <IActionResult> Update(PostInput input)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.GetErrors();
                return(ScriptBox.ShowMessage(errors, MsgType.error));
            }

            var updatePost = await _postService.UpdateAsync(input);

            if (!updatePost.Result)
            {
                return(ScriptBox.ShowMessage(updatePost.Message, MsgType.error));
            }

            return(ScriptBox.ReloadPage());
        }
예제 #9
0
        public async Task <JavaScriptResult> Create(PostInput input)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.GetErrors();
                return(ScriptBox.ShowMessage(errors, MsgType.error));
            }

            input.UserId = "599b295c03a89924849735b3";
            var response = await _postService.CreateAsync(input);

            if (!response.result)
            {
                return(ScriptBox.ShowMessage(response.message, MsgType.error));
            }

            return(ScriptBox.RedirectToUrl(url: "/admin/posts/update", values: new { id = response.id }, message: response.message));
        }
        public override void Draw(DrawingContext drawingContext, double scale, double x, double y)
        {
            this.BaseBox.DrawWithGuidelines(drawingContext, scale, x, y);

            if (this.Over)
            {
                // Draw delimeter and script boxes over base box.
                var centerY      = y - this.BaseBox.Height - this.DelimeterBox.Width;
                var translationX = x + this.DelimeterBox.Width / 2;
                var translationY = centerY + this.DelimeterBox.Width / 2;

                drawingContext.PushTransform(new TranslateTransform(translationX * scale, translationY * scale));
                drawingContext.PushTransform(new RotateTransform(90));
                this.DelimeterBox.DrawWithGuidelines(drawingContext, scale, -this.DelimeterBox.Width / 2,
                                                     -this.DelimeterBox.Depth + this.DelimeterBox.Width / 2);
                drawingContext.Pop();
                drawingContext.Pop();

                // Draw script box as superscript.
                if (this.ScriptBox != null)
                {
                    this.ScriptBox.DrawWithGuidelines(drawingContext, scale, x, centerY - this.Kern - this.ScriptBox.Depth);
                }
            }
            else
            {
                // Draw delimeter and script boxes under base box.
                var centerY      = y + this.BaseBox.Depth + this.DelimeterBox.Width;
                var translationX = x + this.DelimeterBox.Width / 2;
                var translationY = centerY - this.DelimeterBox.Width / 2;

                drawingContext.PushTransform(new TranslateTransform(translationX * scale, translationY * scale));
                drawingContext.PushTransform(new RotateTransform(90));
                this.DelimeterBox.DrawWithGuidelines(drawingContext, scale, -this.DelimeterBox.Width / 2,
                                                     -this.DelimeterBox.Depth + this.DelimeterBox.Width / 2);
                drawingContext.Pop();
                drawingContext.Pop();

                // Draw script box as subscript.
                ScriptBox?.DrawWithGuidelines(drawingContext, scale, x, centerY + Kern + ScriptBox.Height);
            }
        }
예제 #11
0
        public async Task <JavaScriptResult> Create(PostInput input)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.GetErrors();
                return(ScriptBox.ShowMessage(errors, MsgType.error));
            }


            input.UserId = GetCurrentUserId();

            var createPost = await _postService.CreateAsync(input);

            if (!createPost.Result)
            {
                return(ScriptBox.ShowMessage(createPost.Message, MsgType.error));
            }

            return(ScriptBox.RedirectToUrl(url: "/admin/posts/update", values: new { id = createPost.Id }, message: createPost.Message));
        }
예제 #12
0
        public override void Draw(DrawingContext drawingContext, double scale, double x, double y)
        {
            BaseBox.Draw(drawingContext, scale, x, y);

            if (Over)
            {
                // Draw delimeter and script boxes over base box.
                var centerY      = y - BaseBox.Height - DelimeterBox.Width;
                var translationX = x + DelimeterBox.Width / 2;
                var translationY = centerY + DelimeterBox.Width / 2;

                drawingContext.PushTransform(new TranslateTransform(translationX * scale, translationY * scale));
                drawingContext.PushTransform(new RotateTransform(90));
                DelimeterBox.Draw(drawingContext, scale, -DelimeterBox.Width / 2,
                                  -DelimeterBox.Depth + DelimeterBox.Width / 2);
                drawingContext.Pop();
                drawingContext.Pop();

                // Draw script box as superscript.
                ScriptBox?.Draw(drawingContext, scale, x, centerY - Kern - ScriptBox.Depth);
            }
            else
            {
                // Draw delimeter and script boxes under base box.
                var centerY      = y + BaseBox.Depth + DelimeterBox.Width;
                var translationX = x + DelimeterBox.Width / 2;
                var translationY = centerY - DelimeterBox.Width / 2;

                drawingContext.PushTransform(new TranslateTransform(translationX * scale, translationY * scale));
                drawingContext.PushTransform(new RotateTransform(90));
                DelimeterBox.Draw(drawingContext, scale, -DelimeterBox.Width / 2,
                                  -DelimeterBox.Depth + DelimeterBox.Width / 2);
                drawingContext.Pop();
                drawingContext.Pop();

                // Draw script box as subscript.
                ScriptBox?.Draw(drawingContext, scale, x, centerY + Kern + ScriptBox.Height);
            }
        }
예제 #13
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     ScriptBox.Clear();
 }
예제 #14
0
 private void ClearBTN_Click(object sender, EventArgs e) => ScriptBox.Clear();