示例#1
0
 //位置保存到SDK里
 public void SaveSubmrainePos()
 {
     //byte data;
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     System.IO.BinaryWriter bw = new System.IO.BinaryWriter(ms);
     bw.Write(m_SubmarinePos);
     bw.Write(PlayerRole.Instance.RoleInfo.RoleMe.GetUserID());
     RuntimeInfo.SaveLocalFile(RuntimeInfo.GetSubmarinePosFileName(), ms.ToArray());
     bw.Close();
 }
示例#2
0
    public bool LoadSubmarinePos()
    {
        //读取SD卡的潜艇位置
        byte[] data = RuntimeInfo.GetLocalFile(RuntimeInfo.GetSubmarinePosFileName());
        if (data == null)
        {
            return(false);
        }

        System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
        System.IO.BinaryReader br = new System.IO.BinaryReader(ms);
        m_SubmarinePos = br.ReadByte();
        uint UserID = br.ReadUInt32();

        //m_SubmarinePos = data[0];

        if (UserID != PlayerRole.Instance.RoleInfo.RoleMe.GetUserID())
        {
            return(false);
        }
        return(true);
    }