Beispiel #1
0
        protected override void Refresh()
        {
            if (!SceneTransporter.IsCurrentGameRefreshed())
            {
                return;
            }

            if (SceneTransporter.CurrentGame.CurrentEventCard != null)
            {
                JoanOfArcPreviewFrame.SetActive(true);
                OriginalPreviewFrame.SetActive(false);
                JoanOfArcAgeTextGo.GetComponent <TextMesh>().text =
                    SceneTransporter.CurrentGame.CurrentEventCard.CardAge.ToString();
                JoanOfArcNameTextGo.GetComponent <TextMesh>().text =
                    SceneTransporter.CurrentGame.CurrentEventCard.CardName;
            }
            else
            {
                JoanOfArcPreviewFrame.SetActive(false);
                OriginalPreviewFrame.SetActive(true);
                OriginalPreviewFrame.GetComponent <TextMesh>().text =
                    SceneTransporter.CurrentGame.CurrentEventAge.ToString();
            }

            Fill(CurrentEventCountGOs, SceneTransporter.CurrentGame.CurrentAge,
                 SceneTransporter.CurrentGame.CurrentEventCount);
            Fill(FutureEventCountGOs, SceneTransporter.CurrentGame.CurrentAge,
                 SceneTransporter.CurrentGame.FutureEventCount);
        }
        private void Update()
        {
            if (!SceneTransporter.IsCurrentGameRefreshed())
            {
                return;
            }

            if (SceneTransporter.CurrentGame.Boards.Count <= PlayerNo)
            {
                return;
            }

            TtaBoard board = SceneTransporter.CurrentGame.Boards[PlayerNo];


            PlayerNameTextMesh.GetComponent <TextMesh>().text = board.PlayerName;

            CultureTotalTextMesh.GetComponent <TextMesh>().text       = board.Resource[ResourceType.Culture].ToString();
            CultureIncrementalTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.CultureIncrement].ToString();

            ScienceTotalTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.Science].ToString() +
                (board.Resource[ResourceType.ScienceForMilitary] == 0
                    ? ""
                    : "<color=#ffa500ff>" +
                 (board.Resource[ResourceType.ScienceForMilitary] > 0 ? "+" : "")
                 + board.Resource[ResourceType.ScienceForMilitary].ToString() + "</color>");
            ScienceIncrementalTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.ScienceIncrement].ToString();

            MilitaryStrengthTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.MilitaryForce].ToString();
            ExplorationTextMesh.GetComponent <TextMesh>().text = board.Resource[ResourceType.Exploration].ToString();

            ResourceTotalTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.Resource].ToString() +
                (board.Resource[ResourceType.ResourceForMilitary] == 0
                    ? ""
                    : "<color=#ffa500ff>" +
                 (board.Resource[ResourceType.ResourceForMilitary] > 0 ? "+" : "")
                 + board.Resource[ResourceType.ResourceForMilitary].ToString() + "</color>");
            ResourceIncrementalTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.ResourceIncrement].ToString();

            FoodTotalTextMesh.GetComponent <TextMesh>().text       = board.Resource[ResourceType.Food].ToString();
            FoodIncrementalTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.FoodIncrement].ToString();

            WhiteMarkerTextMesh.GetComponent <TextMesh>().text =
                board.Resource[ResourceType.WhiteMarker] + "/" + board.Resource[ResourceType.WhiteMarkerMax];

            RedMarkerTextMesh.GetComponent <TextMesh>().text = board.Resource[ResourceType.RedMarker] + "/" +
                                                               board.Resource[ResourceType.RedMarkerMax];
        }
        internal void SwitchBoard(int no)
        {
            if (!SceneTransporter.IsCurrentGameRefreshed())
            {
                return;
            }

            if (SceneTransporter.CurrentGame.Boards.Count <= no)
            {
                return;
            }

            CurrentPlayerBoardIndex = no;

            InterAction = null;
            ActionBinder.Unbind();
            BoardDisplay.Refresh();
            ActionBinder.BindAction(SceneTransporter.CurrentGame.PossibleActions, this);
        }
Beispiel #4
0
        //用update会导致弹出窗口的OnMouseExit捕捉不到
        public void Refresh()
        {
            if (!SceneTransporter.IsCurrentGameRefreshed())
            {
                //当前游戏不完整,不刷新
                ////此处应该抛出异常
                return;
            }

            if (SceneTransporter.CurrentGame.Boards.Count <= BoardBehavior.CurrentPlayerBoardIndex)
            {
                //当前玩家编号出现错误,不刷新
                //此处应该抛出异常
                return;
            }

            TtaBoard board = SceneTransporter.CurrentGame.Boards[BoardBehavior.CurrentPlayerBoardIndex];

            DisplayCardRow(SceneTransporter.CurrentGame.CardRow);
            DisplayEventsAndCardCounts(SceneTransporter.CurrentGame);

            //如果当前阶段是PoliticalPhase,那么就展示PoliticalPhase
            if (SceneTransporter.CurrentGame.CurrentPhase == TtaPhase.PoliticalPhase)
            {
                //不一定你是当前玩家,因为有可能别人在他的政治行动阶段打你呢
                //或者你正在处理一个事件
                if (SceneTransporter.CurrentGame.PossibleActions.Count > 0)
                {
                    DisplayPoliticalPhaseDialogs(SceneTransporter.CurrentGame);
                }
                else
                {
                    HideAllPoliticalPhaseDialogs();
                }
            }
            else
            {
                HideAllPoliticalPhaseDialogs();
            }

            var backgroundSpriteName = "SpriteTile/PCBoard/pc-board-player-background-" + "orange,purple,green,grey".Split(",".ToCharArray())[BoardBehavior.CurrentPlayerBoardIndex];
            var backgroundsp         = UnityResources.GetSprite(backgroundSpriteName);

            BackgroundSpriteGo.GetComponent <SpriteRenderer>().sprite = backgroundsp;


            JournalFrame.Refresh();

            //展示用代码


            DisplayYellowBlueBank(board);

            DisplayWhiteRedMarkers(board);

            DisplayGovenrment(board);
            DisplayLeader(board);

            DisplayCivilHandCard(board);
            DisplayMilitaryHandCard(board);

            DisplayWonders(board);
            DisplayColony(board);

            DisplayBuildings(board);

            DisplaySpecialTech(board);

            DisplayWarnings(board);

            DisplayTactics(board);

            DisplayWorkerPool(board);
        }