示例#1
0
    protected void SetMode(InputMode mode)
    {
        Debug.LogFormat("Setting mode to {0}", mode.ToString());
        currentMode = mode;
        switch (currentMode)
        {
        case InputMode.Idle:
            if (OnChangeToIdleEvent != null)
            {
                OnChangeToIdleEvent();
            }
            break;

        case InputMode.Properties:
            if (OnChangeToPropertiesEvent != null)
            {
                OnChangeToPropertiesEvent();
            }
            break;

        case InputMode.Connect:
            if (OnChangeToConnectEvent != null)
            {
                OnChangeToConnectEvent();
            }
            break;

        case InputMode.Drag:
            if (OnChangeToDragEvent != null)
            {
                OnChangeToDragEvent();
            }
            break;
        }
    }
        public void SwitchInputMode(InputMode inputMode, String deviceIdToListenTo)
        {
            desiredInputMode          = inputMode;
            desiredDeviceIdToListenTo = deviceIdToListenTo;

            Console.WriteLine("Switching input mode to " + inputMode.ToString() + " for device " + deviceIdToListenTo);
        }
示例#3
0
 public void ChangeMode(InputMode mode)
 {
     var member = GetType().GetField(string.Format("_{0}Dict", mode.ToString().ToLower()), BindingFlags.NonPublic | BindingFlags.Instance);
     if (member == null) throw new Exception(mode + " does not have a dictionary set up");
     _currentDict = (SequencedDictionary<Key, Message>)member.GetValue(this);
     InputMode = mode;
 }
示例#4
0
    private void Start()
    {
        horizontalAxis = mode.ToString() + " Horizontal";
        verticalAxis   = mode.ToString() + " Vertical";
        blinkButton    = mode.ToString() + " Blink";
        fireButton     = mode.ToString() + " Fire";

        blink      = false;
        blinkTimer = 0f;

        shaker  = GetComponentInChildren <CameraShake>();
        shooter = GetComponent <ShootingComponent>();

        gameManager = GameManager.instance;

        health = GetComponent <HealthComponent>();
    }
 public void ShowInputScheme(InputMode mode)
 {
     if (mode == null)
     {
         inputSchemeText.text = "Custom";
     }
     else
     {
         inputSchemeText.text = mode.ToString();
     }
 }
    public void SavePreferences()
    {
        if (EnableSound)
        {
            PlayerPrefs.SetString("EnableSound", "ON");
        }
        else
        {
            PlayerPrefs.SetString("EnableSound", "OFF");
        }

        if (EnableReplay)
        {
            PlayerPrefs.SetString("EnableReplay", "ON");
        }
        else
        {
            PlayerPrefs.SetString("EnableReplay", "OFF");
        }

        if (MinHelp)
        {
            PlayerPrefs.SetString("MinHelp", "ON");
        }
        else
        {
            PlayerPrefs.SetString("MinHelp", "OFF");
        }


        if (MaxHelp)
        {
            PlayerPrefs.SetString("MaxHelp", "ON");
        }
        else
        {
            PlayerPrefs.SetString("MaxHelp", "OFF");
        }

        if (TimeHelp)
        {
            PlayerPrefs.SetString("TimeHelp", "ON");
        }
        else
        {
            PlayerPrefs.SetString("TimeHelp", "OFF");
        }

        PlayerPrefs.SetString("CurrentInputMode", CurrentInputMode.ToString());
        PlayerPrefs.Save();
    }
 protected void SetMode(InputMode mode)
 {
     Debug.LogFormat("Setting mode to {0}", mode.ToString());
     currentMode = mode;
     switch (currentMode)
     {
         case InputMode.Idle:
             if (OnChangeToIdleEvent != null) OnChangeToIdleEvent();
             break;
         case InputMode.Properties:
             if (OnChangeToPropertiesEvent != null) OnChangeToPropertiesEvent();
             break;
         case InputMode.Connect:
             if (OnChangeToConnectEvent != null) OnChangeToConnectEvent();
             break;
         case InputMode.Drag:
             if (OnChangeToDragEvent != null) OnChangeToDragEvent();
             break;
     }
 }
示例#8
0
        public void SwitchInputMode(InputMode inputMode, String deviceIdToListenTo)
        {
            desiredInputMode = inputMode;
                desiredDeviceIdToListenTo = deviceIdToListenTo;

                Console.WriteLine("Switching input mode to " + inputMode.ToString() + " for device " + deviceIdToListenTo);
        }
示例#9
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();

            string inputm = "";

            do
            {
                Dialog.InputBox("Enter input mode", "Input mode:", ref inputm);
            } while (!Enum.TryParse <InputMode>(inputm, out inputMode));

            if (collectingData)
            {
                if (Dialog.InputBox("Enter user name", "User name:", ref username) == DialogResult.OK)
                {
                    try {
                        DateTime dt = DateTime.Now;
                        accessDirectory = username + inputMode.ToString() + " " + dt.Day + "-" + dt.Month + " " + dt.Hour + ";" + dt.Minute;
                        if (Directory.Exists(accessDirectory))
                        {
                            Console.Out.WriteLine("Directory exists");
                            this.Exit();
                            return;
                        }
                        DirectoryInfo di = Directory.CreateDirectory(accessDirectory);
                    } catch (Exception e) {
                        Console.Out.WriteLine("Failed! " + e.StackTrace);
                        this.Exit();
                        return;
                    }
                }
                else
                {
                    this.Exit();
                    return;
                }
            }

            kAccess = new KinectAccess(Content, GraphicsDevice);
            if (inputMode == InputMode.WAND)
            {
                wAccess     = new WiimoteAccess();
                lastWMState = wAccess.GetState();
            }

            Console.Out.WriteLine("We got here");
            wandCursor = new WandCursor(this, spriteBatch);

            camera           = new RotatingCamera(this, new Vector3(0, 50, 0), Vector3.Backward, Vector3.Up);
            camera.YRotation = 0;

            cloister = new Cloister(this, camera, Vector3.Zero);

            fillRaster          = new RasterizerState();
            fillRaster.FillMode = FillMode.Solid;
            fillRaster.CullMode = CullMode.CullClockwiseFace;
            wireRaster          = new RasterizerState();
            wireRaster.FillMode = FillMode.WireFrame;
            fillRaster.CullMode = CullMode.None;

            Door door = new Door(this, camera, new Vector3(32, 5.75f, -100), 0);

            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-47.5f, 5.75f, 185.5f), 0);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(31f, 5.75f, 185.5f), 0);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-245, 101.5f, 349), -MathHelper.PiOver2);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-374, 101.5f, 301.5f), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-374, 101.5f, 195), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-374, 101.5f, 88.5f), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-374, 101.5f, -120), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-374, 101.5f, -327), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-320.25f, 101.5f, -380.5f), MathHelper.PiOver2);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(-12, 101.5f, -380.5f), MathHelper.PiOver2);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(296, 101.5f, -380.5f), MathHelper.PiOver2);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(350, 101.5f, -428.5f), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(348.75f, 101.5f, -327), 0);
            door.scale = 10;
            doorList.Add(door);
            door       = new Door(this, camera, new Vector3(349.5f, 101.5f, 153.5f), MathHelper.Pi);
            door.scale = 10;
            doorList.Add(door);

            selDoor = doorList.Count - 1;
            Trial.InitializeFont(this);
        }
示例#10
0
 /// <summary>
 /// 按键延迟
 /// </summary>
 public void SetKeyboardDelay(InputMode mode, int delay)
 {
     win.Dmsoft.SetKeypadDelay(mode.ToString(), delay);
 }
示例#11
0
    public void SelectionHandler()
    {
        //MouseButtonDown will grab a node and highlight it
        Debug.Log(currentInputMode.ToString());
        switch (currentInputMode)
        {
        case InputMode.buildMode:
            if (Input.GetMouseButtonDown(0))
            {
                canPlaceObject = false;
                selectedNodesPos.Clear();
                camRay = Camera.main.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane));
                if (Physics.Raycast(camRay, out hitInfo))
                {
                    mouseToWorld = hitInfo.point;
                }
                startNode    = AstarPath.active.GetNearest(mouseToWorld).node;
                startNodePos = AstarPath.active.GetNearest(mouseToWorld).node.position;
                //Debug.Log("Start " + startNodePos.ToString());
            }
            else if (Input.GetMouseButton(0))
            {
                camRay = Camera.main.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane));
                if (Physics.Raycast(camRay, out hitInfo))
                {
                    mouseToWorld = hitInfo.point;
                }
                endNode    = AstarPath.active.GetNearest(mouseToWorld).node;
                endNodePos = AstarPath.active.GetNearest(mouseToWorld).node.position;
                CreateSelectionFromNodes();
                CheckObjectPlacement();
                //Debug.Log("End " + endNodePos.ToString());
            }
            else if (Input.GetMouseButtonUp(0))
            {
                PlaceBuildingInSelection();
                selectedNodesPos.Clear();
                canPlaceObject = false;
                //currentInputMode = InputMode.selectMode;
                //Debug.Log(selectedNodesPos.Count);
            }
            break;

        case InputMode.selectMode:
            break;
        }


        /*switch(currentInputMode)
         * {
         *  case InputMode.selectMode:
         *      GetBuildingUnderCursor();
         *      break;
         *
         *  case InputMode.buildMode:
         *      if (CheckIfObjectSelected())
         *      {
         *          GetBuildingUnderCursor();
         *          MoveObjectToCursor();
         *          canPlaceObject = CheckBuildingPlacement();
         *          PlaceBuilding();
         *      }
         *      break;
         *
         *  case InputMode.modifyMode:
         *      if (CheckIfObjectSelected())
         *      {
         *          GetBuildingUnderCursor();
         *          MoveModToBuilding();
         *          //canPlaceObject = CheckModPlacement();
         *          AttachMod();
         *      }
         *      break;
         *
         *  case InputMode.tileMode:
         *      break;
         * }*/
    }
示例#12
0
文件: Mouse.cs 项目: kaluluosi/Sugoi
 public void SetMouseDelay(InputMode mode, int delay)
 {
     win.Dmsoft.SetMouseDelay(mode.ToString(), delay);
 }
示例#13
0
 public void ChangeInputMode(InputMode targetMode)
 {
     Debug.Log("[GameManager]\tChanging mode from " + mode.ToString() + " to " + targetMode.ToString());
     previousMode = mode;
     mode         = targetMode;
 }