/********************************
 *
 * 作者:吴隆健
 * 创建时间: 2019/7/8 13:26:08
 * 
 ********************************/

using System;

namespace GameData {

    /// <summary>
    /// 服务器节点
    /// </summary>
    //[ProtoBuf.ProtoContract]
#pragma warning disable CS0659 // 类型重写 Object.Equals(object o)，但不重写 Object.GetHashCode()
    public class ServerNode {
#pragma warning restore CS0659 // 类型重写 Object.Equals(object o)，但不重写 Object.GetHashCode()
        /// <summary>
        /// 模块id  大系统的编号
        /// </summary>
        //[ProtoBuf.ProtoMember(1)]
        public int id;

        /// <summary>
        /// 节点编号  集群中的编号
        /// </summary>
        //[ProtoBuf.ProtoMember(2)]
        public int nodeNum;

        /// <summary>
        /// 是否暂停
        /// </summary>
        //[ProtoBuf.ProtoMember(3)]
        public bool ispause = false;

        /// <summary>
        /// 
        /// </summary>
        public ServerNode() {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="nodeNum"></param>
        public ServerNode(int moduleId, int nodeNum) {
            this.id = moduleId;
            this.nodeNum = nodeNum;
        }

        /// <summary>
        /// 比较数据是否相同
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj) {
            if (obj == null)
                return false;
            ServerNode node = obj as ServerNode;
            if (node == null)
                return false;
            return node.id == this.id && node.nodeNum == this.nodeNum&&node.ispause ==this.ispause;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string ToString() {
            if (ispause)
                return "id:" + id + ",nodeNum:" + nodeNum + ",暂停";
            else
                return "id:" + id + ",nodeNum:" + nodeNum;
        }
    }
}