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); } }
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); }
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); } } }
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)); } } }
internal void DestroyView(RoomView view) { Rpc(BroadcastType.All, "_DestroyView", view.Id); }