예제 #1
0
 public static void OnRecipePickerReturn_Prefix(UIAssemblerWindow __instance, RecipeProto recipe)
 {
     if (SimulatedWorld.Initialized)
     {
         LocalPlayer.SendPacketToLocalStar(new AssemblerRecipeEventPacket(GameMain.data.localPlanet.factoryIndex, __instance.assemblerId, recipe.ID));
     }
 }
예제 #2
0
 public static void OnProductIcon1Click_Prefix(UIAssemblerWindow __instance)
 {
     if (SimulatedWorld.Initialized)
     {
         LocalPlayer.SendPacketToLocalStar(new AssemblerUpdateProducesPacket(1, __instance.factorySystem.assemblerPool[__instance.assemblerId].produced[1], GameMain.data.localPlanet.factoryIndex, __instance.assemblerId));
     }
 }
예제 #3
0
 public static void OnProductIcon1Click_Postfix(UIAssemblerWindow __instance)
 {
     if (Multiplayer.IsActive)
     {
         Multiplayer.Session.Network.SendPacketToLocalStar(new AssemblerUpdateProducesPacket(1, __instance.factorySystem.assemblerPool[__instance.assemblerId].produced[1], GameMain.data.localPlanet.id, __instance.assemblerId));
     }
 }
예제 #4
0
 public static void OnRecipeResetClick_Prefix(UIAssemblerWindow __instance)
 {
     if (SimulatedWorld.Initialized)
     {
         LocalPlayer.SendPacketToLocalStar(new AssemblerRecipeEventPacket(GameMain.data.localPlanet.id, __instance.assemblerId, 0));
     }
 }
예제 #5
0
 public static void OnRecipePickerReturn_Postfix(UIAssemblerWindow __instance, RecipeProto recipe)
 {
     if (Multiplayer.IsActive)
     {
         Multiplayer.Session.Network.SendPacketToLocalStar(new AssemblerRecipeEventPacket(GameMain.data.localPlanet.id, __instance.assemblerId, recipe.ID));
     }
 }
예제 #6
0
 public static void OnIncSwitchClick_Postfix(UIAssemblerWindow __instance)
 {
     if (Multiplayer.IsActive)
     {
         // Notify others about production switch
         Multiplayer.Session.Network.SendPacketToLocalStar(new AssemblerRecipeEventPacket(GameMain.data.localPlanet.id, __instance.assemblerId, -1));
     }
 }
예제 #7
0
        public static void OnAssemblerIdChange_Prefix(UIAssemblerWindow __instance)
        {
            int[]            update           = new int[__instance.factorySystem.assemblerPool[__instance.assemblerId].served.Length];
            StorageComponent assemblerStorage = (StorageComponent)AccessTools.Field(typeof(UIAssemblerWindow), "servingStorage").GetValue(__instance);

            for (int i = 0; i < update.Length; i++)
            {
                update[i] = assemblerStorage.grids[i].count;
            }
            LocalPlayer.SendPacketToLocalPlanet(new AssemblerUpdateStoragePacket(update, GameMain.data.localPlanet.factoryIndex, __instance.assemblerId));
        }
예제 #8
0
        public static void OnUIUpdate(UIAssemblerWindow __instance)
        {
            if (__instance.assemblerId == 0 || __instance.factory == null)
            {
                return;
            }
            AssemblerComponent assemblerComponent = __instance.factorySystem.assemblerPool[__instance.assemblerId];

            if (!assemblerComponent.recipeIsLocked)
            {
                __instance.stateText.text  = "recipeLockedWarn".Translate();
                __instance.stateText.color = __instance.workStoppedColor;
            }
        }
예제 #9
0
        public static void OnRecipePickerReturnPatch(UIAssemblerWindow __instance)
        {
            if (__instance.assemblerId == 0 || __instance.factory == null)
            {
                return;
            }
            AssemblerComponent assemblerComponent = __instance.factorySystem.assemblerPool[__instance.assemblerId];

            if (assemblerComponent.id != __instance.assemblerId)
            {
                return;
            }
            SyncAssemblerFunctions(__instance.factorySystem, __instance.player.package, __instance.assemblerId);
        }
예제 #10
0
        public static void OnManualServingContentChange_Postfix(UIAssemblerWindow __instance)
        {
            if (!Multiplayer.IsActive)
            {
                return;
            }

            int[]            served           = new int[__instance.factorySystem.assemblerPool[__instance.assemblerId].served.Length];
            int[]            incServed        = new int[served.Length];
            StorageComponent assemblerStorage = __instance.servingStorage;

            for (int i = 0; i < served.Length; i++)
            {
                served[i]    = assemblerStorage.grids[i].count;
                incServed[i] = assemblerStorage.grids[i].inc;
            }
            Multiplayer.Session.Network.SendPacketToLocalStar(new AssemblerUpdateStoragePacket(GameMain.data.localPlanet.id, __instance.assemblerId, served, incServed));
        }
예제 #11
0
 public static void OnProductIcon0Click_Prefix(UIAssemblerWindow __instance)
 {
     LocalPlayer.SendPacketToLocalPlanet(new AssemblerUpdateProducesPacket(0, __instance.factorySystem.assemblerPool[__instance.assemblerId].produced[0], GameMain.data.localPlanet.factoryIndex, __instance.assemblerId));
 }
예제 #12
0
 public static void OnRecipeResetClick_Prefix(UIAssemblerWindow __instance)
 {
     LocalPlayer.SendPacketToLocalPlanet(new AssemblerRecipeEventPacket(GameMain.data.localPlanet.factoryIndex, __instance.assemblerId, 0));
 }