public void SetBagIconRef(int i)//捡取道具改变了Item类型时,也需要重新更改指向 { GameObject BagIconFrameChild = BagIconFrame.transform.GetChild(i).gameObject; ItemDrag BagIconDrag = BagIconFrameChild.GetComponent <ItemDrag>(); BagIconDrag.SetRef(_package.bag[i]); }
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]); }
//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]); } } }
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]); } } }
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); }