Пример #1
0
 /// <summary>
 /// Função para dropar o item para o mundo com possibilidade de escolher a quantidade
 /// Recebe como parametro o Item de drag e drop por conta do seu link visual e de Data
 /// </summary>
 /// <param name="itemOnSlot"></param>
 /// <param name="dropCount"></param>
 public void DropItem(ItemDrag itemOnSlot, int dropCount)
 {
     // Se o drop requisitado for mais do que possui ele irá dropar tudo e zerar o Item de drag e drop
     if (itemOnSlot.itemData.itemCount < dropCount)
     {
         itemOnSlot.itemData = null;
         // TODO: Criar uma desativação no Item que não tem mais Data
         Debug.Log("Dropped to World By max amount reachead");
         // Adicionar linha para transferir o item para o mundo
     }
     else
     {
         // Caso ele n seja maior ele irá descontar apena e dropar o item com a quantidade requisitada ao mundo
         itemOnSlot.itemData.itemCount -= dropCount;
         // Verifica se ele n requisitou o valor exato
         if (itemOnSlot.itemData.itemCount == 0)
         {
             // Anula o Data do Item de drag e drop
             itemOnSlot.itemData = null;
             // TODO: Criar uma desativação no Item que não tem mais Data
         }
         Debug.Log("Dropped to World By custom amount");
         // Adicionar linha para transferir o item para o mundo
     }
 }
Пример #2
0
    public void OnDrop(PointerEventData event_data)
    {
        if (!PlayerAction.can_act)
        {
            return;
        }

        Debug.Log("OnDrop");

        GameObject go = event_data.pointerDrag;

        Debug.Log(go.GetComponent <Item>().item_info.id);
        Debug.Log(item.item_info.id);
        int item1 = (int)item.item_info.id;
        int item2 = (int)go.GetComponent <Item>().item_info.id;

        int result_item = Mathf.Max(ItemRecipes.getResultItem(item1, item2), ItemRecipes.getResultItem(item2, item1));

        if (result_item >= 0)
        {
            ItemDrag drag = event_data.pointerDrag.gameObject.GetComponent <ItemDrag>();
            drag.combine = true;
            PlayerAction.dragging_item = false;
            Destroy(drag.copy);

            ItemControl.instance.combineItems(gameObject, go, result_item);
            ItemControl.instance.enableButtons(true);
        }
    }
Пример #3
0
    public void SetBagIconRef(int i)//捡取道具改变了Item类型时,也需要重新更改指向
    {
        GameObject BagIconFrameChild = BagIconFrame.transform.GetChild(i).gameObject;
        ItemDrag   BagIconDrag       = BagIconFrameChild.GetComponent <ItemDrag>();

        BagIconDrag.SetRef(_package.bag[i]);
    }
Пример #4
0
    /// <summary>
    /// Coroutine chamada para fazer o trabalho da função LinkItemToSlotAfterFrame após ter a UI atualizada
    /// </summary>
    /// <param name="item"></param>
    /// <returns></returns>
    IEnumerator CorrectOnFrame(ItemDrag item)
    {
        yield return(new WaitForEndOfFrame());

        LinkItemToSlotAfterFrame(item);
        //LinkItemFromChestToSlot(item);
        yield return(null);
    }
Пример #5
0
    public void onItemClick()
    {
        ItemDrag   itemDrag = gameObject.transform.Find("ItemImage").GetComponent <ItemDrag>();
        GameObject player   = GameObject.Find("Player");

        if (player == null)
        {
            Debug.Log("player null");
        }
        ItemBaseClass item = itemDrag.Item;

        Debug.Log("CLICK" + item);
        Debug.Log(item.Name + " equipped");
        if (item.name.Equals("Pistol"))
        {
            WeaponFire Wp = GameObject.Find("Player").GetComponentInChildren <WeaponFire>();
            if (Wp == null)
            {
                Debug.Log("weapon null");
            }
            else
            {
                Debug.Log("pistol equipped");
            }
            Wp.rateOfFire     = 0;
            Wp.damage         = 50;
            Wp.weaponEquipped = true;
        }
        if (item.name.Equals("MiniGun"))
        {
            WeaponFire Wp = GameObject.Find("Player").GetComponentInChildren <WeaponFire>();
            if (Wp == null)
            {
                Debug.Log("weapon null");
            }
            else
            {
                Debug.Log("minigun equipped");
            }
            Wp.rateOfFire     = 20;
            Wp.damage         = 5;
            Wp.weaponEquipped = true;
        }
        else
        {
            WeaponFire Wp = GameObject.Find("Player").GetComponentInChildren <WeaponFire>();
            if (Wp == null)
            {
                Debug.Log("weapon null");
            }
            Wp.weaponEquipped = false;
        }
        inventory.UseItem(item);
        //		item.OnUse();
    }
Пример #6
0
    public void SetQuickItemIconRef(int i)
    {
        GameObject QuickIconFrameChild = QuickItemIconFrame.transform.GetChild(i).gameObject;
        ItemDrag   QuickIconDrag       = QuickIconFrameChild.GetComponent <ItemDrag>();

        QuickIconDrag.SetRef(_package.quickItem[i]);
        GameObject QuickIconFrameChild2 = QuickItemIconFrame2.transform.GetChild(i).gameObject;
        ItemDrag   QuickIconDrag2       = QuickIconFrameChild2.GetComponent <ItemDrag>();

        QuickIconDrag2.SetRef(_package.quickItem[i]);
    }
Пример #7
0
 /// <summary>
 /// Faz a troca de items nos slots ATENÇÃO: ERROS SE FOR USADO EM UM ITEM QUE NÃO POSSUA UMA REFERENCIA DE ITEMSLOT
 /// </summary>
 /// <param name="itemToSwap"></param>
 private void SwapItemOnSlot(ItemDrag itemToSwap)
 {
     if (itemToSwap.GetSlot())
     {
         // Cria uma referencia temporario do slot que foi pego para trocar
         ItemSlot tempSlot = itemToSwap.GetSlot();
         // Força ele no seu slot antigo
         lastSlot.LinkItemToSlot(itemToSwap);
         // Se auto coloca no slot em que estava o item antigo
         tempSlot.LinkItemToSlot(this);
     }
 }
Пример #8
0
    private ItemSlot target;            //최종 걸리는 놈

    void Awake()
    {
        //sInstance 에 자신을 문다.
        sInstance = this;

        //Item UISprite 를 얻는다.
        this.itemImage =
            this.transform.FindChild("ItemImage").GetComponent<UISprite>();
        
        //비활성화로 시작한다.
        this.gameObject.SetActive(false);
    }
Пример #9
0
    private ItemSlot target;            //최종 걸리는 놈

    void Awake()
    {
        //sInstance 에 자신을 문다.
        sInstance = this;

        //Item UISprite 를 얻는다.
        this.itemImage =
            this.transform.FindChild("ItemImage").GetComponent <UISprite>();

        //비활성화로 시작한다.
        this.gameObject.SetActive(false);
    }
Пример #10
0
    //Checks and finds the item via image and component to then be used by the player.
    public void OnItemClicked()
    {
        ItemDrag dragHandler = gameObject.transform.Find("Image").GetComponent <ItemDrag>();

        TheInventoryItem item = dragHandler.Item;

        Debug.Log(item.Name);

        //Calls for the item to be used
        daInventory.UseItem(item);

        item.OnUse();
    }
Пример #11
0
 /// <summary>
 /// Função para procurar por um itemDrag vazio e setar os dados do itemSO nele e coloca no slot providenciado
 /// </summary>
 /// <param name="itemData"></param>
 /// <param name="slotToSet"></param>
 private void SetItemDragData(ItemSO itemData, ItemSlot slotToSet)
 {
     for (int i = 0; i < chestDragItemsList.Count; i++)
     {
         ItemDrag itemDrag = chestDragItemsList[i];
         if (!itemDrag.itemData)
         {
             itemDrag.itemData = itemData;
             slotToSet.LinkItemToSlot(itemDrag);
             return;
         }
     }
 }
Пример #12
0
 //public void SetWarehouseIconRef(int i)
 //{
 //    GameObject WarehouseIconFrameChild = Warehouse_Icon.transform.GetChild(i).gameObject;
 //    ItemDrag WarehouseconDrag = WarehouseIconFrameChild.GetComponent<ItemDrag>();
 //    WarehouseconDrag.SetRef(_package.quickItem[i]);
 //}
 public void FindWarehouse()
 {
     //Warehouse
     warehouse = FindObjectOfType <Warehouse>();
     if (warehouse != null)
     {
         for (int i = 0; i < 30; i++)
         {
             GameObject WarehouseIconFrameChild = Warehouse_Icon.transform.GetChild(0).GetChild(i).gameObject;
             ItemDrag   WarehouseIconDrag       = WarehouseIconFrameChild.GetComponent <ItemDrag>();
             WarehouseIconDrag.SetRef(warehouse.items[i]);
         }
     }
 }
Пример #13
0
 /// <summary>
 /// Função que atualzia o tamanho e a seta o itemDrag na posição do slot,
 /// aproveita e seta o sprite que tem e torna sua gameobject ativa
 /// </summary>
 /// <param name="item"></param>
 private void LinkItemToSlotAfterFrame(ItemDrag item)
 {
     item.SetSlot(this);
     item.transform.SetParent(this.transform);
     item.GetComponent <RectTransform>().sizeDelta = rectTransform.sizeDelta;
     if (item.transform.childCount > 0)
     {
         item.transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = rectTransform.sizeDelta;
     }
     item.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
     item.GetComponent <Image>().sprite = item.itemData.icon;
     item.itemSlot  = this;
     itemOnSlotData = item.itemData;
     item.gameObject.SetActive(true);
 }
Пример #14
0
    private void InventoryScript_ItemAdded(object sender, InventoryEventArgs e)
    {
        Transform inventoryPanel = transform.Find("InventoryPanel");
        int       counter        = -1;

        foreach (Transform slot in inventoryPanel)
        {
            counter++;
            Transform imageTransform = slot.GetChild(0).GetChild(0);               //sets imageTransform into image of slot
            Transform textTransform  = slot.GetChild(0).GetChild(1);
            Image     image          = imageTransform.GetComponent <Image> ();
            Text      textCount      = textTransform.GetComponent <Text> ();
            ItemDrag  itemDrag       = imageTransform.GetComponent <ItemDrag> ();

            if (counter == e.Item.Slot.Id)
            {
                image.enabled = true;
                image.sprite  = e.Item.Image;

                int itemCount = e.Item.Slot.Count;
                Debug.Log("ITEM COUNT" + itemCount);
                if (itemCount >= 1)
                {
                    textCount.text = itemCount.ToString();
                }
                else
                {
                    textCount.text = "";
                }

//				itemDrag.Item = e.Item;
                itemDrag.Item = (ItemBaseClass)e.Item;

                break;
            }

//			//finding empty slot
//			if(image.sprite == null){
//				image.enabled = true;
//				image.sprite = e.Item.Image;
//
//				//TODO: Store a reference to item
//				break;
//			}
        }
    }
Пример #15
0
 /// <summary>
 /// Chama a função para atualizar seu tamanho e posição do itemDrag
 /// </summary>
 /// <param name="item"></param>
 public void LinkItemToSlot(ItemDrag item)
 {
     //TODO: ACHAR SOLUCAO DO PQ O BAU NA PRIMEIRA ABRIDA NAO MOSTRA OS ITENS
     // Verifica se foi atualizado o seu tamanho do slot para ver se a UI foi atualizada
     isSlotUsed = true;
     if (rectTransform.sizeDelta != Vector2.zero)
     {
         LinkItemToSlotAfterFrame(item);
     }
     // Caso veja que não foi ele irá chamar uma Coroutine para esperar ele terminar o frame para atualizar
     else
     {
         if (this.gameObject.activeSelf)
         {
             StartCoroutine(CorrectOnFrame(item));
         }
     }
 }
Пример #16
0
    //Removes the item image from the inventory UI slot by grabbing the child of the image and finding the item
    private void InventoryItemRemove(object sender, InventoryEventArgs eventItem)
    {
        Transform inventoryPanel = transform.Find("Inventory");

        foreach (Transform slot in inventoryPanel.GetChild(0))
        {
            Image    image    = slot.GetChild(0).GetChild(0).GetComponent <Image>();
            ItemDrag itemDrag = slot.GetChild(0).GetChild(0).GetComponent <ItemDrag>();

            if (itemDrag.Item.Equals(eventItem.Item))
            {
                image.enabled = false;
                image.sprite  = null;
                itemDrag.Item = null;
                break;
            }
        }
    }
Пример #17
0
    void Inventory_ItemRemoved(object sender, InventoryEventArgs e)
    {
        Transform inventoryPanel = transform.Find("InventoryPanel");
        int       counter        = -1;

        foreach (Transform slot in inventoryPanel)
        {
            counter++;

            Transform imageTransform = slot.GetChild(0).GetChild(0);               //sets imageTransform into image of slot
            Transform textTransform  = slot.GetChild(0).GetChild(1);
            Image     image          = imageTransform.GetComponent <Image> ();
            Text      textCount      = textTransform.GetComponent <Text> ();
            ItemDrag  itemDrag       = imageTransform.GetComponent <ItemDrag> ();

            if (itemDrag.Item == null)
            {
                continue;
            }

            if (e.Item.Slot.Id == counter)
            {
                int itemCount = e.Item.Slot.Count;
//				itemDrag.Item = e.Item.Slot.FirstItem;
                itemDrag.Item = (ItemBaseClass)e.Item.Slot.FirstItem;

                if (itemCount < 2)
                {
                    textCount.text = "";
                }
                else
                {
                    textCount.text = itemCount.ToString();
                }

                if (itemCount == 0)
                {
                    image.enabled = false;
                    image.sprite  = null;
                }
                break;
            }
        }
    }
Пример #18
0
    private void OnDrawGizmos()
    {
        i_ItemCount = context.childCount;
        ItemDrag[] a_itemDragT = new ItemDrag[i_ItemCount];

        for (int i = 0; i < i_ItemCount; i++)
        {
            a_itemDragT[i] = context.GetChild(i).GetComponent <ItemDrag>();
        }
        Gizmos.color = Color.blue;


        float contextWidth = (f_ItemWidth + f_ItemSpace) * i_ItemCount / 2f;
        float PosX;
        float posXT;
        float localsXT;

        for (int i = 0; i < i_ItemCount; i++)
        {
            PosX     = ((float)i / (i_ItemCount)) * 2f - 1f;
            posXT    = (PosX + f_process + 1f) % 2f - 1f;
            localsXT = localScaleXYVaule.Evaluate(posXT) * f_ItemWidth;

            Vector2 anchored = new Vector2(contextWidth * posXT * positionXOff.Evaluate(posXT), contextWidth * positionYOff.Evaluate(posXT));
            if (!horizontal)
            {
                anchored = new Vector2(contextWidth * (1 - positionXOff.Evaluate(posXT)), contextWidth * posXT * (1 - positionYOff.Evaluate(posXT)));
            }
            Gizmos.DrawWireCube(context.TransformPoint(anchored), new Vector3(localsXT, localsXT, 0));
        }

        PosX  = ((float)(i_ItemCount / 2 - (i_ItemCount % 2 == 0 ? 1 : 0)) / i_ItemCount) * 2f - 1f;
        posXT = (PosX + f_ProMin + 1f) % 2f - 1f;
        Vector2 anchored2 = new Vector2(contextWidth * posXT * positionXOff.Evaluate(posXT), contextWidth * positionYOff.Evaluate(posXT));

        if (!horizontal)
        {
            anchored2 = new Vector2(contextWidth * (1 - positionXOff.Evaluate(posXT)), contextWidth * posXT * (1 - positionYOff.Evaluate(posXT)));
        }
        Gizmos.color = Color.yellow;
        Vector3 size = new Vector3(f_ItemWidth / (horizontal ? 1 : 0.2f), f_ItemWidth / (horizontal ? 0.2f : 1f), 0);

        Gizmos.DrawWireCube(context.TransformPoint(anchored2), size);
    }
Пример #19
0
    public void InitData()
    {
        i_ItemCount = context.childCount;
        a_itemDrag  = new ItemDrag[i_ItemCount];
        ItemDrag itemDragT = null;

        for (int i = 0; i < i_ItemCount; i++)
        {
            itemDragT = context.GetChild(i).GetComponent <ItemDrag>();
            float processT = Mathf.RoundToInt((((float)i / (i_ItemCount)) * 2f - 1f) * 100000f) / 100000f;
            itemDragT.SetData(processT, this);
            a_itemDrag[i] = itemDragT;
        }

        f_proMin        = Normal(1f / i_ItemCount);
        f_proMax        = 2 + f_proMin;
        f_targetProcess = f_process = Normal(f_proMin + _value * f_proMin * 2f);

        SetPositions(a_itemDrag);
    }
Пример #20
0
    void Inventory_ItemRemoved(object sender, InventoryEventArgs e)
    {
        Transform inventoryPanel = transform.Find("InventoryPanel");

        foreach (Transform slot in inventoryPanel)
        {
            Transform imageTransform = slot.GetChild(0).GetChild(0);
            Image     image          = imageTransform.GetComponent <Image>();
            ItemDrag  itemDrag       = imageTransform.GetComponent <ItemDrag>();

            // Find item in the UI
            if (itemDrag.Item.Equals(e.Item))
            {
                image.enabled = false;
                image.sprite  = null;
                itemDrag.Item = null;
                break;
            }
        }
    }
Пример #21
0
    //Grabs the image in the inventory UI created on the canvas then puts the item image of said image picked up into that slot.
    private void InventoryScriptItemAdd(object sender, InventoryEventArgs eventItem)
    {
        Transform inventoryPanel = transform.Find("Inventory");

        foreach (Transform slot in inventoryPanel.GetChild(0))
        {
            Image    image    = slot.GetChild(0).GetChild(0).GetComponent <Image>();
            ItemDrag itemDrag = slot.GetChild(0).GetChild(0).GetComponent <ItemDrag>();

            if (!image.enabled)
            {
                image.enabled = true;
                image.sprite  = eventItem.Item.Image;

                //Store refernce;
                itemDrag.Item = eventItem.Item;

                break;
            }
        }
    }
Пример #22
0
 public void FindShop()
 {
     //shop
     shop = FindObjectOfType <Shop>();
     if (shop != null)
     {
         for (int i = 0; i < 5; i++)
         {
             GameObject GoodsIconFrameChild = Shop_Icon.transform.GetChild(0).GetChild(i).gameObject;
             ItemDrag   GoodsIconDrag       = GoodsIconFrameChild.GetComponent <ItemDrag>();
             GoodsIconDrag.SetRef(shop.goodsItem[i]);
         }
         for (int i = 0; i < 10; i++)
         {
             GameObject ConsumeIconFrameChild = Shop_Icon.transform.GetChild(1).GetChild(i).gameObject;
             consumeIcon[i]     = ConsumeIconFrameChild.GetComponentInChildren <Image>();
             ConsumeIconDrag[i] = ConsumeIconFrameChild.GetComponent <ItemDrag>();
             ConsumeIconDrag[i].SetRef(shop.consume[i]);
         }
     }
 }
Пример #23
0
 public void Swap()
 {
     if (ItemTemp2 != null && ItemTemp1 != null && ItemTemp1.GetItemType() != ItemType.Item)
     {
         if (ItemTemp1 == package.weapon[0])
         {
             if (!(System.Convert.ToInt32(ItemTemp2.GetID()) > 20 && System.Convert.ToInt32(ItemTemp2.GetID()) <= 40) && ItemTemp2.GetItemType() != ItemType.Item)
             {
                 return;
             }
         }
         else if (ItemTemp1 == package.weapon[1])//如果是近程武器
         {
             if (!(System.Convert.ToInt32(ItemTemp2.GetID()) > 0 && System.Convert.ToInt32(ItemTemp2.GetID()) <= 20) && ItemTemp2.GetItemType() != ItemType.Item)
             {
                 return;
             }
         }
         if (ItemTemp2 == package.weapon[0])//如果替换到的目标是远程武器
         {
             if (!(System.Convert.ToInt32(ItemTemp1.GetID()) > 20 && System.Convert.ToInt32(ItemTemp1.GetID()) <= 40))
             {
                 return;
             }
         }
         else if (ItemTemp2 == package.weapon[1])//如果替换到的目标是近程武器
         {
             if (!(System.Convert.ToInt32(ItemTemp1.GetID()) > 0 && System.Convert.ToInt32(ItemTemp1.GetID()) <= 20))
             {
                 return;
             }
         }
         SwapClear();
     }
     ItemTemp1 = null; ItemTemp2 = null;
     if (ItemTemp1Drag != null && ItemTemp2Drag != null)
     {
         ItemTemp1Drag = null; ItemTemp2Drag = null;
     }
 }
Пример #24
0
    /// <summary>
    /// Função para procurar um itemDrag vazio e setar a referencia de item contido nele,
    /// </summary>
    /// <param name="itemData"></param>
    private void LinkNewItemOnEmptySlot(ItemSO itemData)
    {
        // Procura por um ItemDrag que não esteja em uso e setado em um slot do inventario
        for (int i = 0; i < itemDragOnInventory.Count; i++)
        {
            if (!FindAndMerge(itemData))
            {
                if (!itemDragOnInventory[i].itemData)
                {
                    // Se achar ele seta o item em questao e passa o icone nele
                    itemDragOnInventory[i].itemData = itemData;
                    itemDragOnInventory[i].transform.GetComponent <Image>().sprite = itemData.icon;
                    itemData.itemCount++;
                    itemDragOnInventory[i].transform.GetChild(0).GetComponent <Text>().text = itemData.itemCount.ToString();
                    // Procura por um slot vazio para ancorar/setar sua posição nele
                    for (int e = 0; e < itemSlotsList.Count; e++)
                    {
                        if (!itemSlotsList[e].isSlotUsed)
                        {
                            itemSlotsList[e].LinkItemToSlot(itemDragOnInventory[i]);

                            return;
                        }
                    }
                }
            }
            else
            {
                return;
            }
        }
        // Caso não encontre uma vaga ele irá chamar a função de drop
        ItemDrag excessToDrop = new ItemDrag();

        excessToDrop.itemData = itemData;
        DropItem(excessToDrop, excessToDrop.itemData.itemCount);
    }
Пример #25
0
    void InventoryScript_ItemAdded(object sender, InventoryEventArgs e)
    {
        Transform inventoryPanel = transform.Find("InventoryPanel");

        foreach (Transform slot in inventoryPanel)
        {
            // Border image
            Transform imageTransform = slot.GetChild(0).GetChild(0);
            Image     image          = slot.GetChild(0).GetChild(0).GetComponent <Image>();
            ItemDrag  itemDrag       = imageTransform.GetComponent <ItemDrag>();

            // There is an empty slot available
            if (!image.enabled)
            {
                image.enabled = true;
                image.sprite  = e.Item.Image;

                // Store a reference to the item
                itemDrag.Item = e.Item;

                break;
            }
        }
    }
Пример #26
0
 protected virtual void OnItemDrag(ListBoxItemEventArgs e)
 {
     ItemDrag?.Invoke(this, e);
 }
Пример #27
0
    public void Startup()
    {
        status = ManagerStatus.Started;

        _player  = MainGameManager.playerManager.player;
        _human   = MainGameManager.playerManager.human;
        _package = MainGameManager.playerManager.package;
        HP.text  = System.Convert.ToString(_human.HP);



        STR = InfoValue.transform.Find("STR").GetComponent <Text>();
        DEF = InfoValue.transform.Find("DEF").GetComponent <Text>();
        ATS = InfoValue.transform.Find("ATS").GetComponent <Text>();
        MOS = InfoValue.transform.Find("MOS").GetComponent <Text>();


        for (int i = 0; i < 10; i++)
        {
            GameObject BagIconFrameChild = BagIconFrame.transform.GetChild(i).gameObject;
            BagIcon[i] = BagIconFrameChild.GetComponentInChildren <Image>();

            ItemDrag BagIconDrag = BagIconFrameChild.GetComponent <ItemDrag>();
            BagIconDrag.SetRef(_package.bag[i]);

            BagNum[i] = BagNumFrame.transform.GetChild(i).GetComponentInChildren <Text>();
        }

        for (int i = 0; i < 4; i++)
        {
            GameObject QuickIconFrameChild = QuickItemIconFrame.transform.GetChild(i).gameObject;
            QuickItemIcon[i] = QuickIconFrameChild.GetComponentInChildren <Image>();

            ItemDrag QuickIconDrag = QuickIconFrameChild.GetComponent <ItemDrag>();
            QuickIconDrag.SetRef(_package.quickItem[i]);

            QuickItemNum[i] = QuickItemNumFrame.transform.GetChild(i).GetComponentInChildren <Text>();


            GameObject QuickIconFrameChild2 = QuickItemIconFrame2.transform.GetChild(i).gameObject;
            QuickItemIcon2[i] = QuickIconFrameChild2.GetComponentInChildren <Image>();
            ItemDrag QuickIconDrag2 = QuickIconFrameChild2.GetComponent <ItemDrag>();
            QuickIconDrag2.SetRef(_package.quickItem[i]);
            QuickItemNum2[i] = QuickItemNumFrame2.transform.GetChild(i).GetComponentInChildren <Text>();
        }

        leftWeaponIcon = GameObject.Find("leftWeaponIcon_Package").GetComponent <Image>();
        ItemDrag leftWeaponIconDrag = leftWeaponIcon.transform.parent.GetComponent <ItemDrag>();

        leftWeaponIconDrag.SetRef(_package.weapon[1]);
        rightWeaponIcon = GameObject.Find("rightWeaponIcon_Package").GetComponent <Image>();
        ItemDrag rightWeaponIconDrag = rightWeaponIcon.transform.parent.GetComponent <ItemDrag>();

        rightWeaponIconDrag.SetRef(_package.weapon[0]);
        leftWeaponIcon2 = GameObject.Find("leftWeaponIcon_UI").GetComponent <Image>();
        ItemDrag leftWeaponIconDrag2 = leftWeaponIcon2.transform.parent.GetComponent <ItemDrag>();

        leftWeaponIconDrag2.SetRef(_package.weapon[1]);
        rightWeaponIcon2 = GameObject.Find("rightWeaponIcon_UI").GetComponent <Image>();
        ItemDrag rightWeaponIconDrag2 = rightWeaponIcon2.transform.parent.GetComponent <ItemDrag>();

        rightWeaponIconDrag2.SetRef(_package.weapon[0]);

        leftWeaponText   = GameObject.Find("leftWeaponNum_Package").GetComponent <Text>();
        rightWeaponText  = GameObject.Find("rightWeaponNum_Package").GetComponent <Text>();
        leftWeaponText2  = GameObject.Find("leftWeaponNum_UI").GetComponent <Text>();
        rightWeaponText2 = GameObject.Find("rightWeaponNum_UI").GetComponent <Text>();

        FindWarehouse();
        for (int i = 0; i < 30; i++)
        {
            GameObject WarehouseIconFrameChild = Warehouse_Icon.transform.GetChild(0).GetChild(i).gameObject;
            WarehouseIcon[i] = WarehouseIconFrameChild.GetComponentInChildren <Image>();
            WarehouseNum[i]  = Warehouse_Num.transform.GetChild(0).GetChild(i).GetComponentInChildren <Text>();
        }
        FindShop();
        for (int i = 0; i < 5; i++)
        {
            GameObject GoodsIconFrameChild = Shop_Icon.transform.GetChild(0).GetChild(i).gameObject;
            goodsIcon[i] = GoodsIconFrameChild.GetComponentInChildren <Image>();
            goodsNum[i]  = Shop_Num.transform.GetChild(0).GetChild(i).GetComponentInChildren <Text>();
            goodsCost[i] = Shop_Num.transform.GetChild(2).GetChild(i).GetComponentInChildren <Text>();
        }
        for (int i = 0; i < 10; i++)
        {
            GameObject ConsumeIconFrameChild = Shop_Icon.transform.GetChild(1).GetChild(i).gameObject;
            consumeIcon[i] = ConsumeIconFrameChild.GetComponentInChildren <Image>();
            consumeNum[i]  = Shop_Num.transform.GetChild(1).GetChild(i).GetComponentInChildren <Text>();
        }
        allCost = Shop_Num.transform.GetChild(3).GetComponentInChildren <Text>();

        SetBag();
        SetQuickItem();
        SetWeapon();
        SetWarehouse();
        SetShop();

        //MainGameManager.playerManager.rightWeapon.SetActive(false);

        package_back.SetActive(false);
        package_icon.SetActive(false);
        package_num.SetActive(false);

        Warehouse_Back.SetActive(false);
        Warehouse_Icon.SetActive(false);
        Warehouse_Num.SetActive(false);


        Shop_Back.SetActive(false);
        Shop_Icon.SetActive(false);
        Shop_Num.SetActive(false);
    }
Пример #28
0
 private void Awake()
 {
     current        = this;
     itemDragCanvas = GameObject.Find("UI_PanelCanvas").transform;
     itemObj        = (GameObject)Resources.Load("UI/Item");
 }