olympus-r-17plugins
Version:
A plugin of Olympus for 17zuoye.
94 lines (88 loc) • 3.06 kB
text/typescript
import { EgretMediatorClass } from "olympus-r-egret/egret/injector/Injector";
import PanelMediator from "olympus-r/engine/panel/PanelMediator";
import IPromptPanel, { IPromptParams, ButtonType } from "olympus-r/engine/panel/IPromptPanel";
import { DOMMediatorClass } from "olympus-r-dom/dom/injector/Injector";
import { BindValue, BindOn, BindFor, BindIf } from "olympus-r/engine/injector/Injector";
export class DOMPrompt extends PanelMediator implements IPromptPanel
{
public btn_close:HTMLElement;
public itm_title:HTMLElement;
public txt_title:HTMLElement;
public txt_content:HTMLElement;
public lst_buttons:HTMLElement;
public onOpen():void
{
this.viewModel = {
params: {
title: null,
msg: null,
handlers: []
},
handleButtonLeft: function(index:number):string
{
switch(this.params.handlers.length)
{
case 0:
return "0%";
case 1:
return "50%";
default:
return (28 + 44 * index) + "%";
}
}
};
}
public update(params:IPromptParams):void
{
this.viewModel.params = params;
}
}
export class EgretPrompt extends PanelMediator implements IPromptPanel
{
public txt_title:eui.Label;
public txt_content:eui.Label;
public btn_close:eui.Button;
public lst_buttons:eui.DataGroup;
public onOpen():void
{
this.viewModel = {
// 这里列出所有被绑定的属性
msg: null,
title: null,
handlers: null
};
}
public update(params:IPromptParams):void
{
for(let key in params)
{
this.viewModel[key] = params[key];
}
}
}