Exemplo n.º 1
0
        private static void ObsManager_SceneChanged(object sender, string sceneName)
        {
            DateTime startTime = DateTime.Now;

            StopExistingAnimation();

            List <VideoAnimationBinding> bindings = AllVideoBindings.GetAll(sceneName);

            if (bindings != null)
            {
                StartLiveAnimation(sceneName, bindings, startTime);
            }

            if (sceneName == STR_AnimationEditor)
            {
                animationEditorTimer.Start();
            }
            else
            {
                HubtasticBaseStation.PreloadImageBack(null, 0, 0, 0);
                HubtasticBaseStation.PreloadImageFront(null, 0, 0, 0);
                HubtasticBaseStation.ShowImageFront(null);
                HubtasticBaseStation.ShowImageBack(null);
            }

            ChangeLightsBasedOnScene(sceneName);
        }
Exemplo n.º 2
0
        private void ItemBuilder_TestEffect(object sender, RoutedEffectEventArgs ea)
        {
            if (ea.TimeLineData == null)
            {
                return;
            }

            EffectGroup effectGroup = new EffectGroup();

            foreach (TimeLineEffect timeLineEffects in ea.TimeLineData.Entries)
            {
                Effect effect = null;

                if (timeLineEffects.Effect != null)
                {
                    effect = timeLineEffects.Effect.GetPrimaryEffect();
                }

                if (effect != null)
                {
                    effect.timeOffsetMs = (int)Math.Round(timeLineEffects.Start.TotalMilliseconds);
                    effectGroup.Add(effect);
                }
            }

            string serializedObject = JsonConvert.SerializeObject(effectGroup);

            HubtasticBaseStation.TriggerEffect(serializedObject);
        }
Exemplo n.º 3
0
        public static void RollingDiceNow(DiceRoll diceRoll)
        {
            HubtasticBaseStation.ClearWindup("Weapon.*!");
            HubtasticBaseStation.ClearWindup("Windup.*!");

            SystemVariables.DiceRoll = diceRoll;
        }
Exemplo n.º 4
0
 private void UpdataData()
 {
     skeletalData2d.UpdateVirtualObjects();
     lock (skeletalData2d.world.Instances)
         HubtasticBaseStation.UpdateSkeletalData(JsonConvert.SerializeObject(skeletalData2d));
     LastUpdateTime = DateTime.Now;
     ClearImpulseData();
 }
Exemplo n.º 5
0
 private void CharacterSheets_PageChanged(object sender, RoutedEventArgs ea)
 {
     if (sender is CharacterSheets characterSheets && activePage != characterSheets.Page)
     {
         activePage = characterSheets.Page;
         HubtasticBaseStation.PlayerDataChanged(tabPlayers.SelectedIndex, activePage, string.Empty);
     }
 }
Exemplo n.º 6
0
 private void HandleCharacterChanged(object sender, RoutedEventArgs e)
 {
     if (sender is CharacterSheets characterSheets)
     {
         string character = characterSheets.GetCharacter();
         HubtasticBaseStation.PlayerDataChanged(tabPlayers.SelectedIndex, activePage, character);
     }
 }
Exemplo n.º 7
0
 public void ClearTheDice()
 {
     updateClearButtonTimer.Stop();
     btnClearDice.Visibility    = Visibility.Hidden;
     spRollNowButtons.IsEnabled = true;
     spSpecialThrows.IsEnabled  = true;
     HubtasticBaseStation.ClearDice();
 }
Exemplo n.º 8
0
        void SendCardCommand(string command)
        {
            CardHandDto cardDto = new CardHandDto();

            cardDto.Hands   = Hands.Values.ToList();
            cardDto.Command = command;
            HubtasticBaseStation.CardCommand(JsonConvert.SerializeObject(cardDto));
        }
Exemplo n.º 9
0
 private void TabControl_PlayerChanged(object sender, SelectionChangedEventArgs e)
 {
     highlightRectangles = null;
     NextDieRollType     = DiceRollType.None;
     activePage          = ScrollPage.main;
     FocusHelper.ClearActiveStatBoxes();
     HubtasticBaseStation.PlayerDataChanged(PlayerID, activePage, string.Empty);
     SetActionShortcuts(PlayerID);
 }
Exemplo n.º 10
0
        public void RollTheDice(DiceRoll diceRoll)
        {
            rbTestNormalDieRoll.IsChecked = true;
            updateClearButtonTimer.Stop();
            EnableDiceRollButtons(false);
            btnClearDice.Visibility = Visibility.Hidden;
            PrepareForClear();
            string serializedObject = JsonConvert.SerializeObject(diceRoll);

            HubtasticBaseStation.RollDice(serializedObject);
        }
Exemplo n.º 11
0
        private void UpdateData()
        {
            UpdateLights();
            // Don't update the LIFX bulbs faster than 20Hz!

            skeletalData2d.UpdateVirtualObjects();
            lock (skeletalData2d.world.worldLock)
                HubtasticBaseStation.UpdateSkeletalData(JsonConvert.SerializeObject(skeletalData2d));
            LastUpdateTime = DateTime.Now;
            ClearImpulseData();
        }
Exemplo n.º 12
0
        private void BtnTestEffect_Click(object sender, RoutedEventArgs e)
        {
            Effect activeEffect = effectBuilder.GetEffect();

            if (activeEffect == null)
            {
                return;
            }
            string serializedObject = JsonConvert.SerializeObject(activeEffect);

            HubtasticBaseStation.TriggerEffect(serializedObject);
        }
Exemplo n.º 13
0
        private void BtnTestGroupEffect_Click(object sender, RoutedEventArgs e)
        {
            EffectGroup effectGroup = new EffectGroup();

            effectGroup.Add(effectBuilder.GetEffect());

            effectGroup.Add(new SoundEffect("Blood Squirting Weapon Impact.mp3"));

            string serializedObject = JsonConvert.SerializeObject(effectGroup);

            HubtasticBaseStation.TriggerEffect(serializedObject);
        }
Exemplo n.º 14
0
        private void FocusHelper_FocusedControlsChanged(object sender, FocusedControlsChangedEventArgs e)
        {
            foreach (StatBox statBox in e.Active)
            {
                HubtasticBaseStation.FocusItem(PlayerID, activePage, statBox.FocusItem);
            }

            foreach (StatBox statBox in e.Deactivated)
            {
                HubtasticBaseStation.UnfocusItem(PlayerID, activePage, statBox.FocusItem);
            }
        }
Exemplo n.º 15
0
        void PreloadAroundActiveFrame(int extraFramesCount)
        {
            if (backFiles == null)
            {
                return;
            }
            int startFrame = Math.Max(0, frameIndex - extraFramesCount);
            int lastIndex  = backFiles.Length - 1;
            int endFrame   = Math.Min(lastIndex, frameIndex + extraFramesCount);

            HubtasticBaseStation.PreloadImageBack(relativePathBack, startFrame, endFrame, digitCount);
            HubtasticBaseStation.PreloadImageFront(relativePathFront, startFrame, endFrame, digitCount);
        }
Exemplo n.º 16
0
 public void PlayCard(StreamlootsCard cardToPlay)
 {
     if (cardToPlay == null)
     {
         return;
     }
     if (cardToPlay.IsSecret)
     {
         HubtasticBaseStation.ShowValidationIssue(CharacterId, DndCore.ValidationAction.Stop, "Cannot play secret cards.");
         return;
     }
     Cards.Remove(cardToPlay);
     CardsToPlay.Add(cardToPlay);
 }
Exemplo n.º 17
0
        public bool PlayCard(StreamlootsCard cardToPlay, Creature creature)
        {
            if (cardToPlay == null)
            {
                return(false);
            }
            if (cardToPlay.IsSecret)
            {
                HubtasticBaseStation.ShowValidationIssue(CharacterId, ValidationAction.Stop, "Cannot play secret cards.");
                return(false);
            }

            Cards.Remove(cardToPlay);
            CardsToPlay.Add(cardToPlay);
            TriggerCardPlayed(cardToPlay, creature);
            return(true);
        }
Exemplo n.º 18
0
        public static void SeriouslyRollTheDice(DiceRoll diceRoll)
        {
            CardEventManager.ConditionRoll(diceRoll);
            LastChanceToModifyDiceBeforeRoll(diceRoll);
            LastDieRollTime = DateTime.Now;

            if (SpellManager.nextSpellIdWeAreCasting != null)
            {
                diceRoll.SpellID = SpellManager.nextSpellIdWeAreCasting;
                SpellManager.nextSpellIdWeAreCasting = null;
            }
            SpellManager.activeSpellName = null;
            string serializedObject = JsonConvert.SerializeObject(diceRoll);

            HubtasticBaseStation.RollDice(serializedObject);
            TargetManager.ClearTargetingAfterRoll();
        }
Exemplo n.º 19
0
        void DrawActiveFrame()
        {
            if (backFiles == null)
            {
                return;
            }
            if (frameIndex < 0 || frameIndex >= backFiles.Length)
            {
                HubtasticBaseStation.ShowImageBack(null);
                HubtasticBaseStation.ShowImageFront(null);
                return;
            }

            HubtasticBaseStation.ShowImageBack(GetRelativePath(backFiles[frameIndex]));
            HubtasticBaseStation.ShowImageFront(GetRelativePath(frontFiles[frameIndex]));

            foreach (AnimatorWithTransforms animatorWithTransform in liveFeedAnimators)
            {
                DrawFrameSource(animatorWithTransform);
            }
        }
Exemplo n.º 20
0
        private void BtnTestGroupEffect_Click(object sender, RoutedEventArgs e)
        {
            EffectGroup effectGroup = new EffectGroup();

            foreach (TimeLineEffect timeLineEffect in groupEffectBuilder.Entries)
            {
                Effect effect = null;

                if (timeLineEffect.Effect != null)
                {
                    effect = timeLineEffect.Effect.GetPrimaryEffect();
                }

                if (effect != null)
                {
                    effect.timeOffsetMs = (int)Math.Round(timeLineEffect.Start.TotalMilliseconds);
                    effectGroup.Add(effect);
                }
            }

            string serializedObject = JsonConvert.SerializeObject(effectGroup);

            HubtasticBaseStation.TriggerEffect(serializedObject);
        }
Exemplo n.º 21
0
 private void TabControl_PlayerChanged(object sender, SelectionChangedEventArgs e)
 {
     activePage = ScrollPage.main;
     FocusHelper.ClearActiveStatBoxes();
     HubtasticBaseStation.PlayerDataChanged(PlayerID, activePage, string.Empty);
 }
Exemplo n.º 22
0
        private void UpdateClock(bool bigUpdate = false, double daysSinceLastUpdate = 0)
        {
            if (txtTime == null)
            {
                return;
            }
            string timeStr = dndTimeClock.Time.ToString("H:mm:ss") + ", " + dndTimeClock.AsDndDateString();

            if (dndTimeClock.InCombat)
            {
                timeStr = " " + timeStr + " ";
            }

            if (txtTime.Text == timeStr)
            {
                return;
            }

            txtTime.Text = timeStr;

            TimeSpan timeIntoToday      = dndTimeClock.Time - new DateTime(dndTimeClock.Time.Year, dndTimeClock.Time.Month, dndTimeClock.Time.Day);
            double   percentageRotation = 360 * timeIntoToday.TotalMinutes / TimeSpan.FromDays(1).TotalMinutes;

            string afterSpinMp3 = null;

            if (daysSinceLastUpdate > 0.08)              // Short rest or greater
            {
                if (timeIntoToday.TotalHours < 2 || timeIntoToday.TotalHours > 22)
                {
                    afterSpinMp3 = "midnightWolf";
                }
                else if (timeIntoToday.TotalHours > 4 && timeIntoToday.TotalHours < 8)
                {
                    afterSpinMp3 = "morningRooster";
                }
                else if (timeIntoToday.TotalHours > 10 && timeIntoToday.TotalHours < 14)
                {
                    afterSpinMp3 = "birdsNoon";
                }
                else if (timeIntoToday.TotalHours > 16 && timeIntoToday.TotalHours < 20)
                {
                    if (new Random().Next(100) > 50)
                    {
                        afterSpinMp3 = "eveningCrickets";
                    }
                    else
                    {
                        afterSpinMp3 = "lateEveningFrogs";
                    }
                }
                if (lastAmbientSoundPlayed == afterSpinMp3)                  // prevent the same sound from being played twice in a row.
                {
                    afterSpinMp3 = null;
                }
                else
                {
                    lastAmbientSoundPlayed = afterSpinMp3;
                }
            }

            ClockDto clockDto = new ClockDto()
            {
                Time         = timeStr,
                BigUpdate    = bigUpdate,
                Rotation     = percentageRotation,
                InCombat     = dndTimeClock.InCombat,
                FullSpins    = daysSinceLastUpdate,
                AfterSpinMp3 = afterSpinMp3
            };

            string serializedObject = JsonConvert.SerializeObject(clockDto);

            HubtasticBaseStation.UpdateClock(serializedObject);
        }
Exemplo n.º 23
0
        static void UpdateInGameViewerRollQueue()
        {
            ViewerQueueDto viewerQueueDto = new ViewerQueueDto(viewerRollQueue);

            HubtasticBaseStation.CardCommand(JsonConvert.SerializeObject(viewerQueueDto));
        }