Пример #1
0
        /// <summary>
        ///     The programs entry point.
        /// </summary>
        /// <param name="args">The arguments.</param>
        private static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            NodeNetworkHandler.FastThreadPool = new DedicatedThreadPool(new DedicatedThreadPoolSettings(Environment.ProcessorCount));

            var server = new MiNetServer();

            int threads;
            int iothreads;

            ThreadPool.GetMinThreads(out threads, out iothreads);
            ThreadPool.SetMinThreads(4000, iothreads);

            var localServerManager = new NodeServerManager(server, 51234);

            server.ServerManager = localServerManager;
            server.ServerRole    = ServerRole.Node;
            server.LevelManager  = new SpreadLevelManager(60);

            server.StartServer();

            Console.WriteLine("MiNET running...");
            Console.ReadLine();
        }
Пример #2
0
        public MovieVideo(string magnetUri)
        {
            InitializeComponent();
            //AxWMPLib.AxWindowsMediaPlayer player = new AxWindowsMediaPlayer();
            //Host.Child = player;
            if (magnetUri != string.Empty)
            {
                if (File.Exists("hash.txt"))
                {
                    File.Delete("hash.txt");
                }
                NodeServerManager.StartServer(magnetUri);
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (sender, e) =>
                {
                    while (true)
                    {
                        if (File.Exists("hash.txt"))
                        {
                            break;
                        }
                    }
                };
                worker.RunWorkerCompleted += (sender, e) =>
                {
                    File.Delete("hash.txt");
                    //this.Player.closedCaption.SAMIFileName=
                    this.Player.URL = "http://localhost:1337";
                };
                worker.RunWorkerAsync();

                //this.Player.URL = "http://localhost:1337";
                //axWmp.URL = "http://localhost:1337";
            }
        }
    void CreateNewText()
    {
        Debug.Log("Received word");
        GameObject text = Instantiate(Resources.Load <GameObject>("prefabs/TravelingText"));

        text.transform.SetParent(canvas.transform, false);
        RectTransform      textRect     = text.GetComponent <RectTransform>();
        ScreenCrossingText crossingText = text.GetComponent <ScreenCrossingText>();

        switch (Random.Range(0, 4))
        {
        case 0:
            textRect.anchoredPosition = new Vector2(Screen.width * Random.value, (Screen.height / 2) + 100);
            crossingText.InitializeTravel(90, 5);
            break;

        case 1:
            textRect.anchoredPosition = new Vector2(Screen.width * Random.value, -(Screen.height / 2) - 100);
            crossingText.InitializeTravel(-90, 5);
            break;

        case 2:
            textRect.anchoredPosition = new Vector2(-(Screen.width / 2) - 100, Screen.height * Random.value);
            crossingText.InitializeTravelWithVector(0, 5, new Vector2(1, 0));
            break;

        case 3:
            textRect.anchoredPosition = new Vector2((Screen.width / 2) + 100, Screen.height * Random.value);
            crossingText.InitializeTravelWithVector(0, 5, new Vector2(-1, 0));
            break;
        }
        crossingText.SetText(NodeServerManager.GetLastUnconfirmedWord());
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        bool inWords = false;

        foreach (string w in NodeServerManager.GetConfirmedWords())
        {
            if (word == w)
            {
                inWords = true;
            }
        }
        if (!inWords)
        {
            transform.localScale += Vector3.one * Time.deltaTime * speed;
            transform.position   += Vector3.right * Time.deltaTime * speed;
        }
        else
        {
            transform.localScale -= Vector3.one * Time.deltaTime * speed;
            transform.position   += Vector3.right * Time.deltaTime;
            if (transform.localScale.x < 0)
            {
                gameObject.SetActive(false);
                wordAssigned.gameObject.SetActive(false);
            }
            // transform.position += Vector3.forward * Time.deltaTime;
        }
    }
Пример #5
0
        public WordData()
        {
            this.word   = NodeServerManager.GetLastUnconfirmedWord();
            this.volume = MicVolume.MicLoudness;
            ColorScheme scheme = EmotionColorPicker.GetColorSchemeForWord(NodeServerManager.GetLastUnconfirmedWord());

            Debug.Log(scheme.colorName);
            this.colorType = (WordDataManager.WordData.ColorType)System.Enum.Parse(typeof(WordDataManager.WordData.ColorType), scheme.colorName);
        }
Пример #6
0
    void DoThing()
    {
        lineDraw.positionCount = TextIO.count;
        Vector3 wordPos = Camera.main.transform.position + (Vector3.forward * 25) + (new Vector3(Mathf.Sin((float)TextIO.count / 1.2f), Mathf.Cos((float)TextIO.count / 1.2f), 0)) * ((Mathf.Sin(Time.time) + 1.5f) * 2f);

        textWriter.CreateWord(wordPos, NodeServerManager.GetLastUnconfirmedWord());


        // sphere.localScale = Vector3.zero;
        lineDraw.SetPosition(TextIO.count - 1, wordPos);
    }
Пример #7
0
 void CheckForNewTreeSegments()
 {
     string[] words = NodeServerManager.GetAllWords();
     for (int i = 0; i < words.Length; i++)
     {
         if (words[i] != " " && branchedWords.IndexOf(words[i]) == -1)
         {
             branchedWords.Add(words[i]);
             AddToTree(words[i]);
         }
     }
 }
Пример #8
0
 void CheckNewWords()
 {
     fullText.text = NodeServerManager.confirmedFullText + " " + NodeServerManager.currentPossibleText;
     string[] confirmedWords = NodeServerManager.GetConfirmedWords();
     foreach (string word in confirmedWords)
     {
         ColorScheme wordColor = EmotionColorPicker.GetColorSchemeForWord(word);
         if (word != "" && wordColor.colorName != "None" && wordColor.colorName != "error" &&
             coloredWords.IndexOf(word) == -1)
         {
             coloredWords.Add(word);
         }
     }
     currentWord.text = NodeServerManager.GetLastUnconfirmedWord();
     if (currentWord.text == "")
     {
         currentWord.text = NodeServerManager.GetLastConfirmedWord();
     }
     UpdateTextureColors();
 }
Пример #9
0
    void DoThing()
    {
        // lineDraw.positionCount = TextIO.count;
        GameObject newSphere = (GameObject)Instantiate(sphere, Vector3.forward * 10 + Vector3.right * -40, Quaternion.identity);
        float      volume    = 2f;

        //use colorName to make switch happen

        scaleSphere s = newSphere.GetComponent <scaleSphere>();

        s.speed = volume;
        //newSphere.transform.localScale = Vector3.one;

        float r = Random.Range(0.0f, 1.0f);
        float g = Random.Range(0.0f, 1.0f);
        float b = Random.Range(0.0f, 1.0f);

        newSphere.GetComponent <MeshRenderer>().material.color = Random.ColorHSV(0f, 1f, (float)TextIO.wordCount / 10f, (float)TextIO.wordCount / 10f, (float)TextIO.wordCount / 10f, (float)TextIO.wordCount / 10f);
        // newSphere.GetComponent<MeshRenderer>().material.color = EmotionColorPicker.GetColorSchemeForWord(TextIO.lastWord).background;

        Vector3   wordPos = Camera.main.transform.position + (Vector3.forward * (10 + TextIO.count));
        Transform newWord;

        // if(TextIO.newUnconfirmedWord){
        newWord = textWriter.CreateWord(wordPos, NodeServerManager.GetLastUnconfirmedWord()).transform;
        s.word  = NodeServerManager.GetLastUnconfirmedWord();
        // }else{
        //  newWord = textWriter.CreateWord(wordPos, TextIO.lastWord).transform;
        //  s.word = TextIO.lastWord;
        // }

        newWord.GetComponent <TextMesh>().fontSize = 120;
        s.wordAssigned = newWord;
        followTarget f = newWord.gameObject.AddComponent <followTarget>();

        f.target = newSphere.transform;
    }
Пример #10
0
 private void ModernWindow_Closing(object sender, CancelEventArgs e)
 {
     NodeServerManager.CloseServer();
 }
Пример #11
0
 private void ModernWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     NodeServerManager.CloseServer();
 }
Пример #12
0
    public void NextWord()
    {
        if ((useVoice && wordCount >= 10) || wordCount >= canto [lineCount % canto.Length].Length)
        {
            textDisplay.fullText.text += "\n";

            GUIStyle   height_calculator = new GUIStyle();
            GUIContent guiTextContent    = new GUIContent(textDisplay.fullText.text);

            float textWidth  = textDisplay.fullText.preferredWidth;
            float textHeight = height_calculator.CalcHeight(guiTextContent, textWidth);

            if (textHeight > 50)
            {
                bool delete    = true;
                int  charIndex = 0;
                while (delete)
                {
                    if (charIndex >= textDisplay.fullText.text.Length || textDisplay.fullText.text[charIndex] == '\n' || charIndex > 100)
                    {
                        if (textDisplay.fullText.text[charIndex + 1] != '\n')
                        {
                            charIndex++;
                        }
                        delete = false;
                    }
                    else
                    {
                        charIndex++;
                    }
                }
                // textDisplay.fullText.text
                textDisplay.fullText.text = textDisplay.fullText.text.Substring(charIndex, textDisplay.fullText.text.Length - charIndex);
            }

            wordCount = 0;
            lineCount++;
        }

        //if(useVoice){

        confirmedCount             = NodeServerManager.GetConfirmedWords().Length;
        textDisplay.fullText.text += NodeServerManager.GetLastConfirmedWord() + " ";

        unconfirmedCount = NodeServerManager.GetUnconfirmedWords().Length;
        textDisplay.GetComponent <Text>().text = NodeServerManager.GetLastUnconfirmedWord();
        //}else{

        //	lastWord = canto[lineCount][wordCount];
        //	textDisplay.GetComponent<Text>().text =  canto[lineCount][wordCount];
        //	textDisplay.fullText.text += canto[lineCount][wordCount] + " ";
        //}

        // textDisplay.fullText.text
        // textDisplay.GetComponent<Text>().text =  canto[lineCount][wordCount];
        //  Font curFont = fonts [Random.Range (0, fonts.Length)];
        //  newWord.GetComponent<TextMesh> ().font = curFont;
        //  curFont = fonts [Random.Range(0, fonts.Length)];
        //  if (newWord.GetComponent<TextMesh> ().font == curFont) {
        //  }
        //  newWord.GetComponent<Renderer> ().sharedMaterial = curFont.material;
        //  newWord.AddComponent<BoxCollider2D> ();
        //  newWord.GetComponent<BoxCollider2D> ().isTrigger = true;
        //  lastWord.x += newWord.GetComponent<BoxCollider2D> ().bounds.size.x + letterSpacing;
        //  if(canto[lineCount % canto.Length][wordCount].Contains(lineBreak)){
        //      newWord.transform.localScale *= 5;
        //      curFont = fonts [4];
        //      newWord.GetComponent<TextMesh> ().font = curFont;
        //      newWord.GetComponent<Renderer> ().sharedMaterial = curFont.material;
        //  }
        wordCount++;
        count++;
    }