public void updateUI(EquipItem item)
        {
            txtName.Text  = item.Name;
            txtEquipCodes.Text  = item.ToString();
            cboEquipLevel.SelectedIndex = item.Level;
            cboEquipExt.SelectedIndex = item.Ext;
            chkEquipJN.Checked = item.JN;
            chkEquipXY.Checked = item.XY;
            chkEquipZY1.Checked = item.ZY1;
            chkEquipZY2.Checked = item.ZY2;
            chkEquipZY3.Checked = item.ZY3;
            chkEquipZY4.Checked = item.ZY4;
            chkEquipZY5.Checked = item.ZY5;
            chkEquipZY6.Checked = item.ZY6;
            //chkEquipSet.Checked = item.Set;

            int set = item.Set;

            if (set == 0)
                chkEquipSet.Checked = false;
            else
            {
                chkEquipSet.Checked = true;
                txtSet.Text = set.ToString();
            }

            txtDurability.Text = Convert.ToString(item.Durability);
            GetSocketVal(item.Socket1, ref comboSock1, ref numericSock1);
            GetSocketVal(item.Socket2, ref comboSock2, ref numericSock2);
            GetSocketVal(item.Socket3, ref comboSock3, ref numericSock3);
            GetSocketVal(item.Socket4, ref comboSock4, ref numericSock4);
            GetSocketVal(item.Socket5, ref comboSock5, ref numericSock5);
            //comboHarmony.SelectedIndex = (item.Harmony & 0xF0) >> 4;
        }
        protected static EquipItem createUnknownItem()
        {
            EquipItem item = new EquipItem();
            item.Name = EquipItem.UNKNOW_ITEM;
            item.hand = 1;
            item.profs = 0xFF;
            ResourceManager rmgr = new ResourceManager("zDBManager.Properties.Resources", Assembly.GetExecutingAssembly());
            item.Img = (Image)rmgr.GetObject(UNKNOW_ITEM);

            return item;
        }
        public void updateData(EquipItem item)
        {
            item.Level = (byte)(cboEquipLevel.SelectedIndex);
            item.Ext = cboEquipExt.SelectedIndex;
            item.JN = chkEquipJN.Checked;
            item.XY = chkEquipXY.Checked;
            item.ZY1 = chkEquipZY1.Checked;
            item.ZY2 = chkEquipZY2.Checked;
            item.ZY3 = chkEquipZY3.Checked;
            item.ZY4 = chkEquipZY4.Checked;
            item.ZY5 = chkEquipZY5.Checked;
            item.ZY6 = chkEquipZY6.Checked;
            //item.Set = chkEquipSet.Checked;

            if (chkEquipSet.Checked == false)
                item.Set = 0;
            else
            {
                item.Set = Convert.ToByte(txtSet.Text);
            }

            item.Durability = Convert.ToByte(txtDurability.Text);
            item.Socket1 = GetSocketNum(comboSock1, numericSock1.Value);
            item.Socket2 = GetSocketNum(comboSock2, numericSock2.Value);
            item.Socket3 = GetSocketNum(comboSock3, numericSock3.Value);
            item.Socket4 = GetSocketNum(comboSock4, numericSock4.Value);
            item.Socket5 = GetSocketNum(comboSock5, numericSock5.Value);

            item.Harmony = 0;
            if (comboHarmony.SelectedItem != null)
            {
                if (comboHarmony.SelectedIndex > 0)
                {
                    item.Harmony |= Convert.ToByte((comboHarmony.SelectedIndex) << 4);
                    item.Harmony |= Convert.ToByte(item.Level & 0x0F);
                }
            }
        }
示例#4
0
        public void updateUI(EquipItem item)
        {
            txtName.Text                = item.Name;
            txtEquipCodes.Text          = item.ToString();
            cboEquipLevel.SelectedIndex = item.Level;
            cboEquipExt.SelectedIndex   = item.Ext;
            chkEquipJN.Checked          = item.JN;
            chkEquipXY.Checked          = item.XY;
            chkEquipZY1.Checked         = item.ZY1;
            chkEquipZY2.Checked         = item.ZY2;
            chkEquipZY3.Checked         = item.ZY3;
            chkEquipZY4.Checked         = item.ZY4;
            chkEquipZY5.Checked         = item.ZY5;
            chkEquipZY6.Checked         = item.ZY6;
            //chkEquipSet.Checked = item.Set;

            int set = item.Set;

            if (set == 0)
            {
                chkEquipSet.Checked = false;
            }
            else
            {
                chkEquipSet.Checked = true;
                txtSet.Text         = set.ToString();
            }

            txtDurability.Text = Convert.ToString(item.Durability);
            GetSocketVal(item.Socket1, ref comboSock1, ref numericSock1);
            GetSocketVal(item.Socket2, ref comboSock2, ref numericSock2);
            GetSocketVal(item.Socket3, ref comboSock3, ref numericSock3);
            GetSocketVal(item.Socket4, ref comboSock4, ref numericSock4);
            GetSocketVal(item.Socket5, ref comboSock5, ref numericSock5);
            //comboHarmony.SelectedIndex = (item.Harmony & 0xF0) >> 4;
        }
示例#5
0
        public bool tryPutItem(EquipItem item, int x, int y, bool[,] flags)
        {
            if (item.Width + x > xnum || item.Height + y > ynum || x < 0 || y < 0)
                return false;
            if (flags[x, y]) return false;

            for (int i = 0; i < item.Width; i++)
            {
                for (int j = 0; j < item.Height; j++)
                {
                    if (!flags[i + x, j + y])
                        flags[i + x, j + y] = true;
                    else
                        return false;
                }
            }
            return true;
        }
示例#6
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     item = null;
 }
示例#7
0
 public DrawingUnit(EquipItem item, int x, int y)
 {
     this.item = item;
     this.x = x;
     this.y = y;
 }
示例#8
0
        public bool putItems(EquipItem[] items)
        {
            bool isPut = true;
            if (canPutItems(items))
            {
                for (int i = 0; i < items.Length ; i ++)
                {
                    if (null == items[i])
                        continue;
                    isPut = isPut && putItem (items[i], true);
                }
                return isPut;
            }

            return false;
        }
        private void EquipPanel_Paint(object sender, PaintEventArgs e)
        {
            if (units == null)
            {
                return;
            }
            //
            Graphics g = e.Graphics;

            DrawingUnit unit = null;
            EquipItem   item = null;
            int         x = 0, y = 0;

            for (int i = 0; i < xnum; i++)
            {
                for (int j = 0; j < ynum; j++)
                {
                    if ((unit = units[i, j]) != null && unit.Item != null)
                    {
                        drawUnit(g, units[i, j]);
                    }
                }
            }

            if (null != selectedUnit && null != selectedUnit.Item)
            {
                Brush brush = new SolidBrush(Color.FromArgb(60, 128, 128, 128));
                g.FillRectangle(brush, selectedUnit.X * pixels, selectedUnit.Y * pixels, selectedUnit.Item.Width * pixels, selectedUnit.Item.Height * pixels);
            }

            if (null != activeUnit && null != activeUnit.Item)
            {
                item = activeUnit.Item;
                x    = activeUnit.X; y = activeUnit.Y;
                g.DrawImage(item.Img, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
                if (canPutItem(activeUnit))
                {
                    g.DrawRectangle(Pens.Blue, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
                }
                else
                {
                    g.DrawRectangle(Pens.Red, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
                }
            }

            if (coveredUnit != null && coveredUnit.Item != null)
            {
                item = coveredUnit.Item;
                x    = coveredUnit.X; y = coveredUnit.Y;
                g.DrawRectangle(Pens.Blue, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
            }

            if (activeUnit == null && coveredUnit == null && selectedUnit == null && curUnit != null && curUnit.Item != null)
            {
                item = curUnit.Item;
                x    = curUnit.X; y = curUnit.Y;
                g.DrawImage(item.Img, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
                if (canPutItem(curUnit))
                {
                    g.DrawRectangle(Pens.Blue, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
                }
                else
                {
                    g.DrawRectangle(Pens.Red, x * pixels, y * pixels, item.Width * pixels, item.Height * pixels);
                }
            }
        }
示例#10
0
        public bool putItem(EquipItem item, bool add)
        {
            DrawingUnit unit = null;
            if (add)
            {
                unit = new DrawingUnit(new EquipItem(), 0, 0);
                unit.Item.assign(item);
            }
            else
            {
                unit = new DrawingUnit(item, 0, 0);
            }

            for (int j = 0; j < ynum; j++)
            {
                for (int i = 0; i < xnum; i++)
                {
                    if (!flags[i, j])
                    {
                        unit.X = i; unit.Y = j;
                        if (canPutItem(unit))
                        {
                            return putItem(unit, false);
                        }
                    }
                }
            }

            return false;
        }
示例#11
0
        public EquipItem(EquipItem baseItem, byte[] codes, int offset, int len)
        {
            this.xnum = baseItem.xnum;
            this.ynum = baseItem.ynum;
            this.name = baseItem.name;
            this.hand = baseItem.hand;
            this.profs = baseItem.profs; // 1234 5678 1234 5678 1234 5678 1234  //
            this.img = baseItem.img;

            Array.Copy(codes, offset, this.codes, 0, len);
        }
示例#12
0
        public static EquipItem createItem(byte code, byte type)
        {
            string codeType = getItemCodeType(code, type);

            EquipItem item = null;

            for (Int32 i = 0; i < EquipItemInfo.g_ItemInfo.m_ItemInfo.Count; i++)
            {
                if (getItemCodeType(EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Number) == codeType)
                {
                    item = new EquipItem(Int32.Parse(EquipItem.getItemCodeType(EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Number)),
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Name,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].HandFlag,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Width,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Height, 0);
                    item.Img = EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Photo;
                    break;
                }
            }

               // EquipItem item = EquipImageCache.Instance.getItemByCodeType(codeType);
               return new EquipItem(item);
               // return null;
        }
示例#13
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (null != item)
         updateData(item);
     item = null;
     this.Close();
 }
示例#14
0
        public EquipItem(EquipItem baseItem)
        {
            this.xnum = baseItem.xnum;
            this.ynum = baseItem.ynum;
            this.name = baseItem.name;
            this.hand = baseItem.hand;
            this.profs = baseItem.profs; // 1234 5678 1234 5678 1234 5678 1234  //

            this.img = baseItem.img;
        }
示例#15
0
 public EquipProperty(EquipItem item)
 {
     InitializeComponent();
     this.item = item;
 }
示例#16
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     item = null;
 }
 public DrawingUnit(EquipItem item)
 {
     this.item = item;
 }
 public DrawingUnit(EquipItem item, int x, int y)
 {
     this.item = item;
     this.x    = x;
     this.y    = y;
 }
 public void assign(DrawingUnit unit)
 {
     x    = unit.X;
     y    = unit.Y;
     item = unit.Item;
 }
示例#20
0
 public EquipProperty(EquipItem item)
 {
     InitializeComponent();
     this.item = item;
 }
        private void cboEquipName_TextChanged(object sender, EventArgs e)
        {
            string itemName = cboEquipName.Text;
            if (null == itemName || "" == itemName.Trim())
            {
                return;
            }

            EquipItem item = null;

            for (Int32 i = 0; i < EquipItemInfo.g_ItemInfo.m_ItemInfo.Count; i++)
            {
                if (EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category == (cboEquipType.Items[cboEquipType.SelectedIndex] as EquipItemType).TypeId
                    && EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Number == (cboEquipName.Items[cboEquipName.SelectedIndex] as Character.ComboboxItem).Value)
                {
                    item = new EquipItem(Int32.Parse(EquipItem.getItemCodeType(EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Number)), itemName,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].HandFlag, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Width, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Height, 0);
                    item.Img = EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Photo;
                    break;
                }
            }

            
                
           //     EquipImageCache.Instance.getItem(cboEquipName.Text);
            
            if (null != item)
            {

                if (editItem == null)
                    editItem = new EquipItem(); 
                
                editItem.assign(item);
           }
        }
示例#22
0
        public EquipItem(EquipItem baseItem, byte[] codes)
        {
            this.xnum = baseItem.xnum;
            this.ynum = baseItem.ynum;
            this.name = baseItem.name;
            this.hand = baseItem.hand;
            this.profs = baseItem.profs; // 1234 5678 1234 5678 1234 5678 1234  //
            this.img = baseItem.img;

            codes.CopyTo(this.codes, 0);
        }
示例#23
0
 public void assign(DrawingUnit unit)
 {
     x = unit.X;
     y = unit.Y;
     item = unit.Item;
 }
示例#24
0
        public static EquipItem createItem(byte[] codes, int offset, int len)
        {
            if (offset < 0 || len <= 0 || (offset + len > codes.Length) || codes[offset] == 0xFF)
            {
                return null;
            }

            string codeType = getItemCodeType(codes, offset, len);

            EquipItem item = null;

            for (Int32 i = 0; i < EquipItemInfo.g_ItemInfo.m_ItemInfo.Count; i++)
            {
                if (getItemCodeType(EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Number) == codeType)
                {
                    item = new EquipItem(Int32.Parse(EquipItem.getItemCodeType(EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category, EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Number)),
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Name,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].HandFlag,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Category,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Width,
                        EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Height, 0);
                    item.Img = EquipItemInfo.g_ItemInfo.m_ItemInfo[i].Photo;
                    break;
                }
            }

            //EquipItem item = EquipImageCache.Instance.getItemByCodeType(codeType);
            return new EquipItem(item, codes, offset, len);
        }
示例#25
0
        public bool canPutItems(EquipItem[] items)
        {
            bool[,] curflags = (bool[,])flags.Clone();

            foreach (EquipItem item in items)
            {
                if (null == item)
                    continue;

                for (int j = 0; j < ynum; j++)
                {
                    for (int i = 0; i < xnum; i++)
                    {
                        if (!curflags[i, j] && canPutItem (item, i, j, curflags ) && tryPutItem(item, i, j, curflags))
                        {
                            goto NextItem;
                        }
                    }
                }
                return false;
            NextItem: ;
            }
            return true;
        }
示例#26
0
        public EquipItem assign(EquipItem other)
        {
            other.codes.CopyTo(this.codes, 0);

            this.xnum = other.xnum;
            this.ynum = other.ynum;
            this.name = other.name;
            this.hand = other.hand;
            this.profs = other.profs; // 1 2 3 4 5 6 7
            this.img = other.img;

            return this;
        }
示例#27
0
 public DrawingUnit(EquipItem item)
 {
     this.item = item;
 }