예제 #1
0
    private ShowBehavior LoadShow(TextAsset dataSource)
    {
        GameObject   obj = new GameObject(dataSource.name);
        ShowBehavior ret = obj.AddComponent <ShowBehavior>();

        ret.Episodes = DataLoader.LoadData(dataSource);
        obj.transform.SetParent(RootTransform, false);
        return(ret);
    }
예제 #2
0
 private void comboShowType_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (comboShowType.SelectedIndex == 0)
     {
         sb = new MessBox();
     }
     else
     {
         sb = new Popup();
     }
 }
예제 #3
0
 public void SetShowBehavior(ShowBehavior sb)
 {
     showBehavior = sb;
 }
예제 #4
0
        public void Show(ShowBehavior behavior, Transform showGrid, bool repeat)
        {
            showBehavior = behavior;
            popupList.items.Clear();
            popupList.AddItem("近战");
            popupList.AddItem("远程");
            popupList.AddItem("攻城");
            OKButton.onClick.Clear();
            returnButton.onClick.Clear();
            EventDelegate.Add(returnButton.onClick, () => Hide());

            if (!repeat)
            {
                BlackShow.GetInstance().Show(true);
                PlayerController.GetInstance().obj.SetActive(false);
                EnemyController.GetInstance().obj.SetActive(false);
                obj.SetActive(true);
            }

            switch (showBehavior)
            {
            case ShowBehavior.draw:
                label.text = "请选择要打出的牌";
                goto default;

            case ShowBehavior.show:
                label.text = "显示卡牌";
                goto default;

            case ShowBehavior.leader:
                label.text = "领导牌";
                PlayerLeaderBehavior leaderBehavior = LeaderController.GetInstance().obj[0].GetComponent <PlayerLeaderBehavior>();
                messageLabel.text = leaderBehavior.message;
                messageLabel.gameObject.SetActive(true);
                popupList.gameObject.SetActive(false);
                OKButton.gameObject.SetActive(true);
                OKButton.GetComponent <UIButton>().isEnabled = leaderBehavior.IsEnabled;
                EventDelegate.Add(OKButton.onClick, () => leaderBehavior.Play());
                break;

            case ShowBehavior.replace:
                label.text = string.Format("请选择要替换的牌 {0}/2", replaceInt);
                EventDelegate.Add(returnButton.onClick, () => GameController.GetInstance().StartGame());
                goto default;

            case ShowBehavior.nurse:
                label.text = "从墓地中打出卡牌";
                totalGrid  = showGrid;
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(false);
                OKButton.gameObject.SetActive(false);
                EventDelegate.Add(returnButton.onClick, () => CoroutineManager.GetInstance().AddTask(EnemyController.GetInstance().Play(EnemyController.GetInstance().grids[1])));
                break;

            case ShowBehavior.dummy:
                label.text = "请选择要替换的牌";
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(true);
                OKButton.gameObject.SetActive(false);
                break;

            case ShowBehavior.warhorn:
                label.text = "战争号角";
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(true);
                OKButton.gameObject.SetActive(true);
                OKButton.GetComponent <UIButton>().isEnabled = true;
                EventDelegate.Add(OKButton.onClick, () => WarhornController.GetInstance().Warhorn());
                break;

            case ShowBehavior.agile:
                label.text = "请选择出牌的排";
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(true);
                popupList.items.Remove("攻城");
                OKButton.gameObject.SetActive(true);
                OKButton.GetComponent <UIButton>().isEnabled = true;
                EventDelegate.Add(OKButton.onClick, () => AgileController.GetInstance().Agile());
                break;

            default:
                totalGrid = showGrid;
                messageLabel.gameObject.SetActive(false);
                popupList.gameObject.SetActive(false);
                OKButton.gameObject.SetActive(false);
                break;
            }

            if (repeat)
            {
                grid.DestroyChildren();
            }

            for (int i = 0; i < showGrid.childCount; i++)
            {
                GameObject cardObject = Instantiate(showGrid.GetChild(i).gameObject, grid);
                UISprite   sprite     = cardObject.GetComponent <UISprite>();
                sprite.width  = 250;
                sprite.height = 450;
                UIButton cardButton = cardObject.GetComponent <UIButton>();
                switch (showBehavior)
                {
                case ShowBehavior.draw:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Play());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.show:
                    cardButton.enabled = false;
                    break;

                case ShowBehavior.replace:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Replace());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.nurse:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Play());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.dummy:
                    EventDelegate.Add(cardButton.onClick, () => cardObject.GetComponent <CardBehavior>().Dummy());
                    cardButton.enabled = true;
                    break;

                case ShowBehavior.warhorn:
                    cardButton.enabled = false;
                    break;

                case ShowBehavior.agile:
                    cardButton.enabled = false;
                    break;
                }
                cardObject.GetComponent <UIDragScrollView>().scrollView = scrollView;
                cardObject.GetComponent <BoxCollider>().size            = new Vector3(250, 450, 1);
            }

            grid.GetComponent <UIGrid>().Reposition();
        }