同步官网文档8m_25d
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
front:
|
||||
front:
|
||||
hard: 入门
|
||||
time: 分钟
|
||||
sidebarDepth: 4
|
||||
@@ -115,7 +115,7 @@ bookManager = clientApi.GetBookManager()
|
||||
bookManager = clientApi.GetBookManager()
|
||||
# 获取书本配置常量
|
||||
bcf = bookManager.GetBookConfig()
|
||||
print bcf.TextSize.content # 输出正常文本的字体大小值 10
|
||||
print bcf.TextSize.content # 输出正常文本的字体大小值 10
|
||||
```
|
||||
|
||||
### GetBookInstance
|
||||
@@ -193,11 +193,11 @@ bookManager = clientApi.GetBookManager()
|
||||
- 返回值
|
||||
|
||||
无
|
||||
|
||||
|
||||
- 示例
|
||||
|
||||
可见[CustomBookMod](../../13-模组SDK编程/60-Demo示例.md#CustomBookMod)中的**behavior_pack/tutorialScripts/pages/buttonPage.py**这一自定义页面的这块代码,这里实现的功能就是点击按钮后在按钮的中心位置显示文本信息。
|
||||
|
||||
|
||||
```python
|
||||
def ShowMsg(self, msg):
|
||||
# 获取所有书本得管理对象
|
||||
@@ -337,11 +337,11 @@ bookManager = clientApi.GetBookManager()
|
||||
```python
|
||||
def GoToPage(self, addr):
|
||||
# 获取所有书本得管理对象
|
||||
bookManager = clientApi.GetBookManager()
|
||||
bookManager = clientApi.GetBookManager()
|
||||
# 跳转到地址
|
||||
bookManager.To(addr)
|
||||
```
|
||||
|
||||
|
||||
备注
|
||||
|
||||
- 只能在打开的书本中进行跳转,无法从一本书中的页面跳转到另外一本书的页面,其他跳转均是允许的,比如同章节内跳转,章节跳转到目录等等。
|
||||
@@ -381,15 +381,15 @@ bookManager = clientApi.GetBookManager()
|
||||
TextComp = bookManager.GetTextCompCls()
|
||||
# 获取预设组件类 ImageComp
|
||||
ImageComp = bookManager.GetImageCompCls()
|
||||
|
||||
|
||||
# 自定义的一个Page
|
||||
class MyTitlePage(TitlePage):
|
||||
def __init__(self, size = None, position = None):
|
||||
# 调用父类同名方法,TitlePage 会自动添加标题组件以及提供标题组件注入数据的方法,排版的方法。
|
||||
TitlePage.__init__(self, size, position)
|
||||
self.content1 = TextComp(bcf.TextAlign.Left)
|
||||
self.image = ImageComp()
|
||||
self.content2 = TextComp(bcf.TextAlign.Left)
|
||||
self.content1 = TextComp(bcf.TextAlign.Left)
|
||||
self.image = ImageComp()
|
||||
self.content2 = TextComp(bcf.TextAlign.Left)
|
||||
self.AddComps(self.content1, self.image, self.content2)
|
||||
```
|
||||
|
||||
@@ -648,7 +648,7 @@ bookInstance = bookManager.GetBookInstance("customBook") # 获取书本名称为
|
||||
- 返回值
|
||||
|
||||
无
|
||||
|
||||
|
||||
- 示例
|
||||
|
||||
```python
|
||||
@@ -872,9 +872,9 @@ bookInstance = bookManager.GetBookInstance("customBook") # 获取书本名称为
|
||||
bookInstance = clientApi.GetBookManager().GetBookInstance("customBook") # 获取书本名称为"customBook"的书本管理对象
|
||||
if bookInstance:
|
||||
# 比如获取一个identifier为"pages"的目录对象,它的父页组为"customBook"这个Book对象
|
||||
categoryObj_1 = bookInstance.GetCategory("pages")
|
||||
categoryObj_1 = bookInstance.GetCategory("pages")
|
||||
# 比如获取一个identifier为"subcategory1"的目录对象,它的父页组为"subcategoryTest"这个Category对象,这就是一个嵌套的例子
|
||||
categoryObj_2 = bookInstance.GetCategory("subcategory1")
|
||||
categoryObj_2 = bookInstance.GetCategory("subcategory1")
|
||||
if categoryObj_1:
|
||||
print categoryObj_1.GetParent().name # 输出 "customBook"
|
||||
if categoryObj_2:
|
||||
@@ -982,7 +982,7 @@ bookInstance = bookManager.GetBookInstance("customBook") # 获取书本名称为
|
||||
# 比如获取书本当前的解锁进度,如果书本下有两个已经解锁的一级子目录,那么其解锁进度为100%,如果一个解锁一个未解锁,则为50%
|
||||
import mod.client.extraClientApi as clientApi
|
||||
bookInstance = clientApi.GetBookManager().GetBookInstance("customBook") # 获取书本名称为"customBook"的书本管理对象
|
||||
if bookInstance:
|
||||
if bookInstance:
|
||||
categoryObj = bookInstance.GetCategory("pages")
|
||||
if categoryObj:
|
||||
# 获取 identifier 为"pages"的目录的解锁进度
|
||||
@@ -1099,7 +1099,7 @@ bookInstance = bookManager.GetBookInstance("customBook") # 获取书本名称为
|
||||
bookInstance = clientApi.GetBookManager().GetBookInstance("customBook") # 获取书本名称为"customBook"的书本管理对象
|
||||
if bookInstance:
|
||||
entryObj = bookInstance.GetEntry("entityEntry")
|
||||
if entryObj:
|
||||
if entryObj:
|
||||
# 给 identifier 为"entityEntry"的目录解锁
|
||||
entryObj.Unlock()
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user