protected override void Execute(List <GameEntity> entities) { if (_context.hasBattleOver) { return; } foreach (var e in entities) { if (e.hasJutsuTarget) { e.isStartConditionConfirm = true; var newJutsuControl = new MatchDataJutsuControl { matchId = _context.currentMatchData.value.customMatchId, originatorId = e.originator.value.id.value, jutsuName = e.name.text, needTarget = true, targetId = e.jutsuTarget.value.id.value }; _context.CreateEntity().ReplaceSendMatchData(1011, Utilities.ToJson(newJutsuControl)); e.isDestroy = true; continue; } var jutsuConfig = _context.ninjutsuAttributes.dic[e.name.text]; var targets = new List <GameEntity>(); foreach (var target in _context.GetEntities()) { if (!CheckRequireFlag(jutsuConfig, target)) { continue; } var targetMark = _context.CreateEntity(); targetMark.ReplaceSelectTarget(target); targetMark.ReplaceName("SelectTarget_" + _context.jutsuSelectTargetId.value); targetMark.ReplaceUiOpen("SelectTarget"); var targetScreenPosition = _context.viewService.instance.WorldPositionToScreenPosition(target.position.value); if (targetScreenPosition.X >= 0 && targetScreenPosition.X <= _context.viewService.instance.ScreenSize.X && targetScreenPosition.Y >= 0 && targetScreenPosition.Y <= _context.viewService.instance.ScreenSize.Y) { targetMark.ReplaceParentEntity(target); } else { var currentPlayer = _context.GetEntityWithId(_context.currentPlayerId.value); GameEntity listEntity = null; var left = target.position.value.X < currentPlayer.position.value.X; var listName = left ? "OutScreenSelectTargetViewLeftList" : "OutScreenSelectTargetViewRightList"; foreach (var ui in _context.GetGroup(GameMatcher.UiRootId)) { if (!ui.hasName) { continue; } if (ui.name.text != listName) { continue; } listEntity = ui; break; } if (listEntity == null) { continue; } targetMark.ReplaceParentEntity(listEntity); } targets.Add(targetMark); _context.ReplaceJutsuSelectTargetId(_context.jutsuSelectTargetId.value + 1); } if (targets.Count == 0) { e.isDestroy = true; continue; } _context.coroutineService.instance.StartCoroutine(WaitSelectTarget(targets, e)); } }
protected override void Execute(List <GameEntity> entities) { if (_context.hasBattleOver) { return; } foreach (var e in entities) { var jutsuConfig = _context.ninjutsuAttributes.dic[e.name.text]; var originator = e.originator.value; var chaKuRaCoast = jutsuConfig.chaKuRaCoast; var taiRyuKuCoast = jutsuConfig.taiRyuKuCoast; if (originator.isDead) { continue; } if (!originator.hasId) { e.isDestroy = true; continue; } if (originator.chaKuRaCurrent.value >= chaKuRaCoast) { // originator.ReplaceChaKuRaExpend(chaKuRaCoast); var newChaKuRaExpend = new MatchDataChaKuRaExpendControl { matchId = _context.currentMatchData.value.customMatchId, userId = originator.id.value, chaKuRaExpend = chaKuRaCoast }; _context.CreateEntity().ReplaceSendMatchData(1007, Utilities.ToJson(newChaKuRaExpend)); } else { // originator.ReplaceChaKuRaExpend(originator.chaKuRaCurrent.value); var newChaKuRaExpend = new MatchDataChaKuRaExpendControl { matchId = _context.currentMatchData.value.customMatchId, userId = originator.id.value, chaKuRaExpend = originator.chaKuRaCurrent.value }; _context.CreateEntity().ReplaceSendMatchData(1007, Utilities.ToJson(newChaKuRaExpend)); taiRyuKuCoast += 1.1f * (jutsuConfig.chaKuRaCoast - originator.chaKuRaCurrent.value) / originator.chaKuRaSlewRate.value; } if (originator.taiRyoKuCurrent.value >= taiRyuKuCoast) { // originator.ReplaceTaiRyoKuExpend(taiRyuKuCoast); var newTaiRyoKuExpend = new MatchDataTaiRyuKuExpendControl { matchId = _context.currentMatchData.value.customMatchId, userId = originator.id.value, taiRyuKuExpend = taiRyuKuCoast }; _context.CreateEntity().ReplaceSendMatchData(1008, Utilities.ToJson(newTaiRyoKuExpend)); } else { // originator.ReplaceTaiRyoKuExpend(originator.taiRyoKuCurrent.value); var newTaiRyoKuExpend = new MatchDataTaiRyuKuExpendControl { matchId = _context.currentMatchData.value.customMatchId, userId = originator.id.value, taiRyuKuExpend = originator.taiRyoKuCurrent.value }; _context.CreateEntity().ReplaceSendMatchData(1008, Utilities.ToJson(newTaiRyoKuExpend)); e.isDestroy = true; } foreach (var beforeJutsu in _context.GetGroup(GameMatcher.BeforeJutsuTarget)) { if (beforeJutsu.name.text == e.name.text) { e.ReplaceJutsuTarget(beforeJutsu.jutsuTarget.value); } beforeJutsu.isDestroy = true; } if (!jutsuConfig.needSelectTarget || jutsuConfig.needSelectTarget && e.hasJutsuTarget) { e.isStartConditionConfirm = true; var newJutsuControl = new MatchDataJutsuControl { matchId = _context.currentMatchData.value.customMatchId, originatorId = e.originator.value.id.value, jutsuName = e.name.text, needTarget = jutsuConfig.needSelectTarget }; if (jutsuConfig.needSelectTarget) { newJutsuControl.targetId = e.jutsuTarget.value.id.value; } _context.CreateEntity().ReplaceSendMatchData(1011, Utilities.ToJson(newJutsuControl)); e.isDestroy = true; } } }