Beispiel #1
0
        private static bool CheckAndEndGameForSabotageWin(ShipStatus __instance)
        {
            ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.LifeSupp) ? __instance.Systems[SystemTypes.LifeSupp] : null;

            if (systemType != null)
            {
                LifeSuppSystemType lifeSuppSystemType = systemType.TryCast <LifeSuppSystemType>();
                if (lifeSuppSystemType.Countdown < 0f)
                {
                    EndGameForSabotage(__instance);
                    lifeSuppSystemType.Countdown = 10000f;
                    return(true);
                }
            }
            ISystemType systemType2 = __instance.Systems.ContainsKey(SystemTypes.Reactor) ? __instance.Systems[SystemTypes.Reactor] : null;

            if (systemType2 == null)
            {
                systemType2 = __instance.Systems.ContainsKey(SystemTypes.Laboratory) ? __instance.Systems[SystemTypes.Laboratory] : null;
            }
            if (systemType2 != null)
            {
                ReactorSystemType reactorSystemType = systemType2.TryCast <ReactorSystemType>();
                if (reactorSystemType.Countdown < 0f)
                {
                    EndGameForSabotage(__instance);
                    reactorSystemType.Countdown = 10000f;
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
 public string GetSystemDetails()
 {
     IBrand brand = computerFactory.Brand();
     IProcessor processor = computerFactory.Processor();
     ISystemType systemType = computerFactory.SystemType();
     string returnValue = string.Format("{0} {1} {2}", brand.GetBrand(), processor.GetProcessor(), systemType.GetSystemType());
     return returnValue;
 }
Beispiel #3
0
        public string GetSystemDetails()
        {
            IBrand      brand       = _IComputerFactory.Brand();
            IProcessor  processor   = _IComputerFactory.Processor();
            ISystemType systemType  = _IComputerFactory.SystemType();
            string      returnValue = string.Format($"{brand.GetBrand()} - {processor.GetProcessor()} - {systemType.GetSystemType()}");

            return(returnValue);
        }
Beispiel #4
0
        public string GetSystemDetails()
        {
            IBrand      brand       = _iComputerFactory.Brand();
            IProcessor  processor   = _iComputerFactory.Processor();
            ISystemType systemType  = _iComputerFactory.SystemType();
            string      returnValue = string.Format("Computer Configuration: {0},{1},{2}", brand, processor, systemType);

            return(returnValue);
        }
Beispiel #5
0
        public string GetSystemDetails()
        {
            IBrand      iBrand      = _IComputerFactory.Brand();
            IProcessor  iProcessor  = _IComputerFactory.Procesor();
            ISystemType iSystemType = _IComputerFactory.SystemType();

            string returnValue = string.Format("{0} {1} {2}", iBrand.GetBrand(), iProcessor.GetProcessor(), iSystemType.GetSystemType());

            return(returnValue);
        }
Beispiel #6
0
        public void RunSystems(ISystemType type, double delta_time)
        {
            foreach (var system in systems)
            {
                if (system.Type.HasFlag(type))
                {
                    var queryed_entities = QueryEntities(system.SystemArchetype);

                    if (queryed_entities.Any())
                    {
                        system.Update(delta_time, queryed_entities);
                    }
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public SystemType() : base()
        {
            if (isMultiDatabase)
            {
                base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, dicmultiDatabase[this.GetType().Name].ToString());
            }
            else
            {
                base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
            }

            baseDal.OnOperationLog += new OperationLogEventHandler(OperationLog.OnOperationLog);//如果需要记录操作日志,则实现这个事件

            dal = baseDal as ISystemType;
        }
        public static bool Prefix(ref float __result, ShipStatus __instance, [HarmonyArgument(0)] GameData.PlayerInfo player)
        {
            ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.Electrical) ? __instance.Systems[SystemTypes.Electrical] : null;

            if (systemType == null)
            {
                return(true);
            }
            SwitchSystem switchSystem = systemType.TryCast <SwitchSystem>();

            if (switchSystem == null)
            {
                return(true);
            }

            float num = (float)switchSystem.Value / 255f;

            if (player == null || player.IsDead) // IsDead
            {
                __result = __instance.MaxLightRadius;
            }
            else if (player.IsImpostor) // IsImpostor
            {
                __result = __instance.MaxLightRadius * PlayerControl.GameOptions.ImpostorLightMod;
            }
            else if (Lighter.lighter != null && Lighter.lighter.PlayerId == player.PlayerId && Lighter.lighterTimer > 0f) // if player is Lighter and Lighter has his ability active
            {
                __result = Mathf.Lerp(__instance.MaxLightRadius * Lighter.lighterModeLightsOffVision, __instance.MaxLightRadius * Lighter.lighterModeLightsOnVision, num);
            }
            else if (Trickster.trickster != null && Trickster.lightsOutTimer > 0f)
            {
                float lerpValue = 1f;
                if (Trickster.lightsOutDuration - Trickster.lightsOutTimer < 0.5f)
                {
                    lerpValue = Mathf.Clamp01((Trickster.lightsOutDuration - Trickster.lightsOutTimer) * 2);
                }
                else if (Trickster.lightsOutTimer < 0.5)
                {
                    lerpValue = Mathf.Clamp01(Trickster.lightsOutTimer * 2);
                }
                __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, 1 - lerpValue) * PlayerControl.GameOptions.CrewLightMod; // Instant lights out? Maybe add a smooth transition?
            }
            else
            {
                __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, num) * PlayerControl.GameOptions.CrewLightMod;
            }
            return(false);
        }
Beispiel #9
0
        public static bool Prefix(ShipStatus __instance)
        {
            if (!GameData.Instance)
            {
                return(false);
            }
            ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.LifeSupp) ? __instance.Systems[SystemTypes.LifeSupp] : null;

            if (systemType != null)
            {
                LifeSuppSystemType lifeSuppSystemType = systemType.TryCast <LifeSuppSystemType>();
                if (lifeSuppSystemType.Countdown < 0f)
                {
                    EndGameForSabotage(__instance);
                    lifeSuppSystemType.Countdown = 10000f;
                }
            }
            ISystemType systemType2 = __instance.Systems.ContainsKey(SystemTypes.Reactor) ? __instance.Systems[SystemTypes.Reactor] : null;

            if (systemType2 == null)
            {
                systemType2 = __instance.Systems.ContainsKey(SystemTypes.Laboratory) ? __instance.Systems[SystemTypes.Laboratory] : null;
            }
            if (systemType2 != null)
            {
                ReactorSystemType reactorSystemType = systemType2.TryCast <ReactorSystemType>();
                if (reactorSystemType.Countdown < 0f)
                {
                    EndGameForSabotage(__instance);
                    reactorSystemType.Countdown = 10000f;
                }
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            for (int i = 0; i < GameData.Instance.PlayerCount; i++)
            {
                GameData.PlayerInfo playerInfo = GameData.Instance.AllPlayers[i];
                if (!playerInfo.Disconnected)
                {
                    if (playerInfo.IsImpostor)
                    {
                        num3++;
                    }
                    if (!playerInfo.IsDead)
                    {
                        if (playerInfo.IsImpostor)
                        {
                            num2++;
                        }
                        else
                        {
                            num++;
                        }
                    }
                }
            }
            if (num2 <= 0 && (!DestroyableSingleton <TutorialManager> .InstanceExists || num3 > 0))
            {
                if (!DestroyableSingleton <TutorialManager> .InstanceExists)
                {
                    __instance.enabled = false;
                    ShipStatus.RpcEndGame(GameOverReason.HumansByVote, false);
                    return(false);
                }
                DestroyableSingleton <HudManager> .Instance.ShowPopUp(DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.GameOverImpostorDead, new Il2CppReferenceArray <Il2CppSystem.Object>(0)));

                ReviveEveryone();
                return(false);
            }
            else
            {
                if (num > num2)
                {
                    bool localCompletedAllTasks = true;
                    foreach (PlayerTask t in PlayerControl.LocalPlayer.myTasks)
                    {
                        localCompletedAllTasks = localCompletedAllTasks && t.IsComplete;
                    }

                    if (!DestroyableSingleton <TutorialManager> .InstanceExists)
                    {
                        if (GameData.Instance.TotalTasks <= GameData.Instance.CompletedTasks)
                        {
                            __instance.enabled = false;
                            ShipStatus.RpcEndGame(GameOverReason.HumansByTask, false);
                            return(false);
                        }
                    }
                    else if (localCompletedAllTasks)
                    {
                        DestroyableSingleton <HudManager> .Instance.ShowPopUp(DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.GameOverTaskWin, new Il2CppReferenceArray <Il2CppSystem.Object>(0)));

                        __instance.Begin();
                    }
                    if (num + num2 == 3 && Lovers.existingAndAlive())   // 3 players with 2 lovers is always a lover win (either shared with crewmates or solo for lovers, marked as impostor win)
                    {
                        __instance.enabled = false;
                        ShipStatus.RpcEndGame(Lovers.existingWithImpLover() ? GameOverReason.ImpostorByKill : GameOverReason.HumansByVote, false); // should be implemented using a proper GameOverReason in the future
                        return(false);
                    }
                    return(false);
                }
                if (num == num2 && Lovers.existingAndAlive() && Lovers.existingWithImpLover())   // 3 vs 3 or 2 vs 2 is not win if both lovers are alive and one is an impostor
                {
                    return(false);
                }
                if (!DestroyableSingleton <TutorialManager> .InstanceExists)
                {
                    __instance.enabled = false;
                    GameOverReason endReason;
                    switch (TempData.LastDeathReason)
                    {
                    case DeathReason.Exile:
                        endReason = GameOverReason.ImpostorByVote;
                        break;

                    case DeathReason.Kill:
                        endReason = GameOverReason.ImpostorByKill;
                        break;

                    default:
                        endReason = GameOverReason.ImpostorByVote;
                        break;
                    }
                    ShipStatus.RpcEndGame(endReason, false);
                    return(false);
                }
                DestroyableSingleton <HudManager> .Instance.ShowPopUp(DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.GameOverImpostorKills, new Il2CppReferenceArray <Il2CppSystem.Object>(0)));

                ReviveEveryone();
                return(false);
            }
        }
Beispiel #10
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public SystemType() : base()
 {
     base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
     this.systemTypeDal = (ISystemType)baseDal;
 }
Beispiel #11
0
 public SystemType()
 {
     base.Init(base.GetType().FullName, Assembly.GetExecutingAssembly().GetName().Name);
     this.isystemType_0 = (ISystemType)base.baseDal;
 }
Beispiel #12
0
 public void AddSystem(SystemTypes Type, ISystemType IType)
 {
     Systems.Add(Type, IType);
 }
Beispiel #13
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public SystemType() : base()
 {
     base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
     baseDal.OnOperationLog += new OperationLogEventHandler(OperationLog.OnOperationLog);//如果需要记录操作日志,则实现这个事件
     this.systemTypeDal      = (ISystemType)baseDal;
 }