예제 #1
0
        public acegiak_Song ChooseSong(GameObject who)
        {
            acegiak_SongBook part2 = who.GetPart <acegiak_SongBook>();

            if (!who.IsPlayer())
            {
                return(part2.Songs.GetRandomElement());
            }

            //IPart.AddPlayerMessage(part2.ToString());
            List <acegiak_Song> ObjectChoices = new List <acegiak_Song>();
            List <string>       ChoiceList    = new List <string>();
            List <char>         HotkeyList    = new List <char>();
            char ch = 'a';

            if (part2 == null || part2.Songs.Count <= 0)
            {
                Popup.Show(who.The + who.DisplayNameOnly + who.GetVerb("doesn't") + " know any songs");
                return(null);
            }
            foreach (acegiak_Song song in part2.Songs)
            {
                ObjectChoices.Add(song);
                HotkeyList.Add(ch);
                ChoiceList.Add(song.Name);
                ch = (char)(ch + 1);
            }
            if (ObjectChoices.Count == 0)
            {
                Popup.Show(who.The + who.DisplayNameOnly + who.GetVerb("doesn't") + " know any songs");
                return(null);
            }
            int num12 = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "Select a song to play.", 60, bRespectOptionNewlines: false, bAllowEscape: true);

            if (num12 < 0)
            {
                return(null);
            }
            return(ObjectChoices[num12]);
        }
예제 #2
0
        public void Compose(GameObject who)
        {
            List <UnityEngine.GameObject> GOs = new List <UnityEngine.GameObject>();

            foreach (string voice in SoundName.Split(';'))
            {
                string[] bits = voice.Split(':');

                UnityEngine.GameObject gameObject;
                gameObject = new UnityEngine.GameObject();
                gameObject.transform.position = new Vector3(0f, 0f, 1f);
                gameObject.name = "MusicPlayer";
                gameObject.AddComponent <acegiak_AudioSequencer>();
                gameObject.GetComponent <acegiak_AudioSequencer>().recordVoice = bits[0];
                if (bits.Length > 1)
                {
                    gameObject.GetComponent <acegiak_AudioSequencer>().recordVolume = Int32.Parse(bits[1]) / 100f;
                }
                UnityEngine.Object.DontDestroyOnLoad(gameObject);

                GOs.Add(gameObject);
            }

            foreach (UnityEngine.GameObject GO in GOs)
            {
                acegiak_AudioSequencer component = GO.GetComponent <acegiak_AudioSequencer>();
                component.Record();
            }
            Popup.AskString("Play with 0-9", "", 300);

            // acegiak_ScreenBufferMaker p = delegate(ScreenBuffer sb, int charcode)
            //  {
            //      ConsoleChar c = new ConsoleChar();
            //      c.Tile = "Tiles/sw_box.bmp";
            //      sb[1,1] = c;
            //      ConsoleChar f = new ConsoleChar();
            //      f.Tile = "Tiles/sw_box.bmp";
            //      sb[3,3] = f;
            //      //IPart.AddPlayerMessage("Boxy?");
            //      return sb;
            //  };
            // acegiak_CustomPopup.CustomRender(p,20,10);

            if (XRLCore.Core.Game.Player.Body.HasSkill("acegiak_Customs_Music"))
            {
                string songname = Popup.AskString("Name this song. (leave blank to forget)", "", 140);
                if (songname != null && songname.Length > 0)
                {
                    acegiak_SongBook book = who.GetPart <acegiak_SongBook>();
                    if (book == null)
                    {
                        Popup.Show(who.The + who.DisplayNameOnly + " can't remember songs.");
                    }
                    else
                    {
                        acegiak_Song song = new acegiak_Song();
                        song.Name  = songname;
                        song.Notes = GOs[0].GetComponent <acegiak_AudioSequencer>().Print();
                        book.Songs.Add(song);

                        JournalAPI.AddAccomplishment("You wrote a song: " + song.Name);
                        JournalAPI.AddObservation(song.Name, song.Name, "Songs", null, null, true);
                    }
                }
            }

            who.FireEvent(Event.New("PlayedSong", "Object", ParentObject));
        }