You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace uc
{
public class ActivityQueueNetworkManager : NetworkManagerControl
{
[Header("Activity Queue")]
public ActivityQueueManager queueManager = null;
void SharedUpdate()
{
if (queueManager == null)
{
queueManager = FindObjectOfType<ActivityQueueManager>();
}
}
protected override void ClientUpdate()
{
//print("ClientUpdate");
SharedUpdate();
if (queueManager)
{
var identity = GetLocalPlayer();
if (identity != null)
{
var an = identity.GetComponent<ActivityNetwork>();
queueManager.SetActivityByIndex(an.QueueIndex);
}
}
}
protected override void ServerUpdate()
{
//print("ServerUpdate");
SharedUpdate();
if (queueManager)
{
foreach (var id in NetworkServer.objects.Keys)
{
var identity = NetworkServer.objects[id];
var an = identity.GetComponent<ActivityNetwork>();
an.QueueIndex = queueManager.CurrentIndex;
}
}
}
}
}