网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
06月07日漏签0天
吉里吉里吧 关注:51,144贴子:70,805
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 12回复贴,共1页
<<返回吉里吉里吧
>0< 加载中...

yesno方面的问题

  • 只看楼主
  • 收藏

  • 回复
  • 海乾苪嵩
  • 知府
    8
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我复制D大的yesnodialog.tjs结果出现这种情况这是怎么回事?我没有对mainwindow.tjs就行过修改。图片名字也全都对好了没写错。


  • 海乾苪嵩
  • 知府
    8
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
D大的源代码是
// YesNoDialog.tjs - はい/いいえを選択するダイアログボックス
// Copyright (C)2001-2006, W.Dee and contributors 改変&#12539;配布は自由です
class YesNoDialogWindow extends Window
{
var yesButton; // [はい] ボタン
var noButton; // [いいえ] ボタン
var result = false; // no:false yes:true
//添加临时层
var tempLayer;
property temporaryLayer
{
// ワークエリアとして一時的に使用できるレイヤを返す
getter()
{
if(tempLayer === void)
{
tempLayer = new KAGLayer(this, primaryLayer);
tempLayer.name = "一時ワークレイヤ";
}
return tempLayer;
}
}
function YesNoDialogWindow(message, cap)
{
super.Window();
// メインウィンドウから cursor**** の情報をとってくる
if(global.Window.mainWindow !== null &&
typeof global.Window.mainWindow.cursorDefault != "undefined")
this.cursorDefault = global.Window.mainWindow.cursorDefault;
if(global.Window.mainWindow !== null &&
typeof global.Window.mainWindow.cursorPointed != "undefined")
this.cursorPointed = global.Window.mainWindow.cursorPointed;
// 外見の調整
borderStyle = bsNone;
innerSunken = false;
caption = cap;
// プライマリレイヤの作成
add(new Layer(this, null));
// プライマリのマウスカーソルを設定
if(typeof this.cursorDefault !== "undefined")
primaryLayer.cursor = cursorDefault;
//不同询问窗口的底图
if (message=="是否退出?")
primaryLayer.loadImages("yn_exit_cn");
else if (message=="是否回到开始?")
primaryLayer.loadImages("yn_return_cn");
else
primaryLayer.loadImages("yn_bgd");
primaryLayer.setSizeToImageSize();
// 文字样式设定
primaryLayer.font.face="黑体";
primaryLayer.font.height=28;
var tw = primaryLayer.font.getTextWidth(message);
var th = primaryLayer.font.getTextHeight(message);
// サイズを決定
var max_tw = 0;
var sum_th = 0;
var messages = message.split('\n');
for (var i=0; i < messages.count; i++)
{
var lw = primaryLayer.font.getTextWidth(messages[i]);
var lh = primaryLayer.font.getTextHeight(messages[i]);
if (lw > max_tw)
max_tw = tw;
sum_th += lh + 0; // 行間が必要なら+0より大きくする
}
tw = max_tw;
th = sum_th;
var w =primaryLayer.width;
var h = primaryLayer.height;
setInnerSize(w, h);
primaryLayer.width = w;
primaryLayer.height = h;


2025-06-07 08:10:03
广告
  • 海乾苪嵩
  • 知府
    8
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
// ウィンドウ位置の調整
if(global.Window.mainWindow !== null && global.Window.mainWindow isvalid)
{
var win = global.Window.mainWindow;
var l, t;
l = ((win.width - width)>>1) + win.left;
t = ((win.height - height)>>1) + win.top;
if(l < 0) l = 0;
if(t < 0) t = 0;
if(l + width > System.screenWidth) l = System.screenWidth - width;
if(t + height > System.screenHeight) t = System.screenHeight - height;
setPos(l, t);
}
else
{
setPos((System.screenWidth - width)>>1, (System.screenHeight - height)>>1);
}
// message文字的描绘
var msgpos_y = 60;
if (message!="是否退出?" && message!="是否回到开始?")
{
for (var i=0; i < messages.count; i++)
{
var lw = primaryLayer.font.getTextWidth(messages[i]);
var lh = primaryLayer.font.getTextHeight(messages[i]);
var msgpos_x = (w - lw)\2;
primaryLayer.drawText(msgpos_x, msgpos_y, messages[i],0xFFFFFF);
msgpos_y += lh + 10; // 调整行间距
}
}
// Yesボタン
add(yesButton = new ButtonLayer(this, primaryLayer));
yesButton.loadButtons("yn_yes_cn_1.png","yn_yes_cn_2.png","yn_yes_cn_2.png");//确认按钮的图片
yesButton.top = 135;//调整按钮显示位置
yesButton.left = (primaryLayer.width/3)-(yesButton.width/2);//调整按钮显示位置
yesButton.visible = true;
// Noボタン
add(noButton = new ButtonLayer(this, primaryLayer));
noButton.loadButtons("yn_no_cn_1.png","yn_no_cn_2.png","yn_no_cn_2.png");//取消按钮的图片
noButton.top = 135;//调整按钮显示位置
noButton.left = (primaryLayer.width*2/3)-(yesButton.width/2);;//调整按钮显示位置
noButton.visible = true;
}
function finalize()
{
super.finalize(...);
}
function action(ev)
{
// action
if(ev.type == "onClick")
{
if(ev.target == yesButton)
{
result = true;
close();
}
else if(ev.target == noButton)
{
result = false;
close();
}
}
else if(ev.type == "onKeyDown" && ev.target === this)
{
// パッド入力に対応する処理
switch(ev.key)
{
case VK_PADLEFT:
yesButton.focus();
break;
case VK_PADRIGHT:
noButton.focus();
break;
case VK_PAD1:
if(focusedLayer == yesButton)
{
result = true;
close();
}
else if(focusedLayer == noButton)
{
result = false;
close();
}
break;
case VK_PAD2:
result = false;
close();
break;
}
}
}
function onKeyDown(key, shift)
{
super.onKeyDown(...);
if(key == VK_ESCAPE)
{
// ESC キーが押された
// 「いいえ」として処理
result = false;
close();
}
}
}
// Yes か No かはっきりさせる関数
function askYesNo(message, caption = "确认", yesFunc=void, noFunc=void, param=void, doneFunc=void)
{
var win = new YesNoDialogWindow(message, caption);
win.showModal();
var res = win.result;
invalidate win;
if (res) {
if (yesFunc !== void) {
yesFunc(param);
}
} else {
if (noFunc !== void) {
noFunc(param);
}
}
if (doneFunc !== void) {
doneFunc(param);
}
}


  • 幽叶怨
  • 藩台
    10
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
这是个没有找到yesno对象,是不是没有申明


  • 全局变量D
  • 藩台
    10
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
其实得先知道你用的啥版本……


  • 海乾苪嵩
  • 知府
    8
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
问题解决了。原来我修改过 mainwindow.tjs 我这记性,开头还说没改过这个文件。好尴尬。。。


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 12回复贴,共1页
<<返回吉里吉里吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示