コード例 #1
0
        public bool IsActive(InputMethod input)
        {
            switch (input.Type)
            {
                case InputMethod.InputType.Keyboard:
                    return _kbState.IsKeyDown(input.Key);

                case InputMethod.InputType.Mouse:
                    switch (input.MouseButton)
                    {
                        case InputMethod.MouseButtons.Left:
                            return (int) _mState.LeftButton == 1;
                        case InputMethod.MouseButtons.Right:
                            return (int) _mState.RightButton == 1;
                        case InputMethod.MouseButtons.Middle:
                            return (int) _mState.MiddleButton == 1;
                        case InputMethod.MouseButtons.ScrollUp:
                            return _oldScrollWheelValue < _mState.ScrollWheelValue;
                        case InputMethod.MouseButtons.ScrollDown:
                            return _mState.ScrollWheelValue < _oldScrollWheelValue;

                        default:
                            return false;
                    }
            }
            return false;
        }
コード例 #2
0
ファイル: InputMapping.cs プロジェクト: ChrisLakeZA/duality
		public void Update(Transform referenceObj)
		{
			if (this.method == InputMethod.Unknown)
			{
				if (Time.FrameCount - this.creationFrame < 5) return;

				InputMethod[] takenMethods = 
					Scene.Current.FindComponents<Player>()
					.Select(p => p.InputMethod)
					.Where(m => m != InputMethod.Unknown)
					.ToArray();
				InputMethod[] freeMethods = 
					Enum.GetValues(typeof(InputMethod))
					.Cast<InputMethod>()
					.Except(takenMethods)
					.ToArray();
				
				for (int i = 0; i < freeMethods.Length; i++)
				{
					if (this.Detect(freeMethods[i]))
					{
						this.method = freeMethods[i];
						break;
					}
				}
			}
			else
			{
				this.UpdateFrom(referenceObj, this.method);
			}
		}
コード例 #3
0
        private void setInputTextBox(int tidx, int sidx)
        {
            TextBlock tblk;
            Canvas    cnvs;

            if (tidx == -1)
            {
                cnvs = m_clsHaiseki.m_lstSouryo[sidx].getNameCanvas();
                m_textboxInput.Width  = m_dSouryoWidth - m_dLineHeight * 1.4;
                m_textboxInput.Height = m_dLineHeight;
            }
            else
            {
                cnvs = m_clsHaiseki.m_lstTable[tidx].m_lstSekiji[sidx].getNameCanvas();
                m_textboxInput.Width  = m_dTableWidth - m_dLineHeight * 1.4;
                m_textboxInput.Height = m_dLineHeight;
            }
            m_cnvsCrtParent     = cnvs;
            tblk                = (TextBlock)m_cnvsCrtParent.Children[0];
            m_textboxInput.Text = tblk.Text;
            m_cnvsCrtParent.Children.Add(m_textboxInput);
            m_textboxInput.Focus();
            m_textboxInput.SelectAll();
            InputMethod.SetPreferredImeState(m_textboxInput, InputMethodState.On);
        }
コード例 #4
0
ファイル: WindowsFormsHost.cs プロジェクト: zheng1748/wpf
        /// <summary>
        ///     Synchronizes the Winforms Child control ime context enble status.
        /// </summary>
        private void SyncChildImeEnabledContext()
        {
            if (SWF.ImeModeConversion.IsCurrentConversionTableSupported && this.Child != null && this.Child.IsHandleCreated)
            {
                Debug.WriteLineIf(HostUtils.ImeMode.Level >= TraceLevel.Info, "Inside SyncChildImeEnabledContext(), this = " + this);
                Debug.Indent();

                // Note: Do not attempt to set Child.ImeMode directly, it will be updated properly from the context.
                if (InputMethod.GetIsInputMethodEnabled(this))
                {
                    if (this.Child.ImeMode == ImeMode.Disable)
                    {
                        SWF.ImeContext.Enable(this.Child.Handle);
                    }
                }
                else
                {
                    if (this.Child.ImeMode != ImeMode.Disable)
                    {
                        SWF.ImeContext.Disable(this.Child.Handle);
                    }
                }

                Debug.Unindent();
            }
        }
コード例 #5
0
 /// <summary>
 /// Creates a new InputButton from the given controller button.
 /// </summary>
 public InputButton(Buttons Button)
 {
     this._Key          = 0;    // Prevent complaining about readonly.
     this._KeyModifiers = 0;
     this._Button       = Button;
     this.Type          = InputMethod.Button;
 }
コード例 #6
0
        public SearchBox()
        {
            InitializeComponent();

            DataContext = EverythingSearch.Instance;
            InputMethod.SetPreferredImeState(this, InputMethodState.On);
        }
コード例 #7
0
        protected void InsertAppData()
        {
            StringBuilder appDataSb = new StringBuilder();

            appDataSb.Append("window.appData = {");
            appDataSb.Append("dictionaries: {");
            appDataSb.Append("inputDocTypes: [" + FormatDictionaryList(InputDocType.GetAll(), "InputDocTypeID") + "], ");
            appDataSb.Append("inputMethods: [" + FormatDictionaryList(InputMethod.GetAll(), "InputMethodID") + "], ");
            appDataSb.Append("inputSigns: [" + FormatDictionaryList(InputSign.GetAll(), "InputSignID") + "], ");
            appDataSb.Append("inputSubjectTypes: [" + FormatDictionaryList(InputSubjectType.GetAll(), "InputSubjectTypeID") + "], ");
            appDataSb.Append("deliveryTypes: [" + FormatDictionaryList(DeliveryType.GetAll(), "DeliveryTypeID") + "] ,");
            appDataSb.Append("socialStatuses: [" + FormatDictionaryList(SocialStatus.GetAll(), "SocialStatusID") + "], ");
            appDataSb.Append("branchTypes: [" + FormatDictionaryList(BranchType.GetAll(), "BranchTypeID") + "], ");
            appDataSb.Append("socialCategories: [" + FormatDictionaryList(SocialCategory.GetAll(), "SocialCategoryID") + "], ");
            appDataSb.Append("cardStatuses: [" + FormatDictionaryList(CardStatus.GetAll(), "CardStatusID") + "], ");
            appDataSb.Append("labels: [" + FormatDictionaryList(Label.GetList(), "LabelID") + "], ");
            appDataSb.Append("docStatuses: [" + FormatDictionaryList(DocStatus.GetAll(), "DocStatusID") + "]");
            appDataSb.Append("}");
            appDataSb.Append("}");

            HtmlGenericControl scriptControl = new HtmlGenericControl("script");

            scriptControl.Attributes["type"] = "text/javascript";
            scriptControl.InnerHtml          = appDataSb.ToString();
            Page.Header.Controls.AddAt(0, scriptControl);
        }
コード例 #8
0
 public ActivationDialog(IServices services, ActivationWizardAction wizardStartAction)
     : base(services)
 {
     this.wizardStartAction = wizardStartAction;
     this.InitializeComponent();
     InputMethod.SetIsInputMethodEnabled((DependencyObject)this, false);
 }
コード例 #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        public CustomTextBox()
        {
            // 初期化
            this.Initialized += (sender, e) => {
                switch (this.ImeMode)
                {
                case ImeMode.Disabled:
                    InputMethod.SetIsInputMethodEnabled(this, false);
                    break;

                case ImeMode.Hiragana:
                    InputMethod.SetPreferredImeState(this, InputMethodState.On);
                    InputMethod.SetPreferredImeConversionMode(this, ImeConversionModeValues.FullShape | ImeConversionModeValues.Native);
                    break;

                case ImeMode.Off:
                    InputMethod.SetPreferredImeState(this, InputMethodState.Off);
                    break;

                default:
                    InputMethod.SetPreferredImeState(this, InputMethodState.DoNotCare);
                    break;
                }
            };

            this.GotFocus  += CustomTextBox_GotFocus;
            this.LostFocus += CustomTextBox_LostFocus;
        }
コード例 #10
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //加载列
            for (int i = 0; i < COLUMNS; i++)
            {
                gameGrid.ColumnDefinitions.Add(new ColumnDefinition());
            }

            //加载行
            for (int i = 0; i < ROWS; i++)
            {
                gameGrid.RowDefinitions.Add(new RowDefinition());
            }
            //加载游戏线程
            snakeTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(600 - speedSlider.Value)
            };
            snakeTimer.Tick += SnakeTimer_Tick;

            this.KeyDown += new KeyEventHandler(Game_KeyDown);
            InputMethod.SetIsInputMethodEnabled(this, false);
            stopButton.IsEnabled = false;
            snakeTimer.IsEnabled = false;
            stateLabel.Content   = "未开始";

            //食物线程
            foodTimer = new DispatcherTimer
            {
                Interval = snakeTimer.Interval
            };
            foodTimer.Tick += FoodTimer_Tick;
        }
コード例 #11
0
        List <AxisData> GetAxesOfType(InputMethod method)
        {
            List <AxisData> axesList = new List <AxisData>();

            foreach (AxisData axis in axes.Values)
            {
                if (axis.IsEnabled)
                {
                    bool secondaryFlag = false;

                    if (axis.IsSecondaryInputEnabled)
                    {
                        // order matters--button check needs to come last
                        if (!axis.DoesSecondaryNeedTrigger || player.GetButton(axis.secondaryInputTrigger))
                        {
                            if (axis.secondaryInputMethod == method)
                            {
                                secondaryFlag = true;
                            }
                        }
                    }

                    if (axis.inputMethod == method || secondaryFlag)
                    {
                        axesList.Add(axis);
                    }
                }
            }

            return(axesList);
        }
コード例 #12
0
    /// <summary>
    /// Adds a new player with a specified InputMethod
    /// </summary>
    /// <param name="inputMethod"></param>
    public static void AddPlayer(InputMethod inputMethod)
    {
        // Do not add more players than the maximum allowed
        if (players.Count >= singleton.maxPlayers)
        {
            return;
        }

        // If there is only 1 player and the players' input method is the keyboard, change the input method to a connected controller
        else if (players.Count == 1 && players[0].GetComponent <IInputPlayer>().InputMethod == InputMethod.Keyboard)
        {
            if (inputMethod == InputMethod.XboxController)
            {
                players[0].GetComponent <IInputPlayer>().PlayerIndex = 0;
                players[0].GetComponent <IInputPlayer>().InputMethod = inputMethod;
                return;
            }
        }

        // Create a new player with index/input method, and create a new set of input dictioanries for the player
        else
        {
            GameObject newPlayer;
            players.Add(newPlayer = Instantiate(singleton.playerPrefab));

            newPlayer.GetComponent <IInputPlayer>().InputMethod = inputMethod;
            newPlayer.GetComponent <IInputPlayer>().PlayerIndex = players.IndexOf(newPlayer);

            DuplicateDictionaries();
            return;
        }
    }
コード例 #13
0
        public ShortcutKeyControlElement(MainWindow window, SettingsWindow settingsWindow)
        {
            this.InitializeComponent();
            this.ParentWindow         = window;
            this.ParentSettingsWindow = settingsWindow;
            InputMethod.SetIsInputMethodEnabled((DependencyObject)this.mShortcutKeyTextBox, false);
            MainWindow parentWindow = this.ParentWindow;

            string[] strArray;
            if (parentWindow == null)
            {
                strArray = (string[])null;
            }
            else
            {
                strArray = parentWindow.mCommonHandler.mShortcutsConfigInstance.DefaultModifier.Split(new char[1]
                {
                    ','
                }, StringSplitOptions.RemoveEmptyEntries);
            }
            foreach (string str in strArray)
            {
                Key key = (Key)Enum.Parse(typeof(Key), str);
                this.mDefaultModifierForUI   = this.mDefaultModifierForUI + IMAPKeys.GetStringForUI(key) + " + ";
                this.mDefaultModifierForFile = this.mDefaultModifierForFile + IMAPKeys.GetStringForFile(key) + " + ";
            }
        }
コード例 #14
0
        private static void NumTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var tb = d as TextBox;

            if (tb == null)
            {
                return;
            }

            tb.PreviewTextInput -= tbb_PreviewTextInput;
            tb.PreviewKeyDown   -= tbb_PreviewKeyDown;
            DataObject.RemovePastingHandler(tb, OnClipboardPaste);
            NumTextType result = (NumTextType)e.NewValue;

            if (result != NumTextType.Default)
            {
                InputMethod.SetIsInputMethodEnabled(tb, false);
                tb.PreviewTextInput += tbb_PreviewTextInput;
                tb.PreviewKeyDown   += tbb_PreviewKeyDown;
                DataObject.AddPastingHandler(tb, OnClipboardPaste);
            }
            else
            {
                InputMethod.SetIsInputMethodEnabled(tb, true);
            }
        }
コード例 #15
0
        public Browser()
        {
            if (IsDesignMode)
            {
                return;
            }

            WebView                = mbWebView.Create();
            TitleChanged           = new EventAdapter <TitleChangeEventArgs, mbTitleChangedCallback>(this, NativeMethods.mbOnTitleChanged);
            UrlChanged             = new EventAdapter <UrlChangeEventArgs, mbURLChangedCallback>(this, NativeMethods.mbOnURLChanged);
            NewWindow              = new EventAdapter <NewWindowEventArgs, mbCreateViewCallback>(this, NativeMethods.mbOnCreateView);
            LoadUrlBegin           = new EventAdapter <LoadUrlBeginEventArgs, mbLoadUrlBeginCallback>(this, NativeMethods.mbOnLoadUrlBegin);
            WebSocketOnWillConnect = new EventAdapter <WebSocketWillConnectEventArgs, onWillConnect>(this, RegSocketOnWillConnect);
            WebSocketOnConnect     = new EventAdapter <WebSocketConnectedEventArgs, onConnected>(this, RegSocketOnConnected);
            WebSocketOnReceive     = new EventAdapter <WebSocketDataEventArgs, onReceive>(this, RegSocketOnReceive);
            WebSocketOnSend        = new EventAdapter <WebSocketDataEventArgs, onSend>(this, RegSocketOnSend);
            WebSocketOnError       = new EventAdapter <WebSocketErrorEventArgs, onError>(this, RegSocketOnError);
            LoadUrlEnd             = new EventAdapter <LoadUrlEndEventArgs, mbLoadUrlEndCallback>(this, NativeMethods.mbOnLoadUrlEnd);
            DocumentReady          = new EventAdapter <DocumentReadyEventArgs, mbDocumentReadyCallback>(this, NativeMethods.mbOnDocumentReady);

            mbPaintBitUpdatedCallback = new mbPaintBitUpdatedCallback(mbPaintBitUpdated);
            NativeMethods.mbOnPaintBitUpdated(WebView, mbPaintBitUpdatedCallback, IntPtr.Zero);
            ClipToBounds = true;
            Focusable    = true;
            IsEnabled    = true;
            InputMethod.SetIsInputMethodEnabled(this, true);
            InputMethod.SetIsInputMethodSuspended(this, false);
            InputMethod.Current.ImeState = InputMethodState.Off;
        }
コード例 #16
0
 public VLCManagedEncoder(string sout, string[] arguments, StreamContext context, InputMethod inputMethod)
 {
     this.sout = sout;
     this.arguments = arguments;
     this.inputMethod = inputMethod;
     this.context = context;
 }
コード例 #17
0
        public void InitStressTest()
        {
            MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1));

            InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.UserBeginIdNum, false);


            MainWindow.Instance.PreFixUserID.Text   = ServerAddressRegistry.ReadValue(MainWindow.SAVE_PREFIX_KEY_ID, "Braves");
            MainWindow.Instance.UserBeginIdNum.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_USER_BEGIN_NUM_KEY_ID, "3000");

            MainWindow.Instance.TenKBInGroupUserCount.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_TENKBGRUCOUNT_KEY_ID, "50");
            MainWindow.Instance.TenKBMaxUserNumber.Text    = ServerAddressRegistry.ReadValue(MainWindow.SAVE_TENKBMAXUSERCOUNT_KEY_ID, "100");

            MainWindow.Instance.MatchInGroupUserCount.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_MATCHGRUCOUNT_KEY_ID, "50");
            MainWindow.Instance.MatchKBMaxUserNumber.Text  = ServerAddressRegistry.ReadValue(MainWindow.SAVE_MATCHMAXUSERCOUNT_ID, "100");

            MainWindow.Instance.TestLoginInGroupUserCount.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_LOGINTGRUCOUNT_KEY_ID, "50");
            MainWindow.Instance.TestLoginMaxUserNumber.Text    = ServerAddressRegistry.ReadValue(MainWindow.SAVE_LOGINTMAXUSERCOUNT_ID, "100");


            mDataTestWin.InitStressTest();
            mMatcingTestWin.InitStressTest();
            mMatched10KBTestWin.InitStressTest();
            mLoginTestWin.InitStressTest();
        }
コード例 #18
0
 public void ResetFocus()
 {
     // 一旦フォーカスが外れると、IMEが無効になる問題への対処療法
     _view.DummyTextBox.Focus();
     InputMethod.SetPreferredImeState(_view.Editor, InputMethodState.On);
     InputMethod.SetPreferredImeConversionMode(_view.Editor, ImeConversionModeValues.FullShape);
 }
コード例 #19
0
        //https://developer.xamarin.com/recipes/android/other_ux/camera_intent/take_a_picture_and_save_using_camera_app/
        private void LaunchCamera()
        {
            Intent intent = new Intent(MediaStore.ActionImageCapture);

            // if there is an app to resolve the ActionImageCapture intent
            if (intent.ResolveActivity(PackageManager) != null)
            {
                intent.SetFlags(ActivityFlags.GrantReadUriPermission | ActivityFlags.GrantWriteUriPermission);

                File image = new File(CacheDir, FILENAME_CAMERA_IMAGE);                                              //generate file

                originalImageUri = FileProvider.GetUriForFile(ApplicationContext, PackageName + ".provider", image); //get uri

                if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
                {
                    // Workaround to make the camera work on Android Version < 5.0 (Lollipop)
                    // https://stackoverflow.com/questions/33650632/fileprovider-not-working-with-camera/33652695#33652695
                    IList <ResolveInfo> resInfoList = this.PackageManager.QueryIntentActivities(intent, PackageInfoFlags.MatchDefaultOnly);
                    foreach (ResolveInfo resolveInfo in resInfoList)
                    {
                        String packageName = resolveInfo.ActivityInfo.PackageName;
                        GrantUriPermission(packageName, originalImageUri, ActivityFlags.GrantReadUriPermission | ActivityFlags.GrantWriteUriPermission);
                    }
                }

                intent.PutExtra(MediaStore.ExtraOutput, originalImageUri);

                selectedInputMethod = InputMethod.Camera;
                StartActivityForResult(intent, (int)RequestCode.Camera);
                RunForwardAnimation();
            }
        }
コード例 #20
0
ファイル: InputMapping.cs プロジェクト: ykafia/duality
        public void Update(Transform referenceObj)
        {
            if (this.method == InputMethod.Unknown)
            {
                if (Time.FrameCount - this.creationFrame < 5)
                {
                    return;
                }

                InputMethod[] takenMethods =
                    Scene.Current.FindComponents <Player>()
                    .Select(p => p.InputMethod)
                    .Where(m => m != InputMethod.Unknown)
                    .ToArray();
                InputMethod[] freeMethods =
                    Enum.GetValues(typeof(InputMethod))
                    .Cast <InputMethod>()
                    .Except(takenMethods)
                    .ToArray();

                for (int i = 0; i < freeMethods.Length; i++)
                {
                    if (this.Detect(freeMethods[i]))
                    {
                        this.method = freeMethods[i];
                        break;
                    }
                }
            }
            else
            {
                this.UpdateFrom(referenceObj, this.method);
            }
        }
コード例 #21
0
ファイル: RoutineInput.cs プロジェクト: tbm0115/Consoul
 public RoutineInput(XmlNode xNode) : this()
 {
     Value = xNode["Value"]?.InnerText;
     if (!string.IsNullOrEmpty(xNode["RequestTime"]?.InnerText))
     {
         RequestTime = DateTime.Parse(xNode["RequestTime"].InnerText);
     }
     if (!string.IsNullOrEmpty(xNode["ResponseTime"]?.InnerText))
     {
         ResponseTime = DateTime.Parse(xNode["ResponseTime"].InnerText);
     }
     if (!string.IsNullOrEmpty(xNode["Method"]?.InnerText))
     {
         Method = (InputMethod)Enum.Parse(typeof(InputMethod), xNode["Method"].InnerText);
     }
     Description = xNode["Description"]?.InnerText;
     if (xNode["Transforms"] != null)
     {
         XmlNodeList           xTransforms = xNode.SelectNodes("Transforms/Transform");
         List <InputTransform> transforms  = new List <InputTransform>();
         foreach (XmlNode xTransform in xTransforms)
         {
             transforms.Add(new InputTransform(xTransform));
         }
         Transforms = transforms.ToArray();
     }
 }
コード例 #22
0
 public VLCManagedEncoder(string sout, string[] arguments, StreamContext context, InputMethod inputMethod)
 {
     this.sout        = sout;
     this.arguments   = arguments;
     this.inputMethod = inputMethod;
     this.context     = context;
 }
コード例 #23
0
 /// <summary>
 /// Creates a new InputButton from the given key and, optionally, modifiers.
 /// </summary>
 public InputButton(Keys Key, ConsoleModifiers Modifiers = 0)
 {
     this._Button       = 0;       // Make it not complain about readonly being assigned, even though it's incorrect.
     this._Key          = Key;
     this._KeyModifiers = Modifiers;
     this.Type          = InputMethod.Key;
 }
コード例 #24
0
        private void TextBox_GotFocus(object sender, EventArgs e)
        {
            TextBox tb;

            tb = (TextBox)sender;
            InputMethod.SetPreferredImeState(tb, InputMethodState.On);
        }
コード例 #25
0
ファイル: DadaInput.cs プロジェクト: jperamak/Dada
    private void Configure(InputMethod forceMethod)
    {
        KeyMap kMap;

        List <ConsoleController> controllers = new List <ConsoleController>();

        for (int i = 0; i < _controllerNames.Length; i++)
        {
            kMap = MakeMap(_controllerNames[i]);
            ConsoleController c = new ConsoleController(kMap, _controllerNames[i], i);
            controllers.Add(c);
            _joyList.Add(c);
        }
        if (controllers.Count > 0)
        {
            GamepadSync.Initialize(controllers);
        }

        _joyList.Add(new KeyboardController(_rawKeyMaps["Keyboard"], _joyList.Count));

        if (_joyList.Count > 0)
        {
            _joy = new CompositeController(_joyList);
        }
        else
        {
            _joy = new NullController(0);
        }
    }
コード例 #26
0
        private void CheckAndHandleSharing(Intent intent)
        {
            // Determine if the Activity was launched via Intent.ActionSend
            String intentAction = intent.Action;

            if (Intent.ActionSend.Equals(intentAction))
            {
                System.Diagnostics.Debug.WriteLine("Received ACTION_SEND intent");

                AndroidUri uri = (AndroidUri)intent.GetParcelableExtra(Intent.ExtraStream);
                if (uri != null)
                {
                    originalImageUri    = uri;
                    selectedInputMethod = InputMethod.Sharing;
                    TryExtStorageDependentAction(LaunchPhotoCropper);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Unable to retrieve shared image URI");
                    Snackbar.Make(rootView, Resource.String.sharing_uri_null_error, Snackbar.LengthIndefinite)
                    .SetAction(Android.Resource.String.Ok, (v) => { })
                    .Show();
                }
            }
        }
コード例 #27
0
 public IMapTextBox()
 {
     this.InitializeComponent();
     InputMethod.SetIsInputMethodEnabled((DependencyObject)this, false);
     this.ClearValue(IMapTextBox.IMActionItemsProperty);
     this.Loaded += new RoutedEventHandler(this.IMapTextBox_Loaded);
 }
コード例 #28
0
        /// <summary>
        /// 构造器
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            ViewManager.SetWindowReference(this);
            this.Title             = GlobalConfigContext.GAME_TITLE_NAME;
            this.Width             = GlobalConfigContext.GAME_VIEWPORT_WIDTH;
            this.Height            = GlobalConfigContext.GAME_VIEWPORT_ACTUALHEIGHT;
            this.mainCanvas.Width  = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.mainCanvas.Height = GlobalConfigContext.GAME_WINDOW_HEIGHT;
            this.ResizeMode        = GlobalConfigContext.GAME_WINDOW_RESIZEABLE ? ResizeMode.CanResize : ResizeMode.NoResize;
            // 加载主页面
            this.mainFrame.Width  = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.mainFrame.Height = GlobalConfigContext.GAME_WINDOW_HEIGHT;
            ViewPageManager.RegisterPage("SplashPage", new SplashPage());
            ViewPageManager.RegisterPage("LHPage", new LHPage());
            ViewPageManager.RegisterPage("LHStartPage", new LHStartPage());
            this.maskFrame.Width  = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.maskFrame.Height = GlobalConfigContext.GAME_WINDOW_HEIGHT;
            this.uiFrame.Width    = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.uiFrame.Height   = GlobalConfigContext.GAME_WINDOW_HEIGHT;

            ViewManager.MaskFrameRef = this.maskFrame;
            InputMethod.SetIsInputMethodEnabled(this, false);
            this.mainFrame.Content = ViewPageManager.RetrievePage("SplashPage");

            if (GlobalConfigContext.GAME_WINDOW_FULLSCREEN)
            {
                Director.IsFullScreen = true;
                this.FullScreenTransform();
            }
            logger.Info("main window loaded");
        }
コード例 #29
0
ファイル: TextCaret.cs プロジェクト: azureidea/dnSpy-1
 public TextCaret(IWpfTextView textView, IAdornmentLayer caretLayer, ISmartIndentationService smartIndentationService, IClassificationFormatMap classificationFormatMap)
 {
     if (caretLayer == null)
     {
         throw new ArgumentNullException(nameof(caretLayer));
     }
     if (classificationFormatMap == null)
     {
         throw new ArgumentNullException(nameof(classificationFormatMap));
     }
     this.textView = textView ?? throw new ArgumentNullException(nameof(textView));
     imeState      = new ImeState();
     this.smartIndentationService = smartIndentationService ?? throw new ArgumentNullException(nameof(smartIndentationService));
     preferredXCoordinate         = 0;
     __preferredYCoordinate       = 0;
     Affinity        = PositionAffinity.Successor;
     currentPosition = new VirtualSnapshotPoint(textView.TextSnapshot, 0);
     textView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority;
     textView.TextBuffer.ContentTypeChanged  += TextBuffer_ContentTypeChanged;
     textView.Options.OptionChanged          += Options_OptionChanged;
     textView.VisualElement.AddHandler(UIElement.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
     textView.VisualElement.AddHandler(UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
     textView.LayoutChanged += TextView_LayoutChanged;
     textCaretLayer          = new TextCaretLayer(this, caretLayer, classificationFormatMap);
     InputMethod.SetIsInputMethodSuspended(textView.VisualElement, true);
 }
コード例 #30
0
ファイル: InputButton.cs プロジェクト: Octanum/Corvus
 /// <summary>
 /// Creates a new InputButton from the given key and, optionally, modifiers.
 /// </summary>
 public InputButton(Keys Key, ConsoleModifiers Modifiers = 0)
 {
     this._Button = 0; // Make it not complain about readonly being assigned, even though it's incorrect.
     this._Key = Key;
     this._KeyModifiers = Modifiers;
     this.Type = InputMethod.Key;
 }
コード例 #31
0
ファイル: InputButton.cs プロジェクト: Octanum/Corvus
 /// <summary>
 /// Creates a new InputButton from the given controller button.
 /// </summary>
 public InputButton(Buttons Button)
 {
     this._Key = 0; // Prevent complaining about readonly.
     this._KeyModifiers = 0;
     this._Button = Button;
     this.Type = InputMethod.Button;
 }
コード例 #32
0
 public TextNumber() : base()
 {
     this.PreviewTextInput += TextNumber_PreviewTextInput;
     this.TextChanged      += TextNumber_TextChanged;
     InputMethod.SetIsInputMethodEnabled(this, false);
     this.Text = "0";
 }
コード例 #33
0
ファイル: HexCaretImpl.cs プロジェクト: pashav15/pashav
 public HexCaretImpl(WpfHexView hexView, HexAdornmentLayer caretLayer, VSTC.IClassificationFormatMap classificationFormatMap, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService)
 {
     if (hexView == null)
     {
         throw new ArgumentNullException(nameof(hexView));
     }
     if (caretLayer == null)
     {
         throw new ArgumentNullException(nameof(caretLayer));
     }
     if (classificationFormatMap == null)
     {
         throw new ArgumentNullException(nameof(classificationFormatMap));
     }
     if (classificationTypeRegistryService == null)
     {
         throw new ArgumentNullException(nameof(classificationTypeRegistryService));
     }
     this.hexView                   = hexView;
     imeState                       = new ImeState();
     preferredXCoordinate           = 0;
     __preferredYCoordinate         = 0;
     hexView.Options.OptionChanged += Options_OptionChanged;
     hexView.VisualElement.AddHandler(UIElement.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
     hexView.VisualElement.AddHandler(UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
     hexView.LayoutChanged      += HexView_LayoutChanged;
     hexView.BufferLinesChanged += HexView_BufferLinesChanged;
     hexView.ZoomLevelChanged   += HexView_ZoomLevelChanged;
     hexCaretLayer = new HexCaretLayer(this, caretLayer, classificationFormatMap, classificationTypeRegistryService);
     InputMethod.SetIsInputMethodSuspended(hexView.VisualElement, true);
 }
コード例 #34
0
        public override string ReadLine()
        {
            _inputMethod = InputMethod.Unknown;

            var task = Task.Factory.StartNew(() =>
            {
                var s        = System.Console.ReadLine();
                _inputMethod = InputMethod.Keyboard;
                if (!_reading)
                {
                    return;
                }
                _input = s;
                _autoResetEvent.Set();
            });

            _mainSpeechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);

            _reading = true;
            _autoResetEvent.WaitOne();
            _reading = false;

            _mainSpeechRecognitionEngine.RecognizeAsyncCancel();

            if (_inputMethod == InputMethod.Voice)
            {
                var hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
                PostMessage(hWnd, WM_KEYDOWN, VK_RETURN, 0);
            }

            task.Wait();
            task.Dispose();

            return(_input);
        }
コード例 #35
0
ファイル: DateTimeInput.cs プロジェクト: OceanYan/Platform
 public DateTimeInput()
 {
     Title = "日期时间域";
     //禁用输入法
     InputMethod.SetIsInputMethodEnabled(tb_Host, false);
     DateTimeFormatString = "yyyy年MM月dd日";
     MinValue             = DateTime.MinValue;
     MaxValue             = DateTime.MaxValue;
     //获得焦点时,全选
     GotFocus              += (sender, e) => { tb_Host.SelectAll(); };
     PreviewKeyDown        += DateTimeInput_PreviewKeyDown;
     this.PreviewFlowLeave += (sender, e) =>
     {
         var text = tb_Host.Text;
         if (string.IsNullOrEmpty(text))
         {
             return;
         }
         var dt = GetDateTimeByString(tb_Host.Text, DateTimeFormatString);
         if (dt == null)
         {
             this.ToastMessage("该输入项不是有效的日期时间!");
             e.Handled = true;
         }
         else if (dt.Value.CompareTo(MinValue) < 0 || dt.Value.CompareTo(MaxValue) > 0)
         {
             this.ToastMessage(string.Format("该输入项不在有效的范围内!要求的范围是[{0}]-[{1}]",
                                             MinValue.ToString(DateTimeFormatString), MaxValue.ToString(DateTimeFormatString)));
             e.Handled = true;
         }
     };
 }
コード例 #36
0
ファイル: InputMapping.cs プロジェクト: ChrisLakeZA/duality
		private bool Detect(InputMethod method)
		{
			switch (method)
			{
				case InputMethod.MouseAndKeyboard:	return this.DetectMouseAndKeyboard(DualityApp.Mouse, DualityApp.Keyboard);
				case InputMethod.FirstGamepad:		return this.DetectGamepad(DualityApp.Gamepads[0]);
				case InputMethod.SecondGamepad:		return this.DetectGamepad(DualityApp.Gamepads[1]);
				default:							return false;
			}
		}
コード例 #37
0
ファイル: PlayerInput.cs プロジェクト: 41407/happy-cycling
 void CheckIfInputMethodChanged()
 {
     InputMethod current = Input.GetButtonDown("Jump") ? InputMethod.button : InputMethod.mouse;
     if (previousInput != InputMethod.none && previousInput != current)
     {
         paused = true;
         Invoke("Continue", 0.5f);
         UnityEngine.Cursor.visible = Input.GetMouseButtonDown(0);
     }
     previousInput = current;
 }
コード例 #38
0
ファイル: InputMapping.cs プロジェクト: ChrisLakeZA/duality
		private void UpdateFrom(Transform referenceObj, InputMethod method)
		{
			switch (method)
			{
				case InputMethod.MouseAndKeyboard:	this.UpdateFromMouseAndKeyboard(referenceObj, DualityApp.Mouse, DualityApp.Keyboard); break;
				case InputMethod.FirstGamepad:		this.UpdateFromGamepad(referenceObj, DualityApp.Gamepads[0]); break;
				case InputMethod.SecondGamepad:		this.UpdateFromGamepad(referenceObj, DualityApp.Gamepads[1]); break;
			}
		}
コード例 #39
0
        private void ShowPage()
        {
            GUI.skin.label.wordWrap = true;

            if (pageNumber == 0)
            {
                if (logo != null)
                {
                    GUILayout.Label (logo);
                }
                GUILayout.Space (5f);
                GUILayout.Label ("This window can help you get started with making a new Adventure Creator game.");
                GUILayout.Label ("To begin, click 'Next'. Changes will not be implemented until you are finished.");
            }

            else if (pageNumber == 1)
            {
                GUILayout.Label ("Enter a name for your game. This will be used for filenames, so alphanumeric characters only.");
                gameName = GUILayout.TextField (gameName);
            }

            else if (pageNumber == 2)
            {
                GUILayout.Label ("What kind of perspective will your game have?");
                cameraPerspective_int = EditorGUILayout.Popup (cameraPerspective_int, cameraPerspective_list);

                if (cameraPerspective_int == 0)
                {
                    GUILayout.Space (5f);
                    GUILayout.Label ("By default, 2D games are built entirely in the X-Z plane, and characters are scaled to achieve a depth effect.\nIf you prefer, you can position your characters in 3D space, so that they scale accurately due to camera perspective.");
                    screenSpace = EditorGUILayout.ToggleLeft ("I'll position my characters in 3D space", screenSpace);
                }
                else if (cameraPerspective_int == 1)
                {
                    GUILayout.Space (5f);
                    GUILayout.Label ("2.5D games mixes 3D characters with 2D backgrounds. By default, 2.5D games group several backgrounds into one scene, and swap them out according to the camera angle.\nIf you prefer, you can work with just one background in a scene, to create a more traditional 2D-like adventure.");
                    oneScenePerBackground = EditorGUILayout.ToggleLeft ("I'll work with one background per scene", oneScenePerBackground);
                }
                else if (cameraPerspective_int == 2)
                {
                    GUILayout.Label ("3D games can still have sprite-based Characters, but having a true 3D environment is more flexible so far as Player control goes. How should your Player character be controlled?");
                    movementMethod = (MovementMethod) EditorGUILayout.EnumPopup (movementMethod);
                }
            }

            else if (pageNumber == 3)
            {
                if (cameraPerspective_int == 1 && !oneScenePerBackground)
                {
                    GUILayout.Label ("Do you want to play the game ONLY with a keyboard or controller?");
                    directControl = EditorGUILayout.ToggleLeft ("Yes", directControl);
                    GUILayout.Space (5f);
                }
                else if (cameraPerspective_int == 2 && movementMethod == MovementMethod.Drag)
                {
                    GUILayout.Label ("Is your game designed for Touch-screen devices?");
                    touchScreen = EditorGUILayout.ToggleLeft ("Yes", touchScreen);
                    GUILayout.Space (5f);
                }

                GUILayout.Label ("How do you want to interact with Hotspots?");
                interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup (interactionMethod);
                if (interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.HelpBox ("This method simplifies interactions to either Use, Examine, or Use Inventory. Hotspots can be interacted with in just one click.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.HelpBox ("This method emulates the classic 'Sierra-style' interface, in which the player chooses from a list of verbs, and then the Hotspot they wish to interact with.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    EditorGUILayout.HelpBox ("This method involves first choosing a Hotspot, and then from a range of available interactions, which can be customised in the Editor.", MessageType.Info);
                }
            }

            else if (pageNumber == 4)
            {
                GUILayout.Label ("Please choose what interface you would like to start with. It can be changed at any time - this is just to help you get started.");
                wizardMenu = (WizardMenu) EditorGUILayout.EnumPopup (wizardMenu);
            }

            else if (pageNumber == 5)
            {
                GUILayout.Label ("The following values have been set based on your choices. Please review them and amend if necessary, then click 'Finish' to create your game template.");
                GUILayout.Space (5f);

                gameName = EditorGUILayout.TextField ("Game name:", gameName);
                cameraPerspective_int = (int) cameraPerspective;
                cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
                cameraPerspective = (CameraPerspective) cameraPerspective_int;

                if (cameraPerspective == CameraPerspective.TwoD)
                {
                    movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning);
                }

                movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod);
                inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
                interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);
                hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection);

                wizardMenu = (WizardMenu) EditorGUILayout.EnumPopup ("GUI type:", wizardMenu);
            }

            else if (pageNumber == 6)
            {
                GUILayout.Label ("Congratulations, your game's Managers have been set up!");
                GUILayout.Space (5f);
                GUILayout.Label ("Your scene objects have also been organised for Adventure Creator to use. Your next step is to create and set your Player prefab, which you can assign in your Settings Manager.");
            }
        }
コード例 #40
0
        public override string ReadLine()
        {
            _inputMethod = InputMethod.Unknown;

            var task = Task.Factory.StartNew(() =>
            {
                var s = System.Console.ReadLine();
                _inputMethod = InputMethod.Keyboard;
                if (!_reading) return;
                _input = s;
                _autoResetEvent.Set();
            });

            _mainSpeechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);

            _reading = true;
            _autoResetEvent.WaitOne();
            _reading = false;

            _mainSpeechRecognitionEngine.RecognizeAsyncCancel();

            if (_inputMethod == InputMethod.Voice)
            {
                var hwnd = Process.GetCurrentProcess().MainWindowHandle;
                PostMessage(hwnd, Keydown, Retrun, 0);
            }

            task.Wait();
            task.Dispose();

            return _input;
        }
コード例 #41
0
        public override ConsoleKeyInfo ReadKey()
        {
            _inputMethod = InputMethod.Unknown;

            var task = Task.Factory.StartNew(() =>
            {
                var s = System.Console.ReadKey();
                //var s = _consoleReader.ReadKey();
                _inputMethod = InputMethod.Keyboard;
                if (!_reading) return;
                _keyInput = s;
                _autoResetEvent.Set();
            });

            _subSpeechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);

            _reading = true;
            _autoResetEvent.WaitOne();
            _reading = false;

            _subSpeechRecognitionEngine.RecognizeAsyncCancel();

            ////if (_inputMethod == InputMethod.Voice)
            ////{
            ////    if (_input == "tab")
            ////        _keyInput = new ConsoleKeyInfo((char)10, ConsoleKey.Tab, false, false, false);

            ////    var hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
            ////    PostMessage(hWnd, WM_KEYDOWN, _keyInput.KeyChar, 0);
            ////}

            task.Wait();
            task.Dispose();

            //return _keyInput;
            _reading = false;
            return _keyInput;
        }
コード例 #42
0
        private void Process()
        {
            if (cameraPerspective_int == 0)
            {
                cameraPerspective = CameraPerspective.TwoD;
                if (screenSpace)
                {
                    movingTurning = MovingTurning.ScreenSpace;
                }
                else
                {
                    movingTurning = MovingTurning.Unity2D;
                }

                movementMethod = MovementMethod.PointAndClick;
                inputMethod = InputMethod.MouseAndKeyboard;
                hotspotDetection = HotspotDetection.MouseOver;
            }
            else if (cameraPerspective_int == 1)
            {
                if (oneScenePerBackground)
                {
                    cameraPerspective = CameraPerspective.TwoD;
                    movingTurning = MovingTurning.ScreenSpace;
                    movementMethod = MovementMethod.PointAndClick;
                    inputMethod = InputMethod.MouseAndKeyboard;
                    hotspotDetection = HotspotDetection.MouseOver;
                }
                else
                {
                    cameraPerspective = CameraPerspective.TwoPointFiveD;

                    if (directControl)
                    {
                        movementMethod = MovementMethod.Direct;
                        inputMethod = InputMethod.KeyboardOrController;
                        hotspotDetection = HotspotDetection.PlayerVicinity;
                    }
                    else
                    {
                        movementMethod = MovementMethod.PointAndClick;
                        inputMethod = InputMethod.MouseAndKeyboard;
                        hotspotDetection = HotspotDetection.MouseOver;
                    }
                }
            }
            else if (cameraPerspective_int == 2)
            {
                cameraPerspective = CameraPerspective.ThreeD;
                hotspotDetection = HotspotDetection.MouseOver;

                inputMethod = InputMethod.MouseAndKeyboard;
                if (movementMethod == MovementMethod.Drag)
                {
                    if (touchScreen)
                    {
                        inputMethod = InputMethod.TouchScreen;
                    }
                    else
                    {
                        inputMethod = InputMethod.MouseAndKeyboard;
                    }
                }
            }
        }
コード例 #43
0
 public VLCManagedEncoder(string sout, string[] arguments, StreamContext context, InputMethod inputMethod, string input)
     : this(sout, arguments, context, inputMethod)
 {
     this.inputPath = input;
 }
コード例 #44
0
 private void _mainSpeechRecognitionEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
 {
     if (_reading)
     {
         _inputMethod = InputMethod.Voice;
         _input = e.Result.Text;
         //System.Console.Write(_input);
         _consoleWriter.Write(_input);
         _autoResetEvent.Set();
     }
 }
コード例 #45
0
		public void ShowGUI ()
		{
			EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel);
			
			if (saveFileName == "")
			{
				saveFileName = SaveSystem.SetProjectName ();
			}
			saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName);
			#if !UNITY_WEBPLAYER && !UNITY_ANDROID
			saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay);
			takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots);
			#else
			EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer and Android platforms.", MessageType.Info);
			takeSaveScreenshots = false;
			#endif
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel);
			
			actionListOnStart = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on start game:", actionListOnStart, typeof (ActionListAsset), false);
			blackOutWhenSkipping = EditorGUILayout.Toggle ("Black out when skipping?", blackOutWhenSkipping);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Character settings:", EditorStyles.boldLabel);
			
			CreatePlayersGUI ();
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Interface settings", EditorStyles.boldLabel);
			
			movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod);
			if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ())
			{
				EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
			}

			inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
			interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);
			
			if (inputMethod != InputMethod.TouchScreen)
			{
				useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya);
				if (useOuya && !OuyaIntegration.IsDefinePresent ())
				{
					EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
				}
				if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
				{
					selectInteractions = (SelectInteractions) EditorGUILayout.EnumPopup ("Select Interactions by:", selectInteractions);
					if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot)
					{
						seeInteractions = (SeeInteractions) EditorGUILayout.EnumPopup ("See Interactions with:", seeInteractions);
					}
					if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
					{
						cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Cycle through Inventory items too?", cycleInventoryCursors);
						autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract);
					}
				
					if (SelectInteractionMethod () == SelectInteractions.ClickingMenu)
					{
						cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions);
					}
					else
					{
						cancelInteractions = CancelInteractions.CursorLeavesMenus;
					}
				}
			}
			if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
			{
				autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract);
			}
			lockCursorOnStart = EditorGUILayout.ToggleLeft ("Lock cursor in screen's centre when game begins?", lockCursorOnStart);
			hideLockedCursor = EditorGUILayout.ToggleLeft ("Hide cursor when locked in screen's centre?", hideLockedCursor);
			if (IsInFirstPerson ())
			{
				disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", disableFreeAimWhenDragging);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel);
			
			reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations);
			if (interactionMethod != AC_InteractionMethod.ContextSensitive)
			{
				inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions);
			}
			if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
			{
				inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop);
				if (!inventoryDragDrop)
				{
					inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft);
					if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
					{
						rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory);
					}
					
					if (movementMethod == MovementMethod.PointAndClick)
					{
						canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive);
					}
				}
				else
				{
					inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook);
				}
				inventoryActiveEffect = (InventoryActiveEffect) EditorGUILayout.EnumPopup ("Active cursor FX:", inventoryActiveEffect);
				if (inventoryActiveEffect == InventoryActiveEffect.Pulse)
				{
					inventoryPulseSpeed = EditorGUILayout.Slider ("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f);
				}
				activeWhenUnhandled = EditorGUILayout.ToggleLeft ("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled);
				canReorderItems = EditorGUILayout.ToggleLeft ("Items can be re-ordered in Menu?", canReorderItems);
				hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu);
			}
			activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel);
			EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Movement settings", EditorStyles.boldLabel);
			
			if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag)
			{
				dragWalkThreshold = EditorGUILayout.FloatField ("Walk threshold:", dragWalkThreshold);
				dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
				
				if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson)
				{
					freeAimTouchSpeed = EditorGUILayout.FloatField ("Freelook speed:", freeAimTouchSpeed);
				}
				
				drawDragLine = EditorGUILayout.Toggle ("Draw drag line?", drawDragLine);
				if (drawDragLine)
				{
					dragLineWidth = EditorGUILayout.FloatField ("Drag line width:", dragLineWidth);
					dragLineColor = EditorGUILayout.ColorField ("Drag line colour:", dragLineColor);
				}
			}
			else if (movementMethod == MovementMethod.Direct)
			{
				directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType);
				if (directMovementType == DirectMovementType.RelativeToCamera)
				{
					limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement);
				}
			}
			else if (movementMethod == MovementMethod.PointAndClick)
			{
				clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false);
				walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f);
				doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement);
			}
			if (movementMethod == MovementMethod.StraightToCursor)
			{
				dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
				singleTapStraight = EditorGUILayout.Toggle ("Single-click works too?", singleTapStraight);
			}
			if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
			{
				dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects);
			}
			if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen)
			{
				jumpSpeed = EditorGUILayout.Slider ("Jump speed:", jumpSpeed, 1f, 10f);
			}
			
			destinationAccuracy = EditorGUILayout.Slider ("Destination accuracy:", destinationAccuracy, 0f, 1f);
			
			if (inputMethod == InputMethod.TouchScreen)
			{
				EditorGUILayout.Space ();
				EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel);
				
				offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor);
				doubleTapHotspots = EditorGUILayout.Toggle ("Double-tap Hotspots?", doubleTapHotspots);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Camera settings", EditorStyles.boldLabel);
			
			cameraPerspective_int = (int) cameraPerspective;
			cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
			cameraPerspective = (CameraPerspective) cameraPerspective_int;
			if (movementMethod == MovementMethod.FirstPerson)
			{
				cameraPerspective = CameraPerspective.ThreeD;
			}
			if (cameraPerspective == CameraPerspective.TwoD)
			{
				movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning);
				if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D)
				{
					verticalReductionFactor = EditorGUILayout.Slider ("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f);
				}
			}
			
			forceAspectRatio = EditorGUILayout.Toggle ("Force aspect ratio?", forceAspectRatio);
			if (forceAspectRatio)
			{
				wantedAspectRatio = EditorGUILayout.FloatField ("Aspect ratio:", wantedAspectRatio);
				#if UNITY_IPHONE
				landscapeModeOnly = EditorGUILayout.Toggle ("Landscape-mode only?", landscapeModeOnly);
				#endif
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Hotpot settings", EditorStyles.boldLabel);
			
			hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection);
			
			if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson ()))
			{
				hotspotsInVicinity = (HotspotsInVicinity) EditorGUILayout.EnumPopup ("Hotspots in vicinity:", hotspotsInVicinity);
			}
			
			if (cameraPerspective != CameraPerspective.TwoD)
			{
				playerFacesHotspots = EditorGUILayout.Toggle ("Player turns head to active?", playerFacesHotspots);
			}
			
			hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icon:", hotspotIconDisplay);
			if (hotspotIconDisplay != HotspotIconDisplay.Never)
			{
				hotspotIcon = (HotspotIcon) EditorGUILayout.EnumPopup ("Hotspot icon type:", hotspotIcon);
				if (hotspotIcon == HotspotIcon.Texture)
				{
					hotspotIconTexture = (Texture2D) EditorGUILayout.ObjectField ("Hotspot icon texture:", hotspotIconTexture, typeof (Texture2D), false);
				}
				hotspotIconSize = EditorGUILayout.FloatField ("Hotspot icon size:", hotspotIconSize);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Raycast settings", EditorStyles.boldLabel);
			navMeshRaycastLength = EditorGUILayout.FloatField ("NavMesh ray length:", navMeshRaycastLength);
			hotspotRaycastLength = EditorGUILayout.FloatField ("Hotspot ray length:", hotspotRaycastLength);
			moveableRaycastLength = EditorGUILayout.FloatField ("Moveable ray length:", moveableRaycastLength);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Layer names", EditorStyles.boldLabel);
			
			hotspotLayer = EditorGUILayout.TextField ("Hotspot:", hotspotLayer);
			navMeshLayer = EditorGUILayout.TextField ("Nav mesh:", navMeshLayer);
			if (cameraPerspective == CameraPerspective.TwoPointFiveD)
			{
				backgroundImageLayer = EditorGUILayout.TextField ("Background image:", backgroundImageLayer);
			}
			deactivatedLayer = EditorGUILayout.TextField ("Deactivated:", deactivatedLayer);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Loading scene", EditorStyles.boldLabel);
			useLoadingScreen = EditorGUILayout.Toggle ("Use loading screen?", useLoadingScreen);
			if (useLoadingScreen)
			{
				loadingSceneIs = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose loading scene by:", loadingSceneIs);
				if (loadingSceneIs == ChooseSceneBy.Name)
				{
					loadingSceneName = EditorGUILayout.TextField ("Loading scene name:", loadingSceneName);
				}
				else
				{
					loadingScene = EditorGUILayout.IntField ("Loading screen scene:", loadingScene);
				}
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel);
			
			if (!PlayerPrefs.HasKey (ppKey))
			{
				optionsData = new OptionsData ();
				optionsBinary = Serializer.SerializeObjectBinary (optionsData);
				PlayerPrefs.SetString (ppKey, optionsBinary);
			}
			
			optionsBinary = PlayerPrefs.GetString (ppKey);
			optionsData = Serializer.DeserializeObjectBinary <OptionsData> (optionsBinary);
			
			optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f);
			optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f);
			optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f);
			optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles);
			optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language);
			
			optionsBinary = Serializer.SerializeObjectBinary (optionsData);
			PlayerPrefs.SetString (ppKey, optionsBinary);
			
			if (GUILayout.Button ("Reset options data"))
			{
				PlayerPrefs.DeleteKey ("Options");
				optionsData = new OptionsData ();
				Debug.Log ("PlayerPrefs cleared");
			}
			
			if (GUI.changed)
			{
				EditorUtility.SetDirty (this);
			}
		}
コード例 #46
0
        private void _subSpeechRecognitionEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            if (_reading)
            {
                _inputMethod = InputMethod.Voice;
                _input = e.Result.Text;

                var hwnd = Process.GetCurrentProcess().MainWindowHandle;

                switch (_input)
                {
                    case "tab":
                        PostMessage(hwnd, Keydown, 9, 0);
                        break;
                    case "enter":
                        PostMessage(hwnd, Keydown, 13, 0);
                        break;
                }
            }
        }
コード例 #47
0
ファイル: Worm.cs プロジェクト: cjacobwade/WormBall
	// Use this for initialization
	void Start () 
	{
		WiggleLogic = SkilledTankWiggleLogic;
		initSegmentNum = segmentNum;

		gameObject.layer = LayerMask.NameToLayer("Beak" + playerNum);
		transform.GetChild(0).gameObject.layer = LayerMask.NameToLayer("Beak" + playerNum);
		mouth = transform.GetChild(0);

		moveSpeed = defaultMoveSpeed;
		rotSpeed = defaultRotSpeed;
		defaultScale = transform.localScale.x;

		SetupBody(segmentNum);
		GetComponent<Renderer>().material.SetFloat("_OverlayAlpha", 0.0f);

		moveHighlightSprite = WadeUtils.Instantiate( moveHighlightObj ).GetComponent<SpriteRenderer>();
		moveHighlightSprite.color = new Color(0f, 0f, 0f, 0f);
		moveHighlightSprite.transform.parent = transform;
		moveHighlightSprite.transform.localPosition = Vector3.zero;

		carryHighlightSprite = WadeUtils.Instantiate( carryHighlightObj ).GetComponent<SpriteRenderer>();
		carryHighlightSprite.color = new Color(1f, 0f, 0f, 0f);
		carryHighlightSprite.transform.parent = segments[5];
		carryHighlightSprite.transform.localPosition = Vector3.zero;

		initCarryHighlightScale = carryHighlightSprite.transform.localScale.x;
	}
コード例 #48
0
ファイル: Worm.cs プロジェクト: cjacobwade/WormBall
	public void SetControls(string schemeName)
	{
		if(schemeName == "OGControls")
		{
			WiggleLogic = WiggleAlternateLogic;
		}
		else if(schemeName == "StarwhalControls")
		{
			WiggleLogic = StarwhalWiggleLogic;
		}
		else if(schemeName == "TankControls")
		{
			WiggleLogic = TankWiggleLogic;
		}
		else if(schemeName == "SkilledTankControls")
		{
			WiggleLogic = SkilledTankWiggleLogic;
		}

		speedBoost = 1f;
	}
コード例 #49
0
ファイル: SettingsManager.cs プロジェクト: IJkeB/Ekster_Final
        public void ShowGUI()
        {
            EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel);

            if (saveFileName == "")
            {
                saveFileName = SaveSystem.SetProjectName ();
            }
            maxSaves = EditorGUILayout.IntField ("Max. number of saves:", maxSaves);
            saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName);
            useProfiles = EditorGUILayout.ToggleLeft ("Enable save game profiles?", useProfiles);
            #if !UNITY_WEBPLAYER && !UNITY_ANDROID && !UNITY_WINRT && !UNITY_WII
            saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay);
            takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots);
            orderSavesByUpdateTime = EditorGUILayout.ToggleLeft ("Order save lists by update time?", orderSavesByUpdateTime);
            #else
            EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer, Windows Store and Android platforms.", MessageType.Info);
            takeSaveScreenshots = false;
            #endif

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel);

            actionListOnStart = ActionListAssetMenu.AssetGUI ("ActionList on start game:", actionListOnStart);
            blackOutWhenSkipping = EditorGUILayout.Toggle ("Black out when skipping?", blackOutWhenSkipping);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Character settings:", EditorStyles.boldLabel);

            CreatePlayersGUI ();

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Interface settings", EditorStyles.boldLabel);

            movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod);
            if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ())
            {
                EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
            interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);

            if (inputMethod != InputMethod.TouchScreen)
            {
                useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya);
                if (useOuya && !OuyaIntegration.IsDefinePresent ())
                {
                    EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                }
                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    selectInteractions = (SelectInteractions) EditorGUILayout.EnumPopup ("Select Interactions by:", selectInteractions);
                    if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        seeInteractions = (SeeInteractions) EditorGUILayout.EnumPopup ("See Interactions with:", seeInteractions);
                        if (seeInteractions == SeeInteractions.ClickOnHotspot)
                        {
                            stopPlayerOnClickHotspot = EditorGUILayout.ToggleLeft ("Stop player moving when click Hotspot?", stopPlayerOnClickHotspot);
                        }
                    }

                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract);
                    }

                    if (SelectInteractionMethod () == SelectInteractions.ClickingMenu)
                    {
                        clickUpInteractions = EditorGUILayout.ToggleLeft ("Trigger interaction by releasing click?", clickUpInteractions);
                        cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions);
                    }
                    else
                    {
                        cancelInteractions = CancelInteractions.CursorLeavesMenu;
                    }
                }
            }
            if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
            {
                autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract);
            }

            if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                // First person dragging only works if cursor is unlocked
                lockCursorOnStart = false;
            }
            else
            {
                lockCursorOnStart = EditorGUILayout.ToggleLeft ("Lock cursor in screen's centre when game begins?", lockCursorOnStart);
                hideLockedCursor = EditorGUILayout.ToggleLeft ("Hide cursor when locked in screen's centre?", hideLockedCursor);
                onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft ("Disallow Interactions if cursor is locked?", onlyInteractWhenCursorUnlocked);
            }
            if (IsInFirstPerson ())
            {
                disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", disableFreeAimWhenDragging);

                if (movementMethod == MovementMethod.FirstPerson)
                {
                    useFPCamDuringConversations = EditorGUILayout.ToggleLeft ("Run Conversations in first-person?", useFPCamDuringConversations);
                }
            }
            if (inputMethod != InputMethod.TouchScreen)
            {
                runConversationsWithKeys = EditorGUILayout.ToggleLeft ("Dialogue options can be selected with number keys?", runConversationsWithKeys);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel);

            if (interactionMethod != AC_InteractionMethod.ContextSensitive)
            {
                inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions);

                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Interaction cycles?", cycleInventoryCursors);
                    }
                    else
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Interaction menus?", cycleInventoryCursors);
                    }
                }

                if (inventoryInteractions == InventoryInteractions.Multiple && CanSelectItems (false))
                {
                    selectInvWithUnhandled = EditorGUILayout.ToggleLeft ("Select item if Interaction is unhandled?", selectInvWithUnhandled);
                    if (selectInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            selectInvWithIconID = GetIconID ("Select with unhandled:", selectInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }

                    giveInvWithUnhandled = EditorGUILayout.ToggleLeft ("Give item if Interaction is unhandled?", giveInvWithUnhandled);
                    if (giveInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            giveInvWithIconID = GetIconID ("Give with unhandled:", giveInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }
                }
            }

            if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.ClickingMenu && inventoryInteractions == InventoryInteractions.Multiple)
            {}
            else
            {
                reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations);
            }

            //if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
            if (CanSelectItems (false))
            {
                inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop);
                if (!inventoryDragDrop)
                {
                    if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
                    {
                        rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory);
                    }
                }
                else if (inventoryInteractions == AC.InventoryInteractions.Single)
                {
                    inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook);
                }
            }

            if (CanSelectItems (false) && !inventoryDragDrop)
            {
                inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft);

                if (movementMethod == MovementMethod.PointAndClick && !inventoryDisableLeft)
                {
                    canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive);
                }
            }

            inventoryActiveEffect = (InventoryActiveEffect) EditorGUILayout.EnumPopup ("Active cursor FX:", inventoryActiveEffect);
            if (inventoryActiveEffect == InventoryActiveEffect.Pulse)
            {
                inventoryPulseSpeed = EditorGUILayout.Slider ("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f);
            }

            activeWhenUnhandled = EditorGUILayout.ToggleLeft ("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled);
            canReorderItems = EditorGUILayout.ToggleLeft ("Items can be re-ordered in Menu?", canReorderItems);
            hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu);
            activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Movement settings", EditorStyles.boldLabel);

            if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag)
            {
                dragWalkThreshold = EditorGUILayout.FloatField ("Walk threshold:", dragWalkThreshold);
                dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);

                if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson)
                {
                    freeAimTouchSpeed = EditorGUILayout.FloatField ("Freelook speed:", freeAimTouchSpeed);
                }

                drawDragLine = EditorGUILayout.Toggle ("Draw drag line?", drawDragLine);
                if (drawDragLine)
                {
                    dragLineWidth = EditorGUILayout.FloatField ("Drag line width:", dragLineWidth);
                    dragLineColor = EditorGUILayout.ColorField ("Drag line colour:", dragLineColor);
                }
            }
            else if (movementMethod == MovementMethod.Direct)
            {
                magnitudeAffectsDirect = EditorGUILayout.ToggleLeft ("Input magnitude affects speed?", magnitudeAffectsDirect);
                directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType);
                if (directMovementType == DirectMovementType.RelativeToCamera)
                {
                    limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement);
                    if (cameraPerspective == CameraPerspective.ThreeD)
                    {
                        directMovementPerspective = EditorGUILayout.ToggleLeft ("Account for player's position on screen?", directMovementPerspective);
                    }
                }
            }
            else if (movementMethod == MovementMethod.PointAndClick)
            {
                clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false);
                walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f);
                doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement);
            }
            if (movementMethod == MovementMethod.StraightToCursor)
            {
                dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
                singleTapStraight = EditorGUILayout.ToggleLeft ("Single-clicking also moves player?", singleTapStraight);
                if (singleTapStraight)
                {
                    singleTapStraightPathfind = EditorGUILayout.ToggleLeft ("Pathfind when single-clicking?", singleTapStraightPathfind);
                }
            }
            if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects);
            }
            if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen)
            {
                jumpSpeed = EditorGUILayout.Slider ("Jump speed:", jumpSpeed, 1f, 10f);
            }

            destinationAccuracy = EditorGUILayout.Slider ("Destination accuracy:", destinationAccuracy, 0f, 1f);
            if (destinationAccuracy == 1f && movementMethod != MovementMethod.StraightToCursor)
            {
                experimentalAccuracy = EditorGUILayout.ToggleLeft ("Attempt to be super-accurate? (Experimental)", experimentalAccuracy);
            }

            if (inputMethod == InputMethod.TouchScreen)
            {
                EditorGUILayout.Space ();
                EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel);

                if (movementMethod != MovementMethod.FirstPerson)
                {
                    offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor);
                }
                doubleTapHotspots = EditorGUILayout.Toggle ("Double-tap Hotspots?", doubleTapHotspots);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Camera settings", EditorStyles.boldLabel);

            cameraPerspective_int = (int) cameraPerspective;
            cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
            cameraPerspective = (CameraPerspective) cameraPerspective_int;
            if (movementMethod == MovementMethod.FirstPerson)
            {
                cameraPerspective = CameraPerspective.ThreeD;
            }
            if (cameraPerspective == CameraPerspective.TwoD)
            {
                movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning);
                if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D)
                {
                    verticalReductionFactor = EditorGUILayout.Slider ("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f);
                }
            }

            forceAspectRatio = EditorGUILayout.Toggle ("Force aspect ratio?", forceAspectRatio);
            if (forceAspectRatio)
            {
                wantedAspectRatio = EditorGUILayout.FloatField ("Aspect ratio:", wantedAspectRatio);
                #if UNITY_IPHONE
                landscapeModeOnly = EditorGUILayout.Toggle ("Landscape-mode only?", landscapeModeOnly);
                #endif
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Hotpot settings", EditorStyles.boldLabel);

            hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection);
            if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson ()))
            {
                hotspotsInVicinity = (HotspotsInVicinity) EditorGUILayout.EnumPopup ("Hotspots in vicinity:", hotspotsInVicinity);
            }
            else if (hotspotDetection == HotspotDetection.MouseOver)
            {
                scaleHighlightWithMouseProximity = EditorGUILayout.ToggleLeft ("Highlight Hotspots based on cursor proximity?", scaleHighlightWithMouseProximity);
                if (scaleHighlightWithMouseProximity)
                {
                    highlightProximityFactor = EditorGUILayout.FloatField ("Cursor proximity factor:", highlightProximityFactor);
                }
            }

            if (cameraPerspective != CameraPerspective.TwoD)
            {
                playerFacesHotspots = EditorGUILayout.ToggleLeft ("Player turns head to active Hotspot?", playerFacesHotspots);
            }

            hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icon:", hotspotIconDisplay);
            if (hotspotIconDisplay != HotspotIconDisplay.Never)
            {
                if (cameraPerspective != CameraPerspective.TwoD)
                {
                    occludeIcons = EditorGUILayout.ToggleLeft ("Don't show behind Colliders?", occludeIcons);
                }
                hotspotIcon = (HotspotIcon) EditorGUILayout.EnumPopup ("Hotspot icon type:", hotspotIcon);
                if (hotspotIcon == HotspotIcon.Texture)
                {
                    hotspotIconTexture = (Texture2D) EditorGUILayout.ObjectField ("Hotspot icon texture:", hotspotIconTexture, typeof (Texture2D), false);
                }
                hotspotIconSize = EditorGUILayout.FloatField ("Hotspot icon size:", hotspotIconSize);
                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction &&
                    selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot &&
                    hotspotIconDisplay != HotspotIconDisplay.OnlyWhenFlashing)
                {
                    hideIconUnderInteractionMenu = EditorGUILayout.ToggleLeft ("Hide when Interaction Menus are visible?", hideIconUnderInteractionMenu);
                }
            }

            #if UNITY_5
            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Audio settings", EditorStyles.boldLabel);
            volumeControl = (VolumeControl) EditorGUILayout.EnumPopup ("Volume controlled by:", volumeControl);
            if (volumeControl == VolumeControl.AudioMixerGroups)
            {
                musicMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Music mixer:", musicMixerGroup, typeof (AudioMixerGroup), false);
                sfxMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("SFX mixer:", sfxMixerGroup, typeof (AudioMixerGroup), false);
                speechMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Speech mixer:", speechMixerGroup, typeof (AudioMixerGroup), false);
                musicAttentuationParameter = EditorGUILayout.TextField ("Music atten. parameter:", musicAttentuationParameter);
                sfxAttentuationParameter = EditorGUILayout.TextField ("SFX atten. parameter:", sfxAttentuationParameter);
                speechAttentuationParameter = EditorGUILayout.TextField ("Speech atten. parameter:", speechAttentuationParameter);
            }
            #endif

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Raycast settings", EditorStyles.boldLabel);
            navMeshRaycastLength = EditorGUILayout.FloatField ("NavMesh ray length:", navMeshRaycastLength);
            hotspotRaycastLength = EditorGUILayout.FloatField ("Hotspot ray length:", hotspotRaycastLength);
            moveableRaycastLength = EditorGUILayout.FloatField ("Moveable ray length:", moveableRaycastLength);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Layer names", EditorStyles.boldLabel);

            hotspotLayer = EditorGUILayout.TextField ("Hotspot:", hotspotLayer);
            navMeshLayer = EditorGUILayout.TextField ("Nav mesh:", navMeshLayer);
            if (cameraPerspective == CameraPerspective.TwoPointFiveD)
            {
                backgroundImageLayer = EditorGUILayout.TextField ("Background image:", backgroundImageLayer);
            }
            deactivatedLayer = EditorGUILayout.TextField ("Deactivated:", deactivatedLayer);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Loading scene", EditorStyles.boldLabel);
            useLoadingScreen = EditorGUILayout.Toggle ("Use loading screen?", useLoadingScreen);
            if (useLoadingScreen)
            {
                loadingSceneIs = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose loading scene by:", loadingSceneIs);
                if (loadingSceneIs == ChooseSceneBy.Name)
                {
                    loadingSceneName = EditorGUILayout.TextField ("Loading scene name:", loadingSceneName);
                }
                else
                {
                    loadingScene = EditorGUILayout.IntField ("Loading screen scene:", loadingScene);
                }
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel);

            optionsData = Options.LoadPrefsFromID (0, false, true);
            if (optionsData == null)
            {
                Debug.Log ("Saved new prefs");
                Options.SaveDefaultPrefs (optionsData);
            }

            defaultSpeechVolume = optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f);
            defaultMusicVolume = optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f);
            defaultSfxVolume = optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f);
            defaultShowSubtitles = optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles);
            defaultLanguage = optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language);

            Options.SaveDefaultPrefs (optionsData);

            if (GUILayout.Button ("Reset options data"))
            {
                optionsData = new OptionsData ();

                optionsData.language = 0;
                optionsData.speechVolume = 1f;
                optionsData.musicVolume = 0.6f;
                optionsData.sfxVolume = 0.9f;
                optionsData.showSubtitles = false;

                Options.SavePrefsToID (0, optionsData, true);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Debug settings", EditorStyles.boldLabel);
            showActiveActionLists = EditorGUILayout.ToggleLeft ("List active ActionLists in Game window?", showActiveActionLists);
            showHierarchyIcons = EditorGUILayout.ToggleLeft ("Show icons in Hierarchy window?", showHierarchyIcons);

            if (GUI.changed)
            {
                EditorUtility.SetDirty (this);
            }
        }
コード例 #50
0
ファイル: XnaInput.cs プロジェクト: shader/XnaInput
 /// <summary>
 /// Allows you to assign a custom-made InputMethod to a control.
 /// InputMethods take no arguments, and return a float.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="name"></param>
 /// <param name="method"></param>
 public void AssignControl(PlayerIndex player, string name, InputMethod method)
 {
     PlayerControls[player][name] = method;
 }
コード例 #51
0
ファイル: XnaInput.cs プロジェクト: shader/XnaInput
 /// <summary>
 /// Allows you to assign a custom-made InputMethod to a control for all players.
 /// InputMethods take no arguments, and return a float.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="name"></param>
 /// <param name="method"></param>
 public void AssignControl(string name, InputMethod method)
 {
     AssignControl(PlayerIndex.One, name, method);
     AssignControl(PlayerIndex.Two, name, method);
     AssignControl(PlayerIndex.Three, name, method);
     AssignControl(PlayerIndex.Four, name, method);
 }