public bool AddBuffer(EntityModel attackerModel)
    {
        //  不附件状态
        string buffType = attackerModel.buffType;

        if (buffType == null || buffType == Constants.EMPTY)
        {
            return(false);
        }

        //  初始化
        if (m_buffers == null)
        {
            m_buffers      = new List <GameBuffer>();
            m_buffTypes    = new Dictionary <string, GameBuffer>();
            m_delayRemoved = new List <GameBuffer>();
        }

        //  相同状态新的状态替换旧的状态
        if (m_buffTypes.ContainsKey(buffType))
        {
            var buf = m_buffTypes[buffType];
            buf.Destroy();
            m_buffTypes.Remove(buffType);
            m_buffers.Remove(buf);
        }

        //  添加到列表并标记
        var buff = new GameBuffer(Entity, attackerModel, buffType);

        m_buffers.Add(buff);
        m_buffTypes.Add(buffType, buff);
        return(true);
    }
Beispiel #2
0
        public GameBuffer ReadFile(string filename)
        {
            var path_filename = System.IO.Path.Combine(external_path, filename);

            universalApp.LogInfo(string.Format("UFS->ReadFile:{0}", path_filename));

            GameBuffer buffer = null;

            if (universalApp.GetCache().Exists(path_filename))
            {
                File file = universalApp.GetCache().GetFile(path_filename, true);
                universalApp.LogInfo(string.Format("UFS->ReadFile()->file_size:{0}", file.GetSize()));
                int        f_size = (int)file.GetSize();
                UCharArray uch    = new UCharArray(f_size);
                buffer = new GameBuffer(f_size);

                file.ReadBinary(uch);
                file.Close();
                buffer.bytes = uch.ToArray();

                universalApp.LogInfo(string.Format("UFS->ReadFile()->buffer_length:{0}", buffer.bytes.Length));
            }
            else
            {
                universalApp.LogError(string.Format("filename does not exists:{0}", universalApp));
            }
            return(buffer);
        }
Beispiel #3
0
        public string[] ConvertBinToStringLine(GameBuffer buffer)
        {
            var lines = new List <string>();

            if (buffer != null)
            {
                while (buffer.getLength() < buffer.bytes.Length)
                {
                    lines.Add(buffer.readUnformatedString());
                }
            }
            return(lines.ToArray());
        }
Beispiel #4
0
 public void SaveFile(string filename, GameBuffer buffer)
 {
     //
 }