public void PlayMessage()
 {
     AudioEventManager.InterruptPilotVOForTeam(base.Combat.LocalPlayerTeam, null);
     WwiseManager.PostEvent <AudioEventList_vo>(AudioEventList_vo.vo_stop_missions, WwiseManager.GlobalAudioObject, null, null);
     this.Play();
     this.SetState(DialogState.Finished);
 }
Exemple #2
0
    //----------------------------------------------------------------------------------------
    // start
    void Start()
    {
        Instance = this;

        uint bankID;

        AkSoundEngine.LoadBank("Ambiance", AkSoundEngine.AK_DEFAULT_POOL_ID, out bankID);
        AkSoundEngine.LoadBank("Car_Motor", AkSoundEngine.AK_DEFAULT_POOL_ID, out bankID);
        AkSoundEngine.LoadBank("Music", AkSoundEngine.AK_DEFAULT_POOL_ID, out bankID);
        AkSoundEngine.LoadBank("UI", AkSoundEngine.AK_DEFAULT_POOL_ID, out bankID);



        // set the volume of Busses
        if (modifyBussesVolume)
        {
            AkSoundEngine.SetRTPCValue("RTPC_BUS_MASTER_GLOBAL_VOL", volumeGlobal);
            AkSoundEngine.SetRTPCValue("RTPC_BUS_MASTER_MUSIC_VOL", volumeMusic);
            AkSoundEngine.SetRTPCValue("RTPC_BUS_MASTER_VOICES_VOL", volumeVoice);
            AkSoundEngine.SetRTPCValue("RTPC_BUS_MASTER_SFX_VOL", volumeSFX);
        }
        else
        {
            // volumeGlobal = 100f;
            volumeMusic = 100f;
            volumeVoice = 100f;
            volumeSFX   = 100f;
        }
    }
Exemple #3
0
    /// <summary>
    /// 创建音乐盒子
    /// </summary>
    /// <param name="aiUid"></param>
    private void CreateSoundBox(ulong aiUid)
    {
        if (aiUid <= 0 || m_AISoundBoxs.ContainsKey(aiUid))
        {
            /// TODO.
            /// or play sound box begin music
            Debug.LogError("aiUid is 0 or Plot repeated trigger the Invaded2");
            return;
        }

        SpacecraftEntity AI = m_GameplayProxy.GetEntityById <SpacecraftEntity>((uint)aiUid);

        if (AI)
        {
            Npc npc = AI.GetNPCTemplateVO();
            if (npc.Behavior > 0)
            {
                PlotBehavior plotBehavior = m_CfgEternityProxy.PlotBehaviorsByKey((uint)npc.Behavior);
                if (plotBehavior.FightBeginSound > 0)
                {
                    GameObject soundBox = WwiseManager.CreatTAkAmbientSphereBox((int)plotBehavior.FightBeginSound, (int)plotBehavior.FightEndSound);
                    soundBox.transform.position = AI.GetRootTransform().position;
                    float scale = plotBehavior.SoundBoxSize;
                    soundBox.transform.localScale = new Vector3(scale, scale, scale);
                    m_AISoundBoxs.Add(aiUid, soundBox);
                }
            }
        }
    }
Exemple #4
0
        public static bool ActiveProbeSequence_CompleteOrders_Prefix(ActiveProbeSequence __instance, AbstractActor ___owningActor, ParticleSystem ___probeParticles)
        {
            Mod.Log.Trace?.Write("SLS:CO entered, aborting invocation");
            //Mod.Log.Trace?.Write($"  oa:{___owningActor.DisplayName}_{___owningActor.GetPilot().Name} hasFired:{___owningActor.HasFiredThisRound} hasMoved:{___owningActor.HasMovedThisRound} hasActivated:{___owningActor.HasActivatedThisRound}");

            // Force the ability to be on cooldown
            if (ActorHasFreeSensorLock(___owningActor))
            {
                CombatGameState ___Combat = Traverse.Create(__instance).Property("Combat").GetValue <CombatGameState>();
                if (___probeParticles != null)
                {
                    ___probeParticles.Stop(true);
                    ___Combat.DataManager.PoolGameObject(___Combat.Constants.VFXNames.active_probe_effect, ___probeParticles.gameObject);
                }
                WwiseManager.PostEvent(AudioEventList_activeProbe.activeProbe_stop, WwiseManager.GlobalAudioObject, null, null);

                Mod.Log.Debug?.Write($"  Clearing all sequences");

                if (ModState.SelectionStateActiveProbe != null)
                {
                    Mod.Log.Debug?.Write($"  Calling clearTargetedActor");
                    Traverse traverse = Traverse.Create(ModState.SelectionStateActiveProbe).Method("RefreshPossibleTargets");
                    traverse.GetValue();

                    //State.SelectionStateSensorLock.BackOut();

                    ModState.SelectionStateActiveProbe = null;
                }
                return(false);
            }

            return(true);
        }
Exemple #5
0
 public static void PlaySFX(AIMCritInfo info)
 {
     try {
         GameRepresentation GameRep = info.target.GameRep;
         if (GameRep == null)
         {
             return;
         }
         if (info.weapon.weaponRep != null && info.weapon.weaponRep.HasWeaponEffect)
         {
             WwiseManager.SetSwitch(info.weapon.weaponRep.WeaponEffect.weaponImpactType, GameRep.audioObject);
         }
         else if (laser_medium != 0)
         {
             WwiseManager.SetSwitch(laser_medium, GameRep.audioObject);
         }
         if (mech_critical_hit != 0)
         {
             WwiseManager.SetSwitch(mech_critical_hit, GameRep.audioObject);
         }
         if (impact_weapon != 0)
         {
             WwiseManager.PostEvent(impact_weapon, GameRep.audioObject, null, null);
         }
         if (explosion_small != 0)
         {
             WwiseManager.PostEvent(explosion_small, GameRep.audioObject, null, null);
         }
     }                 catch (Exception ex) { Error(ex); }
 }
            //public static void Prefix()
            //{
            //    return;
            //}

            public static void Postfix(SGTimePlayPause __instance, int daysPassed)
            {
                try
                {
                    string          message        = GetTimelineDate(daysPassed);
                    TextMeshProUGUI timePassedText = (TextMeshProUGUI)ReflectionHelper.GetPrivateField(__instance, "timePassedText");
                    timePassedText.text = message;

                    WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_sim_travel_ping_play, WwiseManager.GlobalAudioObject, null, null);
                    int day = daysPassed % 7 + 1;
                    for (int i = 0; i < 7; i++)
                    {
                        List <DOTweenAnimation> DayPips = (List <DOTweenAnimation>)ReflectionHelper.GetPrivateField(__instance, "DayPips");
                        if (i < day)
                        {
                            DayPips[i].DOPlayForwardById("fadeIn");
                        }
                        else
                        {
                            DayPips[i].DOPlayBackwardsById("fadeIn");
                        }
                    }
                    __instance.CheckForLaunchVisbility();
                }
                catch (Exception e)
                {
                    Logger.LogError(e);
                }
            }
Exemple #7
0
    public override void Execute(INotification notification)
    {
        MsgLoadSoundCombo parame = notification.Body as MsgLoadSoundCombo;

        if (parame != null)
        {
            WwiseManager.LoadMusicCombo(parame.SoundComboId, parame.todoPrepareEvent);
        }
    }
Exemple #8
0
    /// <summary>
    /// 更新
    /// </summary>
    private void Update()
    {
        if (!gameObject.activeInHierarchy)
        {
            return;
        }
        if (!m_Button || !m_Button.isActiveAndEnabled || !m_Button.interactable)
        {
            return;
        }

        if (m_State.Mode != HotkeyManager.HotkeyMode.Hold)
        {
            return;
        }
        if (m_State.Holding)
        {
            return;
        }

        if (m_PressTime > 0)
        {
            float progress = Mathf.Clamp01((Time.time - m_PressTime) / m_State.HoldDuration);
            if (progress < 1)
            {
                if (m_State.Callback != null)
                {
                    m_State.Callback.Invoke(HotkeyCallback.CreateFrom(HotkeyPhase.Started, Time.time, m_PressTime, m_State.HoldDuration, true));
                }

                Progress = progress;

                float repc = progress * 10.0f;
                WwiseManager.SetParameter(WwiseRtpc.Rtpc_UI_Hotkey, repc);
            }
            else
            {
                PlayFinishAnim();

                HotkeyManager.Instance.PlayHotKeySound(m_State, InputActionPhase.Performed);

                if (m_State.Callback != null)
                {
                    m_State.Callback.Invoke(HotkeyCallback.CreateFrom(HotkeyPhase.Performed, Time.time, m_PressTime, m_State.HoldDuration, true));
                }

                Progress = 0;

                m_PressTime = 0;
            }
        }
    }
Exemple #9
0
 public static void Postfix(WwiseManager __instance, ref List <LoadedAudioBank> ___loadedBanks)
 {
     RLog.M.TWL(0, "WwiseManager.LoadCombatBanks");
     foreach (var soundBank in ModTek.soundBanks)
     {
         if (soundBank.Value.type != SoundBankType.Combat)
         {
             continue;
         }
         if (soundBank.Value.loaded == true)
         {
             continue;
         }
         RLog.M.WL(1, "Loading:" + soundBank.Key);
         ___loadedBanks.Add(new LoadedAudioBank(soundBank.Key, true, false));
     }
 }
Exemple #10
0
 public override void OnAdded()
 {
     base.OnAdded();
     if (this.OwningMech.GameRep != null)
     {
         string text = string.Format("MechOverheatSequence_{0}_{1}", base.RootSequenceGUID, base.SequenceGUID);
         AudioEventManager.CreateVOQueue(text, -1f, null, null);
         AudioEventManager.QueueVOEvent(text, VOEvents.Mech_Overheat_Shutdown, this.OwningMech);
         AudioEventManager.StartVOQueue(1f);
         this.OwningMech.GameRep.PlayVFX(1, this.OwningMech.Combat.Constants.VFXNames.heat_heatShutdown, true, Vector3.zero, false, -1f);
         this.AddChildSequence(new ShowActorInfoSequence(this.OwningMech, "Emergency Shutdown Initiated!", FloatieMessage.MessageNature.Debuff, true), this.ChildSequenceCount - 1);
         WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_overheat_alarm_3, WwiseManager.GlobalAudioObject, null, null);
         if (this.OwningMech.team.LocalPlayerControlsTeam)
         {
             AudioEventManager.PlayAudioEvent("audioeventdef_musictriggers_combat", "friendly_overheating", null, null);
         }
     }
 }
Exemple #11
0
    public override void Execute(INotification notification)
    {
        //特殊枚举类型标记
        MsgPlaySpecialTypeMusicOrSound specialparame = notification.Body as MsgPlaySpecialTypeMusicOrSound;

        if (specialparame != null)
        {
            if (specialparame.UseSoundParent)
            {
                WwiseManager.PlaySpecialTypeMusicOrSound(specialparame.ComboId, specialparame.type, specialparame.palce, specialparame.alreadyPrepare, specialparame.SoundParent, specialparame.endAction, specialparame.userEndData);
            }
            else
            {
                WwiseManager.PlaySpecialTypeMusicOrSound(specialparame.ComboId, specialparame.type, specialparame.palce, specialparame.alreadyPrepare, specialparame.point, specialparame.endAction, specialparame.userEndData);
            }
        }

        //普通的
        MsgPlayMusicOrSound playparame = notification.Body as MsgPlayMusicOrSound;

        if (playparame != null)
        {
            if (playparame.UseSoundParent)
            {
                WwiseManager.PlayMusicOrSound(playparame.musicId, playparame.alreadyPrepare, playparame.SoundParent, playparame.endAction, playparame.userEndData);
            }
            else
            {
                WwiseManager.PlayMusicOrSound(playparame.musicId, playparame.alreadyPrepare, playparame.point, playparame.endAction, playparame.userEndData);
            }
        }

        //toggle 越界声音
        MsgPlayMusicOrSound_outLine outLineparame = notification.Body as MsgPlayMusicOrSound_outLine;

        if (outLineparame != null && outLineparame.OldSelectionObj != null && outLineparame.OldSelectionObj.activeInHierarchy)
        {
            UnityEngine.UI.ButtonWithSound buttonSoundSprite = outLineparame.OldSelectionObj.GetComponent <UnityEngine.UI.ButtonWithSound>();
            if (buttonSoundSprite != null)
            {
                buttonSoundSprite.PlayOutLineSound();
            }
        }
    }
        static bool Prefix(int idx, MechDef mech, bool active, bool forcePlacement, bool displayMechPopup,
                           string mechAddedHeader, SimGameState __instance)
        {
            Logger.Debug("AddMech Prefix Patch Installed");
            if (displayMechPopup)
            {
                if (string.IsNullOrEmpty(mech.GUID))
                {
                    mech.SetGuid(__instance.GenerateSimGameUID());
                }

                var companyStats = Traverse.Create(__instance).Field("companyStats").GetValue <StatCollection>();
                companyStats.ModifyStat <int>("Mission", 0, "COMPANY_MechsAdded", StatCollection.StatOperation.Int_Add, 1, -1, true);
                if (string.IsNullOrEmpty(mechAddedHeader))
                {
                    mechAddedHeader = "'Mech Chassis Complete";
                    int num = (int)WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_sim_popup_newChassis, WwiseManager.GlobalAudioObject, (AkCallbackManager.EventCallback)null, (object)null);
                }

                mechAddedHeader += ": {0}";

                __instance.GetInterruptQueue().QueuePauseNotification(
                    string.Format(mechAddedHeader, (object)mech.Description.UIName), mech.Chassis.YangsThoughts,
                    __instance.GetCrewPortrait(SimGameCrew.Crew_Yang), "notification_mechreadycomplete", (Action)(() =>
                {
                    int firstFreeMechBay = __instance.GetFirstFreeMechBay();
                    if (firstFreeMechBay >= 0)
                    {
                        __instance.ActiveMechs[firstFreeMechBay] = mech;
                        SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs,
                                         __instance.ReadyingMechs);
                    }
                    else
                    {
                        __instance.CreateMechPlacementPopup(mech);
                    }
                }), "Continue", (Action)null, (string)null);
                return(false);
            }

            return(true);
        }
        public static bool Prefix(TextMeshProUGUI ____version, string button)
        {
            if (Iterator == null || (button == DebugCycleCombatSoundsFeature.Shared.Settings.SpecificButton && !Iterator.MoveNext()))
            {
                SceneSingletonBehavior <WwiseManager> .Instance.LoadCombatBanks();

                SceneSingletonBehavior <WwiseManager> .Instance.LoadCombatBanks();

                Iterator = EventIds();
            }

            var eventId = Iterator.Current;

            ____version.text = eventId;
            SceneSingletonBehavior <WwiseManager> .Instance.StopAllAudio();

            WwiseManager.PostEvent(Iterator.Current, WwiseManager.GlobalAudioObject);
            Control.mod.Logger.Log($"WwiseManager.PostEvent eventName={eventId}");

            // AudioEventList_aircraft.aircraft_leopard_destruction
            return(false);
        }
        private void Update()
        {
            if (!Application.isPlaying || !isOblique || ObliqueRectTransform == null)
            {
                return;
            }

            Camera  canvasCamera  = CameraManager.GetInstance().GetUICameraComponent().GetCamera();
            Vector2 mousePosition = InputManager.Instance.GetCurrentVirtualCursorPos();
            Vector2 mousePos_U;

            if (canvasCamera != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(ObliqueRectTransform, mousePosition, canvasCamera, out mousePos_U))
            {
                float x = mousePos_U.x;                              // mousePosition.x - transfomPosition.x;     //鼠标点相对于 面板坐标点的 位置
                float y = mousePos_U.y;                              // mousePosition.y - transfomPosition.y;

                float width  = ObliqueRectTransform.sizeDelta.x / 2; //面板宽度
                float height = ObliqueRectTransform.sizeDelta.y / 2;

                float Xmin = Mathf.Min(Mathf.Abs(x), width);      //鼠标 x ,跟 w 取最小值
                float Ymin = Mathf.Min(Mathf.Abs(y), height);

                float xyDis = Vector2.Distance(new Vector2(Xmin, Ymin), Vector2.zero);        //xy 距离
                float whDis = Vector2.Distance(new Vector2(width, height), Vector2.zero);     //面板最远处距离

                float value = whDis == 0 ? 0 : xyDis / whDis;

                value = value * valueOff;

                //Debug.LogWarning("---------0-----------> mousePosition = " + mousePosition + "  mousePos_U = " + mousePos_U);
                //Debug.LogWarning("---------1-----------> x = " + x + "  y = " + y + " width=" + width + " height=" + height + " Xmin=" + Xmin + " Ymin=" + Ymin);
                //Debug.LogWarning("---------2-----------> xyDis = " + xyDis + "  whDis = " + whDis + " value=" + value);

                if (Rcpc > 0)
                {
                    WwiseManager.SetParameter(Rcpc, value);
                }
            }
        }
Exemple #15
0
 public static void Postfix(WwiseManager __instance, ref List <LoadedAudioBank> ___loadedBanks)
 {
     RLog.M.TWL(0, "WwiseManager.UnloadCombatBanks");
     foreach (var soundBank in ModTek.soundBanks)
     {
         if (soundBank.Value.type != SoundBankType.Combat)
         {
             continue;
         }
         if (soundBank.Value.loaded == false)
         {
             continue;
         }
         LoadedAudioBank loadedAudioBank = ___loadedBanks.Find((Predicate <LoadedAudioBank>)(x => x.name == soundBank.Value.name));
         if (loadedAudioBank != null)
         {
             RLog.M.WL(1, "Unloading:" + soundBank.Key);
             loadedAudioBank.UnloadBank();
             ___loadedBanks.Remove(loadedAudioBank);
         }
     }
 }
Exemple #16
0
        // Prevent the debuff floatie
        public override void OnAdded()
        {
            base.OnAdded();
            if (this.OwningMech.GameRep != null)
            {
                Mod.Log.Info?.Write("Sending floatie notification.");

                string text = string.Format("MechOverheatSequence_{0}_{1}", base.RootSequenceGUID, base.SequenceGUID);

                AudioEventManager.CreateVOQueue(text, -1f, null, null);
                AudioEventManager.QueueVOEvent(text, VOEvents.Mech_Overheat_Shutdown, this.OwningMech);
                AudioEventManager.StartVOQueue(1f);

                this.OwningMech.GameRep.PlayVFX(8, this.OwningMech.Combat.Constants.VFXNames.heat_heatShutdown, true, Vector3.zero, false, -1f);

                WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_overheat_alarm_3, WwiseManager.GlobalAudioObject, null, null);
                if (this.OwningMech.team.LocalPlayerControlsTeam)
                {
                    AudioEventManager.PlayAudioEvent("audioeventdef_musictriggers_combat", "friendly_overheating", null, null);
                }
            }
        }
        public void ProcessWeaponHit(MechComponent mechComponent, WeaponHitInfo hitInfo, ref ComponentDamageLevel damageLevel)
        {
            if (mechComponent.parent == null)
            {
                return;
            }

            if (mechComponent.DamageLevel == ComponentDamageLevel.Destroyed) // already destroyed
            {
                return;
            }

            var criticalEffects = mechComponent.GetCriticalEffects();

            if (criticalEffects == null)
            {
                return;
            }

            var actor = mechComponent.parent;

            damageLevel = ComponentDamageLevel.Penalized;

            int critsPrev;
            int critsNext;
            int critsAdded;

            {
                critsPrev = criticalEffects.HasLinked ? mechComponent.CriticalSlotsHitLinked() : mechComponent.CriticalSlotsHit();
                var critsMax = criticalEffects.PenalizedEffectIDs.Length + 1; // max = how many crits can be absorbed, last one destroys component

                var slots = mechComponent.CriticalSlots();                    // critical slots left

                var locationDestroyed = actor.StructureForLocation(mechComponent.Location) <= 0f;
                var critsHit          = locationDestroyed ? slots : Mathf.Min(1, slots);

                critsNext = Mathf.Min(critsMax, critsPrev + critsHit);
                if (critsNext >= critsMax)
                {
                    damageLevel = ComponentDamageLevel.Destroyed;
                }
                if (criticalEffects.HasLinked)
                {
                    mechComponent.CriticalSlotsHitLinked(critsNext);
                }

                critsAdded = Mathf.Max(critsNext - critsPrev, 0);

                var slotsHitPrev = mechComponent.CriticalSlotsHit();
                mechComponent.CriticalSlotsHit(slotsHitPrev + critsAdded);

                Control.mod.Logger.LogDebug(
                    $"{criticalEffects.Def.Description.Id} on {mechComponent.Location} " +
                    $"critsAdded={critsAdded} critsMax={critsMax} " +
                    $"critsPrev={critsPrev} critsNext={critsNext} " +
                    $"critsHit={critsHit} " +
                    $"slots={slots} slotsHitPrev={slotsHitPrev} " +
                    $"damageLevel={damageLevel} " +
                    $"HasLinked={criticalEffects.HasLinked}"
                    );
            }

            {
                SetDamageLevel(mechComponent, hitInfo, damageLevel);

                if (criticalEffects.HasLinked)
                {
                    var scopedId = mechComponent.ScopedId(criticalEffects.LinkedStatisticName, true);

                    foreach (var mc in actor.allComponents)
                    {
                        if (mc.DamageLevel == ComponentDamageLevel.Destroyed)
                        {
                            continue;
                        }

                        var ce = mc.GetCriticalEffects();
                        if (ce == null)
                        {
                            continue;
                        }

                        if (!ce.HasLinked)
                        {
                            continue;
                        }

                        var otherScopedId = mc.ScopedId(ce.LinkedStatisticName, true);
                        if (scopedId == otherScopedId)
                        {
                            SetDamageLevel(mc, hitInfo, damageLevel);
                        }
                    }
                }
            }

            {
                // cancel effects
                var effectIds = new string[0];

                if (critsPrev > 0 && critsPrev <= criticalEffects.PenalizedEffectIDs.Length)
                {
                    effectIds = effectIds.AddRange(criticalEffects.PenalizedEffectIDs[critsPrev - 1]);
                }

                if (damageLevel == ComponentDamageLevel.Destroyed)
                {
                    effectIds = effectIds.AddRange(criticalEffects.OnDestroyedDisableEffectIds);
                }

                foreach (var effectId in effectIds)
                {
                    var util = new EffectIdUtil(effectId, mechComponent, criticalEffects);
                    util.CancelCriticalEffect();
                }
            }

            {
                // create effects
                var effectIds = new string[0];

                if (critsNext > 0 && critsNext <= criticalEffects.PenalizedEffectIDs.Length)
                {
                    effectIds = criticalEffects.PenalizedEffectIDs[critsNext - 1];
                }

                if (damageLevel == ComponentDamageLevel.Destroyed)
                {
                    effectIds = criticalEffects.OnDestroyedEffectIDs;
                }

                // collect disabled effects, probably easier to cache these in a mech statistic
                var disabledEffectIds = DisabledScopedIdsOnActor(actor);
                //Control.mod.Logger.LogDebug($"disabledEffectIds={string.Join(",", disabledEffectIds.ToArray())}");
                foreach (var effectId in effectIds)
                {
                    var scopedId = mechComponent.ScopedId(effectId, criticalEffects.HasLinked);
                    if (disabledEffectIds.Contains(scopedId))
                    {
                        continue;
                    }

                    var util = new EffectIdUtil(effectId, mechComponent, criticalEffects);
                    util.CreateCriticalEffect(damageLevel < ComponentDamageLevel.Destroyed);
                }
            }

            if (damageLevel == ComponentDamageLevel.Destroyed)
            {
                if (criticalEffects.DeathMethod != DeathMethod.NOT_SET)
                {
                    actor.FlagForDeath(
                        $"{mechComponent.UIName} DESTROYED",
                        criticalEffects.DeathMethod,
                        DamageType.Combat,
                        mechComponent.Location,
                        hitInfo.stackItemUID,
                        hitInfo.attackerId,
                        false);
                    actor.HandleDeath(hitInfo.attackerId);
                }

                if (!string.IsNullOrEmpty(criticalEffects.OnDestroyedVFXName))
                {
                    actor.GameRep.PlayVFX(mechComponent.Location, criticalEffects.OnDestroyedVFXName, true, Vector3.zero, true, -1f);
                }

                if (!string.IsNullOrEmpty(criticalEffects.OnDestroyedAudioEventName))
                {
                    WwiseManager.PostEvent(criticalEffects.OnDestroyedAudioEventName, actor.GameRep.audioObject);
                }
            }
        }
        public static void Postfix(ref SGCharacterCreationNamePanel __instance, ref Gender __result)
        {
            if (CustomVoiceFetcher.isCustomVoicesDetected)
            {
                return;
            }
            bool lastVOWasLight = false;

            WwiseManager.PostEvent(AudioEventList_vo.vo_stop_pilots, WwiseManager.GlobalAudioObject, null, null);
            NewVoice.newVoice = string.Empty;
            string text = __instance.pronounSelector.selection.ToLower();

            if (text != null)
            {
                if (CommanderPortraitLoader.customVoices != null)
                {
                    foreach (CustomVoice cv in CommanderPortraitLoader.customVoices)
                    {
                        if (text == cv.name)
                        {
                            NewVoice.newVoice = cv.name;
                            __result          = cv.gender;
                            SGBarracksDossierPanel.PlayVO(cv.name);
                            return;
                        }
                    }
                }
                if (!(text == "male pro") && !(text == "male british") && !(text == "male david") && !(text == "male brad") && !(text == "male rick") && !(text == "male matthew") && !(text == "male allan") && !(text == "male ermy") && !(text == "male bear") && !(text == "male raju") && !(text == "male rizzo") && !(text == "male vizzini") && !(text == "male overload"))
                {
                    if (!(text == "female pro") && !(text == "female pro 2") && !(text == "female british") && !(text == "female asian") && !(text == "female irish") && !(text == "female midwest") && !(text == "female tanesha") && !(text == "female tough") && !(text == "female bear") && !(text == "female creep") && !(text == "female russian") && !(text == "female kamea") && !(text == "female overload"))
                    {
                        if (text == "onboard ai")
                        {
                            __result = Gender.NonBinary;
                        }
                    }
                    else
                    {
                        if (text == "female pro")
                        {
                            NewVoice.newVoice = "f_pro01";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro01, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female pro 2")
                        {
                            NewVoice.newVoice = "f_pro07";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro07, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female british")
                        {
                            NewVoice.newVoice = "f_pro01_brit";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro01_brit, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female asian")
                        {
                            NewVoice.newVoice = "f_pro02_asian";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro02_asian, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female irish")
                        {
                            NewVoice.newVoice = "f_pro02_irish";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro02_irish, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female midwest")
                        {
                            NewVoice.newVoice = "f_pro04_midwest";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro04_midwest, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female tanesha")
                        {
                            NewVoice.newVoice = "f_pro05_tanesha";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro05_tanesha, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female tough")
                        {
                            NewVoice.newVoice = "f_pro06_tough";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro06_tough, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female bear")
                        {
                            NewVoice.newVoice = "f_bear02";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_bear02, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female creep")
                        {
                            NewVoice.newVoice = "f_creep01";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_creep01, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female russian")
                        {
                            NewVoice.newVoice = "f_glum01_russian";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_glum01_russian, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female kamea")
                        {
                            NewVoice.newVoice = "f_kamea";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_kamea, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female overload")
                        {
                            NewVoice.newVoice = "f_overload01";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_overload01, WwiseManager.GlobalAudioObject);
                        }
                        __result = Gender.Female;
                    }
                }
                else
                {
                    if (text == "male pro")
                    {
                        NewVoice.newVoice = "m_pro01_stark_chad";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro01_stark_chad, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male british")
                    {
                        NewVoice.newVoice = "m_pro03_brit";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro03_brit, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male david")
                    {
                        NewVoice.newVoice = "m_pro02_david";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro02_david, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male brad")
                    {
                        NewVoice.newVoice = "m_pro04_brad";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro04_brad, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male rick")
                    {
                        NewVoice.newVoice = "m_pro05_rick";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro05_rick, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male matthew")
                    {
                        NewVoice.newVoice = "m_pro06_matthew";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro06_matthew, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male allan")
                    {
                        NewVoice.newVoice = "m_pro07_allan";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro07_allan, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male ermy")
                    {
                        NewVoice.newVoice = "m_ermy01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_ermy01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male bear")
                    {
                        NewVoice.newVoice = "m_bear01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_bear01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male raju")
                    {
                        NewVoice.newVoice = "m_raju";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_raju, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male rizzo")
                    {
                        NewVoice.newVoice = "m_rizzo01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_rizzo01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male vizzini")
                    {
                        NewVoice.newVoice = "m_vizzini01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_vizzini01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male overload")
                    {
                        NewVoice.newVoice = "m_overload02";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_overload02, WwiseManager.GlobalAudioObject);
                    }
                    __result = Gender.Male;
                }
                if (NewVoice.newVoice == string.Empty)
                {
                    WwiseManager.SetSwitch(AudioSwitch_dialog_lines_computer_ai.welcome_commander, WwiseManager.GlobalAudioObject);
                    WwiseManager.PostEvent(AudioEventList_vo.vo_play_computer_ai, WwiseManager.GlobalAudioObject, null, null);
                }
                else
                {
                    WwiseManager.SetSwitch(AudioSwitch_dialog_lines_pilots.chosen, WwiseManager.GlobalAudioObject);
                    if (lastVOWasLight)
                    {
                        WwiseManager.SetSwitch(AudioSwitch_dialog_dark_light.dark, WwiseManager.GlobalAudioObject);
                        lastVOWasLight = !lastVOWasLight;
                    }
                    else
                    {
                        WwiseManager.SetSwitch(AudioSwitch_dialog_dark_light.light, WwiseManager.GlobalAudioObject);
                        lastVOWasLight = !lastVOWasLight;
                    }
                    WwiseManager.PostEvent(AudioEventList_vo.vo_play_pilots, WwiseManager.GlobalAudioObject, null, null);
                }
            }
            return;
        }
Exemple #19
0
    public override void OnFixedUpdate()
    {
        if (m_Animator == null)
        {
            return;
        }

        OnSpacecraftAnimationChangeStateEvent();

        if (m_AnimatorParameterVelocityTarget >= 0 && m_AnimatorParameterVelocity != m_AnimatorParameterVelocityTarget)
        {
            /// Magic Number: 美术调的效果
            m_AnimatorParameterVelocity = Mathf.Lerp(m_AnimatorParameterVelocity, m_AnimatorParameterVelocityTarget, 8.0f * Time.fixedDeltaTime);
            m_Animator.SetFloat(Velocity.Name, m_AnimatorParameterVelocity);
        }

        if (m_LeapCameraAnimator != null)
        {
            Rigidbody rigidbody = m_SpacecraftPlayerAnimatorProperty.GetRigidbody();
            if (m_SpacecraftPlayerAnimatorProperty.GetHeroType() == KHeroType.htPlayer && rigidbody != null)
            {
                // 尾焰音效
                float velocityRate = Mathf.Abs(m_SpacecraftPlayerAnimatorProperty.GetRootTransform().InverseTransformVector(rigidbody.velocity).z / m_SpacecraftPlayerAnimatorProperty.GetCurrentSpacecraftMotionInfo().LineVelocityMax.z);
                if (!float.IsNaN(velocityRate))
                {
                    velocityRate = Mathf.Clamp01(velocityRate);
                    if (m_IsMain)
                    {
                        // 速度线 Magic Number: 美术调的效果
                        if (m_SpacecraftPlayerAnimatorProperty.GetCurrentState().IsHasSubState(EnumSubState.Leaping))
                        {
                            m_Animator.SetFloat(Velocity.Name, 1.0f);
                            m_LeapCameraAnimator.SetFloat(Velocity.Name, 1.0f);
                        }
                        else if (m_SpacecraftPlayerAnimatorProperty.GetCurrentState().GetMainState() == EnumMainState.Fight)
                        {
                            m_LeapCameraAnimator.SetFloat(Velocity.Name, velocityRate * 0.3f);
                        }
                        else if (m_SpacecraftPlayerAnimatorProperty.GetCurrentState().GetMainState() == EnumMainState.Cruise)
                        {
                            m_LeapCameraAnimator.SetFloat(Velocity.Name, velocityRate * 0.6f);
                        }
                    }
                    WwiseManager.SetParameter(WwiseRtpc.Rtpc_ShipVelocity, velocityRate);
                }
            }
        }

        /// 速度线朝向飞船速度方向
        if (m_LeapCamera != null)
        {
            Rigidbody rigidbody = m_SpacecraftPlayerAnimatorProperty.GetRigidbody();
            if (rigidbody != null)
            {
                Vector3 direction = rigidbody.velocity.normalized;
                if (!direction.Equals(Vector3.zero))
                {
                    m_LeapCamera.transform.rotation = Quaternion.LookRotation(direction);
                }
            }
        }
    }
            public static bool Prefix(MechHeatSequence __instance, HeatSequenceState newState)
            {
                if (newState != HeatSequenceState.Finished)
                {
                    return(true);
                }

                Traverse          stateT       = Traverse.Create(__instance).Field("state");
                HeatSequenceState currentState = (HeatSequenceState)stateT.GetValue <int>();

                if (currentState == newState)
                {
                    return(true);
                }

                Mod.Log.Info($"MHS - executing updated logic for state: {newState} on actor:{__instance.OwningMech.DisplayName}_{__instance.OwningMech.GetPilot().Name}.");
                stateT.SetValue((int)newState);

                Traverse timeInCurrentStateT = Traverse.Create(__instance).Field("timeInCurrentState");

                timeInCurrentStateT.SetValue(0f);

                /* Finished Can be invoked from a rising state (heat being added):
                 *  Attack Sequence, artillery sequence, actor burning effect, (heatSinkStep=false, applyStartupHeatSinks=false)
                 *  On End of turn sequence - (heatSinkStep=true, applyStartupHeatSinks=false)
                 *  On Mech Startup sequence - (heatSinkStep=true, applyStartupHeatSinks=true)
                 */

                if (!__instance.PerformHeatSinkStep)
                {
                    Mod.Log.Debug($"Reconciling heat for actor: {CombatantUtils.Label(__instance.OwningMech)}");
                    Mod.Log.Debug($"  Before - currentHeat: {__instance.OwningMech.CurrentHeat}  tempHeat: {__instance.OwningMech.TempHeat}  " +
                                  $"isPastMaxHeat: {__instance.OwningMech.IsPastMaxHeat}  hasAppliedHeatSinks: {__instance.OwningMech.HasAppliedHeatSinks}");
                    // Checks for heat damage, clamps heat to max and min
                    __instance.OwningMech.ReconcileHeat(__instance.RootSequenceGUID, __instance.InstigatorID);
                    Mod.Log.Debug($"  After - currentHeat: {__instance.OwningMech.CurrentHeat}  tempHeat: {__instance.OwningMech.TempHeat}  " +
                                  $"isPastMaxHeat: {__instance.OwningMech.IsPastMaxHeat}  hasAppliedHeatSinks: {__instance.OwningMech.HasAppliedHeatSinks}");
                }

                //if (__instance.OwningMech.IsPastMaxHeat && !__instance.OwningMech.IsShutDown) {
                //    __instance.OwningMech.GenerateOverheatedSequence(__instance);
                //    return;
                //}

                if (__instance.PerformHeatSinkStep && !__instance.ApplyStartupHeatSinks)
                {
                    // We are at the end of the turn - force an overheat
                    Mod.Log.Info("AT END OF TURN - CHECKING EFFECTS");

                    MultiSequence sequence = new MultiSequence(__instance.OwningMech.Combat);

                    // Possible sequences
                    //  Shutdown
                    //  Fall from shutdown
                    //  Ammo Explosion
                    //  System damage
                    //  Pilot injury
                    //  Pilot death

                    float heatCheck  = __instance.OwningMech.HeatCheckMod(Mod.Config.Piloting.SkillMulti);
                    float pilotCheck = __instance.OwningMech.PilotCheckMod(Mod.Config.Piloting.SkillMulti);
                    Mod.Log.Debug($" Actor: {CombatantUtils.Label(__instance.OwningMech)} has gutsMulti: {heatCheck}  pilotingMulti: {pilotCheck}");

                    // Resolve Pilot Injury
                    bool failedInjuryCheck = !CheckHelper.DidCheckPassThreshold(Mod.Config.Heat.PilotInjury, __instance.OwningMech.CurrentHeat, __instance.OwningMech, heatCheck, ModConfig.FT_Check_Injury);
                    Mod.Log.Debug($"  failedInjuryCheck: {failedInjuryCheck}");
                    if (failedInjuryCheck)
                    {
                        Mod.Log.Debug("-- Pilot Injury check failed, forcing injury from heat");
                        __instance.OwningMech.pilot.InjurePilot(__instance.SequenceGUID.ToString(), __instance.RootSequenceGUID, 1, DamageType.OverheatSelf, null, __instance.OwningMech);
                        if (!__instance.OwningMech.pilot.IsIncapacitated)
                        {
                            AudioEventManager.SetPilotVOSwitch <AudioSwitch_dialog_dark_light>(AudioSwitch_dialog_dark_light.dark, __instance.OwningMech);
                            AudioEventManager.PlayPilotVO(VOEvents.Pilot_TakeDamage, __instance.OwningMech, null, null, true);
                            if (__instance.OwningMech.team.LocalPlayerControlsTeam)
                            {
                                AudioEventManager.PlayAudioEvent("audioeventdef_musictriggers_combat", "friendly_warrior_injured", null, null);
                            }
                        }
                    }

                    // Resolve System Damage
                    bool failedSystemFailureCheck = !CheckHelper.DidCheckPassThreshold(Mod.Config.Heat.SystemFailures, __instance.OwningMech.CurrentHeat, __instance.OwningMech, heatCheck, ModConfig.FT_Check_System_Failure);
                    Mod.Log.Debug($"  failedSystemFailureCheck: {failedSystemFailureCheck}");
                    if (failedSystemFailureCheck)
                    {
                        Mod.Log.Debug("-- System Failure check failed, forcing system damage");
                        List <MechComponent> functionalComponents = __instance.OwningMech.allComponents.Where(mc => mc.IsFunctional).ToList();
                        MechComponent        componentToDamage    = functionalComponents.GetRandomElement();
                        Mod.Log.Debug($" Destroying component: {componentToDamage.UIName} from heat damage.");

                        WeaponHitInfo fakeHit = new WeaponHitInfo(__instance.RootSequenceGUID, -1, -1, -1, string.Empty, string.Empty, -1, null, null, null, null, null, null, null,
                                                                  new AttackDirection[] { AttackDirection.None }, null, null, null);
                        componentToDamage.DamageComponent(fakeHit, ComponentDamageLevel.Destroyed, true);
                    }

                    // Resolve Ammo Explosion - regular ammo
                    bool          failedAmmoCheck = false;
                    AmmunitionBox mostDamaging    = HeatHelper.FindMostDamagingAmmoBox(__instance.OwningMech, false);
                    if (mostDamaging != null)
                    {
                        failedAmmoCheck = !CheckHelper.DidCheckPassThreshold(Mod.Config.Heat.Explosion, __instance.OwningMech.CurrentHeat, __instance.OwningMech, heatCheck, ModConfig.FT_Check_Explosion);
                        Mod.Log.Debug($"  failedAmmoCheck: {failedAmmoCheck}");
                        if (failedAmmoCheck)
                        {
                            Mod.Log.Debug("-- Ammo Explosion check failed, forcing ammo explosion");

                            if (mostDamaging != null)
                            {
                                Mod.Log.Debug($" Exploding ammo: {mostDamaging.UIName}");
                                WeaponHitInfo fakeHit = new WeaponHitInfo(__instance.RootSequenceGUID, -1, -1, -1, string.Empty, string.Empty, -1, null, null, null, null, null, null, null,
                                                                          new AttackDirection[] { AttackDirection.None }, null, null, null);
                                mostDamaging.DamageComponent(fakeHit, ComponentDamageLevel.Destroyed, true);
                            }
                            else
                            {
                                Mod.Log.Debug(" Unit has no ammo boxes, skipping.");
                            }
                        }
                    }

                    // Resolve Ammo Explosion - inferno ammo
                    bool          failedVolatileAmmoCheck = false;
                    AmmunitionBox mostDamagingVolatile    = HeatHelper.FindMostDamagingAmmoBox(__instance.OwningMech, true);
                    if (mostDamagingVolatile != null)
                    {
                        failedVolatileAmmoCheck = !CheckHelper.DidCheckPassThreshold(Mod.Config.Heat.Explosion, __instance.OwningMech.CurrentHeat, __instance.OwningMech, heatCheck, ModConfig.FT_Check_Explosion);
                        Mod.Log.Debug($"  failedVolatileAmmoCheck: {failedVolatileAmmoCheck}");
                        if (failedVolatileAmmoCheck)
                        {
                            Mod.Log.Debug("-- Volatile Ammo Explosion check failed, forcing volatile ammo explosion");

                            if (mostDamaging != null)
                            {
                                Mod.Log.Debug($" Exploding inferno ammo: {mostDamagingVolatile.UIName}");
                                WeaponHitInfo fakeHit = new WeaponHitInfo(__instance.RootSequenceGUID, -1, -1, -1, string.Empty, string.Empty, -1, null, null, null, null, null, null, null,
                                                                          new AttackDirection[] { AttackDirection.None }, null, null, null);
                                mostDamagingVolatile.DamageComponent(fakeHit, ComponentDamageLevel.Destroyed, true);
                            }
                            else
                            {
                                Mod.Log.Debug(" Unit has no inferno ammo boxes, skipping.");
                            }
                        }
                    }

                    bool failedShutdownCheck = false;
                    if (!__instance.OwningMech.IsShutDown)
                    {
                        // Resolve Shutdown + Fall
                        failedShutdownCheck = !CheckHelper.DidCheckPassThreshold(Mod.Config.Heat.Shutdown, __instance.OwningMech.CurrentHeat, __instance.OwningMech, heatCheck, ModConfig.FT_Check_Shutdown);
                        Mod.Log.Debug($"  failedShutdownCheck: {failedShutdownCheck}");
                        if (failedShutdownCheck)
                        {
                            Mod.Log.Debug("-- Shutdown check failed, forcing unit to shutdown");

                            string debuffText = new Text(Mod.Config.LocalizedFloaties[ModConfig.FT_Shutdown_Failed_Overide]).ToString();
                            sequence.AddChildSequence(new ShowActorInfoSequence(__instance.OwningMech, debuffText,
                                                                                FloatieMessage.MessageNature.Debuff, true), sequence.ChildSequenceCount - 1);

                            MechEmergencyShutdownSequence mechShutdownSequence = new MechEmergencyShutdownSequence(__instance.OwningMech)
                            {
                                RootSequenceGUID = __instance.SequenceGUID
                            };
                            sequence.AddChildSequence(mechShutdownSequence, sequence.ChildSequenceCount - 1);

                            if (__instance.OwningMech.IsOrWillBeProne)
                            {
                                bool failedFallingCheck = !CheckHelper.DidCheckPassThreshold(Mod.Config.Heat.ShutdownFallThreshold, __instance.OwningMech, pilotCheck, ModConfig.FT_Check_Fall);
                                Mod.Log.Debug($"  failedFallingCheck: {failedFallingCheck}");
                                if (failedFallingCheck)
                                {
                                    Mod.Log.Info("Pilot check from shutdown failed! Forcing a fall!");

                                    string fallDebuffText = new Text(Mod.Config.LocalizedFloaties[ModConfig.FT_Shutdown_Fall]).ToString();
                                    sequence.AddChildSequence(new ShowActorInfoSequence(__instance.OwningMech, fallDebuffText,
                                                                                        FloatieMessage.MessageNature.Debuff, true), sequence.ChildSequenceCount - 1);

                                    MechFallSequence mfs = new MechFallSequence(__instance.OwningMech, "Overheat", new Vector2(0f, -1f))
                                    {
                                        RootSequenceGUID = __instance.SequenceGUID
                                    };
                                    sequence.AddChildSequence(mfs, sequence.ChildSequenceCount - 1);
                                }
                                else
                                {
                                    Mod.Log.Info($"Pilot check to avoid falling passed.");
                                }
                            }
                            else
                            {
                                Mod.Log.Debug("Unit is already prone, skipping.");
                            }
                        }
                    }
                    else
                    {
                        Mod.Log.Debug("Unit is already shutdown, skipping.");
                    }

                    if (failedInjuryCheck || failedSystemFailureCheck || failedAmmoCheck || failedShutdownCheck)
                    {
                        __instance.OwningMech.Combat.MessageCenter.PublishMessage(new AddSequenceToStackMessage(sequence));
                    }

                    return(false);
                }

                if (__instance.OwningMech.GameRep != null)
                {
                    if (__instance.OwningMech.team.LocalPlayerControlsTeam)
                    {
                        if (__instance.OwningMech.CurrentHeat > __instance.OwningMech.OverheatLevel)
                        {
                            string text = string.Format("MechHeatSequence_{0}_{1}", __instance.RootSequenceGUID, __instance.SequenceGUID);
                            AudioEventManager.CreateVOQueue(text, -1f, null, null);
                            AudioEventManager.QueueVOEvent(text, VOEvents.Mech_Overheat_Warning, __instance.OwningMech);
                            AudioEventManager.StartVOQueue(1f);
                        }

                        if ((float)__instance.OwningMech.CurrentHeat > (float)__instance.OwningMech.MaxHeat - (float)(__instance.OwningMech.MaxHeat - __instance.OwningMech.OverheatLevel) * 0.333f)
                        {
                            WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_overheat_alarm_3, WwiseManager.GlobalAudioObject, null, null);
                        }
                        else if ((float)__instance.OwningMech.CurrentHeat > (float)__instance.OwningMech.MaxHeat - (float)(__instance.OwningMech.MaxHeat - __instance.OwningMech.OverheatLevel) * 0.666f)
                        {
                            WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_overheat_alarm_2, WwiseManager.GlobalAudioObject, null, null);
                        }
                        else if (__instance.OwningMech.CurrentHeat > __instance.OwningMech.OverheatLevel)
                        {
                            WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_overheat_alarm_1, WwiseManager.GlobalAudioObject, null, null);
                        }
                    }

                    if (__instance.OwningMech.CurrentHeat > Mod.Config.Heat.ShowLowOverheatAnim)
                    {
                        __instance.OwningMech.GameRep.StopManualPersistentVFX(__instance.OwningMech.Combat.Constants.VFXNames.heat_midHeat_persistent);
                        __instance.OwningMech.GameRep.PlayVFX(8, __instance.OwningMech.Combat.Constants.VFXNames.heat_highHeat_persistent, true, Vector3.zero, false, -1f);
                        return(false);
                    }

                    if ((float)__instance.OwningMech.CurrentHeat > Mod.Config.Heat.ShowExtremeOverheatAnim)
                    {
                        __instance.OwningMech.GameRep.StopManualPersistentVFX(__instance.OwningMech.Combat.Constants.VFXNames.heat_highHeat_persistent);
                        __instance.OwningMech.GameRep.PlayVFX(8, __instance.OwningMech.Combat.Constants.VFXNames.heat_midHeat_persistent, true, Vector3.zero, false, -1f);
                        return(false);
                    }

                    __instance.OwningMech.GameRep.StopManualPersistentVFX(__instance.OwningMech.Combat.Constants.VFXNames.heat_highHeat_persistent);
                    __instance.OwningMech.GameRep.StopManualPersistentVFX(__instance.OwningMech.Combat.Constants.VFXNames.heat_midHeat_persistent);
                }

                return(false);
            }
Exemple #21
0
        public static void CritComponent(this MechComponent component, ref WeaponHitInfo hitInfo)
        {
            Weapon        weapon1      = component as Weapon;
            AmmunitionBox ammoBox      = component as AmmunitionBox;
            Jumpjet       jumpjet      = component as Jumpjet;
            HeatSinkDef   componentDef = component.componentDef as HeatSinkDef;
            bool          flag         = weapon1 != null;

            if (component.parent != null)
            {
                if (component.parent.GameRep != null)
                {
                    WwiseManager.SetSwitch <AudioSwitch_weapon_type>(AudioSwitch_weapon_type.laser_medium, component.parent.GameRep.audioObject);
                    WwiseManager.SetSwitch <AudioSwitch_surface_type>(AudioSwitch_surface_type.mech_critical_hit, component.parent.GameRep.audioObject);
                    int num1 = (int)WwiseManager.PostEvent <AudioEventList_impact>(AudioEventList_impact.impact_weapon, component.parent.GameRep.audioObject, (AkCallbackManager.EventCallback)null, (object)null);
                    int num2 = (int)WwiseManager.PostEvent <AudioEventList_explosion>(AudioEventList_explosion.explosion_small, component.parent.GameRep.audioObject, (AkCallbackManager.EventCallback)null, (object)null);
                    if (component.parent.team.LocalPlayerControlsTeam)
                    {
                        AudioEventManager.PlayAudioEvent("audioeventdef_musictriggers_combat", "critical_hit_friendly ", (AkGameObj)null, (AkCallbackManager.EventCallback)null);
                    }
                    else if (!component.parent.team.IsFriendly(component.parent.Combat.LocalPlayerTeam))
                    {
                        AudioEventManager.PlayAudioEvent("audioeventdef_musictriggers_combat", "critical_hit_enemy", (AkGameObj)null, (AkCallbackManager.EventCallback)null);
                    }
                    if (jumpjet == null && componentDef == null && (ammoBox == null && component.DamageLevel > ComponentDamageLevel.Functional))
                    {
                        if (component.parent is Mech mech)
                        {
                            mech.GameRep.PlayComponentCritVFX(component.Location);
                        }
                    }
                    if (ammoBox != null && component.DamageLevel > ComponentDamageLevel.Functional)
                    {
                        component.parent.GameRep.PlayVFX(component.Location, (string)component.parent.Combat.Constants.VFXNames.componentDestruction_AmmoExplosion, true, Vector3.zero, true, -1f);
                    }
                }
            }
            ComponentDamageLevel damageLevel = component.DamageLevel;

            switch (damageLevel)
            {
            case ComponentDamageLevel.Functional:
                if (flag)
                {
                    damageLevel = ComponentDamageLevel.Penalized;
                    component.parent.Combat.MessageCenter.PublishMessage((MessageCenterMessage) new AddSequenceToStackMessage((IStackSequence) new ShowActorInfoSequence((ICombatant)component.parent, new Text("{0} CRIT", new object[1]
                    {
                        (object)component.UIName
                    }), FloatieMessage.MessageNature.CriticalHit, true)));
                    goto case ComponentDamageLevel.Destroyed;
                }
                else
                {
                    damageLevel = ComponentDamageLevel.Destroyed;
                    component.parent.Combat.MessageCenter.PublishMessage((MessageCenterMessage) new AddSequenceToStackMessage((IStackSequence) new ShowActorInfoSequence((ICombatant)component.parent, new Text("{0} DESTROYED", new object[1]
                    {
                        (object)component.UIName
                    }), FloatieMessage.MessageNature.ComponentDestroyed, true)));
                    goto case ComponentDamageLevel.Destroyed;
                }

            case ComponentDamageLevel.Destroyed:
                component.DamageComponent(hitInfo, damageLevel, true);
                break;

            default:
                damageLevel = ComponentDamageLevel.Destroyed;
                component.parent.Combat.MessageCenter.PublishMessage((MessageCenterMessage) new AddSequenceToStackMessage((IStackSequence) new ShowActorInfoSequence((ICombatant)component.parent, new Text("{0} DESTROYED", new object[1]
                {
                    (object)component.UIName
                }), FloatieMessage.MessageNature.ComponentDestroyed, true)));
                goto case ComponentDamageLevel.Destroyed;
            }
        }
Exemple #22
0
 public override void Execute(INotification notification)
 {
     WwiseManager.UnLoadMusicCombo((int)notification.Body);
 }
Exemple #23
0
 public static Dictionary <string, uint> guidIdMap(this WwiseManager manager)
 {
     return((Dictionary <string, uint>)f_guidIdMap.GetValue(manager));
 }
    /// <summary>
    /// 空格键按下  生产 加速 领取
    /// </summary>
    /// <param name="callbackContext">参数</param>
    public void OnProduce(HotkeyCallback callbackContext)
    {
        if (callbackContext.started)
        {
            if (!m_HoldProduceDown)
            {
                m_HoldProduceDown = true;
                if (m_SelectProduceTid > 0)
                {
                    m_ProducingTid = m_SelectProduceTid;
                    if (m_FoundryProxy.GetBluePrintDic().TryGetValue(m_SelectProduceTid, out ProduceInfoVO girdInfo))
                    {
                        //if (girdInfo.BluePrintState == ProduceState.CanProduce)
                        //{
                        //    MsgProduceConfim msgProduceConfim = new MsgProduceConfim();
                        //    msgProduceConfim.OrderType = ProduceOrder.Produce;
                        //    msgProduceConfim.Tid = m_SelectProduceTid;
                        //    GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDER, msgProduceConfim);
                        //}

                        if (girdInfo.BluePrintState == ProduceState.Producing)
                        {
                            ProduceInfoVO foundryMember = m_FoundryProxy.GetFoundryMemberByTID(girdInfo.TID);
                            if (foundryMember != null)
                            {
                                MsgProduceConfim msgProduceConfim = new MsgProduceConfim();
                                msgProduceConfim.OrderType = ProduceOrder.SpeedUp;
                                msgProduceConfim.Tid       = m_SelectProduceTid;
                                msgProduceConfim.ExpendNum = GetNeedGlod(m_SelectProduceTid);
                                GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDER, msgProduceConfim);
                            }
                            else
                            {
                                Debug.Log("fuwuqi不包含");
                            }
                        }
                    }
                    else
                    {
                        Debug.Log("不包含");
                    }
                }
                WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_began, false, null);
            }
            if (m_ProducingTid == m_SelectProduceTid && !m_Discard)
            {
                GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_SHOW);
                float progress = (float)((callbackContext.time - callbackContext.startTime) / callbackContext.duration);
                if (m_ProduceView.GetDownProgressImage() != null)
                {
                    m_ProduceView.GetDownProgressImage().fillAmount = progress;
                }

                float repc = progress * m_SoundRtpcOffet;
                WwiseManager.SetParameter(WwiseRtpc.Rtpc_UI_Hotkey, repc);
            }
            else
            {
                GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_RRETRIEVE);
                m_Discard = true;
                WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_ToCancel, false, null);
            }
        }
        if (callbackContext.performed && m_ProducingTid == m_SelectProduceTid && !m_Discard)
        {
            GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_RRETRIEVE);
            ProduceCallBack();
            m_HoldProduceDown = false;
            WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_end, false, null);
        }
        if (callbackContext.cancelled)
        {
            GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_RRETRIEVE);
            m_Discard         = false;
            m_HoldProduceDown = false;
            WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_ToCancel, false, null);
        }
    }
        public static void PerformMechAssemblyStorePopup(SimGameState s, MechDef d, Action onClose)
        {
            WwiseManager.PostEvent(AudioEventList_ui.ui_sim_popup_newChassis, WwiseManager.GlobalAudioObject, null, null);
            MechDef toAdd = PerformMechAssembly(s, d);
            int     mechbay;

            if (toAdd.IsVehicle())
            {
                mechbay = CUIntegration.GetFirstFreeMechBay(s, d); // vehicle bay, +100 or something similar
            }
            else
            {
                mechbay = s.GetFirstFreeMechBay();
            }
            GenericPopupBuilder pop = GenericPopupBuilder.Create($"{d.GetMechOmniVehicle()} Assembled", $"Yang: [[DM.MechDefs[{d.Description.Id}],{d.Chassis.Description.UIName} {d.Chassis.VariantName}]] finished!\n{d.Chassis.YangsThoughts}\n\n");

            pop.AddButton("storage", delegate
            {
                StoreMech(s, toAdd);
                CallMessages(s, toAdd);
                Log.Log("direct storage");
                onClose?.Invoke();
            }, true, null);
            if (mechbay < 0) // no space - direct storage
            {
                pop.Body += $"We have no space for a new {d.GetMechOmniVehicle()}, so it goes into storage.";
            }
            else
            {
                pop.Body += "Should I put it into storage or ready it for combat?";
                pop.AddButton("ready it", delegate
                {
                    if (Settings.AssembledMechsNeedReadying)
                    {
                        ReadyMech(s, toAdd, mechbay);
                        CallMessages(s, toAdd);
                    }
                    else
                    {
                        s.AddMech(mechbay, toAdd, true, false, false);
                        CallMessages(s, toAdd);
                    }
                    Log.Log("added to bay " + mechbay);
                    onClose?.Invoke();
                }, true, null);
            }
            if (s.IsSellingAllowed())
            {
                int cost = toAdd.GetMechSellCost(s);
                pop.Body += $"\n\nDarius: We could also sell it for {SimGameState.GetCBillString(cost)}, although Yang would certanly not like it.";
                pop.AddButton("sell it", delegate
                {
                    s.AddFunds(cost, "Store", true, true);
                    Log.Log("sold for " + cost);
                    s.CompanyStats.ModifyStat("Mission", 0, "COMPANY_MechsAdded", StatCollection.StatOperation.Int_Add, 1, -1, true);
                    CallMessages(s, toAdd);
                    onClose?.Invoke();
                }, true, null);
            }
            pop.AddFader(new UIColorRef?(LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.PopupBackfill), 0f, true);
            pop.Render();
        }