Exemplo n.º 1
0
        private void addTopRowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (EquipmentGrid.GetFocusedRow() is EquipmentProfiles item)
                {
                    UnitOfWork unitOfWork = new UnitOfWork();
                    var        rowNumber  = item.RowNumber;
                    foreach (var i in unitOfWork.EquipmentProfilesRepo.Get(x => x.RefId == item.RefId && x.TableName == "TechSpecs" && x.RowNumber >= rowNumber))
                    {
                        var eq = unitOfWork.EquipmentProfilesRepo.Find(x => x.Id == i.Id);
                        eq.RowNumber = i.RowNumber + 1;
                        unitOfWork.Save();
                    }

                    unitOfWork = new UnitOfWork();
                    unitOfWork.EquipmentProfilesRepo.Insert(new EquipmentProfiles()
                    {
                        RefId = TechSpecsId, TableName = "TechSpecs", RowNumber = rowNumber, ParentItem = item.ParentItem
                    });
                    unitOfWork.Save();

                    this.EquipmentProfileBindingSource.DataSource = unitOfWork.EquipmentProfilesRepo.Get(m => m.RefId == TechSpecsId && m.TableName == "TechSpecs", orderBy: x => x.OrderBy(m => m.RowNumber));
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }
Exemplo n.º 2
0
        private void repositoryItemButtonEdit1_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (!User.UserInAction("Delete Tech Spec"))
            {
                return;
            }

            if (MessageBox.Show("Do you want to delete this", "Deleting", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                var eP = this.EquipmentGrid.GetFocusedRow() as EquipmentProfiles;
                if (eP == null || eP?.Id == null)
                {
                    return;
                }
                try
                {
                    unitOfWork.EquipmentProfilesRepo.Delete(m => m.Id == eP.Id && m.TableName == "TechSpecs");
                    unitOfWork.Save();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            EquipmentProfileBindingSource.DataSource =
                new UnitOfWork().EquipmentProfilesRepo.Get(m => m.RefId == TechSpecsId && m.TableName == "TechSpecs");
            EquipmentGrid.RefreshData();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 用于获取每个装备格子中的脚本
 /// </summary>
 private void getEquipmentGrid()
 {
     armorGrid     = armor.GetComponent <EquipmentGrid>();
     headgearGrid  = headgear.GetComponent <EquipmentGrid>();
     leftHandGrid  = leftHand.GetComponent <EquipmentGrid>();
     rightHandGrid = rightHand.GetComponent <EquipmentGrid>();
     shoeGrid      = shoe.GetComponent <EquipmentGrid>();
     accessoryGrid = accessory.GetComponent <EquipmentGrid>();
 }
Exemplo n.º 4
0
 private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (MessageBox.Show("Do you want to delete this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
     {
         return;
     }
     if (EquipmentGrid.GetFocusedRow() is EquipmentProfiles item)
     {
         var unitOfWork = new UnitOfWork();
         unitOfWork.EquipmentProfilesRepo.Delete(m => m.Id == item.Id && m.TableName == "Deliveries");
         unitOfWork.Save();
     }
 }
Exemplo n.º 5
0
    public void NodeClick(EquipmentGridType type,EquipmentGrid grid,MasterShop.param data)
    {
        CommonFile.push();
        if (type == EquipmentGridType.Category)
        {
			grid.ChangeGrid(EquipmentGridType.Item,this.type);
        }

        if (type == EquipmentGridType.Item)
        {
            int category = data.category;
            DialogCreater.CreateShopDialog(CanvasList.Get.GetCanvas(CanvasType.FrontCanvas).point.transform,
				data,()=> { SetEquipment((EquipmentType)data.category,data.res,data.GetColor(),data); });
			
        }

    }
Exemplo n.º 6
0
 private void Update()
 {
     if (tempTransform != null && Input.GetMouseButtonDown(1))
     {
         if (tempTransform.childCount != 0)
         {
             Destroy(tempTransform.GetChild(0).gameObject);
             EquipmentGrid temp     = tempTransform.gameObject.GetComponent <EquipmentGrid>();
             ObjectInfo    tempInfo = ObjectsInfo._instance.GetObjectInfoById(temp.id);
             Player_State._instancePlayerState.attack_plus -= tempInfo.attackValue;
             Player_State._instancePlayerState.def_plus    -= tempInfo.defValue;
             Player_State._instancePlayerState.speed_plus  -= tempInfo.speedValue;
             if (statusUI.activeInHierarchy == true)
             {
                 StatusUI._instanceStatus.UpdateStatus();
             }
             Bag._intanceBag.GetID(temp.id);
             temp.id       = 0;
             tempTransform = null;
         }
     }
 }
Exemplo n.º 7
0
 private void btnScan_Click(object sender, EventArgs e)
 {
     var relationCount = EquipmentGrid.GetRelationCount(0);
     var childView     = EquipmentGrid.GetDetailView(0, 0) as GridView;
     //        EquipmentGrid.ExpandMasterRow(0, 0);
 }
Exemplo n.º 8
0
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetMouseButtonDown(0))
        {
            GetOverUI(GameObject.Find("Canvas"));
        }
#endif
        if (IsPickedItem)
        {
            if (Input.GetMouseButton(0))
            {
                showItemUI.Show();
                showInfo.Hide();
                showItemUI.transform.position = Input.mousePosition;
            }
            if (Input.GetMouseButtonUp(0))
            {
                List <GameObject> objects = GetOverUI(GameObject.Find("Canvas"));
                for (int i = 0; i < objects.Count; i++)
                {
                    if (objects[i].name.Contains("Grid"))
                    {
                        //1,是玩家的装备格子
                        if (objects[i].name.Contains("EquipmentGrid"))
                        {
                            EquipmentGrid equipmentGrid = objects[i].GetComponent <EquipmentGrid>();
                            if (showItemUI.currentItem.itemType == ItemType.Weapon && equipmentGrid.equipmentType == EquipmentType.Weapon)
                            {
                                if (equipmentGrid.CurrentItem == null)
                                {
                                    equipmentGrid.AddItem(showItemUI.currentItem);
                                    equipmentGrid.CurrentItem = showItemUI.currentItem;
                                }
                                else//替换掉 替换掉,原来的装备放回背包
                                {
                                    Knapsack.Instance.AddItemToGrid(equipmentGrid.CurrentItem);
                                    equipmentGrid.RemoveItem(equipmentGrid.CurrentItem);
                                    equipmentGrid.AddItem(showItemUI.currentItem);
                                    equipmentGrid.CurrentItem = showItemUI.currentItem;
                                }
                            }
                            else if (showItemUI.currentItem.itemType == ItemType.Equipment && equipmentGrid.equipmentType == (showItemUI.currentItem as Equipment).equipmentType)
                            {
                                if (equipmentGrid.CurrentItem == null)
                                {
                                    equipmentGrid.AddItem(showItemUI.currentItem);
                                    equipmentGrid.CurrentItem = showItemUI.currentItem;
                                }
                                else //替换掉,原来的装备放回背包
                                {
                                    Knapsack.Instance.AddItemToGrid(equipmentGrid.CurrentItem);
                                    equipmentGrid.RemoveItem(equipmentGrid.CurrentItem);
                                    equipmentGrid.AddItem(showItemUI.currentItem);
                                    equipmentGrid.CurrentItem = showItemUI.currentItem;
                                }
                            }
                            else //放回原处
                            {
                                bePickGrid.AddItem(showItemUI.currentItem);
                            }
                        }
                        else
                        {
                            //2,不是玩家装备格子
                            Grid grid = objects[i].GetComponent <Grid>();
                            if (grid.IsEmpty)//格子为空时
                            {
                                grid.AddItem(showItemUI.currentItem);
                            }
                            else if (showItemUI.currentItem.id == grid.ItemStoredId && grid.CurrentStorageNum < grid.StorageSpaceMax)//格子中有物品但未达到该类物品的存储上限
                            {
                                grid.AddItem(showItemUI.currentItem);
                            }
                            else//格子中有物品且达到该类物品的存储上限
                            {
                                //回到背包TODO
                                bePickGrid.AddItem(showItemUI.currentItem);
                            }
                        }

                        break;
                    }
                    else
                    {
                        //出售掉装备 跟新玩家的金币数量
                        //TODO
                    }
                }

                IsPickedItem = false;
            }
        }
        else
        {
            showItemUI.Hide();
            BePickGrid = null;
        }
        if (IsPickedItem == false && IsShowItmInfo)
        {
            showInfo.SetPosition(Input.mousePosition);
        }
        else
        {
            showInfo.Hide();
        }
    }