public void OnOperationResponse(OperationResponse response) { try { if (this.listener.IsDebugLogEnabled) { this.listener.LogDebug(string.Format("{0}: received return {1}", this.avatar.Id, response.ReturnCode)); } if (response.ReturnCode == 0) { string itemId; switch ((OperationCode)response.OperationCode) { case OperationCode.CreateWorld: this.EnterWorld(); return; case OperationCode.EnterWorld: var worldData = new WorldData { Name = (string)response.Parameters[(byte)ParameterCode.WorldName], BoundingBox = (BoundingBox)response.Parameters[(byte)ParameterCode.BoundingBox], TileDimensions = (Vector)response.Parameters[(byte)ParameterCode.TileDimensions] }; this.SetStateWorldEntered(worldData); return; case OperationCode.RemoveInterestArea: case OperationCode.AddInterestArea: return; case OperationCode.AttachInterestArea: itemId = (string)response[(byte)ParameterCode.ItemId]; this.OnCameraAttached(itemId); return; case OperationCode.DetachInterestArea: this.OnCameraDetached(); return; case OperationCode.SpawnItem: itemId = (string)response[(byte)ParameterCode.ItemId]; string line = "sadding item: " + itemId + "\n"; // System.IO.File.AppendAllText(@"D:\client-" + Avatar.Id + ".log", line); this.OnItemSpawned(itemId); return; case OperationCode.FireLaser: // itemId = (string)response[(byte)ParameterCode.ItemId]; //// Vector pos = (Vector)response[(byte)ParameterCode.Position]; // // Vector rot = (Vector)response[(byte)ParameterCode.Rotation]; // this.OnLaserFired(itemId); return; case OperationCode.FireSaber: //itemId = (string)response[(byte)ParameterCode.ItemId]; //this.OnSaberFired(itemId); return; case OperationCode.RadarSubscribe: return; } } else { switch ((OperationCode)response.OperationCode) { case OperationCode.EnterWorld: Operations.CreateWorld( this, this.WorldData.Name, this.WorldData.BoundingBox, this.WorldData.TileDimensions); return; } } this.OnUnexpectedOperationError(response); } catch (Exception e) { this.listener.LogError(e); } }
public void OnOperationResponse(OperationResponse response) { try { if (this.listener.IsDebugLogEnabled) { this.listener.LogDebug(string.Format("{0}: received return {1}", this.avatar.Id, response.ReturnCode)); } if (response.ReturnCode == 0) { string itemId; switch ((OperationCode)response.OperationCode) { case OperationCode.CreateWorld: this.EnterWorld(); return; case OperationCode.EnterWorld: var worldData = new WorldData { Name = (string)response.Parameters[(byte)ParameterCode.WorldName], BoundingBox = (BoundingBox)response.Parameters[(byte)ParameterCode.BoundingBox], TileDimensions = (Vector)response.Parameters[(byte)ParameterCode.TileDimensions] }; this.SetStateWorldEntered(worldData); return; case OperationCode.RemoveInterestArea: case OperationCode.AddInterestArea: return; case OperationCode.AttachInterestArea: itemId = (string)response[(byte)ParameterCode.ItemId]; this.OnCameraAttached(itemId); return; case OperationCode.DetachInterestArea: this.OnCameraDetached(); return; case OperationCode.SpawnItem: itemId = (string)response[(byte)ParameterCode.ItemId]; this.OnItemSpawned(itemId); return; case OperationCode.RadarSubscribe: return; } } else { switch ((OperationCode)response.OperationCode) { case OperationCode.EnterWorld: Operations.CreateWorld( this, this.WorldData.Name, this.WorldData.BoundingBox, this.WorldData.TileDimensions); return; } } this.OnUnexpectedOperationError(response); } catch (Exception e) { this.listener.LogError(e); } }