Пример #1
0
    /// <summary>
    /// 可视数据表添加行入口
    /// </summary>
    /// <param name="args"></param>

    virtual public void on_record_add_row(string strRecordName, int nRow, int nRows)
    {
        IGameSceneObj roleObj = ObjectManager.GetRoleDataObj();

        if (roleObj == null)
        {
            return;
        }

        for (int i = 0; i < nRows; i++)
        {
            int iRow = nRow + i;
            int rows = roleObj.GetRecordRows(m_recordName);
            if (iRow < rows)
            {
                object data = GetDataItem();
                ReadItemData(iRow, data, roleObj);
                m_data.Add(data);
            }
        }

        if (m_callFunction != null)
        {
            m_callFunction(this);
        }
    }
Пример #2
0
    /// <summary>
    /// 可视数据表删除行入口
    /// </summary>
    /// <param name="args"></param>

    virtual public void on_record_remove_row(string strRecordName, int nRow)
    {
        IGameSceneObj roleObj = ObjectManager.GetRoleDataObj();

        if (roleObj == null)
        {
            return;
        }

        int iRows = roleObj.GetRecordRows(strRecordName);

        if (nRow >= 0 && nRow <= iRows)
        {
            m_data.RemoveAt(nRow);
        }

        m_callFunction(this);
    }
Пример #3
0
    /// <summary>
    /// 读取数据
    /// </summary>

    public int QueryData()
    {
        m_data.Clear();
        IGameSceneObj roleobj = ObjectManager.GetRoleDataObj();

        if (roleobj == null)
        {
            return(0);
        }

        int rows = roleobj.GetRecordRows(m_recordName);

        for (int i = 0; i < rows; i++)
        {
            on_record_add_row(m_recordName, i, 1);
        }

        return(rows);
    }
Пример #4
0
    /// <summary>
    /// 可视数据表改变一行中的分列入口
    /// </summary>
    /// <param name="args"></param>

    virtual public void on_record_single_grid(string strRecordName, int nRow, int nCol)
    {
        IGameSceneObj roleObj = ObjectManager.GetRoleDataObj();

        if (roleObj == null)
        {
            return;
        }

        int iRows = roleObj.GetRecordRows(m_recordName);

        if (nRow >= 0 && nRow <= iRows)
        {
            ReadItemData(nRow, m_data[nRow], roleObj);

            if (m_callFunction != null)
            {
                m_callFunction(this);
            }
        }
    }
Пример #5
0
 /// <summary>
 /// 读取指定行数据
 /// </summary>
 /// <param name="index"></param>
 /// <param name="item"></param>
 virtual protected void ReadItemData(int row, object item, IGameSceneObj record)
 {
 }
Пример #6
0
    public static void CallAddObject(string strIdent)
    {
        try
        {
            Game game = Game.Instance;
            if (game == null || game.mGameClient == null)
            {
                return;
            }

            IGameSceneObj sceneObj = game.mGameClient.GetSceneObj(strIdent);
            if (sceneObj == null)
            {
                return;
            }

            IObject cObj = null;
            int     type = 0;
            if (!sceneObj.QueryPropInt("ObjectType", ref type))
            {
                LogSystem.Log("could not find type : ", strIdent);

                return;
            }

            string strModel = string.Empty;
            if (!sceneObj.QueryPropString("ResourcePath", ref strModel))
            {
                LogSystem.Log("could not find ResourcePath : ", strIdent);

                return;
            }

            ObjectType ObjType = (ObjectType)type;

            switch (ObjType)
            {
            case ObjectType.ObjectType_Player:
                if (game.mGameClient.IsPlayer(strIdent))
                {
                    cObj = new CRoleObject();
                    ObjectManager.mRole = cObj as CRoleObject;
                }
                else
                {
                    cObj = new CPlayerObject();
                }
                break;

            case ObjectType.ObjectType_Npc:
                cObj = new CNpcObject();
                break;

            case ObjectType.ObjectType_Monster:
                cObj = new CMonsterObject();
                break;

            case ObjectType.ObjectType_Soldier:
            case ObjectType.ObjectType_Creeps:

                break;

            case ObjectType.ObjectType_Born:
                break;
            }

            if (cObj != null)
            {
                cObj.mObjectType   = ObjType;
                cObj.mGameSceneObj = sceneObj;
                cObj.mObjectRes    = strModel;
                cObj.mStrIdent     = strIdent;
                cObj.OnAddObject();
                ObjectManager.AddObject(strIdent, cObj);
                if (cObj is CRoleObject)
                {
                    //GUIManager.CacheView<CharacterPanel>();
                    //GUIManager.CacheView<PlayerMainViewPanel>();
                    //GUIManager.CacheView<PlayerControlPanel>();
                    //GUIManager.CacheView<PlayerStatePanel>();
                    //GUIManager.CacheView<PlayerMapControlPanel>();
                    //GUIManager.CacheView<MainChatPanel>();

                    // 添加到主角的AOI中
                }
                else
                {
                    RangeTools.MotifyObjectAoi(mRole, cObj);
                }
            }
        }
        catch (System.Exception ex)
        {
            LogSystem.LogError("on_add_object catch error", ex.ToString());
        }
    }