예제 #1
0
 protected override void OnDragDropRelease(GameObject surface)
 {
     base.OnDragDropRelease(surface);
     if (surface != null)
     {
         if (surface.tag == Tags.item_grid)
         {
             if (surface == this.transform.parent)
             {
             }
             else
             {
                 InventoryItemgrid oldParent = this.transform.parent.GetComponent <InventoryItemgrid>();
                 this.transform.parent = surface.transform;
                 InventoryItemgrid newParent = surface.transform.GetComponent <InventoryItemgrid>();
                 newParent.SetId(oldParent.id, oldParent.num);
                 oldParent.ClearInfo();
             }
         }
         else if (surface.tag == Tags.item)
         {
             InventoryItemgrid grid1 = this.transform.parent.GetComponent <InventoryItemgrid>();
             InventoryItemgrid grid2 = surface.GetComponentInParent <InventoryItemgrid>();
             int id = grid1.id; int num = grid1.num;
             grid1.SetId(grid2.id, grid2.num);
             grid2.SetId(id, num);
         }
         if (surface.tag == Tags.shortCutItem && objectType == ObjectType.Drug)
         {
             ShortCutType type = ShortCutType.Drug;
             surface.transform.Find("icon").GetComponent <ShortCutItem>().SetItem(id, type);
         }
     }
     ResetPosition();
 }
예제 #2
0
파일: EIDrag.cs 프로젝트: pl369564/BOE
 protected override void OnDragDropRelease(GameObject surface)
 {
     base.OnDragDropRelease(surface);
     if (surface != null)
     {
         if (surface.tag == Tags.item_grid)
         {
             InventoryItemgrid grid = surface.transform.GetComponent <InventoryItemgrid>();
             if (grid != null)
             {
                 GameObject itemGo = NGUITools.AddChild(grid.gameObject, inventoryItem);
                 itemGo.transform.localPosition = Vector3.zero;
                 itemGo.GetComponentInParent <UISprite> ().depth = 4;
                 grid.SetId(ei.id, grid.num);
                 ei.id = 0;
                 EquipMentUI._instance.UpdateProperty();
                 GameObject.Destroy(this.gameObject);
             }
         }
         if (surface.tag == Tags.item)
         {
             print("item!");
             InventoryItem item = surface.GetComponent <InventoryItem>();
             if (item.objectType == ObjectType.Equip)
             {
                 print("Equip!");
                 if (item.dressType == ei.dressType)
                 {
                     print("DressType!");
                     InventoryItemgrid grid = surface.transform.GetComponentInParent <InventoryItemgrid>();
                     if (grid != null)
                     {
                         int count = 1;
                         int oldId = ei.id;
                         ei.SetId(grid.id);
                         grid.SetId(oldId, count);
                         EquipMentUI._instance.UpdateProperty();
                     }
                 }
             }
         }
     }
     ResetPosition();
 }
예제 #3
0
    public void GetId(int id, int count = 1)
    {
        InventoryItemgrid grid = null;
        ObjectsInfo       info = ObjectInfo._instance.GetOjectInfoById(id);

        foreach (InventoryItemgrid temp in itemGridList)
        {
            if (temp.id == id)
            {
                grid = temp;
                break;
            }
        }
        if (grid != null && info.type != ObjectType.Equip)
        {
            grid.PlusNumber(count);
        }
        else
        {
            foreach (InventoryItemgrid temp in itemGridList)
            {
                if (temp.id == 0)
                {
                    grid = temp;
                    break;
                }
                else
                {
                    grid = null;
                }
            }
            if (grid != null)
            {
                GameObject itemGo = NGUITools.AddChild(grid.gameObject, inventoryItem);
                itemGo.transform.localPosition = Vector3.zero;
                itemGo.GetComponentInParent <UISprite> ().depth = 4;
                grid.SetId(id, count);
            }
        }
    }
예제 #4
0
 void Update()
 {
     if (isHoving == true)
     {
         if (Input.GetMouseButtonDown(1))
         {
             if (objectType == ObjectType.Equip)
             {
                 bool isDress = EquipMentUI._instance.Dress(id, this.gameObject);
                 isExchange = EquipMentUI._instance.isExchange;
                 if (isExchange == true)
                 {
                     InventoryItemgrid grid = this.transform.parent.GetComponent <InventoryItemgrid>();
                     int num = 1;
                     grid.SetId(EquipMentUI._instance.oldId, num);
                     EquipMentUI._instance.isExchange = false;
                 }
                 if (isDress == false)
                 {
                     print("DressFalse");
                 }
                 else
                 {
                     EquipMentUI._instance.UpdateProperty();
                 }
             }
             if (objectType == ObjectType.Drug || objectType == ObjectType.Mat)
             {
                 int hp = ObjectInfo._instance.GetOjectInfoById(id).hp;
                 int mp = ObjectInfo._instance.GetOjectInfoById(id).mp;
                 pStatus.UseDrug(hp, mp);
                 HeadStatusUI._instance.OnUpdateShow();
                 int num = 1;
                 Inventory._instance.MinusItem(id, num);
             }
         }
     }
 }