private void InitializeElementReference(string elementPath) { elementViewModelReference = lookup.CreateReference(elementPath); elementViewModelReference.ElementDeleted += ElementViewModelReferenceElementDeleted; elementViewModelReference.PathChanged += ElementViewModelReferencePathChanged; if (elementViewModelReference.Element != null) { this.elementViewModel = elementViewModelReference.Element; } else { elementViewModelReference.ElementFound += ElementViewModelReferenceElementFound; } }
public abstract ValueTask <bool> OpenModal(ElementReference elementRef, bool scrollToTop);
public ValueTask SetCaret(ElementReference elementRef, int caret) { return(runtime.InvokeVoidAsync($"{BLAZORISE_NAMESPACE}.setCaret", elementRef, caret)); }
public virtual ValueTask UpdateTimePickerValue(ElementReference elementRef, string elementId, object value) { return(ValueTask.CompletedTask); }
public virtual ValueTask DestroyTimePicker(ElementReference elementRef, string elementId) { return(ValueTask.CompletedTask); }
public ValueTask <FlexibleConnectedPositionStrategyOrigin> GetBoundingClientRect(ElementReference element) { return(_jsRuntime.InvokeAsync <FlexibleConnectedPositionStrategyOrigin>("dnetoverlay.getBoundingClientRect", element)); }
/// <summary> /// Indicates the object is being disposed. /// </summary> /// <param name="disposing">Indicates <see cref="ViewModel.Dispose(bool)"/> was invoked through an explicit call to <see cref="ViewModel.Dispose()"/> instead of a finalizer call.</param> protected override void Dispose(bool disposing) { if (elementScope != null) { elementScope.CollectionChanged -= ElementScopeCollectionChanged; elementScope.Dispose(); elementScope = null; } if (reference != null) { reference.ElementFound -= ReferenceElementFound; reference.ElementDeleted -= ReferenceElementDeleted; reference.NameChanged -= ReferenceNameChanged; reference.Dispose(); reference = null; } if (changeScopePropertyWatcher != null) { changeScopePropertyWatcher.Dispose(); } ((INotifyCollectionChanged)ValidationResults).CollectionChanged -= ValidationCollectionChanged; base.Dispose(disposing); }
public static async Task hide(this IJSRuntime JsRuntime, ElementReference element) => await JsRuntime.InvokeVoidAsync("hideWrapper", element);
public SharedMemoryFileListEntryStream(IJSRuntime jsRuntime, ElementReference inputFileElement, FileListEntryImpl file) : base(jsRuntime, inputFileElement, file) { }
/** FUNCTIONS **/ public static async Task addClass(this IJSRuntime JsRuntime, ElementReference element, string classNames) => await JsRuntime.InvokeVoidAsync("addClassWrapper", element, classNames);
public static async Task FocusAsync(IJSRuntime runtime, ElementReference elementRef) => await runtime.InvokeAsync <bool>($"{BlazorDemo}focusElement", elementRef).ConfigureAwait(false);
public async Task DrawFocusIfNeededAsync(ElementReference elementReference) => await this.BatchCallAsync(DRAW_FOCUS_IF_NEEDED_METHOD, isMethodCall : true, elementReference);
public void DrawFocusIfNeeded(ElementReference elementReference) => this.CallMethod <object>(DRAW_FOCUS_IF_NEEDED_METHOD, elementReference);
/** * Adds an atrezzo item reference to the list of atrezzo item references * * @param atrezzoReference * the atrezzo item reference to add */ public void addAtrezzoReference(ElementReference itemReference) { atrezzoReferences.Add(itemReference); }
public static async Task addEventListener(this IJSRuntime JsRuntime, ElementReference element, string eventName, string eventHandlerName) => await JsRuntime.InvokeVoidAsync("addEventListenerWrapper", element, eventName, eventHandlerName);
/** * Adds an item reference to the list of item references * * @param itemReference * the item reference to add */ public void addItemReference(ElementReference itemReference) { itemReferences.Add(itemReference); }
public static async Task <double> getElementWidth(this IJSRuntime JsRuntime, ElementReference element) => await JsRuntime.InvokeAsync <double>("getElementWidth", element);
private void HandleNewScreen(FlatRedBall.Glue.SaveClasses.ScreenSave newScreen) { bool createGumScreen = propertiesManager.GetAutoCreateGumScreens(); if(createGumScreen && AppState.Self.GumProjectSave != null) { string gumScreenName = FileManager.RemovePath( newScreen.Name ) + "Gum"; bool exists = AppState.Self.GumProjectSave.Screens.Any(item => item.Name == gumScreenName); if (!exists) { Gum.DataTypes.ScreenSave gumScreen = new Gum.DataTypes.ScreenSave(); gumScreen.Initialize(StandardElementsManager.Self.GetDefaultStateFor("Screen")); gumScreen.Name = gumScreenName; string gumProjectFileName = GumProjectManager.Self.GetGumProjectFileName(); var directory = FileManager.GetDirectory(gumProjectFileName) + ElementReference.ScreenSubfolder + "/"; AppState.Self.GumProjectSave.Screens.Add(gumScreen); var elementReference = new ElementReference { ElementType = ElementType.Screen, Name = gumScreenName }; AppState.Self.GumProjectSave.ScreenReferences.Add(elementReference); AppState.Self.GumProjectSave.ScreenReferences.Sort((first, second) => first.Name.CompareTo(second.Name)); AppState.Self.GumProjectSave.Save(gumProjectFileName, saveElements: false); string screenFileName = directory + gumScreen.Name + "." + GumProjectSave.ScreenExtension; gumScreen.Save(screenFileName); } // Select the screen to add the file to this GlueState.Self.CurrentScreenSave = newScreen; RightClickManager.Self.AddScreenByName(gumScreenName); } }
public static async Task <double> addWidthToEveryChild(this IJSRuntime JsRuntime, ElementReference element, double valueToAdd) => await JsRuntime.InvokeAsync <double>("addWidthToEveryChild", element, valueToAdd);
internal static async Task CallBarChartJs(this ElementReference elementReference, IJSRuntime jSRuntime, string barChartJsData) { await jSRuntime.InvokeVoidAsync(identifier : "setBarChart", elementReference, barChartJsData); }
public static async Task <T> getProp <T>(this IJSRuntime JsRuntime, ElementReference element, string propName) => await JsRuntime.InvokeAsync <T>("getPropWrapper", element, propName);
public virtual ValueTask UpdateDatePickerOptions(ElementReference elementRef, string elementId, object options) { return(ValueTask.CompletedTask); }
public static async Task setProp(this IJSRuntime JsRuntime, ElementReference element, string propName, object propVal) => await JsRuntime.InvokeVoidAsync("setPropWrapper", element, propName, propVal);
public virtual ValueTask ActivateTimePicker(ElementReference elementRef, string elementId, object options) { return(ValueTask.CompletedTask); }
public static async Task RegisterOnScrollToChangeHeaderStyle(this IJSRuntime jsRuntime, ElementReference element) { await jsRuntime.InvokeVoidAsync("RegisterOnScrollToChangeHeaderStyle", element); }
public ValueTask <bool> SetTextValue(ElementReference elementRef, object value) { return(runtime.InvokeAsync <bool>($"{BLAZORISE_NAMESPACE}.setTextValue", elementRef, value)); }
internal FileReaderRef(ElementReference elementRef, FileReaderJsInterop fileReaderJsInterop) { this.ElementRef = elementRef; this.FileReaderJsInterop = fileReaderJsInterop; }
public ValueTask <int> GetCaret(ElementReference elementRef) { return(runtime.InvokeAsync <int>($"{BLAZORISE_NAMESPACE}.getCaret", elementRef)); }
public async ValueTask <bool> ShowDialog(ElementReference element) { return(await JsRuntime.InvokeAsync <bool>("window.RadialJsDialog.showDialog", element)); }
public abstract ValueTask <bool> CloseModal(ElementReference elementRef);
public void AllowDrag(ElementReference element) { JsRuntime.InvokeVoidAsync("window.RadialJsDialog.allowDrag", element); }
/** * Adds a character reference to the list of character references * * @param characterReference * the character reference to add */ public void addCharacterReference(ElementReference characterReference) { characterReferences.Add(characterReference); }
public Element(ElementReference elementReference, IJSRuntime jSRuntime) { this.elementReference = elementReference; this.jSRuntime = jSRuntime; this.Style = new Style(elementReference, jSRuntime); }
private void DeletePayload() { environmentOverridenElementData.Delete(); environmentOverridenElementData = null; if (elementViewModelReference != null) { elementViewModelReference.Dispose(); elementViewModelReference = null; } if (elementViewModel != null) { elementViewModel.PropertyChanged -= SubjectPropertyChanged; elementViewModel.Deleted -= SubjectDeleted; } }
public async Task AppendAsync(ElementReference element) { await jSRuntime.InvokeAsync <object>("elementAppendChild", elementReference, element); }
public override void ParseElement(XmlElement element) { XmlNodeList resourcess = element.SelectNodes("resources"), assets, conditions, effects, postseffects, notseffect, defaultsinitialsposition = element.SelectNodes("default-initial-position"), exits = element.SelectNodes("exits/exit"), exitslook, nextsscene = element.SelectNodes("next-scene"), points, objectsrefs = element.SelectNodes("objects/object-ref"), charactersrefs = element.SelectNodes("characters/character-ref"), atrezzosrefs = element.SelectNodes("atrezzo/atrezzo-ref"), activesareas = element.SelectNodes("active-areas/active-area"), barriers = element.SelectNodes("barrier"), trajectorys = element.SelectNodes("trajectory"); string tmpArgVal; string sceneId = ""; bool initialScene = false; int playerLayer = -1; float playerScale = 1.0f; tmpArgVal = element.GetAttribute("id"); if (!string.IsNullOrEmpty(tmpArgVal)) { sceneId = tmpArgVal; } tmpArgVal = element.GetAttribute("start"); if (!string.IsNullOrEmpty(tmpArgVal)) { initialScene = tmpArgVal.Equals("yes"); } tmpArgVal = element.GetAttribute("playerLayer"); if (!string.IsNullOrEmpty(tmpArgVal)) { playerLayer = int.Parse(tmpArgVal); } tmpArgVal = element.GetAttribute("playerScale"); if (!string.IsNullOrEmpty(tmpArgVal)) { playerScale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture); } scene = new Scene(sceneId); scene.setPlayerLayer(playerLayer); scene.setPlayerScale(playerScale); if (initialScene) chapter.setTargetId(sceneId); if (element.SelectSingleNode("name") != null) scene.setName(element.SelectSingleNode("name").InnerText); if (element.SelectSingleNode("documentation") != null) scene.setDocumentation(element.SelectSingleNode("documentation").InnerText); foreach (XmlElement el in resourcess) { currentResources = new ResourcesUni(); tmpArgVal = el.GetAttribute("name"); if (!string.IsNullOrEmpty(tmpArgVal)) { currentResources.setName(el.GetAttribute(tmpArgVal)); } assets = el.SelectNodes("asset"); foreach (XmlElement ell in assets) { string type = ""; string path = ""; tmpArgVal = ell.GetAttribute("type"); if (!string.IsNullOrEmpty(tmpArgVal)) { type = tmpArgVal; } tmpArgVal = ell.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { path = tmpArgVal; } currentResources.addAsset(type, path); } conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentResources.setConditions(currentConditions); } scene.addResources(currentResources); } foreach (XmlElement el in defaultsinitialsposition) { int x = int.MinValue, y = int.MinValue; tmpArgVal = el.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } scene.setDefaultPosition(x, y); } foreach (XmlElement el in exits) { int x = 0, y = 0, width = 0, height = 0; bool rectangular = true; int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0; bool hasInfluence = false; string idTarget = ""; int destinyX = int.MinValue, destinyY = int.MinValue; int transitionType = 0, transitionTime = 0; bool notEffects = false; tmpArgVal = el.GetAttribute("rectangular"); if (!string.IsNullOrEmpty(tmpArgVal)) { rectangular = tmpArgVal.Equals("yes"); } tmpArgVal = el.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("width"); if (!string.IsNullOrEmpty(tmpArgVal)) { width = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("height"); if (!string.IsNullOrEmpty(tmpArgVal)) { height = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("hasInfluenceArea"); if (!string.IsNullOrEmpty(tmpArgVal)) { hasInfluence = tmpArgVal.Equals("yes"); } tmpArgVal = el.GetAttribute("influenceX"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceX = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceY"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceY = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceWidth"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceWidth = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceHeight"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceHeight = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { idTarget = tmpArgVal; } tmpArgVal = el.GetAttribute("destinyX"); if (!string.IsNullOrEmpty(tmpArgVal)) { destinyX = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("destinyY"); if (!string.IsNullOrEmpty(tmpArgVal)) { destinyY = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("transitionType"); if (!string.IsNullOrEmpty(tmpArgVal)) { transitionType = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("transitionTime"); if (!string.IsNullOrEmpty(tmpArgVal)) { transitionTime = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("not-effects"); if (!string.IsNullOrEmpty(tmpArgVal)) { notEffects = tmpArgVal.Equals("yes"); } currentExit = new Exit(rectangular, x, y, width, height); currentExit.setNextSceneId(idTarget); currentExit.setDestinyX(destinyX); currentExit.setDestinyY(destinyY); currentExit.setTransitionTime(transitionTime); currentExit.setTransitionType(transitionType); currentExit.setHasNotEffects(notEffects); if (hasInfluence) { InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight); currentExit.setInfluenceArea(influenceArea); } exitslook = el.SelectNodes("exit-look"); foreach (XmlElement ell in exitslook) { currentExitLook = new ExitLook(); string text = null; string cursorPath = null; string soundPath = null; tmpArgVal = ell.GetAttribute("text"); if (!string.IsNullOrEmpty(tmpArgVal)) { text = tmpArgVal; } tmpArgVal = ell.GetAttribute("cursor-path"); if (!string.IsNullOrEmpty(tmpArgVal)) { cursorPath = tmpArgVal; } tmpArgVal = ell.GetAttribute("sound-path"); if (!string.IsNullOrEmpty(tmpArgVal)) { soundPath = tmpArgVal; } currentExitLook.setCursorPath(cursorPath); currentExitLook.setExitText(text); if (soundPath != null) { currentExitLook.setSoundPath(soundPath); } currentExit.setDefaultExitLook(currentExitLook); } if (el.SelectSingleNode("documentation") != null) currentExit.setDocumentation(el.SelectSingleNode("documentation").InnerText); points = el.SelectNodes("point"); foreach (XmlElement ell in points) { int x_ = 0; int y_ = 0; tmpArgVal = ell.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x_ = int.Parse(tmpArgVal); } tmpArgVal = ell.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y_ = int.Parse(tmpArgVal); } currentPoint = new Vector2(x_, y_); currentExit.addPoint(currentPoint); } conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentExit.setConditions(currentConditions); } effects = el.SelectNodes("effect"); foreach (XmlElement ell in effects) { currentEffects = new Effects(); new EffectSubParser_(currentEffects, chapter).ParseElement(ell); currentExit.setEffects(currentEffects); } notseffect = el.SelectNodes("not-effect"); foreach (XmlElement ell in notseffect) { currentEffects = new Effects(); new EffectSubParser_(currentEffects, chapter).ParseElement(ell); currentExit.setNotEffects(currentEffects); } postseffects = el.SelectNodes("post-effect"); foreach (XmlElement ell in postseffects) { currentEffects = new Effects(); new EffectSubParser_(currentEffects, chapter).ParseElement(ell); currentExit.setPostEffects(currentEffects); } if (currentExit.getNextScenes().Count > 0) { foreach (NextScene nextScene in currentExit.getNextScenes()) { Exit exit = (Exit) currentExit; exit.setNextScenes(new List<NextScene>()); exit.setDestinyX(nextScene.getPositionX()); exit.setDestinyY(nextScene.getPositionY()); exit.setEffects(nextScene.getEffects()); exit.setPostEffects(nextScene.getPostEffects()); if (exit.getDefaultExitLook() == null) exit.setDefaultExitLook(nextScene.getExitLook()); else { if (nextScene.getExitLook() != null) { if (nextScene.getExitLook().getExitText() != null && !nextScene.getExitLook().getExitText().Equals("")) exit.getDefaultExitLook().setExitText(nextScene.getExitLook().getExitText()); if (nextScene.getExitLook().getCursorPath() != null && !nextScene.getExitLook().getCursorPath().Equals("")) exit.getDefaultExitLook().setCursorPath(nextScene.getExitLook().getCursorPath()); } } exit.setHasNotEffects(false); exit.setConditions(nextScene.getConditions()); exit.setNextSceneId(nextScene.getTargetId()); scene.addExit(exit); } } else { scene.addExit(currentExit); } } foreach (XmlElement el in nextsscene) { string idTarget = ""; int x = int.MinValue, y = int.MinValue; int transitionType = 0, transitionTime = 0; tmpArgVal = el.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { idTarget = tmpArgVal; } tmpArgVal = el.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("transitionType"); if (!string.IsNullOrEmpty(tmpArgVal)) { transitionType = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("transitionTime"); if (!string.IsNullOrEmpty(tmpArgVal)) { transitionTime = int.Parse(tmpArgVal); } currentNextScene = new NextScene(idTarget, x, y); currentNextScene.setTransitionType((NextSceneEnumTransitionType) transitionType); currentNextScene.setTransitionTime(transitionTime); currentNextScene.setExitLook(currentExitLook); conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentNextScene.setConditions(currentConditions); } effects = el.SelectNodes("effect"); foreach (XmlElement ell in effects) { currentEffects = new Effects(); new EffectSubParser_(currentEffects, chapter).ParseElement(ell); currentNextScene.setEffects(currentEffects); } postseffects = el.SelectNodes("post-effect"); foreach (XmlElement ell in effects) { currentEffects = new Effects(); new EffectSubParser_(currentEffects, chapter).ParseElement(ell); currentNextScene.setPostEffects(currentEffects); } } foreach (XmlElement el in objectsrefs) { string idTarget = ""; int x = 0, y = 0; float scale = 0; int layer = 0; int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0; bool hasInfluence = false; tmpArgVal = el.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { idTarget = tmpArgVal; } tmpArgVal = el.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("scale"); if (!string.IsNullOrEmpty(tmpArgVal)) { scale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture); } tmpArgVal = el.GetAttribute("layer"); if (!string.IsNullOrEmpty(tmpArgVal)) { layer = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("hasInfluenceArea"); if (!string.IsNullOrEmpty(tmpArgVal)) { hasInfluence = tmpArgVal.Equals("yes"); } tmpArgVal = el.GetAttribute("layer"); if (!string.IsNullOrEmpty(tmpArgVal)) { layer = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceX"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceX = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceY"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceY = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceWidth"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceWidth = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceHeight"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceHeight = int.Parse(tmpArgVal); } // This is for maintain the back-compatibility: in previous dtd versions layer has -1 as default value and this is // an erroneous value. This reason, if this value is -1, it will be changed to 0. Now in dtd there are not default value // for layer if (layer == -1) layer = 0; currentElementReference = new ElementReference(idTarget, x, y, layer); if (hasInfluence) { InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight); currentElementReference.setInfluenceArea(influenceArea); } if (scale > 0.001 || scale < -0.001) currentElementReference.setScale(scale); if (el.SelectSingleNode("documentation") != null) currentElementReference.setDocumentation(el.SelectSingleNode("documentation").InnerText); conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentElementReference.setConditions(currentConditions); } scene.addItemReference(currentElementReference); } foreach (XmlElement el in charactersrefs) { string idTarget = ""; int x = 0, y = 0; float scale = 0; int layer = 0; int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0; bool hasInfluence = false; tmpArgVal = el.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { idTarget = tmpArgVal; } tmpArgVal = el.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("scale"); if (!string.IsNullOrEmpty(tmpArgVal)) { scale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture); } tmpArgVal = el.GetAttribute("layer"); if (!string.IsNullOrEmpty(tmpArgVal)) { layer = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("hasInfluenceArea"); if (!string.IsNullOrEmpty(tmpArgVal)) { hasInfluence = tmpArgVal.Equals("yes"); } tmpArgVal = el.GetAttribute("layer"); if (!string.IsNullOrEmpty(tmpArgVal)) { layer = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceX"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceX = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceY"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceY = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceWidth"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceWidth = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceHeight"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceHeight = int.Parse(tmpArgVal); } // This is for maintain the back-compatibility: in previous dtd versions layer has -1 as default value and this is // an erroneous value. This reason, if this value is -1, it will be changed to 0. Now in dtd there are not default value // for layer if (layer == -1) layer = 0; currentElementReference = new ElementReference(idTarget, x, y, layer); if (hasInfluence) { InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight); currentElementReference.setInfluenceArea(influenceArea); } if (scale > 0.001 || scale < -0.001) currentElementReference.setScale(scale); if (el.SelectSingleNode("documentation") != null) currentElementReference.setDocumentation(el.SelectSingleNode("documentation").InnerText); conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentElementReference.setConditions(currentConditions); } scene.addCharacterReference(currentElementReference); } foreach (XmlElement el in atrezzosrefs) { string idTarget = ""; int x = 0, y = 0; float scale = 0; int layer = 0; int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0; bool hasInfluence = false; tmpArgVal = el.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { idTarget = tmpArgVal; } tmpArgVal = el.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("scale"); if (!string.IsNullOrEmpty(tmpArgVal)) { scale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture); } tmpArgVal = el.GetAttribute("layer"); if (!string.IsNullOrEmpty(tmpArgVal)) { layer = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("hasInfluenceArea"); if (!string.IsNullOrEmpty(tmpArgVal)) { hasInfluence = tmpArgVal.Equals("yes"); } tmpArgVal = el.GetAttribute("layer"); if (!string.IsNullOrEmpty(tmpArgVal)) { layer = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceX"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceX = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceY"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceY = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceWidth"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceWidth = int.Parse(tmpArgVal); } tmpArgVal = el.GetAttribute("influenceHeight"); if (!string.IsNullOrEmpty(tmpArgVal)) { influenceHeight = int.Parse(tmpArgVal); } // This is for maintain the back-compatibility: in previous dtd versions layer has -1 as default value and this is // an erroneous value. This reason, if this value is -1, it will be changed to 0. Now in dtd there are not default value // for layer if (layer == -1) layer = 0; currentElementReference = new ElementReference(idTarget, x, y, layer); if (hasInfluence) { InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight); currentElementReference.setInfluenceArea(influenceArea); } if (scale > 0.001 || scale < -0.001) currentElementReference.setScale(scale); if (el.SelectSingleNode("documentation") != null) currentElementReference.setDocumentation(el.SelectSingleNode("documentation").InnerText); conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentElementReference.setConditions(currentConditions); } scene.addAtrezzoReference(currentElementReference); } foreach (XmlElement el in activesareas) { new ActiveAreaSubParser_(chapter, scene, scene.getActiveAreas().Count).ParseElement(el); } foreach (XmlElement el in barriers) { new BarrierSubParser_(chapter, scene, scene.getBarriers().Count).ParseElement(el); } foreach (XmlElement el in trajectorys) { new TrajectorySubParser_(chapter, scene).ParseElement(el); } if (scene != null) { TrajectoryFixer.fixTrajectory(scene); } chapter.addScene(scene); }
public ValueTask <object> Focus(ElementReference element) { return(_jsRuntime.InvokeAsync <object>("dnetoverlay.setFocus", element)); }
private void EnsureReferenceInitialized(bool refresh) { EnsureScopeInitialized(); if (!elementScope.IsScopeResolved) return; if (referenceInitialized && !refresh) return; if (reference != null) reference.Dispose(); reference = lookup.CreateReference(elementScope.ScopePath, referenceAttribute.TargetType, (string)base.GetValue()); reference.ElementFound += ReferenceElementFound; reference.ElementDeleted += ReferenceElementDeleted; reference.NameChanged += ReferenceNameChanged; referenceInitialized = true; }
public ValueTask <object> AddKeyDownEventListener(ElementReference element) { return(_jsRuntime.InvokeAsync <object>("dnetoverlay.addKeyDownEventListener", element)); }
public void InitializeReference(string elementPath, EnvironmentNodeMergeElement mergeElement) { this.mergeElement = mergeElement; this.mergeElement.ConfigurationNodePath = elementPath; elementReference = overrides.lookup.CreateReference(elementPath); elementReference.ElementDeleted += new EventHandler(elementReference_ElementDeleted); elementReference.ElementFound += new EventHandler(elementReference_ElementFound); elementReference.PathChanged += new PropertyValueChangedEventHandler<string>(ElementReferencePathChanged); needsInitialization = false; }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.cargador.subparsers.SubParser#startElement(java.lang.string, java.lang.string, * java.lang.string, org.xml.sax.Attributes) */ public override void startElement(string namespaceURI, string sName, string qName, Dictionary<string, string> attrs) { Debug.Log("START: " + sName + " " + qName + " sub:" + subParsing + ", reading: " + reading); // If no element is being parsed if (subParsing == SUBPARSING_NONE) { // If it is a scene tag, create a new scene with its id if (qName.Equals("scene")) { string sceneId = ""; bool initialScene = false; int playerLayer = -1; float playerScale = 1.0f; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("id")) sceneId = entry.Value.ToString(); if (entry.Key.Equals("start")) initialScene = entry.Value.ToString().Equals("yes"); if (entry.Key.Equals("playerLayer")) playerLayer = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("playerScale")) playerScale = float.Parse(entry.Value.ToString(), CultureInfo.InvariantCulture); } scene = new Scene(sceneId); scene.setPlayerLayer(playerLayer); scene.setPlayerScale(playerScale); if (initialScene) chapter.setTargetId(sceneId); } // If it is a resources tag, create the new resources else if (qName.Equals("resources")) { currentResources = new ResourcesUni(); foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("name")) currentResources.setName(entry.Value.ToString()); } reading = READING_RESOURCES; } // If it is an asset tag, read it and add it to the current resources else if (qName.Equals("asset")) { string type = ""; string path = ""; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("type")) type = entry.Value.ToString(); if (entry.Key.Equals("uri")) path = entry.Value.ToString(); } currentResources.addAsset(type, path); } // If it is a default-initial-position tag, store it in the scene else if (qName.Equals("default-initial-position")) { int x = int.MinValue, y = int.MinValue; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); } scene.setDefaultPosition(x, y); } // If it is an exit tag, create the new exit else if (qName.Equals("exit")) { int x = 0, y = 0, width = 0, height = 0; bool rectangular = true; int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0; bool hasInfluence = false; string idTarget = ""; int destinyX = int.MinValue, destinyY = int.MinValue; int transitionType = 0, transitionTime = 0; bool notEffects = false; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("rectangular")) rectangular = entry.Value.ToString().Equals("yes"); if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("width")) width = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("height")) height = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("hasInfluenceArea")) hasInfluence = entry.Value.ToString().Equals("yes"); if (entry.Key.Equals("influenceX")) influenceX = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("influenceY")) influenceY = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("influenceWidth")) influenceWidth = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("influenceHeight")) influenceHeight = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("idTarget")) idTarget = entry.Value.ToString(); if (entry.Key.Equals("destinyX")) destinyX = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("destinyY")) destinyY = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("transitionType")) transitionType = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("transitionTime")) transitionTime = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("not-effects")) notEffects = entry.Value.ToString().Equals("yes"); } currentExit = new Exit(rectangular, x, y, width, height); currentExit.setNextSceneId(idTarget); currentExit.setDestinyX(destinyX); currentExit.setDestinyY(destinyY); currentExit.setTransitionTime(transitionTime); currentExit.setTransitionType(transitionType); currentExit.setHasNotEffects(notEffects); if (hasInfluence) { InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight); currentExit.setInfluenceArea(influenceArea); } reading = READING_EXIT; } else if (qName.Equals("exit-look")) { currentExitLook = new ExitLook(); string text = null; string cursorPath = null; string soundPath = null; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("text")) { text = entry.Value.ToString(); } if (entry.Key.Equals("cursor-path")) cursorPath = entry.Value.ToString(); if (entry.Key.Equals("sound-path")) soundPath = entry.Value.ToString(); } currentExitLook.setCursorPath(cursorPath); currentExitLook.setExitText(text); if (soundPath != null) { currentExitLook.setSoundPath(soundPath); } // Debug.Log("311" + currentExitLook.getExitText()); } // If it is a next-scene tag, create the new next scene else if (qName.Equals("next-scene")) { string idTarget = ""; int x = int.MinValue, y = int.MinValue; int transitionType = 0, transitionTime = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) idTarget = entry.Value.ToString(); if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("transitionType")) transitionType = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("transitionTime")) transitionTime = int.Parse(entry.Value.ToString()); } currentNextScene = new NextScene(idTarget, x, y); currentNextScene.setTransitionType((NextSceneEnumTransitionType)transitionType); currentNextScene.setTransitionTime(transitionTime); reading = READING_NEXT_SCENE; } else if (qName.Equals("point")) { int x = 0; int y = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); } currentPoint = new Vector2(x, y); } // If it is a object-ref or character-ref, create the new element reference else if (qName.Equals("object-ref") || qName.Equals("character-ref") || qName.Equals("atrezzo-ref")) { Debug.Log("SceneReference Start"); string idTarget = ""; int x = 0, y = 0; float scale = 0; int layer = 0; int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0; bool hasInfluence = false; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) idTarget = entry.Value.ToString(); if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("scale")) scale = float.Parse(entry.Value.ToString(), CultureInfo.InvariantCulture); if (entry.Key.Equals("layer")) layer = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("hasInfluenceArea")) hasInfluence = entry.Value.ToString().Equals("yes"); if (entry.Key.Equals("influenceX")) influenceX = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("influenceY")) influenceY = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("influenceWidth")) influenceWidth = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("influenceHeight")) influenceHeight = int.Parse(entry.Value.ToString()); } // This is for maintain the back-compatibility: in previous dtd versions layer has -1 as default value and this is // an erroneous value. This reason, if this value is -1, it will be changed to 0. Now in dtd there are not default value // for layer if (layer == -1) layer = 0; currentElementReference = new ElementReference(idTarget, x, y, layer); if (hasInfluence) { InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight); currentElementReference.setInfluenceArea(influenceArea); } if (scale > 0.001 || scale < -0.001) currentElementReference.setScale(scale); reading = READING_ELEMENT_REFERENCE; } // If it is a condition tag, create the new condition, the subparser and switch the state else if (qName.Equals("condition")) { currentConditions = new Conditions(); subParser = new ConditionSubParser(currentConditions, chapter); subParsing = SUBPARSING_CONDITION; } // If it is a effect tag, create the new effect, the subparser and switch the state else if (qName.Equals("effect")) { currentEffects = new Effects(); subParser = new EffectSubParser(currentEffects, chapter); subParsing = SUBPARSING_EFFECT; } // If it is a post-effect tag, create the new effect, the subparser and switch the state else if (qName.Equals("post-effect")) { currentEffects = new Effects(); subParser = new EffectSubParser(currentEffects, chapter); subParsing = SUBPARSING_EFFECT; } // If it is a post-effect tag, create the new effect, the subparser and switch the state else if (qName.Equals("not-effect")) { currentEffects = new Effects(); subParser = new EffectSubParser(currentEffects, chapter); subParsing = SUBPARSING_EFFECT; } // If it is a post-effect tag, create the new effect, the subparser and switch the state else if (qName.Equals("active-area")) { subParsing = SUBPARSING_ACTIVE_AREA; subParser = new ActiveAreaSubParser(chapter, scene, scene.getActiveAreas().Count); } // If it is a post-effect tag, create the new effect, the subparser and switch the state else if (qName.Equals("barrier")) { subParsing = SUBPARSING_BARRIER; subParser = new BarrierSubParser(chapter, scene, scene.getBarriers().Count); } else if (qName.Equals("trajectory")) { subParsing = SUBPARSING_TRAJECTORY; subParser = new TrajectorySubParser(chapter, scene); } } // If it is subparsing an effect or condition, spread the call if (subParsing != SUBPARSING_NONE) { subParser.startElement(namespaceURI, sName, qName, attrs); } }