Esempio n. 1
0
		public override Rectangle2D GenerateGump(TriggerObject trigObject, UberScriptGump gump, int originX, int originY)
		{
			if (m_Condition != null && GetCondition(trigObject) == false)
			{
				return new Rectangle2D();
			}

			int backgroundID = GetBackgroundID(trigObject);
			int padding = GetPadding(trigObject);
			int x = originX + GetX(trigObject);
			int y = originY + GetY(trigObject);
			int width = GetWidth(trigObject);
			int height = GetHeight(trigObject);
			int verticalGap = GetVerticalGap(trigObject);

			if (backgroundID != 0)
			{
				gump.AddBackground(x, y, width, height, backgroundID);
			}

			x += padding;
			y += padding;

			foreach (UberGumpElement child in Children)
			{
				if (child is UberGumpList)
				{
					UberGumpList list = (UberGumpList)child;
					ArrayList actualList = list.GetListSource(trigObject);

					if (actualList != null)
					{
						string key = list.GetObjsVarName(trigObject);
						string functionName = list.GetLoopFunction(trigObject);

						foreach (object element in actualList)
						{
							trigObject.objs[key] = element;
							child.GenerateGump(trigObject, gump, x, y);
							y += child.GetHeight(trigObject) + verticalGap;

							// check the script to execute in between
							if (functionName == null)
							{
								continue;
							}

							RootNode scriptNode = trigObject.Script.ScriptRootNode;

							if (scriptNode != null)
							{
								foreach (UserDefinedFunctionNode node in
									scriptNode.UserDefinedFunctionNodes.Where(node => node.ScriptString == functionName))
								{
									node.Execute(trigObject);
									break;
								}
							}
						}
					}
				}
				else
				{
					child.GenerateGump(trigObject, gump, x, y);
					y += child.GetHeight(trigObject) + verticalGap;
				}
			}
			return new Rectangle2D(GetX(trigObject), GetY(trigObject), GetWidth(trigObject), GetHeight(trigObject));
		}
Esempio n. 2
0
		public override Rectangle2D GenerateGump(TriggerObject trigObject, UberScriptGump gump, int originX, int originY)
		{
			if (m_Condition != null && GetCondition(trigObject) == false)
			{
				return new Rectangle2D();
			}

			int backgroundID = GetBackgroundID(trigObject);
			int padding = GetPadding(trigObject);
			int x = originX + GetX(trigObject);
			int y = originY + GetY(trigObject);
			int width = GetWidth(trigObject);
			int height = GetHeight(trigObject);
			int horizontalGap = GetHorizontalGap(trigObject);

			if (backgroundID != 0)
			{
				gump.AddBackground(x, y, width, height, backgroundID);
			}

			x += padding;
			y += padding;

			foreach (UberGumpElement child in Children)
			{
				child.GenerateGump(trigObject, gump, x, y);
				x += child.GetWidth(trigObject) + horizontalGap;
			}

			return new Rectangle2D(GetX(trigObject), GetY(trigObject), GetWidth(trigObject), GetHeight(trigObject));
		}