-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shared focus dependency parsing (增加国策树渲染时的共享国策依赖解析) #97
Conversation
src/util/dependency.ts
Outdated
@@ -30,6 +32,27 @@ export function getDependenciesFromText(text: string): Dependency[] { | |||
match = regex.exec(text); | |||
} | |||
|
|||
if (sharedFocusIndex){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议直接改 getDependenciesFromText 这个函数,这个函数是所有preview共用的。
比较好的做法是去改 previewdef/focustree/loader.ts。
而且相比用正则匹配,你可以用 convertNodeToJson() 这个方法得到比较准确的值。这样可以避免有人在注释里面或者文本里面写 shared_focus = blabla。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦哦我给忘了,之前看数据的时候看到了focuses里有shared focus的键来着
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把增量解析依赖文件的逻辑改到previewdef/focustree/loader.ts里了
src/previewdef/focustree/loader.ts
Outdated
@@ -17,7 +19,25 @@ export class FocusTreeLoader extends ContentLoader<FocusTreeLoaderResult> { | |||
if (error || (content === undefined)) { | |||
throw error; | |||
} | |||
|
|||
|
|||
const file = convertFocusFileNodeToJson(parseHoi4File(content, localize('infile', 'In file {0}:\n', this.file)),{}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的constants需要和49行的传同一个实例
src/previewdef/focustree/loader.ts
Outdated
} | ||
const filePath = findFileByFocusKey(sharedFocus); | ||
if (filePath){ | ||
if(dependencies.findIndex((item) => item.path === filePath) === -1){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if () {
这里需要加适当的空格
嗯嗯,以上的问题都改完了。 |
Controlled by
sharedFocusIndex
feature flag, default istrue
由
sharedFocusIndex
feature flag控制,默认为true