コード例 #1
0
		void playerTracker_ItemAdded(TrackedPlayer item)
		{
			try
			{
				HudList.HudListRowAccessor newRow = hudList.InsertRow(1);

				((HudStaticText)newRow[1]).Text = item.Name;

				playerTracker_ItemChanged(item);
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
コード例 #2
0
		void playerTracker_ItemChanged(TrackedPlayer item)
		{
			try
			{
				for (int row = 1; row <= hudList.RowCount; row++)
				{
					if (((HudStaticText)hudList[row - 1][1]).Text == item.Name)
					{
						((HudStaticText)hudList[row - 1][0]).Text = item.LastSeen.ToString("yy/MM/dd HH:mm");

						CoordsObject newCords = Mag.Shared.Util.GetCoords(item.LandBlock, item.LocationX, item.LocationY);
						((HudStaticText)hudList[row - 1][2]).Text = newCords.ToString();

						((HudStaticText)hudList[row - 1][3]).Text = item.Id.ToString(CultureInfo.InvariantCulture);

						SortList();
					}
				}
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
コード例 #3
0
		public static bool Import(string fileName, out List<TrackedPlayer> items)
		{
			items = new List<TrackedPlayer>();


			FileInfo fileInfo = new FileInfo(fileName);

			if (!fileInfo.Exists)
				return false;


			XmlDocument xmlDocument = new XmlDocument();

			xmlDocument.Load(fileName);

			XmlNode playersNode = xmlDocument.SelectSingleNode("Players");

			if (playersNode == null)
				return false;


			// Import the Players
			if (playersNode.HasChildNodes)
			{
				foreach (XmlNode node in playersNode.ChildNodes)
				{
					if (node.Attributes == null || node.Attributes.Count == 0)
						continue;

					XmlAttribute attribute;

					TrackedPlayer item;

					if ((attribute = node.Attributes["Name"]) != null)
						item = new TrackedPlayer(attribute.Value);
					else
						continue;

					if ((attribute = node.Attributes["LastSeen"]) != null)
					{
						long value;
						if (long.TryParse(attribute.Value, out value))
							item.LastSeen = new DateTime(value);
					}

					if ((attribute = node.Attributes["LandBlock"]) != null)
					{
						int value;
						if (int.TryParse(attribute.Value, out value))
							item.LandBlock = value;
					}

					if ((attribute = node.Attributes["LocationX"]) != null)
					{
						double value;
						if (double.TryParse(attribute.Value, out value))
							item.LocationX = value;
					}

					if ((attribute = node.Attributes["LocationY"]) != null)
					{
						double value;
						if (double.TryParse(attribute.Value, out value))
							item.LocationY = value;
					}

					if ((attribute = node.Attributes["LocationZ"]) != null)
					{
						double value;
						if (double.TryParse(attribute.Value, out value))
							item.LocationZ = value;
					}

					items.Add(item);
				}
			}

			return true;
		}
コード例 #4
0
		void playerTracker_ItemRemoved(TrackedPlayer item)
		{
			try
			{
				for (int row = 1; row <= hudList.RowCount; row++)
				{
					if (((HudStaticText)hudList[row - 1][1]).Text == item.Name)
					{
						hudList.RemoveRow(row - 1);

						row--;
					}
				}
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
コード例 #5
0
        public static bool Import(string fileName, out List <TrackedPlayer> items)
        {
            items = new List <TrackedPlayer>();


            FileInfo fileInfo = new FileInfo(fileName);

            if (!fileInfo.Exists)
            {
                return(false);
            }


            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(fileName);

            XmlNode playersNode = xmlDocument.SelectSingleNode("Players");

            if (playersNode == null)
            {
                return(false);
            }


            // Import the Players
            if (playersNode.HasChildNodes)
            {
                foreach (XmlNode node in playersNode.ChildNodes)
                {
                    if (node.Attributes == null || node.Attributes.Count == 0)
                    {
                        continue;
                    }

                    XmlAttribute attribute;

                    TrackedPlayer item;

                    if ((attribute = node.Attributes["Name"]) != null)
                    {
                        item = new TrackedPlayer(attribute.Value);
                    }
                    else
                    {
                        continue;
                    }

                    if ((attribute = node.Attributes["LastSeen"]) != null)
                    {
                        long value;
                        if (long.TryParse(attribute.Value, out value))
                        {
                            item.LastSeen = new DateTime(value);
                        }
                    }

                    if ((attribute = node.Attributes["LandBlock"]) != null)
                    {
                        int value;
                        if (int.TryParse(attribute.Value, out value))
                        {
                            item.LandBlock = value;
                        }
                    }

                    if ((attribute = node.Attributes["LocationX"]) != null)
                    {
                        double value;
                        if (double.TryParse(attribute.Value, out value))
                        {
                            item.LocationX = value;
                        }
                    }

                    if ((attribute = node.Attributes["LocationY"]) != null)
                    {
                        double value;
                        if (double.TryParse(attribute.Value, out value))
                        {
                            item.LocationY = value;
                        }
                    }

                    if ((attribute = node.Attributes["LocationZ"]) != null)
                    {
                        double value;
                        if (double.TryParse(attribute.Value, out value))
                        {
                            item.LocationZ = value;
                        }
                    }

                    items.Add(item);
                }
            }

            return(true);
        }