Remove









How do I use Remove
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: frmThiThat.cs Copy
50         void TaoBangRandomCauHoi(DataTable BangQuestion)
51         {
52
53             try
54             {
55                 Random Rnd = new Random();
56                 ArrayList ArrQuestion = new ArrayList();
57
58                 ArrQuestion.Clear();
59                 int x, dem = 0;
60                 int SoCauTrongBangGoc = BangQuestion.Rows.Count;
61                 while (dem < SoCauNgauNhien)
62                 {
63                     x = Rnd.Next(0, SoCauTrongBangGoc);
64                     if (!ArrQuestion.Contains(x))
65                     {
66                         ArrQuestion.Add(x);
67                         dem++;
68                     }
69                 }
70                 for (int j = SoCauTrongBangGoc - 1; j >= 0; j--)
71                     if (!ArrQuestion.Contains(j))
72                         BangQuestion.Rows.RemoveAt(j);
73
74                 BangDeThi = BangQuestion;
75                 BangDeThi.Columns.Add("cauhoi,DAPAN");
76
77             }
78             catch (Exception ex)
79             { MessageBox.Show(ex.Message); }
80
81         }
File name: frmThiThat.cs Copy
82         void TaoBangRandomCauTraLoi()
83         {
84             try
85             {
86                 SoCauHoi = BangDeThi.Rows.Count;
87                 string DapAnDung = "";
88                 string A, B, C, D;
89                 int DapAn;
90                 Random Rnd = new Random();
91                 ArrayList ArrDapAn = new ArrayList();
92                 for (int i = 0; i < SoCauHoi; i++)
93                 {
94                     A = "";
95                     B = "";
96                     C = "";
97                     D = "";
98                     DapAnDung = "";
99                     DapAn = 0;
100                     ArrDapAn.Clear();
101                     ArrDapAn.Add(2);
102                     ArrDapAn.Add(3);
103                     ArrDapAn.Add(4);
104                     ArrDapAn.Add(5);
105
106                     DapAn = Rnd.Next(ArrDapAn.Count);
107                     A = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
108                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
109                         DapAnDung += "A";
110                     ArrDapAn.RemoveAt(DapAn);
111                     DapAn = Rnd.Next(ArrDapAn.Count);
112                     B = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
113                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
114                         DapAnDung += "B";
115                     ArrDapAn.RemoveAt(DapAn);
116                     DapAn = Rnd.Next(ArrDapAn.Count);
117                     C = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
118                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
119                         DapAnDung += "C";
120                     ArrDapAn.RemoveAt(DapAn);
121                     DapAn = Rnd.Next(ArrDapAn.Count);
122                     D = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
123                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
124                         DapAnDung += "D";
125                     BangDeThi.Rows[i][2] = A;
126                     BangDeThi.Rows[i][3] = B;
127                     BangDeThi.Rows[i][4] = C;
128                     BangDeThi.Rows[i][5] = D;
129                     BangDeThi.Rows[i][6] = DapAnDung;
130                 }
131             }
132             catch (Exception ex)
133             { MessageBox.Show(ex.Message); }
134         }
File name: ChatGui.cs Copy
215     private void GuiSendsMsg()
216     {
217         if (string.IsNullOrEmpty(this.inputLine))
218         {
219
220             GUI.FocusControl("");
221             return;
222         }
223
224         if (this.inputLine[0].Equals('\\'))
225         {
226             string[] tokens = this.inputLine.Split(new char[] {' '}, 2);
227             if (tokens[0].Equals("\\help"))
228             {
229                 this.PostHelpToCurrentChannel();
230             }
231             if (tokens[0].Equals("\\state"))
232             {
233                 int newState = int.Parse(tokens[1]);
234                 this.chatClient.SetOnlineStatus(newState, new string[] { "i am state " + newState }); // this is how you set your own state and (any) message
235             }
236             else if (tokens[0].Equals("\\subscribe") && !string.IsNullOrEmpty(tokens[1]))
237             {
238                 this.chatClient.Subscribe(tokens[1].Split(new char[] {' ', ','}));
239             }
240             else if (tokens[0].Equals("\\unsubscribe") && !string.IsNullOrEmpty(tokens[1]))
241             {
242                 this.chatClient.Unsubscribe(tokens[1].Split(new char[] {' ', ','}));
243             }
244             else if (tokens[0].Equals("\\clear"))
245             {
246                 if (this.doingPrivateChat)
247                 {
248                     this.chatClient.PrivateChannels.Remove(this.selectedChannelName);
249                 }
250                 else
251                 {
252                     ChatChannel channel;
253                     if (this.chatClient.TryGetChannel(this.selectedChannelName, this.doingPrivateChat, out channel))
254                     {
255                         channel.ClearMessages();
256                     }
257                 }
258             }
259             else if (tokens[0].Equals("\\msg") && !string.IsNullOrEmpty(tokens[1]))
260             {
261                 string[] subtokens = tokens[1].Split(new char[] {' ', ','}, 2);
262                 string targetUser = subtokens[0];
263                 string message = subtokens[1];
264                 this.chatClient.SendPrivateMessage(targetUser, message);
265             }
266         }
267         else
268         {
269             if (this.doingPrivateChat)
270             {
271                 this.chatClient.SendPrivateMessage(this.userIdInput, this.inputLine);
272             }
273             else
274             {
275                 this.chatClient.PublishMessage(this.selectedChannelName, this.inputLine);
276             }
277         }
278
279         this.inputLine = "";
280         GUI.FocusControl("");
281     }
File name: PhotonAnimatorViewEditor.cs Copy
157     private void CheckIfStoredParametersExist()
158     {
159         for (int i = 0; i < this.m_Target.GetSynchronizedParameters().Count; ++i)
160         {
161             string parameterName = this.m_Target.GetSynchronizedParameters()[i].Name;
162             if (DoesParameterExist(parameterName) == false)
163             {
164                 Debug.LogWarning("Parameter '" + this.m_Target.GetSynchronizedParameters()[i].Name +
165                                  "' doesn't exist anymore. Removing it from the list of synchronized parameters");
166                 int numberOfRemovedElements = this.m_Target.GetSynchronizedParameters().RemoveAll(item => item.Name == parameterName);
167                 EditorUtility.SetDirty(this.m_Target);
168
169                 i -= numberOfRemovedElements;
170
171                 if (i < 0)
172                 {
173                     break;
174                 }
175             }
176         }
177     }
File name: PhotonEditor.cs Copy
909     public static void UpdateRpcList()
910     {
911         List additionalRpcs = new List();
912         HashSet currentRpcs = new HashSet();
913
914         var types = GetAllSubTypesInScripts(typeof(MonoBehaviour));
915
916         foreach (var mono in types)
917         {
918             MethodInfo[] methods = mono.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
919
920             foreach (MethodInfo method in methods)
921             {
922                 if (method.IsDefined(typeof(UnityEngine.RPC), false))
923                 {
924                     currentRpcs.Add(method.Name);
925
926                     if (!additionalRpcs.Contains(method.Name) && !PhotonEditor.Current.RpcList.Contains(method.Name))
927                     {
928                         additionalRpcs.Add(method.Name);
929                     }
930                 }
931             }
932         }
933
934         if (additionalRpcs.Count > 0)
935         {
936             // LIMITS RPC COUNT
937             if (additionalRpcs.Count + PhotonEditor.Current.RpcList.Count >= byte.MaxValue)
938             {
939                 if (currentRpcs.Count <= byte.MaxValue)
940                 {
941                     bool clearList = EditorUtility.DisplayDialog(CurrentLang.IncorrectRPCListTitle, CurrentLang.IncorrectRPCListLabel, CurrentLang.RemoveOutdatedRPCsLabel, CurrentLang.CancelButton);
942                     if (clearList)
943                     {
944                         PhotonEditor.Current.RpcList.Clear();
945                         PhotonEditor.Current.RpcList.AddRange(currentRpcs);
946                     }
947                     else
948                     {
949                         return;
950                     }
951                 }
952                 else
953                 {
954                     EditorUtility.DisplayDialog(CurrentLang.FullRPCListTitle, CurrentLang.FullRPCListLabel, CurrentLang.SkipRPCListUpdateLabel);
955                     return;
956                 }
957             }
958
959             additionalRpcs.Sort();
960             PhotonEditor.Current.RpcList.AddRange(additionalRpcs);
961             EditorUtility.SetDirty(PhotonEditor.Current);
962         }
963     }
File name: PhotonGUI.cs Copy
69     {
70         get
71         {
72             if( m_DefaultRemoveButtonStyle == null )
73             {
74                 m_DefaultRemoveButtonStyle = new GUIStyle();
75                 m_DefaultRemoveButtonStyle.fixedWidth = 30;
76                 m_DefaultRemoveButtonStyle.fixedHeight = 20;
77                 m_DefaultRemoveButtonStyle.active.background = ReorderableListResources.CreatePixelTexture( "Dark Pixel (List GUI)", new Color32( 18, 18, 18, 255 ) );
78                 m_DefaultRemoveButtonStyle.imagePosition = ImagePosition.ImageOnly;
79                 m_DefaultRemoveButtonStyle.alignment = TextAnchor.MiddleCenter;
80             }
81
82             return m_DefaultRemoveButtonStyle;
83         }
84     }
File name: PhotonViewInspector.cs Copy
258     void DrawObservedComponentsList()
259     {
260         GUILayout.Space( 5 );
261         SerializedProperty listProperty = serializedObject.FindProperty( "ObservedComponents" );
262
263         if( listProperty == null )
264         {
265             return;
266         }
267
268         float containerElementHeight = 22;
269         float containerHeight = listProperty.arraySize * containerElementHeight;
270
271         bool isOpen = PhotonGUI.ContainerHeaderFoldout( "Observed Components (" + GetObservedComponentsCount() + ")", serializedObject.FindProperty( "ObservedComponentsFoldoutOpen" ).boolValue );
272         serializedObject.FindProperty( "ObservedComponentsFoldoutOpen" ).boolValue = isOpen;
273
274         if( isOpen == false )
275         {
276             containerHeight = 0;
277         }
278
279         //Texture2D statsIcon = AssetDatabase.LoadAssetAtPath( "Assets/Photon Unity Networking/Editor/PhotonNetwork/PhotonViewStats.png", typeof( Texture2D ) ) as Texture2D;
280
281         Rect containerRect = PhotonGUI.ContainerBody( containerHeight );
282         bool wasObservedComponentsEmpty = m_Target.ObservedComponents.FindAll( item => item != null ).Count == 0;
283         if( isOpen == true )
284         {
285             for( int i = 0; i < listProperty.arraySize; ++i )
286             {
287                 Rect elementRect = new Rect( containerRect.xMin, containerRect.yMin + containerElementHeight * i, containerRect.width, containerElementHeight );
288                 {
289                     Rect texturePosition = new Rect( elementRect.xMin + 6, elementRect.yMin + elementRect.height / 2f - 1, 9, 5 );
290                     ReorderableListResources.DrawTexture( texturePosition, ReorderableListResources.texGrabHandle );
291
292                     Rect propertyPosition = new Rect( elementRect.xMin + 20, elementRect.yMin + 3, elementRect.width - 45, 16 );
293                     EditorGUI.PropertyField( propertyPosition, listProperty.GetArrayElementAtIndex( i ), new GUIContent() );
294
295                     //Debug.Log( listProperty.GetArrayElementAtIndex( i ).objectReferenceValue.GetType() );
296                     //Rect statsPosition = new Rect( propertyPosition.xMax + 7, propertyPosition.yMin, statsIcon.width, statsIcon.height );
297                     //ReorderableListResources.DrawTexture( statsPosition, statsIcon );
298
299                     Rect removeButtonRect = new Rect( elementRect.xMax - PhotonGUI.DefaultRemoveButtonStyle.fixedWidth,
300                                                         elementRect.yMin + 2,
301                                                         PhotonGUI.DefaultRemoveButtonStyle.fixedWidth,
302                                                         PhotonGUI.DefaultRemoveButtonStyle.fixedHeight );
303
304                     GUI.enabled = listProperty.arraySize > 1;
305                     if( GUI.Button( removeButtonRect, new GUIContent( ReorderableListResources.texRemoveButton ), PhotonGUI.DefaultRemoveButtonStyle ) )
306                     {
307                         listProperty.DeleteArrayElementAtIndex( i );
308                     }
309                     GUI.enabled = true;
310
311                     if( i < listProperty.arraySize - 1 )
312                     {
313                         texturePosition = new Rect( elementRect.xMin + 2, elementRect.yMax, elementRect.width - 4, 1 );
314                         PhotonGUI.DrawSplitter( texturePosition );
315                     }
316                 }
317             }
318         }
319
320         if( PhotonGUI.AddButton() )
321         {
322             listProperty.InsertArrayElementAtIndex( Mathf.Max( 0, listProperty.arraySize - 1 ) );
323         }
324
325         serializedObject.ApplyModifiedProperties();
326
327         bool isObservedComponentsEmpty = m_Target.ObservedComponents.FindAll( item => item != null ).Count == 0;
328
329         if( wasObservedComponentsEmpty == true && isObservedComponentsEmpty == false && m_Target.synchronization == ViewSynchronization.Off )
330         {
331             m_Target.synchronization = ViewSynchronization.UnreliableOnChange;
332             EditorUtility.SetDirty( m_Target );
333             serializedObject.Update();
334         }
335
336         if( wasObservedComponentsEmpty == false && isObservedComponentsEmpty == true )
337         {
338             m_Target.synchronization = ViewSynchronization.Off;
339             EditorUtility.SetDirty( m_Target );
340             serializedObject.Update();
341         }
342
343     }
File name: ReorderableListResources.cs Copy
28         {
29             add_button = 0,
30             add_button_active,
31             container_background,
32             grab_handle,
33             remove_button,
34             remove_button_active,
35             title_background,
36         }
File name: ReorderableListResources.cs Copy
103         {
104             get { return s_Cached[ (int)ResourceName.remove_button ]; }
105         }
File name: ReorderableListResources.cs Copy
110         {
111             get { return s_Cached[ (int)ResourceName.remove_button_active ]; }
112         }

Download file with original file name:Remove

Remove 216 lượt xem

Gõ tìm kiếm nhanh...