public void PlayerTileCollide(Player player, Exit exit) { game.transition = true; game.level = new Level(exit.destination, game); game.keyboard = new KeyboardController(game.level.player, game); game.level.player.position = new Vector2(game.prevPlayerPosition.X, game.prevPlayerPosition.Y + 10); }
/// <summary> /// Awake this instance. /// </summary> void Awake(){ Instance = this; if(Instance){ DestroyImmediate(gameObject); } else{ DontDestroyOnLoad(gameObject); } }
/// <summary> /// Factory method for creating commands /// </summary> /// <param name="inputCommand">User input string</param> /// <returns>ICommand object</returns> public ICommand CreateCommand(string inputCommand) { inputCommand = inputCommand.ToLower(); if (this.commandDictionary.ContainsKey(inputCommand)) { return this.commandDictionary[inputCommand]; } else { ICommand command; switch (inputCommand) { case "help": command = new Help(); break; case "top": command = new Top(); break; case "restart": command = new Restart(); break; case "exit": command = new Exit(); break; default: if (inputCommand.Length != 1 || string.IsNullOrWhiteSpace(inputCommand)) { throw new ArgumentException(GlobalMessages.IncorrectGuessOrCommand); } command = new LetterGuess(inputCommand); break; } return command; } }
public void AddExit(Exit exit) { exits.Add(exit); }
private Board MakeBoard(Turtle turtle = null, Exit exit = null) { return(new Board(2, 3, turtle ?? MakeTurtle(), exit ?? MakeExit())); }
/* * (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); } }
/// <summary> /// Raises the <see cref="Menu.Exit" /> event. /// </summary> /// <param name="player">The player.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> public void OnExit(BasePlayer player, EventArgs e) { Exit?.Invoke(player, e); }
public override Statement VisitExit(Exit Exit) { if (Exit == null) return null; int level = Exit.Level != null ? (int)Exit.Level.Value : 1; if (level < 0 || level > (this.loopCount+this.switchCaseCount)) { this.HandleError(Exit, Error.BadExitOrContinue); return null; } return Exit; }
public virtual Statement VisitExit(Exit exit) { return exit; }
public virtual bool CanUseExit(Exit e) { return(true); }
public virtual Statement VisitExit(Exit exit1, Exit exit2) { return exit1; }
private void ExitStatusBar_Click(object sender, RoutedEventArgs e) { Exit?.Invoke(sender, e); }
/// <summary> /// Creates a room at the given position in the layout. /// </summary> /// <param name="x">The x coordinate.</param> /// <param name="y">The y coordinate.</param> /// <returns>The created room.</returns> private Room CreateRoom(int x, int y) { var room = new Room(); if (x > 0 || y > 0) { var exits = new List <ExitDirectionType> (); if (x > 0) { if (layout [x - 1, y] != null) { exits.Add(ExitDirectionType.Left); } } if (x < width - 1) { if (layout [x + 1, y] != null) { exits.Add(ExitDirectionType.Right); } } if (y > 0) { if (layout [x, y - 1] != null) { exits.Add(ExitDirectionType.Bottom); } } if (y < height - 1) { if (layout [x, y + 1] != null) { exits.Add(ExitDirectionType.Top); } } var direction = exits [Random.Range(0, exits.Count)]; Exit exit = null; if (direction == ExitDirectionType.Bottom || direction == ExitDirectionType.Top) { exit = new ExitHorizontal() { Direction = direction, Type = (ExitHorizontalType)Random.Range(1, 4) }; } else { exit = new ExitVertical() { Direction = direction, Type = (ExitVerticalType)Random.Range(1, 4) }; } room.Exits.Add(exit); if (exit.Direction == ExitDirectionType.Bottom) { layout [x, y - 1].Exits.Add(new ExitHorizontal() { Direction = ExitDirectionType.Top, Type = ((ExitHorizontal)exit).Type }); } else if (exit.Direction == ExitDirectionType.Left) { layout [x - 1, y].Exits.Add(new ExitVertical() { Direction = ExitDirectionType.Right, Type = ((ExitVertical)exit).Type }); } else if (exit.Direction == ExitDirectionType.Right) { layout [x + 1, y].Exits.Add(new ExitVertical() { Direction = ExitDirectionType.Left, Type = ((ExitVertical)exit).Type }); } else { layout [x, y + 1].Exits.Add(new ExitHorizontal() { Direction = ExitDirectionType.Bottom, Type = ((ExitHorizontal)exit).Type }); } } return(room); }
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 override Statement VisitExit(Exit exit) { throw new ApplicationException("unimplemented"); }
public void Close() { Exit?.Invoke(this, new EventArgs()); }
public void GetElementName_ExitKeyReterned() { var corridor = new Exit(); Assert.AreEqual(Keys.ExitKey, corridor.ElementName); }
public virtual bool CanUsePortal(Exit p, Room r) { return(true); }
public override Statement VisitExit(Exit exit){ if (exit == null) return null; int level = exit.Level != null ? (int)exit.Level.Value : 0; int n = this.exitTargets.Count; bool leavesExceptionBlock = false; while (level >= 0 && n > 0){ Statement et = this.exitTargets[--n]; switch(et.NodeType){ case NodeType.Block: if (level-- == 0 || n == 0){ Branch b = new Branch(null, (Block)et, false, false, leavesExceptionBlock); b.SourceContext = exit.SourceContext; return b; } break; case NodeType.Try: leavesExceptionBlock = true; break; case NodeType.Finally: //Should not happen if Checker did its job n = 0; break; } } return new Statement(NodeType.Nop); //TODO: replace with throw }
public virtual string GetExitCommand(Exit e) { return(e.Command == "stop" ? null : e.Command); }
public virtual uint GetLeaveRoomCost(Room r, Exit e) { return(r.LeaveCost); }
/// <summary> /// Loads and starts the level specified. /// </summary> /// <param name="levelNumber">The level to start.</param> /// <param name="isCustom">Whether the level is a custom level or not.</param> public void BeginLevel(int levelNumber, bool isCustom) { this.CurrentLevelCustom = isCustom; this.Complete = false; this.CurrentLevel = levelNumber > 0 ? levelNumber : 1; this.currentLevelCustom = isCustom; this.scrollingDeath = new ScrollingDeath(ref this.physicsWorld, this.gameDisplayResolution.Y, LevelConstants.MinimumScrollRate, LevelConstants.MaximumScrollRate, LevelConstants.ScrollRate, LevelConstants.ScrollAcceleration, LevelConstants.ScrollDeceleration, this.contentManager); this.scrollStartTimer = 0.0f; this.physicsWorld.ClearForces(); this.levelLoader.LoadLevel(this.CurrentLevel, this.currentLevelCustom); LevelFactory.CreateFloor(this.levelLoader.FloorPoints, ref this.physicsWorld, ref this.floorEdges, ref this.visualFloorEdges, this.gameDisplayResolution.Y); LevelFactory.CreatePlatforms(this.levelLoader.PlatformDescriptions, ref this.physicsWorld, ref this.platforms, this.spriteBatch, this.contentManager); LevelFactory.CreateInteractiveEntities(this.levelLoader.InteractiveDescriptions, ref this.physicsWorld, ref this.interactiveEntities, ref this.mineCart, ref this.cartSwitch, this.spriteBatch, this.contentManager); this.exit = new Exit(this.spriteBatch, this.contentManager, ref this.physicsWorld, this.levelLoader.EndPosition); this.stickman.Reset(this.levelLoader.StartPosition); float startX = this.visualFloorEdges[this.visualFloorEdges.Count - 1].EndPoint.X; float y = this.visualFloorEdges[this.visualFloorEdges.Count - 1].EndPoint.Y - this.gameDisplayResolution.Y; this.visualFloorEdges.Add(new VisualEdge(new Vector2(startX, y), new Vector2(startX + this.gameDisplayResolution.X, y))); this.background.Reset(); AudioManager.PlayBackgroundMusic(true); Camera2D.Y = this.stickman.Position.Y - (this.gameDisplayResolution.Y / 2.0f); this.background.Update(); this.DisplayNotifications(); }
public virtual uint GetExitCost(Exit e) { return(e.Cost); }
public virtual Statement VisitExit(Exit exit, Exit changes, Exit deletions, Exit insertions){ this.UpdateSourceContext(exit, changes); if (exit == null) return changes; if (changes != null){ if (deletions == null || insertions == null) Debug.Assert(false); else{ exit.Level = changes.Level; } }else if (deletions != null) return null; return exit; }
public virtual uint GetPortalCost(Exit e) { return(e.Cost); }
/// <summary> /// Печать документа с анализом есть ли ЛК2 /// </summary> /// <param name="date">Дата регистрации СНУ</param> /// <param name="statusButton">Кнопка контроля состояний</param> /// <param name="pathfileinn">Путь к файлу с массовыми ИНН</param> /// <param name="pathjurnalerror">Путь к журналу с ошибками</param> /// <param name="pathjurnalok">Путь к отаботаным спискам</param> /// <param name="conectionstring">Строка соединения с нашей БД</param> public void PrintSnu(DatePickerPub date, StatusButtonMethod statusButton, string pathfileinn, string pathjurnalerror, string pathjurnalok, string conectionstring) { try { if (date.IsValidation()) { DispatcherHelper.Initialize(); if (File.Exists(pathfileinn)) { Task.Run(delegate { LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); object obj = read.ReadXml(pathfileinn, typeof(INNList)); INNList snumodelmass = (INNList)obj; if (snumodelmass.ListInn != null) { DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); KclicerButton clickerButton = new KclicerButton(); Exit exit = new Exit(); WindowsAis3 ais3 = new WindowsAis3(); if (ais3.WinexistsAis3() == 1) { foreach (var inn in snumodelmass.ListInn) { if (statusButton.Iswork) { clickerButton.Click7(date.Date, pathjurnalerror, pathjurnalok, inn.MyInnn, conectionstring, statusButton.IsChekcs, statusButton.IsLk2); read.DeleteAtributXml(pathfileinn, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute .GenerateAtributeMassNumCollection(inn.NumColection.ToString())); statusButton.Count++; } else { break; } statusButton.IsCheker(); } var status = exit.Exitfunc(statusButton.Count, snumodelmass.ListInn.Length, statusButton.Iswork); statusButton.Count = status.IsCount; statusButton.Iswork = status.IsWork; DispatcherHelper.CheckBeginInvokeOnUI( delegate { statusButton.StatusGrinandYellow(status.Stat); }); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status1); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin); } } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status7); } }); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status5); } } } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public virtual uint GetEnterRoomCost(Room r, Exit e) { return(r.EntryCost); }
public FrmAddCus(Exit ex) { InitializeComponent(); exit = ex; }
private void btnExit_Click(object sender, EventArgs e) { Exit?.Invoke(this); }
private void State_Exit(object sender, EventArgs e) { Exit?.Invoke(this, new EventArgs()); }
void OnEnable() { //Load settings // Character try { if (EditorPrefs.HasKey(SETTINGS_CHARACTER)) { this.character = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_CHARACTER), typeof(Character)) as Character; } } catch (System.Exception) { } // Tiles try { if (EditorPrefs.HasKey(SETTINGS_DIRT)) { this.dirt = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_DIRT), typeof(Dirt)) as Dirt; } } catch (System.Exception) { } try { if (EditorPrefs.HasKey(SETTINGS_WATER)) { this.water = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_WATER), typeof(Water)) as Water; } } catch (System.Exception) { } try { if (EditorPrefs.HasKey(SETTINGS_SPIKES)) { this.spikes = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_SPIKES), typeof(Spikes)) as Spikes; } } catch (System.Exception) { } // Doodads try { if (EditorPrefs.HasKey(SETTINGS_ENTRANCE)) { this.entrance = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_ENTRANCE), typeof(Entrance)) as Entrance; } } catch (System.Exception) { } try { if (EditorPrefs.HasKey(SETTINGS_EXIT)) { this.exit = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_EXIT), typeof(Exit)) as Exit; } } catch (System.Exception) { } try { if (EditorPrefs.HasKey(SETTINGS_BOULDER)) { this.boulder = AssetDatabase.LoadAssetAtPath(EditorPrefs.GetString(SETTINGS_BOULDER), typeof(Boulder)) as Boulder; } } catch (System.Exception) { } }
protected virtual void OnExit() { Exit?.Invoke(this, EventArgs.Empty); }
internal void EndCurrentLevel(Exit e) { this.fallDeathZone.GetComponent<Collider>().enabled = false; this.player.GetComponent<Rigidbody>().velocity = new Vector3(0, this.player.GetComponent<Rigidbody>().velocity.y, 0); this.player.transform.forward = -Vector3.forward; clearedDungeons++; if (!GoalReached()) StartCoroutine(CallDelayed(1, this.dungeonManager.CreateDungeon)); else Win(); }
public virtual bool Visit(Exit exit) { return(true); }
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Exit?.Invoke(animator, state); inState = false; }
public void AddExit(Exit exit) { this.Exits[(int)exit.ExitPosition] = exit; }
private void MapMessageDetails(Exit exit, OrderStatusChangedMessage message) { exit.Quantity = Convert.ToUInt16(message.Message.Filled); exit.Price = message.Message.AvgFillPrice; exit.TimeStamp = DateTime.UtcNow; }
static void LoadScene(string[] sceneData) { currentScene = new Scene (); ParseMode parseMode = ParseMode.None; Character currentCharacter = null; // Quest currentQuest = null; EventBase currentEventBase = null; // Drama currentDrama = null; QuestAction currentQuestAction = null; // Quest currentQuest = null; foreach (string line in sceneData) { if (line.Contains("BG:")){ string[] parts = line.Split(':'); currentScene.bgID = int.Parse(parts[1]); } if (line.Contains ("BGWidth")){ string[] parts = line.Split(':'); currentScene.bgWidth = int.Parse(parts[1]); } if (line.Contains("NextScene:")){ string[] parts = line.Split(':'); currentScene.nextScene = int.Parse(parts[1]); } if (line.Contains("ChangeSequence:")){ string[] parts = line.Split(':'); currentScene.nextSequence = parts[1]; } if (line.Contains("<CharaSetup>")){ parseMode = ParseMode.CharaSetup; continue; } if (line.Contains("<Quest>")){ parseMode = ParseMode.Quest; currentEventBase = new Quest(); // currentQuest = new Quest(); // currentQuest.actionList = new List<QuestAction>(); continue; } if (line.Contains("<Exit>")){ parseMode = ParseMode.Path; currentEventBase = new Exit(); // currentQuest = new Quest(); // currentQuest.actionList = new List<QuestAction>(); continue; } if (line.Contains("<PlayerSetup>")){ parseMode = ParseMode.PlayerSetup; continue; } if (line.Contains("<Drama>")){ parseMode = ParseMode.DramaLocation; // currentDrama = new Drama(); currentEventBase = new Drama(); continue; } if (line.Contains("<DramaEnd>") || line.Contains("<QuestEnd>") || line.Contains("<ExitEnd>")){ // currentScene.dialogList.Add(currentDrama); currentScene.eventList.Add (currentEventBase); } // if (line.Contains("<QuestEnd>")){ // if (currentQuest != null && currentQuestAction != null){ // currentQuest.actionList.Add(currentQuestAction); // } // currentScene.eventList.Add (currentQuest); // } // if (line.Contains("<QuestEvent>")){ // parseMode = ParseMode.QuestAction; // if (currentQuest != null && currentQuestAction != null){ // currentQuest.actionList.Add(currentQuestAction); // } // currentQuestAction = new QuestAction(); // // } switch (parseMode){ case ParseMode.PlayerSetup: if (line.Contains(":")){ string[] parts = line.Split(':'); if (line.Contains("x")){ currentScene.playerPos.x = int.Parse(parts[1]); } if (line.Contains("y")){ currentScene.playerPos.y = int.Parse(parts[1]); } } break; case ParseMode.CharaSetup: if (line.Contains("<Chara>")){ currentCharacter = new Character(currentScene.characterList.Count); } if (line.Contains("<CharaEnd>")){ currentScene.characterList.Add(currentCharacter); } if (line.Contains(":")){ string[] parts = line.Split(':'); if (line.Contains("x:")){ currentCharacter.xpos = int.Parse(parts[1]); } if (line.Contains("y:")){ currentCharacter.ypos = int.Parse(parts[1]); } if (line.Contains("hair:")){ currentCharacter.hairId = int.Parse(parts[1]); } if (line.Contains("clothes:")){ currentCharacter.clothesId = int.Parse(parts[1]); } if (line.Contains("name:")){ currentCharacter._name = parts[1]; } if (line.Contains ("anim:")){ currentCharacter.startAnimation = parts[1]; } if (line.Contains("side:")){ currentCharacter.side = int.Parse(parts[1]); } if (line.Contains ("id:")){ currentCharacter._id = int.Parse (parts[1]); } } break; case ParseMode.DramaLocation: case ParseMode.Quest: case ParseMode.Path: if (line.Contains(":")){ string[] parts = line.Split(':'); if (line.Contains("x:")){ currentEventBase.loc.x = int.Parse(parts[1]); // currentDrama.loc.x = int.Parse(parts[1]); } if (line.Contains("y:")){ currentEventBase.loc.y = int.Parse(parts[1]); // currentDrama.loc.y = int.Parse(parts[1]); } if (line.Contains("filename")){ currentEventBase.file = parts[1]; if (parseMode == ParseMode.Quest){ Quest quest = currentEventBase as Quest; LoadQuest(ref quest ); } // currentDrama.file = parts[1]; } if (line.Contains("next")){ currentEventBase.nextEvent = int.Parse(parts[1]); } if (line.Contains("side")){ currentEventBase.direction = int.Parse(parts[1]); // currentDrama.direction = int.Parse(parts[1]); } if (line.Contains("prereq:")){ currentEventBase.prereq = int.Parse (parts[1]); // currentDrama.prereq = int.Parse (parts[1]); } if (line.Contains ("reqchara:")){ currentEventBase.charaid = int.Parse (parts[1]); } if (line.Contains("id:")){ currentEventBase.id = int.Parse(parts[1]); // currentDrama.id = int.Parse (parts[1]); } if (line.Contains ("bondup:")){ int bond = int.Parse (parts[1]); Drama currentDrama = currentEventBase as Drama; currentDrama.showBond = (bond == 1); } if (line.Contains ("major:")){ int isMajorEvent = int.Parse (parts[1]); currentEventBase.isMajorEvent = (isMajorEvent == 1); } if (line.Contains("AddNews:")){ // Drama currentDrama = currentEventBase as Drama; currentEventBase.addnews = parts[1]; } if (line.Contains("AddNewsIcon:")){ // Drama currentDrama = currentEventBase as Drama; currentEventBase.addnewsIcon = parts[1]; } if (line.Contains("AddNewsImage:")){ // Drama currentDrama = currentEventBase as Drama; currentEventBase.addnewsImage = parts[1]; } if (line.Contains ("gobattle")){ currentEventBase.isBattle = true; } if (line.Contains ("monstername:")){ currentEventBase.monstername = parts[1]; } if (line.Contains ("monsterType:")){ currentEventBase.enemyType = int.Parse (parts[1]); } if (line.Contains ("repeat:")){ currentEventBase.isRepeat = (int.Parse (parts[1]) == 1); } if (line.Contains ("nextscene:") && parseMode == ParseMode.Path){ Exit exit = currentEventBase as Exit; exit.nextScene = int.Parse (parts[1]); } if (line.Contains ("chainstart:")){ currentEventBase.startChain = true; currentEventBase.chain = int.Parse(parts[1]); } else if (line.Contains ("chainend:")){ currentEventBase.endChain = true; } else if (line.Contains ("chain:")){ currentEventBase.chain = int.Parse (parts[1]); } } break; // case ParseMode.Quest: // if (line.Contains(":")){ // string[] parts = line.Split(':'); // if (line.Contains("x:")){ // currentQuest.loc.x = int.Parse(parts[1]); // } // if (line.Contains("y:")){ // currentQuest.loc.y = int.Parse(parts[1]); // } // if (line.Contains("side")){ // currentQuest.direction = int.Parse(parts[1]); // } // if (line.Contains("prereq:")){ // currentQuest.prereq = int.Parse (parts[1]); // } // if (line.Contains("id:")){ // currentQuest.id = int.Parse (parts[1]); // } // if (line.Contains ("filename:")){ // currentQuest.file = parts[1]; // LoadQuest (ref currentQuest); // } // if (line.Contains("id:")){ // currentQuest.id = int.Parse (parts[1]); // } // if (line.Contains ("completion")){ // currentQuest.requiredAmount = int.Parse (parts[1]); // } // if (line.Contains("name")){ // currentQuest.questName = parts[1]; // } // if (line.Contains ("startdesc")){ // int start = line.IndexOf('"') + 1; // string desc = line.Substring (start, line.LastIndexOf('"') - start).Replace("\\n", System.Environment.NewLine) ; // currentQuest.questDesc = desc; // } // if (line.Contains ("finishdesc")){ // int start = line.IndexOf('"') + 1; // string desc = line.Substring (start, line.LastIndexOf('"') - start).Replace("\\n", System.Environment.NewLine) ; // currentQuest.finishDesc = desc; // } // if (line.Contains("nextscene")){ // currentQuest.nextEvent = parts[1]; // } // } break; // case ParseMode.QuestAction: // if (line.Contains(":")){ // string[] parts = line.Split(':'); // if (line.Contains("x:")){ // currentQuestAction.loc.x = int.Parse(parts[1]); // } // if (line.Contains("y:")){ // currentQuestAction.loc.y = int.Parse(parts[1]); // } // if (line.Contains("desc")){ // currentQuestAction.desc = parts[1]; // } // if (line.Contains ("completion")){ // currentQuestAction.completionAmount = int.Parse (parts[1]); // } // if (line.Contains("cost")){ // currentQuestAction.staminaCost = int.Parse (parts[1]); // } // } // // break; } } }
public override void VisitExit(Exit exit) { IL.Emit(OpCodes.Br, ExitLabel); }
public override Statement VisitExit(Exit exit) { if (exit == null) return null; return base.VisitExit((Exit)exit.Clone()); }
protected virtual void OnExit(ExitEventArgs e) { Exit?.Invoke(this, e); }
public Player Build(string fileName) { float xCoord = 0, yCoord = 0; StreamReader sr; sr = File.OpenText(Game1.GetInstance().Content.RootDirectory + "\\" + fileName); string line; int reference = 0; // LEVEL DESTINATIONS int currDest = 0; List<string> destinations = new List<string>(); // LEVEL TILES List<TileFactory.TileType> tileChoices = new List<TileFactory.TileType>(); tileChoices.Add(TileFactory.TileType.grass); tileChoices.Add(TileFactory.TileType.pokePlainFloor); int tileNumber = 0; // LEVEL DATA line = sr.ReadLine(); string[] initialWords = line.Split(','); try { tileNumber = Int32.Parse(initialWords[0]); } catch { } for (int i = 0; i < initialWords.Length; i++) { if (initialWords[i].Contains("Levels")) { destinations.Add(initialWords[i]); } } // MAIN LEVEL while ((line = sr.ReadLine()) != null) { xCoord = 0; string[] words = line.Split(','); for (int i = 0; i < words.Length; i++) { if (words[i].Length > 1) { try { string tmp = words[i].Remove(1); reference = Int32.Parse(words[i][1].ToString()); words[i] = tmp; } catch { // exception here } } if (xCoord % 32 == 0 && yCoord % 32 == 0) { Tile tile = tileFactory.builder(tileChoices[tileNumber], new Vector2(xCoord, yCoord)); level.levelBackground.Add(tile); } if (words[i] == "P") { player = new Player(new Vector2(xCoord, yCoord)); } if (tileDictionary.ContainsKey(words[i])) { Tile tile = tileFactory.builder(tileDictionary[words[i]], new Vector2(xCoord, yCoord)); if (words[i] == "0" || words[i] == "q") { tile.collision = false; } if (words[i] == "q") { tile.position.X += 8f; tile.position.Y += 4f; } if (words[i] == "p") { tile.sign = true; tile.signTex = factory.builder(SpriteFactory.sprites.instructions); } level.levelTiles.Add(tile); } if (grassDictionary.ContainsKey(words[i])) { Grass grass = grassFactory.builder(grassDictionary[words[i]], new Vector2(xCoord, yCoord)); level.levelGrass.Add(grass); } if (ledgeDictionary.ContainsKey(words[i])) { Ledge ledge = ledgeFactory.builder(ledgeDictionary[words[i]], new Vector2(xCoord, yCoord)); level.levelLedges.Add(ledge); } if (buildingDictionary.ContainsKey(words[i])) { Building building = buildingFactory.builder(buildingDictionary[words[i]], new Vector2(xCoord, yCoord)); if (words[i] == "I") { building.isDoor = true; building.destination = destinations[currDest]; building.source = fileName; currDest++; } level.levelBuildings.Add(building); } if (exitDictionary.ContainsKey(words[i])) { Exit exit = new Exit(factory.builder(exitDictionary[words[i]]), new Vector2(xCoord, yCoord)); exit.destination = destinations[currDest]; currDest++; level.levelExits.Add(exit); } if (enemyDictionary.ContainsKey(words[i])) { Enemy enemy = enemyFactory.builder(enemyDictionary[words[i]], new Vector2(xCoord, yCoord), reference); level.levelEnemies.Add(enemy); } xCoord += spacingIncrement; } yCoord += spacingIncrement; } return player; }
// Use this for initialization void Awake() { instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>(); exit = GetComponentInParent <Exit>(); }
/// <summary> /// Initializes a new instance of the <see cref="LevelManager"/> class. /// </summary> /// <param name="gameDisplayResolution">The resolution the game is set to render at.</param> /// <param name="frameTime">The frame time set for the game.</param> public LevelManager(Vector2 gameDisplayResolution, float frameTime) { this.startText = new RenderableText(); this.Complete = false; this.physicsWorld = null; this.gameDisplayResolution = gameDisplayResolution; this.frameTime = frameTime; this.physicsWorld = null; this.spriteBatch = null; this.floorSprite = new Sprite(); this.contentManager = null; this.levelLoader = null; this.floorEdges = new List<Body>(); this.visualFloorEdges = new List<VisualEdge>(); this.platforms = new List<Platform>(); this.interactiveEntities = new List<InteractiveEntity>(); this.stickman = null; this.exit = null; this.scrollingDeath = null; this.mineCart = null; this.cartSwitch = null; this.scrollStartTimer = 0.0f; this.background = new Background(this.gameDisplayResolution, 0.8f); this.maxScore = 0.0f; }
//TODO: find bug causing this task to fire randomly // ran twice when casting armor spell on cat! -_- // c armor cat //Your hands start to glow as you begin chanting the armour spell //You place your hands upon Black and White cat engulfing them in a white protective glow. //You feel better as a wave of warth surrounds your body <-- task //Someone says to you, you should be feeling better now, wake when you are ready <-- task public static async Task Awakening(PlayerSetup.Player player, Room.Room room, string step, string calledBy) { //to stop task firing twice if (player.QuestLog.FirstOrDefault(x => x.Name.Equals("Find and greet Lance")) != null) { return; } player.Status = PlayerSetup.Player.PlayerStatus.Sleeping; await Task.Delay(5000); if (string.IsNullOrEmpty(step)) { player.Area = "Tutorial"; player.Region = "Tutorial"; player.AreaId = 3; var exit = new Exit { area = player.Area, region = player.Region, areaId = player.AreaId }; var templeRoom = Cache.ReturnRooms() .FirstOrDefault( x => x.area.Equals(player.Area) && x.areaId.Equals(player.AreaId) && x.region.Equals(player.Region)); if (templeRoom != null) { Movement.Teleport(player, templeRoom, exit); } else { var loadRoom = new LoadRoom { Area = player.Area, id = player.AreaId, Region = player.Region }; var newRoom = loadRoom.LoadRoomFile(); Movement.Teleport(player, newRoom, exit); //load from DB } //fix for random wake message hint showing var playerInRoom = Cache.ReturnRooms() .FirstOrDefault( x => x.area.Equals("Tutorial") && x.areaId.Equals(1) && x.region.Equals("Tutorial")) .players.FirstOrDefault(x => x.Name.Equals(player.Name)); //well this does not work if (playerInRoom != null) { await Task.Delay(3000); HubContext.SendToClient("You feel better as a wave of warmth surrounds your body", player.HubGuid); await Task.Delay(2000); HubContext.SendToClient("Someone says to you, You should be feeling better now, wake when you are ready", player.HubGuid); await Task.Delay(2000); HubContext.SendToClient("<p class='RoomExits'>[Hint] Type wake to wake up</p>", player.HubGuid); } //loops forever because room.players does not get updated when player leaves the ambush room // so this always tries to fire the messages below. as to why it sometimes it shows and sometimes does not, I have no idea. while (playerInRoom != null && playerInRoom.Area.Equals("Tutorial")) { await Task.Delay(30000); // <-- is this the cause && the check below is not working playerInRoom = Cache.ReturnRooms() .FirstOrDefault( x => x.area.Equals("Tutorial") && x.areaId.Equals(1) && x.region.Equals("Tutorial")) .players.FirstOrDefault(x => x.Name.Equals(player.Name)); if (playerInRoom == null) { return; } if (playerInRoom.Status != PlayerSetup.Player.PlayerStatus.Standing) { HubContext.SendToClient("You feel better as a wave of warth surrounds your body", player.HubGuid); await Task.Delay(2000); HubContext.SendToClient("Someone says to you, you should be feeling better now, wake when you are ready", player.HubGuid); await Task.Delay(2000); HubContext.SendToClient("<p class='RoomExits'>[Hint] Type wake to wake up</p>", player.HubGuid); } } } }
/// <summary> /// Loads the content used by entities in a level. /// </summary> /// <param name="contentManager">The content manager to load content with.</param> /// <param name="spriteBatch">The sprite batch to render using.</param> public void LoadContent(ContentManager contentManager, SpriteBatch spriteBatch) { this.CurrentLevelCustom = false; this.physicsWorld = new World(ConvertUnits.ToSimUnits(new Vector2(0.0f, 348.8f))); this.contentManager = contentManager; this.spriteBatch = spriteBatch; this.startText.InitializeAndLoad(spriteBatch, this.contentManager, ContentLocations.SegoeUIFontLarge, EntityConstants.GoText); this.InitializeAndLoadSprites(this.spriteBatch, this.contentManager); this.levelLoader = new LevelLoader(this.contentManager); this.stickman = new StickMan(ref this.physicsWorld, 10.0f, 100, -1.0f, this.spriteBatch, this.contentManager); this.exit = new Exit(spriteBatch, contentManager, ref this.physicsWorld, this.levelLoader.EndPosition); this.scrollingDeath = new ScrollingDeath(ref this.physicsWorld, this.gameDisplayResolution.Y, LevelConstants.MinimumScrollRate, LevelConstants.MaximumScrollRate, LevelConstants.ScrollRate, LevelConstants.ScrollAcceleration, LevelConstants.ScrollDeceleration, this.contentManager); this.rockyTerrain = contentManager.Load<Texture2D>(ContentLocations.Scenery + ContentLocations.RockyTerrain); this.background.InitializeAndLoad(this.spriteBatch, this.contentManager, ContentLocations.RockyBackGround); }
private static void Main(string[] args) { UIThread = Thread.CurrentThread.ManagedThreadId; if (args.Length == 0) { if (Process.GetProcessesByName(nameof(AxTools)).Length > 1) { log.Info("Waiting for parent AxTools process (1000 ms)"); Thread.Sleep(1000); } using (new Mutex(true, "AxToolsMainExecutable", out bool newInstance)) { if (newInstance) { if (Environment.OSVersion.Version >= new Version(6, 1)) { using (WindowsIdentity p = WindowsIdentity.GetCurrent()) { var pricipal = new WindowsPrincipal(p); if (!pricipal.IsInRole(WindowsBuiltInRole.Administrator)) { TaskDialog.Show("This program requires administrator privileges", nameof(AxTools), "Make sure you have administrator privileges", TaskDialogButton.OK, TaskDialogIcon.SecurityError); return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); WebRequest.DefaultWebProxy = null; DeleteTempFolder(); Legacy(); InstallRootCertificate(); log.Info("Adjusting process priorities..."); Utils.SetProcessPrioritiesToNormal(Process.GetCurrentProcess().Id); // in case we'are starting from Task Scheduler priorities can be lower than normal log.Info($"{typeof(WoWAntiKick)} is subscribing for {typeof(WoWProcessManager)}'s events"); WoWAntiKick.StartWaitForWoWProcesses(); log.Info($"Registered for: {Settings2.Instance.UserID}"); log.Info("Starting to load plugins..."); PluginManagerEx.LoadPluginsAsync(); log.Info("Starting WoW process manager..."); StartWoWProcessManagerTask = Task.Run((Action)WoWProcessManager.StartWatcher); log.Info("Looking for WoW client..."); WoWPathSearchTask = Task.Run(delegate { }); // CheckWoWDirectoryIsValid // log.Info("Starting add-ons backup service..."); Task.Run((Action)AddonsBackup.StartService); log.Info("Starting pinger..."); Task.Run(delegate { Pinger.Enabled = Settings2.Instance.PingerServerID != 0; }); log.Info("Starting updater service..."); Task.Run((Action)UpdaterService.Start); log.Info($"Constructing MainWindow, app version: {Globals.AppVersion}"); Application.Run(new MainWindow()); log.Info("MainWindow is closed, waiting for ShutdownLock..."); ShutdownLock.WaitForLocks(); log.Info($"Invoking 'Exit' handlers ({Exit?.GetInvocationList().Length})..."); Exit?.Invoke(); log.Info("Application is closed"); SendLogToDeveloper(); } else { MessageBox.Show("This program works only on Windows 7 or higher", nameof(AxTools), MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { TaskDialog.Show("This program is already running", nameof(AxTools), "", TaskDialogButton.OK, TaskDialogIcon.Warning); } } } else { ProcessArgs(); } }
public virtual Differences VisitExit(Exit exit1, Exit exit2){ Differences differences = new Differences(exit1, exit2); if (exit1 == null || exit2 == null){ if (exit1 != exit2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } Exit changes = (Exit)exit2.Clone(); Exit deletions = (Exit)exit2.Clone(); Exit insertions = (Exit)exit2.Clone(); differences.NumberOfSimilarities++; if (exit1.Level == exit2.Level) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++; if (differences.NumberOfDifferences == 0){ differences.Changes = null; differences.Deletions = null; differences.Insertions = null; }else{ differences.Changes = changes; differences.Deletions = deletions; differences.Insertions = insertions; } return differences; }
public static Room.Room TempleOfTyr() { var room = new Room.Room { region = "Tutorial", area = "Tutorial", areaId = 3, title = "Temple of Tyr", description = "<p>A circular blue mosaic covers the centre of the temple with a gold fist and star underneath in the centre. Above is a dome roof with yellow tinted glass giving the area a golden glow. An Alter to Tyr is at the back with a large blue banner hanging from the wall with the same golden fist above the star. To the south the entrance to the Temple</p>", //Defaults exits = new List <Exit>(), items = new List <Item.Item>(), mobs = new List <PlayerSetup.Player>(), terrain = Room.Room.Terrain.Field, keywords = new List <RoomObject>(), corpses = new List <PlayerSetup.Player>(), players = new List <PlayerSetup.Player>(), fighting = new List <string>(), clean = true, }; var mortem = new PlayerSetup.Player { NPCId = Guid.NewGuid(), Name = "Mortem", KnownByName = true, Type = PlayerSetup.Player.PlayerTypes.Mob, Description = "A blue cape of Tyr hangs down Mortems back who is covered in full plate mail except for his heads and hands. A golden mace hangs upside down from his belt.", Strength = 14, Dexterity = 16, Constitution = 18, Intelligence = 12, Wisdom = 18, Charisma = 14, MaxHitPoints = 300, HitPoints = 300, Level = 20, Gold = 450, Status = PlayerSetup.Player.PlayerStatus.Standing, Skills = new List <Skill>(), Inventory = new List <Item.Item>(), DialogueTree = new List <DialogTree>(), Greet = false, Emotes = new List <string>(), EventOnComunicate = new Dictionary <string, string>(), EventWake = "awakening awake", EventWear = "awakening awake" }; var plainTop = ClothingBody.PlainTop(); var plainTrousers = ClothingLegs.PlainTrousers(); var breastPlateTyr = FullPlateBody.BreastPlateOfTyr(); breastPlateTyr.location = Item.Item.ItemLocation.Worn; mortem.Inventory.Add(plainTop); mortem.Inventory.Add(plainTrousers); mortem.Inventory.Add(breastPlateTyr); mortem.Equipment.Body = breastPlateTyr.name; var intro = new DialogTree() { GiveQuest = true, QuestId = 0, Message = "" }; var south = new Exit { name = "South", area = "Anker", region = "Anker", areaId = 17, keywords = new List <string>(), hidden = false, locked = false }; room.exits.Add(south); // create item for platemail / cape / mace / set to worn //top and trousers for player room.mobs.Add(mortem); return(room); }
/* * Called by exit when it's build */ public void AddExit(Exit exit) { exits.Add(exit); }
public static void LinkRoomTo(Room fromRoom, Room toRoom) { Exit exit = new Exit() { Name = fromRoom.Name + " Exit", Description = fromRoom.Name + " Description", DoorLabel = toRoom.Name, Area = toRoom.Area, Room = toRoom }; fromRoom.AddExit(exit); }