Beispiel #1
0
 private void OnGUI()
 {
     GUILayoutTools.DrawTitle("对白编辑器");
     GUILayoutTools.Separator_NoSpaceDoubleLine();
     ToolBar();
     GUILayout.Space(5);
     using (new GUILayout.HorizontalScope())
     {
         using (new GUILayout.VerticalScope(GUILayout.Width(position.width * 0.3f)))
         {
             DrawList();
         }
         GUILayout.Space(10);
         using (new GUILayout.VerticalScope())
         {
             DrawDialogueGroup(curDialogueGroup);
         }
         GUILayout.Space(10);
     }
     GUILayoutTools.Separator_DoubleLine();
     using (new GUILayout.HorizontalScope())
     {
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("保 存", GUILayout.Width(120), GUILayout.Height(30)))
         {
             Save();
         }
         GUILayout.FlexibleSpace();
     }
     if (Event.current.type == EventType.MouseDown)
     {
         GUI.FocusControl(null);
     }
     Repaint();
 }
Beispiel #2
0
 private void DrawDialogueGroup(DialogueGroup dialogueGroup)
 {
     if (dialogueGroup == null)
     {
         return;
     }
     if (show = GUILayoutTools.Header("对白明细", show, null))
     {
         GUILayout.BeginVertical("helpbox");
         dialogueGroup.Id   = EditorGUILayout.IntField("id", dialogueGroup.Id);
         dialogueGroup.Desc = EditorGUILayout.TextField("对白组的简单描述", dialogueGroup.Desc);
         GUILayout.EndVertical();
         dialoguePos = GUILayout.BeginScrollView(dialoguePos, "box");
         GUILayoutTools.Separator_SingleLine();
         foreach (var dia in dialogueGroup.dialogues)
         {
             DrawDialogue(dia);
             GUILayoutTools.Separator_SingleLine();
         }
         GUILayout.EndScrollView();
         using (new GUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("新增一条对白", GUILayout.Width(100)))
             {
                 dialogueGroup.dialogues.Add(new Dialogue());
             }
             GUILayout.FlexibleSpace();
         }
     }
 }
Beispiel #3
0
        private void DrawProviderBox(string field, ProviderId provider)
        {
            bool isEditorDefault  = _editorProvider.enumValueIndex == (int)provider;
            bool isRuntimeDefault = _runtimeProvider.enumValueIndex == (int)provider;

            if (isEditorDefault || isRuntimeDefault)
            {
                GUILayoutTools.LineSeparator();

                StringBuilder titleBuilder = new StringBuilder();
                titleBuilder.Append(Enum.GetName(typeof(ProviderId), provider));

                if (isEditorDefault)
                {
                    titleBuilder.Append(TitleSeparator);
                    titleBuilder.Append(EditorDefaultTitle);
                }

                if (isRuntimeDefault)
                {
                    titleBuilder.Append(TitleSeparator);
                    titleBuilder.Append(RuntimeDefaultTitle);
                }

                EditorGUILayout.LabelField(titleBuilder.ToString(), WearableConstants.EmptyLayoutOptions);

                EditorGUILayout.PropertyField(serializedObject.FindProperty(field), WearableConstants.EmptyLayoutOptions);
            }
        }
Beispiel #4
0
        public static void DrawCharacter(CharacterInfo character)
        {
            if (character == null)
            {
                return;
            }
            if (showCharacterInfo = GUILayoutTools.Header(character.Name + " ÏêϸÅäÖÃ", showCharacterInfo, null))
            {
                GUILayout.BeginVertical("helpbox");
                character.Id = EditorGUILayout.IntField("½ÇÉ«ID", character.Id);

                character.Name = EditorGUILayout.TextField("½ÇÉ«Ãû", character.Name);

                character.characterSex = (CharacterSex)EditorGUILayout.EnumPopup("ÐÔ±ð", character.characterSex);

                EditorGUILayout.LabelField("ÈËÎï¼ò½é");
                character.otherInfo = EditorGUILayout.TextArea(character.otherInfo);

                character.texture = EditorGUILayout.ObjectField(character.texture, typeof(Texture), false) as Texture;

                GUILayout.EndVertical();

                //to do   ×ÊÔ´Ô¤ÀÀ
                if (character.texture)
                {
                    var rect = GUILayoutUtility.GetRect(500, 800);
                    GUI.DrawTexture(rect, character.texture, ScaleMode.ScaleToFit);
                }
            }
        }
Beispiel #5
0
 private void ShowDialogue()
 {
     if (curShow == null)
     {
         ShowNotification(new GUIContent("请选择一组对白开始查看"));
     }
     else
     {
         RemoveNotification();
         GUILayout.Label("正在演示 " + curShow.Id + ":" + curShow.Desc);
         using (var sc = new GUILayout.ScrollViewScope(scPos, "box"))
         {
             for (int i = 0; i <= curShow.curIndex; ++i)
             {
                 var dia = curShow.dialogues[i];
                 if (dia.dialogueType == DialogueType.Narrator_旁白)
                 {
                     GUILayout.Label(GUILayoutTools.GetTextSizeOf(dia.ShowText(), 13));
                 }
                 else
                 {
                     GUILayout.Label(GUILayoutTools.GetTextSizeOf(string.Format("【{0}】: {1}", GetCharacterName(dia.characterId), dia.content), 13));
                 }
                 GUILayout.Space(10);
             }
             scPos = sc.scrollPosition;
         }
     }
 }
Beispiel #6
0
        public void OnGUI()
        {
            GUILayoutTools.DrawTitle("演示板");
            GUILayoutTools.Separator_NoSpaceDoubleLine();
            ToolBar();
            GUILayout.Label("当前已有对白", StyleTools.MiddleCenterLab);
            var dgs = MainWinodws.Instance.dialogueGroups;

            using (new GUILayout.HorizontalScope())
            {
                foreach (var dg in dgs)
                {
                    if (GUILayout.Button(dg.Id + ":" + dg.Desc))
                    {
                        if (curShow != dg)
                        {
                            curShow = dg;
                            auto    = false;
                        }
                    }
                }
            }
            GUILayoutTools.Separator_SingleLine();
            ShowDialogue();
            Repaint();
        }
Beispiel #7
0
 public override void BuildMenuTree()
 {
     AddMenuItem("Icon预览", DrawIcon);
     AddMenuItem("控件预览", EditorCommondPreview);
     AddMenuItem("空白页签", null);
     AddMenuItem("测试页签", r =>
     {
         GUI.Label(r, GUILayoutTools.GetTextSizeOf("asdasdcvasdv\nasdvasdv", 15), StyleTools.MiddleCenterLab);
     });
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(serializedObject.FindProperty(UpdateModeField), WearableConstants.EmptyLayoutOptions);
            EditorGUILayout.PropertyField(_editorProvider, WearableConstants.EmptyLayoutOptions);
            EditorGUILayout.PropertyField(_runtimeProvider, WearableConstants.EmptyLayoutOptions);

            DrawProviderBox(DebugProviderField, ProviderId.DebugProvider);
            DrawProviderBox(ProxyProviderField, ProviderId.WearableProxy);
            DrawProviderBox(MobileProviderField, ProviderId.MobileProvider);
            DrawProviderBox(USBProviderField, ProviderId.USBProvider);
            DrawProviderBox(DeviceProviderField, ProviderId.WearableDevice);
            if (_editorProvider.enumValueIndex == (int)ProviderId.WearableDevice)
            {
                EditorGUILayout.HelpBox(WearableDeviceProviderUnsupportedEditorWarning, MessageType.Error);
            }
            if (_runtimeProvider.enumValueIndex == (int)ProviderId.USBProvider)
            {
                EditorGUILayout.HelpBox(USBProviderUnsupportedOutsideEditorWarning, MessageType.Error);
            }

            if (Application.isPlaying)
            {
                GUILayoutTools.LineSeparator();


                if (_wearableControl.IsOverridingDeviceConfig)
                {
                    EditorGUILayout.LabelField(OverrideDeviceConfigTitle, WearableConstants.EmptyLayoutOptions);
                    EditorGUILayout.HelpBox(OverrideConfigPresentWarning, MessageType.Warning);
                    EditorGUI.BeginDisabledGroup(true);
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty(OverrideWearableDeviceConfigField),
                        WearableConstants.EmptyLayoutOptions);
                }
                else
                {
                    EditorGUILayout.LabelField(ResolvedDeviceConfigTitle, WearableConstants.EmptyLayoutOptions);
                    EditorGUI.BeginDisabledGroup(true);
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty(FinalWearableDeviceConfigField),
                        WearableConstants.EmptyLayoutOptions);
                }

                EditorGUI.EndDisabledGroup();
            }

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #9
0
 public override void OnGUI(Rect rect)
 {
     using (new GUILayout.VerticalScope(EditorStyles.helpBox))
     {
         GUILayoutTools.DrawTitle("角色选择");
         searchName = searchField.OnGUI(searchName);
         using (var sc = new GUILayout.ScrollViewScope(scPos, "Box"))
         {
             foreach (var ch in MainWinodws.Instance.characterInfos)
             {
                 var name = ch.Name;
                 var id   = ch.Id.ToString();
                 if (name.ToLower().Contains(searchName.ToLower()) ||
                     id.ToLower().Contains(searchName.ToLower()))
                 {
                     using (new GUILayout.HorizontalScope())
                     {
                         Color c        = GUI.color;
                         bool  isSelect = curId == name;
                         GUI.color = isSelect ? Color.green : c;
                         if (GUILayout.Button(name + " : " + id, GUILayout.Height(18f)))
                         {
                             curId = name;
                             if (isSelect)
                             {
                                 if (action != null)
                                 {
                                     action(ch.Id);
                                 }
                                 editorWindow.Close();
                             }
                         }
                         if (GUILayout.Button("选 择", GUILayout.Height(18f), GUILayout.Width(60f)))
                         {
                             if (action != null)
                             {
                                 action(ch.Id);
                             }
                             editorWindow.Close();
                         }
                         GUI.color = c;
                     }
                 }
             }
             scPos = sc.scrollPosition;
         }
     }
 }
        public override void OnInspectorGUI()
        {
            var listProp            = serializedObject.FindProperty(ListPropertyName);
            var originalIndentLevel = EditorGUI.indentLevel;

            GUI.changed           = false;
            EditorGUI.indentLevel = 0;
            for (var i = 0; i < listProp.arraySize; i++)
            {
                var entryProp = listProp.GetArrayElementAtIndex(i);
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.PropertyField(entryProp.FindPropertyRelative(GestureIdPropertyName));
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.PropertyField(entryProp.FindPropertyRelative(GestureIconPropertyName));
                GUILayoutTools.LineSeparator();
            }
            EditorGUI.indentLevel = originalIndentLevel;

            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
Beispiel #11
0
 private void OnGUI()
 {
     GUILayoutTools.DrawTitle("½ÇÉ«ÅäÖÃ");
     GUILayoutTools.Separator_NoSpaceDoubleLine();
     ToolBar();
     GUILayout.Space(5);
     using (new GUILayout.HorizontalScope())
     {
         using (new GUILayout.VerticalScope(GUILayout.Width(position.width * 0.3f)))
         {
             DrawList();
         }
         GUILayout.Space(10);
         using (new GUILayout.VerticalScope())
         {
             DrawCharacter(curChar);
         }
         GUILayout.Space(10);
     }
     GUILayoutTools.Separator_DoubleLine();
     using (new GUILayout.HorizontalScope())
     {
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("±£ ´æ", GUILayout.Width(120), GUILayout.Height(30)))
         {
             Save();
         }
         GUILayout.FlexibleSpace();
     }
     GUILayout.Label("");
     Repaint();
     if (Event.current.type == EventType.MouseDown)
     {
         GUI.FocusControl(null);
     }
 }
Beispiel #12
0
        public void EditorCommondPreview(Rect r)
        {
            if (GUILayoutTools.DrawHeader("控 件 预 览", "asc", false, false))
            {
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, StyleTools.Skin.box);
                GUILayoutTools.NotificationTextLabel(new GUIContent("     控  件  预   览"));
                GUILayoutTools.Separator_DoubleLine();
                GUILayoutTools.TextArea("这是一个TextArea!\n" +
                                        "sdfbsdvvsdvsssssssssss" +
                                        "sdv" +
                                        "sdv");
                GUILayoutTools.TextField("这是一个TextField!");
                GUILayoutTools.Separator_SingleLine();

                s = GUILayoutTools.PathPicker("Path Picker", s);
                if (GUILayoutTools.SerachFiled(ref s1))
                {
                    Debug.Log(s1);
                }
                GUILayoutTools.Separator_SingleLine();

                GUILayout.BeginHorizontal();
                GUILayoutTools.Button100_50(new GUIContent("100*50"));
                GUILayoutTools.ButtonFixedSizeGray_Frame(new GUIContent("Button"), 100, 50);
                GUILayoutTools.ButtonFixedSizeGray(new GUIContent("Button"), 100, 50);
                GUILayoutTools.ButtonFixedSizeYellow(new GUIContent("Button"), 100, 50);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayoutTools.Button80_40(new GUIContent("80*40"));
                GUILayoutTools.ButtonFixedSizeGray_Frame(new GUIContent("Button"), 80, 40);
                GUILayoutTools.ButtonFixedSizeGray(new GUIContent("Button"), 80, 40);
                GUILayoutTools.ButtonFixedSizeYellow(new GUIContent("Button"), 80, 40);
                GUILayout.EndHorizontal();


                GUILayout.BeginHorizontal();
                GUILayoutTools.Button("Button160*40", GUILayout.Width(160), GUILayout.Height(40));
                GUILayoutTools.ButtonFixedSizeGray_Frame(new GUIContent("Button"), 160, 40);
                GUILayoutTools.ButtonFixedSizeGray(new GUIContent("Button"), 160, 40);
                GUILayoutTools.ButtonFixedSizeYellow(new GUIContent("Button"), 160, 40);
                GUILayout.EndHorizontal();

                GUILayoutTools.Button("Button", GUILayout.Height(30));
                GUILayout.BeginHorizontal();
                GUILayoutTools.SerachButton();
                GUILayoutTools.ConfigIconButton();
                GUILayoutTools.OKButton();
                GUILayoutTools.IconButton();
                GUILayoutTools.ListButton();
                GUILayoutTools.SettingButton();
                GUILayoutTools.RefreshButton();
                GUILayoutTools.AddButton();
                GUILayoutTools.MinusButton();
                GUILayoutTools.ConfigButton();
                GUILayout.EndHorizontal();
                GUILayoutTools.Separator_SingleLine();

                t  = GUILayoutTools.Toggle(t, "NormalToggle");
                t1 = GUILayoutTools.DotToggle(t1, new GUIContent("DotToggle"));
                GUILayoutTools.Separator_SingleLine();

                GUILayoutTools.WhiteBoldLabel(new GUIContent("WhiteBoldLabel"));
                GUILayoutTools.WhiteLargeLabel(new GUIContent("WhiteLargeLabel"));
                GUILayoutTools.TitleTextLabel(new GUIContent("TitleText"));
                GUILayoutTools.Separator_DoubleLine();
                GUILayout.EndScrollView();
            }
        }
Beispiel #13
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUI.changed = false;

            AppIntentProfile profile = target as AppIntentProfile;

            if (profile == null)
            {
                // Nothing we can do, so give up.
                return;
            }

            // Sensors
            EditorGUILayout.LabelField(SensorsLabel, EditorStyles.boldLabel);
            _newSensors.Clear();
            bool sensorsChanged = false;

            for (int i = 0; i < WearableConstants.SensorIds.Length; i++)
            {
                SensorId id = WearableConstants.SensorIds[i];

                bool prior = profile.GetSensorInProfile(id);
                bool post  = EditorGUILayout.Toggle(id.ToString(), prior, WearableConstants.EmptyLayoutOptions);
                sensorsChanged |= prior != post;

                if (post)
                {
                    _newSensors.Add(id);
                }
            }

            if (sensorsChanged)
            {
                profile.SetSensorIntent(_newSensors);
            }

            // Intervals
            GUILayoutTools.LineSeparator();
            EditorGUILayout.LabelField(IntervalsLabel, EditorStyles.boldLabel);
            _newIntervals.Clear();
            bool intervalsChanged = false;

            for (int i = 0; i < WearableConstants.UpdateIntervals.Length; i++)
            {
                SensorUpdateInterval interval = WearableConstants.UpdateIntervals[i];
                string label = string.Format(
                    IntervalFormat,
                    ((int)WearableTools.SensorUpdateIntervalToMilliseconds(interval)).ToString());
                bool prior = profile.GetIntervalInProfile(interval);
                bool post  = EditorGUILayout.Toggle(label, prior, WearableConstants.EmptyLayoutOptions);
                intervalsChanged |= prior != post;

                if (post)
                {
                    _newIntervals.Add(interval);
                }
            }

            if (intervalsChanged)
            {
                profile.SetIntervalIntent(_newIntervals);
            }


            // Gestures
            GUILayoutTools.LineSeparator();
            EditorGUILayout.LabelField(GesturesLabel, EditorStyles.boldLabel);

            _newGestures.Clear();
            bool gesturesChanged = false;

            for (int i = 0; i < WearableConstants.GestureIds.Length; i++)
            {
                GestureId id = WearableConstants.GestureIds[i];

                if (id == GestureId.None)
                {
                    continue;
                }

                bool prior = profile.GetGestureInProfile(id);
                bool post  = EditorGUILayout.Toggle(id.ToString(), prior, WearableConstants.EmptyLayoutOptions);
                gesturesChanged |= prior != post;

                if (post)
                {
                    _newGestures.Add(id);
                }
            }

            if (gesturesChanged)
            {
                profile.SetGestureIntent(_newGestures);
            }

            if (HasDeviceSpecificGesturesEnabled(profile))
            {
                EditorGUILayout.HelpBox(WearableConstants.DeviceSpecificGestureDiscouragedWarning, MessageType.Warning);
            }

            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
                EditorUtility.SetDirty(target);
            }
        }
Beispiel #14
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // Update mode
            EditorGUILayout.PropertyField(serializedObject.FindProperty(UpdateModeField), WearableConstants.EmptyLayoutOptions);

            // Provider defaults
            using (new EditorGUI.DisabledScope(Application.isPlaying))
            {
                // Editor Default Provider
                string editorProviderName = GetNameForProvider((ProviderId)_editorProvider.intValue);
                int    optionIndex        = Array.IndexOf(_editorProviderOptions, editorProviderName);
                _editorProviderIndex = EditorGUILayout.Popup(
                    ObjectNames.NicifyVariableName(EditorDefaultProviderField),
                    optionIndex >= 0 ? optionIndex : (int)WearableConstants.EditorDefaultProvider,
                    _editorProviderOptions
                    );

                _editorProvider.intValue = (int)_editorProviderMap[_editorProviderOptions[_editorProviderIndex]];

                // Runtime Default Provider
                string runtimeProviderName = GetNameForProvider((ProviderId)_runtimeProvider.intValue);
                optionIndex           = Array.IndexOf(_runtimeProviderOptions, runtimeProviderName);
                _runtimeProviderIndex = EditorGUILayout.Popup(
                    ObjectNames.NicifyVariableName(RuntimeDefaultProviderField),
                    optionIndex >= 0 ? optionIndex : (int)WearableConstants.RuntimeDefaultProvider,
                    _runtimeProviderOptions
                    );

                _runtimeProvider.intValue = (int)_runtimeProviderMap[_runtimeProviderOptions[_runtimeProviderIndex]];
            }

            // Intent profile
            GUILayoutTools.LineSeparator();
            DrawIntentsSection();

            // Providers
            DrawProviderBox(DebugProviderField, ProviderId.DebugProvider);
            DrawProviderBox(ProxyProviderField, ProviderId.WearableProxy);
            DrawProviderBox(USBProviderField, ProviderId.USBProvider);
            DrawProviderBox(DeviceProviderField, ProviderId.WearableDevice);

            if (Application.isPlaying)
            {
                GUILayoutTools.LineSeparator();

                if (_wearableControl.IsOverridingDeviceConfig)
                {
                    EditorGUILayout.LabelField(OverrideDeviceConfigTitle, WearableConstants.EmptyLayoutOptions);
                    EditorGUILayout.HelpBox(OverrideConfigPresentWarning, MessageType.Warning);
                    using (new EditorGUI.DisabledScope(true))
                    {
                        EditorGUILayout.PropertyField(
                            serializedObject.FindProperty(OverrideWearableDeviceConfigField),
                            WearableConstants.EmptyLayoutOptions);
                    }
                }
                else
                {
                    EditorGUILayout.LabelField(ResolvedDeviceConfigTitle, WearableConstants.EmptyLayoutOptions);
                    using (new EditorGUI.DisabledScope(true))
                    {
                        EditorGUILayout.PropertyField(
                            serializedObject.FindProperty(FinalWearableDeviceConfigField),
                            WearableConstants.EmptyLayoutOptions);
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #15
0
 public void OnGUI()
 {
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     using (new GUILayout.VerticalScope(GUILayout.Width(position.width * 0.45f)))
     {
         GUILayout.FlexibleSpace();
         GUI.color = new Color(0, 0, 0, 0.3f);
         GUILayout.BeginHorizontal(StyleTools.Skin.box);
         GUI.color = Color.white;
         GUILayout.Label(GUILayoutTools.GetTextSizeOf("С˵¾çÇé±à¼­Æ÷", 65), StyleTools.MiddleCenterLab);
         GUILayout.EndHorizontal();
         GUILayoutTools.Separator_DoubleLine();
         using (new GUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("¶Ô°×±à¼­Æ÷", GUILayout.Height(70), GUILayout.Width(position.width * 0.3f)))
             {
                 if (dialogueWindow == null)
                 {
                     dialogueWindow = GetWindow <DialogueWindow>(typeof(MainWinodws));
                     dialogueWindow.Init(dialogueGroups);
                 }
                 dialogueWindow.Focus();
             }
             GUILayout.FlexibleSpace();
         }
         using (new GUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("С˵ÈËÎïÅäÖÃ", GUILayout.Height(70), GUILayout.Width(position.width * 0.3f)))
             {
                 if (characterConfigWindow == null)
                 {
                     characterConfigWindow = GetWindow <CharacterConfigWindow>(typeof(MainWinodws));
                     characterConfigWindow.Init(characterInfos);
                 }
                 characterConfigWindow.Focus();
             }
             GUILayout.FlexibleSpace();
         }
         using (new GUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("¶Ô°×ÑÝʾ", GUILayout.Height(70), GUILayout.Width(position.width * 0.3f)))
             {
                 if (demoShowWinodw == null)
                 {
                     demoShowWinodw = GetWindow <DemoShowWinodw>(typeof(MainWinodws));
                 }
                 demoShowWinodw.Focus();
             }
             GUILayout.FlexibleSpace();
         }
         using (new GUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("¶Ô°×³¡¾°²¼ÖÃ(´ý¿ª·¢)", GUILayout.Height(70), GUILayout.Width(position.width * 0.3f)))
             {
             }
             GUILayout.FlexibleSpace();
         }
         GUILayout.Space(position.height * 0.1f);
         GUILayout.FlexibleSpace();
     }
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }