示例#1
0
    // enum Images
    // {
    //   ItemIcon,
    // }

    public override void Init()
    {
        base.Init();

        Bind <Button>(typeof(Buttons));
        Bind <GameObject>(typeof(GameObjects));

        // GetButton((int)Buttons.PointButton).gameObject.AddUIEvent(OnPointButtonClicked);
        GetButton((int)Buttons.CloseButton).gameObject.AddUIEvent(OnCloseButtonClicked);

        // GameObject go = GetImage((int)Images.ItemIcon).gameObject;
        // BindEvent(go, (PointerEventData data) => { go.transform.position = data.position; }, Define.UIEvent.Drag);

        GameObject gridPanel = Get <GameObject>((int)GameObjects.GridPanel);

        foreach (Transform child in gridPanel.transform)
        {
            Managers.Resource.Destroy(child.gameObject);
        }

        Dictionary <int, List <Item> > itemInfos = Managers.Data.getItemData();

        foreach (KeyValuePair <int, List <Item> > each in itemInfos)
        {
            int           itemNum    = each.Key;
            List <Item>   items      = each.Value;
            GameObject    itemObject = Managers.UI.MakeSubItem <UI_Inven_Item>(parent: gridPanel.transform).gameObject;
            UI_Inven_Item inven_Item = itemObject.GetOrAddComponent <UI_Inven_Item>();
            inven_Item.SetInfo(itemNum, items.Count);
        }
    }
示例#2
0
    public override void Init()
    {
        base.Init();

        Bind <GameObject>(typeof(GameObjects));
        GameObject gridPanel = Get <GameObject>((int)GameObjects.GridPanel);

        foreach (Transform child in gridPanel.transform)
        {
            Managers.Resource.Destroy(child.gameObject);
        }

        for (int i = 0; i < 8; i++)
        {
            GameObject item = Managers.UI.MakeSubItem <UI_Inven_Item>(gridPanel.transform).gameObject;

            UI_Inven_Item invenItem = item.GetOrAddComponent <UI_Inven_Item>();
            invenItem.SetInfo($"집행검{i}");
        }
    }
示例#3
0
    public override void Init()
    {
        base.Init();

        Bind <GameObject>(typeof(GameObjects));

        GameObject gridPanel = Get <GameObject>((int)GameObjects.GridPanel);

        // GridPanel 초기화. 모든 자식게임오브젝트(아이템)을 삭제
        foreach (Transform child in gridPanel.transform)
        {
            Managers.Resource.Destroy(child.gameObject);
        }

        // TODO : 실제 인벤토리 정보를 가져와서 넣기
        for (int i = 0; i < 12; i++)
        {
            GameObject item = Managers.UI.MakeSubItem <UI_Inven_Item>(parent: gridPanel.transform).gameObject;

            UI_Inven_Item invenItem = item.GetOrAddComponent <UI_Inven_Item>();
            invenItem.SetInfo($"매직마르시아 {i}번");
        }
    }
示例#4
0
    public override void Init()
    {
        base.Init();
        Bind <GameObject>(typeof(GameObjects));

        GameObject gridPanel = Get <GameObject>((int)GameObjects.GridPanel);

        foreach (Transform child in gridPanel.transform)
        {
            Managers.Resource.Destroy(child.gameObject);
        }
        //실제 인벤토리 데이터를 참고하여 Inven Item 삽입
        for (int i = 0; i < 8; i++)
        {
            //현재는 임시로 더미 데이터 8개
            //GameObject item = Managers.Resource.Instantiate("UI/Scene/UI_Inven_Item");
            //item.transform.SetParent(gridPanel.transform); //game obj의 부모를 지정해 연결

            GameObject item = Managers.UI.MakeSubItem <UI_Inven_Item>(gridPanel.transform).gameObject;
            //하위 컴포(프리팹인) 인벤 아이템을 바인드
            UI_Inven_Item invenItem = item.GetOrAddComponent <UI_Inven_Item>();
            invenItem.SetInfo($"집행검{i}번");
        }
    }