private void cbxOps_SelectedValueChanged(object sender, EventArgs e) { pnlFields.Visible = false; _controls.Clear(); pnlFields.Controls.Clear(); PacketReflectionInfo info = PacketController.Client.Processor.Serializer.Info[cbxOps.Text]; foreach (FieldInfo field in info.Fields) { Type type = field.FieldType; TypeCode fTypeCode = Type.GetTypeCode(type); UserControl ctrl = null; if (type.IsEnum) { ctrl = new ExEnum(field); } else { switch (fTypeCode) { case TypeCode.Object: if (type == typeof(Vector3)) { ctrl = new ExVector3(field); } if (type == typeof(Angle)) { ctrl = new ExAngle(field); } break; case TypeCode.Boolean: break; case TypeCode.SByte: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.UInt16: case TypeCode.Int32: case TypeCode.UInt32: case TypeCode.Int64: case TypeCode.UInt64: case TypeCode.Single: case TypeCode.Double: ctrl = new ExUpDown(field); break; case TypeCode.String: ctrl = new ExTextBox(field); break; } } if (ctrl != null) { AddControl(GetPanel()); AddControl(ctrl); _controls.Add((ExControl)ctrl); } } if (_controls.Count != info.Fields.Length) { throw new Exception("Not enough controls."); } pnlFields.Visible = true; }
public override void Reset() { gameObject = null; exampleEnum = ExEnum.Option2; fsmEnum = null; variable = new FsmVar(); compareTos = null; compareEvents = null; //"UseVariable" sets the field in the action to 'None' by default targetGameObject = new FsmGameObject() { UseVariable = true }; normalStringArray = new FsmString[2]; anyArrayResult = null; result = null; }
/// <summary> /// 添加log到集合中显示 /// </summary> /// <param name="paramStr">log信息</param> /// <param name="paramLevel">log级别</param> public void WriteLog(string paramStr, ExEnum paramLevel) { string level = string.Empty; if (paramLevel == ExEnum.Infor) { level = "提示"; } if (paramLevel == ExEnum.Error) { level = "异常"; } if (!string.IsNullOrEmpty(level)) { ExceptionModels.Add(new ExceptionModel() { ExTime = DateTime.Now, ExLevel = level, ExMessage = paramStr }); } }