当前位置: 首页>>代码示例>>C#>>正文


C# Dialog.addOption方法代码示例

本文整理汇总了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);
        }
    }
开发者ID:nvidiosin,项目名称:isoAbbeyTFG,代码行数:78,代码来源:DialogEditor.cs


注:本文中的Dialog.addOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。