コード例 #1
0
    public void PreparePointDescription()
    {
        pointIcon.uvRect = GetMarkerRect(chosenPoint.type);

        if (chosenPoint != null)
        {
            switch (chosenPoint.type)
            {
            case MapMarkerType.MyCity:
            {
                if (GameMaster.realMaster.colonyController != null)
                {
                    pointLabel.text = GameMaster.realMaster.colonyController.cityName;
                }
                else
                {
                    pointLabel.text = Localization.GetPhrase(LocalizedPhrase.YouAreHere);
                }
                pointDescription.text = Localization.GetMyColonyDescription();
                if (sendExpeditionButton.activeSelf)
                {
                    sendExpeditionButton.SetActive(false);
                }
                break;
            }

            case MapMarkerType.FlyingExpedition:
            {
                var e = (chosenPoint as FlyingExpedition).expedition;
                pointLabel.text       = Localization.GetExpeditionName(e);
                pointDescription.text = Localization.GetExpeditionDescription(e);
                if (e.stage == Expedition.ExpeditionStage.WayIn)
                {
                    sendButtonLabel.text = Localization.GetPhrase(LocalizedPhrase.RecallExpedition);
                    if (!sendExpeditionButton.activeSelf)
                    {
                        sendExpeditionButton.SetActive(true);
                    }
                }
                else
                {
                    if (sendExpeditionButton.activeSelf)
                    {
                        sendExpeditionButton.SetActive(false);
                    }
                }
                break;
            }

            default:
            {
                pointLabel.text = Localization.GetMapPointTitle(chosenPoint.type);

                var poi = chosenPoint as PointOfInterest;
                if (poi != null)
                {
                    var s = chosenPoint.GetDescription() +
                            "\n\n" + Localization.GetWord(LocalizedWord.Difficulty) + ": " + ((int)(poi.difficulty * 100f)).ToString() + '%';
                    if (poi.workingExpedition == null)
                    {
                        sendButtonLabel.text = Localization.GetPhrase(LocalizedPhrase.SendExpedition);
                        if (!sendExpeditionButton.activeSelf)
                        {
                            sendExpeditionButton.SetActive(true);
                        }
                    }
                    else
                    {
                        s += '\n' + Localization.GetWord(LocalizedWord.Expedition) + ": " + poi.workingExpedition.crew.name;
                        sendButtonLabel.text = Localization.GetPhrase(LocalizedPhrase.OpenExpeditionWindow);
                        if (!sendExpeditionButton.activeSelf)
                        {
                            sendExpeditionButton.SetActive(true);
                        }
                    }
                    pointDescription.text = s;
                }
                else
                {
                    pointDescription.text = chosenPoint.GetDescription();
                    if (sendExpeditionButton.activeSelf)
                    {
                        sendExpeditionButton.SetActive(false);
                    }
                }
                break;
            }
            }

            if (!infoPanel.activeSelf)
            {
                infoPanel.SetActive(true);
            }
        }
        else
        {
            CloseInfopanel();
        }
    }