コード例 #1
0
        protected virtual void OnDestroy()
        {
            Instance = null;
            _usedServiceCallbackIds.Clear();
            foreach (var item in _pendingServiceCallbacks.CacheItems.Values)
            {
                item.Value.State = ServiceCallbackStateEnum.ERROR_TIMEOUT;
                item.Value.RaiseTimeout();
            }

            _pendingServiceCallbacks.Clear();
        }
コード例 #2
0
        //Functions
        #region Unity
        protected virtual void Awake()
        {
            if (Instance != null)
            {
                Destroy(gameObject);
                return;
            }

            Instance = this;
            _usedServiceCallbackIds            = new HandlerPoolUInt();
            _usedServiceCallbackIds.UseFreeIds = false; // Ids from the HandlerPoolUInt will fully count to uint.MaxValue before being reused. This is to prevent collision.
            _pendingServiceCallbacks           = new CacheDictionary <uint, ServiceCallback, float>(new DelayFixedTime(GameTime.FixedTimeUpdater()), CACHE_LIFETIME_PENDING_SERVICE_CALLBACKS);
            _scenesRegistered              = new Dictionary <uint, Dictionary <string, NodeNetworkSceneTemplate> >();
            _scenesCached                  = new CacheDictionary <string, NodeNetworkSceneTemplate, float>(new DelayFixedTime(GameTime.FixedTimeUpdater()), CACHE_LIFETIME_SCENES_CACHED);
            _nodeToNetworkingPlayer        = new Dictionary <uint, NetworkingPlayer>();
            _enableLookupCaching           = NodeManager.Instance.EnableLookupCaching;
            _updatePendingServiceCallbacks = _pendingServiceCallbacks.UpdateCoroutine();
            _pendingServiceCallbacks.OnCacheItemExpired += PendingServiceCallbacks_OnCacheItemExpired;
            _updateScenesCached = _scenesCached.UpdateCoroutine();
            _scenesCached.OnCacheItemExpired += ScenesCached_OnCacheItemExpired;
        }
コード例 #3
0
 public virtual ServiceCallback <string, NodeNetworkSceneTemplate> LookUpNetworkSceneTemplate(uint pSourceNodeId, string pSceneName)
 {
     return(NodeService.LookupScene(pSourceNodeId, pSceneName));
 }
コード例 #4
0
 public virtual ServiceCallback <string, ServiceCallbackStateEnum> UnregisterDynamicScene(uint pSourceNodeId, bool pRequireConfirmation, string pSceneName)
 {
     return(NodeService.UnregisterScene(pSourceNodeId, pRequireConfirmation, pSceneName));
 }
コード例 #5
0
        public virtual ServiceCallback <RPCNetworkSceneTemplate, ServiceCallbackStateEnum> RegisterDynamicScene(uint pSourceNodeId, bool pRequireConfirmation, NetworkSceneTemplate pTemplate)
        {
            ServiceCallback <RPCNetworkSceneTemplate, ServiceCallbackStateEnum> callback = NodeService.RegisterScene(pSourceNodeId, pRequireConfirmation, pTemplate);

            if (callback.State == ServiceCallbackStateEnum.AWAITING_RESPONSE)
            {
                callback.OnResponse += (pResponseTime, pResponseData, pSender) => {
                    ConfirmRegisterDynamicScene(callback);
                };
            }

            return(callback);
        }
コード例 #6
0
 public virtual ServiceCallback <RPCCreateNetworkSceneInNode, ServiceCallbackStateEnum> CreateNetworkSceneInNode(uint pSourceNodeId, uint pTargetNodeId, NetworkSceneTemplate pTemplate, bool pAutoAssignIp = false, bool pAutoAssignPort = false, byte[] pNetworkSceneMetaData = null)
 {
     return(NodeService.CreateNetworkSceneInNode(pSourceNodeId, pTargetNodeId, pTemplate, pAutoAssignIp, pAutoAssignPort, pNetworkSceneMetaData));
 }
コード例 #7
0
 public virtual ServiceCallback <RPCInstantiateInNode, ServiceCallbackStateEnum> InstantiateInNode(uint pSourceNodeId, uint pTargetNodeId, string pSceneName, int pCreateCode = -1, IRPCSerializable pBehaviorData = null, Vector3?pPosition = null, Quaternion?pRotation = null, bool pSendTransform = true)
 {
     return(NodeService.InstantiateInNode(pSourceNodeId, pTargetNodeId, pSceneName, pCreateCode, pBehaviorData, pPosition, pRotation, pSendTransform));
 }