Example #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            RoomView view            = (RoomView)this.target;
            bool     isProjectPrefab = EditorUtility.IsPersistent(view.gameObject);

            if (view.Owner == null)
            {
                GUILayout.Label("ViewId: Not Set");
            }
            else
            {
                GUILayout.Label("ViewId:" + view.Id);
            }
        }
Example #2
0
        private GameObject _InsSceneView(int viewId, string prefabPath, Vector3 pos, Quaternion rot,
                                         object[] customData)
        {
            GameObject ins  = RoomClient.InstantiateFunc(prefabPath, pos, rot);
            RoomView   view = ins.GetComponent <RoomView>();

            if (view == null)
            {
                throw new Exception(prefabPath + " don't hava a RoomPlayerView component");
            }
            view.Room           = this.Room;
            view.OwnerId        = 0;     //scene view
            view.ViewIdInPlayer = viewId;
            this.Room.Views.Add(view.Id, view);
            view.OnInstantiate(customData);
            return(ins);
        }
Example #3
0
 public void DestoryView(RoomView view)
 {
     if (OfflineMode)
     {
         UnityEngine.Object.Destroy(view.gameObject);
     }
     else
     {
         if (!this.ToRoomClient.InRoom)
         {
             throw new Exception("DestoryView must in room");
         }
         else
         {
             this.ToRoomClient.Room.MinePlayer.DestroyView(view);
         }
     }
 }
Example #4
0
 public GameObject Instantiate(string prefabPath, Vector3 pos, Quaternion rot, object[] customData)
 {
     if (OfflineMode)
     {
         var      ret  = InstantiateFunc(prefabPath, pos, rot);
         RoomView view = ret.GetComponent <RoomView>();
         view.OnInstantiate(customData);
         return(ret);
     }
     else
     {
         if (!this.ToRoomClient.InRoom)
         {
             throw new Exception("Instantiate Operate must in room");
         }
         else
         {
             return(this.ToRoomClient.Room.MinePlayer.Instantiate(prefabPath, pos, rot, customData));
         }
     }
 }
Example #5
0
 internal void DestroyView(RoomView view)
 {
     Rpc(BroadcastType.All, "_DestroyView", view.Id);
 }