private void MoveToNum(int num) { if (Convert.ToInt32(mprotxt.text.Split('/')[0]) >= num) { if (maxExp != -1) { (mpro as ComProgressBar).value = num; (mpro as ComProgressBar).max = maxExp; mprotxt.text = num.ToString() + "/" + 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); } } else { mprotxt.text = num.ToString(); } return; } if (maxExp != -1) { (mpro as ComProgressBar).value = Convert.ToInt32(mprotxt.text.Split('/') [0]) + cha; (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 = (Convert.ToInt32(mprotxt.text.Split('/')[0]) + cha).ToString() + "/" + maxExp; } else { mprotxt.text = (Convert.ToInt32(mprotxt.text.Split('/')[0]) + cha).ToString(); } mpro.TweenScaleX(1.1f, 0.05f).OnComplete(() => { mpro.TweenScaleX(1f, 0.05f).OnComplete(() => { MoveToNum(num); }); }); }
public Tweener SetFilterAdjustBrightness(GObject go, float time, float start = 0f, float end = 1f) { Tweener t; ColorFilter cf = Tools.AddColorFilter(go); cf.Reset(); float c = start; if (time == 0) { cf.AdjustBrightness(0); t = null; } else { t = DOTween.To(() => c, x => c = x, end, time).OnUpdate(() => { // Log.debug ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx - " + Math.Round (c, 2).ToString ()); cf.Reset(); cf.AdjustBrightness(Convert.ToSingle(Math.Round(c, 2))); }); } return(t); }
void __sliderChanged(EventContext context) { int cnt = _mainView.numChildren; for (int i = 0; i < cnt; i++) { GObject obj = _mainView.GetChildAt(i); if (obj.filter is ColorFilter) { ColorFilter filter = (ColorFilter)obj.filter; filter.Reset(); filter.AdjustBrightness((_s0.value - 100) / 100f); filter.AdjustContrast((_s1.value - 100) / 100f); filter.AdjustSaturation((_s2.value - 100) / 100f); filter.AdjustHue((_s3.value - 100) / 100f); } } }
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); }
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); }
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; }