/// <summary> /// Renders the setting control's markup /// </summary> /// <param name="parent">The parent DOM element</param> public void render(Element parent) { _container = (HTMLElement)window.document.createElement("DIV"); var h2 = (HTMLElement)window.document.createElement("H2"); h2.innerHTML = name; _container.appendChild(h2); renderContent(_container); parent.appendChild(_container); }
public Game(HTMLElement element) { _element = element; window.document.title = Name; wrapper = (HTMLDivElement)window.document.createElement("DIV"); wrapper.className = "vtjGame"; element.appendChild(wrapper); canvas = (HTMLCanvasElement)window.document.createElement("CANVAS"); wrapper.appendChild(canvas); var toolbar = window.document.createElement("DIV"); toolbar.className = "vtjToolbar"; element.appendChild(toolbar); var title = (HTMLSpanElement)window.document.createElement("SPAN"); title.innerHTML = Name; toolbar.appendChild(title); if (window.localStorage != null) { var s = (GameSettings)window.JSON.parse(window.localStorage.getItem("GameSettings")); if (s != null) settings = s; } if (!(dynamic)settings) settings = new GameSettings(); window.addEventListener("resize", (e) => { refresh(); }, false); var m = buildMenus(); if ((dynamic)m && (dynamic)m.length) { foreach (var menu in m) { menu.Render(toolbar); menu.changed += menuChanged; } } refresh(); }
public SmilingFaceGame(HTMLElement element) : base(element) { loadScene(new SmilingFaceScene(this)); }
/// <summary> /// Called when the binding is first applied to an element, and again during any observable value change. /// </summary> /// <param name="element">The DOM element involved in this binding</param> /// <param name="valueAccessor">A function that can be called to get the current model property that is involved in this binding.</param> /// <param name="allBindingsAccessor">A function that can be called to get all the model properties bound to this DOM element.</param> /// <param name="viewModel">The view model object that is bound to the element.</param> public virtual void update(HTMLElement element, Func<object> valueAccessor, Func<dynamic> allBindingsAccessor, object viewModel) { }