예제 #1
0
    public override void InitUIData()
    {
        base.InitUIData();

        timeTextBuilder      = new StringBuilder();
        m_ConfirmItem        = MysteriousItem.GenerateItem(selfTransform.FindChild("ConfirmPanel/Item").gameObject);
        m_CostImage          = selfTransform.FindChild("ConfirmPanel/PlayerWalletText/CostImage").GetComponent <Image>();
        originItem           = selfTransform.FindChild("OriginPanel/OriginItem").gameObject;
        itemListLayout       = selfTransform.FindChild("ItemList/ListLayout").gameObject;
        confirmPanel         = selfTransform.FindChild("ConfirmPanel").gameObject;
        m_CaptionLayoutPoint = selfTransform.FindChild("CaptionLayout");
        battleStageMgr       = ObjectSelf.GetInstance().BattleStageData;

        m_Time = battleStageMgr.m_SpecialStage.m_Time;

        GameEventDispatcher.Inst.addEventListener(GameEventID.UI_MysteriousShopBuyReplay, PayHandler);
    }
예제 #2
0
    //private int SortHandler(ItemData leftItem,ItemData rightItem)
    //{
    //    return leftItem.mysteriousshopTemplate.getSorting() - rightItem.mysteriousshopTemplate.getSorting();
    //}

    private MysteriousItem CreatItem()
    {
        if (itemListLayout == null || originItem == null)
        {
            //Debug.Log("神秘商店面板:无法找到子物体:itemListLayout和originItem");
            return(null);
        }

        GameObject go = Instantiate(originItem, itemListLayout.transform.position, itemListLayout.transform.rotation) as GameObject;

        go.transform.SetParent(itemListLayout.transform);
        go.transform.localScale = Vector3.one;

        var item = MysteriousItem.GenerateItem(go);

        item.buyBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickBuyBtn));
        return(item);
    }