Ejemplo n.º 1
0
        //为效果选择主语目标
        public bool ExecutionEffectFindTarget(EffectInfo effectInfo,
                                              EffectInfoProxy effectInfoProxy,
                                              PlayerGroupProxy playerGroupProxy,
                                              QuestStageCircuitProxy questStageCircuitProxy,
                                              GameContainerProxy gameContainerProxy)
        {
            bool hasTargetOver = true;

            if (effectInfo.effectInfoStage == EffectInfoStage.UnStart || effectInfo.effectInfoStage == EffectInfoStage.ConfirmingTarget)
            {
                effectInfo.effectInfoStage = EffectInfoStage.ConfirmingTarget;
                foreach (TargetSet targetSet in effectInfo.operationalTarget.selectTargetList)
                {
                    bool findOver = FindTargetOrObejct(effectInfo, targetSet, effectInfoProxy, playerGroupProxy, questStageCircuitProxy, gameContainerProxy);
                    if (!findOver)
                    {
                        return(false);
                    }
                }
                foreach (TargetSet targetSet in effectInfo.operationalTarget.selectTargetList)
                {
                    if (!targetSet.hasTarget)
                    {
                        hasTargetOver = false;
                    }
                }
                if (hasTargetOver)
                {
                    effectInfo.effectInfoStage = EffectInfoStage.ConfirmedTarget;
                }
            }


            return(hasTargetOver);
        }
Ejemplo n.º 2
0
 //为前置后置效果选择主语目标
 public bool ExecutionEffectFindTargetForBeforeAndAfter(EffectInfo effectInfo,
                                                        PlayerGroupProxy playerGroupProxy,
                                                        QuestStageCircuitProxy questStageCircuitProxy,
                                                        EffectInfoProxy effectInfoProxy,
                                                        GameContainerProxy gameContainerProxy
                                                        )
 {
     effectInfo.effectInfoStage = EffectInfoStage.ConfirmingTarget;
     //遍历每一个前置效果
     foreach (EffectInfo preEffect in effectInfo.preEffectEntryList)
     {
         preEffect.player    = effectInfo.player;
         preEffect.cardEntry = effectInfo.cardEntry;
         bool hasTarget = ExecutionEffectFindTarget(preEffect, effectInfoProxy, playerGroupProxy, questStageCircuitProxy, gameContainerProxy);
         if (!hasTarget)
         {
             return(hasTarget);
         }
     }
     //遍历每一个后置效果
     foreach (EffectInfo postEffect in effectInfo.postEffectEntryList)
     {
         postEffect.player    = effectInfo.player;
         postEffect.cardEntry = effectInfo.cardEntry;
         bool hasTarget = ExecutionEffectFindTarget(postEffect, effectInfoProxy, playerGroupProxy, questStageCircuitProxy, gameContainerProxy);
         if (!hasTarget)
         {
             return(hasTarget);
         }
     }
     effectInfo.effectInfoStage = EffectInfoStage.ConfirmedTarget;
     return(true);
 }
Ejemplo n.º 3
0
        public override void Execute(INotification notification)
        {
            GameContainerProxy gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;
            EffectInfoProxy effectInfoProxy =
                Facade.RetrieveProxy(EffectInfoProxy.NAME) as EffectInfoProxy;
            QuestStageCircuitProxy questStageCircuitProxy =
                Facade.RetrieveProxy(QuestStageCircuitProxy.NAME) as QuestStageCircuitProxy;

            switch (notification.Type)
            {
            case GameContainerEvent.GAME_CONTAINER_SYS_CARD_NEED_MOVE:
                CardEntry cardEntryNeedMoveToHand = notification.Body as CardEntry;
                gameContainerProxy.MoveOneCardFromOldeContainerItemToNeweContainerItem(cardEntryNeedMoveToHand, cardEntryNeedMoveToHand.nextGameContainerType);
                break;

            case GameContainerEvent.GAME_CONTAINER_SYS_CARD_NEED_ADD_TO_TTS:
                CardEntry cardEntryNeedAddToTTS = notification.Body as CardEntry;
                //获取卡牌的效果,如果是持续效果则添加到全局监听中
                foreach (string effectCode in cardEntryNeedAddToTTS.effectCodeList)
                {
                    EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectCode);
                    if (oneEffectInfo.impactType == "Continue")
                    {
                        oneEffectInfo.player    = cardEntryNeedAddToTTS.controllerPlayerItem;
                        oneEffectInfo.cardEntry = cardEntryNeedAddToTTS;
                        questStageCircuitProxy.circuitItem.putOneEffectInfoInActiveMap(oneEffectInfo, effectInfoProxy.effectSysItem.impactTimeTriggerMap);
                    }
                }
                break;
            }
        }
Ejemplo n.º 4
0
 //执行效果
 public void ExecutionEffectContentList(EffectInfoProxy effectInfoProxy, GameContainerProxy gameContainerProxy)
 {
     //if (effectInfoProxy.effectSysItem.cardEntry.gameContainerType == "CardHand") {
     //    effectInfoProxy.effectSysItem.cardEntry.ttCardNeedHideInView(effectInfoProxy.effectSysItem.cardEntry);
     //}
     for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
     {
         EffectInfo effectInfo = effectInfoProxy.effectSysItem.effectInfos[n];
         UtilityLog.Log("开始执行效果【" + effectInfo.code + "】", LogUtType.Effect);
         effectInfo.effectInfoStage = EffectInfoStage.Executing;
         if (effectInfo.effectType == "Independent")
         {
             ExecutionOneEffectContent(effectInfoProxy, effectInfo, gameContainerProxy);
         }
         else if (effectInfo.effectType == "BeforeAndAfter")
         {
             bool allPreEffectExe = true;
             //遍历每一个前置效果
             foreach (EffectInfo preEffect in effectInfo.preEffectEntryList)
             {
                 UtilityLog.Log("执行前置效果", LogUtType.Special);
                 if (preEffect.userChooseExecution)
                 {
                     UtilityLog.Log("执行一个前置效果", LogUtType.Special);
                     ExecutionOneEffectContent(effectInfoProxy, preEffect, gameContainerProxy);
                 }
                 else
                 {
                     allPreEffectExe = false;
                 }
             }
             if (allPreEffectExe)
             {
                 UtilityLog.Log("执行后置效果", LogUtType.Special);
                 //遍历每一个后置效果
                 foreach (EffectInfo postEffect in effectInfo.postEffectEntryList)
                 {
                     UtilityLog.Log("执行一个后置效果", LogUtType.Special);
                     ExecutionOneEffectContent(effectInfoProxy, postEffect, gameContainerProxy);
                 }
             }
             effectInfo.effectInfoStage = EffectInfoStage.Finished;
         }
         //选择效果无需展示
         if (effectInfo.whetherToshow == "Y")
         {
             //发送已经确认目标的效果到前台进行展示
             CardEntry oneCardEntry = effectInfo.cardEntry;
             oneCardEntry.needShowEffectInfo = effectInfo;
             effectInfoProxy.effectSysItem.showEffectNum++;
             SendNotification(UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS, oneCardEntry, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_PUT_ONE_EFFECT);
         }
     }
 }
Ejemplo n.º 5
0
        public void AskTheUserOperating(EffectInfo effectInfo,
                                        PlayerGroupProxy playerGroupProxy,
                                        QuestStageCircuitProxy questStageCircuitProxy,
                                        EffectInfoProxy effectInfoProxy,
                                        GameContainerProxy gameContainerProxy)
        {
            effectInfo.effectInfoStage = EffectInfoStage.AskTheUser;
            if (effectInfo.effectType == "Independent")
            {
            }
            else if (effectInfo.effectType == "BeforeAndAfter")
            {
                //遍历每一个前置效果
                foreach (EffectInfo preEffect in effectInfo.preEffectEntryList)
                {
                    if (preEffect.effectInfoStage == EffectInfoStage.AskTheUser ||
                        preEffect.effectInfoStage == EffectInfoStage.ConfirmedTarget)
                    {
                        preEffect.effectInfoStage   = EffectInfoStage.AskTheUser;
                        preEffect.checkCanExecution = true;

                        bool checkOver = EffectExecution(preEffect, EffectExeType.Check, gameContainerProxy);
                        if (!checkOver)
                        {
                            preEffect.checkCanExecution = false;
                            UtilityLog.Log(preEffect.code + ":检查为不能释放", LogUtType.Special);
                        }
                        //判断是否是必发
                        if (preEffect.mustBeLaunched == "N")
                        {
                            //不是必发,需要用户判断
                            effectInfo.needChoosePreEffect = preEffect;
                            //发送已经确认目标的效果到前台进行展示
                            CardEntry oneCardEntry = effectInfo.cardEntry;
                            oneCardEntry.needShowEffectInfo = effectInfo;
                            effectInfoProxy.effectSysItem.showEffectNum++;
                            SendNotification(UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS, oneCardEntry, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_ONE_EFFECT_NEED_CHOOSE_EXE);
                            return;
                        }
                        else
                        {
                            preEffect.effectInfoStage = EffectInfoStage.AskTheUserOver;
                        }
                    }
                    else
                    {
                        UtilityLog.LogError("逻辑错误:不应出现【用户判断】阶段前不是【宾语目标寻找结束】阶段");
                    }
                }
            }

            effectInfo.effectInfoStage = EffectInfoStage.AskTheUserOver;
        }
Ejemplo n.º 6
0
        public override void Execute(INotification notification)
        {
            GameContainerProxy gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;
            PlayerGroupProxy playerGroupProxy =
                Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;

            switch (notification.Type)
            {
            //根据效果渲染高亮
            case MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT:
                TargetSet targetSetToChoose = notification.Body as TargetSet;
                //通知生物层发生变更重新渲染部分生物
                SendNotification(MinionSystemEvent.MINION_VIEW, GetMinionListByTargetSet(targetSetToChoose, gameContainerProxy), MinionSystemEvent.MINION_VIEW_MINIONS_CHANGE);
                break;

            //根据效果渲染高亮-预定成为目标选择项
            case MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_BECOME_TARGET:
                TargetSet        targetSetToChooseTarget = notification.Body as TargetSet;
                List <CardEntry> mList = GetMinionListByTargetSet(targetSetToChooseTarget, gameContainerProxy);

                //通知生物层发生变更重新渲染部分生物
                SendNotification(MinionSystemEvent.MINION_VIEW, mList, MinionSystemEvent.MINION_VIEW_MINIONS_CHANGE_TO_CHOOSE_TARGET);
                break;

            case MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_CLOSE:
                List <CardEntry>         mListClose = new List <CardEntry>();
                List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield");
                foreach (GameContainerItem gameContainerItem in returnGameContainerItemList)
                {
                    foreach (CardEntry minionCellItem in gameContainerItem.cardEntryList)
                    {
                        if (minionCellItem.IsEffectTarget == true)
                        {
                            minionCellItem.IsEffectTarget = false;
                        }
                        mListClose.Add(minionCellItem);
                    }
                }
                //通知生物层发生变更重新渲染部分生物
                SendNotification(MinionSystemEvent.MINION_VIEW, mListClose, MinionSystemEvent.MINION_VIEW_MINIONS_CHANGE);
                break;

            //生物死亡
            case MinionSystemEvent.MINION_SYS_ONE_MINION_IS_DEAD:
                CardEntry minionCellItemIsDead = notification.Body as CardEntry;
                //放入墓地
                minionCellItemIsDead.nextGameContainerType = "CardGraveyard";
                minionCellItemIsDead.ttNeedChangeGameContainerType(minionCellItemIsDead);
                break;
            }
        }
Ejemplo n.º 7
0
        public override void Execute(INotification notification)
        {
            MainUI mainUI = notification.Body as MainUI;

            if (null == mainUI)
            {
                throw new Exception("程序启动失败..");
            }

            //数据信息代理
            CardDbProxy cardDbProxy = new CardDbProxy();

            Facade.RegisterProxy(cardDbProxy);
            EffectInfoProxy effectInfoProxy = new EffectInfoProxy();

            Facade.RegisterProxy(effectInfoProxy);
            TestCaseProxy testCaseProxy = new TestCaseProxy();

            Facade.RegisterProxy(testCaseProxy);
            //游戏模式代理
            GameModelProxy gameModelProxy = new GameModelProxy();

            Facade.RegisterProxy(gameModelProxy);

            //UI层代理
            UIControllerListMediator uIControllerListMediator = new UIControllerListMediator(mainUI.UIControllerListView);

            Facade.RegisterMediator(uIControllerListMediator);



            //玩家组代理
            PlayerGroupProxy playerGroupProxy = new PlayerGroupProxy();

            Facade.RegisterProxy(playerGroupProxy);

            //游戏容器代理
            GameContainerProxy gameContainerProxy = new GameContainerProxy();

            Facade.RegisterProxy(gameContainerProxy);



            //选择阶段进程代理
            ChooseStageCircuitProxy chooseStageCircuitProxy = new ChooseStageCircuitProxy();

            Facade.RegisterProxy(chooseStageCircuitProxy);



            SendNotification(OrderSystemEvent.START_CIRCUIT, mainUI, OrderSystemEvent.START_CIRCUIT_MAIN);
        }
Ejemplo n.º 8
0
        public override void Execute(INotification notification)
        {
            PlayerGroupProxy        playerGroupProxy        = Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;
            ChooseStageCircuitProxy chooseStageCircuitProxy = Facade.RetrieveProxy(ChooseStageCircuitProxy.NAME) as ChooseStageCircuitProxy;
            CardDbProxy             cardDbProxy             = Facade.RetrieveProxy(CardDbProxy.NAME) as CardDbProxy;
            GameContainerProxy      gameContainerProxy      = Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;

            switch (notification.Type)
            {
            case UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE_ONE_CARD:
                CardEntry  card             = notification.Body as CardEntry;
                string     playerCodeChoose = chooseStageCircuitProxy.GetNowPlayerCode();
                PlayerItem playerItemNow    = playerGroupProxy.getPlayerByPlayerCode(playerCodeChoose);
                //如果能成功购买,该玩家的购买费用减少,否则返回购买力不够
                if (playerItemNow.shipCard.cost >= card.cost)
                {
                    //添加到卡组
                    gameContainerProxy.AddCardByPlayerItemAndGameContainerType(playerItemNow, "CardDeck", card);

                    // cardDbProxy.RemoveOneCardEntry(card);
                    playerItemNow.shipCard.cost -= card.cost;
                    SendNotification(UIViewSystemEvent.UI_CARD_DECK_LIST, playerItemNow, UIViewSystemEvent.UI_CARD_DECK_LIST_LOAD);
                    card.isBuyed = true;
                    SendNotification(UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE, card, UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE_ONE_CARD_SUCCESS);

                    //判断是否大于6回合
                    if (chooseStageCircuitProxy.chooseStageCircuitItem.chooseIndex == 7)
                    {
                        SendNotification(UIViewSystemEvent.UI_VIEW_CURRENT, UIViewConfig.getNameStrByUIViewName(UIViewName.ViewChooseMakeStage), UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW);
                        SendNotification(UIViewSystemEvent.UI_QUEST_STAGE, null, UIViewSystemEvent.UI_QUEST_STAGE_START);
                    }
                    else
                    {
                        //下一回合
                        chooseStageCircuitProxy.IntoNextTurn();
                        SendNotification(UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE, cardDbProxy.GetOneCardListForPool(), UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE_LOAD_NEXT_LIST);
                    }
                }
                else
                {
                    SendNotification(UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE, card, UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE_ONE_CARD_FAILURE);
                }

                break;
            }
        }
Ejemplo n.º 9
0
        public override void Execute(INotification notification)
        {
            OperateSystemProxy operateSystemProxy =
                Facade.RetrieveProxy(OperateSystemProxy.NAME) as OperateSystemProxy;
            QuestStageCircuitProxy questStageCircuitProxy =
                Facade.RetrieveProxy(QuestStageCircuitProxy.NAME) as QuestStageCircuitProxy;
            PlayerGroupProxy playerGroupProxy =
                Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;
            CardDbProxy cardDbProxy =
                Facade.RetrieveProxy(CardDbProxy.NAME) as CardDbProxy;
            EffectInfoProxy effectInfoProxy =
                Facade.RetrieveProxy(EffectInfoProxy.NAME) as EffectInfoProxy;
            GameModelProxy gameModelProxy =
                Facade.RetrieveProxy(GameModelProxy.NAME) as GameModelProxy;
            GameContainerProxy gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;
            HexGridProxy hexGridProxy =
                Facade.RetrieveProxy(HexGridProxy.NAME) as HexGridProxy;

            //获取当前操作玩家
            string playerCode = questStageCircuitProxy.GetNowHaveStagePlayerCode();

            if (playerCode == null)
            {
                return;
            }
            PlayerItem playerItem = playerGroupProxy.getPlayerByPlayerCode(playerCode);
            CardEntry  chooseHand = operateSystemProxy.operateSystemItem.onChooseCardEntry;

            switch (notification.Type)
            {
            //判断手牌是否可用
            case OperateSystemEvent.OPERATE_SYS_HAND_CAN_USE_JUDGE:
                string            playerCodeHandCanUseJudge = notification.Body as string;
                PlayerItem        playerItemHandCanUseJudge = playerGroupProxy.playerGroup.playerItems[playerCodeHandCanUseJudge];
                GameContainerItem gameContainerItem         = gameContainerProxy.GetGameContainerItemByPlayerItemAndGameContainerType(playerItemHandCanUseJudge, "CardHand");
                gameContainerItem.ChangeHandCardCanUse(questStageCircuitProxy.circuitItem);
                SendNotification(HandSystemEvent.HAND_CHANGE, gameContainerItem.cardEntryList, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_CHANGE_CAN_USE_JUDGE, playerCode));
                break;

            //选中战场上一个生物
            case OperateSystemEvent.OPERATE_SYS_POINTER_DOWN_ONE_MINION:
                CardEntry downMinionCard = notification.Body as CardEntry;
                operateSystemProxy.IntoModeByType(downMinionCard, playerItem, OperateSystemItem.OperateType.MinionControling);
                //渲染可移动区域
                SendNotification(HexSystemEvent.HEX_VIEW_SYS, operateSystemProxy.operateSystemItem, HexSystemEvent.HEX_VIEW_RENDER_CAN_MOVE_AND_ATK);
                //消息通知-划线组件激活
                SendNotification(OperateSystemEvent.OPERATE_TRAIL_DRAW, null, OperateSystemEvent.OPERATE_TRAIL_DRAW_START);

                break;

            //选中手牌
            case OperateSystemEvent.OPERATE_SYS_HAND_CHOOSE:
                CardEntry handCellItem = notification.Body as CardEntry;
                operateSystemProxy.IntoModeByType(handCellItem, playerItem, OperateSystemItem.OperateType.HandUse);
                switch (handCellItem.WhichCard)
                {
                case CardEntry.CardType.MinionCard:
                    //渲染可召唤区域
                    SendNotification(HexSystemEvent.HEX_VIEW_SYS, operateSystemProxy.operateSystemItem, HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL);
                    break;

                case CardEntry.CardType.TacticsCard:
                    //渲染可释放
                    //获取效果信息
                    //判断是否存在用于渲染的目标效果
                    if (handCellItem.cardInfo.targetSetToChooseList != null)
                    {
                        foreach (string targetSetToChooseCode in handCellItem.cardInfo.targetSetToChooseList)
                        {
                            TargetSet targetSetToChoose = effectInfoProxy.GetDepthCloneTargetSetByName(targetSetToChooseCode);
                            foreach (TargetClaim targetClaim in targetSetToChoose.targetClaims)
                            {
                                if (targetClaim.claim == "Owner")
                                {
                                    if (targetClaim.content == "Myself")
                                    {
                                        targetClaim.result.Add(playerItem.playerCode);
                                    }
                                }
                            }
                            if (targetSetToChoose.target == "Minion")
                            {
                                //传入效果,根据效果目标进行筛选渲染
                                SendNotification(MinionSystemEvent.MINION_SYS, targetSetToChoose, MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT);
                            }
                        }
                    }

                    break;
                }
                break;

            //划线结束选择了战场
            case OperateSystemEvent.OPERATE_SYS_DRAW_END_HEX:
                HexCellItem    hexCellItem = notification.Body as HexCellItem;
                HexCoordinates index       = hexCellItem.coordinates;
                //通知战场层去除渲染
                SendNotification(HexSystemEvent.HEX_VIEW_SYS, null, HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL_CANCEL);
                //判断状态
                if (operateSystemProxy.operateSystemItem.operateModeType == OperateSystemItem.OperateType.HandUse)
                {
                    UtilityLog.Log("玩家【" + playerCode + "】尝试操作手牌,手牌种类为【" + chooseHand.WhichCard + "】", LogUtType.Operate);
                    //如果成功释放了,还需要去除掉目标渲染
                    bool   checkUseSuccess = false;
                    string targetType      = "Null";
                    switch (chooseHand.WhichCard)
                    {
                    case CardEntry.CardType.ResourceCard:
                        UtilityLog.Log("玩家【" + playerCode + "】进行操作手牌,手牌种类为【" + chooseHand.WhichCard + "】", LogUtType.Operate);
                        checkUseSuccess = true;
                        //执行卡牌
                        //SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, chooseHand, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_CARD);
                        break;

                    case CardEntry.CardType.MinionCard:
                        //检查是否可用释放
                        bool canUse  = playerItem.CheckOneCardCanUse(chooseHand, questStageCircuitProxy.circuitItem);
                        bool canCall = playerItem.CheckOneCellCanCall(hexCellItem.coordinates);
                        //检查所选格子是否可用召唤
                        if (canUse && canCall)
                        {
                            checkUseSuccess     = true;
                            chooseHand.nowIndex = index;
                        }
                        else
                        {
                            SendNotification(OperateSystemEvent.OPERATE_SYS, null, OperateSystemEvent.OPERATE_SYS_DRAW_END_NULL);
                        }
                        break;

                    case CardEntry.CardType.TacticsCard:
                        //如果存在目标,则需要先选择目标再释放
                        if (chooseHand.cardInfo.targetSetToChooseList != null)
                        {
                            bool hasTarget = false;
                            foreach (string targetSetToChooseCode in chooseHand.cardInfo.targetSetToChooseList)
                            {
                                TargetSet targetSetToChoose = effectInfoProxy.GetDepthCloneTargetSetByName(targetSetToChooseCode);
                                if (targetSetToChoose.target == "Minion")
                                {
                                    targetType = "Minion";
                                    //判断格子上是否有生物
                                    CardEntry minionCellItem = gameContainerProxy.CheckHasCardEntryByGameContainerTypeAndHexCoordinates("CardBattlefield", index);
                                    if (minionCellItem != null)
                                    {
                                        //检查是否满足效果释放条件
                                        if (targetSetToChoose.checkEffectToTargetMinionCellItem(minionCellItem))
                                        {
                                            //确认目标
                                            chooseHand.targetBasicGameDto = minionCellItem;
                                            hasTarget = true;
                                        }
                                    }
                                }
                            }
                            if (hasTarget)
                            {
                                checkUseSuccess = true;
                            }
                        }
                        //如果不需要选择目标或者需要选择多个目标则先执行
                        else
                        {
                            checkUseSuccess = true;
                        }
                        break;
                    }
                    if (checkUseSuccess)
                    {
                        //减少费用-预先减少
                        playerItem.ChangeManaUsableByUseHand(chooseHand);
                        chooseHand.nextGameContainerType = "CardIsReleasing";
                        chooseHand.ttNeedChangeGameContainerType(chooseHand);
                        //减少费用-预先减少
                        playerItem.ChangeManaUsableByUseHand(chooseHand);
                        if (targetType == "Minion")
                        {
                            //取消渲染
                            SendNotification(MinionSystemEvent.MINION_SYS, null, MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_CLOSE);
                        }
                        //执行卡牌
                        SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, chooseHand, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_CARD);
                    }
                }
                else if (operateSystemProxy.operateSystemItem.operateModeType == OperateSystemItem.OperateType.MinionControling)
                {
                    UtilityLog.Log("玩家【" + playerCode + "】尝试操作生物", LogUtType.Special);
                    if (operateSystemProxy.operateSystemItem.onChooseCardEntry.canBeMovedCellMap.ContainsKey(index))
                    {
                        HexCellItem        endHexCellItem = operateSystemProxy.operateSystemItem.onChooseCardEntry.canBeMovedCellMap[index];
                        List <HexCellItem> cellRoute      = new List <HexCellItem>();
                        cellRoute.Add(endHexCellItem);
                        bool isOver = false;
                        while (!isOver)
                        {
                            if (endHexCellItem.pathfindingLastCell.coordinates.X == operateSystemProxy.operateSystemItem.onChooseCardEntry.nowIndex.X &&
                                endHexCellItem.pathfindingLastCell.coordinates.Z == operateSystemProxy.operateSystemItem.onChooseCardEntry.nowIndex.Z)
                            {
                                isOver = true;
                            }
                            else
                            {
                                cellRoute.Add(endHexCellItem.pathfindingLastCell);
                                endHexCellItem = endHexCellItem.pathfindingLastCell;
                            }
                        }
                        //路径是倒的,需要换成正序的
                        List <HexCellItem> positiveCellRoute = new List <HexCellItem>();
                        for (int n = cellRoute.Count - 1; n > -1; n--)
                        {
                            positiveCellRoute.Add(cellRoute[n]);
                        }
                        operateSystemProxy.operateSystemItem.onChooseCardEntry.cellRoute = positiveCellRoute;
                        effectInfoProxy.effectSysItem.showEffectNum++;
                        operateSystemProxy.operateSystemItem.onChooseCardEntry.MoveToTargetHexCoordinates(index);
                    }
                }

                break;

            case OperateSystemEvent.OPERATE_SYS_HAND_CHOOSE_EXE_OVER:
                //如果是战术,资源牌,放入墓地
                if (chooseHand.WhichCard == CardEntry.CardType.ResourceCard || chooseHand.WhichCard == CardEntry.CardType.TacticsCard)
                {
                    //在墓地添加手牌
                    chooseHand.nextGameContainerType = "CardGraveyard";
                    chooseHand.ttNeedChangeGameContainerType(chooseHand);
                }
                else if (chooseHand.WhichCard == CardEntry.CardType.MinionCard)
                {
                    gameContainerProxy.AddOneMinionByCard(chooseHand.nowIndex, chooseHand);
                    chooseHand.nextGameContainerType = "CardBattlefield";
                    chooseHand.ttNeedChangeGameContainerType(chooseHand);
                }
                //移除手牌
                playerItem.RemoveOneCardByUse(chooseHand);
                UtilityLog.Log("手牌【" + chooseHand.name + "】使用完毕:", LogUtType.Operate);
                //结束,改变模式为初始,清除手牌
                operateSystemProxy.IntoModeClose();
                break;

            case OperateSystemEvent.OPERATE_SYS_DRAW_END_NULL:
                //什么都没选
                switch (operateSystemProxy.operateSystemItem.operateModeType)
                {
                //手牌使用状态
                case OperateSystemItem.OperateType.HandUse:

                    //手牌回复原位
                    SendNotification(HandSystemEvent.HAND_CHANGE, chooseHand, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_CHANGE_UNCHECK_STATUS, playerItem.playerCode));
                    switch (chooseHand.WhichCard)
                    {
                    case CardEntry.CardType.MinionCard:
                        //通知战场层取消渲染
                        SendNotification(HexSystemEvent.HEX_VIEW_SYS, null, HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL_CANCEL);
                        operateSystemProxy.IntoModeClose();
                        break;

                    case CardEntry.CardType.TacticsCard:
                        EffectInfo effectInfo = effectInfoProxy.GetDepthCloneEffectByName(chooseHand.cardInfo.effectCodeList[0]);
                        foreach (TargetSet targetSet in effectInfo.operationalTarget.selectTargetList)
                        {
                            if (targetSet.target == "Minion")
                            {
                                //取消渲染
                                SendNotification(MinionSystemEvent.MINION_SYS, effectInfo, MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_CLOSE);
                            }
                        }


                        break;
                    }
                    break;
                }
                break;

            //选择一个生物作为某次选择的结果
            case OperateSystemEvent.OPERATE_SYS_CHOOSE_ONE_MINION:
                CardEntry oneChooseMinionCellItem = notification.Body as CardEntry;
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    EffectInfo effect = effectInfoProxy.effectSysItem.effectInfos[n];
                    if (effect.effectInfoStage == EffectInfoStage.ConfirmingTarget)
                    {
                        //遍历每一个前置效果
                        foreach (EffectInfo preEffect in effect.preEffectEntryList)
                        {
                            if (preEffect.effectInfoStage == EffectInfoStage.ConfirmingTarget)
                            {
                                preEffect.effectInfoStage = EffectInfoStage.ConfirmedTarget;
                                preEffect.needPlayerToChooseTargetSet.targetMinionCellItems.Add(oneChooseMinionCellItem);
                                break;
                            }
                        }
                        //遍历每一个后置效果
                        foreach (EffectInfo postEffect in effect.postEffectEntryList)
                        {
                            if (postEffect.effectInfoStage == EffectInfoStage.ConfirmingTarget)
                            {
                                postEffect.effectInfoStage = EffectInfoStage.ConfirmedTarget;
                                postEffect.needPlayerToChooseTargetSet.targetMinionCellItems.Add(oneChooseMinionCellItem);
                                break;
                            }
                        }
                        effectInfoProxy.effectSysItem.showEffectNum--;
                        //返回继续执行效果选择的信号
                        SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_FIND_TARGET);
                    }
                }
                break;

            //选择一个效果的某一个选项
            case OperateSystemEvent.OPERATE_SYS_CHOOSE_ONE_USER_SELECTION_ITEM:
                OneUserSelectionItem oneUserSelectionItem = notification.Body as OneUserSelectionItem;
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    EffectInfo effect = effectInfoProxy.effectSysItem.effectInfos[n];
                    if (effect.effectInfoStage == EffectInfoStage.AskTheUser)
                    {
                        //遍历每一个前置效果
                        foreach (EffectInfo preEffect in effect.preEffectEntryList)
                        {
                            if (preEffect.effectInfoStage == EffectInfoStage.AskTheUser)
                            {
                                preEffect.userChooseExecution = oneUserSelectionItem.isExecute;
                                preEffect.effectInfoStage     = EffectInfoStage.AskTheUserOver;
                                UtilityLog.Log("收到前台的反馈并修改了", LogUtType.Special);
                                break;
                            }
                        }
                        effect.effectInfoStage = EffectInfoStage.AskTheUserOver;
                        effectInfoProxy.effectSysItem.showEffectNum--;
                        //返回继续执行效果选择的信号
                        SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_ASK_THE_USER);
                    }
                }
                break;

            //选择一个效果类型,选择了目标
            case OperateSystemEvent.OPERATE_SYS_CHOOSE_ONE_EFFECT:
                CardEntry effectCard = notification.Body as CardEntry;
                //逻辑上可以确定只能有一个效果字段?
                if (effectCard.effectCodeList.Length > 1)
                {
                    UtilityLog.LogError("this chooseEffect has many Effect");
                }
                EffectInfo chooseEffect = effectInfoProxy.GetDepthCloneEffectByName(effectCard.effectCodeList[0]);
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    EffectInfo effect = effectInfoProxy.effectSysItem.effectInfos[n];
                    if (effect.effectInfoStage == EffectInfoStage.ConfirmingTarget)
                    {
                        foreach (TargetSet targetSet in effect.operationalTarget.selectTargetList)
                        {
                            if (targetSet.target == "ChooseEffect")
                            {
                                //确认目标
                                targetSet.targetEffectInfos.Add(chooseEffect);
                                //设置为确认完毕
                                effect.effectInfoStage = EffectInfoStage.ConfirmedTarget;
                                //添加新效果
                                //设置状态
                                chooseEffect.effectInfoStage = EffectInfoStage.UnStart;
                                //设置所有者,手牌操作模式,所有者是当前玩家
                                chooseEffect.player = playerItem;
                                //设置所属卡牌
                                chooseEffect.cardEntry = chooseHand;
                                //将这个效果添加到队列中
                                effectInfoProxy.effectSysItem.effectInfos.Add(chooseEffect);
                                //返回一个选择完毕的信号
                                SendNotification(
                                    UIViewSystemEvent.UI_VIEW_CURRENT,
                                    UIViewConfig.getNameStrByUIViewName(UIViewName.ChooseStage),
                                    StringUtil.GetNTByNotificationTypeAndUIViewNameAndMaskLayer(
                                        UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW,
                                        UIViewConfig.getNameStrByUIViewName(UIViewName.ChooseStage),
                                        "N"
                                        )
                                    );


                                //返回继续执行效果选择的信号
                                SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_FIND_TARGET);
                                return;
                            }
                            else
                            {
                                UtilityLog.LogError("this effectType is not ChooseEffect");
                            }
                        }
                    }
                }
                break;

            //打开了墓地
            case OperateSystemEvent.OPERATE_SYS_GRAVEYARD_LIST_LOAD:
                string     playerCodeOpenGraveyard = notification.Body as string;
                PlayerItem playerItemOpenGraveyard = playerGroupProxy.getPlayerByPlayerCode(playerCodeOpenGraveyard);
                //获取墓地的牌,并发送给前台
                SendNotification(
                    UIViewSystemEvent.UI_VIEW_CURRENT,
                    gameContainerProxy.GetGameContainerItemByPlayerItemAndGameContainerType(playerItemOpenGraveyard, "CardGraveyard"),
                    StringUtil.GetNTByNotificationTypeAndUIViewNameAndMaskLayer(
                        UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                        UIViewConfig.getNameStrByUIViewName(UIViewName.GraveyardListView),
                        "Y"
                        )
                    );

                break;
            }
        }
Ejemplo n.º 10
0
        public override void Execute(INotification notification)
        {
            PlayerGroupProxy   playerGroupProxy   = Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;
            EffectInfoProxy    effectInfoProxy    = Facade.RetrieveProxy(EffectInfoProxy.NAME) as EffectInfoProxy;
            CardDbProxy        cardDbProxy        = Facade.RetrieveProxy(CardDbProxy.NAME) as CardDbProxy;
            HexGridProxy       hexGridProxy       = Facade.RetrieveProxy(HexGridProxy.NAME) as HexGridProxy;
            OperateSystemProxy operateSystemProxy = Facade.RetrieveProxy(OperateSystemProxy.NAME) as OperateSystemProxy;
            GameModelProxy     gameModelProxy     = Facade.RetrieveProxy(GameModelProxy.NAME) as GameModelProxy;

            QuestStageCircuitProxy questStageCircuitProxy = Facade.RetrieveProxy(QuestStageCircuitProxy.NAME) as QuestStageCircuitProxy;

            GameContainerProxy gameContainerProxy = Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;



            switch (notification.Type)
            {
            case UIViewSystemEvent.UI_QUEST_STAGE_START_SPECIAL:
                TestCaseInfo chooseOneTestCase = notification.Body as TestCaseInfo;
                //读取默认设置
                GameInterfacePreparationByGameModel(gameModelProxy,
                                                    playerGroupProxy,
                                                    questStageCircuitProxy,
                                                    effectInfoProxy,
                                                    gameContainerProxy,
                                                    chooseOneTestCase.gameModelName);

                //读取存储json文件
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    PI_Player pI_Player = new PI_Player();
                    if (playerItem.playerCode == "TEST1")
                    {
                        pI_Player = chooseOneTestCase.myselfPlayer;
                    }
                    else
                    {
                        pI_Player = chooseOneTestCase.enemyPlayer;
                    }
                    foreach (PI_GameContainer pI_GameContainer in pI_Player.gameContainerList)
                    {
                        List <CardEntry> cardEntries = new List <CardEntry>();
                        foreach (string cardCode in pI_GameContainer.gameContainerContent)
                        {
                            CardEntry cardEntry = cardDbProxy.GetCardEntryByCode(cardCode);
                            cardEntry.controllerPlayerItem = playerItem;
                            cardEntry.ttCardNeedAddToTTS(cardEntry);
                            cardEntries.Add(cardEntry);
                        }
                        gameContainerProxy.AddCardListByPlayerItemAndGameContainerType(playerItem, pI_GameContainer.gameContainerType, cardEntries);
                    }

                    CardEntry shipCard = cardDbProxy.GetCardEntryByCode(pI_Player.shipCardCode);
                    playerItem.shipCard = shipCard;
                    //费用上限和可用费用
                    playerItem.LoadingManaInfo(pI_Player.manaUpperLimit, pI_Player.manaUpperLimit);
                    //科技
                    foreach (string trait in pI_Player.traitList)
                    {
                        playerItem.traitCombination.AddTraitType(trait);
                    }
                    //生物渲染?
                    foreach (PI_Minion pI_Minion in pI_Player.minionList)
                    {
                        HexCoordinates index     = new HexCoordinates(pI_Minion.x, pI_Minion.z);
                        CardEntry      cardEntry = cardDbProxy.GetCardEntryByCode(pI_Minion.code);
                        cardEntry.controllerPlayerItem = playerItem;
                        gameContainerProxy.AddOneMinionByCard(index, cardEntry);
                        gameContainerProxy.AddCardByPlayerItemAndGameContainerType(playerItem, "CardBattlefield", cardEntry);
                        hexGridProxy.HexGrid.cellMap[index].inThisCellCardList.Add(cardEntry);
                    }
                }
                questStageCircuitProxy.CircuitStart(playerGroupProxy.playerGroup.playerItems);
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    //刷新手牌是否可用
                    GameContainerItem gameContainerItem = gameContainerProxy.GetGameContainerItemByPlayerItemAndGameContainerType(playerItem, "CardHand");
                    //先开启手牌栏
                    SendNotification(HandSystemEvent.HAND_VIEW_SYS, null, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_VIEW_SYS_INIT_PLAYER_CODE, playerItem.playerCode));
                    //手牌渲染
                    SendNotification(HandSystemEvent.HAND_CHANGE, gameContainerItem, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_CHANGE_AFFLUX, playerItem.playerCode));
                    //获取船只的效果,如果是持续效果则添加到全局监听中
                    foreach (string effectCode in playerItem.shipCard.effectCodeList)
                    {
                        EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectCode);
                        if (oneEffectInfo.impactType == "Continue")
                        {
                            oneEffectInfo.player    = playerItem;
                            oneEffectInfo.cardEntry = playerItem.shipCard;
                            questStageCircuitProxy.circuitItem.putOneEffectInfoInActiveMap(oneEffectInfo, effectInfoProxy.effectSysItem.impactTimeTriggerMap);
                        }
                    }
                    VariableAttribute manaVariableAttribute = playerItem.playerVariableAttributeMap.variableAttributeMap["Mana"];

                    SendNotification(UIViewSystemEvent.UI_MANA_INFA_SYS, manaVariableAttribute, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_MANA_INFA_SYS_INIT, playerItem.playerCode));
                    SendNotification(UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS, playerItem.traitCombination.traitTypes, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS_INIT, playerItem.playerCode));
                }
                ShowSomeInCommonUseUIView();
                SendNotification(UIViewSystemEvent.UI_QUEST_TURN_STAGE, null, UIViewSystemEvent.UI_QUEST_TURN_STAGE_ASSIGN_START_OF_TRUN);

                break;

            case UIViewSystemEvent.UI_QUEST_STAGE_START:
                //读取默认设置
                GameInterfacePreparationByGameModel(gameModelProxy,
                                                    playerGroupProxy,
                                                    questStageCircuitProxy,
                                                    effectInfoProxy,
                                                    gameContainerProxy,
                                                    "Andor");

                questStageCircuitProxy.CircuitStart(playerGroupProxy.playerGroup.playerItems);
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    //创建牌库
                    List <CardEntry> cardEntryList = new List <CardEntry>();
                    for (int i = 0; i < 20; i++)
                    {
                        CardEntry cardEntry = new CardEntry();
                        if (i % 3 == 0)
                        {
                            //生物
                            cardEntry = cardDbProxy.GetCardEntryByCode("ImperialRecruit");
                        }
                        else if (i % 3 == 1)
                        {
                            //事件
                            cardEntry = cardDbProxy.GetCardEntryByCode("FortifiedAgent");
                        }
                        else
                        {
                            //资源
                            cardEntry = cardDbProxy.GetCardEntryByCode("TaxCar");
                        }
                        cardEntry.controllerPlayerItem = playerItem;
                        cardEntry.ttCardNeedAddToTTS(cardEntry);
                        cardEntryList.Add(cardEntry);
                    }
                    gameContainerProxy.AddCardListByPlayerItemAndGameContainerType(playerItem, "CardDeck", cardEntryList);
                    CardEntry shipCard = cardDbProxy.GetCardEntryByCode("FindWay");
                    playerItem.shipCard = shipCard;
                }
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    //先开启手牌栏
                    SendNotification(HandSystemEvent.HAND_VIEW_SYS, null, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_VIEW_SYS_INIT_PLAYER_CODE, playerItem.playerCode));

                    //分发手牌
                    playerItem.DrawCard(3);
                    //设置起始费用上限1
                    //设置当前费用为0
                    playerItem.LoadingManaInfo(1, 0);
                    //获取船只的效果,如果是持续效果则添加到全局监听中
                    foreach (string effectCode in playerItem.shipCard.effectCodeList)
                    {
                        EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectCode);
                        if (oneEffectInfo.impactType == "Continue")
                        {
                            oneEffectInfo.player    = playerItem;
                            oneEffectInfo.cardEntry = playerItem.shipCard;
                            questStageCircuitProxy.circuitItem.putOneEffectInfoInActiveMap(oneEffectInfo, effectInfoProxy.effectSysItem.impactTimeTriggerMap);
                        }
                    }
                    VariableAttribute manaVariableAttribute = playerItem.playerVariableAttributeMap.variableAttributeMap["Mana"];
                    SendNotification(UIViewSystemEvent.UI_MANA_INFA_SYS, manaVariableAttribute, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_MANA_INFA_SYS_INIT, playerItem.playerCode));

                    SendNotification(UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS, playerItem.traitCombination.traitTypes, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS_INIT, playerItem.playerCode));
                    //手牌渲染
                    //SendNotification(HandSystemEvent.HAND_CHANGE, playerItem.handGridItem, StringUtil.NotificationTypeAddPlayerCode(HandSystemEvent.HAND_CHANGE_AFFLUX, playerItem.playerCode));
                }
                ShowSomeInCommonUseUIView();
                UtilityLog.Log("测试准备完成", LogUtType.Other);
                SendNotification(UIViewSystemEvent.UI_QUEST_TURN_STAGE, null, UIViewSystemEvent.UI_QUEST_TURN_STAGE_START_OF_TRUN);
                break;
            }
        }
Ejemplo n.º 11
0
        //读取模式并做出一定的设置
        public void GameInterfacePreparationByGameModel(GameModelProxy gameModelProxy,
                                                        PlayerGroupProxy playerGroupProxy,
                                                        QuestStageCircuitProxy questStageCircuitProxy,
                                                        EffectInfoProxy effectInfoProxy,
                                                        GameContainerProxy gameContainerProxy,
                                                        string gameModelName)
        {
            gameModelProxy.setGameModelNow(gameModelName);

            HexGridProxy hexGridProxy = Facade.RetrieveProxy(HexGridProxy.NAME) as HexGridProxy;

            hexGridProxy.InitializeTheProxy(gameModelProxy.hexModelInfoNow);

            int number = 0;

            foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
            {
                GM_PlayerSite playerSiteOne = gameModelProxy.gameModelNow.playerSiteList[number];
                playerItem.LoadingGameModelPlayerSet(playerSiteOne);
                gameContainerProxy.CreateNecessaryContainer(playerItem, gameModelProxy.gameModelNow.gameContainerTypeList);
                number++;
            }
            //初始化流程信息
            //将流程需要的监听放入到监听效果集合中
            for (int n = 0; n < gameModelProxy.gameModelNow.turnStage.Length; n++)
            {
                GM_OneStageSite oneStageSite = gameModelProxy.stageSiteMap[gameModelProxy.gameModelNow.turnStage[n]];
                questStageCircuitProxy.circuitItem.questOneTurnStageList.Add(oneStageSite);
                foreach (string effectCode in oneStageSite.effectNeedExeList)
                {
                    //创建空的实体信息,在执行的时候会用到
                    EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectCode);
                    CardEntry  cardEntry     = new CardEntry();
                    PlayerItem player        = new PlayerItem("NONE");
                    oneEffectInfo.cardEntry = cardEntry;
                    oneEffectInfo.player    = player;

                    if (oneEffectInfo.impactType == "GameModelRule")
                    {
                        questStageCircuitProxy.circuitItem.putOneEffectInfoInActiveMap(oneEffectInfo, effectInfoProxy.effectSysItem.impactTimeTriggerMap);
                    }
                }
            }

            //通知渲染战场
            SendNotification(HexSystemEvent.HEX_VIEW_SYS, null, HexSystemEvent.HEX_VIEW_SYS_SHOW_START);
            //渲染费用栏
            SendNotification(
                UIViewSystemEvent.UI_VIEW_CURRENT,
                null,
                StringUtil.GetNTByNotificationTypeAndUIViewName(
                    UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                    UIViewConfig.getNameStrByUIViewName(UIViewName.ManaInfoView)
                    )
                );
            //渲染科技栏
            SendNotification(
                UIViewSystemEvent.UI_VIEW_CURRENT,
                null,
                StringUtil.GetNTByNotificationTypeAndUIViewName(
                    UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                    UIViewConfig.getNameStrByUIViewName(UIViewName.TraitCombinationView)
                    )
                );
            //渲染船只栏
            SendNotification(
                UIViewSystemEvent.UI_VIEW_CURRENT,
                null,
                StringUtil.GetNTByNotificationTypeAndUIViewName(
                    UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                    UIViewConfig.getNameStrByUIViewName(UIViewName.ShipComponentView)
                    )
                );
            //打开回合控制栏
            SendNotification(
                UIViewSystemEvent.UI_VIEW_CURRENT,
                questStageCircuitProxy.circuitItem.questOneTurnStageList,
                StringUtil.GetNTByNotificationTypeAndUIViewName(
                    UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                    UIViewConfig.getNameStrByUIViewName(UIViewName.TurnSysProgressBarView)
                    )
                );
        }
Ejemplo n.º 12
0
        bool ChangeOrCheckCard(string impactTarget, string impactContent, CardEntry cardEntry, GameContainerProxy gameContainerProxy, EffectExeType effectExeType)
        {
            bool canExecute = true;

            if (impactTarget == "GameContainerType")
            {
                gameContainerProxy.MoveOneCardFromOldeContainerItemToNeweContainerItem(cardEntry, impactContent);
            }

            return(canExecute);
        }
Ejemplo n.º 13
0
 public bool EffectExecution(EffectInfo exeEffect, EffectExeType effectExeType, GameContainerProxy gameContainerProxy)
 {
     if (exeEffect.operationalContent != null)
     {
         if (exeEffect.operationalContent.operationalTarget == "All")
         {
             foreach (TargetSet targetSetDto in exeEffect.operationalTarget.selectTargetList)
             {
                 if (targetSetDto.target == "Minion")
                 {
                     for (int n = 0; n < targetSetDto.targetMinionCellItems.Count; n++)
                     {
                         if (!exeEffect.isReverse)
                         {
                             if (exeEffect.effectiveTime.ContinuousStage != "Moment" && exeEffect.effectiveTime.ContinuousStage != "Permanent")
                             {
                                 targetSetDto.targetMinionCellItems[n].effectBuffInfoList.Add(exeEffect);
                                 targetSetDto.targetMinionCellItems[n].ttBuffChange();
                             }
                         }
                         for (int m = 0; m < exeEffect.operationalContent.impactTargets.Length; m++)
                         {
                             bool result = ChangeOrCheckMinion(exeEffect.operationalContent.impactTargets[m],
                                                               exeEffect.operationalContent.impactContents[m],
                                                               targetSetDto.targetMinionCellItems[n],
                                                               exeEffect.isReverse,
                                                               effectExeType);
                         }
                     }
                 }
                 else if (targetSetDto.target == "Player")
                 {
                     for (int n = 0; n < targetSetDto.targetPlayerItems.Count; n++)
                     {
                         UtilityLog.Log("目标玩家【" + targetSetDto.targetPlayerItems[n].playerCode + "】生效效果【" + exeEffect.description + "】", LogUtType.Effect);
                         for (int m = 0; m < exeEffect.operationalContent.impactTargets.Length; m++)
                         {
                             bool result = ChangeOrCheckPlayer(
                                 exeEffect.operationalContent.impactTargets[m],
                                 exeEffect.operationalContent.impactContents[m],
                                 targetSetDto.targetPlayerItems[n],
                                 effectExeType);
                             if (!result)
                             {
                                 return(false);
                             }
                         }
                     }
                 }
                 else if (targetSetDto.target == "Card")
                 {
                     for (int n = 0; n < targetSetDto.targetCardEntries.Count; n++)
                     {
                         for (int m = 0; m < exeEffect.operationalContent.impactTargets.Length; m++)
                         {
                             bool result = ChangeOrCheckCard(
                                 exeEffect.operationalContent.impactTargets[m],
                                 exeEffect.operationalContent.impactContents[m],
                                 targetSetDto.targetCardEntries[n],
                                 gameContainerProxy,
                                 effectExeType);
                             if (!result)
                             {
                                 return(false);
                             }
                         }
                     }
                 }
             }
         }
     }
     return(true);
 }
Ejemplo n.º 14
0
        public bool FindTargetOrObejct(EffectInfo effectInfo, TargetSet targetSet,
                                       EffectInfoProxy effectInfoProxy,
                                       PlayerGroupProxy playerGroupProxy,
                                       QuestStageCircuitProxy questStageCircuitProxy,
                                       GameContainerProxy gameContainerProxy)
        {
            bool designationTargetOver = false;

            effectInfo.needPlayerToChooseTargetSet = targetSet;
            //先判断是否已经指定了目标
            switch (targetSet.target)
            {
            case "Minion":
                if (targetSet.targetMinionCellItems.Count == targetSet.targetClaimsNums)
                {
                    designationTargetOver = true;
                }
                break;
            }
            if (designationTargetOver)
            {
                targetSet.hasTarget = true;
                return(true);
            }
            //条件
            TargetClaim[] targetClaims = targetSet.targetClaims;

            //目标玩家
            PlayerItem targetPlayer = null;

            //类型
            switch (targetSet.target)
            {
            case "Card":
                List <CardEntry> cardEntries       = new List <CardEntry>();
                string           gameContainerType = targetSet.targetSource;
                PlayerItem       gameContainerControllerPlayerItem = null;
                for (int n = 0; n < targetClaims.Length; n++)
                {
                    //判断所有权
                    if (targetClaims[n].claim == "Owner")
                    {
                        //是自己选
                        if (targetClaims[n].content == "Myself")
                        {
                            gameContainerControllerPlayerItem = effectInfo.player;
                        }
                    }
                }
                GameContainerItem gameContainerItem = gameContainerProxy.GetGameContainerItemByPlayerItemAndGameContainerType(gameContainerControllerPlayerItem, gameContainerType);
                for (int n = 0; n < targetClaims.Length; n++)
                {
                    //判断所有权
                    if (targetClaims[n].claim == "locationIndex")
                    {
                        cardEntries.Add(gameContainerItem.cardEntryList[Convert.ToInt32(targetClaims[n].content)]);
                    }
                    else if (targetClaims[n].claim == "CardCode")
                    {
                        CardEntry cardEntryByCode = gameContainerItem.GetOneCardByCardCode(targetClaims[n].content);
                        if (cardEntryByCode != null)
                        {
                            cardEntries.Add(cardEntryByCode);
                        }
                    }
                }
                if (cardEntries.Count > 0)
                {
                    if (targetSet.targetClaimsNums == 1)
                    {
                        targetSet.hasTarget = true;
                        targetSet.targetCardEntries.Add(cardEntries[0]);
                    }
                }
                break;

            case "Minion":
                List <CardEntry>         minionCellItems             = new List <CardEntry>();
                List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield");
                foreach (GameContainerItem gameContainerItemMinion in returnGameContainerItemList)
                {
                    foreach (CardEntry minionCellItem in gameContainerItemMinion.cardEntryList)
                    {
                        for (int n = 0; n < targetClaims.Length; n++)
                        {
                            //判断所有权
                            if (targetClaims[n].claim == "Owner")
                            {
                                //是自己的
                                if (targetClaims[n].content == "Myself")
                                {
                                    targetClaims[n].result.Add(effectInfo.player.playerCode);
                                    if (minionCellItem.controllerPlayerItem.playerCode == effectInfo.player.playerCode)
                                    {
                                        minionCellItems.Add(minionCellItem);
                                    }
                                }
                                //不是自己的
                                else if (targetClaims[n].content == "Enemy")
                                {
                                    targetClaims[n].result.Add(effectInfo.player.playerCode);
                                    if (minionCellItem.controllerPlayerItem.playerCode != effectInfo.player.playerCode)
                                    {
                                        minionCellItems.Add(minionCellItem);
                                    }
                                }
                            }
                        }
                    }
                }
                if (minionCellItems.Count <= targetSet.targetClaimsNums)
                {
                    //符合数量限制
                    targetSet.hasTarget             = true;
                    targetSet.targetMinionCellItems = minionCellItems;
                }
                else
                {
                    //超出目标上限,需要用户选择
                    if (effectInfo.operationalTarget.whoOperate == "MyselfPlayer")
                    {
                        effectInfo.chooseByPlayer = effectInfo.player;
                        //发送已经确认目标的效果到前台进行展示
                        CardEntry oneCardEntry = effectInfo.cardEntry;
                        oneCardEntry.needShowEffectInfo = effectInfo;
                        effectInfoProxy.effectSysItem.showEffectNum++;
                        SendNotification(UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS, oneCardEntry, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_ONE_EFFECT_NEED_CHOOSE_TARGET);
                        //发布用户需要选择信号
                        SendNotification(LogicalSysEvent.LOGICAL_SYS, effectInfo, LogicalSysEvent.LOGICAL_SYS_NEED_PLAYER_CHOOSE);
                    }
                    else
                    {
                        UtilityLog.LogError("找不到需要选择的用户");
                    }
                    return(false);
                }

                break;

            //效果选择
            case "ChooseEffect":
                //获取玩家,根据条件筛选出复合条件的释放者和选择者
                //筛选结果
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    for (int n = 0; n < targetClaims.Length; n++)
                    {
                        //判断所有权
                        if (targetClaims[n].claim == "Owner")
                        {
                            //是自己选
                            if (targetClaims[n].content == "Myself")
                            {
                                if (playerItem.playerCode == effectInfo.player.playerCode)
                                {
                                    targetPlayer = playerItem;
                                }
                            }
                        }
                    }
                }
                if (targetPlayer != null)
                {
                    effectInfo.chooseByPlayer = targetPlayer;
                    //发布用户需要选择信号
                    SendNotification(LogicalSysEvent.LOGICAL_SYS, effectInfo, LogicalSysEvent.LOGICAL_SYS_NEED_PLAYER_CHOOSE);
                    return(false);
                    //
                }
                else
                {
                    UtilityLog.LogError("no player can ChooseEffect");
                }

                break;

            //玩家
            case "Player":
                //获取玩家,根据条件筛选出复合条件的释放者和选择者
                //筛选结果
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    for (int n = 0; n < targetClaims.Length; n++)
                    {
                        //判断所有权
                        if (targetClaims[n].claim == "Owner")
                        {
                            //是自己选
                            if (targetClaims[n].content == "Myself")
                            {
                                if (playerItem.playerCode == effectInfo.player.playerCode)
                                {
                                    targetPlayer = playerItem;
                                }
                            }
                        }
                    }
                }
                if (targetPlayer != null)
                {
                    //玩家确认
                    targetSet.targetPlayerItems.Add(targetPlayer);
                    targetSet.hasTarget = true;
                }
                else
                {
                    UtilityLog.LogError("no player can add TargetPlayerItems");
                }
                break;
            }
            return(true);
        }
Ejemplo n.º 15
0
 //执行一个效果
 public void ExecutionOneEffectContent(EffectInfoProxy effectInfoProxy, EffectInfo effectInfo, GameContainerProxy gameContainerProxy)
 {
     EffectExecution(effectInfo, EffectExeType.Execute, gameContainerProxy);
     effectInfo.effectInfoStage = EffectInfoStage.Finished;
     //进行效果执行完之后的检查
     //SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_PUT_ONE_EFFECT);
 }
Ejemplo n.º 16
0
        public override void Execute(INotification notification)
        {
            EffectInfoProxy effectInfoProxy =
                Facade.RetrieveProxy(EffectInfoProxy.NAME) as EffectInfoProxy;
            PlayerGroupProxy playerGroupProxy =
                Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;
            OperateSystemProxy operateSystemProxy =
                Facade.RetrieveProxy(OperateSystemProxy.NAME) as OperateSystemProxy;
            QuestStageCircuitProxy questStageCircuitProxy =
                Facade.RetrieveProxy(QuestStageCircuitProxy.NAME) as QuestStageCircuitProxy;
            GameContainerProxy gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;

            //待执行的卡牌
            CardEntry exeEffectCard = null;

            switch (notification.Type)
            {
            //执行一张卡
            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_CARD:
                exeEffectCard = notification.Body as CardEntry;
                operateSystemProxy.IntoModeByType(exeEffectCard, exeEffectCard.controllerPlayerItem, OperateSystemItem.OperateType.CardIsReleasing);
                //提取待执行的卡牌效果
                List <EffectInfo> oneExeEffectCardEffects = new List <EffectInfo>();
                //遍历卡牌的效果
                foreach (string effectCode in exeEffectCard.effectCodeList)
                {
                    EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectCode);
                    if (oneEffectInfo.impactTimeTriggers == null)
                    {
                        //设置状态
                        oneEffectInfo.effectInfoStage = EffectInfoStage.UnStart;
                        //设置所有者,手牌操作模式,所有者是当前玩家
                        oneEffectInfo.player = exeEffectCard.controllerPlayerItem;
                        //设置所属卡牌
                        oneEffectInfo.cardEntry = exeEffectCard;
                        //是否有预先选定的目标对象
                        if (exeEffectCard.targetBasicGameDto != null)
                        {
                            if (exeEffectCard.targetBasicGameDto.dtoType == "Minion")
                            {
                                foreach (TargetSet targetSet in oneEffectInfo.operationalTarget.selectTargetList)
                                {
                                    if (targetSet.target == "Minion")
                                    {
                                        targetSet.targetMinionCellItems.Add(exeEffectCard.targetBasicGameDto as CardEntry);
                                    }
                                }
                            }
                        }
                        oneExeEffectCardEffects.Add(oneEffectInfo);
                    }
                }
                //存入效果,进行结算
                effectInfoProxy.IntoModeCardSettle(exeEffectCard, oneExeEffectCardEffects);
                break;

            //执行一张已经触发效果的卡
            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_TRIGGERED_CARD:
                exeEffectCard = notification.Body as CardEntry;
                //提取待执行的卡牌效果
                List <EffectInfo> oneTriggeredEffectCardEffects = new List <EffectInfo>();
                oneTriggeredEffectCardEffects.Add(exeEffectCard.triggeredEffectInfo);
                effectInfoProxy.IntoModeCardSettle(exeEffectCard, oneTriggeredEffectCardEffects);
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_FIND_TARGET:
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    EffectInfo effect = effectInfoProxy.effectSysItem.effectInfos[n];
                    if (effect.effectType == "Independent")
                    {
                        bool hasTarget = ExecutionEffectFindTarget(effect, effectInfoProxy, playerGroupProxy, questStageCircuitProxy, gameContainerProxy);
                        //没能正确的寻找到目标,防止循环继续执行下去导致效果执行两边,直接返回
                        if (!hasTarget)
                        {
                            return;
                        }
                    }
                    else if (effect.effectType == "BeforeAndAfter")
                    {
                        bool allHasTarget = ExecutionEffectFindTargetForBeforeAndAfter(effect, playerGroupProxy, questStageCircuitProxy, effectInfoProxy, gameContainerProxy);
                        if (!allHasTarget)
                        {
                            return;
                        }
                    }
                }
                //判断是否所有效果都存在了目标
                bool allEffectHasTarget = true;
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    if (effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage == EffectInfoStage.UnStart ||
                        effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage == EffectInfoStage.ConfirmingTarget)
                    {
                        allEffectHasTarget = false;
                    }
                }
                //询问是否需要用户操作
                if (allEffectHasTarget)
                {
                    SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_ASK_THE_USER);
                }
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_ASK_THE_USER:
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    EffectInfo effect = effectInfoProxy.effectSysItem.effectInfos[n];
                    if (effect.effectInfoStage == EffectInfoStage.ConfirmedTarget)
                    {
                        AskTheUserOperating(effect,
                                            playerGroupProxy,
                                            questStageCircuitProxy,
                                            effectInfoProxy,
                                            gameContainerProxy
                                            );
                    }
                }
                //判断是否所有效果都进行了用户选择
                bool allEffectHasUserSelect = true;
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    if (effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage == EffectInfoStage.UnStart ||
                        effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage == EffectInfoStage.ConfirmingTarget ||
                        effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage == EffectInfoStage.ConfirmedTarget ||
                        effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage == EffectInfoStage.AskTheUser
                        )
                    {
                        allEffectHasUserSelect = false;
                    }
                }
                if (allEffectHasUserSelect)
                {
                    //执行效果
                    SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_EFFECT);
                }
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_EFFECT_SHOW_OVER:
                effectInfoProxy.effectSysItem.showEffectNum--;
                if (effectInfoProxy.effectSysItem.effectSysItemStage == EffectSysItemStage.UnStart)
                {
                    if (effectInfoProxy.effectSysItem.cardEntryQueue.Count == 0)
                    {
                        if (effectInfoProxy.effectSysItem.showEffectNum == 0)
                        {
                            UtilityLog.Log("所有效果展示完毕" + System.Guid.NewGuid().ToString("N"), LogUtType.Effect);
                            //通知回合控制器当前堆叠已经全部执行完毕
                            SendNotification(UIViewSystemEvent.UI_QUEST_TURN_STAGE, null, UIViewSystemEvent.UI_QUEST_TURN_STAGE_NEED_CHECK_END_STAGE_STATE);
                        }
                    }
                }
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_MINION_BUFF_NEED_REMOVE:
                CardEntry needRemoveBuffMinionCellItem = notification.Body as CardEntry;
                UtilityLog.Log("生物【" + needRemoveBuffMinionCellItem.name + "】的buff需要被清除", LogUtType.Effect);
                foreach (EffectInfo oneEffectInfoBuffCheck in needRemoveBuffMinionCellItem.effectBuffInfoList)
                {
                    if (oneEffectInfoBuffCheck.effectiveTime.ContinuousRound == 0)
                    {
                        //提取待执行的卡牌效果
                        List <EffectInfo> oneBuffCleanEffectCardEffects = new List <EffectInfo>();
                        UtilityLog.Log("生物【" + needRemoveBuffMinionCellItem.name + "】的buff【" + oneEffectInfoBuffCheck.code + "】需要被清除", LogUtType.Special);
                        EffectInfo oneReverseEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(oneEffectInfoBuffCheck.code);
                        foreach (TargetSet targetSet in oneReverseEffectInfo.operationalTarget.selectTargetList)
                        {
                            targetSet.targetMinionCellItems.Add(needRemoveBuffMinionCellItem);
                        }
                        oneReverseEffectInfo.effectInfoStage = EffectInfoStage.ConfirmedTarget;
                        oneReverseEffectInfo.whetherToshow   = "N";
                        oneReverseEffectInfo.isReverse       = true;

                        CardEntry cardEntry = new CardEntry();
                        cardEntry.name = "BuffClean";
                        cardEntry.controllerPlayerItem = needRemoveBuffMinionCellItem.controllerPlayerItem;
                        oneReverseEffectInfo.cardEntry = cardEntry;
                        oneBuffCleanEffectCardEffects.Add(oneReverseEffectInfo);
                        effectInfoProxy.IntoModeCardSettle(cardEntry, oneBuffCleanEffectCardEffects);
                    }
                }
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_EFFECT:
                ExecutionEffectContentList(effectInfoProxy, gameContainerProxy);
                //判断是否所有效果都执行完毕了
                bool allEffectHasFinished = true;
                for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                {
                    if (effectInfoProxy.effectSysItem.effectInfos[n].effectInfoStage != EffectInfoStage.Finished)
                    {
                        allEffectHasFinished = false;
                    }
                }
                if (allEffectHasFinished)
                {
                    for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                    {
                        if (effectInfoProxy.effectSysItem.effectInfos[n].impactTimeTriggertMonitorListWhenOver != null)
                        {
                            //把效果结算完毕的时点都发送出去
                            foreach (string impactTimeTriggertMonitor in effectInfoProxy.effectSysItem.effectInfos[n].impactTimeTriggertMonitorListWhenOver)
                            {
                                SendNotification(TimeTriggerEvent.TIME_TRIGGER_SYS, null, StringUtil.GetNTByNotificationTypeAndPlayerCode(impactTimeTriggertMonitor, effectInfoProxy.effectSysItem.effectInfos[n].player.playerCode));
                            }
                        }
                    }
                    //判断这一组效果是不是都是一张卡的,逻辑上来说都是一张卡
                    CardEntry cardCheck     = new CardEntry();
                    bool      cardCheckOver = true;
                    for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++)
                    {
                        if (n == 0)
                        {
                            cardCheck = effectInfoProxy.effectSysItem.effectInfos[n].cardEntry;
                        }
                        else
                        {
                            if (effectInfoProxy.effectSysItem.effectInfos[n].cardEntry.uuid != cardCheck.uuid)
                            {
                                cardCheckOver = false;
                                break;
                            }
                            else
                            {
                                cardCheck = effectInfoProxy.effectSysItem.effectInfos[n].cardEntry;
                            }
                        }
                    }
                    if (effectInfoProxy.effectSysItem.effectInfos.Count == 0)
                    {
                        cardCheck = effectInfoProxy.effectSysItem.cardEntry;
                    }
                    if (!cardCheckOver)
                    {
                        UtilityLog.LogError("同一个效果组来源多余一个实体");
                    }
                    else
                    {
                        if (cardCheck.lastGameContainerType == "CardHand")
                        {
                            SendNotification(OperateSystemEvent.OPERATE_SYS, null, OperateSystemEvent.OPERATE_SYS_HAND_CHOOSE_EXE_OVER);
                        }
                    }
                    //执行下一组效果
                    effectInfoProxy.effectSysItem.effectSysItemStage = EffectSysItemStage.UnStart;
                    //通知时点触发器这一组效果执行完毕了
                    SendNotification(TimeTriggerEvent.TIME_TRIGGER_SYS, null, TimeTriggerEvent.TIME_TRIGGER_EXE_NEXT_DELAY_NOTIFICATION);
                    effectInfoProxy.ExeEffectQueue();
                }
                else
                {
                    UtilityLog.LogError("效果执行失败");
                }
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_LAUNCH_AN_ATTACK:
                CardEntry      attackMinionCellItem = notification.Body as CardEntry;
                PlayerItem     playerItemAttack     = attackMinionCellItem.controllerPlayerItem;
                HexCoordinates vectorHexCoordinates = new HexCoordinates(playerItemAttack.playerSiteOne.attackDefaultDirection.x, playerItemAttack.playerSiteOne.attackDefaultDirection.z);
                HexCoordinates targetHexCoordinates = HexUtil.GetTargetHexCoordinatesByStartPointAndVector(attackMinionCellItem.nowIndex, vectorHexCoordinates);

                CardEntry defensiveMinionCellItem = gameContainerProxy.CheckHasCardEntryByGameContainerTypeAndHexCoordinates("CardBattlefield", targetHexCoordinates);

                //判断目标单元格上有没有生物
                if (defensiveMinionCellItem != null)
                {
                    //如果有生物,需要再判断是自己的生物还是对手的生物
                    if (defensiveMinionCellItem.controllerPlayerItem != attackMinionCellItem.controllerPlayerItem)
                    {
                        UtilityLog.Log("【" + attackMinionCellItem.name + "】进行攻击", LogUtType.Attack);
                        //攻击
                        effectInfoProxy.effectSysItem.showEffectNum++;
                        attackMinionCellItem.AttackTargetMinion(defensiveMinionCellItem);
                        //反击
                        effectInfoProxy.effectSysItem.showEffectNum++;
                        defensiveMinionCellItem.CounterAttackTargetMinion(attackMinionCellItem);
                    }
                }
                break;

            case EffectExecutionEvent.EFFECT_EXECUTION_SYS_LAUNCH_AN_MOVE:
                CardEntry      moveMinionCellItem       = notification.Body as CardEntry;
                PlayerItem     playerItemMove           = moveMinionCellItem.controllerPlayerItem;
                HexCoordinates vectorHexCoordinatesMove = new HexCoordinates(playerItemMove.playerSiteOne.attackDefaultDirection.x, playerItemMove.playerSiteOne.attackDefaultDirection.z);
                HexCoordinates targetMoveHexCoordinates = HexUtil.GetTargetHexCoordinatesByStartPointAndVector(moveMinionCellItem.nowIndex, vectorHexCoordinatesMove);
                //判断目标单元格是否在可移动范围内
                if (playerItemMove.CheckOneHexCanMove(targetMoveHexCoordinates))
                {
                    CardEntry moveHexCoordinatesCard = gameContainerProxy.CheckHasCardEntryByGameContainerTypeAndHexCoordinates("CardBattlefield", targetMoveHexCoordinates);
                    //判断目标单元格上有没有生物,没有生物才能移动
                    if (moveHexCoordinatesCard == null)
                    {
                        effectInfoProxy.effectSysItem.showEffectNum++;
                        moveMinionCellItem.MoveToTargetHexCoordinates(targetMoveHexCoordinates);
                    }
                }
                break;
                //case EffectExecutionEvent.EFFECT_EXECUTION_SYS_MINION_ENTER_THE_BATTLEFIELD:
                //    CardEntry enterTBFMinionCellItem = notification.Body as CardEntry;
                //    exeEffectCard = enterTBFMinionCellItem;
                //    提取待执行的卡牌效果
                //    List<EffectInfo> oneMinionEffectCardEffects = new List<EffectInfo>();
                //    遍历卡牌的效果
                //    foreach (string effectCode in exeEffectCard.effectCodeList)
                //    {
                //        EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectCode);
                //        bool canExe = false;
                //        foreach (string impactTimeTrigger in oneEffectInfo.impactTimeTriggers) {
                //            if (impactTimeTrigger == "MyselfEnterTheBattlefield") {
                //                canExe = true;
                //                break;
                //            }
                //        }
                //        if (canExe) {
                //            设置状态
                //            oneEffectInfo.effectInfoStage = EffectInfoStage.UnStart;
                //            设置所有者,手牌操作模式,所有者是当前玩家
                //            oneEffectInfo.player = exeEffectCard.controllerPlayerItem;
                //            设置所属卡牌
                //            oneEffectInfo.cardEntry = exeEffectCard;

                //            oneMinionEffectCardEffects.Add(oneEffectInfo);
                //        }

                //    }
                //    存入效果,进行结算
                //    effectInfoProxy.IntoModeCardSettle(exeEffectCard, oneMinionEffectCardEffects);
                //    break;
            }
        }
Ejemplo n.º 17
0
        public List <CardEntry> GetMinionListByTargetSet(TargetSet targetSetToChoose, GameContainerProxy gameContainerProxy)
        {
            List <CardEntry>         mList = new List <CardEntry>();
            List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield");

            foreach (GameContainerItem gameContainerItem in returnGameContainerItemList)
            {
                foreach (CardEntry minionCellItem in gameContainerItem.cardEntryList)
                {
                    if (targetSetToChoose.checkEffectToTargetMinionCellItem(minionCellItem))
                    {
                        UtilityLog.Log(" 检查了生物:" + minionCellItem.cardInfo.code, LogUtType.Special);
                        minionCellItem.IsEffectTarget = true;
                        mList.Add(minionCellItem);
                    }
                }
            }
            return(mList);
        }
Ejemplo n.º 18
0
        public override void Execute(INotification notification)
        {
            OperateSystemProxy operateSystemProxy =
                Facade.RetrieveProxy(OperateSystemProxy.NAME) as OperateSystemProxy;
            QuestStageCircuitProxy circuitProxy =
                Facade.RetrieveProxy(QuestStageCircuitProxy.NAME) as QuestStageCircuitProxy;
            PlayerGroupProxy playerGroupProxy =
                Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;
            ChooseStageCircuitProxy chooseStageCircuitProxy =
                Facade.RetrieveProxy(ChooseStageCircuitProxy.NAME) as ChooseStageCircuitProxy;
            EffectInfoProxy effectInfoProxy =
                Facade.RetrieveProxy(EffectInfoProxy.NAME) as EffectInfoProxy;
            HexGridProxy hexGridProxy =
                Facade.RetrieveProxy(HexGridProxy.NAME) as HexGridProxy;
            GameContainerProxy gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;

            CardDbProxy cardDbProxy = Facade.RetrieveProxy(CardDbProxy.NAME) as CardDbProxy;
            PlayerItem  playerItem  = null;

            switch (notification.Type)
            {
            //选择船只逻辑处理
            case LogicalSysEvent.LOGICAL_SYS_CHOOSE_SHIP_CARD:
                string playerCode = notification.Body as string;
                playerItem = playerGroupProxy.getPlayerByPlayerCode(playerCode);
                //如果是玩家
                if (playerItem.playerType == PlayerType.HumanPlayer)
                {
                    SendNotification(UIViewSystemEvent.UI_CHOOSE_STAGE,
                                     chooseStageCircuitProxy.chooseStageCircuitItem.playerShipCardMap[playerCode],
                                     StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_CHOOSE_STAGE_LOAD_CARD_ENTRY, playerCode));
                }
                //AI玩家
                else if (playerItem.playerType == PlayerType.AIPlayer)
                {
                    //AI进行船只渲染
                    SendNotification(UIViewSystemEvent.UI_CHOOSE_STAGE, chooseStageCircuitProxy.chooseStageCircuitItem.playerShipCardMap[playerCode], StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_CHOOSE_STAGE_LOAD_CARD_ENTRY, playerCode));
                    //AI选择船只
                    CardEntry shipCardEntry = chooseStageCircuitProxy.chooseStageCircuitItem.playerShipCardMap[playerCode][0];
                    SendNotification(UIViewSystemEvent.UI_CHOOSE_STAGE, shipCardEntry, UIViewSystemEvent.UI_CHOOSE_STAGE_ONE_CARD);
                }
                //网络用户
                else if (playerItem.playerType == PlayerType.NetPlayer)
                {
                }
                break;

            case LogicalSysEvent.LOGICAL_SYS_NEED_PLAYER_CHOOSE:
                EffectInfo effectInfo = notification.Body as EffectInfo;
                playerItem = effectInfo.chooseByPlayer;
                //如果是玩家
                if (playerItem.playerType == PlayerType.HumanPlayer)
                {
                    if (effectInfo.needPlayerToChooseTargetSet.target == "ChooseEffect")
                    {
                        //整理好效果内容,弹出选择框让玩家选择
                        //把这些效果实例化成卡片
                        List <CardEntry> cardEntries = new List <CardEntry>();
                        foreach (string effectName in effectInfo.chooseEffectList)
                        {
                            EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectName);
                            CardEntry  oneCardEntry  = cardDbProxy.GetCardEntryBCardInfo(effectInfo.cardEntry.cardInfo);
                            oneCardEntry.InitializeByEffectInfo(oneEffectInfo);
                            cardEntries.Add(oneCardEntry);
                        }

                        //将需要进行选择的内容发送给玩家
                        SendNotification(
                            UIViewSystemEvent.UI_VIEW_CURRENT,
                            cardEntries,
                            StringUtil.GetNTByNotificationTypeAndUIViewNameAndMaskLayerAndPlayerCode(
                                UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                                UIViewConfig.getNameStrByUIViewName(UIViewName.ChooseStage),
                                playerItem.playerCode,
                                "Y"
                                )
                            );
                    }
                    else if (effectInfo.needPlayerToChooseTargetSet.target == "Minion")
                    {
                        //传入效果,根据效果目标进行筛选渲染
                        SendNotification(MinionSystemEvent.MINION_SYS, effectInfo.needPlayerToChooseTargetSet, MinionSystemEvent.MINION_SYS_EFFECT_HIGHLIGHT_BECOME_TARGET);
                    }
                }
                //AI玩家
                else if (playerItem.playerType == PlayerType.AIPlayer)
                {
                    UtilityLog.Log("AI玩家【" + playerItem.playerCode + "】开始选择卡牌效果", LogUtType.Operate);
                    //先直接选择第一种
                    EffectInfo oneEffectInfo = effectInfoProxy.GetDepthCloneEffectByName(effectInfo.chooseEffectList[0]);
                    CardEntry  oneCardEntry  = cardDbProxy.GetCardEntryBCardInfo(effectInfo.cardEntry.cardInfo);
                    oneCardEntry.InitializeByEffectInfo(oneEffectInfo);
                    SendNotification(OperateSystemEvent.OPERATE_SYS, oneCardEntry, OperateSystemEvent.OPERATE_SYS_CHOOSE_ONE_EFFECT);
                }
                //网络用户
                else if (playerItem.playerType == PlayerType.NetPlayer)
                {
                }
                break;

            case LogicalSysEvent.LOGICAL_SYS_ACTIVE_PHASE_ACTION:
                //获取当前进行游戏的玩家进行接管
                string     playerCodeNow = circuitProxy.GetNowHaveStagePlayerCode();
                PlayerItem playerItemNow = playerGroupProxy.getPlayerByPlayerCode(playerCodeNow);
                UtilityLog.Log("AI玩家" + playerCodeNow + "开始操作:", LogUtType.Operate);
                //无法操作了结束回合
                bool canContinueOperation = true;

                //判断是否使用过资源牌
                if (playerItemNow.CheckResourceCardCanUse())
                {
                    UtilityLog.Log("AI玩家" + playerCodeNow + "可以使用资源牌:", LogUtType.Operate);
                    GameContainerItem gameContainerItem = gameContainerProxy.GetGameContainerItemByPlayerItemAndGameContainerType(playerItemNow, "CardHand");
                    CardEntry         getHand           = gameContainerItem.GetOneCardTypeCard(CardType.ResourceCard);
                    //检查手牌里是否存在资源牌
                    if (getHand != null)
                    {
                        //使用这张手牌
                        operateSystemProxy.IntoModeByType(getHand, playerItemNow, OperateSystemItem.OperateType.HandUse);
                        HexCellItem hexCellItem = new HexCellItem(1, 1);
                        SendNotification(OperateSystemEvent.OPERATE_SYS, hexCellItem, OperateSystemEvent.OPERATE_SYS_DRAW_END_HEX);
                    }
                    else
                    {
                        canContinueOperation = false;
                    }
                }
                else
                {
                    UtilityLog.Log("AI玩家" + playerCodeNow + "不可以使用资源牌:", LogUtType.Operate);
                    canContinueOperation = false;
                }

                if (!canContinueOperation)
                {
                    //结束回合
                    SendNotification(UIViewSystemEvent.UI_QUEST_TURN_STAGE, null, UIViewSystemEvent.UI_QUEST_TURN_STAGE_END_OF_STAGE);
                }
                else
                {
                    circuitProxy.circuitItem.autoNextStage = false;
                }
                break;
            }
        }
Ejemplo n.º 19
0
        public override void Execute(INotification notification)
        {
            PlayerGroupProxy       playerGroupProxy   = Facade.RetrieveProxy(PlayerGroupProxy.NAME) as PlayerGroupProxy;
            QuestStageCircuitProxy circuitProxy       = Facade.RetrieveProxy(QuestStageCircuitProxy.NAME) as QuestStageCircuitProxy;
            GameContainerProxy     gameContainerProxy =
                Facade.RetrieveProxy(GameContainerProxy.NAME) as GameContainerProxy;

            string playerCodeNotification = StringUtil.GetValueForNotificationTypeByKey(notification.Type, "PlayerCode");
            string notificationType       = StringUtil.GetValueForNotificationTypeByKey(notification.Type, "NotificationType");



            EffectInfoProxy effectInfoProxy =
                Facade.RetrieveProxy(EffectInfoProxy.NAME) as EffectInfoProxy;

            //一组效果执行完毕
            if (notification.Type == TimeTriggerEvent.TIME_TRIGGER_EXE_NEXT_DELAY_NOTIFICATION)
            {
                if (effectInfoProxy.effectSysItem.delayNotifications.Count > 0)
                {
                    notification           = effectInfoProxy.effectSysItem.delayNotifications.Dequeue();
                    playerCodeNotification = StringUtil.GetValueForNotificationTypeByKey(notification.Type, "PlayerCode");
                    notificationType       = StringUtil.GetValueForNotificationTypeByKey(notification.Type, "NotificationType");
                }
                else
                {
                    return;
                }
            }

            //判断是否在一组效果的执行中
            if (effectInfoProxy.effectSysItem.effectSysItemStage == EffectSysItemStage.Executing)
            {
                effectInfoProxy.effectSysItem.delayNotifications.Enqueue(notification);
                return;
            }


            PlayerItem playerItemNotification = null;

            if (playerCodeNotification != null)
            {
                playerItemNotification = playerGroupProxy.getPlayerByPlayerCode(playerCodeNotification);
            }


            switch (notificationType)
            {
            //玩家需要抽一张牌
            case TimeTriggerEvent.TIME_TRIGGER_SYS_NEED_DRAW_A_CARD:
                SelectEffectAfterTrigger(circuitProxy.circuitItem.activeEffectInfoMap[TimeTriggerEvent.TIME_TRIGGER_SYS_NEED_DRAW_A_CARD], null, playerItemNotification, notificationType);
                break;

            //抽了一张牌
            case TimeTriggerEvent.TIME_TRIGGER_SYS_DRAW_A_CARD:
                if (circuitProxy.circuitItem.activeEffectInfoMap.ContainsKey(TimeTriggerEvent.TIME_TRIGGER_SYS_DRAW_A_CARD))
                {
                    SelectEffectAfterTrigger(circuitProxy.circuitItem.activeEffectInfoMap[TimeTriggerEvent.TIME_TRIGGER_SYS_DRAW_A_CARD], null, playerItemNotification, notificationType);
                }
                break;

            //一个阶段的执行
            case TimeTriggerEvent.TIME_TRIGGER_SYS_ONE_STAGE_EXECUTION:
                string oneTurnStageStart = notification.Body as string + "Execution";
                if (circuitProxy.circuitItem.activeEffectInfoMap.ContainsKey(oneTurnStageStart))
                {
                    SelectEffectAfterTrigger(circuitProxy.circuitItem.activeEffectInfoMap[oneTurnStageStart], null, playerItemNotification, oneTurnStageStart);
                }
                break;

            //一个回合的结束,检查是否有需要清除的buff
            case TimeTriggerEvent.TIME_TRIGGER_SYS_ONE_TURN_END:
                //检测生物
                List <CardEntry> minionCellItems = gameContainerProxy.GetCardEntryListByGameContainerType("CardBattlefield");
                foreach (CardEntry minionCellItem in minionCellItems)
                {
                    minionCellItem.CheckNeedChangeEffectBuffInfo("EndOfTurn");
                }

                //检测玩家

                break;

            //使用了一张手牌
            case TimeTriggerEvent.TIME_TRIGGER_SYS_USE_HAND_CARD:
                CardEntry handCellItemUse = notification.Body as CardEntry;
                switch (handCellItemUse.WhichCard)
                {
                case CardEntry.CardType.ResourceCard:
                    handCellItemUse.controllerPlayerItem.canUseResourceNum--;
                    break;
                }
                break;

            //卡牌到了新位置
            case TimeTriggerEvent.TIME_TRIGGER_SYS_CARD_CHANGE_GAME_CONTAINER_TYPE:
                CardEntry enterTheNewTypeCard = notification.Body as CardEntry;
                string    cardEnterTheNewType = "CardEnterThe" + enterTheNewTypeCard.gameContainerType;
                if (circuitProxy.circuitItem.activeEffectInfoMap.ContainsKey(cardEnterTheNewType))
                {
                    SelectEffectAfterTrigger(circuitProxy.circuitItem.activeEffectInfoMap[cardEnterTheNewType], enterTheNewTypeCard, playerItemNotification, cardEnterTheNewType);
                }
                break;
            }
            //判断还有没有需要继续触发的时点信息
            if (effectInfoProxy.effectSysItem.delayNotifications.Count > 0)
            {
                SendNotification(TimeTriggerEvent.TIME_TRIGGER_SYS, null, TimeTriggerEvent.TIME_TRIGGER_EXE_NEXT_DELAY_NOTIFICATION);
            }
        }