Exemple #1
0
 /// <summary>
 /// Constructor 1
 /// </summary>
 /// <param name="Page">The gump to which the list will be added.</param>
 /// <param name="Style">The style of the GumpList.</param>
 /// <param name="Skin">The skinning parameters of the list.</param>
 public GumpList(Gump Page, string Style, BaseSkin Skin)
 {
     sk         = Skin;
     page       = Page;
     numperpage = sk.NumPerPage;
     style      = Style;
     topbar     = new GumpListEntry(sk.ListStartX, sk.ListStartY, this, sk.EntryDefaultWidth, sk.EntryDefaultHeight);
     listEntries.Add(topbar.GetHashCode(), topbar);
     DebugWrite("Constructor sans title end.");
 }
		/// <summary>
		/// Constructor 1
		/// </summary>
		/// <param name="Page">The gump to which the list will be added.</param>
		/// <param name="Style">The style of the GumpList.</param>
		/// <param name="Skin">The skinning parameters of the list.</param>
		public GumpList( Gump Page, string Style, BaseSkin Skin )
		{			
			sk = Skin;
			page = Page;
			numperpage = sk.NumPerPage;
			style = Style;
			topbar = new GumpListEntry(sk.ListStartX, sk.ListStartY, this, sk.EntryDefaultWidth, sk.EntryDefaultHeight);
			listEntries.Add( topbar.GetHashCode(), topbar);
			DebugWrite("Constructor sans title end.");
		}
Exemple #3
0
 //par has skin and location info. Also contains column count info.
 //style is "details" or "icons".
 /// <summary>
 /// Creates a new Gump List Entry.
 /// </summary>
 /// <param name="x">X location within the GumpList object.</param>
 /// <param name="y">Y location within the GumpList object.</param>
 /// <param name="par">Parent GumpList object.</param>
 /// <param name="width">Full width of GLE</param>
 /// <param name="height">Full height of GLE</param>
 /// <param name="iconID">ID of icon in icons mode.</param>
 public GumpListEntry(int x, int y, GumpList par, int width, int height, int iconID)
 {
     skin         = par.sk;
     m_X          = x;
     m_Y          = y;
     m_Width      = width;
     m_Height     = height;
     m_ParentList = par;
     m_Dividers   = par.ShowDividers;
     m_Tooltip    = false;
     m_TooltipID  = 0;
     m_Background = par.ShowBackground;
     if (m_Background)
     {
         m_BackgroundID = par.GetBackground();
     }
     else
     {
         m_BackgroundID = 0;
     }
     m_Style = par.style;
 }
Exemple #4
0
 public static BaseSkin getSkin(string name)
 {
     try
     {
         BaseSkin sk = skList[name];
         if (sk != null)
         {
             return(sk);
         }
         else
         {
             Console.WriteLine("No Such Skin: " + name); return(null);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Unable to fetch skin: " + name);
         if (Core.Debug)
         {
             Console.WriteLine("" + e);
         }
         return(null);
     }
 }
		public static object LoadSkin(string name, Type t )
		{
			if (skinExists(name))
			{ return getSkin(name); }
			if (!Directory.Exists("TMSS/Data/Skins"))
				Directory.CreateDirectory("TMSS/Data/Skins");
			ObjectHandle objhand = Activator.CreateInstance(null, t.FullName);
			
			object o = objhand.Unwrap();
			
			BaseSkin sk = new BaseSkin();
			string FileName = name+".tskn";
			string path = @"TMSS/Data/Skins/" + FileName;

			Console.Write(" - //Skin// - Loading Skin " + name + " on path: "+path+"...");
			if (!File.Exists(path)) { Console.WriteLine("ERROR: Skin Not Found "); return null; }

			XmlReaderSettings settings = new XmlReaderSettings();
			settings.IgnoreWhitespace = true;
			XmlReader read = XmlReader.Create(path, settings);

			read.ReadStartElement("TMSkin");
			read.ReadStartElement("FieldCount");
			int count = read.ReadContentAsInt();
			read.ReadEndElement();
			int i = 0;
			FieldInfo inf = null;;
			Type t2 = null;
			while (i < count)
			{
				try
				{
					string blah = read.LocalName;
					//string blah = (string)read.ReadElementContentAs( typeof(string), null );
					inf = t.GetField(blah);
					t2 = inf.FieldType;//inf.GetType();
					inf.SetValue(o, read.ReadElementContentAs(t2, null));
				}
				catch (Exception e)
				{
					Console.WriteLine("Invalid operation while setting up Base Skin. " + e+" inf: "+inf+" t2: "+t2+" o: "+o);
				}
				i++;
			}
			try
			{
				((BaseSkin)o).BaseDeserialize(read);
				//sk.BaseDeserialize(read);
				read.Close();
				skList.Add(((BaseSkin)o).SkinName, (BaseSkin)o);
			}
			catch (Exception ex)
			{
				Console.WriteLine("Unable to deserialize a base skin of type: "+t+". Please examine format. "+ex);
			}
			Console.WriteLine("done");
			return o;
		}
Exemple #6
0
        public static object LoadSkin(string name, Type t)
        {
            if (skinExists(name))
            {
                return(getSkin(name));
            }
            if (!Directory.Exists("TMSS/Data/Skins"))
            {
                Directory.CreateDirectory("TMSS/Data/Skins");
            }
            ObjectHandle objhand = Activator.CreateInstance(null, t.FullName);

            object o = objhand.Unwrap();

            BaseSkin sk       = new BaseSkin();
            string   FileName = name + ".tskn";
            string   path     = @"TMSS/Data/Skins/" + FileName;

            Console.Write(" - //Skin// - Loading Skin " + name + " on path: " + path + "...");
            if (!File.Exists(path))
            {
                Console.WriteLine("ERROR: Skin Not Found "); return(null);
            }

            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;
            XmlReader read = XmlReader.Create(path, settings);

            read.ReadStartElement("TMSkin");
            read.ReadStartElement("FieldCount");
            int count = read.ReadContentAsInt();

            read.ReadEndElement();
            int       i   = 0;
            FieldInfo inf = null;;
            Type      t2  = null;

            while (i < count)
            {
                try
                {
                    string blah = read.LocalName;
                    //string blah = (string)read.ReadElementContentAs( typeof(string), null );
                    inf = t.GetField(blah);
                    t2  = inf.FieldType;                   //inf.GetType();
                    inf.SetValue(o, read.ReadElementContentAs(t2, null));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Invalid operation while setting up Base Skin. " + e + " inf: " + inf + " t2: " + t2 + " o: " + o);
                }
                i++;
            }
            try
            {
                ((BaseSkin)o).BaseDeserialize(read);
                //sk.BaseDeserialize(read);
                read.Close();
                skList.Add(((BaseSkin)o).SkinName, (BaseSkin)o);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unable to deserialize a base skin of type: " + t + ". Please examine format. " + ex);
            }
            Console.WriteLine("done");
            return(o);
        }
		//par has skin and location info. Also contains column count info.
		//style is "details" or "icons".
		/// <summary>
		/// Creates a new Gump List Entry.
		/// </summary>
		/// <param name="x">X location within the GumpList object.</param>
		/// <param name="y">Y location within the GumpList object.</param>
		/// <param name="par">Parent GumpList object.</param>
		/// <param name="width">Full width of GLE</param>
		/// <param name="height">Full height of GLE</param>
		/// <param name="iconID">ID of icon in icons mode.</param>
		public GumpListEntry(int x, int y, GumpList par, int width, int height, int iconID)
		{
			skin = par.sk;
			m_X = x;
			m_Y = y;
			m_Width = width;
			m_Height = height;
			m_ParentList = par;
			m_Dividers = par.ShowDividers;
			m_Tooltip = false;
			m_TooltipID = 0;
			m_Background = par.ShowBackground;
			if (m_Background)
				m_BackgroundID = par.GetBackground();
			else
				m_BackgroundID = 0;
			m_Style = par.style;
		}