Set Functions - GenbuHase/GUI-Helper-Official-Repository GitHub Wiki

GUI Helper Reference Guide === セット関数(GUIHelper.Set.*)

関数リスト

関数名 引数
CreateGUI -------------------------
DeleteGUI int ID
DeleteAllGUI -------------------------
SetOnPopUpWindow int ID, Widget Content, int XSize, int YSize,
Align XAlign, Align YAlign, int XPosition, int YPosition
ShowDialog int ID, String Title, Widget Content
ShowAlertDialog int ID, String Title, String Message,
String YesText, String CancelText, String NoText,
function YesFuc, function CancelFuc, function NoFuc,
Boolean IsCancelable

CreateGUI

1. 概要

GUIを定義するために初期化します。
これを書かないとエラーが出てしまうので必ず実行してください

2. 引数一覧

CreateGUI(Content);

Content:Function型

3. For Example

function newLevel() {
	with (GUIHelper) {
		with (GUIHelper.Set) {
			with (GUIHelper.Property) {
				CreateGUI(function() {
					SetOnPopUpWindow(0,
						AddButton(0, "For Example", Size.Wrap, Color.White, function() {
							clientMessage("例コード");
						}, function() {
							
						})
					, Size.Wrap, Size.Wrap, Align.Right, Align.Center, 0, 0);
				});
			}
		}
	}
}

DeleteGUI

1. 概要

指定したIDのGUIを消去します。
尚、SetOnPopUpWindow関数を実行したGUIのみを対象とします。

2. 引数一覧

DeleteGUI(ID);

ID:int型

3. For Example

function newLevel() {
	with (GUIHelper) {
		with (GUIHelper.Set) {
			with (GUIHelper.Property) {
				CreateGUI(function() {
					SetOnPopUpWindow(0,
						AddButton(0, "For Example", Size.Wrap, Color.White, function() {
							clientMessage("例コード");
						}, function() {
							
						})
					, Size.Wrap, Size.Wrap, Align.Right, Align.Center, 0, 0);
				});
			}
		}
	}
}

function leaveGame() {
	DeleteGUI(0);
}

DeleteAllGUI

1. 概要

全てのGUIを消去します。
尚、SetOnPopUpWindow関数を実行したGUIのみを対象とします。

2. 引数一覧

DeleteAllGUI();

3. For Example

function newLevel() {
	with (GUIHelper) {
		with (GUIHelper.Set) {
			with (GUIHelper.Property) {
				CreateGUI(function() {
					SetOnPopUpWindow(0,
						AddButton(0, "ボタン増殖", 10, Color.White, function() {
							i++;
							
							SetOnPopUpWindow(i,
								AddButton(i, i.toString(), 10, Color.Blue, function() {
									
								}, function() {
									
								})
							, Size.Wrap, 100, Align.Right, Align.Top, 0, 100 * i);
						}, function() {
							
						})
					, Size.Wrap, 100, Align.Right, Align.Top, 0, 0);
				});
			}
		}
	}
}

function leaveGame() {
	with (GUIHelper) {
		with (GUIHelper.Set) {
			with (GUIHelper.Property) {
				DeleteAllGUI();
			}
		}
	}
}

SetOnPopUpWindow

1. 概要

設定されたGUIを画面に表示します。
消去処理をしない限りは画面に残ります

なのでワールド退出の時などにはDeleteGUI関数を実行してください。

2. 引数一覧

SetOnPopUpWindow(ID, Content, Width, Height, XAlign, YAlign, XPosition, YPosition);

ID:int型
Content:Widget型
Width:int型
Height:int型
XAlign:Align型
YAlign:Align型
XPosition:int型
YPosition:int型

3. For Example

function newLevel() {
	with (GUIHelper) {
		with (GUIHelper.Set) {
			with (GUIHelper.Property) {
				CreateGUI(function () {
					SetOnPopUpWindow(0, 
						AddButton(0, "(´・ω・`)", 10, Color.Magenta, function () {
							clientMessage("(´・ω・`)");
						}, function () {
							
						})
					, Size.Wrap, Size.Wrap, Align.Right, Align.Center, 0, 0);
				});
			}
		}
	}
}

ShowDialog

1. 概要

MineCraft PE内にダイアログを呼び出します。
これに付きましては、DeleteGUI関数を呼び出す必要がありません。(エラーを吐きます)

2. 引数一覧

ShowDialog(ID, Title, Content);

ID:int型
Title:String型
Content:Widget型

3. For Example

function newLevel() {
	with (GUIHelper) {
		with (GUIHelper.Set) {
			with (GUIHelper.Property) {
				CreateGUI(function () {
					SetOnPopUpWindow(0, 
						AddButton(0, "(´・ω・`)", 10, Color.Magenta, function () {
							ShowDialog(0, "(´・ω・`)ショボボボーン", 
								AddLinearLayout(0, "Vertical", [
									AddEditText(1, "", Color.White, Color.Red)
								])
							);
						}, function () {
							
						})
					, Size.Wrap, Size.Wrap, Align.Right, Align.Center, 0, 0);
				});
			}
		}
	}
}
⚠️ **GitHub.com Fallback** ⚠️