Exemplo n.º 1
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);
        }
Exemplo n.º 2
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));
         }
     }
 }