Exemplo n.º 1
0
        private void Preview_Client(ulong steamId, string command, byte[] data, DateTime timestamp)
        {
            try
            {
                PreviewGridData  preview = MyAPIGateway.Utilities.SerializeFromBinary <PreviewGridData>(data);
                GridStorageBlock block   = MyAPIGateway.Entities.GetEntityById(preview.GarageId).GameLogic.GetAs <GridStorageBlock>();

                block.PlaceGridPrefab = preview.Prefab;
            }
            catch (Exception e)
            {
                MyLog.Default.Error($"[Grid Garage] Error in function Preview_Client: {e.ToString()}");
            }
        }
Exemplo n.º 2
0
        private void Preview_Server(ulong steamId, string command, byte[] data, DateTime timestamp)
        {
            try
            {
                PreviewGridData  preview = MyAPIGateway.Utilities.SerializeFromBinary <PreviewGridData>(data);
                GridStorageBlock block   = MyAPIGateway.Entities.GetEntityById(preview.GarageId).GameLogic.GetAs <GridStorageBlock>();

                if (preview.Index > -1 && preview.Index < block.GridList.Count)
                {
                    preview.Prefab = block.GridList[preview.Index];
                    Network.SendCommand(Command_Preview, data: MyAPIGateway.Utilities.SerializeToBinary(preview), steamId: steamId);
                }
            }
            catch (Exception e)
            {
                MyLog.Default.Error($"[Grid Garage] Error in function Preview_Server: {e.ToString()}");
            }
        }