Esempio n. 1
0
    private void OnRenderList(int index, GObject go)
    {
        go.alpha = 1;
        go.scale = new Vector2(1f, 1f);
        Dictionary <string, object> _da = (Dictionary <string, object>)lisData [index];
        ComBigIcon     icon             = go.asCom.GetChild("n8") as ComBigIcon;
        ComProgressBar progress         = go.asCom.GetChild("n7") as ComProgressBar;
        GTextField     name             = go.asCom.GetChild("n1").asTextField;
        GTextField     info             = go.asCom.GetChild("n3").asTextField;
        GButton        btn = go.asCom.GetChild("n0").asButton;
        Controller     c1  = go.asCom.GetController("c1");
        GImage         bg  = go.asCom.GetChild("n10").asImage;

        name.text        = Tools.GetMessageById(_da ["name"].ToString());
        info.text        = Tools.GetMessageById(_da ["info"].ToString(), GetTypeByObj(_da ["type"].ToString(), (object[])_da ["need"]));
        progress.skin    = ComProgressBar.BAR5;
        progress.offsetY = 5;
//		ColorFilter gggg = btn.GetChild ("n0").asImage.filter as ColorFilter;
//		gggg.Reset ();


        bool isCard = false;
        Dictionary <string, object> gfit = new Dictionary <string, object> ();
        string giftType = "";

        foreach (string str in ((Dictionary <string, object>)_da["reward"]).Keys)
        {
            if (str == Config.ASSET_CARD)
            {
                isCard = true;
            }
            giftType = str;
            gfit.Add(str, ((Dictionary <string, object>)_da ["reward"]) [str]);
            break;
        }
        if (isCard)
        {
            icon.SetSelectIndex(1);
            icon.SetData(((object[])gfit [Config.ASSET_CARD]) [0].ToString(), ((object[])gfit [Config.ASSET_CARD]) [1].ToString(), 4);
        }
        else
        {
            icon.SetSelectIndex(2);
            icon.SetData(giftType, gfit [giftType]);
        }
        progress.max   = (int)((object[])_da ["need"]) [(((object[])_da ["need"]).Length) - 1];
        progress.value = (int)(_da ["rate"]);

        btn.RemoveEventListeners();
        bool isclick = false;

        btn.onTouchBegin.Add(() =>
        {
            isclick  = true;
            go.scale = new Vector2(0.95f, 0.95f);
        });
        btn.onTouchEnd.Add(() =>
        {
            isclick  = false;
            go.scale = new Vector2(1f, 1f);
        });
        btn.onRollOut.Add(() =>
        {
            if (isclick)
            {
                go.scale = new Vector2(1f, 1f);
            }
        });
        go.asCom.GetChild("n9").asTextField.text  = Tools.GetMessageById("23012");
        progress.GetChild("n1").asTextField.color = Tools.GetColor("E8FCD9");
        if (progress.value >= progress.max)
        {
            btn.touchable    = true;
            c1.selectedIndex = 1;
            EffectManager.inst.TweenHuXi(go.asCom.GetChild("n9").asTextField, 3f);
            bg.color = Tools.GetColor("#FFFF99");
//			EffectManager.inst.SetColorShader (btn.displayObject.gameObject, "FFFF00");
//			gggg.AdjustBrightness (0.1f);
//			gggg.AdjustContrast (0.5f);
//			gggg.AdjustSaturation (0.5f);
//			gggg.AdjustHue (-0.2f);
        }
        else
        {
            btn.touchable = false;
//			btn.GetController ("c1").selectedIndex = 0;
            c1.selectedIndex = 0;
        }
        btn.onClick.Add(() =>
        {
            SoundManager.inst.PlaySound(Config.SOUND_MISSIONREWARD);
            btn.touchable  = false;
            this.touchable = false;
            moveGo         = go;
            nowGift        = gfit;
            nowIndex       = index;

            if (ModelManager.inst.guideModel.CheckEffort() == 2 && items.Count == 1)
            {
                if (GuideManager.inst.Check("100:1"))
                {
                    GuideManager.inst.Next();
                }
            }
            NetHttp.inst.Send(NetBase.HTTP_GETEFFORTREWARD, "index=" + (int)(_da ["index"]), GetReward);
        });
    }
Esempio n. 2
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);
    }