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); }