Skip to content

Commit

Permalink
[2.0.17] 확장블록 변경된 로직 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
extracold1209 authored and entrydev committed Jan 28, 2020
1 parent 3da64c6 commit fe198dd
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 4,524 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"browser": true
},
"globals": {
"Entry": true
"Entry": true,
"Lang": true,
"entrylms": true,
},
"rules": {
"no-console": "off",
Expand Down
47 changes: 36 additions & 11 deletions src/renderer/helper/entry/entryModalHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,24 +403,49 @@ class EntryModalHelper {
* 확장블록 리스트를 가져와, 확장블록 추가 팝업을 노출한다.
*/
static async showExpansionPopup() {
let expansionBlocks = _.uniq(_.values(Entry.EXPANSION_BLOCK_LIST));
expansionBlocks = _.sortBy(expansionBlocks, function(item) {
const expansionBlocks = this._getActiveExpansionBlocks();

await this._switchPopup('expansion', {
submit: (data: any) => {
this._addExpansionBlocks(data.selected);
},
itemoff: ({ data, callback }: { data: any; callback?: () => void }) => {
const isActive = Entry.expansion.isActive(data.name);
if (!isActive) {
callback && callback();
} else {
entrylms.alert(Lang.Workspace.deselect_expansion_block_warning);
}
},
itemon: ({ callback }: { callback?: () => void }) => {
callback && callback();
},
}, expansionBlocks as any);
}

static _getActiveExpansionBlocks() {
const activated = Entry.expansionBlocks;
const expansionBlocks = _.uniq(_.values(Entry.EXPANSION_BLOCK_LIST)).map((item) => {
item.active = activated.includes(item.name);
return item;
});
return _.sortBy(expansionBlocks, (item) => {
let result = '';
if (item.title) {
item.nameByLang = item.title[RendererUtils.getLangType() || 'ko'];
item.nameByLang = item.title[Lang.type];
result = item.title.ko.toLowerCase();
}
return result;
});
}

await this._switchPopup('expansion', {
submit: (data: any) => {
Entry.playground.addExpansionBlocks(data.selected);
},
select: (data: any) => {
Entry.playground.addExpansionBlocks(data.item);
},
}, expansionBlocks as any);
static _addExpansionBlocks(blocks: any) {
const addBlocks = blocks.filter(({ name }: { name: string }) => !Entry.expansionBlocks.includes(name));
const removeBlocks = this._getActiveExpansionBlocks()
.filter((item) => item.active)
.filter((item) => !blocks.includes(item));
Entry.playground.addExpansionBlocks(addBlocks);
Entry.playground.removeExpansionBlocks(removeBlocks);
}

/**
Expand Down
825 changes: 73 additions & 752 deletions src/renderer/resources/lang/code.json

Large diffs are not rendered by default.

829 changes: 75 additions & 754 deletions src/renderer/resources/lang/ebs.json

Large diffs are not rendered by default.

821 changes: 71 additions & 750 deletions src/renderer/resources/lang/en.json

Large diffs are not rendered by default.

821 changes: 71 additions & 750 deletions src/renderer/resources/lang/jp.json

Large diffs are not rendered by default.

829 changes: 75 additions & 754 deletions src/renderer/resources/lang/ko.json

Large diffs are not rendered by default.

821 changes: 71 additions & 750 deletions src/renderer/resources/lang/vn.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare type Point = {
y: number;
};

declare namespace NodeJS {
declare namespace NodeJS {
// noinspection JSUnusedGlobalSymbols
interface Global {
sharedObject: GlobalConfigurations;
Expand All @@ -21,8 +21,11 @@ declare namespace NodeJS {
declare interface Window {
createjs: any;
EntryStatic: any;
Lang: any;
}

declare var entrylms: any;
declare var Lang: any;
declare var createjs: any;
declare var EntryStatic: any;

Expand Down Expand Up @@ -126,7 +129,8 @@ declare module IEntry {
* 하드웨어가 연결되면 필요여부에 따라 프로퍼티패널에 하드웨어 모니터가 노출됨
*/
export interface HardwareMonitor {
new (hwModule: HardwareModule): HardwareMonitor;
new(hwModule: HardwareModule): HardwareMonitor;

initView: () => void;
generateView: () => void;
generateListView: () => void;
Expand All @@ -138,6 +142,7 @@ declare module IEntry {
enum WorkspaceMode {
MODE_BOARD, MODE_VIMBOARD, MODE_OVERLAYBOARD
}

export type Project = {
name: string;
script: any & {
Expand Down Expand Up @@ -184,6 +189,7 @@ declare module IEntry {

export interface Container {
getAllObjects(): any[];

addObject: (objectModel: any, ...rest: number[]) => any;
getObject: (objectId: string) => IEntry.Object;
cachePicture: (pictureId: string, image: any) => void;
Expand Down Expand Up @@ -212,6 +218,7 @@ declare module IEntry {
downloadSound: (soundId: string) => void;
changeViewMode: (viewType: PlaygroundViewMode) => void;
addExpansionBlocks: (expansionInfoList: any[]) => void;
removeExpansionBlocks: (expansionInfoList: any[]) => void;
painter: Painter;
setMenu?: (...args: any[]) => any;
board: any;
Expand Down Expand Up @@ -313,6 +320,7 @@ declare class Entry {
static stage: IEntry.Stage;
static toast: IEntry.ToastLegacy;
static Func: any;
static expansionBlocks: any[];

// 엔트리 네임스페이스에 할당되어있는 특정 함수들
static generateHash: () => string;
Expand Down

0 comments on commit fe198dd

Please sign in to comment.