Exemplo n.º 1
0
        /// <summary>
        /// 释放资源
        /// </summary>
        /// <param name="disposing">是否也释放托管资源</param>
        protected virtual void Dispose(bool disposing)
        {
            if (this.IsListening == true)
            {
                this.listenSocket.Close();
                this.listenSocket.Dispose();
            }

            this.acceptArg.Dispose();
            this.sessionManager.Dispose();
            this.plugManager.Clear();
            this.middlewareManager.Clear();

            if (disposing == true)
            {
                this.listenSocket      = null;
                this.acceptArg         = null;
                this.plugManager       = null;
                this.middlewareManager = null;
                this.sessionManager    = null;

                this.LocalEndPoint   = null;
                this.IsListening     = false;
                this.KeepAlivePeriod = TimeSpan.Zero;
            }
        }
Exemplo n.º 2
0
    private void Update()
    {
        if (wire == null && !disableDespawn)
        {
            timeUnwired += Time.deltaTime;
        }

        if (timeUnwired > PlugManager.GetDespawnTimeout())
        {
            DestroyPlug();
        }
    }
Exemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();

            //Force it to load/include all plugs assemblies so all types are correctly found
            //Otherwise the CLR's delay loading techniques block us...
            AssembliesPreloader.LoadAllAssemblies();

            plugManager = new PlugManager(
                ex => { AddExceptionEntry(ex.Message); }, warning => { })
            {
                ThrowExceptions = false
            };
        }
Exemplo n.º 4
0
    public Plug ProcessHit(ref RaycastHit hit, Gun source)
    {
        Plug plug = null;

        if (hit.collider.gameObject == gameObject)
        {
            Vector3 localNormal = hit.transform.InverseTransformVector(hit.normal);
            Vector3 localPos    = hit.transform.InverseTransformPoint(hit.point) + localNormal * 0.1f;

            int index = GetHitSocketIndex(localNormal);
            Debug.Assert(index >= 0 && index < sockets.Length);

            plug = PlugManager.CreatePlug(this, sockets[index], localPos, localNormal);
        }

        return(plug);
    }