Beispiel #1
0
		protected virtual void CompileSecondHand(SuperGumpLayout layout, Point2D center)
		{
			layout.Add(
				"clock/hand/second",
				() =>
				{
					var sa = 2.0f * Math.PI * Time.Seconds / 60.0f;
					var shp = center.Clone2D((int)(Radius * Math.Sin(sa)), (int)(-Radius * Math.Cos(sa)));

					AddLine(center, shp, ColorSecondHand, 1);
				});
		}
Beispiel #2
0
		protected virtual void CompileHourHand(SuperGumpLayout layout, Point2D center)
		{
			layout.Add(
				"clock/hand/hour",
				() =>
				{
					var ha = 2.0f * Math.PI * (Time.Hours + Time.Minutes / 60.0f) / 12.0f;
					var hhp = center.Clone2D((int)(Radius * Math.Sin(ha) / 1.5f), (int)(-Radius * Math.Cos(ha) / 1.5f));

					AddLine(center, hhp, ColorHourHand, 3);
				});
		}
Beispiel #3
0
		protected virtual void CompileMinuteHand(SuperGumpLayout layout, Point2D center)
		{
			layout.Add(
				"clock/hand/minute",
				() =>
				{
					var ma = 2.0f * Math.PI * (Time.Minutes + Time.Seconds / 60.0f) / 60.0f;
					var mhp = center.Clone2D((int)(Radius * Math.Sin(ma)), (int)(-Radius * Math.Cos(ma)));

					AddLine(center, mhp, ColorMinuteHand, 3);
				});
		}
Beispiel #4
0
		protected virtual void CompileSecondHand(SuperGumpLayout layout, Point2D center)
		{
			layout.Add(
				"clock/hand/second",
				() =>
				{
					var sa = 2.0f * Math.PI * Time.Seconds / 60.0f;
					var shp = center.Clone2D((int)(Radius * Math.Sin(sa)), (int)(-Radius * Math.Cos(sa)));

					foreach (var p in center.GetLine2D(shp))
					{
						AddHtml(p.X, p.Y, 1, 1, " ".WrapUOHtmlBG(ColorSecondHand), false, false);
					}
				});
		}
Beispiel #5
0
		protected virtual void CompileMinuteHand(SuperGumpLayout layout, Point2D center)
		{
			layout.Add(
				"clock/hand/minute",
				() =>
				{
					var ma = 2.0f * Math.PI * (Time.Minutes + Time.Seconds / 60.0f) / 60.0f;
					var mhp = center.Clone2D((int)(Radius * Math.Sin(ma)), (int)(-Radius * Math.Cos(ma)));

					foreach (var p in center.GetLine2D(mhp))
					{
						AddHtml(p.X - 1, p.Y - 1, 3, 3, " ".WrapUOHtmlBG(ColorMinuteHand), false, false);
					}
				});
		}
Beispiel #6
0
		protected virtual void CompileHourHand(SuperGumpLayout layout, Point2D center)
		{
			layout.Add(
				"clock/hand/hour",
				() =>
				{
					var ha = 2.0f * Math.PI * (Time.Hours + Time.Minutes / 60.0f) / 12.0f;
					var hhp = center.Clone2D((int)(Radius * Math.Sin(ha) / 1.5f), (int)(-Radius * Math.Cos(ha) / 1.5f));

					foreach (var p in center.GetLine2D(hhp))
					{
						AddHtml(p.X - 1, p.Y - 1, 3, 3, " ".WrapUOHtmlBG(ColorHourHand), false, false);
					}
				});
		}
Beispiel #7
0
		public override void AppendTo(IGumpWriter disp)
		{
			var first = true;

			if (_Background)
			{
				disp.AppendLayout(_Layout1A);
				disp.AppendLayout(_X);
				disp.AppendLayout(_Y);
				disp.AppendLayout(1417);

				if (_BackgroundHue > 0)
				{
					disp.AppendLayout(_Layout1Hue);
					disp.AppendLayoutNS(FixHue(_BackgroundHue));
				}

				first = false;
			}

			if (_Face)
			{
				disp.AppendLayout(first ? _Layout1A : _Layout1B);
				disp.AppendLayout(_X + 33);
				disp.AppendLayout(_Y + 33);
				disp.AppendLayout(1210);

				if (_FaceHue > 0)
				{
					disp.AppendLayout(_Layout1Hue);
					disp.AppendLayoutNS(FixHue(_FaceHue));
				}

				first = false;
			}

			if (_Numbers)
			{
				for (var number = 1; number <= 12; number++)
				{
					AppendTo(disp, ref first, number, _NumbersColor);
				}
			}

			var center = new Point2D(_X + 40, _Y + 40);

			if (_Hours)
			{
				var ha = 2.0f * Math.PI * (_Time.Hour + _Time.Minute / 60.0f) / 12.0f;
				var hl = center.GetLine2D(center.Clone2D((int)(40 * Math.Sin(ha) / 1.5f), (int)(-40 * Math.Cos(ha) / 1.5f)));

				AppendTo(disp, ref first, hl, 3, _HoursColor);
			}

			if (_Minutes)
			{
				var ma = 2.0f * Math.PI * (_Time.Minute + _Time.Second / 60.0f) / 60.0f;
				var ml = center.GetLine2D(center.Clone2D((int)(40 * Math.Sin(ma)), (int)(-40 * Math.Cos(ma))));

				AppendTo(disp, ref first, ml, 3, _MinutesColor);
			}

			if (_Seconds)
			{
				var sa = 2.0f * Math.PI * _Time.Second / 60.0f;
				var sl = center.GetLine2D(center.Clone2D((int)(40 * Math.Sin(sa)), (int)(-40 * Math.Cos(sa))));

				AppendTo(disp, ref first, sl, 1, _SecondsColor);
			}

			if (first)
			{
				disp.AppendLayout(_Layout2A);
				disp.AppendLayout(_X);
				disp.AppendLayout(_Y);
				disp.AppendLayout(Width);
				disp.AppendLayout(Height);
				disp.AppendLayout(Parent.Intern(" ".WrapUOHtmlBG(Color.Transparent)));
				disp.AppendLayout(false);
				disp.AppendLayout(false);
			}
		}
Beispiel #8
0
		public override string Compile()
		{
			var compiled = String.Empty;

			if (_Background)
			{
				if (_BackgroundHue <= 0)
				{
					compiled += String.Format(_Format1A, _X, _Y, 1417);
				}
				else
				{
					compiled += String.Format(_Format1B, _X, _Y, 1417, FixHue(_BackgroundHue));
				}
			}

			if (_Face)
			{
				if (_FaceHue <= 0)
				{
					compiled += String.Format(_Format1A, _X + 33, _Y + 33, 1210);
				}
				else
				{
					compiled += String.Format(_Format1B, _X + 33, _Y + 33, 1210, FixHue(_FaceHue));
				}
			}

			if (_Numbers)
			{
				for (var number = 1; number <= 12; number++)
				{
					compiled += Compile(number, _NumbersColor);
				}
			}

			var center = new Point2D(_X + 40, _Y + 40);

			if (_Hours)
			{
				var ha = 2.0f * Math.PI * (_Time.Hour + _Time.Minute / 60.0f) / 12.0f;
				var hl = center.GetLine2D(center.Clone2D((int)(40 * Math.Sin(ha) / 1.5f), (int)(-40 * Math.Cos(ha) / 1.5f)));

				compiled += Compile(hl, 3, _HoursColor);
			}

			if (_Minutes)
			{
				var ma = 2.0f * Math.PI * (_Time.Minute + _Time.Second / 60.0f) / 60.0f;
				var ml = center.GetLine2D(center.Clone2D((int)(40 * Math.Sin(ma)), (int)(-40 * Math.Cos(ma))));

				compiled += Compile(ml, 3, _MinutesColor);
			}

			if (_Seconds)
			{
				var sa = 2.0f * Math.PI * _Time.Second / 60.0f;
				var sl = center.GetLine2D(center.Clone2D((int)(40 * Math.Sin(sa)), (int)(-40 * Math.Cos(sa))));

				compiled += Compile(sl, 1, _SecondsColor);
			}

			if (String.IsNullOrWhiteSpace(compiled))
			{
				compiled = String.Format(_Format2, _X, _Y, Width, Height, Parent.Intern(" ".WrapUOHtmlBG(Color.Transparent)));
			}

			return compiled;
		}