本文整理汇总了C#中Dialog.addOption方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.addOption方法的具体用法?C# Dialog.addOption怎么用?C# Dialog.addOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialog
的用法示例。
在下文中一共展示了Dialog.addOption方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInspectorGUI
public override void OnInspectorGUI()
{
dialog = target as Dialog;
GUIStyle style = new GUIStyle();
style.padding = new RectOffset(5,5,5,5);
// Textura
if(dialog != null){
dialog.id = UnityEditor.EditorGUILayout.TextField("Name", dialog.id);
Dialog.Fragment[] fragments = dialog.getFragments();
Dialog.DialogOption[] options = dialog.getOptions();
EditorGUILayout.HelpBox("You have to add at least one", MessageType.None);
if(fragments != null){
foreach(Dialog.Fragment frg in fragments){
EditorGUILayout.BeginHorizontal();
frg.Face = EditorGUILayout.ObjectField(frg.Face, typeof(Texture2D), true, GUILayout.Width(60),GUILayout.Height(60)) as Texture2D;
EditorGUILayout.BeginVertical();
frg.Name = EditorGUILayout.TextField(frg.Name);
frg.Msg = EditorGUILayout.TextArea(frg.Msg,GUILayout.Height(40));
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical();
/*
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Reset: ", GUILayout.Width(40));
frg.reset = EditorGUILayout.Toggle(frg.reset);
EditorGUILayout.EndHorizontal();
*/
GUIContent btt = new GUIContent("Remove");
Rect btr = GUILayoutUtility.GetRect(btt, style);
if(GUI.Button(btr,btt)){
dialog.removeFragment(frg);
};
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.EndHorizontal();
GUIContent bttext = new GUIContent("Add Fragment");
Rect btrect = GUILayoutUtility.GetRect(bttext, style);
if(GUI.Button(btrect,bttext)){
dialog.addFragment();
};
EditorGUILayout.HelpBox("Options are the lines between you have to choose at the end of the dialog. Leave empty to do nothing, put one to execute this as the dialog ends, or put more than one to let the player choose between them.", MessageType.None);
if(options != null){
foreach(Dialog.DialogOption opt in options){
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Tag: ", GUILayout.Width(27));
opt.tag = EditorGUILayout.TextField(opt.tag);
EditorGUILayout.LabelField("Text: ", GUILayout.Width(35));
opt.text = EditorGUILayout.TextField(opt.text);
GUIContent btt = new GUIContent("Remove");
Rect btr = GUILayoutUtility.GetRect(btt, style);
if(GUI.Button(btr,btt)){
dialog.removeOption(opt);
};
EditorGUILayout.EndHorizontal();
}
}
bttext = new GUIContent("Add Option");
btrect = GUILayoutUtility.GetRect(bttext, style);
if(GUI.Button(btrect,bttext)){
dialog.addOption();
};
}else{
EditorGUILayout.LabelField("Please select a texture o create a new one!", style);
}
}