Esempio n. 1
0
        protected virtual void DoAlignRightsMenu(object sender, EventArgs e)
        {
            IEnumerator enumerator = (IEnumerator)null;

            try
            {
                foreach (object selectedElement in this.mParent.GetSelectedElements())
                {
                    BaseElement objectValue = (BaseElement)RuntimeHelpers.GetObjectValue(selectedElement);
                    objectValue.X = this.X + this.Width - objectValue.Width;
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            GlobalObjects.DesignerForm.CreateUndoPoint();
        }
Esempio n. 2
0
        public void BreakGroup()
        {
            IEnumerator enumerator = null;

            try
            {
                foreach (object mElement in this.mElements)
                {
                    BaseElement objectValue = (BaseElement)RuntimeHelpers.GetObjectValue(mElement);
                    this.mParent.AddElement(objectValue);
                    objectValue.Selected = true;
                    Point point = new Point(this.X + objectValue.X, this.Y + objectValue.Y);
                    objectValue.Location = point;
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            this.mParent.RemoveElement(this);
        }
Esempio n. 3
0
        public void OnExportUltimaPHP(object sender, EventArgs eventargs, int x, int y, bool noDispose, bool noClose, bool noMove, string gumpName)
        {
            SaveFileDialog dialog = new SaveFileDialog {
                Filter = "Script File (*.gump.php)|*.gump.php"
            };
            int group = -1;

            if (dialog.ShowDialog(this.designer) != DialogResult.Cancel)
            {
                StreamWriter writer = File.CreateText(dialog.FileName);
                writer.WriteLine(header);
                writer.WriteLine("class " + gumpName + " extends Gumps {");
                writer.WriteLine("\tpublic function build() {");
                writer.WriteLine("\t\t$player = UltimaPHP::$socketClients[$this->getClient()]['account']->player;");

                writer.WriteLine("");

                writer.WriteLine("\t\t$this->setNoClose(" + noClose + ");");
                writer.WriteLine("\t\t$this->setNoDispose(" + noDispose + ");");
                writer.WriteLine("\t\t$this->setNoMove(" + noMove + ");");

                int num       = 0;
                int pageIndex = 0;
                if (0 < this.designer.Stacks.Count)
                {
                    do
                    {
                        if (pageIndex > 0)
                        {
                            writer.Write("");
                        }

                        GumpStudio.Elements.GroupElement element12 = this.designer.Stacks[num] as GumpStudio.Elements.GroupElement;
                        writer.Write("\n\t\t$this->addPage(" + num + ");");
                        if (element12 != null)
                        {
                            ArrayList elementsRecursive = element12.GetElementsRecursive();
                            int       num2 = 0;
                            if (0 < elementsRecursive.Count)
                            {
                                do
                                {
                                    GumpStudio.Elements.BaseElement element = elementsRecursive[num2] as GumpStudio.Elements.BaseElement;
                                    string name = element.GetType().Name;

                                    GumpStudio.Elements.AlphaElement element10 = element as GumpStudio.Elements.AlphaElement;
                                    if (element10 != null)
                                    {
                                        writer.Write("\n\t\t$this->addTransparency(" + element10.X + ", " + element10.Y + ", " + element10.Width + ", " + element10.Height + ");");
                                    }
                                    else
                                    {
                                        GumpStudio.Elements.BackgroundElement element8 = element as GumpStudio.Elements.BackgroundElement;
                                        if (element8 != null)
                                        {
                                            writer.Write("\n\t\t$this->addBackground(" + element8.X + ", " + element8.Y + ", " + element8.Width + ", " + element8.Height + ", " + element8.GumpID + ");");
                                        }
                                        else
                                        {
                                            GumpStudio.Elements.ButtonElement element4 = element as GumpStudio.Elements.ButtonElement;
                                            if (element4 != null)
                                            {
                                                if (element4.ButtonType == GumpStudio.Elements.ButtonTypeEnum.Reply)
                                                {
                                                    writer.Write("\n\t\t$this->addButton(" + element4.X + ", " + element4.Y + ", " + element4.NormalID + ", " + element4.PressedID + ", 1, " + element4.Z + ", " + element4.Param + ");");
                                                }
                                                else if (element4.ButtonType == GumpStudio.Elements.ButtonTypeEnum.Page)
                                                {
                                                    writer.Write("\n\t\t$this->addButton(" + element4.X + ", " + element4.Y + ", " + element4.NormalID + ", " + element4.PressedID + ", 0, " + element4.Param + ", " + element4.Z + ");");
                                                }
                                            }
                                            else
                                            {
                                                GumpStudio.Elements.CheckboxElement element6 = element as GumpStudio.Elements.CheckboxElement;
                                                if (element6 != null)
                                                {
                                                    writer.Write("\n\t\t$this->addCheckbox(" + element6.X + ", " + element6.Y + ", " + element6.UnCheckedID + ", " + element6.CheckedID + ", " + element6.Group + ", " + (element6.Checked ? 1 : 0) + "); ");
                                                }
                                                else
                                                {
                                                    GumpStudio.Elements.ImageElement element9 = element as GumpStudio.Elements.ImageElement;
                                                    if (element9 != null)
                                                    {
                                                        writer.Write("\n\t\t$this->addGumpPic(" + element9.X + ", " + element9.Y + ", " + element9.GumpID + ", " + element9.Hue.Index + ");");
                                                    }
                                                    else
                                                    {
                                                        GumpStudio.Elements.ItemElement element11 = element as GumpStudio.Elements.ItemElement;
                                                        if (element11 != null)
                                                        {
                                                            writer.Write("\n\t\t$this->addTilePic(" + element11.X + ", " + element11.Y + ", " + element11.ItemID + ");");
                                                        }
                                                        else
                                                        {
                                                            GumpStudio.Elements.LabelElement element7 = element as GumpStudio.Elements.LabelElement;
                                                            if (element7 != null)
                                                            {
                                                                writer.Write("\n\t\t$this->addText(");
                                                                writer.Write(element7.X);
                                                                writer.Write(", ");
                                                                writer.Write(element7.Y);
                                                                writer.Write(", ");
                                                                writer.Write(element7.Hue.Index);
                                                                writer.Write(", \"");
                                                                if (element7.Text != null)
                                                                {
                                                                    writer.Write(element7.Text.Replace("\"", "\\\""));
                                                                }
                                                                writer.WriteLine("\");");
                                                            }
                                                            else
                                                            {
                                                                GumpStudio.Elements.RadioElement element2 = element as GumpStudio.Elements.RadioElement;
                                                                if (element2 != null)
                                                                {
                                                                    if (element2.Group != group)
                                                                    {
                                                                        writer.Write("\n\t\t$this->addGroup(");
                                                                        writer.Write(element2.Group);
                                                                        writer.WriteLine(");");
                                                                        group = element2.Group;
                                                                    }
                                                                    writer.Write("\n\t\t$this->addRadio(");
                                                                    writer.Write(element2.X);
                                                                    writer.Write(", ");
                                                                    writer.Write(element2.Y);
                                                                    writer.Write(", ");
                                                                    writer.Write(element2.UnCheckedID);
                                                                    writer.Write(", ");
                                                                    writer.Write(element2.CheckedID);
                                                                    writer.Write(", ");
                                                                    writer.Write(element2.Value);
                                                                    writer.Write(", ");
                                                                    writer.Write(element2.Checked ? 1 : 0);
                                                                    writer.WriteLine(");");
                                                                }
                                                                else
                                                                {
                                                                    GumpStudio.Elements.TextEntryElement element3 = element as GumpStudio.Elements.TextEntryElement;
                                                                    if (element3 != null)
                                                                    {
                                                                        writer.Write("\n\t\t$this->addTextEntry(");
                                                                        writer.Write(element3.X);
                                                                        writer.Write(", ");
                                                                        writer.Write(element3.Y);
                                                                        writer.Write(", ");
                                                                        writer.Write(element3.Width);
                                                                        writer.Write(", ");
                                                                        writer.Write(element3.Height);
                                                                        writer.Write(", ");
                                                                        writer.Write(element3.Hue.Index);
                                                                        writer.Write(", ");
                                                                        writer.Write(element3.ID);
                                                                        writer.Write(", \"");
                                                                        if (element3.InitialText != null)
                                                                        {
                                                                            writer.Write(element3.InitialText.Replace("\"", "\\\""));
                                                                        }
                                                                        writer.WriteLine("\");");
                                                                    }
                                                                    else
                                                                    {
                                                                        GumpStudio.Elements.TiledElement element5 = element as GumpStudio.Elements.TiledElement;
                                                                        if (element5 != null)
                                                                        {
                                                                            writer.Write("\n\t\t$this->addBackground(");
                                                                            writer.Write(element5.X);
                                                                            writer.Write(", ");
                                                                            writer.Write(element5.Y);
                                                                            writer.Write(", ");
                                                                            writer.Write(element5.Width);
                                                                            writer.Write(", ");
                                                                            writer.Write(element5.Height);
                                                                            writer.Write(", ");
                                                                            writer.Write(element5.GumpID);
                                                                            writer.Write(", ");
                                                                            writer.Write(element5.Hue.Index);
                                                                            writer.WriteLine(");");
                                                                        }
                                                                        else
                                                                        {
                                                                            GumpStudio.Elements.HTMLElement element13 = element as GumpStudio.Elements.HTMLElement;
                                                                            if (element13 != null)
                                                                            {
                                                                                writer.Write("\n\t\t$this->addHtmlGump(" + element13.X + ", " + element13.Y + ", " + element13.Width + ", " + element13.Height + ", \"" + element13.HTML + "\", " + element13.ShowBackground + ", " + element13.ShowScrollbar + ");");
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    num2++;
                                }while (num2 < elementsRecursive.Count);
                            }
                        }
                        writer.WriteLine("");
                        num++;
                        pageIndex++;
                    }while (num < this.designer.Stacks.Count);
                }
                writer.WriteLine("\t}\n}");
                writer.Close();
            }
        }
Esempio n. 4
0
 public void RemoveEvents(BaseElement Element)
 {
     Element.UpdateParent -= RaiseUpdateEvent;
     Element.Repaint      -= RaiseRepaintEvent;
 }
Esempio n. 5
0
        public void RemoveElement(BaseElement e)
        {
            _Elements.Remove(e);

            RemoveEvents(e);
        }
Esempio n. 6
0
 public void AttachEvents(BaseElement Element)
 {
     Element.UpdateParent += RaiseUpdateEvent;
     Element.Repaint      += RaiseRepaintEvent;
 }
Esempio n. 7
0
 public void RemoveEvents(BaseElement Element)
 {
     Element.UpdateParent -= new BaseElement.UpdateParentEventHandler(this.RaiseUpdateEvent);
     Element.Repaint      -= new BaseElement.RepaintEventHandler(this.RaiseRepaintEvent);
 }
Esempio n. 8
0
 public void RemoveElement(BaseElement e)
 {
     this.mElements.Remove(e);
     this.RemoveEvents(e);
 }
Esempio n. 9
0
 public void AttachEvents(BaseElement Element)
 {
     Element.UpdateParent += new BaseElement.UpdateParentEventHandler(this.RaiseUpdateEvent);
     Element.Repaint      += new BaseElement.RepaintEventHandler(this.RaiseRepaintEvent);
 }