Example #1
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);
    }
Example #2
0
    private void OnlevelUp(MainEvent e)
    {
//		if (GuideManager.inst.Check ("1:3"))
//		{
//			GuideManager.inst.Next ();
//			GuideManager.inst.Show (this);
//		}
        if (this.GetChild("n46") != null)
        {
            this.RemoveChild(this.GetChild("n46"));
        }
        if (oldred != (int)userModel.records [Config.ASSET_REDBAGCOIN])
        {
            ViewManager.inst.ShowGetRedBagCoin((int)userModel.records[Config.ASSET_REDBAGCOIN] - oldred, v2);
        }
        oldred = (int)userModel.records [Config.ASSET_REDBAGCOIN];
        if (((int)DataManager.inst.redbag ["exp"] * (int)userModel.records [Config.ASSET_REDBAGCOIN] + userModel.exp) >= userModel.GetExpMax(userModel.lv))
        {
            if (userModel.lv < 15) //目前满级15  有可能会变
            {
                ViewManager.inst.ShowAlert(Tools.GetMessageById("13110"), (int bo) => {
                    if (bo == 1)
                    {
                        ViewManager.inst.ShowView <MediatorRedPackage>();
                    }
                }, true);
            }
        }
        Tab_Change();
    }
Example #3
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);
    }