using System; 
 | 
using System.Collections.Generic; 
 | 
  
 | 
public class BaseProperty 
 | 
{ 
 | 
    bool m_Dirty = true; 
 | 
    public bool dirty { 
 | 
        get { 
 | 
            return this.m_Dirty; 
 | 
        } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                this.m_Dirty = value; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public BaseProperty() 
 | 
    { 
 | 
  
 | 
    } 
 | 
} 
 | 
  
 | 
public sealed class LogicInt : BaseProperty 
 | 
{ 
 | 
    int m_Value; 
 | 
    public int value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicInt() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicInt(int value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public int Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicFloat : BaseProperty 
 | 
{ 
 | 
    float m_Value; 
 | 
    public float value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicFloat() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicFloat(float value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public float Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicBool : BaseProperty 
 | 
{ 
 | 
    bool m_Value; 
 | 
    public bool value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicBool() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicBool(bool value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public bool Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
  
 | 
public sealed class LogicString : BaseProperty 
 | 
{ 
 | 
    string m_Value = string.Empty; 
 | 
    public string value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicString() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicString(string value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public string Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
  
 | 
public sealed class LogicLong : BaseProperty 
 | 
{ 
 | 
    long m_Value; 
 | 
    public long value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicLong() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicLong(long value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public long Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicInt2 : BaseProperty 
 | 
{ 
 | 
    Int2 m_Value = Int2.zero; 
 | 
    public Int2 value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicInt2() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicInt2(Int2 value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public Int2 Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicInt3 : BaseProperty 
 | 
{ 
 | 
    Int3 m_Value = Int3.zero; 
 | 
    public Int3 value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicInt3() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicInt3(Int3 value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public Int3 Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicDateTime : BaseProperty 
 | 
{ 
 | 
    DateTime m_Value = DateTime.MinValue; 
 | 
    public DateTime value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                if (this.m_Value != value) 
 | 
                { 
 | 
                    this.m_Value = value; 
 | 
                    this.dirty = true; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicDateTime() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicDateTime(DateTime value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public DateTime Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicEnum<T> : BaseProperty where T : struct 
 | 
{ 
 | 
    T m_Value; 
 | 
    public T value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                this.m_Value = value; 
 | 
                this.dirty = true; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicEnum(T value) 
 | 
    { 
 | 
        if (typeof(Enum) != typeof(T).BaseType) 
 | 
        { 
 | 
            throw new ArgumentException("参数必须是枚举类型!"); 
 | 
        } 
 | 
  
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public T Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicList<T> : BaseProperty 
 | 
{ 
 | 
    List<T> collect = new List<T>(); 
 | 
  
 | 
    public T this[int index] { get { return this.collect[index]; } } 
 | 
  
 | 
    public int Count { get { return collect.Count; } } 
 | 
  
 | 
    public void Add(T element) 
 | 
    { 
 | 
        collect.Add(element); 
 | 
        this.dirty = true; 
 | 
    } 
 | 
  
 | 
    public void AddRange(IList<T> elements) 
 | 
    { 
 | 
        collect.AddRange(elements); 
 | 
        this.dirty = true; 
 | 
    } 
 | 
  
 | 
    public void Remove(T element) 
 | 
    { 
 | 
        collect.Remove(element); 
 | 
        this.dirty = true; 
 | 
    } 
 | 
  
 | 
    public void RemoveAt(int index) 
 | 
    { 
 | 
        collect.RemoveAt(index); 
 | 
        this.dirty = true; 
 | 
    } 
 | 
  
 | 
    public bool Contains(T element) 
 | 
    { 
 | 
        return collect.Contains(element); 
 | 
    } 
 | 
  
 | 
    public void Clear() 
 | 
    { 
 | 
        collect.Clear(); 
 | 
        this.dirty = true; 
 | 
    } 
 | 
  
 | 
    public void Sort(Comparison<T> comparison) 
 | 
    { 
 | 
        collect.Sort(comparison); 
 | 
        this.dirty = true; 
 | 
    } 
 | 
  
 | 
    public List<T> Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.collect; 
 | 
    } 
 | 
  
 | 
} 
 | 
  
 | 
public sealed class LogicStruct<T> : BaseProperty where T : struct 
 | 
{ 
 | 
    T m_Value; 
 | 
    public T value { 
 | 
        get { return this.m_Value; } 
 | 
        set { 
 | 
            lock (this) 
 | 
            { 
 | 
                this.m_Value = value; 
 | 
                this.dirty = true; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public LogicStruct() 
 | 
    { 
 | 
    } 
 | 
  
 | 
    public LogicStruct(T value) 
 | 
    { 
 | 
        this.value = value; 
 | 
    } 
 | 
  
 | 
    public T Fetch() 
 | 
    { 
 | 
        this.dirty = false; 
 | 
        return this.m_Value; 
 | 
    } 
 | 
  
 | 
} 
 |