Beispiel #1
0
		void DoubleClicked(jQueryMouseEvent evt) {
			var tr = new jQuery(evt.Target).Closest("tr");
			if(tr.Length == 0)
				return;
			var idx = (int) tr.Data("row-id");
			if(!rowBindings.ContainsKey(idx))
				return;
			var obj = rowBindings[idx];
			DoubleClick?.Invoke(this, obj);
		}
Beispiel #2
0
        private void InitializeStage()
        {
            if (Element == null)
            {
                Element = new jQuery(".stage").First();
            }

            Element.Data("instance", this);
            Canvas = new StageCanvas(Element.Children(".canvas"));
            CenterScroll();
        }
Beispiel #3
0
		void Clicked(jQueryMouseEvent evt) {
			var tr = new jQuery(evt.Target).Closest("tr");
			if(tr.Length == 0)
				return;
			var idx = (int) tr.Data("row-id");
			if(!rowBindings.ContainsKey(idx))
				return;
			var obj = rowBindings[idx];
			Click?.Invoke(this, obj);
			if(Select != null) {
				tr.Parent().Children(".table-row-selected").RemoveClass("table-row-selected");
				tr.AddClass("table-row-selected");
				Select(this, obj);
			}
		}
Beispiel #4
0
        public override void ActivateListeners(jQuery htmlObject)
        {
            // Activate tabs
            jQuery  tabs = htmlObject.Find(".tabs");
            dynamic opts = new RawJSObject();

            opts.initial  = _sheetTab;
            opts.callback = (ClickCallback)ClickTabSelect;
            new FVTTBridge.Bindings.Tabs(tabs, opts);

            //
            // Everything below here is only needed if the sheet is editable
            if (!Options.editable)
            {
                return;
            }

            // Update Inventory Item

            htmlObject.Find(".item-edit").Click(ev => {
                jQuery li = jQuery.Select(ev.CurrentTarget).Parents(".item");
                Item item = Actor.getOwnedItem(li.Data("itemId"));
                //item.render(true);
            });


            // Delete Inventory Item
            htmlObject.Find(".item-delete").Click(ev => {
                jQuery li = jQuery.Select(ev.CurrentTarget).Parents(".item");
                Actor.deleteOwnedItem(li.Data("itemId"), null);
                li.SlideUp(200, () => Render(false));
            });
            // hook stat roll buttons
            htmlObject.Find(".roll_stat_button").Click(ev =>
            {
                Element button = ev.CurrentTarget;
                DoStatRoll(button.GetAttribute("data-statname"));
            });


            htmlObject.Find(".roll_skill_button").Click(ev => {
                Element button = ev.CurrentTarget;
                DoSkillRoll(button.GetAttribute("data-skillname"));
            });

            // Clear skill pulldown
            htmlObject.Find("#skill_pulldown").Click(ev =>
            {
                htmlObject.Find(ev.CurrentTarget).Val("");
            });

            HTMLCollection clear_pulldowns = Document.GetElementsByClassName("clear_pulldown");

            foreach (Element el in clear_pulldowns)
            {
                el.AddEventListener("click", ev => { htmlObject.Find(ev.CurrentTarget.ToString()).Val(""); }, false);
            }

            htmlObject.Find("#add_skill_button").Click(ev =>
            {
                jQuery skillname = htmlObject.Find("#skill_pulldown");
                Console.WriteLine("add skill " + skillname.Val());
                DoAddSkill(skillname.Val());
            });

            htmlObject.Find("#roll_button").Click(ev =>
            {
                Console.WriteLine("show roll dialog");
                htmlObject.Find("#roll_dialog").Show();
            });

            HTMLCollection action_buttons = Document.GetElementsByClassName("action_button");

            foreach (Element el in action_buttons)
            {
                el.AddEventListener("click", ev =>
                {
                    Element button = (Element)ev.CurrentTarget;
                    DoItemAction(button.GetAttribute("data-itemkey"),
                                 button.GetAttribute("data-actionkey"));
                });
            }
        }
Beispiel #5
0
 public StageCanvas(jQuery element)
 {
     Element = element;
     Element.Data("instance", this);
     CreateSvgLayer("Default");
 }