Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(this);

        phrasebook   = new PhraseBook();
        audio        = GetComponent <AudioSource>();
        volume       = 0.6f;
        audio.volume = volume;


        if (File.Exists(Application.persistentDataPath + "/PlayerData.save"))
        {
            string jsonString = File.ReadAllText(Application.persistentDataPath + "/PlayerData.save");
            Debug.Log(jsonString);
            if (jsonString.Equals("null"))
            {
                player       = new Player();
                fileDetected = false;
            }
            else
            {
                player       = JsonConvert.DeserializeObject <Player>(jsonString);
                fileDetected = true;
            }
        }
        else
        {
            fileDetected = false;
            player       = new Player();
        }
    }
Esempio n. 2
0
 public FindNextSystemCommand(ICommunicator communicator, INavigator navigator, IGalaxyMap galaxyMap, FindNextSystemPhrases phrases)
 {
     _communicator = communicator;
     _navigator    = navigator;
     _galaxyMap    = galaxyMap;
     _phraseBook   = PhraseBook.Ingest(phrases.Phrases);
 }
Esempio n. 3
0
        private string BuildScanScript(StarSystem system)
        {
            string script = string.Format(_scanPhraseBook.GetRandomPhrase(), system.Celestials.Count(), PhraseBook.PluralizedEnding(system.Celestials.Count(), _pluralPhrase));

            var celestialsByCategory = system.Celestials
                                       .Where(c => !c.Scanned)
                                       .GroupBy(c => c.Classification)
                                       .ToDictionary(grp => grp.Key, grp => grp.Count());

            int counter = 0;

            bool single = celestialsByCategory.First().Value == 1;

            Log.Debug("Single celestial: {@single} {@celestialsByCategory}", single, celestialsByCategory);
            script += single ? $"{_isPhrase} " : $"{_arePhrase} ";

            foreach (var item in celestialsByCategory)
            {
                counter++;

                if (counter == celestialsByCategory.Count() && celestialsByCategory.Count() > 1)
                {
                    script += $"{_andPhrase} ";
                }

                script += $"{item.Value} {_values.NameFromClassification(item.Key)}";

                script += PhraseBook.PluralizedEnding(item.Value, _pluralPhrase);

                script += ", ";
            }

            return(script);
        }
        public GameLoadCommand(ICommunicator communicator, IPlayerStatus playerStatus, GameLoadPhrases phrases)
        {
            _communicator = communicator;
            _playerStatus = playerStatus;

            _genericPhrases = PhraseBook.Ingest(phrases.Generic);
        }
Esempio n. 5
0
        public ProgressCommand(ICommunicator communicator, INavigator navigator, IPlayerStatus playerStatus, ProgressPhrases phrases)
        {
            _navigator    = navigator;
            _communicator = communicator;
            _playerStatus = playerStatus;

            _progressPhrases       = PhraseBook.Ingest(phrases.Progress);
            _systemsScannedPhrases = PhraseBook.Ingest(phrases.SystemsScanned);
        }
Esempio n. 6
0
    void Start()
    {
        Rect rect = GetComponent <RectTransform>().rect;

        midPointY = rect.center.y;

        gameRules  = GameManager.instance.gameRules;
        phraseBook = GameManager.instance.currentPhraseBook;
    }
        public RescanSystemCommand(ICommunicator communicator, INavigator navigator, IPlayerStatus playerStatus, RescanSystemPhrases phrases, ScansRemainingPhrases scanPhrases)
        {
            _navigator    = navigator;
            _communicator = communicator;
            _playerStatus = playerStatus;

            _errorPhrase         = phrases.Error;
            _systemUnscanned     = PhraseBook.Ingest(phrases.SystemUnscanned);
            _notExpeditionSystem = PhraseBook.Ingest(scanPhrases.SkipSystem);
        }
Esempio n. 8
0
        public FindNextSystemCommand(ICommunicator communicator, INavigator navigator, IGalaxyMap galaxyMap, FindNextSystemPhrases phrases, IPlayerStatus playerStatus)
        {
            _communicator = communicator;
            _navigator    = navigator;
            _galaxyMap    = galaxyMap;
            _playerStatus = playerStatus;

            _phraseBook       = PhraseBook.Ingest(phrases.Phrases);
            _finalDestination = PhraseBook.Ingest(phrases.FinalDestination);
        }
        public NextScanCommand(ICommunicator communicator, INavigator navigator, IPlayerStatus playerStatus, NextScanPhrases phrases)
        {
            _navigator    = navigator;
            _communicator = communicator;
            _playerStatus = playerStatus;

            _skipPhrases     = PhraseBook.Ingest(phrases.SkipSystem);
            _nextScanPhrases = PhraseBook.Ingest(phrases.NextScan);
            _completePhrases = PhraseBook.Ingest(phrases.ScansComplete);
        }
Esempio n. 10
0
        public void Handle(IEvent @event)
        {
            string currentSystem = _playerStatus.Location;

            IEnumerable <Celestial> remaining = _navigator.GetSystem(currentSystem)?
                                                .Celestials
                                                .Where(c => c.Scanned == false)
                                                .OrderBy(r => r.ShortName);


            bool surfaceScansRemain = false;

            if (remaining == null)
            {
                _communicator.Communicate(_skipPhraseBook.GetRandomPhrase());
                return;
            }

            if (!remaining.Any())
            {
                remaining = _navigator.GetSystem(currentSystem)?
                            .Celestials
                            .Where(c => c.SurfaceScanned == false)
                            .OrderBy(r => r.ShortName);

                if (!remaining.Any())
                {
                    _communicator.Communicate(_completePhrases.GetRandomPhrase());
                    return;
                }
                else
                {
                    surfaceScansRemain = true;
                }
            }

            string script = string.Empty;

            foreach (Celestial celestial in remaining)
            {
                if (celestial == remaining.Last() && remaining.Count() > 1)
                {
                    script += $" {_andPhrase} ";
                }

                script += $"{_planetPhrase} {celestial.ShortName}. ";
            }

            string finalScript = string.Format(_remainingPhrases.GetRandomPhrase(),
                                               remaining.Count(), script,
                                               surfaceScansRemain ? "surface " : "",
                                               PhraseBook.PluralizedEnding(remaining.Count(), "s"));

            _communicator.Communicate(finalScript);
        }
Esempio n. 11
0
        public CelestialScanCommand(ICommunicator communicator, INavigator navigator, IPlayerStatus playerStatus, CelestialScanPhrases phrases)
        {
            _communicator = communicator;
            _navigator    = navigator;
            _playerStatus = playerStatus;

            _scanCompletePhrases       = PhraseBook.Ingest(phrases.ScanComplete);
            _allScansCompletePhrases   = PhraseBook.Ingest(phrases.AllScansComplete);
            _oneRemainingPhrases       = PhraseBook.Ingest(phrases.SingleScanRemaining);
            _multipleRemainingPhrases  = PhraseBook.Ingest(phrases.MultipleScansRemaining);
            _expeditionCompletePhrases = PhraseBook.Ingest(phrases.ExpeditionComplete);
        }
Esempio n. 12
0
 public LaunchSRVCommand(ICommunicator communicator, LaunchSRVPhrases phrases, Preferences preferences)
     : base(communicator)
 {
     if (preferences.EnableSRVCommands)
     {
         _phraseBook = PhraseBook.Ingest(phrases.Phrases);
     }
     else
     {
         _phraseBook = PhraseBook.Ingest(new string[] { string.Empty });
     }
 }
Esempio n. 13
0
        public ScansRemainingCommand(ICommunicator communicator, INavigator navigator, IPlayerStatus playerStatus, ScansRemainingPhrases phrases)
        {
            _communicator = communicator;
            _navigator    = navigator;
            _playerStatus = playerStatus;
            _andPhrase    = phrases.AndPhrase;
            _planetPhrase = phrases.PlanetPhrase;

            _skipPhraseBook   = PhraseBook.Ingest(phrases.SkipSystem);
            _completePhrases  = PhraseBook.Ingest(phrases.SystemComplete);
            _remainingPhrases = PhraseBook.Ingest(phrases.ScansRemaining);
        }
Esempio n. 14
0
    void Start()
    {
        dataHolder = GameObject.Find("DataHolder").GetComponent <DataHolder>();
        phrasebook = dataHolder.Phrasebook;

        foreach (Phrase phrase in phrasebook.PhraseList)
        {
            GameObject        tempPhrase = Instantiate(phrasePrefab, transform);
            TextMeshProUGUI[] textList   = tempPhrase.GetComponentsInChildren <TextMeshProUGUI>();

            textList[0].text = phrase.japanese.Replace("~~", dataHolder.player.PlayerName);
            textList[1].text = phrase.english.Replace("~~", dataHolder.player.PlayerName);
        }
    }
Esempio n. 15
0
    void Start()
    {
        dataHolder = GameObject.Find("DataHolder").GetComponent <DataHolder>();
        phrasebook = dataHolder.Phrasebook;
        player     = dataHolder.player;

        //check player progression andset unlock


        foreach (Phrase phrase in phrasebook.PhraseList)
        {
            //after intro with guide unlock kaoru associated phrases
            if (phrase.tag == 1)
            {
                if (player.PlayerProgression["Guide"] >= 1)
                {
                    phrase.isUnlocked = true;
                }
                else
                {
                    phrase.isUnlocked = false;
                }
            }
            else if (phrase.tag == 2)
            {
                if (player.PlayerProgression["Kaoru"] >= 1)
                {
                    phrase.isUnlocked = true;
                }
                else
                {
                    phrase.isUnlocked = false;
                }
            }

            if (phrase.isUnlocked == true)
            {
                GameObject        tempPhrase   = Instantiate(phrasePrefab, transform);
                TextMeshProUGUI[] textList     = tempPhrase.GetComponentsInChildren <TextMeshProUGUI>();
                PhraseButton      phraseButton = tempPhrase.GetComponent <PhraseButton>();

                phraseButton.phraseInt = phrase.voice;
                Debug.Log(phraseButton.phraseInt);

                textList[0].text = phrase.japanese.Replace("~~", dataHolder.player.PlayerName);
                textList[1].text = phrase.english.Replace("~~", dataHolder.player.PlayerName);
            }
        }
    }
Esempio n. 16
0
        public CelestialScanCommand(ICommunicator communicator, INavigator navigator, IPlayerStatus playerStatus, CelestialScanPhrases phrases, CelestialValues values)
        {
            _communicator = communicator;
            _navigator    = navigator;
            _playerStatus = playerStatus;
            _values       = values;

            _scanCompletePhrases           = PhraseBook.Ingest(phrases.ScanComplete);
            _allScansCompletePhrases       = PhraseBook.Ingest(phrases.AllScansComplete);
            _switchtoSurfacesPhrases       = PhraseBook.Ingest(phrases.SwitchToSurfaces);
            _oneRemainingPhrases           = PhraseBook.Ingest(phrases.SingleScanRemaining);
            _multipleRemainingPhrases      = PhraseBook.Ingest(phrases.MultipleScansRemaining);
            _expeditionCompletePhrases     = PhraseBook.Ingest(phrases.ExpeditionComplete);
            _classificationCompletePhrases = PhraseBook.Ingest(phrases.ClassificationComplete);
            _finalDestinationPhrases       = PhraseBook.Ingest(phrases.FinalDestination);
            _systemValuePhrases            = PhraseBook.Ingest(phrases.SystemValue);
        }
Esempio n. 17
0
        public JumpCommand(ICommunicator communicator, INavigator navigator, JumpPhrases jumpPhrases, Preferences preferences)
        {
            _communicator = communicator;
            _navigator    = navigator;

            _isPhrase    = jumpPhrases.IsPhrase;
            _arePhrase   = jumpPhrases.ArePhrase;
            _andPhrase   = jumpPhrases.AndPhrase;
            _puralPhrase = jumpPhrases.PluralPhrase;

            _jumpPhraseBook     = PhraseBook.Ingest(jumpPhrases.Jumping);
            _skipPhraseBook     = PhraseBook.Ingest(jumpPhrases.Skipping);
            _scanPhraseBook     = PhraseBook.Ingest(jumpPhrases.Scanning);
            _alreadyScannedBook = PhraseBook.Ingest(jumpPhrases.AlreadyScanned);

            _communicateSkippableSystems = preferences.CommunicateSkippableSystems;
        }
Esempio n. 18
0
        public JumpCommand(ICommunicator communicator, INavigator navigator, JumpPhrases jumpPhrases, Preferences preferences, CelestialValues values, ILogger logger)
        {
            _communicator = communicator;
            _navigator    = navigator;
            _values       = values;
            _logger       = logger;

            _isPhrase     = jumpPhrases.IsPhrase;
            _arePhrase    = jumpPhrases.ArePhrase;
            _andPhrase    = jumpPhrases.AndPhrase;
            _pluralPhrase = jumpPhrases.PluralPhrase;

            _jumpPhraseBook     = PhraseBook.Ingest(jumpPhrases.Jumping);
            _skipPhraseBook     = PhraseBook.Ingest(jumpPhrases.Skipping);
            _scanPhraseBook     = PhraseBook.Ingest(jumpPhrases.Scanning);
            _alreadyScannedBook = PhraseBook.Ingest(jumpPhrases.AlreadyScanned);
            _systemValueBook    = PhraseBook.Ingest(jumpPhrases.SystemValue);

            _communicateSkippableSystems     = preferences.CommunicateSkippableSystems;
            _onlyCommunicateDuringExpedition = preferences.OnlyCommunicateDuringExpedition;
        }
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(this);

        phrasebook             = new PhraseBook();
        conversationVoiceLines = new VoiceLines("VoiceLines/");
        phraseVoiceLines       = new VoiceLines("PhraseVoiceLines/");

        audio        = GetComponent <AudioSource>();
        volume       = 0.01f;
        audio.volume = volume;

        //checks if voice line audio clips loaded properly
        Debug.Log(conversationVoiceLines.AudioClips.Length);

        if (File.Exists(Application.persistentDataPath + "/PlayerData.save"))
        {
            string jsonString = File.ReadAllText(Application.persistentDataPath + "/PlayerData.save");
            Debug.Log(jsonString);
            if (jsonString.Equals("null"))
            {
                player       = new Player();
                fileDetected = false;
            }
            else
            {
                player       = JsonConvert.DeserializeObject <Player>(jsonString);
                fileDetected = true;
            }
        }
        else
        {
            fileDetected = false;
            player       = new Player();
        }
    }
 public LaunchSRVCommand(ICommunicator communicator, LaunchSRVPhrases phrases)
     : base(communicator)
 {
     _phraseBook = PhraseBook.Ingest(phrases.Phrases);
 }
Esempio n. 21
0
 public GreetingCommand(ICommunicator communicator, GreetingPhrases phrases)
     : base(communicator)
 {
     _phraseBook = PhraseBook.Ingest(phrases.Phrases);
 }
Esempio n. 22
0
 public GetNextSystemCommand(ICommunicator communicator, INavigator navigator, GetNextSystemPhrases phrases)
 {
     _communicator = communicator;
     _navigator    = navigator;
     _phraseBook   = PhraseBook.Ingest(phrases.Phrases);
 }
Esempio n. 23
0
 public InitializedCommand(ICommunicator communicator, InitializedPhrases phrases)
     : base(communicator)
 {
     _phraseBook = PhraseBook.Ingest(phrases.Phrases);
 }