Ejemplo n.º 1
0
        /// <summary>
        /// NetView 를 등록
        /// </summary>
        /// <param name="view">등록할 NetView</param>
        /// <returns>성공여부</returns>
        public bool RegisterView(NetView view)
        {
            if (IsLocalMode == true)
            {
                return(true);
            }

            if (Client == null)
            {
                return(false);
            }

            return(Client.RegisterView(view));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// NetView 를 등록
        /// </summary>
        /// <param name="view">등록할 NetView</param>
        /// <returns>성공여부</returns>
        public bool RegisterView(NetView view)
        {
            if (view.ViewId == 0)
            {
                Debug.LogError($"invalid viewId [{view.gameObject.name}]", view);
                return(false);
            }

            if (_viewMap.ContainsKey(view.ViewId))
            {
                Debug.LogError($"already registered viewId [{view.ViewId}] origin [{_viewMap[view.ViewId].gameObject.name}] try [{view.gameObject.name}]",
                               _viewMap[view.ViewId]);
                return(false);
            }

            _viewMap[view.ViewId] = view;

            return(true);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// NetView 를 등록
 /// </summary>
 /// <param name="view">등록할 NetView</param>
 /// <returns>성공여부</returns>
 public bool RegisterView(NetView view)
 {
     return(Client.RegisterView(view));
 }
Ejemplo n.º 4
0
            public GameObject Alloc(Vector3 pos, Quaternion rot, System.Action <GameObject> func = null)
            {
                CheckParent();

                GameObject obj = null;

                while (_freeList.Count > 0)
                {
                    obj = _freeList.First.Value;
                    _freeList.RemoveFirst();

                    if (obj == null)
                    {
                        continue;
                    }

                    break;
                }

                if (obj == null)
                {
                    try
                    {
                        obj = GameObject.Instantiate(_prefab, pos, rot) as GameObject;
                    }
                    catch (System.Exception ex)
                    {
                        Debug.LogErrorFormat("Pool Alloc GameObject.Instantiate Exception : {0}", ex.Message);
                    }

                    if (obj == null)
                    {
                        Debug.LogErrorFormat("Pool Alloc GameObject.Instantiate Error : {0}", _prefab.name);
                        return(null);
                    }

                    NetView view = obj.GetComponent <NetView>();
                    if (view != null)
                    {
                        view.PrefabPath = _prefabPath;
                    }

                    obj.transform.parent = _parent.transform;

                    obj.transform.localPosition = pos;
                    obj.transform.localRotation = rot;

                    ++_totalAllocCount;
                }
                else
                {
                    obj.transform.localPosition = pos;
                    obj.transform.localRotation = rot;

                    obj.SetActive(true);
                }

                obj.BroadcastMessage("OnPoolInit", SendMessageOptions.DontRequireReceiver);

                if (func != null)
                {
                    func(obj);
                }

                obj.BroadcastMessage("OnPoolPostInit", SendMessageOptions.DontRequireReceiver);

                return(obj);
            }
Ejemplo n.º 5
0
 /// <summary>
 /// NetView 의 등록을 해제
 /// </summary>
 /// <param name="view">등록해제할 NetView</param>
 /// <returns>성공여부</returns>
 public bool UnregisterView(NetView view)
 {
     return(_views.UnregisterView(view));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// NetView 를 등록함
 /// </summary>
 /// <param name="view">등록할 NetView</param>
 /// <returns>성공여부</returns>
 public bool RegisterView(NetView view)
 {
     return(_views.RegisterView(view));
 }
Ejemplo n.º 7
0
 public NetViewRequestWaiter(NetView view)
 {
     View = view;
 }
Ejemplo n.º 8
0
 public NetViewRequestWaiter(NetView view, DeliveryMethod deliveryMethod)
 {
     View           = view;
     DeliveryMethod = deliveryMethod;
 }