Esempio n. 1
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;
            }
        }
Esempio n. 2
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;
            }
        }