Esempio n. 1
0
		public TileDataArray(Int32 size)
		{
			unknown = new TileData(false, Color.Magenta, Color.Magenta);
			data = new TileData[size];	
		}
Esempio n. 2
0
 public TileDataArray(Int32 size)
 {
     unknown = new TileData(false, Color.Magenta, Color.Magenta);
     data    = new TileData[size];
 }
Esempio n. 3
0
		public static void Initialize()
		{
			MarkerType mt;
			Int16 startPos;

			tileTypeDefs = new TileDataArray(TileProperties.TYPES);

			startPos = 0;
			foreach (KeyValuePair<Int32, TileInfo> kvp in Global.Instance.Info.Tiles)
			{
				if (kvp.Value.name == "Signs")
                    TileProperties.Sign = (Int16)kvp.Key;
				else if (kvp.Value.name == "Containers")
                    TileProperties.Chest = (Int16)kvp.Key;
                else if (kvp.Value.name == "Amethyst")
                    TileProperties.Amethyst = (Int16)kvp.Key;
                else if (kvp.Value.name == "Diamond")
                    TileProperties.Diamond = (Int16)kvp.Key;
                else if (kvp.Value.name == "Emerald")
                    TileProperties.Emerald = (Int16)kvp.Key;
                else if (kvp.Value.name == "Ruby")
                    TileProperties.Ruby = (Int16)kvp.Key;
                else if (kvp.Value.name == "Sapphire")
                    TileProperties.Sapphire = (Int16)kvp.Key;
                else if (kvp.Value.name == "Topaz")
                    TileProperties.Topaz = (Int16)kvp.Key;
                else if (kvp.Value.name == "Exposed Gems")
                    TileProperties.ExposedGems = (Int16)kvp.Key;
                else if (kvp.Value.name == "Small Detritus")
                    TileProperties.SmallDetritus = (Int16)kvp.Key;
                else if (kvp.Value.name == "Large Detritus")
                    TileProperties.LargeDetritus = (Int16)kvp.Key;
                else if (kvp.Value.name == "Large Detritus2")
                    TileProperties.LargeDetritus2 = (Int16)kvp.Key;
                else if (kvp.Value.name == "Copper Cache")
                    TileProperties.CopperCache = (Int16)kvp.Key;
                else if (kvp.Value.name == "Silver Cache")
                    TileProperties.SilverCache = (Int16)kvp.Key;
                else if (kvp.Value.name == "Gold Cache")
                    TileProperties.GoldCache = (Int16)kvp.Key;
                else if (kvp.Value.name == "Enchanted Sword")
                    TileProperties.EnchantedSword = (Int16)kvp.Key;

				if (kvp.Value.markerName != "")
				{
                    MarkerInfo mi = Global.Instance.Info.GetMarkerByName(kvp.Value.markerName);

                    if (mi == null)
						mt = MarkerType.Unknown;
                    else
                    {
                        if (Enum.TryParse<MarkerType>(mi.markerImage, out mt) == false)
                            mt = MarkerType.Unknown;
                    }
				}
				else
				{
					mt = MarkerType.Unknown;
				}

				tileTypeDefs[kvp.Key] = new TileData(kvp.Value.important, kvp.Value.color, kvp.Value.officialColor, mt);
				if (kvp.Key > startPos) startPos = (Int16) kvp.Key;
			}
			TileProperties.Unknown = (Int16) (startPos + 1);

			startPos = (Int16) ((TileProperties.TYPES - 2) - Global.Instance.Info.Walls.Count);

			foreach (KeyValuePair<String, List<SpecialObjectInfo>> kvp in Global.Instance.Info.SpecialObjects)
			{
				startPos -= (Int16) kvp.Value.Count;
			}

			TileProperties.Processed = startPos;
			tileTypeDefs[startPos++] = new TileData(false, Color.AliceBlue, Color.AliceBlue);
			TileProperties.Cropped = startPos;
			tileTypeDefs[startPos++] = new TileData(false, Color.AliceBlue, Color.AliceBlue);

			foreach (KeyValuePair<String, List<SpecialObjectInfo>> kvp in Global.Instance.Info.SpecialObjects)
			{
				switch (kvp.Key)
				{
					case "Background":
						TileProperties.BackgroundOffset = startPos;

						foreach (SpecialObjectInfo soi in kvp.Value)
						{
							tileTypeDefs[startPos++] = new TileData(false, soi.color, soi.officialColor);
						}
						break;
					case "Liquid":
						foreach (SpecialObjectInfo soi in kvp.Value)
						{
							if (soi.name == "Honey")
								TileProperties.Honey = startPos;
							else if (soi.name == "Lava")
								TileProperties.Lava = startPos;
							else if (soi.name == "Water")
								TileProperties.Water = startPos;

							tileTypeDefs[startPos++] = new TileData(false, soi.color, soi.officialColor);
						}
						break;
					case "Wire":
						foreach (SpecialObjectInfo soi in kvp.Value)
						{
							if (soi.name == "Red Wire")
								TileProperties.RedWire = startPos;
							else if (soi.name == "Green Wire")
								TileProperties.GreenWire = startPos;
							else if (soi.name == "Blue Wire")
								TileProperties.BlueWire = startPos;

							tileTypeDefs[startPos++] = new TileData(false, soi.color, soi.officialColor);
						}
						break;
					default:
						break;
				}

			}

			// This is a startPos -1 because walls start at 1, not at zero.
			TileProperties.WallOffset = (Int16) (startPos - 1);
			foreach (KeyValuePair<Int32, WallInfo> kvp in Global.Instance.Info.Walls)
			{
				tileTypeDefs[startPos] = new TileData(false, kvp.Value.color, kvp.Value.officialColor);
				startPos++;
			}


			for (Int32 i = 0; i < TileProperties.TYPES; i++)
			{
				if (tileTypeDefs[i] == null)
					tileTypeDefs[i] = new TileData(false, Color.Magenta, Color.Magenta);
			}

		}
Esempio n. 4
0
        public static void Initialize()
        {
            MarkerType mt;
            Int16      startPos;

            tileTypeDefs = new TileDataArray(TileProperties.TYPES);

            startPos = 0;
            foreach (KeyValuePair <Int32, TileInfo> kvp in Global.Instance.Info.Tiles)
            {
                if (kvp.Value.name == "Signs")
                {
                    TileProperties.Sign = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Containers")
                {
                    TileProperties.Chest = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Amethyst")
                {
                    TileProperties.Amethyst = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Diamond")
                {
                    TileProperties.Diamond = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Emerald")
                {
                    TileProperties.Emerald = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Ruby")
                {
                    TileProperties.Ruby = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Sapphire")
                {
                    TileProperties.Sapphire = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Topaz")
                {
                    TileProperties.Topaz = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Exposed Gems")
                {
                    TileProperties.ExposedGems = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Small Detritus")
                {
                    TileProperties.SmallDetritus = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Large Detritus")
                {
                    TileProperties.LargeDetritus = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Large Detritus2")
                {
                    TileProperties.LargeDetritus2 = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Copper Cache")
                {
                    TileProperties.CopperCache = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Silver Cache")
                {
                    TileProperties.SilverCache = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Gold Cache")
                {
                    TileProperties.GoldCache = (Int16)kvp.Key;
                }
                else if (kvp.Value.name == "Enchanted Sword")
                {
                    TileProperties.EnchantedSword = (Int16)kvp.Key;
                }

                if (kvp.Value.markerName != "")
                {
                    MarkerInfo mi = Global.Instance.Info.GetMarkerByName(kvp.Value.markerName);

                    if (mi == null)
                    {
                        mt = MarkerType.Unknown;
                    }
                    else
                    {
                        if (Enum.TryParse <MarkerType>(mi.markerImage, out mt) == false)
                        {
                            mt = MarkerType.Unknown;
                        }
                    }
                }
                else
                {
                    mt = MarkerType.Unknown;
                }

                tileTypeDefs[kvp.Key] = new TileData(kvp.Value.important, kvp.Value.color, kvp.Value.officialColor, mt);
                if (kvp.Key > startPos)
                {
                    startPos = (Int16)kvp.Key;
                }
            }
            TileProperties.Unknown = (Int16)(startPos + 1);

            startPos = (Int16)((TileProperties.TYPES - 2) - Global.Instance.Info.Walls.Count);

            foreach (KeyValuePair <String, List <SpecialObjectInfo> > kvp in Global.Instance.Info.SpecialObjects)
            {
                startPos -= (Int16)kvp.Value.Count;
            }

            TileProperties.Processed = startPos;
            tileTypeDefs[startPos++] = new TileData(false, Color.AliceBlue, Color.AliceBlue);
            TileProperties.Cropped   = startPos;
            tileTypeDefs[startPos++] = new TileData(false, Color.AliceBlue, Color.AliceBlue);

            foreach (KeyValuePair <String, List <SpecialObjectInfo> > kvp in Global.Instance.Info.SpecialObjects)
            {
                switch (kvp.Key)
                {
                case "Background":
                    TileProperties.BackgroundOffset = startPos;

                    foreach (SpecialObjectInfo soi in kvp.Value)
                    {
                        tileTypeDefs[startPos++] = new TileData(false, soi.color, soi.officialColor);
                    }
                    break;

                case "Liquid":
                    foreach (SpecialObjectInfo soi in kvp.Value)
                    {
                        if (soi.name == "Honey")
                        {
                            TileProperties.Honey = startPos;
                        }
                        else if (soi.name == "Lava")
                        {
                            TileProperties.Lava = startPos;
                        }
                        else if (soi.name == "Water")
                        {
                            TileProperties.Water = startPos;
                        }

                        tileTypeDefs[startPos++] = new TileData(false, soi.color, soi.officialColor);
                    }
                    break;

                case "Wire":
                    foreach (SpecialObjectInfo soi in kvp.Value)
                    {
                        if (soi.name == "Red Wire")
                        {
                            TileProperties.RedWire = startPos;
                        }
                        else if (soi.name == "Green Wire")
                        {
                            TileProperties.GreenWire = startPos;
                        }
                        else if (soi.name == "Blue Wire")
                        {
                            TileProperties.BlueWire = startPos;
                        }

                        tileTypeDefs[startPos++] = new TileData(false, soi.color, soi.officialColor);
                    }
                    break;

                default:
                    break;
                }
            }

            // This is a startPos -1 because walls start at 1, not at zero.
            TileProperties.WallOffset = (Int16)(startPos - 1);
            foreach (KeyValuePair <Int32, WallInfo> kvp in Global.Instance.Info.Walls)
            {
                tileTypeDefs[startPos] = new TileData(false, kvp.Value.color, kvp.Value.officialColor);
                startPos++;
            }


            for (Int32 i = 0; i < TileProperties.TYPES; i++)
            {
                if (tileTypeDefs[i] == null)
                {
                    tileTypeDefs[i] = new TileData(false, Color.Magenta, Color.Magenta);
                }
            }
        }