public DType Accept(TLong type, string x) { if (long.TryParse(x, out var b)) { return(DLong.ValueOf(b)); } else { throw new Exception($"{x} 不是long类型"); } }
public static float GetPropertyHeight(DLong dLong) { dLong = dLong ?? new DLong(); float height = LINE_HEIGHT; if (!dLong.isExpanded) { return(height); } height += LINE_HEIGHT; height += LINE_HEIGHT * dLong.DecoratorCount; return(height); }
public DType Accept(TLong type, ExcelStream x) { var d = x.Read(); if (CheckNull(type.IsNullable, d)) { return(null); } var ds = d.ToString(); //if (field?.Remapper is TEnum te) //{ // if (te.DefineEnum.TryValueByNameOrAlias(ds, out var c)) // { // return DLong.ValueOf(c); // } //} if (!long.TryParse(ds, out var v)) { throw new InvalidExcelDataException($"{d} 不是 long 类型值"); } return(DLong.ValueOf(v)); }
public void Accept(DLong type, RawTextTable x) { }
public void Accept(DLong type, ByteBuf x) { x.WriteLong(type.Value); }
public void SetData(string key, DLong data) => longData[key] = data;
public void AddData(string key, DLong data) => longData.Add(key, data);
public static DLong OnGUI(Rect position, DLong DLong, GUIContent label, SerializedObject serializedObject) { Rect pos = position; DLong = DLong ?? new DLong(); string text = label.text + " = " + DLong.Value; pos.height = FIELD_HEIGHT; pos.width = text.Length * CHARACTER_WIDTH; EditorGUI.BeginChangeCheck(); DLong.isExpanded = EditorGUI.Foldout(pos, DLong.isExpanded, text); bool sizeChanged = EditorGUI.EndChangeCheck(); pos.x += pos.width + 3 * SPACE; pos.width = position.width - pos.width; pos.xMax -= 3 * SPACE; EditorGUI.BeginChangeCheck(); long result = EditorGUI.LongField(pos, "[Real Value]", DLong.realValue); if (EditorGUI.EndChangeCheck()) { DLong.Value = result; DLong.Refresh(); } pos.x = position.x + SPACE; pos.xMax = position.xMax - 2 * SPACE; if (DLong.isExpanded) { pos.height = FIELD_HEIGHT; int delete = -1; for (int i = 0, l = DLong.DecoratorCount; i < l; i++) { LongDecorator decorator = DLong.variableDecorators[i]; pos.y += LINE_HEIGHT; Rect rect = new Rect(pos) { xMax = pos.xMax - 4 * CHARACTER_WIDTH }; EditorGUI.BeginChangeCheck(); VariableDecoratorDrawer.OnGUI(rect, decorator, GUIContent.none); if (EditorGUI.EndChangeCheck()) { DLong.Sort(); DLong.Refresh(); } rect.x = rect.xMax + 2 * SPACE; rect.xMax = pos.xMax; if (GUI.Button(rect, "X")) { delete = i; } } if (delete != -1) { DLong.Remove(delete); sizeChanged = true; } pos.y += LINE_HEIGHT; if (GUI.Button(pos, "Add Decorator")) { pos.height = LINE_HEIGHT * 5; DLong.Add(new LongDecorator()); EditorUtility.SetDirty(serializedObject.targetObject); sizeChanged = false; } } if (sizeChanged) { EditorUtility.SetDirty(serializedObject.targetObject); } return(DLong); }
public int Accept(DLong data, TType type, Title x) { SetTitleValue(x, data.Value); return(1); }
public void Accept(DLong type, Utf8JsonWriter x) { x.WriteNumberValue(type.Value); }
public string Accept(DLong type) { return(type.Value.ToString()); }
public void Accept(DLong type, DefAssembly x) { throw new NotImplementedException(); }
public void Accept(DLong type, StringBuilder line) { line.Append(type.Value); }
public bool Accept(DLong type) { return(type.Value == 0); }
public void Accept(DLong type, DefField x, List <ResourceInfo> y) { throw new NotImplementedException(); }
public void Accept(DLong type, TType x, List <ResourceInfo> y) { }
public DType Accept(TLong type, XElement x, DefAssembly ass) { return(DLong.ValueOf(long.Parse(x.Value.Trim()))); }
public void Accept(DLong type, StringBuilder x) { x.Append(type.Value); }
public DType Accept(TLong type, JsonElement x, DefAssembly ass) { return(DLong.ValueOf(x.GetInt64())); }