Esempio n. 1
0
    private void OnUpCardHandler()
    {
        CardVo card = DataManager.inst.GetCardVo(CID);

        if (GuideManager.inst.Check("1:2"))
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            dic["card_id"]   = CID;
            dic["guide_num"] = 2;
//			GuideManager.inst.Next ();
//			GuideManager.inst.Show (this);
            ModelManager.inst.userModel.SetGuide(2, OnCardLvupHandler, dic);
            return;
        }
        if (ModelUser.GetCanBuy(Config.ASSET_GOLD, card.getUpLevelNeed(), "24129"))
        {
            NetHttp.inst.Send(NetBase.HTTP_CARD_LVUP, "cid=" + CID, OnCardLvupHandler);
        }
    }
Esempio n. 2
0
    public override void Init()
    {
        base.Init();
        if (isKu == 2)
        {
            card = DataManager.inst.GetCardVo(CID, 1);
        }
        else
        {
            card = DataManager.inst.GetCardVo(CID, lv);
        }
        this.Create(Config.VIEW_ITEMSHIPINFO, false);
//		, Tools.GetMessageById (card.name)
        sim = (Dictionary <string, object>)(DataManager.inst.systemSimple ["card_attr_info"]);

        btn_up = this.GetChild("n15").asButton;
        btn_up.onClick.Add(OnUpCardHandler);
        btn_change      = this.GetChild("n14").asButton;
        btn_change.text = Tools.GetMessageById("24132");
        btn_change.onClick.Add(OnChangeHandler);

        GImage     img_upbuy      = this.GetChild("n15").asCom.GetChild("n3").asImage;
        GTextField l_getredcoin   = this.GetChild("n25").asTextField;
        GButton    img_getredcoin = this.GetChild("n16").asButton;
//		GImage img_getred = view.GetChild ("n27").asImage;
        GTextField title      = this.GetChild("n64").asTextField;
        GTextField card_lv    = this.GetChild("n54").asTextField;
        GTextField info       = this.GetChild("n12").asTextField;
        GLoader    img_rarity = this.GetChild("n3").asLoader;
        GTextField di         = this.GetChild("n55").asTextField;

        ViewManager.inst.AddTouchTip("GButton", img_getredcoin, Config.ASSET_REDBAGCOIN);

        btn_up.text = "";
        this.GetChild("n73").asLoader.url     = Tools.GetResourceUrl("Image2:n_icon_d" + card.armor.ToString());
        this.GetChild("n52").asTextField.text = card.GetCost();
        title.text     = Tools.GetMessageById(card.name);
        card_lv.text   = card.lv.ToString();
        info.text      = Tools.GetMessageById(card.info);
        l_giveRed      = this.GetChild("n26").asTextField;
        l_giveRed.text = "x" + card.getUpLevelGiveRed();
        GTextField gold = this.GetChild("n15").asCom.GetChild("n5").asTextField;

        gold.text = Tools.GetMessageById("24123", new string[] { card.getUpLevelNeed() + "" });
        GTextField ssss = this.GetChild("n15").asCom.GetChild("n4").asTextField;

        ssss.text      = Tools.GetMessageById("24131");
        img_rarity.url = Tools.GetResourceUrl("Image2:n_icon_dengji" + (card.rarity + 1) + "_");
        di.text        = "";
        this.GetChild("n72").asTextField.text = Tools.GetMessageById("24134", new string[] { card.cd.ToString() });
        GTextField l_rarity = this.GetChild("n6").asTextField;

        l_rarity.text = Tools.GetMessageById("13051", new string[] { CardVo.GetRarityMss(card.rarity) });

        GTextField l_type = this.GetChild("n5").asTextField;

        l_type.text       = CardVo.GetArmorMss(card.armor);
        l_getredcoin.text = Tools.GetMessageById("24130");
        if (card.getUpLevelNeed() == 0)
        {
            img_upbuy.visible = false;
            gold.text         = "";
            ssss.text         = "";
            btn_up.text       = Tools.GetMessageById("14012");
        }
        if (card.lv >= card.maxLv)
        {
            btn_up.visible         = false;
            img_upbuy.visible      = false;
            img_getredcoin.visible = false;
            l_giveRed.text         = "";
            Dictionary <string, object> cfg      = DataManager.inst.systemSimple;
            Dictionary <string, object> card_exp = (Dictionary <string, object>)cfg ["card_lv_exp"];
            card_exp          = (Dictionary <string, object>)card_exp [card.rarity + ""];
            l_getredcoin.text = "";
            di.text           = Tools.GetMessageById("13050", new string[] {
                ((object[])card_exp ["lv_max"]) [1].ToString(),
                ((object[])card_exp ["lv_max"]) [0].ToString()
            });
        }
        if (card.exp < card.maxExp)
        {
            btn_up.enabled   = false;
            img_upbuy.grayed = true;
            gold.grayed      = true;
            ssss.grayed      = true;
        }
        if (card.rarity == 3)
        {
//			EffectManager.inst.SetRainbowBar (this.GetChild ("n69").asCom);
            //		n70
            GGraph  ggg  = this.GetChild("n70").asGraph;
            float   mm   = 125f;
            float   mmm  = 125f;
            float   cc   = 5f;
            float[] rgbA = new float[] { 1f, 1f, 0f, mm, mm, 0f, 0f };
            float[] rgbB = new float[] { 1f, 1f, 0f, mm, mm - 40f, 0f, 0f };

            Color   ccs       = Color.white;
            Color   ccs2      = Color.white;
            Color[] ccc       = new Color[] { ccs, ccs, ccs2, ccs2 };
            float[] nullColor = new float[] { 1, 0, 1 };
            TimerManager.inst.Add(0.04f, 0, (float x) => {
                rgbA = Tools.GetRGB(mm, cc, ref rgbA, nullColor);
                rgbB = Tools.GetRGB(mm, cc, ref rgbB, nullColor);

                ccs.r = rgbA[3] / mmm;
                ccs.g = rgbA[4] / mmm;
                ccs.b = rgbA[5] / mmm;

                ccs2.r = rgbB[3] / mmm;
                ccs2.g = rgbB[4] / mmm;
                ccs2.b = rgbB[5] / mmm;

                ccc[0] = ccs;
                ccc[1] = ccs;
                ccc[2] = ccs2;
                ccc[3] = ccs2;

                ggg.shape.DrawRect(0, ccc);
            });
//			this.GetChild ("n69").asCom.visible = true;
        }
        else
        {
//			this.GetChild ("n69").asCom.visible = false;
            this.GetChild("n70").visible = false;
        }
//		else if (!ModelUser.GetCanBuy (Config.ASSET_GOLD, card.getUpLevelNeed (), false))
//		{
//			btn_up.text = Tools.GetMessageColor (Tools.GetMessageById ("19009", new string[]{ card.getUpLevelNeed () + "" }), new string[]{ "ff0000" });
//		}
        if (isKu == 1)
        {
            btn_change.visible = false;
        }
        (this.GetChild("n56") as ComCard).SetData(CID);
        if (isKu == 2 || isKu == 3)
        {
            btn_change.visible     = false;
            img_upbuy.visible      = false;
            btn_up.visible         = false;
            l_giveRed.text         = "";
            l_getredcoin.text      = "";
            gold.text              = "";
            ssss.text              = "";
            img_getredcoin.visible = false;
            if (isKu == 2)
            {
                (this.GetChild("n56") as ComCard).SetData(CID, -1, 4, 1);
                (this.GetChild("n56") as ComCard).SetText(Tools.GetMessageById(card.name));
            }
            else
            {
                (this.GetChild("n56") as ComCard).SetData(CID, -1, 4, lv);
                (this.GetChild("n56") as ComCard).SetText(Tools.GetMessageById("14015", new string[] { card.lv.ToString() }));
            }
//			this.height = 490;
        }
        if (isKu == 4)
        {
            btn_change.visible     = false;
            img_upbuy.visible      = false;
            btn_up.visible         = false;
            l_giveRed.text         = "";
            l_getredcoin.text      = "";
            gold.text              = "";
            ssss.text              = "";
            img_getredcoin.visible = false;
            if (card.have)
            {
                (this.GetChild("n56") as ComCard).SetData(CID);
            }
            else
            {
                (this.GetChild("n56") as ComCard).SetData(CID, -1, 4, 1);
                (this.GetChild("n56") as ComCard).SetText(Tools.GetMessageById("13053"));
            }
//			this.height = 490;
        }
        this.group.Center();
        if (img_upbuy.visible && btn_up.enabled)
        {
            di.text = Tools.GetMessageById("24118", new string[] {
                CardVo.GetRarityMss(card.rarity),
                (card.lv + 1).ToString()
            });
        }
        FushDataToShow(CID);
        if (GuideManager.inst.Check("1:1"))
        {
            if (btn_up.enabled)
            {
                GuideManager.inst.Next();
                GuideManager.inst.Show(this);
            }
            else
            {
                GuideManager.inst.Clear();
            }
        }
        this.GetChild("n58").asButton.onClick.Add(() => {
            ViewManager.inst.CloseView(this);
        });
        this.GetChild("n61").asButton.onClick.Add(() => {
//			this.GetController("c1").selectedIndex = this.GetController("c1").selectedIndex == 1?0:1;
            infobar = !infobar;
            if (infobar == false)
            {
                float c = this.width;
                DOTween.To(() => c, x => c = x, 543, 0.2f).OnUpdate(() =>
                {
                    this.width = c;
                }).OnComplete(() => {
                    this.GetController("c1").selectedIndex = 0;
                });
            }
            else
            {
                float c = this.width;
                this.GetController("c1").selectedIndex = 1;
                DOTween.To(() => c, x => c             = x, 878, 0.2f).OnUpdate(() =>
                {
                    this.width = c;
                });
            }
        });



        //
    }