Esempio n. 1
0
 public bool AddSubPlayer(UInt32 nAccId, UInt32 nIndex)
 {
     for (int i = 0; i < m_UidAttrList.Count; i++)
     {
         if (m_UidAttrList[i].nAccId == nAccId)
         {
             UidAttr newAttr = new UidAttr();
             newAttr = m_UidAttrList[i];
             if (newAttr.nPlayer1Index == 0)
             {
                 newAttr.nPlayer1Index = nIndex;
             }
             else if (newAttr.nPlayer2Index == 0)
             {
                 newAttr.nPlayer2Index = nIndex;
             }
             else if (newAttr.nPlayer3Index == 0)
             {
                 newAttr.nPlayer3Index = nIndex;
             }
             else
             {
                 return(false);
             }
             m_UidAttrList[i] = newAttr;
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
        public bool AddPlayerUid(UInt32 nAccId, UInt32 uid, UInt32 playerIndex)
        {
            UidAttr newAttr = new UidAttr();

            newAttr.nAccId        = nAccId;
            newAttr.nUid          = uid;
            newAttr.nPlayer1Index = playerIndex;
            newAttr.nPlayer2Index = 0;
            newAttr.nPlayer3Index = 0;

            m_UidAttrList.Add(newAttr);

            return(true);
        }
Esempio n. 3
0
        public bool LoadInfo()
        {
            m_UidAttrList.Clear();

            if (!File.Exists(m_Forder + @"\\uid.dat"))
            {
                return(false);
            }


            FileStream fs = new FileStream(m_Forder + @"\\uid.dat", FileMode.Open, FileAccess.ReadWrite);

            int     ret = 0;
            UidHead ts  = new UidHead();

            byte[] _bytData = new byte[Marshal.SizeOf(ts)];

            ret = fs.Read(_bytData, 0, _bytData.Length);
            if (ret > 0) //记录头
            {
                m_UidHead = CStructBytesFormat.rawDeserialize <UidHead>(_bytData);
            }
            while (ret > 0)
            {
                UidAttr ts2            = new UidAttr();
                byte[]  bytAccAttrData = new byte[Marshal.SizeOf(ts2)];

                ret = fs.Read(bytAccAttrData, 0, bytAccAttrData.Length);
                if (ret <= 0)
                {
                    break;
                }

                ts2         = CStructBytesFormat.rawDeserialize <UidAttr>(bytAccAttrData);
                m_lastUid   = (UInt32)ts2.nUid;
                m_lastAccId = (UInt32)ts2.nAccId;

                m_UidAttrList.Add(ts2);
            }

            fs.Close();

            return(true);
        }