Exemplo n.º 1
0
    private object[] GetTypeByObj(string type, object[] da)
    {
        object[] data = (object[])Tools.Clone(da);
        switch (type)
        {
        case "use_card":
            data [0] = CardVo.GetCardName((string)da [0]);
            break;

        case "have_card_group":
            data [0] = CardVo.GetRarityMss((int)da [0]);
            break;

        case "level_card_group":
            data [0] = CardVo.GetRarityMss((int)da [0]);
            break;
        }
        return(data);
    }
Exemplo 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;
                });
            }
        });



        //
    }
Exemplo n.º 3
0
    private string showItem(Dictionary <string, object> _data, bool ismove = false, float times = 0.2f)
    {
        openTimes = times;
        if (this.item != null)
        {
            if (comIcon != null)
            {
                comIcon.reMoveTimer();
                comIcon = null;
            }
            mpro    = null;
            mprotxt = null;
            TimerManager.inst.Remove(TimerFunction);
            TimerManager.inst.Remove(TimerFunction2);
            TimerManager.inst.Remove(OnTimerFunction);
            this.RemoveChild(this.item);
            starImg   = null;
            this.item = null;
        }
        TimerManager.inst.Remove(onRED_GIFT);
        maxExp = -1;
        string _id  = "";
        string _num = "";

        foreach (string id in _data.Keys)
        {
            _id  = id;
            _num = _data [id].ToString();
        }
        if (_id.StartsWith("C")) //判断是否是彩卡和新卡
        {
            card = DataManager.inst.GetCardVo(_id);
            if (card.rarity == 3)
            {
                ClickBtn.touchable = false;
                TimerManager.inst.Add(3f, 1, (float ff) => { ClickBtn.touchable = true; });
            }
            else if (card.exp.ToString() == _num && card.lv == 1)
            {
                ClickBtn.touchable = false;
                isNew = true;
                TimerManager.inst.Add(3f, 1, (float ff) => { ClickBtn.touchable = true; });
            }
            if (card.rarity == 3)
            {
                isLegend = true;
            }
        }
        float f = this.GetChild("n1").asGraph.y;

//		float tt = 0.3f;
//		if (!ismove) {
//			tt = 0;
//		}


//		DOTween.To (() => f, x => f = x, 400f, tt).OnUpdate (() => {
//			this.GetChild ("n1").asGraph.y = f;
//		}).OnComplete (() => {

        L_Label.visible = true;
        if (nowIndex == newdata.Count - 1)
        {
//				if(_move.IndexOf ("bag") != -1)
//				{
////					GameObjectScaler.Scale (EffectManager.inst.AddEffect (_move, "end", this.GetChild ("n1").asGraph),0.6f);
//					EffectManager.inst.AddEffect (_move, "open", this.GetChild ("n1").asGraph).transform.localScale *= 0.6f;
//                } else{
//					EffectManager.inst.PlayEffect(move,"touch");
//                    SoundManager.inst.PlaySound(Config.SOUND_OPENBOX);
//              }
            this.GetChild("n4").visible = false;
        }
        else
        {
            this.GetChild("n4").visible = true;
        }
        if (_move.IndexOf("egg") != -1)
        {
            EffectManager.inst.PlayEffect(move, "open");
            SoundManager.inst.PlaySound(Config.SOUND_OPENBOX);
        }
        else if (_move.IndexOf("bag") != -1)
        {
            //					GameObjectScaler.Scale (EffectManager.inst.AddEffect (_move, "touch", this.GetChild ("n1").asGraph),0.6f);
            GameObject go = EffectManager.inst.AddEffect(_move, "open", this.GetChild("n1").asGraph);
            go.transform.localScale *= 0.6f;
            if (go.GetComponent <AudioSource>() != null)
            {
                go.GetComponent <AudioSource>().volume = ModelManager.inst.userModel.isSound ? 1 : 0;
            }
//			} else if(_move.IndexOf ("box") != -1) {
//				EffectManager.inst.PlayEffect(move,"touch");
//				SoundManager.inst.PlaySound(Config.SOUND_OPENBOX);
        }
        else
        {
            EffectManager.inst.PlayEffect(move, "touch");
            SoundManager.inst.PlaySound(Config.SOUND_OPENBOX);
        }
        onRED_GIFT = TimerManager.inst.Add(times, 1, (float asdf) => {
            allClick  = true;
            this.item = Tools.GetComponent(Config.RED_GIFT).asCom;
            (item.GetChild("n8") as ComProgressBar).skin    = ComProgressBar.BAR3;
            (item.GetChild("n8") as ComProgressBar).offsetY = 5;
            (item.GetChild("n9") as ComProgressBar).skin    = ComProgressBar.BAR9;
            (item.GetChild("n9") as ComProgressBar).offsetY = -3;
            item.GetChild("n13").asTextField.text           = Tools.GetMessageById("24125");
            item.GetController("c1").selectedIndex          = 1;
            Controller c2    = item.GetController("c2");
            c2.selectedIndex = 3;
            GTextField name  = item.GetChild("n1").asTextField;
            GTextField info  = item.GetChild("n2").asTextField;
            GTextField num   = item.GetChild("n3").asTextField;
            comIcon          = item.GetChild("n4") as ComBigIcon;
            starImg          = item.GetChild("n5").asGraph;
            this.AddChild(this.item);
            name.visible    = false;
            info.visible    = false;
            num.visible     = false;
            starImg.visible = false;
            starImg.TweenScale(new Vector2(1.2f, 1.2f), 0.5f);
            if (isLegend)
            {
                EffectManager.inst.AddPrefab("Legendcard/legendcard", starImg);
            }
            else
            {
                EffectManager.inst.AddPrefab("Normalcard/normalcard", starImg);
            }
//				Log.debug(view.GetChildIndex(item));
//				Log.debug(view.GetChildIndex(view.GetChild("n4")));
            this.item.x = Tools.offectSetX(230f);
            this.item.y = 326f;

            comIcon.rotationY = 180;
            int expNum        = 0;
            if (_id.StartsWith("s") && _id != Config.ASSET_ELSCORE && _id != Config.ASSET_RANKSCORE)
            {
                name.text        = Tools.GetBodyName(_id);
                c2.selectedIndex = 3;
                comIcon.GetChild("n0").visible = false;
                comIcon.SetSelectIndex(2);
                shipobj = EffectManager.inst.AddShip(_id, comIcon.GetChild("n11").asGraph, true);

                shipobj.GetComponent <AudioSource> ().volume = ModelManager.inst.userModel.isSound ? 1 : 0;

                //					GameObjectScaler.Scale(shipobj,0.6f);
                shipobj.transform.localScale *= 0.6f;
                shipobj.transform.Rotate(new Vector3(270, 120, 0));
                shipobj.transform.Rotate(new Vector3(0, 20, 0));
                info.text = Tools.GetMessageById("24110");
                num.text  = "x" + _num;
                comIcon.SetData(_id, _num);
                TimerManager.inst.Add(0.01f, 0, OnFFFFFFFFF);
                comIcon.SetSelectIndex(1);
            }
            else
            {
                float c = 0;
                float y = 90;
                DOTween.To(() => c, x => c = x, 90, 0.5f).OnUpdate(() => {
                    comIcon.rotationY = c;
                }).OnComplete(() => {
                    TimerManager.inst.Add(0.2f, 1, (float ff) => {
                        SoundManager.inst.PlaySound(Config.SOUND_SHOWCARD);
                    });
                    name.text = _id;
                    if (_id.StartsWith("C") && _id != Config.ASSET_CARD)
                    {
                        c2.selectedIndex = 2;
                        CardVo ava       = DataManager.inst.GetCardVo(_id);
                        if (ava.newcard == 1 && isNew)
                        {
                            item.GetChild("n13").asTextField.visible = true;
                            isNew = false;
                        }
                        expNum = ava.exp;
                        comIcon.SetData(_id, _num, 2);
                        comIcon.SetSelectIndex(1);
                        num.text  = "x" + _num;
                        name.text = Tools.GetMessageById(ava.name);
                        info.text = CardVo.GetRarityMss(ava.rarity, 1);
                    }
                    else if (_id.StartsWith("s") && _id != Config.ASSET_ELSCORE && _id != Config.ASSET_RANKSCORE)
                    {
                    }
                    else
                    {
                        name.text = Tools.GetIconName(_id);
                        comIcon.SetSelectIndex(2);
                        num.text = "x" + _num;

                        //						info.text = Tools.GetIconName (_id);
                        info.text = Tools.GetMessageById("21013");
                        //						Dictionary<string,object> ddd = new Dictionary<string,object> ();
                        //						ddd.Add (_id, _num);
                        if (_id == Config.ASSET_ELSCORE)
                        {
                            c2.selectedIndex = 4;
                            comIcon.SetData(_id, _num);
                        }
                        else
                        {
                            if (_id == Config.ASSET_GOLD)
                            {
                                c2.selectedIndex = 0;
                            }
                            else if (_id == Config.ASSET_COIN)
                            {
                                c2.selectedIndex = 1;
                            }
                            comIcon.SetData(_id, Convert.ToInt32(_num));
                        }
                    }
                    DOTween.To(() => y, x => y = x, 0, 0.5f).OnUpdate(() => {
                        comIcon.rotationY = y;
                    });
                });
            }
            comIcon.scale = new Vector2(0.5f, 0.25f);
            comIcon.TweenScale(new Vector2(1f, 1f), 0.25f);
            EffectManager.inst.Bezier(this.item, 0.5f, new Vector2(Tools.offectSetX(230f), 326f), new Vector2(350f, 0f), new Vector2(Tools.offectSetX(630f), 200f), () => {
//					TimerManager.inst.Add (0.01f, 0, OnTimerFunction);
                DOTween.Kill(this.item);
                //starImg.TweenScale (new Vector2 (1.2f, 1.2f), 0.5f);
                TimerManager.inst.Remove(effect);
                effect = TimerManager.inst.Add(0.1f, 1, (float eee) => {
                    if (this.group == null)
                    {
                        return;
                    }
                    if (canClick)
                    {
                        if (_id.StartsWith("C") && _id != Config.ASSET_CARD)
                        {
                            comIcon.SetData(_id, _num, 2);
                            CardVo ava = DataManager.inst.GetCardVo(_id);
                            if (ava.lv == 1 && ava.exp == Convert.ToInt32(_num))
                            {
                                item.GetChild("n13").asTextField.visible = true;
                            }
                            ComProgressBar pro = item.GetChild("n8") as ComProgressBar;
                            mpro      = pro;
                            pro.max   = ava.maxExp;
                            pro.value = ava.exp;
                            upImg     = item.GetChild("n11").asImage;
                            if (pro.max <= pro.value)
                            {
                                EffectManager.inst.TweenJump(upImg, 1f);
                                upImg.visible = true;
                                pro.skin      = ComProgressBar.BAR6;
                            }
                            else
                            {
                                pro.skin = ComProgressBar.BAR3;
                            }
                        }
                        else
                        {
//								comIcon.SetData (_id,ModelManager.inst.userModel.GetIconNumNow (_id));
                            if (_id == Config.ASSET_GOLD)
                            {
                                mpro         = item.GetChild("n6").asCom;
                                mprotxt      = item.GetChild("n6").asCom.GetChild("n0").asTextField;
                                mprotxt.text = ModelManager.inst.userModel.GetIconNumNow(_id).ToString();
                            }
                            else if (_id == Config.ASSET_COIN)
                            {
                                mpro         = item.GetChild("n7").asCom;
                                mprotxt      = item.GetChild("n7").asCom.GetChild("n0").asTextField;
                                mprotxt.text = ModelManager.inst.userModel.GetIconNumNow(_id).ToString();
                            }
                            else if (_id == Config.ASSET_ELSCORE)
                            {
                                mpro    = item.GetChild("n9").asCom;
                                mprotxt = item.GetChild("n9").asCom.GetChild("n1").asTextField;
                                maxExp  = (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1];
                                comIcon.SetData(_id, (ModelManager.inst.userModel.GetIconNumNow(_id) + Convert.ToInt32(_num) > (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1] ? (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1] : ModelManager.inst.userModel.GetIconNumNow(_id) + Convert.ToInt32(_num)));
                                (mpro as ComProgressBar).value = (ModelManager.inst.userModel.GetIconNumNow(_id) + Convert.ToInt32(_num) > (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1] ? (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1] : ModelManager.inst.userModel.GetIconNumNow(_id) + Convert.ToInt32(_num));
                                (mpro as ComProgressBar).max   = maxExp;
                                if ((mpro as ComProgressBar).value == (mpro as ComProgressBar).max)
                                {
                                    ColorFilter gggg = new ColorFilter();
                                    (mpro as ComProgressBar).GetBar().filter = gggg;
                                    gggg.Reset();
                                    gggg.AdjustBrightness(0.1f);
                                    gggg.AdjustContrast(0.5f);
                                    gggg.AdjustSaturation(0.5f);
                                    gggg.AdjustHue(-0.2f);
                                }
//									mprotxt.text = (ModelManager.inst.userModel.GetIconNumNow (_id)+Convert.ToInt32(_num)>(int)((object[])DataManager.inst.systemSimple["el_score"])[1]?(int)((object[])DataManager.inst.systemSimple["el_score"])[1]:ModelManager.inst.userModel.GetIconNumNow (_id)+Convert.ToInt32(_num))+"/"+(int)((object[])DataManager.inst.systemSimple["el_score"])[1];
                            }
                            else if (_id == Config.ASSET_RANKSCORE)
                            {
                                mpro         = item.GetChild("n14").asCom;
                                mprotxt      = item.GetChild("n14").asCom.GetChild("n2").asTextField;
                                mprotxt.text = ModelManager.inst.userModel.GetIconNumNow(_id).ToString();
                            }
                        }
                    }
                    else
                    {
                        if (_id.StartsWith("C") && _id != Config.ASSET_CARD)
                        {
                            try{
                                CardVo ava = DataManager.inst.GetCardVo(_id);
                                if (ava.lv == 1 && ava.exp == Convert.ToInt32(_num))
                                {
                                    item.GetChild("n13").asTextField.visible = true;
                                    ClickBtn.touchable = false;
                                    TimerManager.inst.Add(1.5f, 1, (float ff) => {
                                        ClickBtn.touchable = true;
                                    });
                                }

                                ComProgressBar pro = item.GetChild("n8") as ComProgressBar;
                                mpro      = pro;
                                pro.max   = ava.maxExp;
                                pro.value = ava.exp - Convert.ToInt32(_num);
                                if (pro.max <= pro.value)
                                {
                                    pro.skin = ComProgressBar.BAR6;
                                }
                                else
                                {
                                    pro.skin = ComProgressBar.BAR3;
                                }
                                upImg = item.GetChild("n11").asImage;
                                if (ava.lv == ava.maxLv && ava.exp == ava.maxExp)
                                {
                                    pro.value = ava.exp;
                                }
                                else
                                {
                                    MoveToCard(ava.exp - Convert.ToInt32(_num), ava.exp);
                                }
                            }catch (Exception ex) {}
                        }
                        else
                        {
                            try{
                                if (_id == Config.ASSET_GOLD)
                                {
                                    mpro         = item.GetChild("n6").asCom;
                                    mprotxt      = item.GetChild("n6").asCom.GetChild("n0").asTextField;
                                    mprotxt.text = (ModelManager.inst.userModel.GetIconNumNow(_id) - Convert.ToInt32(_num)).ToString();
                                }
                                else if (_id == Config.ASSET_COIN)
                                {
                                    mpro         = item.GetChild("n7").asCom;
                                    mprotxt      = item.GetChild("n7").asCom.GetChild("n0").asTextField;
                                    mprotxt.text = (ModelManager.inst.userModel.GetIconNumNow(_id) - Convert.ToInt32(_num)).ToString();
                                }
                                else if (_id == Config.ASSET_RANKSCORE)
                                {
                                    mpro         = item.GetChild("n14").asCom;
                                    mprotxt      = item.GetChild("n14").asCom.GetChild("n2").asTextField;
                                    mprotxt.text = (ModelManager.inst.userModel.GetIconNumNow(_id) - Convert.ToInt32(_num)).ToString();
                                }
                                else if (_id == Config.ASSET_ELSCORE)
                                {
                                    mpro    = item.GetChild("n9").asCom;
                                    mprotxt = item.GetChild("n9").asCom.GetChild("n1").asTextField;
                                    maxExp  = (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1];
                                    (mpro as ComProgressBar).value = ModelManager.inst.userModel.GetIconNumNow(_id);
                                    (mpro as ComProgressBar).max   = maxExp;
//									mprotxt.text = ModelManager.inst.userModel.GetIconNumNow (_id) + "/"+ maxExp;
                                    int tem = (ModelManager.inst.userModel.GetIconNumNow(_id) + Convert.ToInt64(_num) > (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1] ? (int)((object[])DataManager.inst.systemSimple ["el_score"]) [1] : ModelManager.inst.userModel.GetIconNumNow(_id) + Convert.ToInt32(_num));
                                    MoveToExp(ModelManager.inst.userModel.GetIconNumNow(_id), tem);
                                }
                                if (_id.StartsWith("s") && _id != Config.ASSET_ELSCORE && _id != Config.ASSET_RANKSCORE || _id == Config.ASSET_ELSCORE)
                                {
                                }
                                else
                                {
                                    MoveToExp(ModelManager.inst.userModel.GetIconNumNow(_id) - Convert.ToInt32(_num), ModelManager.inst.userModel.GetIconNumNow(_id));
                                }
                            }catch (Exception exx) {}
                        }
                    }
                    try{
                        if (name != null)
                        {
                            name.visible = true;
                        }
                        if (info != null)
                        {
                            info.visible = true;
                        }
//						num.visible = true;
                        if (starImg != null)
                        {
                            starImg.visible = true;
                        }
//						canClick = false;
                    }catch (Exception exxx) {}
                });
            });
        });
        //		});
        return(_id);
    }
Exemplo n.º 4
0
    private void showItem(Dictionary <string, object> data, bool isKuai = false)
    {
        step2 = false;
        //
        TimerManager.inst.Remove(TimerFunction);
        //
        this.item = Tools.GetComponent(Config.RED_GIFT).asCom;

        (item.GetChild("n8") as ComProgressBar).skin    = ComProgressBar.BAR3;
        (item.GetChild("n8") as ComProgressBar).offsetY = 5;
        (item.GetChild("n9") as ComProgressBar).skin    = ComProgressBar.BAR9;
        (item.GetChild("n9") as ComProgressBar).offsetY = -3;
        item.GetChild("n13").asTextField.text           = Tools.GetMessageById("24125");
        Controller c2 = item.GetController("c2");

        this.AddChildAt(this.item, 3);
        item.x = Tools.offectSetX(580f);
        item.y = 200f;

        string _id  = "";
        string _num = "";

        foreach (string id in data.Keys)
        {
            _id  = id;
            _num = data [id].ToString();
        }
        GTextField name = item.GetChild("n1").asTextField;
        GTextField info = item.GetChild("n2").asTextField;
        GTextField num  = item.GetChild("n3").asTextField;

        starImg = item.GetChild("n5").asGraph;

        //		TimerManager.inst.Add (0.01f, 0,OnStarImgRatation);
        starImg.TweenScale(new Vector2(1.2f, 1.2f), 0.2f);
        if (isLegend)
        {
            EffectManager.inst.AddPrefab("Legendcard/legendcard", starImg);
            //TimerManager.inst.Remove(eff);
        }
        else
        {
            GameObject go = EffectManager.inst.AddPrefab("Normalcard/normalcard", starImg);
            //go.transform.localScale*=1.2f;
            go.transform.localPosition = (new Vector3(15, 0, 0));
        }
        name.text = _id;

        if (_id.StartsWith("C") && _id != Config.ASSET_CARD)
        {
            num.text = "x" + _num;
            CardVo ava = DataManager.inst.GetCardVo(_id);
            name.text        = Tools.GetMessageById(ava.name);
            info.text        = CardVo.GetRarityMss(ava.rarity, 1);
            c2.selectedIndex = 2;
            ComProgressBar pro = item.GetChild("n8") as ComProgressBar;
            mpro    = pro;
            pro.max = ava.maxExp;

            if (ava.lv == 1 && ava.exp == Convert.ToInt32(_num) && isNew)
            {
                item.GetChild("n13").asTextField.visible = true;
                isNew = false;
            }
            upImg = item.GetChild("n11").asImage;
            if (isKuai)
            {
                pro.value = ava.exp;
                if (pro.max <= pro.value)
                {
                    upImg.visible = true;
                    pro.skin      = ComProgressBar.BAR6;
                }
                else
                {
                    upImg.visible = false;
                    pro.skin      = ComProgressBar.BAR3;
                }
            }
            else
            {
                pro.value = ava.exp - Convert.ToInt32(_num);
                if (pro.max <= pro.value)
                {
                    upImg.visible = true;
                    pro.skin      = ComProgressBar.BAR6;
                }
                else
                {
                    upImg.visible = false;
                    pro.skin      = ComProgressBar.BAR3;
                }
                if (ava.lv == ava.maxLv && ava.exp == ava.maxExp)
                {
                    pro.value = ava.exp;
                }
                else
                {
                    MoveToCard(Convert.ToInt32(pro.value), ava.exp);
                }
            }
        }
        else if (_id.StartsWith("s") && _id != Config.ASSET_ELSCORE && _id != Config.ASSET_RANKSCORE)
        {
            info.text = Tools.GetMessageById("24110");
            num.text  = "x" + _num;
        }
        else
        {
            if (_id == Config.ASSET_GOLD)
            {
                c2.selectedIndex = 0;
                item.GetChild("n6").asCom.GetChild("n0").asTextField.text = (_gold - Convert.ToInt32(_num)).ToString();
                mpro    = item.GetChild("n6").asCom;
                mprotxt = item.GetChild("n6").asCom.GetChild("n0").asTextField;
                if (!isKuai)
                {
                    MoveToExp(_gold - Convert.ToInt32(_num), _gold);
                }
                else
                {
                    mprotxt.text = _gold.ToString();
                }
            }
            else if (_id == Config.ASSET_COIN)
            {
                c2.selectedIndex = 1;
                item.GetChild("n7").asCom.GetChild("n0").asTextField.text = (_coin - Convert.ToInt32(_num)).ToString();
                mpro    = item.GetChild("n7").asCom;
                mprotxt = item.GetChild("n7").asCom.GetChild("n0").asTextField;
                if (!isKuai)
                {
                    MoveToExp(_coin - Convert.ToInt32(_num), _coin);
                }
                else
                {
                    mprotxt.text = _coin.ToString();
                }
            }
            else
            {
                c2.selectedIndex = 2;
            }
            name.text = Tools.GetIconName(_id);
            num.text  = "x" + _num;
            info.text = Tools.GetMessageById("21013");
            Dictionary <string, object> ddd = new Dictionary <string, object> ();
            ddd.Add(_id, _num);
        }
    }