Beispiel #1
0
        public void LoadingInfoByOneUserSelection(OneUserSelectionItem oneUserSelectionItem, SendNotificationAddCardEntry sendNotificationAddCard, UnityAction choseThisView)
        {
            this.choseThisView = choseThisView;
            TextMeshProUGUI oneUserSelectionText = UtilityHelper.FindChild <TextMeshProUGUI>(this.transform, "OneUserSelectionText");

            oneUserSelectionText.text = oneUserSelectionItem.selectionText;
            MonoBehaviour oneUserSelectionBG = UtilityHelper.FindChild <MonoBehaviour>(this.transform, "OneUserSelectionBG");
            Image         image = oneUserSelectionBG.transform.GetComponent <Image>();

            if (oneUserSelectionItem.defaultAvailab)
            {
                if (oneUserSelectionItem.isExecute)
                {
                    image.color = Color.green;
                }
                else
                {
                    image.color = Color.yellow;
                }
                this.sendNotification = sendNotificationAddCard;
            }
            else
            {
                image.color           = Color.gray;
                this.sendNotification = (OneUserSelectionItem oneUserSelectionItemNull) => {
                };
            }

            this.oneUserSelectionItem = oneUserSelectionItem;
        }
Beispiel #2
0
        public void ShowUserSelectListByCardEntry(CardEntry cardEntry, SendNotificationAddCardEntry sendNotificationAddCard)
        {
            //获取需要展示的效果
            EffectInfo needShowEffectInfo = cardEntry.needShowEffectInfo;
            //获取需要用户进行判断的效果
            EffectInfo needChoosePreEffect = needShowEffectInfo.needChoosePreEffect;
            List <OneUserSelectionItem> oneUserSelections = new List <OneUserSelectionItem>();
            //制作第一个选项,用户选择生效
            OneUserSelectionItem oneUserSelectionForYes = new OneUserSelectionItem();

            oneUserSelectionForYes.defaultAvailab = needChoosePreEffect.checkCanExecution;
            oneUserSelectionForYes.selectionText  = needChoosePreEffect.description;
            oneUserSelectionForYes.isExecute      = true;
            oneUserSelectionForYes.cardEntry      = cardEntry;
            //制作第二个选项,用户选择不生效
            OneUserSelectionItem oneUserSelectionForNo = new OneUserSelectionItem();

            oneUserSelectionForNo.defaultAvailab = true;
            oneUserSelectionForNo.selectionText  = "不执行";
            oneUserSelectionForNo.isExecute      = false;
            oneUserSelectionForNo.cardEntry      = cardEntry;
            oneUserSelections.Add(oneUserSelectionForYes);
            oneUserSelections.Add(oneUserSelectionForNo);
            //关闭窗口时执行的操作
            UnityAction choseThisView = () =>
            {
                cardIntactView.gameObject.SetActive(false);
            };

            userSelectionList.LoadingUserSelectionListToCreate(oneUserSelections, sendNotificationAddCard, choseThisView);
        }
Beispiel #3
0
        public override void ExceHandleNotification(INotification notification)
        {
            //判断是否是转发内容
            if (notification.Name.Contains("=>"))
            {
                SendNotification(StringUtil.GeNotificationNameForNN(notification.Name), notification.Body, notification.Type);
                return;
            }

            // 处理公共请求
            HandleNotificationCommon(notification);


            ViewChooseStage     viewChooseStage   = null;
            List <CardDeckList> cardDeckListLoad  = new List <CardDeckList>();
            CardMoveAnimation   cardMoveAnimation = null;
            //回调函数
            UnityAction callBack = () =>
            {
                exceINotification = false;
                SendNotification(UIViewSystemEvent.UI_ANIMATION_SYS, null, UIViewSystemEvent.UI_ANIMATION_SYS_START);
            };
            bool callBackDelay = false;

            switch (notification.Name)
            {
            case UIViewSystemEvent.UI_ANIMATION_SYS:
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_ANIMATION_SYS_START:
                    DoExceHandleNotification();
                    break;
                }
                break;

            case UIViewSystemEvent.UI_CARD_ENTRY_SYS:
                switch (notification.Type)
                {
                //卡牌的归属地发生了变化
                case UIViewSystemEvent.UI_CARD_ENTRY_SYS_CHANGE_GAME_CONTAINER_TYPE:
                    CardEntry cardEntryMove = notification.Body as CardEntry;
                    if (cardEntryMove.gameContainerType == "CardHand")
                    {
                        SendNotification(HandSystemEvent.HAND_CHANGE, notification.Body, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_CHANGE_DRAW_ONE_CARD, cardEntryMove.controllerPlayerItem.playerCode));
                        return;
                    }
                    if (cardEntryMove.lastGameContainerType == "CardHand")
                    {
                        SendNotification(HandSystemEvent.HAND_CHANGE, cardEntryMove, StringUtil.GetNTByNotificationTypeAndPlayerCode(HandSystemEvent.HAND_CHANGE_REMOVE_ONE_CARD, cardEntryMove.controllerPlayerItem.playerCode));
                    }
                    break;

                //卡牌在显示页面需要被隐藏
                case UIViewSystemEvent.UI_CARD_ENTRY_SYS_CARD_NEED_HIDE_IN_VIEW:
                    CardEntry cardEntryNeedHide = notification.Body as CardEntry;
                    if (cardEntryNeedHide.gameContainerType == "CardHand")
                    {
                        SendNotification(HandSystemEvent.HAND_CHANGE, notification.Body, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_CARD_ENTRY_SYS_CARD_NEED_HIDE_IN_VIEW, cardEntryNeedHide.controllerPlayerItem.playerCode));
                    }
                    break;
                }
                break;

            case UIViewSystemEvent.UI_VIEW_CURRENT:
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW:
                    //是否需要打开遮罩层
                    if (parameterMap.ContainsKey("OpenMaskLayer"))
                    {
                        string OpenMaskLayer = parameterMap["OpenMaskLayer"];
                        if ("Y" == OpenMaskLayer)
                        {
                            UIViewName uiMaskLayeView = UIViewConfig.getUIViewNameByNameStr("UIMaskLayeView");
                            UIControllerLIst.ShowView(uiMaskLayeView);
                        }
                    }
                    UIViewName viewNameOpen = UIViewConfig.getUIViewNameByNameStr(parameterMap["UIViewName"]);
                    UIControllerLIst.ShowView(viewNameOpen);
                    //初始化页面
                    UIControllerLIst.GetViewByName <ViewBaseView>(viewNameOpen).InitViewForParameter(this, notification.Body, parameterMap);
                    //一些界面打开时需要初始化
                    switch (viewNameOpen)
                    {
                    case UIViewName.CardDeckList:
                        PlayerItem          playerItem    = notification.Body as PlayerItem;
                        List <CardDeckList> cardDeckLists = UIControllerLIst.GetViewListByName <CardDeckList>(UIViewName.CardDeckList);
                        for (int num = 0; num < cardDeckLists.Count; num++)
                        {
                            if (cardDeckLists[num].playerItem == null)
                            {
                                cardDeckLists[num].playerItem = playerItem;
                                //设置位置
                                //0在左,1在右
                                //己方始终显示在左边
                                Vector3 position = new Vector3();
                                if (playerItem.playerCode == playerCode)
                                {
                                    position.x = -600;
                                }
                                else
                                {
                                    position.x = 430;
                                }
                                cardDeckLists[num].transform.localPosition = position;
                            }
                        }
                        break;
                    }
                    break;

                case UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW:
                    UIViewName viewNameClose = UIViewConfig.getUIViewNameByNameStr(notification.Body as string);
                    UIControllerLIst.HideView(viewNameClose);
                    //是否需要关闭遮罩层
                    if (parameterMap.ContainsKey("OpenMaskLayer"))
                    {
                        string OpenMaskLayer = parameterMap["OpenMaskLayer"];
                        if ("N" == OpenMaskLayer)
                        {
                            UIViewName uiMaskLayeView = UIViewConfig.getUIViewNameByNameStr("UIMaskLayeView");
                            UIControllerLIst.HideView(uiMaskLayeView);
                        }
                    }
                    break;
                }
                break;

            case UIViewSystemEvent.UI_CHOOSE_STAGE:
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_CHOOSE_STAGE_LOAD_CARD_ENTRY:
                    viewChooseStage = UIControllerLIst.GetViewByName <ViewChooseStage>(UIViewName.ChooseStage);
                    List <CardEntry> shipCardEntryList = (List <CardEntry>)notification.Body;
                    //载入卡牌列表
                    viewChooseStage.LoadCardEntryList(shipCardEntryList);
                    //载入完成后绑定事件
                    foreach (CardIntactView cardIntactView in viewChooseStage.cardIntactViews)
                    {
                        //如果是自己的命令则绑定上点击事件
                        if (playerCode == playerCodeNotification)
                        {
                            cardIntactView.OnClick = () =>
                            {
                                SendNotification(UIViewSystemEvent.UI_CHOOSE_STAGE, cardIntactView.card, UIViewSystemEvent.UI_CHOOSE_STAGE_ONE_CARD);
                            };
                        }
                        else
                        {
                            //设置为空
                            cardIntactView.OnClick = () =>
                            {
                            };
                        }
                    }
                    break;

                case UIViewSystemEvent.UI_CHOOSE_STAGE_ONE_SHIP_CARD_ANIMATION:
                    viewChooseStage = UIControllerLIst.GetViewByName <ViewChooseStage>(UIViewName.ChooseStage);
                    CardEntry      choosedShipCard      = notification.Body as CardEntry;
                    CardIntactView targetCardIntactView = null;
                    //找到这张组件
                    foreach (CardIntactView cardIntactView in viewChooseStage.cardIntactViews)
                    {
                        if (cardIntactView.card.uuid == choosedShipCard.uuid)
                        {
                            cardDeckListLoad  = UIControllerLIst.GetViewListByName <CardDeckList>(UIViewName.CardDeckList);
                            cardMoveAnimation = UIControllerLIst.GetViewByName <CardMoveAnimation>(UIViewName.CardMoveAnimation);
                            //执行动画,获得卡牌的位置,list的位置
                            for (int num = 0; num < cardDeckListLoad.Count; num++)
                            {
                                //移动目标
                                if (cardDeckListLoad[num].playerItem.playerCode == playerCodeNotification)
                                {
                                    callBackDelay = true;
                                    cardMoveAnimation.MoveShipCardAnimation(cardIntactView, cardDeckListLoad[num], callBack);
                                }
                            }
                        }
                    }


                    break;
                }
                break;

            case UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE:
                ViewChooseMakeStage viewChooseMakeStage = UIControllerLIst.GetViewByName <ViewChooseMakeStage>(UIViewName.ViewChooseMakeStage);
                switch (notification.Type)
                {
                //获取下一组数据
                case UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE_LOAD_NEXT_LIST:
                    List <CardEntry> cardList = notification.Body as List <CardEntry>;
                    viewChooseMakeStage = UIControllerLIst.GetViewByName <ViewChooseMakeStage>(UIViewName.ViewChooseMakeStage);
                    viewChooseMakeStage.LoadNewCardList(cardList);
                    break;

                case UIViewSystemEvent.UI_CHOOSE_MAKE_STAGE_ONE_CARD_SUCCESS:

                    CardEntry card = notification.Body as CardEntry;
                    viewChooseMakeStage.ChangeOneCradForBuyed(card);
                    break;
                }
                break;

            case UIViewSystemEvent.UI_CARD_DECK_LIST:
                switch (notification.Type)
                {
                //读取牌组
                case UIViewSystemEvent.UI_CARD_DECK_LIST_LOAD:
                    PlayerItem playerItemLoad = notification.Body as PlayerItem;
                    cardDeckListLoad = UIControllerLIst.GetViewListByName <CardDeckList>(UIViewName.CardDeckList);
                    for (int num = 0; num < cardDeckListLoad.Count; num++)
                    {
                        if (cardDeckListLoad[num].playerItem.playerCode == playerItemLoad.playerCode)
                        {
                            cardDeckListLoad[num].LoadPlayerInfo();
                            foreach (CardHeadView cardHeadView in cardDeckListLoad[num].cardHeadViews)
                            {
                                cardHeadView.OnPointerEnter = () =>
                                {
                                    SendNotification(
                                        UIViewSystemEvent.UI_VIEW_CURRENT,
                                        cardHeadView,
                                        StringUtil.GetNTByNotificationTypeAndUIViewNameAndOtherType(
                                            UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                                            UIViewConfig.getNameStrByUIViewName(UIViewName.OneCardAllInfo),
                                            "CardHeadView"
                                            )
                                        );
                                };
                                cardHeadView.OnPointerExit = () =>
                                {
                                    SendNotification(
                                        UIViewSystemEvent.UI_VIEW_CURRENT,
                                        UIViewConfig.getNameStrByUIViewName(UIViewName.OneCardAllInfo),
                                        UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW);
                                };
                            }
                        }
                    }
                    break;
                }
                break;

            //费用控制组件
            case UIViewSystemEvent.UI_MANA_INFA_SYS:
                int          changeNum    = 0;
                ManaInfoView manaInfoView = null;
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_MANA_INFA_SYS_INIT:
                    VariableAttribute manaInitVariableAttribute = notification.Body as VariableAttribute;
                    manaInfoView = UIControllerLIst.GetViewByName <ManaInfoView>(UIViewName.ManaInfoView);
                    manaInfoView.UIManaInfoSysInit(manaInitVariableAttribute, myself, playerCodeNotification);
                    break;

                case UIViewSystemEvent.UI_MANA_INFA_SYS_NUM_CHANGE:
                    VariableAttribute manaChangeVariableAttribute = notification.Body as VariableAttribute;
                    manaInfoView = UIControllerLIst.GetViewByName <ManaInfoView>(UIViewName.ManaInfoView);
                    manaInfoView.ChangeManaUsable(manaChangeVariableAttribute, myself);
                    break;
                }
                break;

            //科技组件显示
            case UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS:
                TraitCombinationView traitCombinationView = null;
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS_INIT:
                    List <TraitType> traitTypes = notification.Body as List <TraitType>;
                    traitCombinationView = UIControllerLIst.GetViewByName <TraitCombinationView>(UIViewName.TraitCombinationView);
                    traitCombinationView.UITraitCombinationSysInit(traitTypes, myself, playerCodeNotification);
                    break;

                case UIViewSystemEvent.UI_TRAIT_COMBINATION_SYS_ADD:
                    string traitType = notification.Body.ToString();
                    traitCombinationView = UIControllerLIst.GetViewByName <TraitCombinationView>(UIViewName.TraitCombinationView);
                    traitCombinationView.UITraitCombinationSysAdd(traitType, myself);
                    break;
                }
                break;

            //效果展示列控制
            case UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS:
                EffectDisplayView effectDisplayView = null;
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_PUT_ONE_EFFECT:
                    effectDisplayView = UIControllerLIst.GetViewByName <EffectDisplayView>(UIViewName.EffectDisplayView);
                    CardEntry effectCardNeedShow = notification.Body as CardEntry;
                    callBackDelay = true;
                    //回调函数
                    callBack = () =>
                    {
                        exceINotification = false;
                        SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EFFECT_SHOW_OVER);
                        SendNotification(UIViewSystemEvent.UI_ANIMATION_SYS, null, UIViewSystemEvent.UI_ANIMATION_SYS_START);
                    };
                    effectDisplayView.ShowCradEffectByCardEntryAuto(effectCardNeedShow, callBack);
                    break;

                case UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_ONE_EFFECT_NEED_CHOOSE_EXE:
                    effectDisplayView = UIControllerLIst.GetViewByName <EffectDisplayView>(UIViewName.EffectDisplayView);
                    CardEntry effectCardNeedChooseExe = notification.Body as CardEntry;
                    SendNotificationAddCardEntry sendNotificationAddCard = (OneUserSelectionItem oneUserSelectionItem) =>
                    {
                        SendNotification(OperateSystemEvent.OPERATE_SYS, oneUserSelectionItem, OperateSystemEvent.OPERATE_SYS_CHOOSE_ONE_USER_SELECTION_ITEM);
                    };
                    effectDisplayView.ShowCradEffectAndUserSelectionListByCardEntry(effectCardNeedChooseExe, sendNotificationAddCard);
                    break;

                case UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_ONE_EFFECT_NEED_CHOOSE_TARGET:
                    effectDisplayView = UIControllerLIst.GetViewByName <EffectDisplayView>(UIViewName.EffectDisplayView);
                    CardEntry effectCardNeedChooseTarget = notification.Body as CardEntry;
                    effectDisplayView.ShowCradEffectByCardEntry(effectCardNeedChooseTarget);
                    break;

                case UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_TO_HIDE:
                    effectDisplayView = UIControllerLIst.GetViewByName <EffectDisplayView>(UIViewName.EffectDisplayView);
                    effectDisplayView.cardIntactView.gameObject.SetActive(false);
                    break;
                }
                break;

            //科技组件显示
            case UIViewSystemEvent.UI_PLAYER_SCORE_SHOW_SYS:
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_PLAYER_SCORE_SHOW_SYS_CHANGE:
                    ShipComponentView shipScoreComponentView = UIControllerLIst.GetViewByName <ShipComponentView>(UIViewName.ShipComponentView);
                    shipScoreComponentView.ChangeScoreShow(myself, Convert.ToInt32(notification.Body));
                    break;
                }
                break;

            //结束按钮的显示控制
            case UIViewSystemEvent.UI_NEXT_TURN_SHOW_SYS:
                NextTurnButton nextTurnButton = null;
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_NEXT_TURN_SHOW_SYS_SHOW:
                    if (myself)
                    {
                        nextTurnButton = UIControllerLIst.GetViewByName <NextTurnButton>(UIViewName.NextTurnButton);
                        nextTurnButton.ShowButton();
                    }
                    break;
                }
                break;

            //展示卡牌完整信息的控制
            case UIViewSystemEvent.UI_ONE_CARD_ALL_INFO:
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_ONE_CARD_ALL_INFO_BUFF_CHANGE:
                    CardEntry      minionCellItem = notification.Body as CardEntry;
                    OneCardAllInfo oneCardAllInfo = UIControllerLIst.GetViewByName <OneCardAllInfo>(UIViewName.OneCardAllInfo);
                    if (oneCardAllInfo != null)
                    {
                        if (oneCardAllInfo.cardEntryShow.uuid == minionCellItem.uuid)
                        {
                            oneCardAllInfo.LoadingAllInfoByMinionCellItem(minionCellItem);
                        }
                    }
                    break;
                }
                break;

            case UIViewSystemEvent.UI_TURN_STAGE_SYS:
                switch (notification.Type)
                {
                case UIViewSystemEvent.UI_TURN_STAGE_SYS_STAGE_CHANGE:
                    //回调函数
                    UnityAction turnStageCallBack = () =>
                    {
                        SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EFFECT_SHOW_OVER);
                        SendNotification(UIViewSystemEvent.UI_ANIMATION_SYS, null, UIViewSystemEvent.UI_ANIMATION_SYS_START);
                    };
                    TurnSysProgressBarView turnSysProgressBarView = UIControllerLIst.GetViewByName <TurnSysProgressBarView>(UIViewName.TurnSysProgressBarView);
                    QuestStageCircuitItem  questStageCircuitItem  = notification.Body as QuestStageCircuitItem;
                    turnSysProgressBarView.LoadingAllStageInfoToChange(questStageCircuitItem, playerCode, turnStageCallBack);
                    break;
                }
                break;
            }
            if (callBackDelay == false)
            {
                callBack();
            }
        }
Beispiel #4
0
 public void LoadingUserSelectionListToCreate(List <OneUserSelectionItem> osParameterList, SendNotificationAddCardEntry sendNotificationAddCard, UnityAction choseThisView)
 {
     choseThisView += () =>
     {
         choseThisList();
     };
     for (int n = 0; n < osParameterList.Count; n++)
     {
         if (n < oneUserSelectionList.Count)
         {
             oneUserSelectionList[n].gameObject.SetActive(true);
             oneUserSelectionList[n].LoadingInfoByOneUserSelection(osParameterList[n], sendNotificationAddCard, choseThisView);
         }
         else
         {
             OneUserSelection cardIntactView = Instantiate <OneUserSelection>(oneUserSelectionPrefab);
             Vector3          position       = new Vector3();
             cardIntactView.transform.SetParent(transform, false);
             cardIntactView.transform.localPosition = position;
             cardIntactView.LoadingInfoByOneUserSelection(osParameterList[n], sendNotificationAddCard, choseThisView);
             oneUserSelectionList.Add(cardIntactView);
         }
     }
     for (int m = osParameterList.Count; m < oneUserSelectionList.Count; m++)
     {
         oneUserSelectionList[m].gameObject.SetActive(false);
     }
 }
Beispiel #5
0
 //展示效果和选项
 public void ShowCradEffectAndUserSelectionListByCardEntry(CardEntry cardEntry, SendNotificationAddCardEntry sendNotificationAddCard)
 {
     //添加需要展示的卡牌
     ShowCradEffect(cardEntry);
     ShowUserSelectListByCardEntry(cardEntry, sendNotificationAddCard);
 }