示例#1
0
    public void init(Player player)
    {
        this.player          = player;
        itemSettingTransform = Instantiate(itemSettings).GetComponent <RectTransform>();
        itemInfoHandler      = itemSettingTransform.gameObject.GetComponent <ItemInfoHandler>();
        itemInfoHandler.setPlayer(this.player);
        parentCanvas = Tools.getChild(player.getUI(), "Inventory_UI");
        itemSettingTransform.SetParent(parentCanvas.transform);
        canvas[0] = Tools.getChild(player.getUI(), "Items_Inventory_Eqp");
        canvas[1] = Tools.getChild(player.getUI(), "Items_Inventory_Use");
        canvas[2] = Tools.getChild(player.getUI(), "Items_Inventory_Etc");
        canvas[3] = Tools.getChild(player.getUI(), "Items_Inventory_Quest");
        GameObject g = (GameObject)(Instantiate(informationPrefab.gameObject, Vector3.zero, Quaternion.identity));

        information = g.GetComponent <inventoryInformation>();
        information.gameObject.transform.SetParent(canvas[0].transform.parent.parent.parent);
        information.gameObject.transform.SetAsLastSibling();
        handler = parentCanvas.GetComponent <UIHandler>();
        //addItem(new Item().getEmptyItem(0));
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     handler = this.transform.parent.gameObject.GetComponent <ItemInfoHandler>();
     button  = this.GetComponent <Button>();
 }