Esempio n. 1
0
    public void UpdateSlot(string name, string avatarIcon)
    {
        skillBG.transform.localScale    = Vector3.one;
        skillIcon.transform.localScale  = Vector3.one;
        pinzhiIcon.transform.localScale = Vector3.one;

        // Vertical text, so don't use [#FFFFFFFF]
        if (string.IsNullOrEmpty(name))
        {
            nameText.transform.parent.localScale = Vector3.zero;
        }
        else
        {
            nameText.transform.parent.localScale = Vector3.one;
            int   rarityLevel = 3;
            Color col         = GUIFontColor.ConvertColor(PackageUnit.GetItemDataNameColor(rarityLevel));
            nameText.Text = name;
            nameText.SetColor(col);
        }

        string icon = avatarIcon.Replace("Avatar", "");

        icon = "Big" + icon;
        portaitIcon.PlayAnim(icon);
    }
    /// <summary>
    /// Updates the item data by data.LocationID
    /// </summary>
    /// <param name='type'>
    /// Type.
    /// </param>
    /// <param name='data'>
    /// Data with right locatioID
    /// </param>
    public void UpdateItemData(ItemSlotType type, ItemSlotData data)
    {
        List <ItemSlotData> tList = GetItemDataList(type);

        bool t_found = false;

        for (int i = 0; i < tList.Count; i++)
        {
            ItemSlotData item = tList[i];

            if (item.LocationID == data.LocationID)
            {
                tList[i] = data;
                t_found  = true;
                break;
            }
        }

        if (!t_found)
        {
            tList.Add(data);
        }

        PackageUnit.UpdatePackageList(type);
    }
    /// <summary>
    /// Adds the item data.
    /// </summary>
    /// <param name='type'>
    /// Type.
    /// </param>
    /// <param name='data'>
    /// Data.
    /// </param>
    public void AddItemData(ItemSlotType type, ItemSlotData data)
    {
        List <ItemSlotData> tList = GetItemDataList(type);

        tList.Add(data);

        PackageUnit.UpdatePackageList(data.SlotType);
    }
Esempio n. 4
0
        public ResourceId(PackageUnit package, string name)
        {
            Debug.AssertNotNull(package);
            Debug.AssertNotNull(name);

            Assembly     = package.Assembly;
            ResourceName = name;
        }
    /// <summary>
    /// Removes the item data.
    /// </summary>
    /// <param name='type'>
    /// Type.
    /// </param>
    /// <param name='locationID'>
    /// Location ID
    /// </param>
    public void RemoveItemData(ItemSlotType type, int locationID)
    {
        List <ItemSlotData> tList = GetItemDataList(type);

        foreach (ItemSlotData item in tList)
        {
            if (item.LocationID == locationID)
            {
                tList.Remove(item);
                PackageUnit.UpdatePackageList(type);
                break;
            }
        }
    }
 /// <summary>
 /// Removes the item data list.
 /// </summary>
 /// <param name='type'>
 /// Type.
 /// </param>
 public void RemoveItemDataList(ItemSlotType type)
 {
     GetItemDataList(type).Clear();
     PackageUnit.UpdatePackageList(type);
 }
 /// <summary>
 /// Removes the item data by the type and data LocationID
 /// </summary>
 /// <param name='type'>
 /// Type.
 /// </param>
 /// <param name='data'>
 /// Data.
 /// </param>
 public void RemoveItemData(ItemSlotType type, ItemSlotData data)
 {
     RemoveItemData(type, data.LocationID);
     PackageUnit.UpdatePackageList(data.SlotType);
 }
 public void Constructor()
 {
     PackageUnit Package  = new PackageUnit("Both");
     PackageUnit Krunched = new PackageUnit("KrunchPackage");
 }
Esempio n. 9
0
        private void FormBaseWarehouseModify_Load(object sender, EventArgs e)
        {
            if (this.mode == FormMode.ALTER && this.modifyID == -1)
            {
                throw new Exception("未设置源库存信息");
            }
            this.tableLayoutPanel1.Controls.Clear();
            if (this.setItem == WAREHOUSE_MODIFY)
            {
                for (int i = 1; i < BaseWarehouseMetaData.KeyNames.Length; i++)
                {
                    KeyName curKeyName = BaseWarehouseMetaData.KeyNames[i];
                    Label   label      = new Label();
                    label.Text = curKeyName.Name;
                    this.tableLayoutPanel1.Controls.Add(label);

                    TextBox textBox = new TextBox();
                    textBox.Name = "textBox" + curKeyName.Key;
                    this.tableLayoutPanel1.Controls.Add(textBox);
                }
                if (this.mode == FormMode.ALTER)
                {
                    try
                    {
                        Warehouse Warehouse = (from s in this.wmsEntities.Warehouse
                                               where s.ID == this.modifyID
                                               select s).Single();
                        Utilities.CopyPropertiesToTextBoxes(Warehouse, this);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("修改失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Close();
                        return;
                    }
                }
            }
            if (setItem == PackageUnit_MODIFY)
            {
                for (int i = 1; i < BasePackageUnitMetaData.KeyNames.Length; i++)
                {
                    KeyName curKeyName = BasePackageUnitMetaData.KeyNames[i];
                    Label   label      = new Label();
                    label.Text = curKeyName.Name;
                    this.tableLayoutPanel1.Controls.Add(label);

                    TextBox textBox = new TextBox();
                    textBox.Name = "textBox" + curKeyName.Key;
                    this.tableLayoutPanel1.Controls.Add(textBox);
                }
                if (this.mode == FormMode.ALTER)
                {
                    try
                    {
                        PackageUnit PackageUnit = (from s in this.wmsEntities.PackageUnit
                                                   where s.ID == this.modifyID
                                                   select s).Single();
                        Utilities.CopyPropertiesToTextBoxes(PackageUnit, this);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("修改失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Close();
                        return;
                    }
                }
            }
        }
Esempio n. 10
0
        private void buttonModify_Click(object sender, EventArgs e)
        {
            var textBoxName = this.Controls.Find("textBoxName", true)[0];

            if (textBoxName.Text == string.Empty)
            {
                MessageBox.Show("名称不能为空!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (setItem == WAREHOUSE_MODIFY)
            {
                Warehouse warehouse = null;

                //若修改,则查询原对象。若添加,则新建对象。
                if (this.mode == FormMode.ALTER)
                {
                    try
                    {
                        warehouse = (from s in this.wmsEntities.Warehouse
                                     where s.ID == this.modifyID
                                     select s).Single();
                    }
                    catch
                    {
                        MessageBox.Show("修改失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (warehouse == null)
                    {
                        MessageBox.Show("仓库不存在,请重新查询", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    try
                    {
                        var sameNameWarehouse = (from u in wmsEntities.Warehouse
                                                 where u.Name == textBoxName.Text &&
                                                 u.ID != warehouse.ID
                                                 select u).ToArray();
                        if (sameNameWarehouse.Length > 0)
                        {
                            MessageBox.Show("修改仓库名失败,已存在同名仓库:" + textBoxName.Text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    catch
                    {
                        MessageBox.Show("操作失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else if (mode == FormMode.ADD)
                {
                    try
                    {
                        var sameNameWarehouse = (from u in wmsEntities.Warehouse
                                                 where u.Name == textBoxName.Text
                                                 select u).ToArray();
                        if (sameNameWarehouse.Length > 0)
                        {
                            MessageBox.Show("修改仓库名失败,已存在同名仓库:" + textBoxName.Text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    catch
                    {
                        MessageBox.Show("操作失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    warehouse = new Warehouse();
                    this.wmsEntities.Warehouse.Add(warehouse);
                }
                //开始数据库操作
                if (Utilities.CopyTextBoxTextsToProperties(this, warehouse, BaseWarehouseMetaData.KeyNames, out string errorMessage) == false)
                {
                    MessageBox.Show(errorMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                try
                {
                    wmsEntities.SaveChanges();
                }
                catch (Exception)
                {
                    if (this.mode == FormMode.ALTER)
                    {
                        MessageBox.Show("修改失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else if (mode == FormMode.ADD)
                    {
                        MessageBox.Show("添加失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                //调用回调函数

                if (this.mode == FormMode.ALTER && this.modifyFinishedCallback != null)
                {
                    this.modifyFinishedCallback(warehouse.ID);
                    MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else if (this.mode == FormMode.ADD && this.addFinishedCallback != null)
                {
                    this.addFinishedCallback(warehouse.ID);
                    MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            if (setItem == PackageUnit_MODIFY)
            {
                PackageUnit packageUnit = null;

                //若修改,则查询原对象。若添加,则新建对象。
                if (this.mode == FormMode.ALTER)
                {
                    try
                    {
                        packageUnit = (from s in this.wmsEntities.PackageUnit
                                       where s.ID == this.modifyID
                                       select s).Single();
                    }
                    catch
                    {
                        MessageBox.Show("修改失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (packageUnit == null)
                    {
                        MessageBox.Show("包装信息不存在,请重新查询", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else if (mode == FormMode.ADD)
                {
                    packageUnit = new PackageUnit();
                    this.wmsEntities.PackageUnit.Add(packageUnit);
                }
                //开始数据库操作
                if (Utilities.CopyTextBoxTextsToProperties(this, packageUnit, BasePackageUnitMetaData.KeyNames, out string errorMessage) == false)
                {
                    MessageBox.Show(errorMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                try
                {
                    wmsEntities.SaveChanges();
                }
                catch (Exception)
                {
                    if (this.mode == FormMode.ALTER)
                    {
                        MessageBox.Show("修改失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else if (mode == FormMode.ADD)
                    {
                        MessageBox.Show("添加失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                //调用回调函数
                if (this.mode == FormMode.ALTER && this.modifyFinishedCallback != null)
                {
                    this.modifyFinishedCallback(packageUnit.ID);
                    MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else if (this.mode == FormMode.ADD && this.addFinishedCallback != null)
                {
                    this.addFinishedCallback(packageUnit.ID);
                    MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }