private void CreateDetectors()
        {
            DCSettings settings = DCSettings.Instance;

            DCSettings.Gesture openWithTouch = settings.openWithGesture;
            switch (openWithTouch)
            {
            case DCSettings.Gesture.None:
                break;

            case DCSettings.Gesture.SWIPE_DOWN_WITH_1_FINGER:
                m_swipeDetector = new SwipeTouchDetector(1);
                break;

            case DCSettings.Gesture.SWIPE_DOWN_WITH_2_FINGERS:
                m_swipeDetector = new SwipeTouchDetector(2);
                break;

            case DCSettings.Gesture.SWIPE_DOWN_WITH_3_FINGERS:
                m_swipeDetector = new SwipeTouchDetector(3);
                break;
            }

            KeyCode key = settings.openWithKey;

            m_keyDownDetector = new KeyDownDetector(key);
        }
        private void HandleOnExceptionOccur()
        {
            DCSettings settings = DCSettings.Instance;

            if (settings.exceptionNotification)
            {
                ShowWindowConsole();
            }
        }
        public void Init(DCSettings settings)
        {
            // create window objects
            foreach (UIWindow.Cfg cfg in cfgs)
            {
//				cfg.go = ClonePrefab(cfg.prefab, canvas.transform);
                m_windowCfgs[cfg.id] = cfg;
            }

            // active eventSystem if needed
            if (EventSystem.current == null)
            {
                eventSystem.gameObject.SetActive(true);
            }

            canvas.sortingOrder = settings.canvasSortOrder;
        }
Exemple #4
0
        private static DCSettings Load()
        {
            string pathInResources  = DCConst.SETTINGS_ASSET_PATH_IN_RESOURCES;
            string settingsFolder   = DCConst.SETTINGS_ASSET_FOLDER;
            string settingsFilename = DCConst.SETTINGS_ASSET_FILENAME;

            DCSettings settings = Resources.Load <DCSettings>(pathInResources);

            if (settings == null)
            {
                settings = ScriptableObject.CreateInstance <DCSettings>();
                SaveToAsset(settings, settingsFolder, settingsFilename);
            }

//			Debug.Log(string.Format("[{0}] Load {1}", DCConst.PLUGIN_NAME, settingsFilename));
            return(settings);
        }
Exemple #5
0
        private void InitOperationTips()
        {
            DCSettings settings  = DCSettings.Instance;
            string     tips      = null;
            string     operation = null;

            bool useTouch = PlatformUtil.IsMobilePlatform();

            if (useTouch)
            {
                string             touch   = "";
                DCSettings.Gesture gesture = settings.openWithGesture;
                switch (gesture)
                {
                case DCSettings.Gesture.SWIPE_DOWN_WITH_1_FINGER:
                    touch = "1 finger";
                    break;

                case DCSettings.Gesture.SWIPE_DOWN_WITH_2_FINGERS:
                    touch = "2 fingers";
                    break;

                case DCSettings.Gesture.SWIPE_DOWN_WITH_3_FINGERS:
                    touch = "3 fingers";
                    break;
                }
                operation = string.Format("Swipe down with <color={0}>{1}</color>", KEY_COLOR, touch);
            }
            else
            {
                KeyCode key = settings.openWithKey;
                operation = string.Format("Press the key <color={0}>{1}</color>", KEY_COLOR, key.ToString());
            }

            if (operation != null)
            {
                tips = string.Format("{0} to open the console.", operation);
            }

            if (tips != null)
            {
                uiOperationTips.text = tips;
            }
        }
        public void Draw()
        {
            GUILayoutOption CONTENT_WIDTH = GUILayout.Width(240);
            DCSettings      settings      = DCSettings.Instance;

            GUILayout.BeginVertical(DCStyles.box_noPadding, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            EditorGUI.BeginChangeCheck();

            // Open
            GUILayout.Label("<b>Open</b>", DCStyles.label_rich);

            GUILayout.BeginHorizontal();
            GUIContent contentOpenWithGesture = new GUIContent("Open With Gesture", "Select the gesture to open the console on mobile.");

            EditorGUILayout.PrefixLabel(contentOpenWithGesture);
            settings.openWithGesture = (DCSettings.Gesture)EditorGUILayout.EnumPopup(settings.openWithGesture, CONTENT_WIDTH);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUIContent contentOpenWithKey = new GUIContent("Open With Key", "Select the key to open the console on PC.");

            EditorGUILayout.PrefixLabel(contentOpenWithKey);
            settings.openWithKey = (KeyCode)EditorGUILayout.EnumPopup(settings.openWithKey, CONTENT_WIDTH);
            GUILayout.EndHorizontal();

            GUILayout.Space(8);
            DCStyles.DrawHorizontalLine();
            GUILayout.Space(8);

            // Display
            GUILayout.Label("<b>Display</b>", DCStyles.label_rich);

            GUILayout.BeginHorizontal();
            GUIContent contentLayer = new GUIContent("UI Layer", "The layer of the Device Console UI.");

            EditorGUILayout.PrefixLabel(contentLayer);
            settings.uiLayer = EditorGUILayout.LayerField(settings.uiLayer, CONTENT_WIDTH);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUIContent contentCanvasSortOrder = new GUIContent("Canvas Sort Order", "The sort order of the Device Console canvas in Overlay render mode. If you can't make the Device Console appear over your UI, which is made with UGUI and uses Overlay render mode too, please set this value to a bigger value.");

            EditorGUILayout.PrefixLabel(contentCanvasSortOrder);
            settings.canvasSortOrder = EditorGUILayout.IntField(settings.canvasSortOrder, CONTENT_WIDTH);
            GUILayout.EndHorizontal();

            GUILayout.Space(8);
            DCStyles.DrawHorizontalLine();
            GUILayout.Space(8);

            // Console
            GUILayout.Label("<b>Console</b>", DCStyles.label_rich);
            GUIContent contentExceptionNotification = new GUIContent("Exception Notification", "Show the console when an exception occurs even if the console is closed.");

            settings.exceptionNotification = EditorGUILayout.Toggle(contentExceptionNotification, settings.exceptionNotification);

            GUILayout.Space(8);
            DCStyles.DrawHorizontalLine();
            GUILayout.Space(8);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(settings);
            }

            GUILayout.EndVertical();
        }