Exemplo n.º 1
0
 public void ReloadExporer()
 {
     foreach (Control c in tabPageExplorer.Controls)
     {
         c.Dispose();
     }
     tabPageExplorer.Controls.Clear();
     foreach (Control _c in panelDesktop.Controls)
     {
         if (_c.GetType() == typeof(Label) || _c.GetType() == typeof(InnerHeader))
         {
             continue;
         }
         InnerControl c = (InnerControl)_c;
         if (c.hidden)
         {
             continue;
         }
         Label textBox = new Label();
         textBox.Location  = new Point(15, tabPageExplorer.Controls.Count * 20);
         textBox.Text      = c.elementName;
         textBox.Click    += TextBox_Click; //Выбор объекта на рабочем столе
         textBox.AutoSize  = true;
         textBox.BackColor = tabPageExplorer.BackColor;
         tabPageExplorer.Controls.Add(textBox);
     }
     changed = true;
 }
Exemplo n.º 2
0
        private void PanelDesktop_Click(object sender, EventArgs e)
        {
            InnerControl innerControl = activeElement;

            if (innerControl != null)
            {
                innerControl.DeselectControl();
            }
        }
Exemplo n.º 3
0
 internal void ColorAllToPanelColor()
 {
     foreach (Control c in panelDesktop.Controls)
     {
         if (c.GetType() == typeof(Label) || c.GetType() == typeof(InnerHeader))
         {
             continue;
         }
         InnerControl innerControl = (InnerControl)c;
         if (innerControl.hidden || innerControl.constant)
         {
             continue;
         }
         innerControl.ColorImagesToPanelColor();
     }
 }
Exemplo n.º 4
0
        private void TextBox_Click(object sender, EventArgs e)
        {
            Label textBox = (Label)sender;

            foreach (Control _c in panelDesktop.Controls)
            {
                if (_c.GetType() == typeof(Label) || _c.GetType() == typeof(InnerHeader))
                {
                    continue;
                }
                InnerControl c = (InnerControl)_c;
                if (c.elementName == textBox.Text)
                {
                    c.SelectControl();
                }
            }
        }
Exemplo n.º 5
0
 internal void RemoveInventorySlots()
 {
     for (int i = 0; i < panelDesktop.Controls.Count; i++)
     {
         Control c = panelDesktop.Controls[i];
         if (c.GetType() == typeof(Label) || c.GetType() == typeof(InnerHeader))
         {
             continue;
         }
         InnerControl _c = (InnerControl)c;
         if (_c.elementName.Contains("__invslot"))
         {
             panelDesktop.Controls[i].Dispose();
             i--;
         }
     }
     inventoryDrawed = false;
 }
Exemplo n.º 6
0
 private void ClearWorkscreen()
 {
     for (int i = 0; i < panelDesktop.Controls.Count; i++)
     {
         Control _c = panelDesktop.Controls[i];
         if (_c.GetType() == typeof(Label) || _c.GetType() == typeof(InnerHeader))
         {
             continue;
         }
         InnerControl c = (InnerControl)_c;
         if (c.constant)
         {
             continue;
         }
         c.Remove();
         i--;
     }
 }
Exemplo n.º 7
0
        private void SwitchHeaderOnly()
        {
            innerHeader.Visible = !innerHeader.Visible;
            if (inventoryDrawed)
            {
                switch (innerHeader.Visible)
                {
                case true:

                    for (int i = 0; i < panelDesktop.Controls.Count; i++)
                    {
                        Control c = panelDesktop.Controls[i];
                        if (c.GetType() == typeof(Label) || c.GetType() == typeof(InnerHeader))
                        {
                            continue;
                        }
                        InnerControl _c = (InnerControl)c;
                        if (_c.elementName.Contains("__invslot"))
                        {
                            _c.Location = new Point(_c.Location.X, _c.Location.Y + 40);
                        }
                    }
                    break;

                case false:
                    for (int i = 0; i < panelDesktop.Controls.Count; i++)
                    {
                        Control c = panelDesktop.Controls[i];
                        if (c.GetType() == typeof(Label) || c.GetType() == typeof(InnerHeader))
                        {
                            continue;
                        }
                        InnerControl _c = (InnerControl)c;
                        if (_c.elementName.Contains("__invslot"))
                        {
                            _c.Location = new Point(_c.Location.X, _c.Location.Y - 40);
                        }
                    }
                    break;
                }
            }
        }
Exemplo n.º 8
0
        private void CloneActiveElement()
        {
            if (tabControl1.SelectedIndex < 0)
            {
                return;
            }
            InnerTabPage innerTabPage = GetActivePage();

            if (innerTabPage.activeElement == null)
            {
                return;
            }
            try
            {
                InnerControl copy = innerTabPage.activeElement.MakeCopy();
                innerTabPage.AddElement(copy);
                copy.BringToFront();
            } catch (ArgumentOutOfRangeException)
            {
            }
        }
Exemplo n.º 9
0
        internal void ApplyChanges(int type, object value)
        {
            /*
             * Типы изменений:
             * 1 - удаление
             * 2 - высота
             * 3 - цвет
             * 4 - Глобальный масштаб
             * 5 - Заголовок
             * 6 - Инвентарь
             */
            switch (type)
            {
            case 1:
                InnerControl copy = (InnerControl)value;
                AddElement(copy);
                copy.BringToFront();
                break;

            case 2:
                label.Top = (int)value;
                break;

            case 3:
                panelDesktop.BackColor = (Color)value;
                break;

            case 4:
                globalScale = (float)value;
                break;

            case 5:
                SwitchHeaderOnly();
                break;

            case 6:
                SwitchInventorySlotsOnly();
                break;
            }
        }
Exemplo n.º 10
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (constant)
     {
         return;
     }
     foreach (Control _c in parentTabPage.GetDesktopPanel().Controls)
     {
         if (_c.GetType() == typeof(Label) || _c.GetType() == typeof(InnerHeader))
         {
             continue;
         }
         InnerControl c = (InnerControl)_c;
         if (c.elementName == elementName)
         {
             parentTabPage.GetDesktopPanel().Controls.Remove(_c);
             break;
         }
     }
     parentTabPage.ReloadExporer();
     this.Dispose();
 }
Exemplo n.º 11
0
 internal void AddElement(InnerControl copy)
 {
     panelDesktop.Controls.Add(copy);
 }
Exemplo n.º 12
0
        internal void Save(string filename)
        {
            string standart   = "{\nstandart: \n{";
            string headerText = parentTabPage.innerHeader.GetText();

            if (headerText != "")
            {
                standart += "\n\t\theader: \n\t\t{ \n\t\t\ttext: { text: \"" + headerText.Replace("\t", "").Replace("\n", "") + "\"},";
                if (!parentTabPage.innerHeader.GetButtonVisibility())
                {
                    standart += "\n\t\t\thideButton: false,";
                }
                standart += "\n\t\t},";
            }
            if (parentTabPage.inventoryDrawed)
            {
                standart += "\n\t\tinventory: { standart: true},";
            }
            standart += "\n\t\tbackground: ";
            if (parentTabPage.GetDesktopPanel().BackgroundImage != null)
            {
                standart += "{bitmap: \"" + parentTabPage.BackgroundImageName + "\"}";
            }
            else
            {
                Color bg_color = parentTabPage.GetDesktopPanel().BackColor;
                if (bg_color == Color.FromArgb(114, 106, 112))
                {
                    standart += "{standart: true}";
                }
                else
                {
                    standart += "{android.graphics.Color.rgb(" + bg_color.R + ',' + bg_color.G + ',' + bg_color.B + ")}";
                }
            }

            standart += "\n\t\tminHeight: " + parentTabPage.MaxY() + ",";

            standart += "\n},\n";

            string _params = "params: \n{";

            if (!this._params.IsSlotDefault())
            {
                _params += "\n\t\tslot: \"" + this._params.slotImageName.Replace(".png", "") + "\",";
            }

            if (!this._params.IsInvSlotDefault())
            {
                _params += "\n\t\tinvSlot: \"" + this._params.invSlotImageName.Replace(".png", "") + "\",";
            }

            if (!this._params.IsSelectionDefault())
            {
                _params += "\n\t\tselection: \"" + this._params.selectionImageName.Replace(".png", "") + "\",";
            }

            if (!this._params.IsCloseButtonDefault())
            {
                _params += "\n\t\tcloseButton: \"" + this._params.closeButtonImageName.Replace(".png", "") + "\",";
            }

            if (!this._params.IsCloseButton2Default())
            {
                _params += "\n\t\tcloseButton: \"" + this._params.closeButton2ImageName.Replace(".png", "") + "\",";
            }

            _params += "\n},\n";

            string drawing = "drawing: \n[";

            foreach (Control _c in parentTabPage.GetDesktopPanel().Controls)
            {
                if (_c.GetType() != typeof(InnerBitmap))
                {
                    continue;
                }
                InnerBitmap c = (InnerBitmap)_c;
                drawing += c.MakeOutput() + ',';
            }
            drawing += "\n],\n";

            string elements = "elements: \n{";

            foreach (Control _c in parentTabPage.GetDesktopPanel().Controls)
            {
                if (_c.GetType() == typeof(Label) || _c.GetType() == typeof(InnerHeader) || _c.GetType() == typeof(InnerBitmap))
                {
                    continue;
                }
                InnerControl c = (InnerControl)_c;
                if (c.hidden)
                {
                    continue;
                }
                elements += c.MakeOutput() + ',';
            }

            elements += "\n}";

            File.WriteAllText(filename, standart + _params + drawing + elements);
        }
Exemplo n.º 13
0
        private static void MoveControl(object container, MouseEventArgs e)
        {
            InnerControl obj = (InnerControl)container;

            if (obj.hidden || obj.constant)
            {
                return;
            }
            if (!moving && !scaling)
            {
                UpdateMousePosition(obj, e.Location);
                UpdateCursor(obj);
            }
            else if (moving)
            {
                Console.WriteLine(parent.aligment);
                int x    = (e.X - cursorOrigin.X) + obj.Left;
                int y    = (e.Y - cursorOrigin.Y) + obj.Top;
                int _x   = parent.GetDesktopPanel().AutoScrollPosition.X;
                int _y   = parent.GetDesktopPanel().AutoScrollPosition.Y;
                int maxx = parent.MaxX();
                int maxy = parent.MaxY();
                if (x + obj.Width > maxx || x - _x < 0)
                {
                    return;
                }
                if (y + obj.Height > maxy || y - _y < 0)
                {
                    return;
                }
                if (parent.aligment)
                {
                    controlAligment.TryToMove(obj, new Point(x, y));
                }
                else
                {
                    obj.Location = new Point(x, y);
                }
            }
            else if (scaling)
            {
                if (leftEdge)
                {
                    if (upperEdge)
                    {
                        /*int x = obj.Location.X - cursorOrigin.X + e.X;
                         * if (x < 0 || x > parent.X - obj.Size.Width)return;
                         * int y = obj.Location.Y - cursorOrigin.X + e.X;
                         * if (y < 0 || y > parent.Y - obj.Size.Y)return;
                         * obj.Location = new Point(x, y);
                         * obj.ResizeControl(obj.Width + cursorOrigin.X - e.X);*/
                    }
                    else if (bottomEdge)
                    {
                        /*int x = obj.Location.X - cursorOrigin.X + e.X;
                         * if (x < 0 || x > parent.X - obj.Size.Width) return;
                         * int y = obj.Location.Y;
                         * obj.Location = new Point(x, y);
                         * obj.ResizeControl(obj.Width + cursorOrigin.X - e.X);*/
                    }
                    else
                    {
                        //Не нужен
                    }
                }
                else if (rightEdge)
                {
                    if (upperEdge)
                    {
                        /*int x = obj.Location.X;
                         * int y = obj.Location.Y - cursorOrigin.Y + e.Y;
                         * if (y < 0 || y > parent.Y - obj.Size.Width) return;
                         * obj.Location = new Point(x, y);
                         * obj.ResizeControl(obj.Height + cursorOrigin.Y - e.Y);*/
                    }
                    else if (bottomEdge)
                    {
                        if (cursorLastPos != e.Location)
                        {
                            int x = e.X - cursorOrigin.X + startSize.Width;
                            int y = e.Y - cursorOrigin.Y + startSize.Height;
                            //Console.WriteLine("{0} - {1}", x, y);
                            obj.ResizeControl(longestSide, longestSide == 'x' ?x: y);
                            cursorLastPos = e.Location;
                        }
                    }
                    else
                    {
                        //Не нужен
                    }
                }
                else if (upperEdge || bottomEdge)
                {
                    //Не нужен
                }
                else
                {
                }
            }
        }