コード例 #1
0
 public DType Accept(TLong type, string x)
 {
     if (long.TryParse(x, out var b))
     {
         return(DLong.ValueOf(b));
     }
     else
     {
         throw new Exception($"{x} 不是long类型");
     }
 }
コード例 #2
0
    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);
    }
コード例 #3
0
        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));
        }
コード例 #4
0
 public void Accept(DLong type, RawTextTable x)
 {
 }
コード例 #5
0
 public void Accept(DLong type, ByteBuf x)
 {
     x.WriteLong(type.Value);
 }
コード例 #6
0
 public void SetData(string key, DLong data) => longData[key] = data;
コード例 #7
0
 public void AddData(string key, DLong data) => longData.Add(key, data);
コード例 #8
0
    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);
    }
コード例 #9
0
 public int Accept(DLong data, TType type, Title x)
 {
     SetTitleValue(x, data.Value);
     return(1);
 }
コード例 #10
0
ファイル: JsonExportor.cs プロジェクト: zhangga/luban
 public void Accept(DLong type, Utf8JsonWriter x)
 {
     x.WriteNumberValue(type.Value);
 }
コード例 #11
0
 public string Accept(DLong type)
 {
     return(type.Value.ToString());
 }
コード例 #12
0
ファイル: ValidatorVisitor.cs プロジェクト: zhangga/luban
 public void Accept(DLong type, DefAssembly x)
 {
     throw new NotImplementedException();
 }
コード例 #13
0
ファイル: LuaExportor.cs プロジェクト: zhangga/luban
 public void Accept(DLong type, StringBuilder line)
 {
     line.Append(type.Value);
 }
コード例 #14
0
 public bool Accept(DLong type)
 {
     return(type.Value == 0);
 }
コード例 #15
0
ファイル: ResourceExportor.cs プロジェクト: zhangga/luban
 public void Accept(DLong type, DefField x, List <ResourceInfo> y)
 {
     throw new NotImplementedException();
 }
コード例 #16
0
 public void Accept(DLong type, TType x, List <ResourceInfo> y)
 {
 }
コード例 #17
0
 public DType Accept(TLong type, XElement x, DefAssembly ass)
 {
     return(DLong.ValueOf(long.Parse(x.Value.Trim())));
 }
コード例 #18
0
 public void Accept(DLong type, StringBuilder x)
 {
     x.Append(type.Value);
 }
コード例 #19
0
 public DType Accept(TLong type, JsonElement x, DefAssembly ass)
 {
     return(DLong.ValueOf(x.GetInt64()));
 }