public override void ProcessPacket(Guid sourcePlayerId, Packet packet, IProcessorContext context) { ClientProcessorContext clientProcessor = (ClientProcessorContext)context; SimulationManager simulationManager = clientProcessor.Client.SimulationManager; Player?player = simulationManager.GetSimulationOwner(); if (player.HasValue && clientProcessor.Client.LocalPlayer.HasValue && clientProcessor.Client.LocalPlayer.Value != player.Value) { return; // Not the simulation owner } GameStateGame gameStateGame = GameManager.getInstance().getGameState() as GameStateGame; string xmlData = WorldSerializer.Serialize(gameStateGame); WorldStateData worldStateData = new WorldStateData(xmlData); WorldDataPacket worldDataPacket = new WorldDataPacket(worldStateData); clientProcessor.Client.SendPacket(worldDataPacket); }
public static void Prefix(GameStateGame __instance, out State __state) { Module mActiveModule = __instance.GetType() .GetField("mActiveModule", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(__instance) as Module; bool?mRenderTops = __instance.GetType() .GetField("mRenderTops", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(__instance) as bool?; if (mActiveModule.isValidPosition()) { __state = new State(mActiveModule, (bool)mRenderTops); } else { __state = null; } }
private void GameUpdate() { // Check if we're editing a storage module game = (GameStateGame)gameState; activeModule = game.mActiveModule; menuSystem = game.mMenuSystem; activeMenu = menuSystem.getCurrentMenu(); if (activeModule != null && activeModule.getCategory() == Module.Category.Storage) { if (activeMenu == menuSystem.mMenuEdit && !menuSetUp) { SetupEditMenu(activeModule); menuSetUp = true; } } else { menuSetUp = false; } RedirectCharacters(); }
public static bool Show(GuiDefinitions.Callback callback, string title, string text) { GameState gameState = GameManager.getInstance().getGameState(); if (gameState is GameStateGame) { GuiGameOverWindow window = new GuiGameOverWindow(callback, title, text); GameStateGame gameStateGame = (GameStateGame)gameState; FieldInfo mGameGuiInfo = Reflection.GetPrivateFieldOrThrow(gameStateGame.GetType(), "mGameGui", true); GameGui mGameGui = (GameGui)Reflection.GetInstanceFieldValue(gameStateGame, mGameGuiInfo); mGameGui.setWindow(window); return(true); } if (gameState is GameStateMultiplayer) { GameStateMultiplayer gameStateMultiplayer = (GameStateMultiplayer)gameState; gameStateMultiplayer.ShowMessageBox(callback, title, text); return(true); } // Not supported return(false); }