Пример #1
0
        private void RefreshHeroInfo(object sender, GameEventArgs e)
        {
            RefreshHeroInfoEventArgs ne = e as RefreshHeroInfoEventArgs;

            switch (ne.Type)
            {
            case RefreshType.Name:
                m_Name.text = ne.Name;
                break;

            case RefreshType.Level:
                m_Level.text = GlobalTools.Format("LV.{0}", ne.Level);
                break;

            case RefreshType.Hp:
                if (ne.MaxHp != 0)
                {
                    m_Hp.value = 100 * (float)ne.CurHp / ne.MaxHp;
                    m_Hp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.CurHp, ne.MaxHp);
                }
                break;

            case RefreshType.Mp:
                if (ne.MaxMp != 0)
                {
                    m_Mp.value = 100 * (float)ne.CurMp / ne.MaxMp;
                    m_Mp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.CurMp, ne.MaxMp);
                }
                break;

            case RefreshType.Exp:
                if (ne.MaxExp != 0)
                {
                    m_Exp.fillAmount = (float)ne.CurExp / ne.MaxExp;
                }
                break;

            case RefreshType.All:
                m_Name.text  = ne.Name;
                m_Level.text = GlobalTools.Format("LV.{0}", ne.Level);
                if (ne.MaxHp != 0)
                {
                    m_Hp.value = 100 * (float)ne.Attribute.Hp / ne.Attribute.MaxHp;
                    m_Hp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.Attribute.Hp, ne.Attribute.MaxHp);
                }
                if (ne.MaxMp != 0)
                {
                    m_Mp.value = 100 * (float)ne.Attribute.Mp / ne.Attribute.MaxMp;
                    m_Mp.GetChild("title").asTextField.text = GlobalTools.Format("{0}/{1}", ne.Attribute.Mp, ne.Attribute.MaxMp);
                }
                if (ne.MaxExp != 0)
                {
                    m_Exp.fillAmount = (float)ne.CurExp / ne.MaxExp;
                }
                break;
            }
        }
Пример #2
0
 /// <summary>
 /// 设置自己的名字
 /// </summary>
 /// <param name="pos"></param>
 public void NameSetSelf()
 {
     if (posCode == PosCode.L)
     {
         HpL.GetChild("UserName").text = PhotonEngine.userName;
         InvokeRepeating("HpRestoreL", 0, 1);
     }
     else
     {
         HpR.GetChild("UserName").text = PhotonEngine.userName;
         InvokeRepeating("HpRestoreR", 0, 1);
     }
 }
Пример #3
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.COM_GOLDCOINEXP, true);
        this.width = GRoot.inst.width;

        userModel = ModelManager.inst.userModel;
        exp       = this.GetChild("n54").asProgress;
        gold      = this.GetChild("n2").asCom;
        coin      = this.GetChild("n1").asCom;

        name           = this.GetChild("n3").asTextField;
        lv             = this.GetChild("n12").asCom.GetChild("n2").asTextField;
        head           = this.GetChild("n12").asCom.GetChild("n0").asButton;
        head.touchable = false;
//		bar = view.GetChild ("n54") as ComProgressBar;

//		exp.skin = ComProgressBar.BAR8;
        exp.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji2");
        exp.value = userModel.exp;
        exp.max   = userModel.GetExpMax(userModel.lv);
        name.text = userModel.uname;
        lv.text   = userModel.lv.ToString();
        Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(userModel.head ["use"].ToString()));

        TimerManager.inst.Add(1f, 0, Over);
        this.AddGlobalListener(MainEvent.JUMP_COINGOLDEXPGET, Onfunction);
    }
Пример #4
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);

            m_HpBar   = UI.GetChild("bar_Hp").asProgress;
            m_BarText = m_HpBar.GetChild("title").asTextField;
            m_Name    = UI.GetChild("tf_Name").asTextField;
        }
Пример #5
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);

        lv     = this.GetChild("n6").asTextField;
        cardLv = this.GetChild("n9").asTextField;
        icon   = this.GetChild("n3").asLoader;
        bg     = this.GetChild("n4").asLoader;
        cardBg = this.GetChild("n0").asLoader;
        bar    = this.GetChild("n7").asProgress;
        up     = this.GetChild("n10").asImage;
        txt    = this.GetChild("n12").asTextField;
        n11    = this.GetChild("n11").asLoader;
        proBar = bar.GetChild("bar").asCom.GetChild("n0").asLoader;
//		bar.offsetY = 5;

        EffectManager.inst.AddPrefab(Config.EFFECT_DENGJI, this.GetChild("n15").asGraph).transform.localScale *= 1.1f;
        EffectManager.inst.AddPrefab(Config.EFFECT_K04, this.GetChild("n17").asGraph).transform.localScale    *= 1.1f;
        this.GetChild("n15").asGraph.visible = false;
        this.GetChild("n17").asGraph.visible = false;

        cfg = DataManager.inst.systemSimple;

//		GGraph ggg = this.GetChild ("n18").asCom.GetChild("n3").asGraph;//new GGraph ();
////		ggg.SetSize (200, 50);
////		ggg.x = 300;
////		ggg.y = 5;
//		float mm = 125f;
//		float cc = 5f;
//		float[] rgbA = new float[]{1f,0f,0f,125f,0f,0f};
//		float[] rgbB = new float[]{1f,1f,0f,125f,125f,0f};
//
//		Color ccs = Color.white;
//		Color ccs2 = Color.white;
//		Color[] ccc = new Color[]{ ccs, ccs, ccs2, ccs2 };
//		TimerManager.inst.Add (0.06f, 0, (float x) => {
//			rgbA = Tools.GetRGB(mm,cc,ref rgbA);
//			rgbB = Tools.GetRGB(mm,cc,ref rgbB);
//
//			ccs.r = rgbA[3]/mm;
//			ccs.g = rgbA[4]/mm;
//			ccs.b = rgbA[5]/mm;
//
//			ccs2.r = rgbB[3]/mm;
//			ccs2.g = rgbB[4]/mm;
//			ccs2.b = rgbB[5]/mm;
//			ccc[0] = ccs;
//			ccc[1] = ccs;
//			ccc[2] = ccs2;
//			ccc[3] = ccs2;
//
//			ggg.shape.DrawRect (0, ccc);
//
//		});


//		this.AddChild (ggg);
    }
Пример #6
0
 //设置为 玩家的敌人
 public void SetIsEnemy(bool enemy)
 {
     if (enemy == true)
     {
         if (m_HP != null)
         {
             m_HP.GetChild("bar").asGraph.color = new Color(192 / 255.0f, 50 / 255.0f, 0 / 255.0f);
         }
     }
     else
     {
         if (m_HP != null)
         {
             //m_HP.GetChild("bar").asGraph.color = new Color(80 / 255.0f, 146 / 255.0f, 57 / 255.0f);
             m_HP.GetChild("bar").asGraph.color = new Color(173 / 255.0f, 245 / 255.0f, 98 / 255.0f);
         }
     }
 }
Пример #7
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.COM_LAN, true);
        //GImage bg = this.GetChild ("n2").asImage;
        int num = Tools.GetRandom(0, 4);

        bg        = this.GetChild("n2").asLoader;
        bg.url    = Tools.GetResourceUrl("Load:qidongye" + num.ToString());
        bg.height = this.height;
        //ViewManager.bgOffsetW = bg.width * (bg.height / 640);
        //ViewManager.bgOffsetX = -(ViewManager.bgOffsetW - this.width) / 2;
        bg.width = ViewManager.bgOffsetW;
        bg.x     = ViewManager.bgOffsetX;
        //bar = this.GetChild ("n4").asCom as ComProgressBar;
        //bar.skin = ComProgressBar.BAR4;
        //bar.value = 0;
        //bar.max = 100;
        //bar.height = 46;
        //bar.side.height = 23;
        ////bar.GetChild("n1").asTextField.color= Tools.GetColor("bd2929");
        //bar.txt.color = Tools.GetColor("bd2929");
        //bar.txt.x = bar.x-bar.txt.width;
        //ViewManager.SetWidthHeight (this.GetChild ("n2"));
        //DOTween.To (() => bar.value, x => bar.value = x, 100f, 3f);
        //DOTween.To(() => bar.txt.x, x => bar.txt.x = x, bar.width-bar.txt.width, 3f);

        Probar = this.GetChild("n4").asProgress;
        Probar.GetChild("title").y += 2;
        Probar.value = 50;
        DOTween.To(() => Probar.value, x => Probar.value = x, 100f, 3f);
        gg = Probar.GetChild("n4").asGroup;
        TimerManager.inst.Add(2.8f, 1, (float ff) => {
            if (gg != null)
            {
                gg.visible = false;
            }
        });
    }
Пример #8
0
    void Update()
    {
        if (isGameing)
        {
            return;
        }
        if (isLoad)
        {
//			isLoad = false;
            StopCoroutine(LoadResource());
//			bar.value = 98;
//			Log.debug ("Load Texture " + (DateTime.Now.Ticks - time) / 10000 + "ms");

            //进入
            if (isLoadNum)
            {
                isGameing     = true;
                Main.loadView = this;
//				Debug.LogError("--------");
                GameObject.Find("Stage").AddComponent <Main> ();
            }
        }
//		else
//		{
//			if (bar.value == 98)
//				return;
        if (isLoadNum)
        {
            return;
        }

        cur      += 2f;
        bar.value = cur;
        if (cur > 97)
        {
            bar.GetChild("n4").visible = false;
        }
        if (cur >= 100)
        {
            cur = 100;
//				bar.value = cur;
            //bar.GetChild ("n4").visible = false;

            isLoadNum = true;
        }
//		}
    }
    public IEnumerator CreateLoadingPanelFromAssetBundle()
    {
        while (Caching.ready == false)
        {
            yield return(null);
        }
        Caching.ClearCache();
        string url = Util.AppContentPath() + "desc_load.unity3d";

        Debug.Log("--------------------AssetBundle加载Loading--------------------------------" + url);

        WWW www = WWW.LoadFromCacheOrDownload(url, 1);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            Debug.Log(www.error);
            yield break;
        }
        AssetBundle ab1 = www.assetBundle;

        string url2 = Util.AppContentPath() + "res_load.unity3d";

        Debug.Log("--------------------AssetBundle加载Loading--------------------------------" + url);
        www = WWW.LoadFromCacheOrDownload(url2, 1);
        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            Debug.Log(www.error);
            yield break;
        }
        AssetBundle ab2 = www.assetBundle;

        if (need)
        {
            UIPackage.AddPackage(ab1, ab2);
            gc = UIPackage.CreateObject("load", "startPanel").asCom;
            pb = gc.GetChild("progress").asProgress;
            gf = pb.GetChild("n3").asTextField;
            GRoot.inst.AddChild(gc);
            pb.value = 0;
            //如果想改变进度值有一个动态的过程
            // pb.TweenValue(100, 3f);
        }
    }
Пример #10
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_LOADFIGHT);
        float temp  = (view.root.height - view.height) / 2;
        float temp2 = (view.root.width - view.width) / 2;

        view.width  = view.root.width;
        view.height = view.root.height;
        int num = Tools.GetRandom(0, 4);

        bg        = this.GetChild("n0").asLoader;
        bg.url    = Tools.GetResourceUrl("Load:qidongye" + num.ToString());
        bg.height = view.height;
        //ViewManager.bgOffsetW = bg.width * (bg.height / 640);
        //ViewManager.bgOffsetX = -(ViewManager.bgOffsetW - view.width) / 2;

        bg.width = ViewManager.bgOffsetW;
        bg.x    -= temp2;
        bg.y     = -temp;
        bar      = this.GetChild("n4").asProgress;
        bar.x   -= temp2;
        bar.GetChild("title").y += 4;
        bar.value = 20;


        ls = ViewManager.LoadScene("snake", (float f) =>
        {
            Log.debug("LoadScene - " + f.ToString());
            float ff = f * 100;
            if (ff <= 20)
            {
                ff = 20;
            }
            if (ff >= 90)
            {
                ff = 90;
            }
            bar.value = ff;
            if (bar.value >= 90)
            {
                ls.Clear();
            }
        });
    }
Пример #11
0
    private void ShowLoader()
    {
        loader = UIPackage.CreateObject("Loader", "AssetsLoader").asLabel;
        compContainer.AddChild(loader);
        progress       = (GProgressBar)loader.GetChild("loaderBar");
        progress.value = 0;
        progress.max   = 100;
        progressBar    = (GProgressBar)loader.GetChild("progressBar");

        loadTxt      = (GTextField)progress.GetChild("txt_title");
        loadTxt.text = "正在连接网络中...";
        loadingTips  = (GTextField)loader.GetChild("loadingTips");
        loader.icon  = "Icons/Loader/loader";
        Timers.inst.Add(5f, 0, TimeHandle);
        TimeHandle();
        InitEvent();
        StartCoroutine(StartGameMgr());
    }
Пример #12
0
    public void SetData(object id, int exp = -1, int type = 0, int _lv = -1)
    {
        this.GetController("c1").selectedIndex = type;
        vo       = DataManager.inst.GetCardVo(id.ToString(), _lv, exp);
        bg.url   = Tools.GetResourceUrl("Icon:bg_kapai" + vo.rarity);
        icon.url = Tools.GetResourceUrl("Icon:" + id);
//		cardLv.text = Tools.GetMessageById ("14015", new string[]{ vo.lv.ToString () });
        cardLv.text = vo.lv.ToString();
        this.GetChild("n15").visible = false;
        this.GetChild("n17").visible = false;
        switch (vo.rarity)
        {
        case 0:
            cardLv.strokeColor = Tools.GetColor("8c8c8c");
            break;

        case 1:
            cardLv.strokeColor = Tools.GetColor("df890e");
            break;

        case 2:
            cardLv.strokeColor = Tools.GetColor("af5bcb");
            break;

        case 3:
            cardLv.strokeColor = Tools.GetColor("427ba3");
            if (type == 0 || type == 2 || type == 4)
            {
//				this.GetChild ("n15").visible = true;
//				this.GetChild ("n17").visible = true;
//				SetColor();
            }
            break;

        case 4:
//			cardLv.color = Tools.GetColor ();
            break;
        }
        lv.text    = vo.GetCost();
        n11.url    = Tools.GetResourceUrl("Image2:n_icon_dengji" + (vo.rarity + 1));
        cardBg.url = Tools.GetResourceUrl("Image2:n_bg_kapai" + ((vo.rarity < 3) ? "" : "2"));
        Dictionary <string, object> exp_Cfg = (Dictionary <string, object>)Tools.Analysis(cfg, "card_lv_exp." + vo.rarity);

        bar.GetChild("title").asTextField.color = Tools.GetColor("E8FCD9");
        if (vo.lv >= vo.maxLv)
        {
//			bar.skin = ComProgressBar.BAR6;
            bar.max   = Convert.ToInt32(((object[])exp_Cfg ["lv_max"]) [0].ToString());
            bar.value = vo.exp;
            if (bar.value >= bar.max)
            {
                proBar.url = Tools.GetResourceUrl("Image2:n_icon_shengji2");
                bar.GetChild("title").asTextField.color = Tools.GetColor("499227");
            }
            else
            {
                proBar.url = Tools.GetResourceUrl("Image2:n_icon_shengji1");
            }
            up.visible = false;
        }
        else
        {
            if (vo.exp < vo.maxExp)
            {
                up.visible = false;
//				bar.viewWidth = 122;
//				bar.skin = ComProgressBar.BAR3;
                proBar.url = Tools.GetResourceUrl("Image2:n_icon_shengji1");
            }
            else
            {
                up.visible = true;
//				bar.viewWidth = 102;
//				bar.skin = ComProgressBar.BAR6;
                proBar.url = Tools.GetResourceUrl("Image2:n_icon_shengji2");
                bar.GetChild("title").asTextField.color = Tools.GetColor("499227");
                EffectManager.inst.TweenJump(up, 1f);
            }
            bar.max   = vo.maxExp;
            bar.value = vo.exp;
        }
    }
Пример #13
0
    public void setItemData(GComponent go, string id, bool vhave = true, bool vlevel = true)
    {
        CardVo  cards = DataManager.inst.GetCardVo(id);
        GLoader bg    = go.GetChild("n6").asLoader;

        bg.url = Tools.GetResourceUrl("Image:bg_kapai" + cards.rarity);

        GLoader icon = go.GetChild("n7").asLoader;

        icon.url = Tools.GetResourceUrl("Icon:" + id);

        GTextField l_have   = go.GetChild("n2").asTextField;
        GImage     img_have = go.GetChild("n1").asImage;

        if (!vhave)
        {
            l_have.visible   = false;
            img_have.visible = false;
        }

        l_have.text = Convert.ToString(cards.cost / 1000);

        GTextField l_lv   = go.GetChild("n10").asTextField;
        GImage     img_lv = go.GetChild("n9").asImage;

        if (!vlevel)
        {
            l_lv.visible   = false;
            img_lv.visible = false;
        }
        GProgressBar pro     = go.GetChild("n8").asProgress;
        GTextField   proText = pro.GetChild("title").asTextField;

        l_lv.text = cards.lv + "";

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

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

        GImage img_up = go.GetChild("n12").asImage;

        if (cards.lv >= cards.maxLv)
        {
            proText.text   = cards.exp + "/" + ((object[])exp_cfg ["lv_max"]) [0].ToString();
            proText.color  = new Color(1, 1, 0);
            img_up.visible = false;
        }
        else
        {
            pro.max      = cards.maxExp;
            pro.value    = cards.exp > cards.maxExp ? cards.maxExp : cards.exp;
            proText.text = cards.exp + "/" + cards.maxExp;

            if (pro.value < pro.max)
            {
                img_up.visible = false;
            }
            else
            {
                img_up.visible = true;
//				EffectManager.inst.TweenJump (img_up.gameObject, 1f);
            }
        }
    }
Пример #14
0
    private void Onfunction(MainEvent e)
    {
        string[] str = e.data as string[];
        switch (str [0])
        {
        case Config.ASSET_GOLD:
            DOTween.Kill(gold, true);
            DOTween.Kill(gold.GetChild("n0"));
            ColorFilter goldgggg = new ColorFilter();
            gold.GetChild("n1").filter        = goldgggg;
            ModelManager.inst.userModel.gold += Convert.ToInt32(str [1]);
            gold.GetChild("n0").TweenMoveY(-2f, 0.05f);
            goldgggg.AdjustBrightness(0.4f);
            gold.TweenMoveY(18, 0.05f).OnComplete(() =>
            {
                gold.y = 27;
                gold.GetChild("n0").y = 2;
                goldgggg.Reset();
                gold.GetChild("n1").filter = null;
            });
            break;

        case Config.ASSET_COIN:
            DOTween.Kill(coin, true);
            DOTween.Kill(coin.GetChild("n0"));
            ColorFilter coingggg = new ColorFilter();
            coin.GetChild("n2").filter        = coingggg;
            ModelManager.inst.userModel.coin += Convert.ToInt32(str [1]);
            coin.GetChild("n0").TweenMoveY(-2f, 0.05f);
            coingggg.AdjustBrightness(0.4f);
            coin.TweenMoveY(18, 0.05f).OnComplete(() => {
                coin.y = 27;
                coin.GetChild("n0").y = 2;
                coingggg.Reset();
                coin.GetChild("n2").filter = null;
            });
            break;

        case Config.ASSET_EXP:
            DOTween.Kill(exp, true);
            DOTween.Kill(exp.GetChild("n1"));
            ColorFilter expgggg = new ColorFilter();
            ModelManager.inst.userModel.exp += Convert.ToInt32(str [1]);
            exp.GetChild("n1").TweenScale(new Vector2(1.1f, 1.1f), 0.05f);
            expgggg.AdjustBrightness(0.4f);
            exp.TweenMoveY(60, 0.05f).OnComplete(() =>
            {
                exp.y = 55;
                exp.GetChild("n1").scale = new Vector2(1f, 1f);
                expgggg.Reset();
                exp.InvalidateBatchingState();
            });
            exp.value = userModel.exp;
            int i = 0;
            exp.max = userModel.GetExpMax(userModel.lv);

            if (exp.value >= exp.max)
            {
                exp.value -= exp.max;
                i++;
            }
            exp.max  = userModel.GetExpMax(userModel.lv + i);
            exp.text = userModel.exp + "/" + exp.max;
            lv.text  = userModel.lv.ToString();
            break;
        }

        DispatchManager.inst.Dispatch(new MainEvent(MainEvent.USER_UPDATE));
        ClearSelf(0);
    }
Пример #15
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_LEVELUP, true);
        SoundManager.inst.PlaySound(Config.SOUND_CARDLVUP);
        ViewManager.SetWidthHeight(this.GetChild("n0"));
        sim      = (Dictionary <string, object>)(DataManager.inst.systemSimple ["card_attr_info"]);
        cardData = (Dictionary <string, object>)DataManager.inst.card [Cid];
        if (cardData.ContainsKey("tips"))
        {
            tips = (object[])cardData ["tips"];
        }
        GButton bgClick = this.GetChild("n0").asButton;

        list = this.GetChild("n5").asList;
        n11  = this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n11").asLoader;
        bgClick.onClick.Add(Mask_Click);
        pro = this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n7").asProgress;
        pro.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji1");
        card = DataManager.inst.GetCardVo(Cid);
//		card = DataManager.inst.GetCardVo (Cid, card.lv - 1);
        this.GetChild("n2").asTextField.text = Tools.GetMessageById(card.name);
        n1x = this.GetChild("n1").asCom.x;
        n2x = this.GetChild("n2").asTextField.x;
        this.GetChild("n2").asTextField.x += 160;
        this.GetChild("n1").asCom.x       += 160;
        list.visible = false;
        this.GetChild("n3").asTextField.visible = false;
        this.GetChild("n3").asTextField.text    = Tools.GetMessageById("24133");
        n11.url = Tools.GetResourceUrl("Image2:n_icon_dengji" + (card.rarity + 1));
        this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_bg_kapai" + ((card.rarity < 3) ? "" : "2"));
        switch (card.rarity)
        {
        case 0:
            this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n9").asTextField.strokeColor = Tools.GetColor("8c8c8c");
            break;

        case 1:
            this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n9").asTextField.strokeColor = Tools.GetColor("df890e");
            break;

        case 2:
            this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n9").asTextField.strokeColor = Tools.GetColor("af5bcb");
            break;

        case 3:
            this.GetChild("n1").asCom.GetChild("n0").asCom.GetChild("n9").asTextField.strokeColor = Tools.GetColor("427ba3");
            break;

        case 4:
            //			cardLv.color = Tools.GetColor ();
            break;
        }
//		cards = DataManager.inst.GetCardVo (Cid, card.lv - 1);
//		pro.value = cards.exp;
//		pro.max = cards.maxExp;
        maxWidth          = pro.width;
        uplist            = ListData(tips, card);
        list.itemRenderer = OnRander;
        list.numItems     = uplist.Count;
//		pro.value = 50f;
//		pro.max = 20f;
//		return;
        //
        setItemData(this.GetChild("n1").asCom.GetChild("n0").asCom, Cid, card.lv - 1, false);

//		this.Effect1 ();
    }
Пример #16
0
    public void setItemData(GComponent go, string id, int lv, bool bo)
    {
        cards = DataManager.inst.GetCardVo(id, lv);

        GLoader bg = go.GetChild("n4").asLoader;

        bg.url = Tools.GetResourceUrl("Icon:bg_kapai" + cards.rarity);

        GLoader icon = go.GetChild("n3").asLoader;

        icon.url = Tools.GetResourceUrl("Icon:" + id);

        GTextField l_have = go.GetChild("n6").asTextField;

        l_have.text = Convert.ToString(cards.cost / 1000);

        GTextField l_lv = go.GetChild("n9").asTextField;

        l_lv.text = cards.lv + "";

        Dictionary <string, object> cfg = DataManager.inst.systemSimple;

        object[] exp_cfg = (object[])(cfg ["exp_config"]);
        GImage   img_up  = go.GetChild("n10").asImage;

        pro.name = "pro";


        if (bo == false)
        {
            pro.value = cards.maxExp;
            pro.max   = cards.maxExp;
            isMove    = true;
            tweeners  = EffectManager.inst.SetFilterAdjustBrightness(go, 1.3f, 0f, 1f);
//			int c = cards.maxExp;
            green = EffectManager.inst.AddPrefab(Config.EFFECT_CARDLVUP, this.GetChild("n6").asGraph);
            boom  = EffectManager.inst.AddPrefab(Config.EFFECT_ELV_UP, this.GetChild("n7").asGraph);
//			GameObjectScaler.Scale (green, 1.2f);
//			GameObjectScaler.Scale (boom, 0.8f);
            green.transform.localScale *= 1.2f;
            boom.transform.localScale  *= 0.8f;

            GComponent par = pro.GetChild("bar").asCom;
            GTextField txt = pro.GetChild("title").asTextField;

            float times = 1.3f;            // / (_max+1);
            if (pro.value >= pro.max)
            {
                pro.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji2");
                pro.GetChild("title").asTextField.color = Tools.GetColor("499227");
            }
            else
            {
                pro.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji1");
                pro.GetChild("title").asTextField.color = Tools.GetColor("E8FCD9");
            }
            allTween = DOTween.To(() => pro.value, x => pro.value = x, 0, times).OnComplete(() =>
            {
                if (isMove)
                {
                    isMove = false;
                    OnTimer(0f);
                }
                else
                {
                    Check_pro_width();
                }
            });
        }
        else
        {
            isMove = false;
//			TimerManager.inst.Remove(tween_pro);
//			if (allTween != null)
//			{
//				DOTween.Kill (allTween, true);
//				allTween = null;
////				Log.debug("aaaaaaaaaaaaaaaaaaaaaaa");
//			}
            if (green != null)
            {
                Tools.Clear(green);
                EffectManager.inst.ClearParticles(green);
            }
            //EffectManager.inst.SetFilterAdjustBrightness(go, 0.3f, 0f, 1f);
            go.TweenScale(new Vector2(1.3f, 1.3f), 0.15f).OnComplete(() =>
            {
                go.TweenScale(new Vector2(0.8f, 0.8f), 0.2f).OnComplete(() => {
                    go.TweenScale(new Vector2(1f, 1f), 0.2f).OnStart(() => {
                        EffectManager.inst.SetFilterAdjustBrightness(go, 0f, 1f, 0f);
                    }).OnComplete(() => {
                        TimerManager.inst.Add(0.5f, 1, OnTimer2);
                    });
                });
            });

            Check_pro_width();
            if (pro.value >= pro.max)
            {
//				pro.skin = ComProgressBar.BAR6;
                pro.GetChild("title").asTextField.color = Tools.GetColor("499227");
                pro.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji2");
                img_up.visible = true;
            }
            else
            {
//				pro.skin = ComProgressBar.BAR3;
                pro.GetChild("title").asTextField.color = Tools.GetColor("E8FCD9");
                pro.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji1");
                img_up.visible = false;
            }
            isUp          = true;
            list.numItems = uplist.Count;
        }
    }