56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
|
using System;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.Collections.Generic;
|
||
|
using Aurora.Proto.PartyV2;
|
||
|
using Google.Protobuf.WellKnownTypes;
|
||
|
|
||
|
|
||
|
namespace Aurora.Services.Server.Controllers
|
||
|
{
|
||
|
public partial class RemotePartyController : RemotePartyService.RemotePartyServiceBase
|
||
|
{
|
||
|
private string _displayName;
|
||
|
private string _description;
|
||
|
private Member _hostMember;
|
||
|
private DateTime _startDateTime;
|
||
|
|
||
|
private EventManager.EventManager _eventManager;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Constructor for partial class
|
||
|
/// </summary>
|
||
|
public RemotePartyController(string partyName, string description)
|
||
|
{
|
||
|
this._startDateTime = DateTime.Now;
|
||
|
this._displayName = partyName;
|
||
|
this._description = description;
|
||
|
this._memberList = new SortedList<string, Member>();
|
||
|
|
||
|
string userName = SettingsService.Instance.Username;
|
||
|
|
||
|
this._eventManager = new EventManager.EventManager();
|
||
|
|
||
|
this._hostMember = new Member()
|
||
|
{
|
||
|
Name = userName,
|
||
|
UserName = userName,
|
||
|
IpAddress = ServerService.GetLocalIPAddress(),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public override Task<Party> GetParty(Proto.General.Empty request, Grpc.Core.ServerCallContext context)
|
||
|
{
|
||
|
Party party = new Party()
|
||
|
{
|
||
|
Name = "party/party1",
|
||
|
DisplayName = this._displayName,
|
||
|
Description = this._description,
|
||
|
HostIp = ServerService.GetLocalIPAddress(),
|
||
|
HostMember = this._hostMember,
|
||
|
CreatedOn = Timestamp.FromDateTime(_startDateTime)
|
||
|
};
|
||
|
|
||
|
return Task.FromResult(party);
|
||
|
}
|
||
|
}
|
||
|
}
|