コード例 #1
0
    public void Init()
    {
        GameManager          gameManager          = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        LocalizedTextManager localizedTextManager = gameManager.GetComponent <LocalizedTextManager>();

        // create day name text
        weekdayNameText.text = localizedTextManager.GetLocalizedString(dayOfTheWeek.ToString()).ToUpper();

        dayNumberText.text = (dayIndex + 1).ToString() + ".";

        // show number of rounds completed in that day
        int numAppointmentsCompleted = 0;
        int currentNumStars          = 0;

        for (int i = 0; i < numAppointments; i++)
        {
            int thisRoundNumStars = SaveGame.GetRoundStarCount(dayIndex_internal, i);
            if (thisRoundNumStars > 0)
            {
                numAppointmentsCompleted++;
                currentNumStars += thisRoundNumStars;
            }

            // generate save game data for blob
            gameManager.gameDataBlob.AddDayStarCount(dayIndex_internal, i, thisRoundNumStars);
        }
        string stringToDisplay = "";

        if (isPlayable && numAppointmentsCompleted > 0)
        {
            stringToDisplay  = numAppointmentsCompleted + " " + localizedTextManager.GetLocalizedString("of") + " " + numAppointments.ToString() + " " + localizedTextManager.GetLocalizedString("sessions");
            stringToDisplay += " - ";
            stringToDisplay += currentNumStars.ToString() + " " + localizedTextManager.GetLocalizedString("of") + " " + (numAppointments * 3).ToString() + " " + localizedTextManager.GetLocalizedString("stars");
            if (numAppointmentsCompleted == numAppointments)
            {
                hasPassedAllRounds = true;
                SaveGame.SetHasCompletedAllRoundsInDay(dayIndex_internal, hasPassedAllRounds);
            }
            if (currentNumStars == (numAppointments * 3))
            {
                hasGottenAllStars = true;
            }
        }
        else
        {
            stringToDisplay = "";
        }
        daySummaryText.text = stringToDisplay;

        AddStatusOverlay();
    }
コード例 #2
0
    public void ShowBubble(Vector3 _positionOfPerson, string[] textOptions, float _showProbability)
    {
        if (Random.Range(0.0f, 1.0f) < _showProbability)
        {
            // move position toward center by amount
            Vector3 _posForBubble = _positionOfPerson;
            _posForBubble.y += (_positionOfPerson.y > verticalCenter ? -verticalDistanceFromPerson : verticalDistanceFromPerson);
            _posForBubble.x *= scalePositionTowardCenter;

            chatBubble.gameObject.transform.position = _posForBubble;
            chatBubble.gameObject.SetActive(true);

            string textToDisplay = (textOptions[Random.Range(0, textOptions.Length)]);
            Text   t             = chatBubble.GetComponentInChildren <Text>();

            LocalizedTextManager localizedTextManager = FindObjectOfType <LocalizedTextManager>();
            textToDisplay = localizedTextManager.GetLocalizedString(textToDisplay);

            t.text = textToDisplay;
            if (t.text.Length < 20)
            {
                t.fontSize = defaultFontSize + smallTextFontIncrease;
            }
            else
            {
                t.fontSize = defaultFontSize;
            }

            isBubbleVisible   = true;
            visibilityCounter = 0.0f;
        }
        showBoredTextCounter = 0.0f;
    }
コード例 #3
0
ファイル: Clipboard.cs プロジェクト: nickhester/SocialNetwork
    void Start()
    {
        gameManager = GameObject.FindWithTag("GameManager").GetComponent <GameManager>();
        gameManager.Register_Clipboard(this);
        localizedTextManager = gameManager.GetComponent <LocalizedTextManager>();

        buttonTextComponent = GetComponentInChildren <Text>();

        offscreenPosition = new Vector3(transform.position.x, transform.position.y - offscreenOffset, transform.position.z);
        offscreenScale    = transform.localScale * offscreenScalar;
        originalPosition  = transform.position;
        originalScale     = transform.localScale;

        createAndDestroyLevelRef = GameObject.FindGameObjectWithTag("persistentObject").GetComponent <CreateAndDestroyAppointment>();

        selectorRef = GameObject.Find("LevelSelector").GetComponent <LevelSelector>();
        createAndDestroyLevelRef.levelsAvailable = selectorRef.dayToGenerate.numAppointments;

        CreateAllAppointments();

        // place badges
        badgeCheckOriginalPos         = badgeCheck.transform.localPosition;
        badgeStarOriginalPos          = badgeStar.transform.localPosition;
        badgeCheck.transform.position = new Vector3(badgeCheck.transform.position.x, badgeCheck.transform.position.y + distanceToPushBadges, badgeCheck.transform.position.z);
        badgeStar.transform.position  = new Vector3(badgeStar.transform.position.x, badgeStar.transform.position.y + distanceToPushBadges, badgeStar.transform.position.z);

        // place showMe banner
        Vector3 showMeScreenEdge = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width * showMeBannerScreenPos_X, Screen.height * showMeBannerScreenPos_Y));

        showMeOutPosition = new Vector3(
            showMeScreenEdge.x,
            showMeScreenEdge.y,
            showMeBanner.transform.position.z);
        showMeInPosition = new Vector3(showMeOutPosition.x - distanceToPushShowMeBanner, showMeOutPosition.y, showMeOutPosition.z);
        showMeBanner.transform.position = showMeInPosition;

        // show notifications at start of clipboard
        if (selectorRef.dayToGenerate.dayIndex_internal == 0)
        {
            GameObject.Find("NotificationManager").GetComponent <NotificationManager>().DisplayNotification(1, false);
        }
        else if (selectorRef.dayToGenerate.dayIndex_internal == 4)
        {
            GameObject.Find("NotificationManager").GetComponent <NotificationManager>().DisplayNotification(9, false);
        }

        textDay.text = localizedTextManager.GetLocalizedString("Day") + " " + (selectorRef.dayToGenerate.dayIndex_internal + 1);

        restartFromResultsScreenButton = GameObject.Find("RestartFromResultsScreenButton");
        ShowRestartButton(false);

        isFirstCreation = false;
    }
コード例 #4
0
    public void SetLocalizedText()
    {
        Text myTextObject = GetComponent <Text>();
        LocalizedTextManager localizedTextManager = FindObjectOfType <LocalizedTextManager>();

        myTextObject.text = localizedTextManager.GetLocalizedString(stringName);

        if (localizedTextManager.currentLanguage == LocalizedTextManager.Language.English)
        {
            myTextObject.resizeTextForBestFit = false;
        }
        else if (localizedTextManager.currentLanguage == LocalizedTextManager.Language.Arabic ||
                 alwaysResizeToBestFit)
        {
            myTextObject.resizeTextForBestFit = true;
        }
        else
        {
            myTextObject.resizeTextForBestFit = false;
        }
    }
コード例 #5
0
ファイル: Clipboard.cs プロジェクト: nickhester/SocialNetwork
    void GenerateALevel(ref Appointment _appt, Difficulty _diff, int _levelNum, bool _special_FallToRed, bool _special_OneClick, bool _special_CantTouch, bool _special_NoLines, int seed)
    {
        string _appointmentText = "";
        string _difficultyText  = "";

        createAndDestroyLevelRef.levelsAvailable--;

        ValidLevels requestedLevel;

        if (seed == -1)
        {
            requestedLevel = GameObject.Find("LevelSelector").GetComponent <LevelFactory>().GetALevel(
                _diff, _levelNum, _special_FallToRed, _special_OneClick, _special_CantTouch, _special_NoLines);
        }
        else
        {
            requestedLevel = GameObject.Find("LevelSelector").GetComponent <LevelFactory>().GetALevel(
                _diff, _levelNum, _special_FallToRed, _special_OneClick, _special_CantTouch, _special_NoLines, seed, false);
        }

        _appt.myLevel = requestedLevel;

        _appt.SetMySpecialOverlays();

        // build text to display on appointment
        if (requestedLevel.difficulty == Difficulty.VeryEasy)
        {
            _difficultyText = localizedTextManager.GetLocalizedString("Trivial");;
        }
        else if (_diff == Difficulty.Easy)
        {
            _difficultyText = localizedTextManager.GetLocalizedString("Minor");
        }
        else if (_diff == Difficulty.Medium)
        {
            _difficultyText = localizedTextManager.GetLocalizedString("Major");
        }
        else if (_diff == Difficulty.Hard)
        {
            _difficultyText = localizedTextManager.GetLocalizedString("Critical");
        }

        _appointmentText        += (_appt.myLevel.level).ToString();
        _appointmentText        += " " + localizedTextManager.GetLocalizedString("Patients") + ",";
        _appointmentText        += " " + localizedTextManager.GetLocalizedString("Issues") + ": ";
        _appt.myDisplayText_prop = _appointmentText + _difficultyText;
    }
コード例 #6
0
ファイル: Clipboard.cs プロジェクト: nickhester/SocialNetwork
    void Start()
    {
        gameManager = GameObject.FindWithTag("GameManager").GetComponent<GameManager>();
        gameManager.Register_Clipboard(this);
        localizedTextManager = gameManager.GetComponent<LocalizedTextManager>();

        buttonTextComponent = GetComponentInChildren<Text>();

        offscreenPosition = new Vector3(transform.position.x, transform.position.y - offscreenOffset, transform.position.z);
        offscreenScale = transform.localScale * offscreenScalar;
        originalPosition = transform.position;
        originalScale = transform.localScale;

        createAndDestroyLevelRef = GameObject.FindGameObjectWithTag("persistentObject").GetComponent<CreateAndDestroyAppointment>();

        selectorRef = GameObject.Find("LevelSelector").GetComponent<LevelSelector>();
        createAndDestroyLevelRef.levelsAvailable = selectorRef.dayToGenerate.numAppointments;

        CreateAllAppointments();

        // place badges
        badgeCheckOriginalPos = badgeCheck.transform.localPosition;
        badgeStarOriginalPos = badgeStar.transform.localPosition;
        badgeCheck.transform.position = new Vector3(badgeCheck.transform.position.x, badgeCheck.transform.position.y + distanceToPushBadges, badgeCheck.transform.position.z);
        badgeStar.transform.position = new Vector3(badgeStar.transform.position.x, badgeStar.transform.position.y + distanceToPushBadges, badgeStar.transform.position.z);

        // place showMe banner
        Vector3 showMeScreenEdge = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width * showMeBannerScreenPos_X, Screen.height * showMeBannerScreenPos_Y));
        showMeOutPosition = new Vector3(
            showMeScreenEdge.x,
            showMeScreenEdge.y,
            showMeBanner.transform.position.z);
        showMeInPosition = new Vector3(showMeOutPosition.x - distanceToPushShowMeBanner, showMeOutPosition.y, showMeOutPosition.z);
        showMeBanner.transform.position = showMeInPosition;

        // show notifications at start of clipboard
        if (selectorRef.dayToGenerate.dayIndex_internal == 0)
        {
            GameObject.Find("NotificationManager").GetComponent<NotificationManager>().DisplayNotification(1, false);
        }
        else if (selectorRef.dayToGenerate.dayIndex_internal == 4)
        {
            GameObject.Find("NotificationManager").GetComponent<NotificationManager>().DisplayNotification(9, false);
        }

        textDay.text = localizedTextManager.GetLocalizedString("Day") + " " + (selectorRef.dayToGenerate.dayIndex_internal + 1);

        restartFromResultsScreenButton = GameObject.Find("RestartFromResultsScreenButton");
        ShowRestartButton(false);

        isFirstCreation = false;
    }