Beispiel #1
0
    IEnumerator RefreshAbleExchangeCardList(int Quality)
    {
        MyTools.DestroyChildNodes(AbleExchangeTable.transform);

        UIScrollView sv = AbleExchangeTable.transform.parent.GetComponent <UIScrollView>();

        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.Quality <= Quality && SerPlayerData.GetItemCount(pair.Value.CardID) > 1)
            {
                GameObject newUnit = NGUITools.AddChild(AbleExchangeTable.gameObject, AbleExchangeCardPrefab);
                newUnit.SetActive(true);
                newUnit.name = "Card_" + pair.Value.CardID;

                UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();
                mc.UnconditionalShow(pair.Value.CardID);

                AbleExchangeTable.repositionNow = true;

                yield return(new WaitForEndOfFrame());

                sv.ResetPosition();
            }
        }
    }
Beispiel #2
0
    IEnumerator RefreshFishList()
    {
        MyTools.DestroyChildNodes(LstTable.transform);
        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.ThemeID != 103)
            {
                continue;
            }

            if (SerPlayerData.GetItemCount(pair.Key) > 0)
            {
                GameObject newUnit = NGUITools.AddChild(LstTable.gameObject, CardPrefab);
                newUnit.SetActive(true);
                newUnit.name = "Card_" + pair.Key;

                UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();
                mc.UnconditionalShow(pair.Key);

                LstTable.repositionNow = true;
                yield return(new WaitForEndOfFrame());

                FishLst.ResetPosition();
            }
        }
    }
Beispiel #3
0
    IEnumerator RefreshCardList()
    {
        MyTools.DestroyChildNodes(CardTable.transform);
        CommodityWaitLoad.SetActive(true);
        int CurProg = 0;

        foreach (MagicCardConfig CardCfg in TempToExchangeCardLst)
        {
            GameObject newUnit = NGUITools.AddChild(CardTable.gameObject, CardUnit_CardPrefab);
            newUnit.SetActive(true);
            newUnit.name = "Card_" + CardCfg.CardID;

            UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();
            mc.UnconditionalShow(CardCfg.CardID);

            CardTable.repositionNow = true;
            yield return(new WaitForEndOfFrame());

            CardLstRoot.GetComponent <UIScrollView>().ResetPosition();

            CurProg++;
            CommodityLoadProgLab.text = StringBuilderTool.ToString("卡牌加载中(", CurProg, "/", TempToExchangeCardLst.Count, ")...");
        }
        CommodityWaitLoad.SetActive(false);
    }
Beispiel #4
0
    public void ShowPurchaseConfirmation(GameObject CommodityObj)
    {
        CurCommodityObj = CommodityObj;
        MyTools.DestroyChildNodes(CommodityRoot);
        GameObject NewCurCommodityObj = GameObject.Instantiate(CurCommodityObj);

        NewCurCommodityObj.transform.parent        = CommodityRoot;
        NewCurCommodityObj.transform.localPosition = Vector3.zero;
        NewCurCommodityObj.transform.localScale    = Vector3.one;

        bool             Purchased = false;
        UI_MagicCard     mc        = NewCurCommodityObj.GetComponent <UI_MagicCard>();
        UI_CommodityItem ci        = NewCurCommodityObj.GetComponent <UI_CommodityItem>();

        if (mc != null)
        {
            Purchased = mc.PurchasedSign.activeSelf;
            if (Purchased)
            {
                mc.RecoverFromPurchased();
            }
        }
        else if (ci != null)
        {
            Purchased = ci.PurchasedSign.activeSelf;
            if (Purchased)
            {
                ci.RecoverFromPurchased();
            }
        }
        PurchaseBtn.isEnabled = !Purchased;
        PurchaseBtn.transform.GetChild(0).GetComponent <UILabel>().text = Purchased ? "已购买" : "购买";

        TweenAlpha.Begin(PurchaseConfirmationRoot, 0.2f, 1).from = 0;
    }
Beispiel #5
0
    public void ShowAbleExchangeCardLst(UI_MagicCard ExchangeCard)
    {
        TweenAlpha.Begin(AbleExchangeCardLstRoot, 0.2f, 1).from = 0;

        CurExchangeCard_InMarket = ExchangeCard;

        ExchangeBtn.isEnabled = false;

        StartCoroutine("RefreshAbleExchangeCardList", CurExchangeCard_InMarket.MCCfg.Quality);
    }
    private void AddCard(int CardID)
    {
        GameObject newUnit = NGUITools.AddChild(CardTable.gameObject, CardUnitPrefab);

        newUnit.SetActive(true);
        newUnit.name = "Card_" + CardID;

        UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();

        mc.Show(CardID);

        CardTable.repositionNow = true;
    }
    IEnumerator _CompoundSuccess(int CardID)
    {
        GameObject eff = Resources.Load <GameObject>("Prefabs/Effect/Effect_UI_kapaihecheng001");

        if (eff != null)
        {
            CompoundEff = GameObject.Instantiate(eff);
            CompoundEff.transform.parent           = CompoundRoot.transform;
            CompoundEff.transform.localPosition    = Vector3.zero;
            CompoundEff.transform.localEulerAngles = Vector3.zero;
            CompoundEff.transform.localScale       = Vector3.one * 360f;

            Transform OBg    = CompoundEff.transform.Find("kapai/kapai_aaa/kapai_bg_aaaaaa001/GameObject/Quad");
            Material  OBgMat = OBg.GetComponent <MeshRenderer>().material;
            OBgMat.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("BigUITexture/", OutputCard.Bg.spriteName)) as Texture;

            Transform OCard    = CompoundEff.transform.Find("kapai/kapai_aaa/kapai_hechengaaaaaaa/GameObject/Quad");
            Material  OCardMat = OCard.GetComponent <MeshRenderer>().material;
            OCardMat.mainTexture = OutputCard.Icon.mainTexture;

            for (int i = 0; i < MaterialCards.Length; i++)
            {
                Transform Bg    = CompoundEff.transform.Find(StringBuilderTool.ToString("kapai/kapai_00", (i + 1), "/kapai_bg_aaaaaa001/GameObject/Quad"));
                Material  BgMat = Bg.GetComponent <MeshRenderer>().material;
                BgMat.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("BigUITexture/", MaterialCards[i].Bg.spriteName)) as Texture;

                Transform Card    = CompoundEff.transform.Find(StringBuilderTool.ToString("kapai/kapai_00", (i + 1), "/kapai_hechengaaaaaaa/GameObject/Quad"));
                Material  CardMat = Card.GetComponent <MeshRenderer>().material;
                CardMat.mainTexture = MaterialCards[i].Icon.mainTexture;
            }
        }

        yield return(new WaitForSeconds(0.5f));

        ResultTitle.text = StringBuilderTool.ToString("恭喜您,获得 [FEE209]", OutputCard.FullName(), "[-]");
        ResultPanel.SetActive(true);
        TweenAlpha.Begin(ResultPanel, 0.2f, 1).from = 0;

        OnClick_HideCompound();

        yield return(new WaitForSeconds(0.5f));

        UI_MagicCard.AddShowNewSignCardID(CardID);

        StartCoroutine("RefreshCardList");

        //GameApp.Instance.CommonHintDlg.OpenHintBox("合成成功!");

        //ResultCard.UnconditionalShow(CardID);
    }
Beispiel #8
0
    public void OnSwitchToggleValueChange(UIToggle toggle)
    {
        for (int i = 0; i < LstTable.transform.childCount; i++)
        {
            Transform child = LstTable.transform.GetChild(i);
            if (child != null)
            {
                UI_MagicCard mc = child.GetComponent <UI_MagicCard>();
                if (mc != null)
                {
                    if (toggle.value)
                    {
                        //Debug.Log("显示涂色贴图");
                        mc.SetCustomColoringTexture(mc.MCCfg.CardID - Const.FishCardFirshID);
                    }
                    else
                    {
                        //Debug.Log("显示原始贴图");
                        mc.SetCustomColoringTexture(-1);
                    }
                }
            }
        }

        foreach (KeyValuePair <int, GameObject> pair in FishModelObjLst)
        {
            foreach (Transform child in pair.Value.transform)
            {
                if (toggle.value)
                {
                    child.gameObject.SetActive(child.name.Contains("_Coloring"));
                }
                else
                {
                    child.gameObject.SetActive(child.name.Contains("_Original"));
                }
            }
        }
    }
Beispiel #9
0
    IEnumerator RefreshCommodityList()
    {
        MyTools.DestroyChildNodes(CommodityTable.transform);
        CommodityWaitLoad.SetActive(true);
        int CurProg = 0;

        foreach (Commodity c in TempCommodityLst)
        {
            if (c.Type == ECommodityType.eCard)
            {
                GameObject newUnit = NGUITools.AddChild(CommodityTable.gameObject, CommodityUnit_CardPrefab);
                newUnit.SetActive(true);
                newUnit.name = "Commodity_Card_" + c.ID;

                UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();
                mc.UnconditionalShow(c.ID);
                mc.SetPrice(c.Price);
            }
            else if (c.Type == ECommodityType.eItem)
            {
                GameObject newUnit = NGUITools.AddChild(CommodityTable.gameObject, CommodityUnit_ItemPrefab);
                newUnit.SetActive(true);
                newUnit.name = "Commodity_Item_" + c.ID;

                UI_CommodityItem ci = newUnit.GetComponent <UI_CommodityItem>();
                ci.Show(c.ID, c.Price, 1001);
            }

            CommodityTable.repositionNow = true;
            yield return(new WaitForEndOfFrame());

            CommodityLstRoot.GetComponent <UIScrollView>().ResetPosition();

            CurProg++;
            CommodityLoadProgLab.text = StringBuilderTool.ToString("商品加载中(", CurProg, "/", TempCommodityLst.Count, ")...");
        }
        CommodityWaitLoad.SetActive(false);
    }
Beispiel #10
0
    public void OnClick()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");
        Debug.Log("点击:" + Name.text);

        //if (MCCfg != null && GameApp.Instance.CardHoldCountLst[MCCfg.CardID] > 0)
        //{
        //GameApp.Instance.HomePageUI.MagicBookUI.FullCard.Show(MCCfg.CardID);

        //Debug.Log(Name.text);
        //}
        //else
        //{
        //GameApp.Instance.CommonHintDlg.OpenHintBox("请先收集到此魔卡后再查看详情!");
        //}
        if (GameApp.Instance.TravelUI != null)
        {
            if (GameApp.Instance.TravelUI.TravelSeafloor != null)
            {
                GameApp.Instance.TravelUI.TravelSeafloor.PutFishModelInScene(MCCfg);
            }
            return;
        }

        if (Price != null)
        {
            Debug.Log("显示购买确认");
            GameApp.Instance.HomePageUI.MarketUI.ShowPurchaseConfirmation(gameObject);
            return;
        }

        if (ExchangeLab != null)
        {
            Debug.Log("显示可换魔卡界面");
            GameApp.Instance.HomePageUI.MarketUI.ShowAbleExchangeCardLst(this);
            return;
        }

        if (Sel != null)
        {
            Debug.Log("选中待更换的魔卡");
            for (int i = 0; i < transform.parent.childCount; i++)
            {
                Transform child = transform.parent.GetChild(i);
                if (child.name == transform.name)
                {
                    continue;
                }

                UI_MagicCard mc = child.GetComponent <UI_MagicCard>();
                mc.ShowSelSign(false);
            }
            ShowSelSign(true);
            GameApp.Instance.HomePageUI.MarketUI.SelectExchangeCard(this);
            return;
        }

        if (EnableCompound != null && EnableCompound.activeSelf)
        {
            if (GameApp.Instance.HomePageUI != null)
            {
                GameApp.Instance.HomePageUI.MagicBookUI.ShowCompound(MCCfg.CardID);
            }
            else if (GameApp.Instance.TravelUI != null)
            {
                GameApp.Instance.TravelUI.MagicBookUI.ShowCompound(MCCfg.CardID);
            }
        }
        else
        {
            if (SerPlayerData.GetItemCount(MCCfg.CardID) > 0)
            {
                RemoveShowNewSignCardID(MCCfg.CardID);
                if (NewSign != null)
                {
                    NewSign.alpha = 0;
                }

                if (GameApp.Instance.HomePageUI != null)
                {
                    GameApp.Instance.HomePageUI.MagicBookUI.ShowCardDetails(MCCfg.CardID);
                }
                else if (GameApp.Instance.TravelUI != null)
                {
                    GameApp.Instance.TravelUI.MagicBookUI.ShowCardDetails(MCCfg.CardID);
                }
            }
            else
            {
                GameApp.Instance.CommonHintDlg.OpenHintBox("请先收集到此魔卡后再查看详情!");
            }
            //GameApp.Instance.CommonHintDlg.OpenHintBox(StringBuilderTool.ToInfoString("查看", FullName(), "的卡牌详情!"));
        }
    }
Beispiel #11
0
    public void SelectExchangeCard(UI_MagicCard ExchangeCard)
    {
        CurExchangeCard_InBag = ExchangeCard;

        ExchangeBtn.isEnabled = true;
    }
Beispiel #12
0
    public void OnClick_Purchase()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");
        Debug.Log("点击【购买】");

        switch (CurType)
        {
        case 1:
        {
            uint Gold           = SerPlayerData.GetItemCount(1001);
            uint CommodityID    = 0;
            uint CommodityPrice = 0;

            UI_MagicCard     mc = CurCommodityObj.GetComponent <UI_MagicCard>();
            UI_CommodityItem ci = CurCommodityObj.GetComponent <UI_CommodityItem>();
            if (mc != null)
            {
                CommodityID    = (uint)mc.MCCfg.CardID;
                CommodityPrice = uint.Parse(mc.Price.text);
            }
            else if (ci != null)
            {
                CommodityID    = (uint)ci.ItemCfg.ItemID;
                CommodityPrice = uint.Parse(ci.Price.text);
            }
            else
            {
                return;
            }

            if (Gold >= CommodityPrice)
            {
                if (mc != null)
                {
                    mc.SetPurchased();

                    GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", mc.MCCfg.CardID, " 1"));
                }
                else if (ci != null)
                {
                    ci.SetPurchased();

                    GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", ci.ItemCfg.ItemID, " 1"));
                }

                TweenAlpha.Begin(PurchaseConfirmationRoot, 0.2f, 0).from = 1;

                GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem 1001 ", -CommodityPrice));
            }
            else
            {
                ShowGoldCoinNotEnough();
            }
        }
        break;

        case 2:
            break;

        case 3:
        {
            UI_CommodityItem ci = CurCommodityObj.GetComponent <UI_CommodityItem>();
            if (ci != null)
            {
                if (GameApp.Instance.Platform != null && GameApp.Instance.LeSDKInstance != null)
                {
                    GameApp.Instance.Platform.CreateOrder(ci.GoodsID);
                }
            }
        }
        break;
        }
    }