Exemplo n.º 1
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);
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
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)
                    )
                );
        }
Exemplo n.º 5
0
        public override void Execute(INotification notification)
        {
            HexGridProxy hexGridProxy =
                Facade.RetrieveProxy(HexGridProxy.NAME) as HexGridProxy;
            GameModelProxy gameModelProxy =
                Facade.RetrieveProxy(GameModelProxy.NAME) as GameModelProxy;

            switch (notification.Type)
            {
            case HexSystemEvent.HEX_VIEW_SYS_SHOW_START:
                SendNotification(HexSystemEvent.HEX_VIEW_SYS, hexGridProxy.HexGrid, HexSystemEvent.HEX_VIEW_SYS_SHOW);
                break;

            case HexSystemEvent.HEX_VIEW_SYS_CARD_CHANGE_GAME_CONTAINER_TYPE:
                CardEntry cardEntryChangeGCType = notification.Body as CardEntry;
                if (cardEntryChangeGCType.gameContainerType == "CardBattlefield")
                {
                    hexGridProxy.HexGrid.cellMap[cardEntryChangeGCType.nowIndex].inThisCellCardList.Add(cardEntryChangeGCType);
                    return;
                }
                if (cardEntryChangeGCType.lastGameContainerType == "CardBattlefield")
                {
                    hexGridProxy.HexGrid.cellMap[cardEntryChangeGCType.nowIndex].inThisCellCardList.Remove(cardEntryChangeGCType);
                }

                break;

            //这一段代码写的比较糟糕,只用作效果展示
            //需要区分模式,渲染出可召唤区域
            case HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL:
                //传递的参数中有生物信息
                OperateSystemItem operateSystemItemCanCall = notification.Body as OperateSystemItem;
                //获取当前玩家固定可召唤区域
                List <HexCoordinates> fixedCanCellHexList = operateSystemItemCanCall.playerItem.fixedCanCallHexList;

                //遍历渲染
                foreach (KeyValuePair <HexCoordinates, HexCellItem> keyValuePair in hexGridProxy.HexGrid.cellMap)
                {
                    if (operateSystemItemCanCall.playerItem.CheckOneCellCanCall(keyValuePair.Key))
                    {
                        keyValuePair.Value.borderState = BorderState.CanCall;
                    }
                }

                SendNotification(HexSystemEvent.HEX_VIEW_SYS, hexGridProxy.HexGrid, HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL_OVER);
                break;

            case HexSystemEvent.HEX_VIEW_RENDER_CAN_MOVE_AND_ATK:
                //传递的参数中有生物信息
                OperateSystemItem operateSystemItemCanMoveAndAttack           = notification.Body as OperateSystemItem;
                Dictionary <HexCoordinates, HexCellItem> alreadyPassedCellMap = hexGridProxy.GetCanMoveCellByMinionCard(operateSystemItemCanMoveAndAttack.onChooseCardEntry, gameModelProxy.hexModelInfoNow);
                //遍历渲染
                foreach (KeyValuePair <HexCoordinates, HexCellItem> keyValuePair in alreadyPassedCellMap)
                {
                    keyValuePair.Value.borderState = BorderState.CanCall;
                }
                operateSystemItemCanMoveAndAttack.onChooseCardEntry.canBeMovedCellMap = alreadyPassedCellMap;
                SendNotification(HexSystemEvent.HEX_VIEW_SYS, hexGridProxy.HexGrid, HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL_OVER);
                break;

            case HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL_CANCEL:
                //遍历渲染
                foreach (KeyValuePair <HexCoordinates, HexCellItem> keyValuePair in hexGridProxy.HexGrid.cellMap)
                {
                    if (keyValuePair.Value.borderState == BorderState.CanCall)
                    {
                        keyValuePair.Value.borderState = BorderState.Normal;
                    }
                }
                SendNotification(HexSystemEvent.HEX_VIEW_SYS, hexGridProxy.HexGrid, HexSystemEvent.HEX_VIEW_RENDER_CAN_CALL_CANCEL_OVER);
                break;
            }
        }
Exemplo n.º 6
0
        //开始流程
        public override void Execute(INotification notification)
        {
            if (notification.Type == OrderSystemEvent.START_CIRCUIT_MAIN)
            {
                MainUI mainUI = notification.Body as MainUI;
                if (null == mainUI)
                {
                    throw new Exception("程序启动失败..");
                }



                //地图代理(需要放在操作层之前)
                HexGridProxy hexGridProxyCreate = new HexGridProxy();
                Facade.RegisterProxy(hexGridProxyCreate);
                HexGridMediator hexGridMediator = new HexGridMediator(mainUI.HexGridView);
                Facade.RegisterMediator(hexGridMediator);

                //生物层代理

                MinionGridMediator minionGridMediator = new MinionGridMediator(mainUI.minionGridView);
                Facade.RegisterMediator(minionGridMediator);


                //进程代理
                QuestStageCircuitProxy createCircuitProxy = new QuestStageCircuitProxy();
                Facade.RegisterProxy(createCircuitProxy);
                QuestStageCircuitMediator circuitMediator = new QuestStageCircuitMediator(mainUI.circuitButton);
                Facade.RegisterMediator(circuitMediator);

                //操作系统代理
                OperateSystemProxy operateSystemProxy = new OperateSystemProxy();
                Facade.RegisterProxy(operateSystemProxy);
                OperateSystemMediator operateSystemMediator = new OperateSystemMediator(mainUI.operateSystemView);
                Facade.RegisterMediator(operateSystemMediator);

                //选择页面代理
                ChooseGridMediator chooseGridMediator = new ChooseGridMediator(mainUI.chooseGridView);
                Facade.RegisterMediator(chooseGridMediator);

                //手牌区代理(需要放在操作系统后)
                HandViewMediator handGridMediator = new HandViewMediator(mainUI.HandControlView);
                Facade.RegisterMediator(handGridMediator);
            }



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

            CardDbProxy    cardDbProxy    = Facade.RetrieveProxy(CardDbProxy.NAME) as CardDbProxy;
            GameModelProxy gameModelProxy = Facade.RetrieveProxy(GameModelProxy.NAME) as GameModelProxy;

            switch (notification.Type)
            {
            case OrderSystemEvent.START_CIRCUIT_MAIN:
                SendNotification(UIViewSystemEvent.UI_VIEW_CURRENT, null, StringUtil.GetNTByNotificationTypeAndUIViewName(UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW, UIViewConfig.getNameStrByUIViewName(UIViewName.StartMain)));
                SendNotification(UIViewSystemEvent.UI_VIEW_CURRENT, null, StringUtil.GetNTByNotificationTypeAndUIViewName(UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW, UIViewConfig.getNameStrByUIViewName(UIViewName.CardMoveAnimation)));
                break;

            case OrderSystemEvent.START_CIRCUIT_START:
                //CardDbProxy cardDbProxy = Facade.RetrieveProxy(CardDbProxy.NAME) as CardDbProxy;
                //玩家信息初始化
                playerGroupProxy.AddPlayer("TEST1", PlayerType.HumanPlayer);
                playerGroupProxy.AddPlayer("TEST2", PlayerType.AIPlayer);

                //设定UI段显示为玩家TEST1
                SendNotification(OrderSystemEvent.CLINET_SYS, "TEST1", OrderSystemEvent.CLINET_SYS_OWNER_CHANGE);

                ChooseStageCircuitProxy chooseStageCircuitProxy = Facade.RetrieveProxy(ChooseStageCircuitProxy.NAME) as ChooseStageCircuitProxy;
                chooseStageCircuitProxy.CircuitStart(playerGroupProxy.playerGroup.playerItems);
                //开启卡组列渲染
                foreach (PlayerItem playerItem in playerGroupProxy.playerGroup.playerItems.Values)
                {
                    SendNotification(
                        UIViewSystemEvent.UI_VIEW_CURRENT,
                        playerItem,
                        StringUtil.GetNTByNotificationTypeAndPlayerCodeAndUIViewName(
                            UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                            playerItem.playerCode,
                            UIViewConfig.getNameStrByUIViewName(UIViewName.CardDeckList)
                            )
                        );
                }
                //开启选择阶段
                SendNotification(UIViewSystemEvent.UI_CHOOSE_STAGE, null, UIViewSystemEvent.UI_CHOOSE_STAGE_START);

                break;

            case OrderSystemEvent.START_CIRCUIT_TEST_CASE:
                TestCaseProxy       testCaseProxy    = Facade.RetrieveProxy(TestCaseProxy.NAME) as TestCaseProxy;
                List <TestCaseInfo> testCaseInfoList = testCaseProxy.testCaseInfoMap.Values.ToList();
                SendNotification(
                    UIViewSystemEvent.UI_VIEW_CURRENT,
                    testCaseInfoList,
                    StringUtil.GetNTByNotificationTypeAndUIViewName(
                        UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                        UIViewConfig.getNameStrByUIViewName(UIViewName.TestCaseView)
                        )
                    );
                break;

            //开始一个测试
            case OrderSystemEvent.START_CIRCUIT_TEST_CASE_START_ONE:
                //玩家信息初始化
                playerGroupProxy.AddPlayer("TEST1", PlayerType.HumanPlayer);
                playerGroupProxy.AddPlayer("TEST2", PlayerType.AIPlayer);
                //设定UI段显示为玩家TEST1
                SendNotification(OrderSystemEvent.CLINET_SYS, "TEST1", OrderSystemEvent.CLINET_SYS_OWNER_CHANGE);
                TestCaseInfo chooseOneTestCase = notification.Body as TestCaseInfo;


                SendNotification(UIViewSystemEvent.UI_VIEW_CURRENT, UIViewConfig.getNameStrByUIViewName(UIViewName.TestCaseView), UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW);
                SendNotification(UIViewSystemEvent.UI_QUEST_STAGE, notification.Body, UIViewSystemEvent.UI_QUEST_STAGE_START_SPECIAL);
                SendNotification(OperateSystemEvent.OPERATE_TRAIL_DRAW, null, OperateSystemEvent.OPERATE_TRAIL_DRAW_CREATE);
                break;

            //开始测试地图
            case OrderSystemEvent.START_CIRCUIT_TEST_MAP:

                //获取当前模式有多少个玩家
                //目前只考虑有两个玩家的情况
                int num = gameModelProxy.gameModelNow.playerNum;


                //玩家信息初始化
                playerGroupProxy.AddPlayer("TEST1", PlayerType.HumanPlayer);
                playerGroupProxy.AddPlayer("TEST2", PlayerType.AIPlayer);
                //设定UI段显示为玩家TEST1
                SendNotification(OrderSystemEvent.CLINET_SYS, "TEST1", OrderSystemEvent.CLINET_SYS_OWNER_CHANGE);



                SendNotification(UIViewSystemEvent.UI_QUEST_STAGE, null, UIViewSystemEvent.UI_QUEST_STAGE_START);
                SendNotification(OperateSystemEvent.OPERATE_TRAIL_DRAW, null, OperateSystemEvent.OPERATE_TRAIL_DRAW_CREATE);
                break;
            }
        }