UNPKG

@yuebai008/cli

Version:

Command line interface for rapid qg-minigame development

1 lines 3.62 kB
import*as Common from"../../core/common/common.js";export class ProfileHeader extends Common.ObjectWrapper.ObjectWrapper{profileTypeInternal;title;uid;fromFileInternal;tempFile;constructor(e,t){super(),this.profileTypeInternal=e,this.title=t,this.uid=e.incrementProfileUid(),this.fromFileInternal=!1,this.tempFile=null}setTitle(e){this.title=e,this.dispatchEventToListeners(Events.ProfileTitleChanged,this)}profileType(){return this.profileTypeInternal}updateStatus(e,t){this.dispatchEventToListeners(Events.UpdateStatus,new StatusUpdate(e,t))}createSidebarTreeElement(e){throw new Error("Not implemented.")}createView(e){throw new Error("Not implemented.")}removeTempFile(){this.tempFile&&this.tempFile.remove()}dispose(){}canSaveToFile(){return!1}saveToFile(){throw new Error("Not implemented.")}loadFromFile(e){throw new Error("Not implemented.")}fromFile(){return this.fromFileInternal}setFromFile(){this.fromFileInternal=!0}setProfile(e){}}export class StatusUpdate{subtitle;wait;constructor(e,t){this.subtitle=e,this.wait=t}}export var Events;!function(e){e.UpdateStatus="UpdateStatus",e.ProfileReceived="ProfileReceived",e.ProfileTitleChanged="ProfileTitleChanged"}(Events||(Events={}));export class ProfileType extends Common.ObjectWrapper.ObjectWrapper{idInternal;nameInternal;profiles;profileBeingRecordedInternal;nextProfileUidInternal;constructor(e,t){super(),this.idInternal=e,this.nameInternal=t,this.profiles=[],this.profileBeingRecordedInternal=null,this.nextProfileUidInternal=1,window.opener||window.addEventListener("unload",this.clearTempStorage.bind(this),!1)}typeName(){return""}nextProfileUid(){return this.nextProfileUidInternal}incrementProfileUid(){return this.nextProfileUidInternal++}hasTemporaryView(){return!1}fileExtension(){return null}get buttonTooltip(){return""}get id(){return this.idInternal}get treeItemTitle(){return this.nameInternal}get name(){return this.nameInternal}buttonClicked(){return!1}get description(){return""}isInstantProfile(){return!1}isEnabled(){return!0}getProfiles(){return this.profiles.filter(function(e){return this.profileBeingRecordedInternal!==e}.bind(this))}customContent(){return null}setCustomContentEnabled(e){}getProfile(e){for(let t=0;t<this.profiles.length;++t)if(this.profiles[t].uid===e)return this.profiles[t];return null}loadFromFile(e){let t=e.name;const r=this.fileExtension();r&&t.endsWith(r)&&(t=t.substr(0,t.length-r.length));const i=this.createProfileLoadedFromFile(t);return i.setFromFile(),this.setProfileBeingRecorded(i),this.addProfile(i),i.loadFromFile(e)}createProfileLoadedFromFile(e){throw new Error("Not implemented")}addProfile(e){this.profiles.push(e),this.dispatchEventToListeners(ProfileEvents.AddProfileHeader,e)}removeProfile(e){const t=this.profiles.indexOf(e);-1!==t&&(this.profiles.splice(t,1),this.disposeProfile(e))}clearTempStorage(){for(let e=0;e<this.profiles.length;++e)this.profiles[e].removeTempFile()}profileBeingRecorded(){return this.profileBeingRecordedInternal}setProfileBeingRecorded(e){this.profileBeingRecordedInternal=e}profileBeingRecordedRemoved(){}reset(){for(const e of this.profiles.slice())this.disposeProfile(e);this.profiles=[],this.nextProfileUidInternal=1}disposeProfile(e){this.dispatchEventToListeners(ProfileEvents.RemoveProfileHeader,e),e.dispose(),this.profileBeingRecordedInternal===e&&(this.profileBeingRecordedRemoved(),this.setProfileBeingRecorded(null))}}export var ProfileEvents;!function(e){e.AddProfileHeader="add-profile-header",e.ProfileComplete="profile-complete",e.RemoveProfileHeader="remove-profile-header",e.ViewUpdated="view-updated"}(ProfileEvents||(ProfileEvents={}));