Beginning stages for party executors

This commit is contained in:
watsonb8
2019-06-03 10:57:05 -04:00
parent 6503d2c410
commit b0307cf7b3
10 changed files with 370 additions and 39 deletions

View File

@ -0,0 +1,77 @@
using System;
using System.Threading.Tasks;
using Aurora.Backend.Executors;
using Aurora.Backend.Services;
using Aurora.Backend.Proto;
namespace Aurora.Backend.Server.Party
{
public class HostPartyExecutor : BasePartyExecutor
{
PartyServiceImpl _partyServiceImpl;
public HostPartyExecutor()
{
_partyServiceImpl = new PartyServiceImpl();
}
public override void Initialize()
{
ServerService.Instance.RegisterService(PartyService.BindService(_partyServiceImpl));
}
public override async void Close()
{
await ServerService.Instance.Stop();
}
public override void AddToQueue()
{
throw new NotImplementedException();
}
public override void GetMembers()
{
throw new NotImplementedException();
}
public override void GetQueue()
{
throw new NotImplementedException();
}
public override void Next()
{
throw new NotImplementedException();
}
public override void Pause()
{
throw new NotImplementedException();
}
public override void Play()
{
throw new NotImplementedException();
}
public override void Previous()
{
throw new NotImplementedException();
}
public override void RemoveFromQueue()
{
throw new NotImplementedException();
}
public override void Run()
{
throw new NotImplementedException();
}
public override void Stop()
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Aurora.Backend.Proto;
using Aurora.Backend.Models;
namespace Aurora.Backend.Server.Party
{
class PartyServiceImpl : PartyService.PartyServiceBase
{
/// <summary>
/// Dictionary of party members. Key -> ClientId
/// </summary>
private Dictionary<string, PartyMember> _partyMembers;
public PartyServiceImpl()
{
_partyMembers = new Dictionary<string, PartyMember>();
}
public Dictionary<string, PartyMember> PartyMembers
{
get
{
return _partyMembers;
}
}
public override Task<JoinPartyResponse> JoinParty(JoinPartyRequest request, Grpc.Core.ServerCallContext context)
{
_partyMembers.Add(request.ClientId, new PartyMember()
{
Username = request.UserName,
Id = request.ClientId,
IpAddress = request.IpAddress,
Port = request.Port,
});
JoinPartyResponse response = new JoinPartyResponse() { Status = PartyJoinedStatusEnum.Connected };
return Task.FromResult(response);
}
public override Task<LeavePartyResponse> LeaveParty(LeavePartyRequest request, Grpc.Core.ServerCallContext context)
{
_partyMembers.Remove(request.ClientId);
LeavePartyResponse response = new LeavePartyResponse() { Status = PartyJoinedStatusEnum.Disconnected };
return Task.FromResult(response);
}
}
}

View File

@ -0,0 +1,10 @@
using System;
using Aurora.Backend.Proto;
namespace Aurora.Backend.Server
{
class PlaybackServiceImpl : PlaybackService.PlaybackServiceBase
{
}
}