コード例 #1
0
 public void PlaySoundSample(
     ushort number, SoundAction action, byte volume,
     byte repeats, SoundFinishedCallback callback
     )
 {
     // nada
 }
コード例 #2
0
    // Update is called once per frame


    public void AddSingleSound(CollectibleBehavior src)
    {
        if (isPlaying)
        {
            return;
        }
        if (isRecordingSolo)
        {
            return;
        }

        Sound s;

        s.timeStamp     = 0;
        s.audioClip     = src.m_audioSource.clip;
        s.lengthInBeats = src.lengthInBeats;

        SoundAction a = new SoundAction();

        a.type        = 0;
        a.singleSound = s;

        composition.Add(a);
        Debug.Log("Stored a single sound");
    }
コード例 #3
0
 public AudioClipPlayback(BaseEvent ef, Environment environment)
 {
     this.ef          = ef;
     this.environment = environment;
     soundAction      = (SoundAction)ef.ShowAction();
     Play();
 }
コード例 #4
0
        public void SoundOutput(SoundType type, SoundAction action)
        {
            foreach (Sound s in sounds)
            {
                if (s.name == type)
                {
                    switch (action)
                    {
                    case SoundAction.Play:
                        if (!s.source.isPlaying)
                        {
                            s.source.Play();
                        }
                        break;

                    case SoundAction.Stop:
                        if (s.source.isPlaying)
                        {
                            s.source.Pause();
                            s.source.Stop();
                        }
                        break;
                    }
                }
            }
        }
コード例 #5
0
ファイル: SoundController.cs プロジェクト: zhalexey/Tetris2d
    //------------------------------------------------------

    public void PlaySound(SoundAction action)
    {
        if (!isSoundOn)
        {
            return;
        }

        switch (action)
        {
        case SoundAction.Rotate:
            gameSoundAudioSource.clip = rotateSound;
            break;

        case SoundAction.Falling:
            gameSoundAudioSource.clip = fallingSound;
            break;

        case SoundAction.BurnLine:
            gameSoundAudioSource.clip = burnLineSound;
            break;

        case SoundAction.CountCoin:
            gameSoundAudioSource.clip = countCoinSound;
            break;

        case SoundAction.MenuBtnHover:
            gameSoundAudioSource.clip = menuBtnHoverSound;
            break;

        case SoundAction.MenuBtnClick:
            gameSoundAudioSource.clip = menuBtnClickSound;
            break;
        }
        gameSoundAudioSource.PlayOneShot(gameSoundAudioSource.clip);
    }
コード例 #6
0
 public void DoMusic(SoundAction soundAction)
 {
     switch (soundAction) {
         case SoundAction.Play: musicAS.Play(); break;
         case SoundAction.Pause: musicAS.Pause(); break;
         case SoundAction.Stop: musicAS.Stop(); break;
     }
 }
コード例 #7
0
ファイル: TeeFilter.cs プロジェクト: hackerlank/zlr
        public override void PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats, SoundFinishedCallback callback)
        {
            if (PassSound)
            {
                side.PlaySoundSample(number, action, volume, repeats, callback);
            }

            base.PlaySoundSample(number, action, volume, repeats, callback);
        }
コード例 #8
0
        public void DoMusic(SoundAction soundAction)
        {
            switch (soundAction)
            {
            case SoundAction.Play: musicAS.Play(); break;

            case SoundAction.Pause: musicAS.Pause(); break;

            case SoundAction.Stop: musicAS.Stop(); break;
            }
        }
コード例 #9
0
    IList <GameState> GetScene1List()
    {
        // Initialization
        GameObject patient = GameObject.Find("patient");

        SoundManager.Instance.addSound(new Sound("Assets/Sounds/phoneRinging.mp3", "phoneRinging"));

        SoundAction phoneRing   = new SoundAction("phoneRinging", true);
        GameState   scene1Start = new GameState(
            "scene1Start",
            new Dictionary <Trigger, string>()
        {
            { new ShakeTrigger(), "scene1Phone" }
        },
            new ParallelAction(new FadeAction(true), phoneRing)
            );
        GameState scene1Phone = new GameState(
            "scene1Phone",
            new Dictionary <Trigger, string>()
        {
            { new StareTrigger("phone"), "scene1Monologue" }
        },
            new FadeAction(false)
            );

        GameState scene1Monologue = new GameState(
            "scene1Monologue",
            new Dictionary <Trigger, string>()
        {
            { new MainActionFinishedTrigger(), "hallucination" }
        },
            new SequentialAction(
                new DialogAction("Mother: Honey, I just wanted to call to see if you’re all right."),
                new DialogAction("Mother: The doctor says you’ll make a full recovery from your accident, but he won’t tell me what happened..."),
                new DialogAction("Mother: He said the same last time, too."),
                new DialogAction("Mother: Do you know how I feel when you go missing?"),
                new DialogAction("Mother: Dad is- I- I know we don’t agree, but you can’t keep running away!"),
                new DialogAction("Every time!"),
                new DialogAction("Mother: If we always disagree (about cloning), why do you bring it up!"),
                new DialogAction("Mother: ... "),
                new DialogAction("Mother: No, that’s not why I called… I just need to know if you’re okay."),
                new DialogAction("Mother: The doctor says you’ll be awake the next time Dad and I’ll visit, so get plenty of rest."),
                new DialogAction("Mother: We'll see you soon")
                ),
            phoneRing
            );

        return(new List <GameState> ()
        {
            scene1Start,
            scene1Phone,
            scene1Monologue
        });
    }
コード例 #10
0
ファイル: ActionSound.cs プロジェクト: Keraunic-Tonic/GJ2021
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI("Sound object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID  = 0;
                soundObject = null;
            }
            else
            {
                soundObject = (Sound)EditorGUILayout.ObjectField("Sound object:", soundObject, typeof(Sound), true);

                constantID  = FieldToID <Sound> (soundObject, constantID);
                soundObject = IDToField <Sound> (soundObject, constantID, false);
            }

            soundAction = (SoundAction)EditorGUILayout.EnumPopup("Sound action:", (SoundAction)soundAction);

            if (soundAction == SoundAction.Play || soundAction == SoundAction.FadeIn)
            {
                loop            = EditorGUILayout.Toggle("Loop?", loop);
                ignoreIfPlaying = EditorGUILayout.Toggle("Ignore if already playing?", ignoreIfPlaying);

                audioClipParameterID = Action.ChooseParameterGUI("New clip (optional):", parameters, audioClipParameterID, ParameterType.UnityObject);
                if (audioClipParameterID < 0)
                {
                    audioClip = (AudioClip)EditorGUILayout.ObjectField("New clip (optional):", audioClip, typeof(AudioClip), false);
                }

                if (soundObject != null && soundObject.soundType == SoundType.Music)
                {
                    autoEndOtherMusicWhenPlayed = EditorGUILayout.Toggle("Auto-end other music?", autoEndOtherMusicWhenPlayed);
                }
            }

            if (soundAction == SoundAction.FadeIn || soundAction == SoundAction.FadeOut)
            {
                fadeTime = EditorGUILayout.Slider("Fade time:", fadeTime, 0f, 10f);
            }

            if (soundAction == SoundAction.Stop)
            {
                affectChildren = EditorGUILayout.Toggle("Stop child Sounds, too?", affectChildren);
            }
            else
            {
                if (soundAction == SoundAction.FadeOut || !loop)
                {
                    willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
                }
            }

            AfterRunningOption();
        }
コード例 #11
0
        private async void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            await this.window.RunAsyncOperation(async() =>
            {
                StoreDetailListingModel listingDetails = await ChannelSession.Services.MixItUpService.GetStoreListing(this.currentListing.ID);
                await ChannelSession.Services.MixItUpService.AddStoreListingDownload(this.currentListing);

                List <ActionBase> actions = listingDetails.GetActions();

                StoreCommandUpgrader.PerformUpgrades(actions, listingDetails.AppVersion);

                if (listingDetails.AssetsIncluded && listingDetails.AssetData != null && listingDetails.AssetData.Length > 0)
                {
                    if (await MessageBoxHelper.ShowConfirmationDialog("This command contains included assets." + Environment.NewLine + "Would you like to download them?"))
                    {
                        string folderLocation = ChannelSession.Services.FileService.ShowOpenFolderDialog();
                        if (!string.IsNullOrEmpty(folderLocation))
                        {
                            string zipFilePath = Path.Combine(ChannelSession.Services.FileService.GetTempFolder(), listingDetails.ID.ToString() + ".zip");
                            await ChannelSession.Services.FileService.SaveFileAsBytes(zipFilePath, listingDetails.AssetData);
                            await ChannelSession.Services.FileService.UnzipFiles(zipFilePath, folderLocation);

                            IEnumerable <string> assetFileNames = (await ChannelSession.Services.FileService.GetFilesInDirectory(folderLocation)).Select(s => Path.GetFileName(s));
                            foreach (ActionBase action in actions)
                            {
                                if (action.Type == ActionTypeEnum.Overlay)
                                {
                                    OverlayAction oAction = (OverlayAction)action;
                                    if (oAction.Effect is OverlayImageEffect)
                                    {
                                        OverlayImageEffect iEffect = (OverlayImageEffect)oAction.Effect;
                                        if (assetFileNames.Contains(Path.GetFileName(iEffect.FilePath)))
                                        {
                                            iEffect.FilePath = Path.Combine(folderLocation, Path.GetFileName(iEffect.FilePath));
                                        }
                                    }
                                }
                                else if (action.Type == ActionTypeEnum.Sound)
                                {
                                    SoundAction sAction = (SoundAction)action;
                                    if (assetFileNames.Contains(Path.GetFileName(sAction.FilePath)))
                                    {
                                        sAction.FilePath = Path.Combine(folderLocation, Path.GetFileName(sAction.FilePath));
                                    }
                                }
                            }
                        }
                    }
                }

                this.window.DownloadCommandFromStore(listingDetails.ID, actions);
            });
        }
コード例 #12
0
    IEnumerator PlaySolo(SoundAction a)
    {
        Debug.Log("Playing Solo");
        float offset = a.startTime;
        int   count  = a.solo.Count;

        for (int i = 0; i < count; i++)
        {
            PlayInAvailableSpeaker(a.solo[i].audioClip, true);
            if (i != count - 1)
            {
                yield return(new WaitForSeconds(a.solo[i + 1].timeStamp - a.solo[i].timeStamp));
            }
        }
    }
コード例 #13
0
	IList<GameState> GetScene1List() {
		// Initialization
		GameObject patient = GameObject.Find ("patient");
		SoundManager.Instance.addSound (new Sound ("Assets/Sounds/phoneRinging.mp3", "phoneRinging"));

		SoundAction phoneRing = new SoundAction ("phoneRinging", true);
		GameState scene1Start = new GameState (
			"scene1Start",
			new Dictionary<Trigger, string>() {
			{new ShakeTrigger(), "scene1Phone"}
			},
			new ParallelAction(new FadeAction(true), phoneRing)
		);
		GameState scene1Phone = new GameState (
			"scene1Phone",
			new Dictionary<Trigger, string>() {
			{new StareTrigger("phone"), "scene1Monologue"}
			},
			new FadeAction(false)
		);

		GameState scene1Monologue = new GameState (
			"scene1Monologue",
			new Dictionary<Trigger, string>() {
			{new MainActionFinishedTrigger(), "hallucination"}
			},
			new SequentialAction(
			new DialogAction("Mother: Honey, I just wanted to call to see if you’re all right."),
			new DialogAction("Mother: The doctor says you’ll make a full recovery from your accident, but he won’t tell me what happened..."),
			new DialogAction("Mother: He said the same last time, too."),
			new DialogAction("Mother: Do you know how I feel when you go missing?"),
			new DialogAction("Mother: Dad is- I- I know we don’t agree, but you can’t keep running away!"),
			new DialogAction("Every time!"),
			new DialogAction("Mother: If we always disagree (about cloning), why do you bring it up!"),
			new DialogAction("Mother: ... "),
			new DialogAction("Mother: No, that’s not why I called… I just need to know if you’re okay."),
			new DialogAction("Mother: The doctor says you’ll be awake the next time Dad and I’ll visit, so get plenty of rest."),
			new DialogAction("Mother: We'll see you soon")
			),
			phoneRing
		);

		return new List<GameState> () {
			scene1Start,
			scene1Phone,
			scene1Monologue
		};
	}
コード例 #14
0
    public void StartSoloRecording()
    {
        if (isRecordingSolo)
        {
            return;
        }
        isRecordingSolo = true;

        SoundAction a = new SoundAction();

        a.type      = 1;
        a.solo      = new List <Sound>();
        a.startTime = Time.time;
        currentSolo = a;

        Debug.Log("Started a solo");
    }
コード例 #15
0
ファイル: SoundTester.cs プロジェクト: boyP/Patient
	// Update is called once per frame
	void Update () {
		if (!started) {
			Debug.Log ("creating new sound action");
			ActionRunner soundAction = new SoundAction ("chatter", false);
			ActionRunner soundAction2 = new SoundAction("happy", false);
			IList<ActionRunner> list = new List<ActionRunner> ();
			list.Add (soundAction);
			list.Add (soundAction2);
			ActionRunner parAction = new ParallelAction(list);
			list = new List<ActionRunner> ();
			list.Add (parAction);
			list.Add (parAction);
			ActionRunner seqAction = new SequentialAction(list);
			seqAction.Start ();
			started = true;
		}
	
	}
コード例 #16
0
ファイル: SoundTester.cs プロジェクト: boyP/Patient
 // Update is called once per frame
 void Update()
 {
     if (!started)
     {
         Debug.Log("creating new sound action");
         ActionRunner         soundAction  = new SoundAction("chatter", false);
         ActionRunner         soundAction2 = new SoundAction("happy", false);
         IList <ActionRunner> list         = new List <ActionRunner> ();
         list.Add(soundAction);
         list.Add(soundAction2);
         ActionRunner parAction = new ParallelAction(list);
         list = new List <ActionRunner> ();
         list.Add(parAction);
         list.Add(parAction);
         ActionRunner seqAction = new SequentialAction(list);
         seqAction.Start();
         started = true;
     }
 }
コード例 #17
0
    override public void ShowGUI()
    {
        soundObject = (Sound)EditorGUILayout.ObjectField("Sound object:", soundObject, typeof(Sound), true);
        soundAction = (SoundAction)EditorGUILayout.EnumPopup("Sound action:", (SoundAction)soundAction);

        if (soundAction == SoundAction.Play || soundAction == SoundAction.FadeIn)
        {
            loop      = EditorGUILayout.Toggle("Loop?", loop);
            audioClip = (AudioClip)EditorGUILayout.ObjectField("New clip (optional)", audioClip, typeof(AudioClip), false);
        }

        if (soundAction == SoundAction.FadeIn || soundAction == SoundAction.FadeOut)
        {
            fadeTime = EditorGUILayout.Slider("Fade time:", fadeTime, 0f, 5f);
        }


        AfterRunningOption();
    }
コード例 #18
0
        internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("Sound"));

            IPDFObject sound = _dictionary["Sound"];

            if (sound != null)
            {
                dict.AddItem("Sound", sound);
            }

            string[] keys = { "Volume", "Synchronous", "Repeat", "Mix" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = _dictionary[keys[i]];
                if (obj != null)
                {
                    dict.AddItem(keys[i], obj.Clone());
                }
            }

            SoundAction action = new SoundAction(dict, owner);

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

            return(action);
        }
コード例 #19
0
ファイル: GlkIO.cs プロジェクト: hackerlank/zlr
        void IZMachineIO.PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats,
                                         SoundFinishedCallback callback)
        {
            switch (action)
            {
            case SoundAction.Prepare:
                Glk.glk_sound_load_hint(number, true);
                break;

            case SoundAction.FinishWith:
                Glk.glk_sound_load_hint(number, false);
                break;

            case SoundAction.Start:
                if (soundChannel.IsNull)
                {
                    soundChannel = Glk.glk_schannel_create(0);
                }

                if (!soundChannel.IsNull)
                {
                    volume = Math.Min(volume, (byte)8);
                    Glk.glk_schannel_set_volume(soundChannel, (uint)(volume << 13));
                    soundCallback = callback;
                    Glk.glk_schannel_play_ext(soundChannel, number, repeats, 1);
                }
                break;

            case SoundAction.Stop:
                if (!soundChannel.IsNull)
                {
                    Glk.glk_schannel_stop(soundChannel);
                    soundChannel  = schanid_t.Null;
                    soundCallback = null;
                }
                break;
            }
        }
コード例 #20
0
ファイル: ActionSound.cs プロジェクト: mcbodge/eidolon
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI("Sound object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID  = 0;
                soundObject = null;
            }
            else
            {
                soundObject = (Sound)EditorGUILayout.ObjectField("Sound object:", soundObject, typeof(Sound), true);

                constantID  = FieldToID <Sound> (soundObject, constantID);
                soundObject = IDToField <Sound> (soundObject, constantID, false);
            }

            soundAction = (SoundAction)EditorGUILayout.EnumPopup("Sound action:", (SoundAction)soundAction);

            if (soundAction == SoundAction.Play || soundAction == SoundAction.FadeIn)
            {
                loop            = EditorGUILayout.Toggle("Loop?", loop);
                ignoreIfPlaying = EditorGUILayout.Toggle("Ignore if already playing?", ignoreIfPlaying);
                audioClip       = (AudioClip)EditorGUILayout.ObjectField("New clip (optional)", audioClip, typeof(AudioClip), false);
            }

            if (soundAction == SoundAction.FadeIn || soundAction == SoundAction.FadeOut)
            {
                fadeTime = EditorGUILayout.Slider("Fade time:", fadeTime, 0f, 10f);
            }

            if (soundAction == SoundAction.Stop)
            {
                affectChildren = EditorGUILayout.Toggle("Stop child Sounds, too?", affectChildren);
            }

            AfterRunningOption();
        }
コード例 #21
0
ファイル: SoundEventArgs.cs プロジェクト: ywjno/mynes-code
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="action"></param>
 public SoundEventArgs(SoundAction action)
 {
     this.action = action;
 }
コード例 #22
0
ファイル: SoundEventArgs.cs プロジェクト: ywjno/mynes-code
 /// <summary>
 /// SoundEventsArgs describe the action to take on a Sound
 /// </summary>
 /// <param name="action">Stop or Fade out</param>
 /// <param name="fadeoutTime">time to faseout</param>
 public SoundEventArgs(SoundAction action, int fadeoutTime)
 {
     this.action = action;
     this.fadeoutTime = fadeoutTime;
 }
コード例 #23
0
ファイル: FilterBase.cs プロジェクト: dbremner/zlr
 public virtual void PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats, SoundFinishedCallback callback)
 {
     next.PlaySoundSample(number, action, volume, repeats, callback);
 }
コード例 #24
0
        /// <summary>
        /// Plays the sound.
        /// </summary>
        /// <param name="sound">The sound.</param>
        public void PlaySound(SoundAction sound)
        {
            using (var soundPlayer = new SoundPlayer())
            {
                switch (sound)
                {
                case SoundAction.FirstKey:
                    if (FirstKeySound == null)
                    {
                        throw new NullReferenceException($"{nameof(FirstKeySound)} is null");
                    }
                    FirstKeySound.Position = 0;
                    soundPlayer.Stream     = FirstKeySound;
                    soundPlayer.Play();
                    break;

                case SoundAction.SecondKey:
                    if (SecondKeySound == null)
                    {
                        throw new NullReferenceException($"{nameof(SecondKeySound)} is null");
                    }
                    SecondKeySound.Position = 0;
                    soundPlayer.Stream      = SecondKeySound;
                    soundPlayer.Play();
                    break;

                case SoundAction.ThirdKey:
                    if (ThirdKeySound == null)
                    {
                        throw new NullReferenceException($"{nameof(ThirdKeySound)} is null");
                    }
                    ThirdKeySound.Position = 0;
                    soundPlayer.Stream     = ThirdKeySound;
                    soundPlayer.Play();
                    break;

                case SoundAction.Shift:
                    if (ShiftActionSound == null)
                    {
                        throw new NullReferenceException($"{nameof(ShiftActionSound)} is null");
                    }
                    ShiftActionSound.Position = 0;
                    soundPlayer.Stream        = ShiftActionSound;
                    soundPlayer.Play();
                    break;

                case SoundAction.Crtl:
                    if (CrtlActionSound == null)
                    {
                        throw new NullReferenceException($"{nameof(CrtlActionSound)} is null");
                    }
                    CrtlActionSound.Position = 0;
                    soundPlayer.Stream       = CrtlActionSound;
                    soundPlayer.Play();
                    break;

                case SoundAction.Alt:
                    if (AltActionSound == null)
                    {
                        throw new NullReferenceException($"{nameof(AltActionSound)} is null");
                    }
                    AltActionSound.Position = 0;
                    soundPlayer.Stream      = AltActionSound;
                    soundPlayer.Play();
                    break;

                case SoundAction.Win:
                    if (WinActionSound == null)
                    {
                        throw new NullReferenceException($"{nameof(WinActionSound)} is null");
                    }
                    WinActionSound.Position = 0;
                    soundPlayer.Stream      = WinActionSound;
                    soundPlayer.Play();
                    break;
                }
            }
        }
コード例 #25
0
ファイル: AudioContext.cs プロジェクト: AreonDev/NoWayOut
 public SoundSourceDescription(Source source, SoundAction sa, Entity entity = null)
 {
     Entity = entity;
     SoundSource = source;
     SoundAction = sa;
 }
コード例 #26
0
ファイル: ActionSound.cs プロジェクト: farreltr/OneLastSunset
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI ("Sound object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID = 0;
                soundObject = null;
            }
            else
            {
                soundObject = (Sound) EditorGUILayout.ObjectField ("Sound object:", soundObject, typeof(Sound), true);

                constantID = FieldToID <Sound> (soundObject, constantID);
                soundObject = IDToField <Sound> (soundObject, constantID, false);
            }

            soundAction = (SoundAction) EditorGUILayout.EnumPopup ("Sound action:", (SoundAction) soundAction);

            if (soundAction == SoundAction.Play || soundAction == SoundAction.FadeIn)
            {
                loop = EditorGUILayout.Toggle ("Loop?", loop);
                ignoreIfPlaying = EditorGUILayout.Toggle ("Ignore if already playing?", ignoreIfPlaying);
                audioClip = (AudioClip) EditorGUILayout.ObjectField ("New clip (optional)", audioClip, typeof (AudioClip), false);
            }

            if (soundAction == SoundAction.FadeIn || soundAction == SoundAction.FadeOut)
            {
                fadeTime = EditorGUILayout.Slider ("Fade time:", fadeTime, 0f, 10f);
            }

            if (soundAction == SoundAction.Stop)
            {
                affectChildren = EditorGUILayout.Toggle ("Stop child Sounds, too?", affectChildren);
            }

            AfterRunningOption ();
        }
コード例 #27
0
ファイル: FilterBase.cs プロジェクト: hackerlank/zlr
 public virtual void PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats, SoundFinishedCallback callback)
 {
     next.PlaySoundSample(number, action, volume, repeats, callback);
 }
コード例 #28
0
        private async void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            await this.window.RunAsyncOperation(async() =>
            {
                StoreDetailListingModel listingDetails = await ChannelSession.Services.MixItUpService.GetStoreListing(this.currentListing.ID);
                if (listingDetails == null)
                {
                    await MessageBoxHelper.ShowMessageDialog("Failed to download command, please try again");
                    return;
                }

                Version assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;

                Version commandVersion = new Version(listingDetails.AppVersion);
                if (assemblyVersion < commandVersion)
                {
                    await MessageBoxHelper.ShowMessageDialog(string.Format("You can not download this command as it was created on version ({0}) of Mix It Up ", commandVersion));
                    return;
                }

                await ChannelSession.Services.MixItUpService.AddStoreListingDownload(listingDetails);

                List <ActionBase> actions = listingDetails.GetActions();

                StoreCommandUpgrader.PerformUpgrades(actions, listingDetails.AppVersion);

                if (listingDetails.AssetsIncluded && listingDetails.AssetData != null && listingDetails.AssetData.Length > 0)
                {
                    if (await MessageBoxHelper.ShowConfirmationDialog("This command contains included assets." + Environment.NewLine + "Would you like to download them?"))
                    {
                        string folderLocation = ChannelSession.Services.FileService.ShowOpenFolderDialog();
                        if (!string.IsNullOrEmpty(folderLocation))
                        {
                            string zipFilePath = Path.Combine(ChannelSession.Services.FileService.GetTempFolder(), listingDetails.ID.ToString() + ".zip");
                            await ChannelSession.Services.FileService.SaveFileAsBytes(zipFilePath, listingDetails.AssetData);
                            await ChannelSession.Services.FileService.UnzipFiles(zipFilePath, folderLocation);

                            IEnumerable <string> assetFileNames = (await ChannelSession.Services.FileService.GetFilesInDirectory(folderLocation)).Select(s => Path.GetFileName(s));
                            foreach (ActionBase action in actions)
                            {
                                if (action.Type == ActionTypeEnum.Overlay)
                                {
                                    OverlayAction oAction = (OverlayAction)action;
                                    if (oAction.Item is OverlayImageItem)
                                    {
                                        OverlayImageItem overlayItem = (OverlayImageItem)oAction.Item;
                                        if (assetFileNames.Contains(Path.GetFileName(overlayItem.FilePath)))
                                        {
                                            overlayItem.FilePath = Path.Combine(folderLocation, Path.GetFileName(overlayItem.FilePath));
                                        }
                                    }
                                }
                                else if (action.Type == ActionTypeEnum.Sound)
                                {
                                    SoundAction sAction = (SoundAction)action;
                                    if (assetFileNames.Contains(Path.GetFileName(sAction.FilePath)))
                                    {
                                        sAction.FilePath = Path.Combine(folderLocation, Path.GetFileName(sAction.FilePath));
                                    }
                                }
                            }
                        }
                    }
                }

                this.window.DownloadCommandFromStore(listingDetails.ID, actions);
            });
        }
コード例 #29
0
ファイル: NoSoundFilter.cs プロジェクト: dbremner/zlr
 public override void PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats, SoundFinishedCallback callback)
 {
     // nada
 }
コード例 #30
0
ファイル: ConsoleIO.cs プロジェクト: dbremner/zlr
 public void PlaySoundSample(ushort num, SoundAction action, byte volume, byte repeats,
     SoundFinishedCallback callback)
 {
     // not supported
 }
コード例 #31
0
 private void HandleShapeAndSound(SoundService soundService, ShapeAndSoundTuple shapeAndSound, SoundAction soundAction, LongSoundOwner longSoundOwner)
 {
     if (shapeAndSound != null)
     {
         if (shapeAndSound.Shape != null && !this._BabyShapes.Components.Contains(shapeAndSound.Shape))
         {
             this._BabyShapes.Components.Add(shapeAndSound.Shape);
         }
         if (shapeAndSound.Sound != null)
         {
             if (soundAction == SoundAction.Button)
             {
                 soundService.TryPlaySoundButton(shapeAndSound.Sound);
             }
             else if (soundAction == SoundAction.Analogue)
             {
                 soundService.TryPlaySoundLong(shapeAndSound.Sound, longSoundOwner);
             }
             else if (soundAction == SoundAction.ForceButton)
             {
                 soundService.ForcePlaySoundButton(shapeAndSound.Sound);
             }
             else if (soundAction == SoundAction.ForceAnalogue)
             {
                 soundService.TryPlaySoundLong(shapeAndSound.Sound, longSoundOwner);
             }
             else
             {
                 throw new ApplicationException("Forgot a soundType.");
             }
         }
     }
 }
コード例 #32
0
 private void HandleShapeAndSound(SoundService soundService, ShapeAndSoundTuple shapeAndSound, SoundAction soundAction)
 {
     this.HandleShapeAndSound(soundService, shapeAndSound, soundAction, LongSoundOwner.None);
 }
コード例 #33
0
        private async Task FinalizeNewUser()
        {
            if (this.scorpBotData != null)
            {
                // Import Ranks
                int    rankEnabled   = int.Parse(this.scorpBotData.GetSettingsValue("currency", "enabled", "0"));
                string rankName      = this.scorpBotData.GetSettingsValue("currency", "name", "Rank");
                int    rankInterval  = int.Parse(this.scorpBotData.GetSettingsValue("currency", "onlinepayinterval", "0"));
                int    rankAmount    = int.Parse(this.scorpBotData.GetSettingsValue("currency", "activeuserbonus", "0"));
                int    rankMaxAmount = int.Parse(this.scorpBotData.GetSettingsValue("currency", "maxlimit", "-1"));
                if (rankMaxAmount <= 0)
                {
                    rankMaxAmount = int.MaxValue;
                }
                int    rankOnFollowBonus    = int.Parse(this.scorpBotData.GetSettingsValue("currency", "onfollowbonus", "0"));
                int    rankOnSubBonus       = int.Parse(this.scorpBotData.GetSettingsValue("currency", "onsubbonus", "0"));
                int    rankSubBonus         = int.Parse(this.scorpBotData.GetSettingsValue("currency", "subbonus", "0"));
                string rankCommand          = this.scorpBotData.GetSettingsValue("currency", "command", "");
                string rankCommandResponse  = this.scorpBotData.GetSettingsValue("currency", "response", "");
                string rankUpCommand        = this.scorpBotData.GetSettingsValue("currency", "Currency1RankUpMsg", "");
                int    rankAccumulationType = int.Parse(this.scorpBotData.GetSettingsValue("currency", "ranksrectype", "0"));

                UserCurrencyViewModel rankCurrency       = null;
                UserCurrencyViewModel rankPointsCurrency = null;
                if (rankEnabled == 1 && !string.IsNullOrEmpty(rankName))
                {
                    if (rankAccumulationType == 1)
                    {
                        rankCurrency = new UserCurrencyViewModel()
                        {
                            Name = rankName.Equals("Points") ? "Hours" : rankName,
                            SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier(rankName.Equals("Points") ? "Hours" : rankName),
                            AcquireInterval   = 60,
                            AcquireAmount     = 1,
                            MaxAmount         = rankMaxAmount,
                        };

                        if (rankInterval >= 0 && rankAmount >= 0)
                        {
                            rankPointsCurrency = new UserCurrencyViewModel()
                            {
                                Name = "Points",
                                SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier("points"),
                                AcquireInterval   = rankInterval,
                                AcquireAmount     = rankAmount,
                                MaxAmount         = rankMaxAmount,
                                OnFollowBonus     = rankOnFollowBonus,
                                OnSubscribeBonus  = rankOnSubBonus,
                                SubscriberBonus   = rankSubBonus
                            };

                            ChannelSession.Settings.Currencies[rankPointsCurrency.ID] = rankPointsCurrency;
                        }
                    }
                    else if (rankInterval >= 0 && rankAmount >= 0)
                    {
                        rankCurrency = new UserCurrencyViewModel()
                        {
                            Name = rankName,
                            SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier(rankName),
                            AcquireInterval   = rankInterval,
                            AcquireAmount     = rankAmount,
                            MaxAmount         = rankMaxAmount,
                            OnFollowBonus     = rankOnFollowBonus,
                            OnSubscribeBonus  = rankOnSubBonus,
                            SubscriberBonus   = rankSubBonus
                        };
                    }
                }

                // Import Currency
                int    currencyEnabled   = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "enabled", "0"));
                string currencyName      = this.scorpBotData.GetSettingsValue("currency2", "name", "Currency");
                int    currencyInterval  = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "onlinepayinterval", "0"));
                int    currencyAmount    = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "activeuserbonus", "0"));
                int    currencyMaxAmount = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "maxlimit", "-1"));
                if (currencyMaxAmount <= 0)
                {
                    currencyMaxAmount = int.MaxValue;
                }
                int    currencyOnFollowBonus   = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "onfollowbonus", "0"));
                int    currencyOnSubBonus      = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "onsubbonus", "0"));
                int    currencySubBonus        = int.Parse(this.scorpBotData.GetSettingsValue("currency2", "subbonus", "0"));
                string currencyCommand         = this.scorpBotData.GetSettingsValue("currency2", "command", "");
                string currencyCommandResponse = this.scorpBotData.GetSettingsValue("currency2", "response", "");

                UserCurrencyViewModel currency = null;
                if (currencyEnabled == 1 && !string.IsNullOrEmpty(currencyName) && currencyInterval >= 0 && currencyAmount >= 0)
                {
                    currency = new UserCurrencyViewModel()
                    {
                        Name            = currencyName, SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier(currencyName), AcquireInterval = currencyInterval,
                        AcquireAmount   = currencyAmount, MaxAmount = currencyMaxAmount, OnFollowBonus = currencyOnFollowBonus, OnSubscribeBonus = currencyOnSubBonus,
                        SubscriberBonus = currencySubBonus
                    };
                    ChannelSession.Settings.Currencies[currency.ID] = currency;

                    if (!string.IsNullOrEmpty(currencyCommand) && !string.IsNullOrEmpty(currencyCommandResponse))
                    {
                        currencyCommandResponse = currencyCommandResponse.Replace("$points2", "$" + currency.UserAmountSpecialIdentifier);
                        currencyCommandResponse = currencyCommandResponse.Replace("$currencyname2", currency.Name);
                        this.scorpBotData.Commands.Add(new ScorpBotCommand(currencyCommand, currencyCommandResponse));
                    }
                }

                foreach (ScorpBotViewer viewer in this.scorpBotData.Viewers)
                {
                    ChannelSession.Settings.UserData[viewer.ID] = new UserDataViewModel(viewer);

                    if (rankPointsCurrency != null)
                    {
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(rankPointsCurrency, (int)viewer.RankPoints);
                    }

                    if (rankCurrency != null)
                    {
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(rankCurrency, (rankPointsCurrency != null) ? (int)viewer.Hours : (int)viewer.RankPoints);
                    }

                    if (currency != null)
                    {
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(currency, (int)viewer.Currency);
                    }
                }

                if (rankCurrency != null)
                {
                    ChannelSession.Settings.Currencies[rankCurrency.ID] = rankCurrency;

                    foreach (ScorpBotRank rank in this.scorpBotData.Ranks)
                    {
                        rankCurrency.Ranks.Add(new UserRankViewModel(rank.Name, rank.Amount));
                    }

                    if (!string.IsNullOrEmpty(rankCommand) && !string.IsNullOrEmpty(rankCommandResponse))
                    {
                        rankCommandResponse = rankCommandResponse.Replace(" / Raids: $raids", "");
                        rankCommandResponse = rankCommandResponse.Replace("$rank", "$" + rankCurrency.UserRankNameSpecialIdentifier);
                        rankCommandResponse = rankCommandResponse.Replace("$points", "$" + rankCurrency.UserAmountSpecialIdentifier);
                        rankCommandResponse = rankCommandResponse.Replace("$currencyname", rankCurrency.Name);
                        this.scorpBotData.Commands.Add(new ScorpBotCommand(rankCommand, rankCommandResponse));
                    }

                    if (!string.IsNullOrEmpty(rankUpCommand))
                    {
                        rankUpCommand = rankUpCommand.Replace("$rank", "$" + rankCurrency.UserRankNameSpecialIdentifier);
                        rankUpCommand = rankUpCommand.Replace("$points", "$" + rankCurrency.UserAmountSpecialIdentifier);
                        rankUpCommand = rankUpCommand.Replace("$currencyname", rankCurrency.Name);

                        ScorpBotCommand scorpCommand = new ScorpBotCommand("rankup", rankUpCommand);
                        ChatCommand     chatCommand  = new ChatCommand(scorpCommand);

                        rankCurrency.RankChangedCommand = new CustomCommand("User Rank Changed");
                        rankCurrency.RankChangedCommand.Actions.AddRange(chatCommand.Actions);
                    }
                }

                foreach (ScorpBotCommand command in this.scorpBotData.Commands)
                {
                    ChannelSession.Settings.ChatCommands.Add(new ChatCommand(command));
                }

                foreach (ScorpBotTimer timer in this.scorpBotData.Timers)
                {
                    ChannelSession.Settings.TimerCommands.Add(new TimerCommand(timer));
                }

                foreach (string quote in this.scorpBotData.Quotes)
                {
                    ChannelSession.Settings.UserQuotes.Add(new UserQuoteViewModel(quote));
                }

                if (ChannelSession.Settings.UserQuotes.Count > 0)
                {
                    ChannelSession.Settings.QuotesEnabled = true;
                }

                foreach (string bannedWord in this.scorpBotData.BannedWords)
                {
                    ChannelSession.Settings.BannedWords.Add(bannedWord);
                }
            }

            if (this.soundwaveData != null && this.soundwaveProfiles != null && this.soundwaveProfiles.Count(p => p.AddProfile) > 0)
            {
                if (this.soundwaveData.StaticCooldown)
                {
                    ChannelSession.Settings.InteractiveCooldownGroups.Add(SoundwaveInteractiveCooldownGroupName, this.soundwaveData.StaticCooldownAmount / 1000);
                }

                InteractiveGameListingModel soundwaveGame = this.interactiveGames.FirstOrDefault(g => g.name.Equals(SoundwaveInteractiveGameName));
                if (soundwaveGame != null)
                {
                    InteractiveGameVersionModel soundwaveGameVersion = await ChannelSession.Connection.GetInteractiveGameVersion(soundwaveGame.versions.First());

                    InteractiveSceneModel soundwaveGameScene = soundwaveGameVersion.controls.scenes.First();

                    foreach (string profile in this.soundwaveProfiles.Where(p => p.AddProfile).Select(p => p.Name))
                    {
                        // Add code logic to create Interactive Game on Mixer that is a copy of the Soundwave Interactive game, but with buttons filed in with name and not disabled
                        InteractiveSceneModel       profileScene = InteractiveGameHelper.CreateDefaultScene();
                        InteractiveGameListingModel profileGame  = await ChannelSession.Connection.CreateInteractiveGame(ChannelSession.Channel, ChannelSession.User, profile, profileScene);

                        InteractiveGameVersionModel gameVersion = profileGame.versions.FirstOrDefault();
                        if (gameVersion != null)
                        {
                            InteractiveGameVersionModel profileGameVersion = await ChannelSession.Connection.GetInteractiveGameVersion(gameVersion);

                            if (profileGameVersion != null)
                            {
                                profileScene = profileGameVersion.controls.scenes.First();

                                for (int i = 0; i < this.soundwaveData.Profiles[profile].Count(); i++)
                                {
                                    SoundwaveButton soundwaveButton = this.soundwaveData.Profiles[profile][i];
                                    InteractiveButtonControlModel soundwaveControl = (InteractiveButtonControlModel)soundwaveGameScene.allControls.FirstOrDefault(c => c.controlID.Equals(i.ToString()));

                                    InteractiveButtonControlModel button = InteractiveGameHelper.CreateButton(soundwaveButton.name, soundwaveButton.name, soundwaveButton.sparks);
                                    button.position = soundwaveControl.position;

                                    InteractiveCommand command = new InteractiveCommand(profileGame, profileScene, button, InteractiveButtonCommandTriggerType.MouseDown);
                                    command.IndividualCooldown = soundwaveButton.cooldown;
                                    if (this.soundwaveData.StaticCooldown)
                                    {
                                        command.CooldownGroup = SoundwaveInteractiveCooldownGroupName;
                                    }

                                    SoundAction action = new SoundAction(soundwaveButton.path, soundwaveButton.volume);
                                    command.Actions.Add(action);

                                    ChannelSession.Settings.InteractiveCommands.Add(command);
                                    profileScene.buttons.Add(button);
                                }

                                await ChannelSession.Connection.UpdateInteractiveGameVersion(profileGameVersion);
                            }
                        }
                    }
                }
            }

            await ChannelSession.SaveSettings();
        }
コード例 #34
0
 /// <summary>
 /// SoundEventsArgs describe the action to take on a Sound
 /// </summary>
 /// <param name="action">Stop or Fade out</param>
 /// <param name="fadeoutTime">time to faseout</param>
 public SoundEventArgs(SoundAction action, int fadeoutTime)
 {
     this.action      = action;
     this.fadeoutTime = fadeoutTime;
 }
コード例 #35
0
 IEnumerator PlaySolo(SoundAction a)
 {
     Debug.Log("Playing Solo");
     float offset = a.startTime;
     int count = a.solo.Count;
     for (int i = 0; i < count; i++)
     {
         PlayInAvailableSpeaker(a.solo[i].audioClip, true);
         if (i != count - 1)
             yield return new WaitForSeconds(a.solo[i+1].timeStamp - a.solo[i].timeStamp);
     }
 }
コード例 #36
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="action"></param>
 public SoundEventArgs(SoundAction action)
 {
     this.action = action;
 }
コード例 #37
0
        private async void UploadButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            await this.RunAsyncOperation(async() =>
            {
                if (string.IsNullOrEmpty(this.NameTextBox.Text))
                {
                    await MessageBoxHelper.ShowMessageDialog("A name must be specified");
                    return;
                }

                if (this.NameTextBox.Text.Length >= 50)
                {
                    await MessageBoxHelper.ShowMessageDialog("A name must be 50 characters or less");
                    return;
                }

                if (string.IsNullOrEmpty(this.DescriptionTextBox.Text))
                {
                    await MessageBoxHelper.ShowMessageDialog("A description must be specified");
                    return;
                }

                if (!string.IsNullOrEmpty(this.DisplayImagePathTextBox.Text))
                {
                    if (!File.Exists(this.DisplayImagePathTextBox.Text))
                    {
                        await MessageBoxHelper.ShowMessageDialog("The specified display image does not exist");
                        return;
                    }

                    FileInfo info = new FileInfo(this.DisplayImagePathTextBox.Text);
                    if (info.Length >= 1000000)
                    {
                        await MessageBoxHelper.ShowMessageDialog("Display image must be smaller than 1 MB");
                        return;
                    }
                }

                HashSet <string> tags = new HashSet <string>();
                if (this.Tag1ComboBox.SelectedIndex > 0)
                {
                    tags.Add(this.Tag1ComboBox.Text);
                }
                if (this.Tag2ComboBox.SelectedIndex > 0)
                {
                    tags.Add(this.Tag2ComboBox.Text);
                }
                if (this.Tag3ComboBox.SelectedIndex > 0)
                {
                    tags.Add(this.Tag3ComboBox.Text);
                }
                if (this.Tag4ComboBox.SelectedIndex > 0)
                {
                    tags.Add(this.Tag4ComboBox.Text);
                }
                if (this.Tag5ComboBox.SelectedIndex > 0)
                {
                    tags.Add(this.Tag5ComboBox.Text);
                }
                if (this.Tag6ComboBox.SelectedIndex > 0)
                {
                    tags.Add(this.Tag6ComboBox.Text);
                }

                if (tags.Count == 0)
                {
                    await MessageBoxHelper.ShowMessageDialog("At least 1 tag must be selected");
                    return;
                }

                JObject metadata = new JObject();

                byte[] displayImageData = null;
                if (!string.IsNullOrEmpty(this.DisplayImagePathTextBox.Text))
                {
                    displayImageData = await ChannelSession.Services.FileService.ReadFileAsBytes(this.DisplayImagePathTextBox.Text);
                }

                byte[] assetData = null;
                if (this.IncludeAssetsToggleButton.IsChecked.GetValueOrDefault())
                {
                    List <string> assetFiles = new List <string>();
                    foreach (ActionBase action in this.command.Actions)
                    {
                        if (action.Type == ActionTypeEnum.Overlay)
                        {
                            OverlayAction oAction = (OverlayAction)action;
                            if (oAction.Item is OverlayImageItem)
                            {
                                OverlayImageItem overlayItem = (OverlayImageItem)oAction.Item;
                                if (File.Exists(overlayItem.FilePath))
                                {
                                    assetFiles.Add(overlayItem.FilePath);
                                }
                            }
                        }
                        else if (action.Type == ActionTypeEnum.Sound)
                        {
                            SoundAction sAction = (SoundAction)action;
                            if (File.Exists(sAction.FilePath))
                            {
                                assetFiles.Add(sAction.FilePath);
                            }
                        }
                    }

                    if (assetFiles.Count > 0)
                    {
                        foreach (string assetFile in assetFiles)
                        {
                            FileInfo info = new FileInfo(assetFile);
                            if (info.Length >= 1000000)
                            {
                                await MessageBoxHelper.ShowMessageDialog("All asset files must be smaller than 1 MB");
                                return;
                            }
                        }

                        string zipFilePath = Path.Combine(ChannelSession.Services.FileService.GetTempFolder(), this.command.ID.ToString() + ".zip");
                        if (File.Exists(zipFilePath))
                        {
                            File.Delete(zipFilePath);
                        }
                        await ChannelSession.Services.FileService.ZipFiles(zipFilePath, assetFiles);
                        assetData = await ChannelSession.Services.FileService.ReadFileAsBytes(zipFilePath);
                    }
                }

                await ChannelSession.Services.MixItUpService.AddStoreListing(new StoreDetailListingModel(this.command, this.NameTextBox.Text, this.DescriptionTextBox.Text, tags,
                                                                                                         this.DisplayImagePathTextBox.Text, displayImageData, assetData, metadata));

                this.command.StoreID = this.command.ID;

                this.Close();
            });
        }
コード例 #38
0
 public SoundActionControl(ActionContainerControl containerControl, SoundAction action) : this(containerControl) { this.action = action; }
コード例 #39
0
 public SoundActionControl(SoundAction action) : this()
 {
     this.action = action;
 }
コード例 #40
0
    public void StartSoloRecording()
    {
        if (isRecordingSolo) return;
        isRecordingSolo = true;

        SoundAction a = new SoundAction();
        a.type = 1;
        a.solo = new List<Sound>();
        a.startTime = Time.time;
        currentSolo = a;

        Debug.Log("Started a solo");
    }
コード例 #41
0
ファイル: GlkIO.cs プロジェクト: KeanW/zlr--git
        void IZMachineIO.PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats,
            SoundFinishedCallback callback)
        {
            switch (action)
            {
                case SoundAction.Prepare:
                    Glk.glk_sound_load_hint(number, true);
                    break;

                case SoundAction.FinishWith:
                    Glk.glk_sound_load_hint(number, false);
                    break;

                case SoundAction.Start:
                    if (soundChannel.IsNull)
                        soundChannel = Glk.glk_schannel_create(0);

                    if (!soundChannel.IsNull)
                    {
                        volume = Math.Min(volume, (byte)8);
                        Glk.glk_schannel_set_volume(soundChannel, (uint)(volume << 13));
                        soundCallback = callback;
                        Glk.glk_schannel_play_ext(soundChannel, number, repeats, 1);
                    }
                    break;

                case SoundAction.Stop:
                    if (!soundChannel.IsNull)
                    {
                        Glk.glk_schannel_stop(soundChannel);
                        soundChannel = schanid_t.Null;
                        soundCallback = null;
                    }
                    break;
            }
        }
コード例 #42
0
    // Update is called once per frame
    public void AddSingleSound(CollectibleBehavior src)
    {
        if (isPlaying) return;
        if (isRecordingSolo) return;

        Sound s;
        s.timeStamp = 0;
        s.audioClip = src.m_audioSource.clip;
        s.lengthInBeats = src.lengthInBeats;

        SoundAction a = new SoundAction();
        a.type = 0;
        a.singleSound = s;

        composition.Add(a);
        Debug.Log("Stored a single sound");
    }
コード例 #43
0
        private async Task FinalizeNewUser()
        {
            if (this.scorpBotData != null)
            {
                // Import Ranks
                int    rankEnabled   = this.scorpBotData.GetIntSettingsValue("currency", "enabled");
                string rankName      = this.scorpBotData.GetSettingsValue("currency", "name", "Rank");
                int    rankInterval  = this.scorpBotData.GetIntSettingsValue("currency", "onlinepayinterval");
                int    rankAmount    = this.scorpBotData.GetIntSettingsValue("currency", "activeuserbonus");
                int    rankMaxAmount = this.scorpBotData.GetIntSettingsValue("currency", "maxlimit");
                if (rankMaxAmount <= 0)
                {
                    rankMaxAmount = int.MaxValue;
                }
                int    rankOnFollowBonus    = this.scorpBotData.GetIntSettingsValue("currency", "onfollowbonus");
                int    rankOnSubBonus       = this.scorpBotData.GetIntSettingsValue("currency", "onsubbonus");
                int    rankSubBonus         = this.scorpBotData.GetIntSettingsValue("currency", "subbonus");
                string rankCommand          = this.scorpBotData.GetSettingsValue("currency", "command", "");
                string rankCommandResponse  = this.scorpBotData.GetSettingsValue("currency", "response", "");
                string rankUpCommand        = this.scorpBotData.GetSettingsValue("currency", "Currency1RankUpMsg", "");
                int    rankAccumulationType = this.scorpBotData.GetIntSettingsValue("currency", "ranksrectype");

                UserCurrencyViewModel rankCurrency       = null;
                UserCurrencyViewModel rankPointsCurrency = null;
                if (!string.IsNullOrEmpty(rankName))
                {
                    if (rankAccumulationType == 1)
                    {
                        rankCurrency = new UserCurrencyViewModel()
                        {
                            Name = rankName.Equals("Points") ? "Hours" : rankName,
                            SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier(rankName.Equals("Points") ? "Hours" : rankName),
                            AcquireInterval   = 60,
                            AcquireAmount     = 1,
                            MaxAmount         = rankMaxAmount,
                        };

                        if (rankInterval >= 0 && rankAmount >= 0)
                        {
                            rankPointsCurrency = new UserCurrencyViewModel()
                            {
                                Name = "Points",
                                SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier("points"),
                                AcquireInterval   = rankInterval,
                                AcquireAmount     = rankAmount,
                                MaxAmount         = rankMaxAmount,
                                OnFollowBonus     = rankOnFollowBonus,
                                OnSubscribeBonus  = rankOnSubBonus,
                                SubscriberBonus   = rankSubBonus,
                                ModeratorBonus    = rankSubBonus
                            };

                            ChannelSession.Settings.Currencies[rankPointsCurrency.ID] = rankPointsCurrency;
                        }
                    }
                    else if (rankInterval >= 0 && rankAmount >= 0)
                    {
                        rankCurrency = new UserCurrencyViewModel()
                        {
                            Name = rankName,
                            SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier(rankName),
                            AcquireInterval   = rankInterval,
                            AcquireAmount     = rankAmount,
                            MaxAmount         = rankMaxAmount,
                            OnFollowBonus     = rankOnFollowBonus,
                            OnSubscribeBonus  = rankOnSubBonus,
                            SubscriberBonus   = rankSubBonus,
                            ModeratorBonus    = rankSubBonus
                        };
                    }
                }

                // Import Currency
                int    currencyEnabled   = this.scorpBotData.GetIntSettingsValue("currency2", "enabled");
                string currencyName      = this.scorpBotData.GetSettingsValue("currency2", "name", "Currency");
                int    currencyInterval  = this.scorpBotData.GetIntSettingsValue("currency2", "onlinepayinterval");
                int    currencyAmount    = this.scorpBotData.GetIntSettingsValue("currency2", "activeuserbonus");
                int    currencyMaxAmount = this.scorpBotData.GetIntSettingsValue("currency2", "maxlimit");
                if (currencyMaxAmount <= 0)
                {
                    currencyMaxAmount = int.MaxValue;
                }
                int    currencyOnFollowBonus   = this.scorpBotData.GetIntSettingsValue("currency2", "onfollowbonus");
                int    currencyOnSubBonus      = this.scorpBotData.GetIntSettingsValue("currency2", "onsubbonus");
                int    currencySubBonus        = this.scorpBotData.GetIntSettingsValue("currency2", "subbonus");
                string currencyCommand         = this.scorpBotData.GetSettingsValue("currency2", "command", "");
                string currencyCommandResponse = this.scorpBotData.GetSettingsValue("currency2", "response", "");

                UserCurrencyViewModel currency = null;
                if (!string.IsNullOrEmpty(currencyName) && currencyInterval >= 0 && currencyAmount >= 0)
                {
                    currency = new UserCurrencyViewModel()
                    {
                        Name          = currencyName, SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier(currencyName), AcquireInterval = currencyInterval,
                        AcquireAmount = currencyAmount, MaxAmount = currencyMaxAmount, OnFollowBonus = currencyOnFollowBonus, OnSubscribeBonus = currencyOnSubBonus,
                    };
                    ChannelSession.Settings.Currencies[currency.ID] = currency;

                    if (!string.IsNullOrEmpty(currencyCommand) && !string.IsNullOrEmpty(currencyCommandResponse))
                    {
                        currencyCommandResponse = currencyCommandResponse.Replace("$points2", "$" + currency.UserAmountSpecialIdentifier);
                        currencyCommandResponse = currencyCommandResponse.Replace("$currencyname2", currency.Name);
                        this.scorpBotData.Commands.Add(new ScorpBotCommand(currencyCommand, currencyCommandResponse));
                    }
                }

                foreach (ScorpBotViewer viewer in this.scorpBotData.Viewers)
                {
                    ChannelSession.Settings.UserData[viewer.ID] = new UserDataViewModel(viewer);

                    if (rankPointsCurrency != null)
                    {
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(rankPointsCurrency, (int)viewer.RankPoints);
                    }

                    if (rankCurrency != null)
                    {
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(rankCurrency, (rankPointsCurrency != null) ? (int)viewer.Hours : (int)viewer.RankPoints);
                    }

                    if (currency != null)
                    {
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(currency, (int)viewer.Currency);
                    }
                }

                if (rankCurrency != null)
                {
                    ChannelSession.Settings.Currencies[rankCurrency.ID] = rankCurrency;

                    foreach (ScorpBotRank rank in this.scorpBotData.Ranks)
                    {
                        rankCurrency.Ranks.Add(new UserRankViewModel(rank.Name, rank.Amount));
                    }

                    if (!string.IsNullOrEmpty(rankCommand) && !string.IsNullOrEmpty(rankCommandResponse))
                    {
                        rankCommandResponse = rankCommandResponse.Replace(" / Raids: $raids", "");
                        rankCommandResponse = rankCommandResponse.Replace("$rank", "$" + rankCurrency.UserRankNameSpecialIdentifier);
                        rankCommandResponse = rankCommandResponse.Replace("$points", "$" + rankCurrency.UserAmountSpecialIdentifier);
                        rankCommandResponse = rankCommandResponse.Replace("$currencyname", rankCurrency.Name);
                        this.scorpBotData.Commands.Add(new ScorpBotCommand(rankCommand, rankCommandResponse));
                    }

                    if (!string.IsNullOrEmpty(rankUpCommand))
                    {
                        rankUpCommand = rankUpCommand.Replace("$rank", "$" + rankCurrency.UserRankNameSpecialIdentifier);
                        rankUpCommand = rankUpCommand.Replace("$points", "$" + rankCurrency.UserAmountSpecialIdentifier);
                        rankUpCommand = rankUpCommand.Replace("$currencyname", rankCurrency.Name);

                        ScorpBotCommand scorpCommand = new ScorpBotCommand("rankup", rankUpCommand);
                        ChatCommand     chatCommand  = new ChatCommand(scorpCommand);

                        rankCurrency.RankChangedCommand = new CustomCommand("User Rank Changed");
                        rankCurrency.RankChangedCommand.Actions.AddRange(chatCommand.Actions);
                    }
                }

                foreach (ScorpBotCommand command in this.scorpBotData.Commands)
                {
                    command.ProcessData(currency, rankCurrency);
                    ChannelSession.Settings.ChatCommands.Add(new ChatCommand(command));
                }

                foreach (ScorpBotTimer timer in this.scorpBotData.Timers)
                {
                    ChannelSession.Settings.TimerCommands.Add(new TimerCommand(timer));
                }

                foreach (string quote in this.scorpBotData.Quotes)
                {
                    ChannelSession.Settings.UserQuotes.Add(new UserQuoteViewModel(quote));
                }

                if (ChannelSession.Settings.UserQuotes.Count > 0)
                {
                    ChannelSession.Settings.QuotesEnabled = true;
                }

                if (this.scorpBotData.GetBoolSettingsValue("settings", "filtwordsen"))
                {
                    foreach (string filteredWord in this.scorpBotData.FilteredWords)
                    {
                        ChannelSession.Settings.FilteredWords.Add(filteredWord);
                    }
                    ChannelSession.Settings.ModerationFilteredWordsExcempt = this.scorpBotData.GetUserRoleSettingsValue("settings", "FilteredWordsPerm");
                }

                if (this.scorpBotData.GetBoolSettingsValue("settings", "chatcapschecknowarnregs"))
                {
                    ChannelSession.Settings.ModerationChatTextExcempt = MixerRoleEnum.User;
                }
                else if (this.scorpBotData.GetBoolSettingsValue("settings", "chatcapschecknowarnsubs"))
                {
                    ChannelSession.Settings.ModerationChatTextExcempt = MixerRoleEnum.Subscriber;
                }
                else if (this.scorpBotData.GetBoolSettingsValue("settings", "chatcapschecknowarnmods"))
                {
                    ChannelSession.Settings.ModerationChatTextExcempt = MixerRoleEnum.Mod;
                }
                else
                {
                    ChannelSession.Settings.ModerationChatTextExcempt = MixerRoleEnum.Streamer;
                }

                ChannelSession.Settings.ModerationCapsBlockIsPercentage = !this.scorpBotData.GetBoolSettingsValue("settings", "chatcapsfiltertype");
                if (ChannelSession.Settings.ModerationCapsBlockIsPercentage)
                {
                    ChannelSession.Settings.ModerationCapsBlockCount = this.scorpBotData.GetIntSettingsValue("settings", "chatperccaps");
                }
                else
                {
                    ChannelSession.Settings.ModerationCapsBlockCount = this.scorpBotData.GetIntSettingsValue("settings", "chatmincaps");
                }

                ChannelSession.Settings.ModerationBlockLinks        = this.scorpBotData.GetBoolSettingsValue("settings", "chatlinkalertsdel");
                ChannelSession.Settings.ModerationBlockLinksExcempt = this.scorpBotData.GetUserRoleSettingsValue("settings", "chatlinkalertsdelperm");
            }

            if (this.streamlabsChatBotData != null)
            {
                UserCurrencyViewModel rank = new UserCurrencyViewModel()
                {
                    Name = "Rank",
                    SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier("rank"),
                    AcquireInterval   = 60,
                    AcquireAmount     = 1
                };

                foreach (StreamlabsChatBotRank slrank in this.streamlabsChatBotData.Ranks)
                {
                    rank.Ranks.Add(new UserRankViewModel(slrank.Name, slrank.Requirement));
                }

                UserCurrencyViewModel currency = new UserCurrencyViewModel()
                {
                    Name = "Points",
                    SpecialIdentifier = SpecialIdentifierStringBuilder.ConvertToSpecialIdentifier("points"),
                    AcquireInterval   = 1,
                    AcquireAmount     = 1
                };

                ChannelSession.Settings.Currencies[rank.ID]     = rank;
                ChannelSession.Settings.Currencies[currency.ID] = currency;

                this.AddCurrencyRankCommands(rank);
                this.AddCurrencyRankCommands(currency);

                foreach (StreamlabsChatBotViewer viewer in this.streamlabsChatBotData.Viewers)
                {
                    UserModel user = await ChannelSession.Connection.GetUser(viewer.Name);

                    if (user != null)
                    {
                        viewer.ID = user.id;
                        ChannelSession.Settings.UserData[viewer.ID] = new UserDataViewModel(viewer);
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(rank, viewer.Hours);
                        ChannelSession.Settings.UserData[viewer.ID].SetCurrencyAmount(currency, viewer.Points);
                    }
                }

                foreach (StreamlabsChatBotCommand command in this.streamlabsChatBotData.Commands)
                {
                    command.ProcessData(currency, rank);
                    ChannelSession.Settings.ChatCommands.Add(new ChatCommand(command));
                }

                foreach (StreamlabsChatBotTimer timer in this.streamlabsChatBotData.Timers)
                {
                    StreamlabsChatBotCommand command = new StreamlabsChatBotCommand()
                    {
                        Command = timer.Name, Response = timer.Response, Enabled = timer.Enabled
                    };
                    command.ProcessData(currency, rank);
                    ChannelSession.Settings.ChatCommands.Add(new ChatCommand(command));

                    timer.Actions = command.Actions;

                    ChannelSession.Settings.TimerCommands.Add(new TimerCommand(timer));
                }

                foreach (string quote in this.streamlabsChatBotData.Quotes)
                {
                    ChannelSession.Settings.UserQuotes.Add(new UserQuoteViewModel(quote));
                }

                if (ChannelSession.Settings.UserQuotes.Count > 0)
                {
                    ChannelSession.Settings.QuotesEnabled = true;
                }
            }

            if (this.soundwaveData != null && this.soundwaveProfiles != null && this.soundwaveProfiles.Count(p => p.AddProfile) > 0)
            {
                if (this.soundwaveData.StaticCooldown)
                {
                    ChannelSession.Settings.CooldownGroups[SoundwaveInteractiveCooldownGroupName] = this.soundwaveData.StaticCooldownAmount / 1000;
                }

                InteractiveGameListingModel soundwaveGame = this.interactiveGames.FirstOrDefault(g => g.name.Equals(SoundwaveInteractiveGameName));
                if (soundwaveGame != null)
                {
                    InteractiveGameVersionModel version = soundwaveGame.versions.FirstOrDefault();
                    if (version != null)
                    {
                        InteractiveGameVersionModel soundwaveGameVersion = await ChannelSession.Connection.GetInteractiveGameVersion(version);

                        if (soundwaveGameVersion != null)
                        {
                            InteractiveSceneModel soundwaveGameScene = soundwaveGameVersion.controls.scenes.FirstOrDefault();
                            if (soundwaveGameScene != null)
                            {
                                foreach (string profile in this.soundwaveProfiles.Where(p => p.AddProfile).Select(p => p.Name))
                                {
                                    // Add code logic to create Interactive Game on Mixer that is a copy of the Soundwave Interactive game, but with buttons filed in with name and not disabled
                                    InteractiveSceneModel       profileScene = InteractiveGameHelper.CreateDefaultScene();
                                    InteractiveGameListingModel profileGame  = await ChannelSession.Connection.CreateInteractiveGame(ChannelSession.Channel, ChannelSession.User, profile, profileScene);

                                    InteractiveGameVersionModel gameVersion = profileGame.versions.FirstOrDefault();
                                    if (gameVersion != null)
                                    {
                                        InteractiveGameVersionModel profileGameVersion = await ChannelSession.Connection.GetInteractiveGameVersion(gameVersion);

                                        if (profileGameVersion != null)
                                        {
                                            profileScene = profileGameVersion.controls.scenes.First();

                                            for (int i = 0; i < this.soundwaveData.Profiles[profile].Count(); i++)
                                            {
                                                SoundwaveButton soundwaveButton = this.soundwaveData.Profiles[profile][i];
                                                InteractiveButtonControlModel soundwaveControl = (InteractiveButtonControlModel)soundwaveGameScene.allControls.FirstOrDefault(c => c.controlID.Equals(i.ToString()));

                                                InteractiveButtonControlModel button = InteractiveGameHelper.CreateButton(soundwaveButton.name, soundwaveButton.name, soundwaveButton.sparks);
                                                button.position = soundwaveControl.position;

                                                RequirementViewModel requirements = new RequirementViewModel();
                                                requirements.Cooldown.Amount = soundwaveButton.cooldown;
                                                if (this.soundwaveData.StaticCooldown)
                                                {
                                                    requirements.Cooldown.Type      = CooldownTypeEnum.Group;
                                                    requirements.Cooldown.GroupName = SoundwaveInteractiveCooldownGroupName;
                                                }
                                                InteractiveButtonCommand command = new InteractiveButtonCommand(profileGame, profileScene, button, InteractiveButtonCommandTriggerType.MouseDown, requirements);

                                                SoundAction action = new SoundAction(soundwaveButton.path, soundwaveButton.volume);
                                                command.Actions.Add(action);

                                                ChannelSession.Settings.InteractiveCommands.Add(command);
                                                profileScene.buttons.Add(button);
                                            }

                                            await ChannelSession.Connection.UpdateInteractiveGameVersion(profileGameVersion);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            await ChannelSession.SaveSettings();
        }
コード例 #44
0
ファイル: TeeFilter.cs プロジェクト: dbremner/zlr
        public override void PlaySoundSample(ushort number, SoundAction action, byte volume, byte repeats, SoundFinishedCallback callback)
        {
            if (PassSound)
                side.PlaySoundSample(number, action, volume, repeats, callback);

            base.PlaySoundSample(number, action, volume, repeats, callback);
        }
コード例 #45
0
        public static GameObject Instantiate(ENTITY e)
        {
            GameObject entityObject;

            switch (e.Classname)
            {
            case "action_animate":
            {
                entityObject = AnimateAction.Instantiate(e);
                break;
            }

            case "action_move":
            {
                entityObject = MoveAction.Instantiate(e);
                break;
            }

            case "action_rotate":
            {
                entityObject = RotateAction.Instantiate(e);
                break;
            }

            case "action_sequence":
            {
                entityObject = ActionSequence.Instantiate(e);
                break;
            }

            case "action_sound":
            {
                entityObject = SoundAction.Instantiate(e);
                break;
            }

            case "action_wait":
            {
                entityObject = WaitAction.Instantiate(e);
                break;
            }

            case "audio_source":
            {
                entityObject = AudioSourceObject.Instantiate(e);
                break;
            }

            case "dream_environment":
            {
                entityObject = DreamEnvironment.Instantiate(e);
                break;
            }

            case "!map":
            {
                entityObject = MapObject.Instantiate(e);
                break;
            }

            case "!model":
            {
                entityObject = ModelObject.Instantiate(e);
                break;
            }

            case "music_controller":
            {
                entityObject = MusicController.Instantiate(e);
                break;
            }

            case "player_spawn":
            {
                entityObject = PlayerSpawn.Instantiate(e);
                break;
            }

            case "target":
            {
                entityObject = Target.Instantiate(e);
                break;
            }

            case "trigger_link":
            {
                entityObject = TriggerLink.Instantiate(e);
                break;
            }

            case "trigger_sequence":
            {
                entityObject = TriggerSequence.Instantiate(e);
                break;
            }

            case "trigger_sound":
            {
                entityObject = TriggerSound.Instantiate(e);
                break;
            }

            case "trigger_teleport":
            {
                entityObject = TriggerTeleport.Instantiate(e);
                break;
            }

            default:
            {
                Debug.LogWarning("Could not instantiate entity with classname " + e.Classname);
                entityObject = new GameObject(e.Classname);
                break;
            }
            }

            return(entityObject);
        }