public int adjustPlayer(Maps.objects feedback, Maps currentMap) { if (feedback == Maps.objects.ENEMYORK1) { healthCounter--; } if (feedback == Maps.objects.ENEMYORK2) { healthCounter--; } if (feedback == Maps.objects.ENEMYSKELETON1) { healthCounter--; } if (feedback == Maps.objects.ENEMYSKELETON2) { healthCounter--; } if (feedback == Maps.objects.ENEMYSKELETON3) { healthCounter--; } if (feedback == Maps.objects.ENEMYSKELETONKING) { healthCounter -= 2; } if (feedback == Maps.objects.KEY) { hasKey = true; } if (feedback == Maps.objects.GOLD) { goldCounter++; } if (feedback == Maps.objects.PLAYER) { healthCounter--; } if (feedback == Maps.objects.TRIFORCE) { hasTriforce = true; } if (feedback == Maps.objects.PORTALTOCITY && currentMap.type == Maps.mapType.FOREST) { return 0; } if (feedback == Maps.objects.PORTALTOCITY && currentMap.type == Maps.mapType.GRAVEYARD) { return 1; } if (feedback == Maps.objects.PORTALTOFOREST) { return 2; } if (feedback == Maps.objects.PORTALTOGRAVEYARDOPEN) { return 3; } return 4; }
public void StartMap(Maps map) { CurrentMap = map; switch (map) { case Maps.Volcano: GameObject.Find("BackGround").GetComponent<SpriteRenderer>().sprite = Background_Volcano; Managers.TerrianManager.Create(); break; case Maps.Forest: GameObject.Find("BackGround").GetComponent<SpriteRenderer>().sprite = Background_Forest; transform.FindChild("Forest").gameObject.SetActive(true); float[] xPos = GetChilds(transform.FindChild("Forest"), "Pistons").Select(g => g.transform.position.x).ToArray(); for (int i = 0; i < xPos.Length; i++) xPos[i] -= 0.15f; Managers.SpawnManager.CustomPositionX.AddRange(xPos); break; case Maps.Ice: GameObject.Find("BackGround").GetComponent<SpriteRenderer>().sprite = Background_Ice; transform.FindChild("Ice").gameObject.SetActive(true); break; } GameObject.Find("BackGround").GetComponent<ResizeToScreen>().Resize(); }
public WorldMap() { // // Required for Windows Form Designer support // InitializeComponent(); m_Big = Pandora.Profile.Travel.WorldMapBig; m_Map = Pandora.Map.Map; bClose.Text = Pandora.Localization.TextProvider[ "Common.Exit" ]; tBar.ImageList = new ImageList(); tBar.ImageList.ImageSize = new Size( 1,1 ); Pandora.Localization.LocalizeControl( this ); m_Buttons = new ToolBarButton[] { bMap0, bMap1, bMap2, bMap3, bMap4 }; InitToolBar(); DoDisplay(); }
public void SetLocation(Maps map, int x, int y, int z = 128) { if (mapViewer.Map != map) { mapViewer.Map = map; map0DungeonToolStripMenuItem.Checked = false; map1SosariaToolStripMenuItem.Checked = false; map2IlshinarToolStripMenuItem.Checked = false; map3MalasToolStripMenuItem.Checked = false; map4TokunoToolStripMenuItem.Checked = false; map5TerMurToolStripMenuItem.Checked = false; switch(map) { case Maps.Dungeon : map0DungeonToolStripMenuItem.Checked = true; break; case Maps.Sosaria: map1SosariaToolStripMenuItem.Checked = true; break; case Maps.Ilshenar: map2IlshinarToolStripMenuItem.Checked = true; break; case Maps.Malas: map3MalasToolStripMenuItem.Checked = true; break; case Maps.Tokuno: map4TokunoToolStripMenuItem.Checked = true; break; case Maps.TerMur: map5TerMurToolStripMenuItem.Checked = true; break; } } Point point = new Point(x, y); if (mapViewer.Center != point) mapViewer.Center = point; }
/// <summary> /// Creates a new npc and spawns it. /// </summary> /// <param name="id">The id of the npc.</param> /// <param name="name">The name of the npc.</param> /// <param name="location">The location of the npc.</param> /// <param name="mesh">The mesh of the npc.</param> /// <param name="avatar">The avatar of the npc.</param> /// <param name="npctype">The type of the npc.</param> /// <param name="flag">The flat of the npc.</param> public static void CreateNPC(uint id, string name, Maps.MapPoint location, ushort mesh, byte avatar, Enums.NPCType npctype = Enums.NPCType.Normal, ushort flag = 2) { Entities.NPC npc = new ProjectX_V3_Game.Entities.NPC(); npc.EntityUID = id; npc.Mesh = (ushort)(mesh * 10); npc.Flag = flag; npc.Name = name; npc.X = location.X; npc.Y = location.Y; npc.NPCType = npctype; npc.Avatar = avatar; if (!location.Map.EnterMap(npc)) { return; } if (Core.Kernel.NPCs.TryAdd(npc.EntityUID, npc)) { IniFile npcini = new IniFile(ServerDatabase.DatabaseLocation + "\\NPCInfo\\" + id + ".ini", "Info"); npcini.WriteString("Name", name); npcini.WriteString("Type", npctype.ToString()); npcini.Write<ushort>("MapID", location.MapID); npcini.Write<ushort>("X", location.X); npcini.Write<ushort>("Y", location.Y); npcini.Write<ushort>("Flag", flag); npcini.Write<ushort>("Mesh", mesh); npcini.Write<byte>("Avatar", avatar); npc.Screen.UpdateScreen(null); } }
public BeamMoveAnimation(Loc2D startLoc, int animIndex, RenderTime animTime, Maps.Direction8 dir, int distance, RenderTime lastingTime) { StartLoc = startLoc; AnimationIndex = animIndex; FrameLength = animTime; Direction = dir; TotalDistance = distance; LastingTime = lastingTime; }
public int adjustEnemy(Maps.objects feedback, Maps currentMap) { if (feedback == Maps.objects.PLAYER) { alive = false; ; } return 4; }
public AStarPathfinder(Maps.IMap map) { this.map = map; this.maxX = map.MaxX; this.maxY = map.MaxY; InitMovements(); InitSquares(); }
public Enemy(Maps.objects enemy, Maps currentMap, Maps.mapType type) { this.canSpawn = true; this.type = (Maps.mapType)type; this.enemy = enemy; this.currentMap = currentMap; this.alive = true; newSpawnPoint(); this.i = 0; }
public ArrowMoveAnimation(Loc2D startLoc, int animIndex, RenderTime animTime, Maps.Direction8 dir, int distance, int speed) { StartLoc = startLoc; AnimationIndex = animIndex; FrameLength = animTime; Direction = dir; TotalWaves = distance; TotalDistance = distance*TextureManager.TILE_SIZE; TravelSpeed = speed; }
/// <summary> /// Creates a new MapViewInfo object /// </summary> /// <param name="map">The map currently displayed</param> /// <param name="controlSize">The size of the control</param> /// <param name="center">The location of the center of the control</param> /// <param name="zoomLevel">The current zoom level</param> /// <param name="viewer">The MapViewer owner of this view</param> public MapViewInfo( Maps map, Size controlSize, Point center, int zoomLevel, MapViewer viewer ) { m_Map = map; m_ControlSize = controlSize; m_Center = center; m_ZoomLevel = zoomLevel; m_Viewer = viewer; Calculate(); }
public Loc( XmlNode xNode ) { Map = (Maps)System.Convert.ToInt16(xNode.Attributes["map"].Value); X = System.Convert.ToInt16( xNode.Attributes["x"].Value ); Y = System.Convert.ToInt16( xNode.Attributes["y"].Value ); Z = System.Convert.ToInt16( xNode.Attributes["z"].Value ); //Color = Color.FromArgb(System.Convert.ToInt32(xNode.Attributes["color"].Value)); Name = xNode.Attributes["name"].Value; IsDefined = true; }
public static void Pluie(UberSpriteBatch sprite_batch, GameTime game_time, Maps.MapData mapdata, bool end) { if (game_time.TotalGameTime.TotalMilliseconds % 1 < 2 && !end) Rain.Add(new MoteurParticule(TexturesManager.Pluie, new Vector2(RandomManager.Next(-100, mapdata.MapWidth * 32), -100), Direction.Down, RandomManager.Next(50), 3)); foreach (var gout in Rain) { gout.update(); gout.Draw(sprite_batch); } Rain.RemoveAll(particule => particule.IsDead || particule.position.X > mapdata.MapWidth * 32 || particule.position.Y > mapdata.MapHeight * 32); }
public Scene() { Layers = new Layers(); AllLayers = new Layers(); Animations = new Animations(); ScriptFiles = new List<string>(); Maps = new Maps(); }
public Layer() { Name = "new_layer"; //Parent = parentLayer; _childLayers = new Layers(this); _attributes = new Dictionary<string, string>(); _maps = new Maps(); }
private List<GameObject>[] mapsBySize = null; //!< A multi-dimensional array of the maps sorted by size /** * Called when the script is loaded, before the game starts */ void Awake () { S = this; // Initialize the maps array mapsBySize = new List<GameObject>[5] { null, // Not used as there will be no 0 player maps new List<GameObject> (), new List<GameObject> (), new List<GameObject> (), new List<GameObject> () }; parseMaps (); }
public UpdateData(StreamHandler Reader, bool LazyReading) { this.m_map = (Maps)Reader.ReadUInt16(); this.Reader = Reader; m_readers = new Action[] { ReadUpdates, }; if (!LazyReading) EnsureRead(); }
/// <summary> /// Creates a new map for the players to play in. Should only be called in Main.LoadContent(). /// </summary> /// <param name="content">The ContentManager that gets passed into Main.LoadContent().</param> /// <param name="name">The name of the map you are creating.</param> /// <param name="enemySpawns">A point array of all the places where enemies can spawn.</param> public Map(ContentManager content, Maps map, Point[] enemySpawns) { // Set this map's name to whatever name the map parameter was set to. Name = Enum.GetNames(typeof(Maps))[(int)map]; try { // If the maps's name was "Map01", then these two lines will // set Foreground to the texture located at "Maps/Map01/foreground" // and Background to the texture located at "Maps/Map01/background" Foreground = content.Load<Texture2D>("Maps/" + Name + "/foreground"); Background = content.Load<Texture2D>("Maps/" + Name + "/background"); } catch { Console.WriteLine("Map \"" + Name + "\" is missing a texture. This is usually okay."); } EnemySpawnPoints = enemySpawns; }
public Engine() { running = true; player = new Player(); ork1 = new Enemy(Maps.objects.ENEMYORK1, forest, (Maps.mapType)2); ork2 = new Enemy(Maps.objects.ENEMYORK1, forest, (Maps.mapType)2); skeleton1 = new Enemy(Maps.objects.ENEMYSKELETON1, graveyard, (Maps.mapType)3); skeleton2 = new Enemy(Maps.objects.ENEMYSKELETON2, graveyard, (Maps.mapType)3); skeleton3 = new Enemy(Maps.objects.ENEMYSKELETON3, graveyard, (Maps.mapType)3); city = new Maps(40, 20, 0, player); forest = new Maps(40, 20, 1, player); graveyard = new Maps(40, 20, 2, player); currentMap = 0; run(); }
private void LoadMap(Maps map) { //tank entity creation was moved to ogmo; see testlevel.oep for adding a decorator to your tank. //try to load a project OgmoProject proj = new OgmoProject("Resources/Maps/test.oep", "Resources/Maps/"); //register our function to call for creating entities //this just is a string with the method name, the method itself has to be in the entities (see tank) proj.CreationMethodName = _creationMethodName; //uuh this somehow "registers a collision tag" proj.RegisterTag(CollidableTags.Wall, "CollisionLayer"); //try to load a level into "Scene"; map gets auto-ToString() to enum position name proj.LoadLevel("Resources/Maps/" + map + ".oel", Scene); }
public static ILevel MakeLevel(ICharacter player, Maps map = Maps.Random) { // Get a new random map, which is not the same as the previous map. while (map == Maps.Random || (player.Level != null && player.Level.Type.Contains(map.ToString()))) { // 2 in order to skip the starting map map = (Maps)GlobalVariables.Rng.Next(2, 6); } ILevel newLevel = new Level($@"{GlobalVariables.ContentDir}Maps\{map}.txt", player); if (map == Maps.HouseMap) { newLevel.Assets.AddRange(ItemFactory.MakeTestItems()); } var spawnLocations = new List<SpawnLocation>(); foreach (IGameObject asset in newLevel.Assets) { if (asset.Type.Contains("SpawnPoint")) { spawnLocations.Add(new SpawnLocation(asset.Position, asset.Type, 0, false)); } } if (map.ToString().Contains("Bloody")) { IEnumerable<ICharacter> enemies = EnemyFactory.MakeRandomEnemies(spawnLocations); newLevel.Enemies.AddRange(enemies); //TODO figure a way to avoid hardcoding here player.Position = GetNewPlayerPosition(player.Position); } foreach (ICharacter enemy in newLevel.Enemies) { enemy.Level = newLevel; } return newLevel; }
public GuildCollector(Maps.Map map, Characters.Character owner, int id) { ID = id; IsInFight = false; Guild = owner.Guild; Map = map; Map.Collector = this; Owner = owner.ID; Cell = owner.MapCell; Dir = 3; Name = new int[2] { Utilities.Basic.Rand(1, 39), Utilities.Basic.Rand(1, 71) }; timer = new Timer(); timer.Enabled = true; timer.Interval = Utilities.Basic.Rand(5000, 15000); timer.Elapsed += new ElapsedEventHandler(this.Move); timer.Start(); Map.Send(string.Concat("GM",PatternMap())); }
public GameServer(int targetClientCount = 2, Maps mapToLoad = Maps.networkTestBench) { //what map should be loaded? _mapToLoad = mapToLoad; //for how many clients should we wait? _targetClientCount = targetClientCount; //in game update so we can pause the scene without problems Game.Instance.OnUpdate += ReadNetwork; //console info Console.WriteLine("server"); //server config NetPeerConfiguration config = new NetPeerConfiguration("tank"); config.Port = 14242; //start the server Server = new NetServer(config); Server.Start(); OnServerData += ServerOnDataHandler; }
protected virtual bool CanMove(DirectionEnum direction) { bool result = false; switch (direction) { case DirectionEnum.Up: { if (Y == 0) { break; } SpriteTypeEnum cur1 = Room[X, Y]; SpriteTypeEnum cur2 = Room[X + 1, Y]; SpriteTypeEnum pos1 = Room[X, Y - 1]; SpriteTypeEnum pos2 = Room[X + 1, Y - 1]; result = ((Maps.IsStairs(cur1) && Maps.IsStairs(cur2)) && !(Maps.IsWall(pos1) || Maps.IsWall(pos2))); break; } case DirectionEnum.Down: { if (Y == 16) { break; } SpriteTypeEnum pos1 = Room[X, Y + 1]; SpriteTypeEnum pos2 = Room[X + 1, Y + 1]; result = (HasNoStrongHold(pos1, false) && HasNoStrongHold(pos2, false)) || (Maps.IsStairs(pos1) && Maps.IsStairs(pos2)); break; } case DirectionEnum.Left: { if (X == 0) { break; } SpriteTypeEnum pos = Room[X - 1, Y]; result = !Maps.IsWall(pos); break; } case DirectionEnum.Right: { if (X == 49) { break; } SpriteTypeEnum pos = Room[X + 2, Y]; result = !Maps.IsWall(pos); break; } } return(result); }
/// <summary> /// Creates a new MapViewInfo object with default values /// </summary> /// <param name="viewer">The MapViewer owner of this view</param> public MapViewInfo( MapViewer viewer ) { m_Map = Maps.Sosaria; m_ControlSize = new Size( 20, 20 ); m_Center = new Point(7212, 3108); m_ZoomLevel = 0; m_Viewer = viewer; Calculate(); }
public TileSprite(MapTile CurrentTile, MapTile PreviousTile, string TileType) { currentTile = CurrentTile; previousTile = PreviousTile; tileType = TileType; Maps maps = GameManager.Instance.GetComponent <Maps>(); if (tileType == "road") { if (previousTile.transform.position.x < currentTile.transform.position.x && previousTile.transform.position.y < currentTile.transform.position.y) { currentTile.roadSprite.sprite = maps.roadTiles[0]; currentTile.pathDirection = "NE"; if (!currentTile.pathDirections.Contains(3)) { currentTile.pathDirections.Add(3); } if (!previousTile.pathDirections.Contains(2)) { previousTile.pathDirections.Add(2); } } if (previousTile.transform.position.x > currentTile.transform.position.x && previousTile.transform.position.y > currentTile.transform.position.y) { currentTile.roadSprite.sprite = maps.roadTiles[0]; currentTile.pathDirection = "SW"; if (!currentTile.pathDirections.Contains(2)) { currentTile.pathDirections.Add(2); } if (!previousTile.pathDirections.Contains(3)) { previousTile.pathDirections.Add(3); } } if (previousTile.transform.position.x < currentTile.transform.position.x && previousTile.transform.position.y > currentTile.transform.position.y) { currentTile.roadSprite.sprite = maps.roadTiles[0]; currentTile.pathDirection = "SE"; currentTile.transform.rotation = new Quaternion(0f, 180f, 0f, 0f); if (!currentTile.pathDirections.Contains(1)) { currentTile.pathDirections.Add(1); } if (!previousTile.pathDirections.Contains(4)) { previousTile.pathDirections.Add(4); } } if (previousTile.transform.position.x > currentTile.transform.position.x && previousTile.transform.position.y < currentTile.transform.position.y) { currentTile.roadSprite.sprite = maps.roadTiles[0]; currentTile.pathDirection = "NW"; currentTile.transform.rotation = new Quaternion(0f, 180f, 0f, 0f); if (!currentTile.pathDirections.Contains(4)) { currentTile.pathDirections.Add(4); } if (!previousTile.pathDirections.Contains(1)) { previousTile.pathDirections.Add(1); } } if (previousTile.pathDirection == "NE" && currentTile.pathDirection == "SE" || previousTile.pathDirection == "NW" && currentTile.pathDirection == "SW") { previousTile.roadSprite.sprite = maps.roadTiles[1]; //previousTile.transform.position = new Vector3(previousTile.transform.position.x, previousTile.transform.position.y + 1.5f, previousTile.transform.position.z); } if (previousTile.pathDirection == "SE" && currentTile.pathDirection == "NE" || previousTile.pathDirection == "SW" && currentTile.pathDirection == "NW") { previousTile.roadSprite.sprite = maps.roadTiles[2]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); //previousTile.transform.position = new Vector3(previousTile.transform.position.x + .5f, previousTile.transform.position.y, previousTile.transform.position.z); } if (previousTile.pathDirection == "NW" && currentTile.pathDirection == "NE" || previousTile.pathDirection == "SW" && currentTile.pathDirection == "SE") { previousTile.roadSprite.sprite = maps.roadTiles[3]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); //previousTile.transform.position = new Vector3(previousTile.transform.position.x, previousTile.transform.position.y + .5f, previousTile.transform.position.z); } if (previousTile.pathDirection == "SE" && currentTile.pathDirection == "SW" || previousTile.pathDirection == "NE" && currentTile.pathDirection == "NW") { previousTile.roadSprite.sprite = maps.roadTiles[3]; previousTile.transform.rotation = new Quaternion(0f, 180f, 0f, 0f); //previousTile.roadSprite.transform.position = new Vector3(previousTile.transform.position.x, previousTile.transform.position.y +.5f, previousTile.transform.position.z); } //if (currentTile.pathCount > 1) //{ if (previousTile.pathDirections.Contains(1) && previousTile.pathDirections.Contains(2) && previousTile.pathDirections.Contains(3)) { previousTile.roadSprite.sprite = maps.roadTiles[7]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); } if (previousTile.pathDirections.Contains(1) && previousTile.pathDirections.Contains(2) && previousTile.pathDirections.Contains(4)) { previousTile.roadSprite.sprite = maps.roadTiles[6]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); } if (previousTile.pathDirections.Contains(1) && previousTile.pathDirections.Contains(3) && previousTile.pathDirections.Contains(4)) { previousTile.roadSprite.sprite = maps.roadTiles[8]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); } if (previousTile.pathDirections.Contains(2) && previousTile.pathDirections.Contains(3) && previousTile.pathDirections.Contains(4)) { previousTile.roadSprite.sprite = maps.roadTiles[5]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); } if (previousTile.pathDirections.Contains(1) && previousTile.pathDirections.Contains(2) && previousTile.pathDirections.Contains(3) && previousTile.pathDirections.Contains(4)) { previousTile.roadSprite.sprite = maps.roadTiles[4]; previousTile.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); } //Debug.Log(previousTile.tileNumber + " " + previousTile.pathDirections.Count); //if (currentTile.pathDirections.Count == 4) //{ // currentTile.roadSprite.sprite = maps.roadTiles[4]; //} //if (currentTile.pathDirections.Count == 3) //{ //} //} } }
public SqlConnector ForDatabase(Maps.DatabaseName database) { if (database == null) return this; return new SqlConnector(Replace(connectionString, database), this.Schema, this.DynamicQueryManager, this.Version); }
/// <summary> /// Decided whether the circle is visible on the specified map view /// </summary> /// <param name="bounds">The bounds of the map portion currently displayed</param> /// <param name="map">The map currently displayed</param> /// <returns>True if the circle is visible, false otherwise</returns> public bool IsVisible(Rectangle bounds, Maps map) { if ( ( m_Map != map ) && ( m_Map != Maps.AllMaps ) ) return false; if ( ( m_Location.X - m_Radius > bounds.Right ) || ( m_Location.X + m_Radius < bounds.Left ) || ( m_Location.Y - m_Radius > bounds.Bottom ) || ( m_Location.Y + m_Radius < bounds.Top ) ) return false; return true; }
/// <summary> /// Creates a MapCircle object at a given location, filled inside /// </summary> /// <param name="radius">The radius of the circle</param> /// <param name="location">The location at which the circle is displayed</param> /// <param name="map">The map on which the circle is displayed</param> /// <param name="color">The color of the border</param> /// <param name="fillColor">The color of the fill</param> public MapCircle( int radius, Point location, Maps map, Color color, Color fillColor ) { m_Radius = radius; m_Map = map; m_Location = location; m_Color = color; m_FillColor = fillColor; m_Fill = true; }
protected override void PostValidate() { ModifyKeys(); if (Errors().Length != 0) { return; } if (Entities.Any()) { Entities.First().IsMaster = true; } ModifyLogLimits(); ModifyRelationshipToMaster(); ModifyIndexes(); // create entity field's matcher foreach (var entity in Entities) { var pattern = string.Join("|", entity.GetAllFields().Where(f => !f.System).OrderByDescending(f => f.Alias.Length).Select(f => f.Alias)); #if NETS10 entity.FieldMatcher = new Regex(pattern); #else entity.FieldMatcher = new Regex(pattern, RegexOptions.Compiled); #endif // more efficient post-back strategy for form validation if (Mode == "form") { var fields = entity.Fields.Where(f => f.Input).ToArray(); var lastField = fields.Last(f => f.InputType != "file"); foreach (var field in fields.Where(f => f.PostBack == "auto").ToArray()) { field.PostBack = field.InputType == "file" || field.V == string.Empty ? "false" : "true"; if (field.Map == string.Empty) { continue; } var map = Maps.FirstOrDefault(m => m.Name == field.Map); if (map == null) { continue; } if (!map.Query.Contains("@")) { continue; } // it is possible for this map to affect other field's post-back setting foreach (var p in new ParameterFinder().Find(map.Query).Distinct()) { var parameterField = fields.FirstOrDefault(f => f.Name == p || f.Alias == p); if (parameterField != null) { parameterField.PostBack = "true"; } } } foreach (var field in fields.Where(f => f.PostBack == "auto").ToArray()) { field.PostBack = "false"; } lastField.PostBack = "true"; } } }
public virtual QuorumCall <AsyncLogger, RemoteEditLogManifest> GetEditLogManifest( long fromTxnId, bool inProgressOk) { IDictionary <AsyncLogger, ListenableFuture <RemoteEditLogManifest> > calls = Maps.NewHashMap (); foreach (AsyncLogger logger in loggers) { ListenableFuture <RemoteEditLogManifest> future = logger.GetEditLogManifest(fromTxnId , inProgressOk); calls[logger] = future; } return(QuorumCall.Create(calls)); }
/// <summary> /// clone process, remove entities, and create entity needed for calculated fields /// </summary> /// <returns>A made-up process that represents the denormalized output's fields that contribute to calculated fields</returns> public Process ToCalculatedFieldsProcess() { // clone process, remove entities, and create entity needed for calculated fields var calc = this.Clone(); calc.LogLimit = LogLimit; calc.EntityLogLimit = EntityLogLimit; calc.FieldLogLimit = FieldLogLimit; calc.Entities.Clear(); calc.CalculatedFields.Clear(); calc.Relationships.Clear(); var entity = new Entity { Name = "Calculated" }; entity.Alias = entity.Name; entity.Key = calc.Name + entity.Alias; entity.Connection = "output"; entity.Fields.Add(new Field { Name = Constants.TflKey, Alias = Constants.TflKey, PrimaryKey = true, System = true, Input = true, Type = "int" }); // Add fields that calculated fields depend on entity.Fields.AddRange(CalculatedFields .SelectMany(f => f.Transforms) .SelectMany(t => t.Parameters) .Where(p => !p.HasValue() && p.IsField(this)) .Select(p => p.AsField(this).Clone()) .Where(f => f.Output) .Distinct() .Except(CalculatedFields) ); var mapFields = CalculatedFields .SelectMany(cf => cf.Transforms) .Where(t => t.Method == "map") .Select(t => Maps.First(m => m.Name == t.Map)) .SelectMany(m => m.Items) .Where(i => i.Parameter != string.Empty) .Select(i => i.AsParameter().AsField(this)) .Distinct() .Except(entity.Fields) .Select(f => f.Clone()); entity.Fields.AddRange(mapFields); entity.CalculatedFields.AddRange(CalculatedFields.Select(cf => cf.Clone())); foreach (var parameter in entity.GetAllFields().SelectMany(f => f.Transforms).SelectMany(t => t.Parameters)) { parameter.Entity = string.Empty; } foreach (var field in entity.Fields) { field.Source = Utility.GetExcelName(field.EntityIndex) + "." + field.FieldName(); } foreach (var field in entity.CalculatedFields) { field.Source = Utility.GetExcelName(field.EntityIndex) + "." + field.FieldName(); } entity.ModifyIndexes(); calc.Entities.Add(entity); calc.ModifyKeys(); calc.ModifyIndexes(); // create entity field's matcher var pattern = string.Join("|", entity.GetAllFields().Where(f => !f.System).OrderByDescending(f => f.Alias.Length).Select(f => f.Alias)); #if NETS10 entity.FieldMatcher = new Regex(pattern); #else entity.FieldMatcher = new Regex(pattern, RegexOptions.Compiled); #endif return(calc); }
public bool From(int map) { return(!(Blocked.Contains(map) || Maps.getMap(map).Blocked.Contains(map))); // False if blocked }
/// <summary> /// Map transforms require the map's parameters. /// </summary> private void ModifyMapParameters() { if (Maps.Count == 0) { return; } foreach (var transform in GetAllTransforms().Where(t => t.Method == "map" && Maps.Any(m => m.Name == t.Map))) { var parameters = Maps .First(m => m.Name == transform.Map) .Items .Where(i => i.Parameter != string.Empty) .Select(p => p.Parameter) .Distinct(); foreach (var parameter in parameters) { if (parameter.IndexOf('.') > 0) { var split = parameter.Split(new[] { '.' }); transform.Parameters.Add(GetParameter(split[0], split[1])); } else { transform.Parameters.Add(GetParameter(parameter)); } } } }
public bool IsInMap(Maps.IMapObject MapObject) { if (DynamicMap != null) { if (MapObject.DynamicMap == null) return false; if (DynamicMap.DynamicID != MapObject.DynamicMap.DynamicID) return false; } return Map.MapID == MapObject.Map.MapID; }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Language display initialization InitializeLanguage(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters Current.Host.Settings.EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Prevent the screen from turning off while under the debugger by disabling // the application's idle detection. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } using (DataContextBuilder db = new DataContextBuilder(DataContextBuilder.DBConnectionString)) { if (db.DatabaseExists() == false) { db.CreateDatabase(); } } DatabaseHandler dbHandler = DatabaseHandler.DbHandler; DataContextBuilder dbTest = new DataContextBuilder("DataSource=isostore:/RUISviewDB.sdf"); Photos photo = new Photos() { p_Location = "pLocation", p_PhotoName = "testPhoto", p_ShowTime = 0, p_TimesShown = 10 }; dbHandler.Interact(0, null, photo); Maps map = new Maps(); map.m_MapLocation = "Testlocation"; map.m_MapName = "Testname"; Photos p2 = new Photos() { p_Location = "pLocation2", p_PhotoName = "testPhoto2", p_ShowTime = 2, p_TimesShown = 20 }; dbHandler.Interact(0, map, null); Maps m = dbTest.Maps.First(); string s = m.m_MapName; photo.m_MapId = m.m_MapId; dbHandler.Interact(0, null, p2); }
private string _user; //имя пользователя для доступа к Zabbix API (пользователь должен входить в группу "API users") #endregion Fields #region Constructors public ZabbixConnection(string api_url, string user, string password) { _user = user; _password = password; ServerRoot=api_url; url = ServerRoot + @"/api_jsonrpc.php"; hostgroups = new HostGroups(this); maps= new Maps(this); triggers = new Triggers(this); events = new Events(this); firstThread = new Thread(getFirstInfo); longThread = new Thread(getInfo); }
void Awake() { self = this; }
public int keyInput(Maps currentMap) { ConsoleKeyInfo keyInfo = Console.ReadKey(true); Maps.objects feedback; switch (keyInfo.Key) { case ConsoleKey.W: if ((feedback = currentMap.update(x, y, x - 1, y, 0)) != Maps.objects.CANTWALK) { if (feedback != Maps.objects.ENEMYSKELETONKING) { this.x--; } return adjustPlayer(feedback, currentMap); } break; case ConsoleKey.S: if ((feedback = currentMap.update(x, y, x + 1, y, 0)) != Maps.objects.CANTWALK) { if (feedback != Maps.objects.ENEMYSKELETONKING) { this.x++; } return adjustPlayer(feedback, currentMap); } break; case ConsoleKey.A: if ((feedback = currentMap.update(x, y, x, y - 1, 0)) != Maps.objects.CANTWALK) { if (feedback != Maps.objects.ENEMYSKELETONKING) { this.y--; } return adjustPlayer(feedback, currentMap); } break; case ConsoleKey.D: if ((feedback = currentMap.update(x, y, x, y + 1, 0)) != Maps.objects.CANTWALK) { if (feedback != Maps.objects.ENEMYSKELETONKING) { this.y++; } return adjustPlayer(feedback, currentMap); } break; case ConsoleKey.Escape: Engine.running = false; break; case ConsoleKey.H: Console.Clear(); Console.WriteLine(" "); Console.WriteLine(" Press \"W\" to Move Up "); Console.WriteLine(" Press \"S\" to Move Down "); Console.WriteLine(" Press \"A\" to Move Left "); Console.WriteLine(" Press \"D\" to Move Right "); Console.WriteLine(" Press \"B\" to Buy one Health for 10 Gold "); Console.WriteLine(" Press \"O\" to insert your Cheat "); Console.WriteLine(" Press \"ESC\" to Exit the game "); Console.WriteLine(" "); Console.WriteLine(" Rougy is created by Julian Hopp and Daniel Lause. "); Console.ReadKey(true); Console.Clear(); break; case ConsoleKey.B: if (goldCounter >= 10) { healthCounter++; goldCounter -= 10; } break; case ConsoleKey.O: Console.Clear(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(" /\\ "); Console.WriteLine(" /--\\ "); Console.WriteLine(" /_\\/_\\ "); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Enter your Cheat: "); String read = Console.ReadLine(); if (read == "key") { hasKey = true; } if (read == "gold") { goldCounter = 999; } if (read == "killurself") { healthCounter = 0; } if (read == "winwin") { hasTriforce = true; } break; default: return 5; } return 5; }
public virtual IDictionary <string, object> toParams() { IDictionary <string, object> @params = Maps.newHashMap(); return(@params); }