Beispiel #1
0
    void OnUnCollect(ButtonScript obj, object args, int param1, int param2)
    {
        UIGrid grid = transform.parent.GetComponent <UIGrid>();

        AuctionHouseSystem.RemoveCollection(grid.GetIndex(transform) - 1);
        grid.RemoveChild(transform);
        gameObject.SetActive(false);
    }
Beispiel #2
0
    private void OnUnCollect(ButtonScript obj, object args, int param1, int param2)
    {
        AuctionHouseSystem.RemoveCollection(param1);

        int index = 0;        //typeListGrid_.GetIndex(obj.transform);

        for (int i = 0; i < collectItemCache.Length; ++i)
        {
            if (collectItemCache[i] != null)
            {
                typeListGrid_.RemoveChild(collectItemCache[i].transform);
                collectItemCache[i].transform.parent = null;
                UIManager.RemoveButtonEventHandler(collectItemCache[i], EnumButtonEvent.OnClick);
                collectItemCache[i].SetActive(false);
            }
        }
        GameObject colItem = null;

        for (int i = 0; i < AuctionHouseSystem.CollectionMax; ++i)
        {
            if (i < AuctionHouseSystem.collectionList_.Count)
            {
                string[] infos  = AuctionHouseSystem.collectionList_[i].Split('|');
                int      id     = int.Parse(infos[0]);
                int      isItem = bool.Parse(infos[1]) == true? 1: 0;
                if (collectItemCache[i] == null)
                {
                    colItem = GameObject.Instantiate(collectItem_) as GameObject;
                    typeListGrid_.AddChild(colItem.transform, index + 1 + i);
                    colItem.SetActive(true);
                    colItem.transform.localScale = Vector3.one;
                    colItem.GetComponent <CollectGood>().SetData(AuctionHouseSystem.collectionList_[i]);
                    UIManager.SetButtonEventHandler(colItem, EnumButtonEvent.OnClick, OnCollectionSearch, id, isItem);
                    UIManager.SetButtonEventHandler(colItem.GetComponent <CollectGood>().cancelCollectBtn_.gameObject, EnumButtonEvent.OnClick, OnUnCollect, i, isItem);
                    collectItemCache[i] = colItem;
                }
                else
                {
                    typeListGrid_.AddChild(collectItemCache[i].transform, index + 1 + i);
                    collectItemCache[i].SetActive(true);
                    collectItemCache[i].GetComponent <CollectGood>().SetData(AuctionHouseSystem.collectionList_[i]);
                    UIManager.SetButtonEventHandler(collectItemCache[i], EnumButtonEvent.OnClick, OnCollectionSearch, id, isItem);
                    UIManager.SetButtonEventHandler(collectItemCache[i].GetComponent <CollectGood>().cancelCollectBtn_.gameObject, EnumButtonEvent.OnClick, OnUnCollect, i, isItem);
                }
            }
            else
            {
                if (collectItemCache[i] != null)
                {
                    UIManager.RemoveButtonEventHandler(collectItemCache[i], EnumButtonEvent.OnClick);
                    collectItemCache[i].SetActive(false);
                }
            }
        }
    }
Beispiel #3
0
    void SelectDisplayGroup(DisplayType type)
    {
        crtDisplayType_ = type;
        buyGroup_.SetActive(type == DisplayType.DT_Buy);
        sellGroup_.SetActive(type == DisplayType.DT_Sell);

        string buyTabName  = type == DisplayType.DT_Buy ? "hb_qieyefu_liang" : "hb_qieyefu_an";
        string sellTabName = type == DisplayType.DT_Sell ? "hb_qieyefu_liang" : "hb_qieyefu_an";

        buyTab_.GetComponentInChildren <UISprite>().spriteName  = buyTabName;
        sellTab_.GetComponentInChildren <UISprite>().spriteName = sellTabName;

        if (type == DisplayType.DT_Buy)
        {
            string coll = AuctionHouseSystem.GetFirstCollection();
            if (!string.IsNullOrEmpty(coll))
            {
                string[] infos  = coll.Split('|');
                int      id     = int.Parse(infos[0]);
                bool     isItem = bool.Parse(infos[1]);
                if (isItem)
                {
                    LaunchContext("", ItemSubType.IST_None, RaceType.RT_None, id);
                }
                else
                {
                    LaunchContext("", ItemSubType.IST_None, RaceType.RT_None, 0, id);
                }
            }
            else
            {
                LaunchContext();
            }
            NetConnection.Instance.fetchSelling(searchContext_);
        }
        else
        {
            OnMySellingUpdate();
            OnBagTab(null, null, (int)type, 0);
        }
    }
Beispiel #4
0
    void OnCollect(ButtonScript obj, object args, int param1, int param2)
    {
        if (crtSelectSellItem_ == null)
        {
            return;
        }

        if (AuctionHouseSystem.collectionList_.Count == AuctionHouseSystem.CollectionMax)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("CollectionFull"), PopText.WarningType.WT_Warning);
            return;
        }

        int  id     = 0;
        bool isItem = false;

        if (crtSelectSellItem_.item_.itemId_ != 0)
        {
            id     = (int)crtSelectSellItem_.item_.itemId_;
            isItem = true;
        }
        else if (crtSelectSellItem_.baby_.instId_ != 0)
        {
            id = (int)crtSelectSellItem_.baby_.properties_[(int)PropertyType.PT_TableId];
        }
        if (AuctionHouseSystem.AddCollection(id, isItem))
        {
            if (typeFlag[(int)TypeType.TT_Collection])
            {
                OnClickTypeBtn(collectionTab_.gameObject.GetComponent <ButtonScript>(), null, 0, 1);
            }

            PopText.Instance.Show(LanguageManager.instance.GetValue("CollectionSucc"), PopText.WarningType.WT_Tip);
        }
        else
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("CollectionSame"), PopText.WarningType.WT_Warning);
        }
    }