コード例 #1
0
    /// <summary>
    /// 可视数据表删除行入口
    /// </summary>
    /// <param name="strRecordName">表名</param>
    /// <param name="nRow">行号</param>
    public override void on_record_remove_row(string strRecordName, int nRow)
    {
        Game game = Game.Instance;

        if (game == null || game.mGameClient == null)
        {
            return;
        }
        IGameObj record = null;

        if (role)
        {
            record = game.mGameClient.GetCurrentPlayer();
        }
        else
        {
            record = GameSceneManager.mScene;
        }
        if (record == null)
        {
            return;
        }
        int iRows = record.GetRecordRows(strRecordName);

        if (nRow >= 0 && nRow <= iRows)
        {
            int len = m_data.Count;
            if (nRow >= len)
            {
                LogSystem.LogError("on_record_remove_row:", strRecordName, " Data.Count is ", len, " but Server send RemoveAt ", nRow);
            }
            else
            {
                T item = m_data[nRow];
                m_data.RemoveAt(nRow);
                SendCallFunc(RecordMode.REMOVE, this, item, nRow);
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// 可视数据表改变一行中的分列入口
    /// </summary>
    /// <param name="strRecordName">表名</param>
    /// <param name="nRow">行号</param>
    /// <param name="nCol">列号</param>
    public override void on_record_single_grid(string strRecordName, int nRow, int nCol)
    {
        Game game = Game.Instance;

        if (game == null || game.mGameClient == null)
        {
            return;
        }
        IGameObj record = null;

        if (role)
        {
            record = game.mGameClient.GetCurrentPlayer();
        }
        else
        {
            record = GameSceneManager.mScene;
        }
        if (record == null)
        {
            return;
        }
        int iRows = record.GetRecordRows(m_recordName);

        if (nRow >= 0 && nRow <= iRows)
        {
            int len = m_data.Count;
            if (nRow >= len)
            {
                LogSystem.LogError("on_record_single_grid:", strRecordName, " Data.Count is ", len, " but Server send Grid ", nRow);
            }
            else
            {
                ReadItemData(nRow, m_data[nRow], record);
                SendCallFunc(RecordMode.UPDATE, this, m_data[nRow], nRow);
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// 可视数据表添加行入口
    /// </summary>
    /// <param name="strRecordName">表名</param>
    /// <param name="nRow">添加的起始行</param>
    /// <param name="nRows">添加的行数</param>
    public override void on_record_add_row(string strRecordName, int nRow, int nRows)
    {
        Game game = Game.Instance;

        if (game == null || game.mGameClient == null)
        {
            return;
        }
        IGameObj record = null;

        if (role)
        {
            record = game.mGameClient.GetCurrentPlayer();
        }
        else
        {
            record = GameSceneManager.mScene;
        }
        if (record == null)
        {
            return;
        }
        int rows = record.GetRecordRows(m_recordName);

        for (int i = 0; i < nRows; i++)
        {
            int iRow = nRow + i;

            if (iRow < rows)
            {
                T item = System.Activator.CreateInstance <T>();
                ReadItemData(iRow, item, record);
                m_data.Add(item);
                SendCallFunc(RecordMode.ADD, this, item, iRow);
            }
        }
    }