コード例 #1
0
    private void MoveToCardNum(int num)
    {
        ComProgressBar com = mpro as ComProgressBar;

        if (com.value >= num)
        {
            com.value = num;
            if (com.max <= com.value)
            {
                upImg.visible = true;
                EffectManager.inst.TweenJump(upImg, 1f);
            }
            return;
        }
        upImg.visible = false;
        com.value     = (com.value + cha);
        if (com.max <= com.value)
        {
            com.skin = ComProgressBar.BAR6;
        }
        else
        {
            com.skin = ComProgressBar.BAR3;
        }
        com.TweenScaleX(1.1f, 0.05f).OnComplete(() =>
        {
            com.TweenScaleX(1f, 0.05f).OnComplete(() =>
            {
                MoveToCardNum(num);
            });
        });
    }
コード例 #2
0
    public override void Init()
    {
        base.Init();
        Create(Config.VIEW_ROLEMICRO);
        btnMicroReStart    = GetChild("n7").asButton;
        btnMicroStart      = GetChild("n5").asButton;
        btnMicroStop       = GetChild("n8").asButton;
        textMicro          = GetChild("n3").asTextField;
        textMicro.text     = Tools.GetMessageById("13162");
        btnMicroUpload     = GetChild("n6").asButton;
        progressMicro      = this.GetChild("n4").asCom as ComProgressBar;
        progressMicro.skin = ComProgressBar.BAR12;
        progressMicro.SetTextVisible(false);
        progressMicro.value = 0;
        progressMicro.max   = 100;
        timeMicro           = GetChild("n2").asTextField;
        timeMicro2          = GetChild("n11").asTextField;
        timeMicro1          = GetChild("n12").asTextField;
        btnMicroStart.onClick.Add(BtnMicroStart);

        btnMicroStop.onClick.Add(BtnMicroStop);
        btnMicroUpload.onClick.Add(BtnMicroUpload);
        btnMicroReStart.onClick.Add(BtnMicroReStart);
        miro_time = (int)DataManager.inst.systemSimple["miro_time"] * 1000;
    }
コード例 #3
0
    private void setItemData(string id)
    {
        Dictionary <string, object> cfg = DataManager.inst.systemSimple;
        GLoader        ra   = this.GetChild("n8").asLoader;
        GLoader        icon = this.GetChild("n9").asLoader;
        ComProgressBar pro  = this.GetChild("n10") as ComProgressBar;

        proBar = pro.GetBar();

        ra.url   = Tools.GetResourceUrl("Image:bg_kapai" + card.rarity);
        icon.url = Tools.GetResourceUrl("Icon:" + id);

        GTextField proText = pro.GetChild("n1").asTextField;

        Dictionary <string, object> exp_cfg = (Dictionary <string, object>)(cfg ["card_lv_exp"]);

        exp_cfg = (Dictionary <string, object>)exp_cfg [card.rarity + ""];

        pro.max   = card.maxExp;
        pro.value = card.exp;
        if (card.lv >= card.maxLv)
        {
            proText.color = new Color(1, 1, 0);
        }
        else
        {
            if (card.exp < card.maxExp)
            {
                pro.skin = ComProgressBar.BAR3;
            }
            else
            {
                pro.skin = ComProgressBar.BAR4;
            }
        }
    }
コード例 #4
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);
        });
    }
コード例 #5
0
    public override void Init()
    {
        base.Init();
        this.isAutoClose = false;
        this.Create(Config.VIEW_TEAMMATCH, false);

//		PlatForm.inst.timeout = 20000f;

        fightModel = ModelManager.inst.fightModel;
        roleModel  = ModelManager.inst.roleModel;
        userModel  = ModelManager.inst.userModel;

        fightModel.fightType = ModelFight.FIGHT_MATCHTEAM;

        list           = this.GetChild("n2").asList;
        btn_Enter      = this.GetChild("n3").asButton;
        btn_Enter.text = Tools.GetMessageById("25062");
        btn_Invite     = this.GetChild("n4").asButton;
        c1             = this.GetController("c1");
        text1          = this.GetChild("n7").asTextField;
        text2          = this.GetChild("n8").asTextField;

        text3 = this.GetChild("n9").asTextField;
        //
        btn_Cancel      = this.GetChild("n6").asButton;
        btn_Cancel.text = Tools.GetMessageById("14025");
        btn_Quit        = this.GetChild("n29").asTextField;
        btn_Chat        = this.GetChild("n18").asButton;
        //btn_Chat.text = Tools.GetMessageById("25067");
        btn_Mil = this.GetChild("n19").asButton;
        btn_Mil.GetChild("n2").asTextField.text = Tools.GetMessageById("25067");
        bar      = this.GetChild("n20").asCom as ComProgressBar;
        bar.skin = ComProgressBar.BAR10;
        bar.SetTextVisible(false);
        bar.value = 0;
        bar.max   = 100;

        btn_Close = this.GetChild("close").asButton;
        btn_Close.onClick.Add(this.Close);
        //
        this.GetChild("title").asTextField.text = Tools.GetMessageById("25033");
        //
        btn_Enter.onClick.Add(Enter_Click);
        btn_Invite.onClick.Add(Invite_Click);
        btn_Cancel.onClick.Add(Cancel_Click);
//		btn_Quit.onClick.Add (Quit_Click);
        btn_Quit.text = Tools.GetMessageById("25058");
        btn_Chat.onClick.Add(Chat_Click);
        btn_Mil.onClick.Add(Chat_Click_Over);
        fightModel.isMatch = false;

        //麦克风功能
        micro = new MediatorMicro();
        ViewManager.inst.AddTopView(micro);
        //房间内部操作
        NetSocket.inst.AddListener(NetBase.SOCKET_TEAMMATCH, (VoSocket vo) =>
        {
//				Debug.LogError("NetSocket.inst.AddListener");
            if (vo.data is Boolean)
            {
                bool isOk = Convert.ToBoolean(vo.data);
                if (!isOk)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("25026"));
                    TimerManager.inst.Remove(Time_Tick);
                    fightModel.isMatch = false;
                    list.numItems      = 4;
                    if (fightModel.isLeader)
                    {
                        c1.selectedIndex = 0;
                    }
                    else
                    {
                        c1.selectedIndex = 1;
                    }
                }
            }
            else
            {
                Dictionary <string, object> data = (Dictionary <string, object>)vo.data;
                fightModel.team1 = (object[])data ["team"];
                list.numItems    = 4;             //fightModel.team1.Length;

                c1.selectedIndex = 4;
                this.closeEnable = false;
                text3.text       = Tools.GetMessageById("25064");
                TimerManager.inst.Add(5f, 1, (float t) =>
                {
                    TimerManager.inst.Remove(Time_Tick);
                    c1.selectedIndex = 4;
                    //					Log.debug ("准备开始 - " + vo.data.ToString ());

                    DispatchManager.inst.Dispatch(new MainEvent(MainEvent.START_FIGHT, data));
                });
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_STARTMATCHPUSH, (VoSocket vo) =>
        {
            fightModel.isMatch = true;
            list.numItems      = 4;       //fightModel.team1.Length;

//			NetSocket.inst.RemoveListener (NetBase.SOCKET_STARTMATCH);
            if (fightModel.isLeader)
            {
                c1.selectedIndex = 2;
            }
            else
            {
                c1.selectedIndex = 3;
            }

            fightModel.preTime   = Convert.ToInt32(vo.data);
            fightModel.matchTime = 0;
//			Log.debug ("开始匹配 - " + fightModel.preTime.ToString ());
            if (fightModel.isLeader)
            {
                text1.text = Tools.GetMessageById("25005", new string[] {
                    fightModel.preTime.ToString(),
                    fightModel.matchTime.ToString()
                });
            }
            else
            {
                text2.text = Tools.GetMessageById("25005", new string[] {
                    fightModel.preTime.ToString(),
                    fightModel.matchTime.ToString()
                });
            }
            TimerManager.inst.Add(1f, 0, Time_Tick);
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25013"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_ACCEPTINVITEOTHER, (VoSocket vo) =>
        {
            string uid    = fightModel.AddTeam(vo.data);
            list.numItems = 4;            //fightModel.team1.Length;
            ViewManager.inst.ShowText(Tools.GetMessageById("25012", new String[] { uid }));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_KILLTEAMPUSH, (VoSocket vo) =>
        {
            fightModel.Clear();
            ViewManager.inst.CloseView(this);
            ViewManager.inst.ShowText(Tools.GetMessageById("25008"));
//			Log.debug ("解散队伍 - " + vo.data.ToString ());
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_QUITTEAMPUSH, (VoSocket vo) =>
        {
//			if (vo.data is Boolean && !Convert.ToBoolean (vo.data))
//			{
//				ViewManager.inst.ShowText (Tools.GetMessageById ("25016"));
//				return;
//			}
            string uid = vo.data.ToString();
            if (userModel.uid == uid)
            {
                ViewManager.inst.CloseView(this);
                ViewManager.inst.ShowText(Tools.GetMessageById("25011"));
//				Log.debug ("退出队伍 - " + vo.data.ToString ());
            }
            else
            {
                fightModel.ChangeTeam(vo.data);
                list.numItems = 4;
                if (fightModel.isLeader)
                {
                    c1.selectedIndex = 0;
                }
                else
                {
                    c1.selectedIndex = 1;
                }
                this.btn_Enter.enabled = false;
                TimerManager.inst.Add(2f, 1, (float t) =>
                {
                    this.btn_Enter.enabled = true;
                });
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CANCELMATCHPUSH, (VoSocket vo) =>
        {
            if (!Convert.ToBoolean(vo.data))
            {
                return;
            }
            fightModel.isMatch = false;
            if (fightModel.isLeader)
            {
                c1.selectedIndex = 0;
            }
            else
            {
                c1.selectedIndex = 1;
            }
            TimerManager.inst.Remove(Time_Tick);
            ViewManager.inst.ShowText(Tools.GetMessageById("25015"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_MATCHTEAMCHATPUSH, (VoSocket vo) =>
        {
            if (userModel.IsChatVoice())
            {
                fightModel.AddMicro(vo.data);
            }
        });

        this.AddGlobalListener(MainEvent.SOCKET_CLOSE, (MainEvent e) =>
        {
            this.Close();
        });
        //
        this.InitData();
    }
コード例 #6
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);
    }
コード例 #7
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_EXPLORE);

        this.x = ModelManager.inst.gameModel.width;
        this.y = 0;

        ExpCfg      = DataManager.inst.explore;
        userModelr  = ModelManager.inst.userModel;
        userExplore = (Dictionary <string, object>)(userModelr.records ["explore"]);

        close = this.GetChild("n7").asButton;
        close.onClick.Add(OnOverFunction);
        RanderBox0x = this.GetChild("n2").asCom;
        RanderBox0  = RanderBox0x.GetChild("n0").asButton;
        RanderBox0.onClick.Add(OnClickRanderBox1);
        RanderBox1x = this.GetChild("n3").asCom;
        RanderBox1  = RanderBox1x.GetChild("n0").asButton;
        RanderBox1.onClick.Add(OnClickRanderBox2);
        RanderBox2x = this.GetChild("n4").asCom;
        RanderBox2  = RanderBox2x.GetChild("n0").asButton;
        RanderBox2.onClick.Add(OnClickRanderBox3);

        move = this.GetChild("n8").asGraph;

        pro_pro = this.GetChild("n5") as ComProgressBar;
        ViewManager.inst.AddTouchTip(Config.TOUCH_PROGRESSBAR, pro_pro, Config.TOUCH_COMELSCORE);
        pro_pro.skin    = ComProgressBar.BAR9;
        pro_pro.offsetY = -2;
        fill            = pro_pro.GetBar();
        ColorFilter gggg = new ColorFilter();

        fill.filter = gggg;
        gggg.Reset();
        pro_pro.value = userModelr.el_score;
        pro_pro.max   = (int)(((object[])DataManager.inst.systemSimple ["el_score"]) [1]);
        if (userModelr.el_score == (int)(((object[])DataManager.inst.systemSimple ["el_score"]) [1]))
        {
            gggg.AdjustBrightness(0.1f);
            gggg.AdjustContrast(0.5f);
            gggg.AdjustSaturation(0.5f);
            gggg.AdjustHue(-0.2f);
        }

        this.AddGlobalListener(MainEvent.EXPLORE_UNLOCK, OnUnlockHandler);
        this.AddGlobalListener(MainEvent.EXPLORE_GIFT, OnGiftHandler);
        this.AddGlobalListener(MainEvent.MAIN_EXPLORE, OnMainExploreFush);
        this.AddGlobalListener(MainEvent.JUMP_ELSCORE, Onfunction);
        if (userExplore ["index"] != null)
        {
            DateTime overTime = (DateTime)userExplore ["time"];
            if (Tools.GetSystemTicks() > overTime.Ticks)
            {
                type = 2;
            }
            else
            {
                type = 1;
                TimerManager.inst.Add(1f, 0, Time_Tick);
                Time_Tick(0f);
            }
        }
        else
        {
            type = 0;
        }
        setBoxData(RanderBox0x, (object[])(((object[])userExplore ["el_ids"]) [0]), 0);
        setBoxData(RanderBox1x, (object[])(((object[])userExplore ["el_ids"]) [1]), 1);
        setBoxData(RanderBox2x, (object[])(((object[])userExplore ["el_ids"]) [2]), 2);

        this.visible = false;
    }
コード例 #8
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);
        }
    }
コード例 #9
0
    public override void Init()
    {
        base.Init();
        this.isAutoClose = false;
        this.Create(Config.VIEW_FREEMATCH, false, Tools.GetMessageById("25024"));

        fightModel           = ModelManager.inst.fightModel;
        userModel            = ModelManager.inst.userModel;
        fightModel.fightType = ModelFight.FIGHT_FREEMATCH1;

//		PlatForm.inst.timeout = 2f;

//		title = view.GetChild ("n1").asTextField;
        btn_Change = this.GetChild("n2").asButton;
        btn_Start  = this.GetChild("n12").asButton;
        btn_Invite = this.GetChild("n13").asButton;

        btn_Change.text = Tools.GetMessageById("33209");
        btn_Start.text  = Tools.GetMessageById("33210");
        btn_Invite.text = Tools.GetMessageById("33211");

        btn_Quit = this.GetChild("n16").asButton;
        btn_Clos = this.GetChild("n31").asButton;
        btn_Bot  = this.GetChild("n11").asButton;
        btn_Chat = this.GetChild("n19").asButton;
        c1       = this.GetController("c1");
        btn_Mil  = this.GetChild("n28").asButton;
        bar      = this.GetChild("n29").asCom as ComProgressBar;
        bar.skin = ComProgressBar.BAR10;
        bar.SetTextVisible(false);
        bar.value = 0;
        bar.max   = 100;

        item0 = this.GetChild("n3").asCom;
        item1 = this.GetChild("n4").asCom;
        item2 = this.GetChild("n5").asCom;
        item3 = this.GetChild("n6").asCom;
        item4 = this.GetChild("n7").asCom;
        item5 = this.GetChild("n8").asCom;
        item6 = this.GetChild("n9").asCom;
        item7 = this.GetChild("n10").asCom;
        help  = this.GetChild("n30").asButton;

        btn_Invite.onClick.Add(Invite_Click);
        btn_Clos.onClick.Add(Close_Click);
        btn_Change.onClick.Add(Change_Click);
        btn_Start.onClick.Add(Start_Click);
        btn_Bot.onClick.Add(Bot_Click);
        btn_Chat.onClick.Add(Chat_Click);
        btn_Quit.onClick.Add(Close_Click);
        help.onClick.Add(Help_Click);

        userModel.GetUnlcok(Config.UNLOCK_FREEMATCH2, btn_Change);

//		public int[] freeType1 = new int[]{ 0, 1, 2, 3, 4, 5, 6, 7 };
//		public int[] freeType2 = new int[]{ 0, 1, 4, 5, 2, 3, 6, 7 };
        if (fightModel.freeType == 1)
        {
            items = new GComponent[8] {
                item0, item1, item2, item3, item4, item5, item6, item7
            }
        }
        ;
        else
        {
            items = new GComponent[8] {
                item0, item1, item4, item5, item2, item3, item6, item7
            }
        };
        this.SetDefault();
        if (fightModel.isRequest)
        {
            NetSocket.inst.AddListener(NetBase.SOCKET_NEWROOM, (VoSocket vo) =>
            {
                NetSocket.inst.RemoveListener(NetBase.SOCKET_NEWROOM);
                fightModel.CreateFreeTeam(vo.data);
                UpdateItems();
                CheckMode();
                btn_Bot.visible = fightModel.isLeader;
            });

            Dictionary <string, object> data = new Dictionary <string, object> ();
            data ["mode"] = fightModel.freeType;
            NetSocket.inst.Send(NetBase.SOCKET_NEWROOM, data);
        }
        else
        {
            CheckMode();
            UpdateItems();
            btn_Bot.visible = fightModel.isLeader;
        }

        micro = new MediatorMicro();
        ViewManager.inst.AddTopView(micro);
//		micro.visible = false;

        NetSocket.inst.AddListener(NetBase.SOCKET_ADDUSER, (VoSocket vo) =>
        {
            fightModel.ChangeFreeTeam(vo.data);
            UpdateItems();
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_REMOVEUSER, (VoSocket vo) =>
        {
            bool b = fightModel.DelFreeTeam(vo.data);
            if (b)
            {
                fightModel.Clear();
                ViewManager.inst.CloseView(this);
                ViewManager.inst.ShowText(Tools.GetMessageById("25011"));
            }
            else
            {
                UpdateItems();
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_KILLROOMPUSH, (VoSocket vo) =>
        {
            fightModel.Clear();
            ViewManager.inst.CloseView(this);
            ViewManager.inst.ShowText(Tools.GetMessageById("25008"));
            Log.debug("解散队伍");
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_FREESTARTMATCHPUSH, (VoSocket vo) =>
        {
            if (fightModel.freeType == 1)
            {
                fightModel.fightType = ModelFight.FIGHT_FREEMATCH1;
            }
            else
            {
                fightModel.fightType = ModelFight.FIGHT_FREEMATCH2;
            }
            Log.debug("进入战斗");
            ViewManager.inst.ShowScene <MediatorFightWorld> (true);
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CHANGEMODEPUSH, (VoSocket vo) =>
        {
            Dictionary <string, object> da = (Dictionary <string, object>)vo.data;
            fightModel.freeType            = Convert.ToInt32(da ["new_mode"]);
            CheckMode(true);
            Log.debug("更换模式");
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25021"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CHANGEPOSPUSH, (VoSocket vo) =>
        {
            fightModel.RepalceFreeTeam(vo.data);
            CheckMode(true);
            Log.debug("更换位置");
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25021"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_FREECHATPUSH, (VoSocket vo) =>
        {
            if (userModel.IsChatVoice())
            {
                fightModel.AddMicro(vo.data);
            }
        });

        this.AddGlobalListener(MainEvent.SOCKET_CLOSE, (MainEvent e) =>
        {
            this.Close();
        });
    }