Exemplo n.º 1
0
 public void FocusOnHackWindow(HackWindow window)
 {
     hasActiveWindow = true;
     activeWindow    = window;
     wordManager.words.Clear();
     foreach (Word word in window.words)
     {
         wordManager.words.Add(word);
     }
     wordManager.context          = WordManager.Context.hack;
     wordManager.activeHackWindow = window;
     wordManager.wordKey          = window.wordKey;
 }
Exemplo n.º 2
0
        private void ButtonHack_OnClick(object sender, RoutedEventArgs e)
        {
            //доступ к хакерству - только если подключен интернет и есть браузер
            bool mayTorrent = ((IInfoComputer)_panel.Computer).GetLevel(Internet) > 0 && ((IInfoSoft)_panel.Soft).GetInfo(SoftBase.Parts.Browser) > 0;

            if (!mayTorrent)
            {
                MessageBox.Show("Для доступа к хакерству должен быть подключен интернет и должен быть установлен любой браузер!", "Хакерство недоступно", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            HackWindow window = new HackWindow(_panel.Hack);

            window.Owner = Window.GetWindow(this);
            window.ShowDialog();
        }
Exemplo n.º 3
0
    public void CreateHackWindow(int lineCount, Vector3 pos)
    {
        HackWindow window = Instantiate(hackWindowPrefab, pos, Quaternion.identity);

        List <string> words = new List <string>();

        foreach (string word in HackLineGenerator.wordList)
        {
            words.Add(word);
        }


        List <int> posIndexes = new List <int> {
            0, 1, 2
        };

        //Word Key
        int  wordIndex = Random.Range(0, words.Count);
        int  posIndex  = Random.Range(0, posIndexes.Count);
        Word wordKey   = new Word(words[wordIndex], wordSpawner.SpawnWord(window.wordPositions[posIndexes[posIndex]].position, window.wordPositions[posIndexes[posIndex]], true));

        words.RemoveAt(wordIndex);
        posIndexes.RemoveAt(posIndex);
        //Word A
        wordIndex = Random.Range(0, words.Count);
        posIndex  = Random.Range(0, posIndexes.Count);
        Word wordA = new Word(words[wordIndex], wordSpawner.SpawnWord(window.wordPositions[posIndexes[posIndex]].position, window.wordPositions[posIndexes[posIndex]], true));

        words.RemoveAt(wordIndex);
        posIndexes.RemoveAt(posIndex);
        //Word B
        wordIndex = Random.Range(0, words.Count);
        posIndex  = Random.Range(0, posIndexes.Count);
        Word wordB = new Word(words[wordIndex], wordSpawner.SpawnWord(window.wordPositions[posIndexes[posIndex]].position, window.wordPositions[posIndexes[posIndex]], true));

        words.RemoveAt(wordIndex);
        posIndexes.RemoveAt(posIndex);


        int lineKeyIndex = Random.Range(0, lineCount);

        window.baseText.text = "";

        for (int i = 0; i < lineCount; i++)
        {
            string addedString = "";

            if (i == lineKeyIndex)
            {
                addedString = HackLineGenerator.GetRandomLine(wordKey.word).line;
            }
            else
            {
                addedString = HackLineGenerator.GetRandomLine(words[Random.Range(0, words.Count)]).line;
            }

            window.baseText.text = window.baseText.text + addedString + "\n";
        }

        window.words.Add(wordKey);
        window.words.Add(wordA);
        window.words.Add(wordB);
        window.wordKey = wordKey.word;

        hackWindows.Add(window);
    }