Пример #1
0
    /** 添加场景角色 */
    public Role addRole(SceneRoleData data)
    {
        if (ShineSetting.openCheck)
        {
            if (_roleDic.contains(data.playerID))
            {
                Ctrl.throwError("场景角色重复添加", data.playerID);
                return(null);
            }
        }

        Role role = GameC.pool.rolePool.getOne();

        role.setData(data);
        role.setScene(_scene);

        role.enabled = true;

        _roleDic.put(role.playerID, role);

        if (role.playerID == GameC.player.role.playerID)
        {
            //设置
            _scene.setSelfRole(role);
        }

        role.init();

        onAddRole(role);

        return(role);
    }
Пример #2
0
    private CachePageData getCachePageData(int subsectionIndex, int subsectionSubIndex)
    {
        long cacheKey = getCacheKey(subsectionIndex, subsectionSubIndex);

        CachePageData cachePageData;

        if (!_cachePageDataMap.contains(cacheKey))
        {
            _cachePageDataMap.put(cacheKey, cachePageData = new CachePageData());
            cachePageData.subsectionIndex    = subsectionIndex;
            cachePageData.subsectionSubIndex = subsectionSubIndex;
        }
        else
        {
            cachePageData = _cachePageDataMap.get(cacheKey);
        }

        return(cachePageData);
    }