public void ShowIconOver(MainEvent e = null) { showIcon.RemoveGlobalListener(MainEvent.JUMP_OVER, ShowIconOver); tween_ShowIcon = 1; showIcon.group.TweenFade(0f, 0.3f).OnComplete(() => { if (showIconFun != null) { showIconFun(); } f.RemoveChild(showIcon.group, true); showIcon = null; tween_ShowIcon = null; // f.InvalidateBatchingState(true); // s.InvalidateBatchingState(true); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.USER_UPDATE_UI)); }).SetId(tween_ShowIcon); }
public void ShowIcon(object obj, Action fun = null, GObject obj1 = null) { bool isOk = ModelManager.inst.userModel.GetUnlcok(Config.UNLOCK_ASSET); if (!isOk) { return; } Dictionary <string, object> dic = obj as Dictionary <string, object>; if (dic.Keys.Count == 0) { if (fun != null) { fun(); } return; } Vector2 v2; if (obj1 == null) { // Debug.Log(Stage.inst.touchPosition.x + "ccc" + Stage.inst.touchPosition.y); v2 = Stage.inst.touchPosition; v2 = f.GlobalToLocal(v2); } else { //190ccc592 //v2 = obj1.LocalToGlobal(new Vector2(obj1.x, obj1.y)); v2 = new Vector2(obj1.x + obj1.width, obj1.y + obj1.height); } if (tween_ShowIcon != null) { DOTween.Kill(tween_ShowIcon); if (showIconFun != null) { showIconFun(); } tween_ShowIcon = null; } if (showIcon == null) { showIconFun = fun; showIcon = new ComGoldCoinExp(); f.AddChild(showIcon.group); showIcon.group.y = 0; // showIcon.group.height / 2; showIcon.group.alpha = 0; } else { showIconFun = fun; } showIcon.group.TweenFade(1f, 0.3f).OnComplete(() => { showIcon.group.InvalidateBatchingState(); }); showIcon.RemoveGlobalListener(MainEvent.JUMP_OVER, ShowIconOver); showIcon.AddGlobalListener(MainEvent.JUMP_OVER, ShowIconOver); int index = 0; foreach (string i in dic.Keys) { string id = i; int _index = index; if (i == Config.ASSET_GOLD || i == Config.ASSET_COIN || i == Config.ASSET_EXP || i == Config.ASSET_CARD) { if (i == Config.ASSET_CARD) { int num = 0; Dictionary <string, object> card = (Dictionary <string, object>)dic [i]; foreach (string str in card.Keys) { num += (int)card [str]; } TimerManager.inst.Add(0.2f * _index, 1, (float time) => { EffectManager.inst.ShowIcon(id, num, f, new Vector2(v2.x, v2.y), new Vector2(569f, 320f)); }); } else { TimerManager.inst.Add(0.2f * _index, 1, (float time) => { EffectManager.inst.ShowIcon(id, (int)dic [id], f, new Vector2(v2.x, v2.y), new Vector2(569f, 320f)); }); } index++; } } }