INFO
How do I use I N F O
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: crBaoCao.cs
Copy
119 public virtual bool ShareDBLogonInfo {
120 get {
121 return false;
122 }
123 set {
124 //
125 }
126 }
File name: FormBaoCao.cs
Copy
40 private void btnLoc_Click(object sender, EventArgs e)
41 {
42 SqlConnection con = dal.GetConnect();
43 con.Open();
44 string sql = "select *from SinhVien where MaLop=@MaLop";
45 SqlDataAdapter da = new SqlDataAdapter(sql, con);
46 da.SelectCommand.Parameters.AddWithValue("@MaLop", cmbMaLop.SelectedValue.ToString());
47 DataTable dt = new DataTable();
48 da.Fill(dt);
49 crBaoCao cr = new crBaoCao();
50 ConnectionInfo crConnectionInfo = new ConnectionInfo();
51 crConnectionInfo.ServerName = "Ty-PC";
52 crConnectionInfo.DatabaseName = "CNPM_1";
53 crConnectionInfo.UserID = "sa";
54 crConnectionInfo.Password = "04091990";
55 TableLogOnInfos crTableLogonInfos = new TableLogOnInfos();
56 foreach (CrystalDecisions.CrystalReports.Engine.Table table in cr.Database.Tables)
57 {
58 TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
59 crTableLogonInfo.TableName = table.Name;
60 crTableLogonInfo.ConnectionInfo = crConnectionInfo;
61 crTableLogonInfos.Add(crTableLogonInfo);
62 table.ApplyLogOnInfo(crTableLogonInfo);
63
64 }
65 crvHocKyHocPhan.LogOnInfo = crTableLogonInfos;
66 cr.SetDataSource(dt);
67 ParameterValues a = new ParameterValues();
68 ParameterDiscreteValue b = new ParameterDiscreteValue();
69 b.Value = cmbMaLop.SelectedValue.ToString();
70 a.Add(b);
71 cr.DataDefinition.ParameterFields["txtMaLop"].ApplyCurrentValues(a);
72 crvHocKyHocPhan.ReportSource = cr;
73 crvHocKyHocPhan.Show();
74 }
File name: rptThisinh.cs
Copy
111 public virtual bool ShareDBLogonInfo {
112 get {
113 return false;
114 }
115 set {
116 //
117 }
118 }
File name: ChatGui.cs
Copy
283 private void PostHelpToCurrentChannel()
284 {
285 ChatChannel channelForHelp = this.selectedChannel;
286 if (channelForHelp != null)
287 {
288 channelForHelp.Add("info", ChatGui.HelpText);
289 }
290 else
291 {
292 Debug.LogError("no channel for help");
293 }
294 }
File name: ChatGui.cs
Copy
348 public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
349 {
350 // this is how you get status updates of friends.
351 // this demo simply adds status updates to the currently shown chat.
352 // you could buffer them or use them any other way, too.
353
354 ChatChannel activeChannel = this.selectedChannel;
355 if (activeChannel != null)
356 {
357 activeChannel.Add("info", string.Format("{0} is {1}. Msg:{2}", user, status, message));
358 }
359
360 Debug.LogWarning("status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message));
361 }
File name: SideWalls.cs
Copy
7 void OnTriggerEnter2D(Collider2D hitInfo) {
8 if (hitInfo.name == "Ball")
9 {
10 string wallName = transform.name;
11 GameManager.Score (wallName);
12 hitInfo.gameObject.SendMessage ("RestartGame", 1, SendMessageOptions.RequireReceiver);
13 }
14 }
File name: GUIFriendFinding.cs
Copy
52 public void OnGUI()
53 {
54 if (!PhotonNetwork.insideLobby)
55 {
56 // this feature is only available on the Master Client. Check either: insideLobby or
57 // PhotonNetwork.connectionStateDetailed == PeerState.Authenticated or
58 // PhotonNetwork.connectionStateDetailed == PeerState.JoinedLobby
59
60 // for simplicity (and cause we know we WILL join the lobby, we can just check that)
61 return;
62 }
63
64
65 GUILayout.BeginArea(GuiRect);
66
67 GUILayout.Label("Your (random) name: " + PhotonNetwork.playerName);
68 GUILayout.Label("Your friends: " + string.Join(", ",this.friendListOfSomeCommunity));
69
70
71 GUILayout.BeginHorizontal();
72 if (GUILayout.Button("Find Friends"))
73 {
74 PhotonNetwork.FindFriends(this.friendListOfSomeCommunity);
75 }
76 if (GUILayout.Button("Create Room"))
77 {
78 PhotonNetwork.CreateRoom(null); // just a random room
79 }
80 GUILayout.EndHorizontal();
81
82
83 if (PhotonNetwork.Friends != null)
84 {
85 foreach (FriendInfo info in PhotonNetwork.Friends)
86 {
87 GUILayout.BeginHorizontal();
88 GUILayout.Label(info.ToString());
89 if (info.IsInRoom)
90 {
91 if (GUILayout.Button("join"))
92 {
93 PhotonNetwork.JoinRoom(info.Room);
94 }
95 }
96 GUILayout.EndHorizontal();
97 }
98 }
99
100 GUILayout.EndArea();
101 }
File name: PickupController.cs
Copy
286 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
287 {
288 if (stream.isWriting)
289 {
290 stream.SendNext(this.transform.position);
291 stream.SendNext((byte)this._characterState);
292 }
293 else
294 {
295 bool initialRemotePosition = (remotePosition == Vector3.zero);
296
297 remotePosition = (Vector3)stream.ReceiveNext();
298 this._characterState = (PickupCharacterState)((byte)stream.ReceiveNext());
299
300 if (initialRemotePosition)
301 {
302 // avoids lerping the character from "center" to the "current" position when this client joins
303 this.transform.position = remotePosition;
304 }
305 }
306 }
File name: CubeExtra.cs
Copy
21 // this method is called by PUN when this script is being "observed" by a PhotonView (setup in inspector)
22 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
23 {
24 // Always send transform (depending on reliability of the network view)
25 if (stream.isWriting)
26 {
27 Vector3 pos = transform.localPosition;
28 Quaternion rot = transform.localRotation;
29 stream.Serialize(ref pos);
30 stream.Serialize(ref rot);
31 }
32 // When receiving, buffer the information
33 else
34 {
35 // Receive latest state information
36 Vector3 pos = Vector3.zero;
37 Quaternion rot = Quaternion.identity;
38 stream.Serialize(ref pos);
39 stream.Serialize(ref rot);
40
41 lastMovement = (pos - latestCorrectPos) / (Time.time - lastTime);
42
43 lastTime = Time.time;
44 latestCorrectPos = pos;
45
46 transform.position = latestCorrectPos;
47 }
48 }
File name: CubeInter.cs
Copy
34 void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
35 {
36 // Always send transform (depending on reliability of the network view)
37 if (stream.isWriting)
38 {
39 Vector3 pos = transform.localPosition;
40 Quaternion rot = transform.localRotation;
41 stream.Serialize(ref pos);
42 stream.Serialize(ref rot);
43 }
44 // When receiving, buffer the information
45 else
46 {
47 // Receive latest state information
48 Vector3 pos = Vector3.zero;
49 Quaternion rot = Quaternion.identity;
50 stream.Serialize(ref pos);
51 stream.Serialize(ref rot);
52
53 // Shift buffer contents, oldest data erased, 18 becomes 19, ... , 0 becomes 1
54 for (int i = m_BufferedState.Length - 1; i >= 1; i--)
55 {
56 m_BufferedState[i] = m_BufferedState[i - 1];
57 }
58
59
60 // Save currect received state as 0 in the buffer, safe to overwrite after shifting
61 State state;
62 state.timestamp = info.timestamp;
63 state.pos = pos;
64 state.rot = rot;
65 m_BufferedState[0] = state;
66
67 // Increment state count but never exceed buffer size
68 m_TimestampCount = Mathf.Min(m_TimestampCount + 1, m_BufferedState.Length);
69
70 // Check integrity, lowest numbered state in the buffer is newest and so on
71 for (int i = 0; i < m_TimestampCount - 1; i++)
72 {
73 if (m_BufferedState[i].timestamp < m_BufferedState[i + 1].timestamp)
74 Debug.Log("State inconsistent");
75 }
76 }
77 }
Download file with original file name:INFO
INFO 1.745 lượt xem
Gõ tìm kiếm nhanh...