public void AddControlEffect(List <ControlEffect> buttonEffects, List <Vector2> pos, Transform node, UIWidget control = null) { for (int i = 0; i < buttonEffects.Count; ++i) { ControlEffect effectType = buttonEffects[i]; GameObject effect = null; if (effectType == ControlEffect.Finger) { effect = CommonFunction.InstantiateObject(prefabTapEffect, node); } else if (effectType == ControlEffect.TopArrow || effectType == ControlEffect.BottomArrow || effectType == ControlEffect.LeftArrow || effectType == ControlEffect.RightArrow) { effect = CommonFunction.InstantiateObject(prefabArrowEffect, node); if (effectType == ControlEffect.BottomArrow) { effect.transform.localEulerAngles = new Vector3(0f, 0f, 180f); } else if (effectType == ControlEffect.LeftArrow) { effect.transform.localEulerAngles = new Vector3(0f, 0f, 90); } else if (effectType == ControlEffect.RightArrow) { effect.transform.localEulerAngles = new Vector3(0f, 0f, -90f); } } else if (effectType == ControlEffect.Halo) { effect = CommonFunction.InstantiateObject(prefabHalo, node); } else if (effectType == ControlEffect.BlinkArea) { effect = CommonFunction.InstantiateObject(prefabBlinkArea, node); UIWidget widgetEffect = effect.GetComponent <UIWidget>(); widgetEffect.leftAnchor.target = control.transform; widgetEffect.leftAnchor.Set(0f, 0f); widgetEffect.rightAnchor.target = control.transform; widgetEffect.rightAnchor.Set(1f, 0f); widgetEffect.topAnchor.target = control.transform; widgetEffect.topAnchor.Set(1f, 0f); widgetEffect.bottomAnchor.target = control.transform; widgetEffect.bottomAnchor.Set(0f, 0f); widgetEffect.ResetAnchors(); } effect.transform.localPosition = new Vector3(0f, 0f, 0f); if (pos != null && pos.Count > i) { effect.transform.localPosition = new Vector3(pos[i].x, pos[i].y, 0f); } UIManager.Instance.AdjustDepth(effect, i + 1); effects.Add(effect); } }
/// <summary> /// 运行单一效果 /// </summary> /// <param name="game"></param> /// <param name="Ability"></param> /// <param name="Result"></param> private static void RunEffect(ActionStatus game, EffectDefine SingleEffect, List <string> Result) { switch (SingleEffect.TrueAtomicEffect.AtomicEffectType) { case AtomicEffectDefine.AtomicEffectEnum.卡牌: case AtomicEffectDefine.AtomicEffectEnum.水晶: case AtomicEffectDefine.AtomicEffectEnum.召唤: case AtomicEffectDefine.AtomicEffectEnum.武器: Result.AddRange(RunGameSystemEffect(game, SingleEffect.TrueAtomicEffect, SingleEffect.AbliltyPosPicker)); break; case AtomicEffectDefine.AtomicEffectEnum.控制: Result.AddRange(ControlEffect.RunEffect(game, SingleEffect.AbliltyPosPicker.SelectedPos.ToString())); break; case AtomicEffectDefine.AtomicEffectEnum.未定义: break; default: Result.AddRange(Effecthandler.RunSingleEffect(SingleEffect, game, ActionStatus.RandomSeed)); break; } }
/// <summary> /// 处理对方的动作 /// </summary> /// <param name="ActionCommand"></param> /// <param name="game"></param> public static void Process(string ActionCommand, ActionStatus game) { string[] actField = ActionCommand.Split(CardUtility.strSplitMark.ToCharArray()); switch (ActionCode.GetActionType(ActionCommand)) { case ActionCode.ActionType.Card: CardEffect.ReRunEffect(1, game, actField); break; case ActionCode.ActionType.UseMinion: int Pos = int.Parse(actField[2]); var minion = (MinionCard)CardUtility.GetCardInfoBySN(actField[1]); minion.初始化(); game.AllRole.YourPublicInfo.BattleField.PutToBattle(Pos, minion); Buff.ResetBuff(game); break; case ActionCode.ActionType.UseWeapon: game.AllRole.YourPublicInfo.Hero.Weapon = (WeaponCard)CardUtility.GetCardInfoBySN(actField[1]); break; case ActionCode.ActionType.UseSecret: game.AllRole.YourPublicInfo.Hero.SecretCount++;; break; case ActionCode.ActionType.UseAbility: break; case ActionCode.ActionType.Fight: //FIGHT#1#2 FightHandler.Fight(int.Parse(actField[2]), int.Parse(actField[1]), game, false); break; case ActionCode.ActionType.Point: IAtomicEffect point = new PointEffect(); point.ReRunEffect(game, actField); break; case ActionCode.ActionType.Health: IAtomicEffect health = new HealthEffect(); health.ReRunEffect(game, actField); break; case ActionCode.ActionType.Status: IAtomicEffect status = new StatusEffect(); status.ReRunEffect(game, actField); break; case ActionCode.ActionType.Transform: IAtomicEffect transform = new TransformEffect(); transform.ReRunEffect(game, actField); break; case ActionCode.ActionType.Attack: IAtomicEffect attack = new AttackEffect(); attack.ReRunEffect(game, actField); break; case ActionCode.ActionType.HitSecret: SecretCard.ReRunSecret(game, actField); break; case ActionCode.ActionType.Control: ControlEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Summon: SummonEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Crystal: CrystalEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.WeaponPoint: WeaponPointEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Settle: ActionStatus.Settle(game); break; } }